32 Gtk::Grid* newGrid =
new Gtk::Grid();
33 newGrid->set_halign(Gtk::Align::CENTER);
34 newGrid->set_valign(Gtk::Align::START);
35 newGrid->set_column_spacing(
SPACING);
36 newGrid->set_row_spacing(
SPACING);
39 int rows = std::ceil(((
float)arts.size())/((
float)cols));
41 for (
int i = 0; i < cols; i++) {
42 newGrid->insert_column(0);
45 for (
int i = 0; i < rows; i++) {
46 newGrid->insert_row(0);
50 for (
int i = 0; i < rows; i++) {
51 for (
int j = 0; j < cols; j++) {
52 if (((
unsigned long)((i * cols) + j)) == arts.size()) {
56 Gtk::Button* button = Gtk::make_managed<Gtk::Button>();
57 Gtk::Image* image = Gtk::make_managed<Gtk::Image>();
60 image->set(arts[(i * cols) + j].art);
61 button->set_has_frame(
false);
63 button->set_child(*image);
65 const std::string url = arts[(i * cols) + j].url;
66 button->signal_clicked().connect([
this,url]() {
70 newGrid->attach(*button, j, i);