if (zavai.app.visibility)
{
// Back
+ zavai.app.back();
} else {
// Close current app
Gdk.Window w = zavai.app.get_screen().get_active_window();
public void on_clicked()
{
- stderr.printf("COMMAND: %s\n", exec);
+ zavai.log.info("Run program: " + exec);
+ string[] args = exec.split(" ");
+ string[] args1 = new string[args.length + 1];
+ int cout = 0;
+ for (int cin = 0; cin < args.length; ++cin)
+ {
+ if (args[cin][0] == '%') continue;
+ args1[cout++] = args[cin];
+ }
+ args1[cout] = null;
+ Pid pid;
+ Process.spawn_async(
+ Environment.get_home_dir(),
+ args1,
+ null,
+ SpawnFlags.SEARCH_PATH,
+ null,
+ out pid);
}
}
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;
+
string pathname = zavai.config.homedir + "/" + file_info.get_name();
//stdout.printf("Load %s\n", pathname);
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) {
zavai.log.error("Not running launcher: " + e.message);
launcher = null;
}
-
+
if (launcher != null)
{
zavai.registry.register_applet("wm.launcher", launcher);