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