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