Description: Add configuration for desktop number for the pager plugin. Author: Julien Lavergne --- a/src/plugins/pager.c +++ b/src/plugins/pager.c @@ -811,6 +811,80 @@ g_free(pg); } +/* Callback when the configuration dialog is to be shown. */ +static void deskno_configure(Plugin * p, GtkWindow * parent) +{ + + GdkScreen *screen = gdk_screen_get_default(); + const char *wm_name = gdk_x11_screen_get_window_manager_name(screen); + GError *error = NULL; + const gchar *command_line = NULL; + + if(g_strcmp0(wm_name, "Openbox") == 0) + { + if (g_find_program_in_path("obconf")) + { + command_line = "obconf"; + } + } + else if (g_strcmp0(wm_name, "compiz") == 0) + { + if (g_find_program_in_path("ccsm")) + { + command_line = "ccsm"; + + } + else if (g_find_program_in_path("simple-ccsm")) + { + command_line = "simple-ccsm"; + } + } + else + { + + GtkWidget* msg; + + msg = gtk_message_dialog_new( NULL, + 0, + GTK_MESSAGE_ERROR, + GTK_BUTTONS_OK, + _("Error, only openbox and compiz are supported") ); + gtk_dialog_run( GTK_DIALOG(msg) ); + gtk_widget_destroy( msg ); + + } + + if (command_line) + { + gdk_spawn_command_line_on_screen(screen, + command_line, + &error); + } + + else + { + + GtkWidget* msg; + + msg = gtk_message_dialog_new( NULL, + 0, + GTK_MESSAGE_ERROR, + GTK_BUTTONS_OK, + _("Error, you need to install obconf, ccsm of simple-ccsm") ); + gtk_dialog_run( GTK_DIALOG(msg) ); + gtk_widget_destroy( msg ); + + } + + if (error) + { + g_print("%s\n", error->message); + + g_free (error); + } + +} + /* Callback when panel configuration changes. */ static void pager_panel_configuration_changed(Plugin * p) { @@ -836,7 +910,7 @@ constructor : pager_constructor, destructor : pager_destructor, - config : NULL, + config : deskno_configure, save : NULL, panel_configuration_changed : pager_panel_configuration_changed };