Sophie

Sophie

distrib > Mandriva > 2010.2 > i586 > media > main-backports-src > by-pkgid > 2f919d9249118e356bfa4acb219ef43f > files > 2

lxpanel-0.5.6-11mdv2010.2.src.rpm

Description: Add configuration for desktop number for the pager plugin.
Bug-Debian: http://bugs.debian.org/608421
Author: Julien Lavergne <gilir@ubuntu.com>

--- lxpanel-0.5.6.orig/src/plugins/pager.c
+++ lxpanel-0.5.6/src/plugins/pager.c
@@ -775,6 +775,80 @@ static void pager_destructor(Plugin * p)
     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)
 {
@@ -800,7 +874,7 @@ PluginClass pager_plugin_class = {
 
     constructor : pager_constructor,
     destructor  : pager_destructor,
-    config : NULL,
+    config : deskno_configure,
     save : NULL,
     panel_configuration_changed : pager_panel_configuration_changed
 };