Rediffing default-config.patch with common diff options.
[debian/lxpanel.git] / debian / patches / configure_desktop_number.patch
1 Description: Add configuration for desktop number for the pager plugin.
2 Author: Julien Lavergne <gilir@ubuntu.com>
3
4 --- a/src/plugins/pager.c
5 +++ b/src/plugins/pager.c
6 @@ -811,6 +811,80 @@
7      g_free(pg);
8  }
9  
10 +/* Callback when the configuration dialog is to be shown. */
11 +static void deskno_configure(Plugin * p, GtkWindow * parent)
12 +{
13 +
14 +    GdkScreen *screen = gdk_screen_get_default();
15 +    const char *wm_name = gdk_x11_screen_get_window_manager_name(screen);
16 +    GError *error = NULL;
17 +    const gchar *command_line = NULL;
18 +
19 +    if(g_strcmp0(wm_name, "Openbox") == 0)
20 +    {
21 +        if (g_find_program_in_path("obconf"))
22 +        {
23 +            command_line = "obconf --tab 6";
24 +        }
25 +    }
26 +    else if (g_strcmp0(wm_name, "compiz") == 0)
27 +    {
28 +         if (g_find_program_in_path("ccsm"))
29 +         {
30 +              command_line = "ccsm";
31 +
32 +         }
33 +         else if (g_find_program_in_path("simple-ccsm"))
34 +         {
35 +              command_line = "simple-ccsm";
36 +         }
37 +    }
38 +    else
39 +    {
40 +    
41 +        GtkWidget* msg;
42 +
43 +        msg = gtk_message_dialog_new( NULL, 
44 +                                      0, 
45 +                                      GTK_MESSAGE_ERROR, 
46 +                                      GTK_BUTTONS_OK, 
47 +                                      _("Error, only openbox and compiz are supported") );
48 +        gtk_dialog_run( GTK_DIALOG(msg) );
49 +        gtk_widget_destroy( msg );
50 +    
51 +    }
52 +
53 +    if (command_line)
54 +    {
55 +        gdk_spawn_command_line_on_screen(screen,
56 +                                         command_line,
57 +                                         &error);
58 +    }
59 +
60 +    else
61 +    {
62 +    
63 +        GtkWidget* msg;
64 +
65 +        msg = gtk_message_dialog_new( NULL, 
66 +                                      0, 
67 +                                      GTK_MESSAGE_ERROR, 
68 +                                      GTK_BUTTONS_OK, 
69 +                                      _("Error, you need to install obconf, ccsm of simple-ccsm") );
70 +        gtk_dialog_run( GTK_DIALOG(msg) );
71 +        gtk_widget_destroy( msg );
72 +    
73 +    }
74 +
75 +       if (error)
76 +       {
77 +           g_print("%s\n", error->message);
78 +               
79 +               g_free (error);
80 +    }
81 +
82 +}
83 +
84  /* Callback when panel configuration changes. */
85  static void pager_panel_configuration_changed(Plugin * p)
86  {
87 @@ -836,7 +910,7 @@
88  
89      constructor : pager_constructor,
90      destructor  : pager_destructor,
91 -    config : NULL,
92 +    config : deskno_configure,
93      save : NULL,
94      panel_configuration_changed : pager_panel_configuration_changed
95  };