FileInfo file_info;
var icon_theme = Gtk.IconTheme.get_default();
+ Gee.ArrayList<LauncherButton> buttons = new Gee.ArrayList<LauncherButton>();
while ((file_info = enumerator.next_file(null)) != null)
{
if (!file_info.get_name().has_suffix(".desktop")) continue;
zavai.log.error("Skipping icon " + icon + ": " + e.message);
}
}
- pack_start(button, false, false, 0);
+ buttons.add(button);
}
+ // Create the table with the launcher buttons
+ uint ROWMAX = 5; // Maximum number of rows
+ uint cols = 1 + (buttons.size + 1) / ROWMAX; // ceil(size/ROWMAX)
+ uint rows = (buttons.size + 1) / cols; // ceil(size/cols)
+ var table = new Gtk.Table(rows, cols, true);
+
+ // Attach the buttons in the table
+ uint row = 0;
+ uint col = 0;
+ foreach (LauncherButton b in buttons)
+ {
+ table.attach(b, col, col+1, row, row+1,
+ Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL,
+ Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL,
+ 0, 0);
+ ++col;
+ if (col == cols)
+ {
+ col = 0;
+ ++row;
+ }
+ }
+
+ pack_start(table, true, true, 0);
+
/*
try {
} catch (Error e) {