Merge lp:~sachinr/xpad/xpad-tray-config into lp:xpad
- xpad-tray-config
- Merge into trunk
Proposed by
Sachin Raut
Status: | Merged |
---|---|
Merged at revision: | 660 |
Proposed branch: | lp:~sachinr/xpad/xpad-tray-config |
Merge into: | lp:xpad |
Diff against target: |
388 lines (+174/-16) (has conflicts) 3 files modified
src/xpad-preferences.c (+44/-2) src/xpad-settings.c (+34/-2) src/xpad-tray.c (+96/-12) Text conflict in src/xpad-tray.c |
To merge this branch: | bzr merge lp:~sachinr/xpad/xpad-tray-config |
Related bugs: | |
Related blueprints: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Arthur Borsboom | Approve | ||
Review via email: mp+191013@code.launchpad.net |
Commit message
Description of the change
fixed Bug #304331: controlling right/left click on tray icon.
fixed Bug #345278: toggle on left mouse click.
To post a comment you must log in.
Revision history for this message
Arthur Borsboom (arthurborsboom) wrote : | # |
Revision history for this message
Arthur Borsboom (arthurborsboom) wrote : | # |
I have merged the changes in my development environment and fixed the conflicts.
Tested the four new options for the left-click behaviour and it seems to work nicely!
Good job.
I will merge this in the main branch.
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'src/xpad-preferences.c' | |||
2 | --- src/xpad-preferences.c 2008-09-21 00:03:40 +0000 | |||
3 | +++ src/xpad-preferences.c 2013-10-14 17:36:30 +0000 | |||
4 | @@ -39,6 +39,7 @@ | |||
5 | 39 | GtkWidget *editcheck; | 39 | GtkWidget *editcheck; |
6 | 40 | GtkWidget *stickycheck; | 40 | GtkWidget *stickycheck; |
7 | 41 | GtkWidget *confirmcheck; | 41 | GtkWidget *confirmcheck; |
8 | 42 | GtkWidget *trayconfigbox; | ||
9 | 42 | 43 | ||
10 | 43 | GtkWidget *textbutton; | 44 | GtkWidget *textbutton; |
11 | 44 | GtkWidget *backbutton; | 45 | GtkWidget *backbutton; |
12 | @@ -50,6 +51,7 @@ | |||
13 | 50 | guint notify_font_handler; | 51 | guint notify_font_handler; |
14 | 51 | guint notify_back_handler; | 52 | guint notify_back_handler; |
15 | 52 | guint notify_text_handler; | 53 | guint notify_text_handler; |
16 | 54 | guint notify_tray_handler; | ||
17 | 53 | guint font_handler; | 55 | guint font_handler; |
18 | 54 | guint back_handler; | 56 | guint back_handler; |
19 | 55 | guint text_handler; | 57 | guint text_handler; |
20 | @@ -58,6 +60,7 @@ | |||
21 | 58 | guint editcheck_handler; | 60 | guint editcheck_handler; |
22 | 59 | guint stickycheck_handler; | 61 | guint stickycheck_handler; |
23 | 60 | guint confirmcheck_handler; | 62 | guint confirmcheck_handler; |
24 | 63 | guint trayclick_handler; | ||
25 | 61 | }; | 64 | }; |
26 | 62 | 65 | ||
27 | 63 | static void change_edit_check (GtkToggleButton *button, XpadPreferences *pref); | 66 | static void change_edit_check (GtkToggleButton *button, XpadPreferences *pref); |
28 | @@ -68,12 +71,14 @@ | |||
29 | 68 | static void change_text_color (GtkColorButton *button, XpadPreferences *pref); | 71 | static void change_text_color (GtkColorButton *button, XpadPreferences *pref); |
30 | 69 | static void change_back_color (GtkColorButton *button, XpadPreferences *pref); | 72 | static void change_back_color (GtkColorButton *button, XpadPreferences *pref); |
31 | 70 | static void change_font_face (GtkFontButton *button, XpadPreferences *pref); | 73 | static void change_font_face (GtkFontButton *button, XpadPreferences *pref); |
32 | 74 | static void change_tray_click_configuration(GtkComboBox *box, XpadPreferences *pref); | ||
33 | 71 | static void notify_edit (XpadPreferences *pref); | 75 | static void notify_edit (XpadPreferences *pref); |
34 | 72 | static void notify_sticky (XpadPreferences *pref); | 76 | static void notify_sticky (XpadPreferences *pref); |
35 | 73 | static void notify_confirm (XpadPreferences *pref); | 77 | static void notify_confirm (XpadPreferences *pref); |
36 | 74 | static void notify_fontname (XpadPreferences *pref); | 78 | static void notify_fontname (XpadPreferences *pref); |
37 | 75 | static void notify_text_color (XpadPreferences *pref); | 79 | static void notify_text_color (XpadPreferences *pref); |
38 | 76 | static void notify_back_color (XpadPreferences *pref); | 80 | static void notify_back_color (XpadPreferences *pref); |
39 | 81 | static void notify_tray_click (XpadPreferences *pref); | ||
40 | 77 | static void xpad_preferences_finalize (GObject *object); | 82 | static void xpad_preferences_finalize (GObject *object); |
41 | 78 | static void xpad_preferences_response (GtkDialog *dialog, gint response); | 83 | static void xpad_preferences_response (GtkDialog *dialog, gint response); |
42 | 79 | 84 | ||
43 | @@ -112,7 +117,7 @@ | |||
44 | 112 | const gchar *fontname; | 117 | const gchar *fontname; |
45 | 113 | GtkStyle *style; | 118 | GtkStyle *style; |
46 | 114 | GtkWidget *label, *appearance_frame, *alignment, *appearance_vbox; | 119 | GtkWidget *label, *appearance_frame, *alignment, *appearance_vbox; |
48 | 115 | GtkWidget *options_frame, *options_vbox, *global_vbox; | 120 | GtkWidget *options_frame, *options_vbox, *global_vbox, *tray_config_vbox; |
49 | 116 | gchar *text; | 121 | gchar *text; |
50 | 117 | GtkSizeGroup *size_group_labels = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); | 122 | GtkSizeGroup *size_group_labels = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); |
51 | 118 | GtkRequisition req; | 123 | GtkRequisition req; |
52 | @@ -272,10 +277,28 @@ | |||
53 | 272 | "child", alignment, | 277 | "child", alignment, |
54 | 273 | NULL)); | 278 | NULL)); |
55 | 274 | 279 | ||
57 | 275 | 280 | tray_config_vbox = GTK_WIDGET (g_object_new (GTK_TYPE_VBOX, | |
58 | 281 | "homogeneous", FALSE, | ||
59 | 282 | "spacing", 6, | ||
60 | 283 | NULL)); | ||
61 | 284 | |||
62 | 285 | pref->priv->trayconfigbox = gtk_combo_box_new_text(); | ||
63 | 286 | gtk_combo_box_append_text( GTK_COMBO_BOX( pref->priv->trayconfigbox ), "Do Nothing" ); | ||
64 | 287 | gtk_combo_box_append_text( GTK_COMBO_BOX( pref->priv->trayconfigbox ), "Toggle Show All" ); | ||
65 | 288 | gtk_combo_box_append_text( GTK_COMBO_BOX( pref->priv->trayconfigbox ), "List of Pads" ); | ||
66 | 289 | gtk_combo_box_append_text( GTK_COMBO_BOX( pref->priv->trayconfigbox ), "New Pad" ); | ||
67 | 290 | gtk_combo_box_set_active( GTK_COMBO_BOX( pref->priv->trayconfigbox ), xpad_settings_get_tray_click_handler(xpad_settings())); | ||
68 | 291 | |||
69 | 292 | hbox = gtk_hbox_new(FALSE, 12); | ||
70 | 293 | label = gtk_label_new_with_mnemonic(_("Tray click behaviour")); | ||
71 | 294 | gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | ||
72 | 295 | gtk_box_pack_start(GTK_BOX(hbox), pref->priv->trayconfigbox, TRUE, TRUE, 0); | ||
73 | 296 | gtk_box_pack_start(GTK_BOX(tray_config_vbox), hbox, TRUE, TRUE, 0); | ||
74 | 297 | |||
75 | 276 | gtk_box_pack_start (GTK_BOX (options_vbox), pref->priv->editcheck, FALSE, FALSE, 0); | 298 | gtk_box_pack_start (GTK_BOX (options_vbox), pref->priv->editcheck, FALSE, FALSE, 0); |
76 | 277 | gtk_box_pack_start (GTK_BOX (options_vbox), pref->priv->stickycheck, FALSE, FALSE, 0); | 299 | gtk_box_pack_start (GTK_BOX (options_vbox), pref->priv->stickycheck, FALSE, FALSE, 0); |
77 | 278 | gtk_box_pack_start (GTK_BOX (options_vbox), pref->priv->confirmcheck, FALSE, FALSE, 0); | 300 | gtk_box_pack_start (GTK_BOX (options_vbox), pref->priv->confirmcheck, FALSE, FALSE, 0); |
78 | 301 | g_object_set (GTK_WIDGET(options_vbox), "child", tray_config_vbox, NULL); | ||
79 | 279 | 302 | ||
80 | 280 | global_vbox = g_object_new (GTK_TYPE_VBOX, | 303 | global_vbox = g_object_new (GTK_TYPE_VBOX, |
81 | 281 | "border-width", 6, | 304 | "border-width", 6, |
82 | @@ -295,12 +318,14 @@ | |||
83 | 295 | pref->priv->text_handler = g_signal_connect (pref->priv->textbutton, "color-set", G_CALLBACK (change_text_color), pref); | 318 | pref->priv->text_handler = g_signal_connect (pref->priv->textbutton, "color-set", G_CALLBACK (change_text_color), pref); |
84 | 296 | pref->priv->back_handler = g_signal_connect (pref->priv->backbutton, "color-set", G_CALLBACK (change_back_color), pref); | 319 | pref->priv->back_handler = g_signal_connect (pref->priv->backbutton, "color-set", G_CALLBACK (change_back_color), pref); |
85 | 297 | pref->priv->font_handler = g_signal_connect (pref->priv->fontbutton, "font-set", G_CALLBACK (change_font_face), pref); | 320 | pref->priv->font_handler = g_signal_connect (pref->priv->fontbutton, "font-set", G_CALLBACK (change_font_face), pref); |
86 | 321 | pref->priv->trayclick_handler = g_signal_connect(pref->priv->trayconfigbox, "changed", G_CALLBACK(change_tray_click_configuration), pref); | ||
87 | 298 | pref->priv->notify_font_handler = g_signal_connect_swapped (xpad_settings (), "notify::fontname", G_CALLBACK (notify_fontname), pref); | 322 | pref->priv->notify_font_handler = g_signal_connect_swapped (xpad_settings (), "notify::fontname", G_CALLBACK (notify_fontname), pref); |
88 | 299 | pref->priv->notify_text_handler = g_signal_connect_swapped (xpad_settings (), "notify::text-color", G_CALLBACK (notify_text_color), pref); | 323 | pref->priv->notify_text_handler = g_signal_connect_swapped (xpad_settings (), "notify::text-color", G_CALLBACK (notify_text_color), pref); |
89 | 300 | pref->priv->notify_back_handler = g_signal_connect_swapped (xpad_settings (), "notify::back-color", G_CALLBACK (notify_back_color), pref); | 324 | pref->priv->notify_back_handler = g_signal_connect_swapped (xpad_settings (), "notify::back-color", G_CALLBACK (notify_back_color), pref); |
90 | 301 | pref->priv->notify_sticky_handler = g_signal_connect_swapped (xpad_settings (), "notify::sticky", G_CALLBACK (notify_sticky), pref); | 325 | pref->priv->notify_sticky_handler = g_signal_connect_swapped (xpad_settings (), "notify::sticky", G_CALLBACK (notify_sticky), pref); |
91 | 302 | pref->priv->notify_edit_handler = g_signal_connect_swapped (xpad_settings (), "notify::edit-lock", G_CALLBACK (notify_edit), pref); | 326 | pref->priv->notify_edit_handler = g_signal_connect_swapped (xpad_settings (), "notify::edit-lock", G_CALLBACK (notify_edit), pref); |
92 | 303 | pref->priv->notify_confirm_handler = g_signal_connect_swapped (xpad_settings (), "notify::confirm-destroy", G_CALLBACK (notify_confirm), pref); | 327 | pref->priv->notify_confirm_handler = g_signal_connect_swapped (xpad_settings (), "notify::confirm-destroy", G_CALLBACK (notify_confirm), pref); |
93 | 328 | pref->priv->notify_tray_handler = g_signal_connect_swapped (xpad_settings (), "notify::tray_click_configuration", G_CALLBACK(notify_tray_click), pref); | ||
94 | 304 | 329 | ||
95 | 305 | g_object_unref (size_group_labels); | 330 | g_object_unref (size_group_labels); |
96 | 306 | 331 | ||
97 | @@ -394,6 +419,14 @@ | |||
98 | 394 | } | 419 | } |
99 | 395 | 420 | ||
100 | 396 | static void | 421 | static void |
101 | 422 | change_tray_click_configuration(GtkComboBox *box, XpadPreferences *pref) | ||
102 | 423 | { | ||
103 | 424 | g_signal_handler_block(xpad_settings(), pref->priv->notify_tray_handler); | ||
104 | 425 | xpad_settings_set_tray_click_handler(xpad_settings(), gtk_combo_box_get_active(box)); | ||
105 | 426 | g_signal_handler_unblock(xpad_settings(), pref->priv->notify_tray_handler); | ||
106 | 427 | } | ||
107 | 428 | |||
108 | 429 | static void | ||
109 | 397 | change_text_color (GtkColorButton *button, XpadPreferences *pref) | 430 | change_text_color (GtkColorButton *button, XpadPreferences *pref) |
110 | 398 | { | 431 | { |
111 | 399 | GdkColor color; | 432 | GdkColor color; |
112 | @@ -516,3 +549,12 @@ | |||
113 | 516 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->confirmcheck), xpad_settings_get_confirm_destroy (xpad_settings ())); | 549 | gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pref->priv->confirmcheck), xpad_settings_get_confirm_destroy (xpad_settings ())); |
114 | 517 | g_signal_handler_unblock (pref->priv->confirmcheck, pref->priv->confirmcheck_handler); | 550 | g_signal_handler_unblock (pref->priv->confirmcheck, pref->priv->confirmcheck_handler); |
115 | 518 | } | 551 | } |
116 | 552 | |||
117 | 553 | static void | ||
118 | 554 | notify_tray_click(XpadPreferences *pref) | ||
119 | 555 | { | ||
120 | 556 | g_signal_handler_block(pref->priv->trayconfigbox, pref->priv->trayclick_handler); | ||
121 | 557 | gtk_combo_box_set_active(GTK_COMBO_BOX(pref->priv->trayconfigbox), xpad_settings_get_tray_click_handler(xpad_settings())); | ||
122 | 558 | g_signal_handler_unblock(pref->priv->trayconfigbox, pref->priv->trayclick_handler); | ||
123 | 559 | } | ||
124 | 560 | |||
125 | 519 | 561 | ||
126 | === modified file 'src/xpad-settings.c' | |||
127 | --- src/xpad-settings.c 2013-10-07 20:07:46 +0000 | |||
128 | +++ src/xpad-settings.c 2013-10-14 17:36:30 +0000 | |||
129 | @@ -35,6 +35,7 @@ | |||
130 | 35 | gboolean confirm_destroy; | 35 | gboolean confirm_destroy; |
131 | 36 | gboolean edit_lock; | 36 | gboolean edit_lock; |
132 | 37 | gboolean sticky; | 37 | gboolean sticky; |
133 | 38 | guint tray_click_configuration; | ||
134 | 38 | gboolean has_toolbar; | 39 | gboolean has_toolbar; |
135 | 39 | gboolean autohide_toolbar; | 40 | gboolean autohide_toolbar; |
136 | 40 | gboolean has_scrollbar; | 41 | gboolean has_scrollbar; |
137 | @@ -59,6 +60,7 @@ | |||
138 | 59 | PROP_CONFIRM_DESTROY, | 60 | PROP_CONFIRM_DESTROY, |
139 | 60 | PROP_STICKY, | 61 | PROP_STICKY, |
140 | 61 | PROP_EDIT_LOCK, | 62 | PROP_EDIT_LOCK, |
141 | 63 | PROP_TRAY_CLICK_CONFIGURATION, | ||
142 | 62 | PROP_HAS_TOOLBAR, | 64 | PROP_HAS_TOOLBAR, |
143 | 63 | PROP_AUTOHIDE_TOOLBAR, | 65 | PROP_AUTOHIDE_TOOLBAR, |
144 | 64 | PROP_HAS_SCROLLBAR, | 66 | PROP_HAS_SCROLLBAR, |
145 | @@ -149,7 +151,15 @@ | |||
146 | 149 | "Whether edit lock mode is enabled", | 151 | "Whether edit lock mode is enabled", |
147 | 150 | FALSE, | 152 | FALSE, |
148 | 151 | G_PARAM_READWRITE)); | 153 | G_PARAM_READWRITE)); |
150 | 152 | 154 | g_object_class_install_property (gobject_class, | |
151 | 155 | PROP_TRAY_CLICK_CONFIGURATION, | ||
152 | 156 | g_param_spec_uint ("tray_click_configuration", | ||
153 | 157 | "Tray Click Configuration", | ||
154 | 158 | "What configuration is selected on tray click", | ||
155 | 159 | 0, | ||
156 | 160 | G_MAXUINT, | ||
157 | 161 | 2, | ||
158 | 162 | G_PARAM_READWRITE)); | ||
159 | 153 | g_object_class_install_property (gobject_class, | 163 | g_object_class_install_property (gobject_class, |
160 | 154 | PROP_HAS_TOOLBAR, | 164 | PROP_HAS_TOOLBAR, |
161 | 155 | g_param_spec_boolean ("has_toolbar", | 165 | g_param_spec_boolean ("has_toolbar", |
162 | @@ -239,6 +249,7 @@ | |||
163 | 239 | settings->priv->confirm_destroy = TRUE; | 249 | settings->priv->confirm_destroy = TRUE; |
164 | 240 | settings->priv->sticky = FALSE; | 250 | settings->priv->sticky = FALSE; |
165 | 241 | settings->priv->edit_lock = FALSE; | 251 | settings->priv->edit_lock = FALSE; |
166 | 252 | settings->priv->tray_click_configuration = 0; | ||
167 | 242 | settings->priv->fontname = NULL; | 253 | settings->priv->fontname = NULL; |
168 | 243 | settings->priv->has_toolbar = TRUE; | 254 | settings->priv->has_toolbar = TRUE; |
169 | 244 | settings->priv->autohide_toolbar = TRUE; | 255 | settings->priv->autohide_toolbar = TRUE; |
170 | @@ -350,6 +361,21 @@ | |||
171 | 350 | return settings->priv->edit_lock; | 361 | return settings->priv->edit_lock; |
172 | 351 | } | 362 | } |
173 | 352 | 363 | ||
174 | 364 | void xpad_settings_set_tray_click_handler (XpadSettings *settings, guint conf) | ||
175 | 365 | { | ||
176 | 366 | if (settings->priv->tray_click_configuration == conf) | ||
177 | 367 | return; | ||
178 | 368 | |||
179 | 369 | settings->priv->tray_click_configuration = conf; | ||
180 | 370 | save_to_file(settings, DEFAULTS_FILENAME); | ||
181 | 371 | g_object_notify (G_OBJECT (settings), "tray_click_configuration"); | ||
182 | 372 | } | ||
183 | 373 | |||
184 | 374 | guint xpad_settings_get_tray_click_handler(XpadSettings *settings) | ||
185 | 375 | { | ||
186 | 376 | return settings->priv->tray_click_configuration; | ||
187 | 377 | } | ||
188 | 378 | |||
189 | 353 | void xpad_settings_set_has_toolbar (XpadSettings *settings, gboolean toolbar) | 379 | void xpad_settings_set_has_toolbar (XpadSettings *settings, gboolean toolbar) |
190 | 354 | { | 380 | { |
191 | 355 | if (settings->priv->has_toolbar == toolbar) | 381 | if (settings->priv->has_toolbar == toolbar) |
192 | @@ -607,7 +633,11 @@ | |||
193 | 607 | case PROP_EDIT_LOCK: | 633 | case PROP_EDIT_LOCK: |
194 | 608 | xpad_settings_set_edit_lock (settings, g_value_get_boolean (value)); | 634 | xpad_settings_set_edit_lock (settings, g_value_get_boolean (value)); |
195 | 609 | break; | 635 | break; |
197 | 610 | 636 | ||
198 | 637 | case PROP_TRAY_CLICK_CONFIGURATION: | ||
199 | 638 | xpad_settings_set_tray_click_handler(settings, g_value_get_uint(value)); | ||
200 | 639 | break; | ||
201 | 640 | |||
202 | 611 | case PROP_HAS_TOOLBAR: | 641 | case PROP_HAS_TOOLBAR: |
203 | 612 | xpad_settings_set_has_toolbar (settings, g_value_get_boolean (value)); | 642 | xpad_settings_set_has_toolbar (settings, g_value_get_boolean (value)); |
204 | 613 | break; | 643 | break; |
205 | @@ -727,6 +757,7 @@ | |||
206 | 727 | "b|confirm_destroy", &settings->priv->confirm_destroy, | 757 | "b|confirm_destroy", &settings->priv->confirm_destroy, |
207 | 728 | "b|edit_lock", &settings->priv->edit_lock, | 758 | "b|edit_lock", &settings->priv->edit_lock, |
208 | 729 | "b|sticky_on_start", &settings->priv->sticky, | 759 | "b|sticky_on_start", &settings->priv->sticky, |
209 | 760 | "u|tray_click_configuration", &settings->priv->tray_click_configuration, | ||
210 | 730 | "h|back_red", &back.red, | 761 | "h|back_red", &back.red, |
211 | 731 | "h|back_green", &back.green, | 762 | "h|back_green", &back.green, |
212 | 732 | "h|back_blue", &back.blue, | 763 | "h|back_blue", &back.blue, |
213 | @@ -818,6 +849,7 @@ | |||
214 | 818 | "b|confirm_destroy", settings->priv->confirm_destroy, | 849 | "b|confirm_destroy", settings->priv->confirm_destroy, |
215 | 819 | "b|edit_lock", settings->priv->edit_lock, | 850 | "b|edit_lock", settings->priv->edit_lock, |
216 | 820 | "b|sticky_on_start", settings->priv->sticky, | 851 | "b|sticky_on_start", settings->priv->sticky, |
217 | 852 | "u|tray_click_configuration", settings->priv->tray_click_configuration, | ||
218 | 821 | "h|back_red", settings->priv->back ? settings->priv->back->red : 0, | 853 | "h|back_red", settings->priv->back ? settings->priv->back->red : 0, |
219 | 822 | "h|back_green", settings->priv->back ? settings->priv->back->green : 0, | 854 | "h|back_green", settings->priv->back ? settings->priv->back->green : 0, |
220 | 823 | "h|back_blue", settings->priv->back ? settings->priv->back->blue : 0, | 855 | "h|back_blue", settings->priv->back ? settings->priv->back->blue : 0, |
221 | 824 | 856 | ||
222 | === modified file 'src/xpad-tray.c' | |||
223 | --- src/xpad-tray.c 2013-10-09 14:46:10 +0000 | |||
224 | +++ src/xpad-tray.c 2013-10-14 17:36:30 +0000 | |||
225 | @@ -29,8 +29,23 @@ | |||
226 | 29 | #include "xpad-preferences.h" | 29 | #include "xpad-preferences.h" |
227 | 30 | #include "xpad-tray.h" | 30 | #include "xpad-tray.h" |
228 | 31 | 31 | ||
229 | 32 | enum | ||
230 | 33 | { | ||
231 | 34 | DO_NOTHING, | ||
232 | 35 | TOGGLE_SHOW_ALL, | ||
233 | 36 | LIST_OF_PADS, | ||
234 | 37 | NEW_PAD | ||
235 | 38 | }; | ||
236 | 39 | // tray icon left click handler | ||
237 | 32 | static void xpad_tray_activate_cb (GtkStatusIcon *icon); | 40 | static void xpad_tray_activate_cb (GtkStatusIcon *icon); |
238 | 41 | // tray icon right click handler | ||
239 | 33 | static void xpad_tray_popup_menu_cb (GtkStatusIcon *icon, guint button, guint time); | 42 | static void xpad_tray_popup_menu_cb (GtkStatusIcon *icon, guint button, guint time); |
240 | 43 | // "toggle show all" menu item handler | ||
241 | 44 | static void xpad_tray_show_hide_all (void); | ||
242 | 45 | // "show pads" menu item handler | ||
243 | 46 | static void xpad_tray_show_windows_list (GtkStatusIcon *icon); | ||
244 | 47 | // helper function to append pad window title as item to menu | ||
245 | 48 | static void xpad_tray_append_pad_window_titles_to_menu (GtkWidget *menu); | ||
246 | 34 | 49 | ||
247 | 35 | static GtkStatusIcon *docklet = NULL; | 50 | static GtkStatusIcon *docklet = NULL; |
248 | 36 | 51 | ||
249 | @@ -101,6 +116,25 @@ | |||
250 | 101 | g_slist_free (pads); | 116 | g_slist_free (pads); |
251 | 102 | } | 117 | } |
252 | 103 | 118 | ||
253 | 119 | static void | ||
254 | 120 | xpad_tray_show_hide_all (void) | ||
255 | 121 | { | ||
256 | 122 | GSList *pads = xpad_pad_group_get_pads (xpad_app_get_pad_group ()); | ||
257 | 123 | // find if any pad is visible | ||
258 | 124 | gboolean open = FALSE; | ||
259 | 125 | GSList *i; | ||
260 | 126 | for(i = pads; i != NULL; i = i->next) | ||
261 | 127 | { | ||
262 | 128 | if (gtk_widget_get_visible(GTK_WIDGET(i->data))) | ||
263 | 129 | { | ||
264 | 130 | open = TRUE; | ||
265 | 131 | break; | ||
266 | 132 | } | ||
267 | 133 | } | ||
268 | 134 | g_slist_foreach(pads, (GFunc) (open ? gtk_widget_hide : gtk_widget_show), NULL); | ||
269 | 135 | g_slist_free (pads); | ||
270 | 136 | } | ||
271 | 137 | |||
272 | 104 | static void | 138 | static void |
273 | 105 | menu_spawn (XpadPadGroup *group) | 139 | menu_spawn (XpadPadGroup *group) |
274 | 106 | { | 140 | { |
275 | @@ -112,11 +146,13 @@ | |||
276 | 112 | xpad_tray_popup_menu_cb (GtkStatusIcon *icon, guint button, guint time) | 146 | xpad_tray_popup_menu_cb (GtkStatusIcon *icon, guint button, guint time) |
277 | 113 | { | 147 | { |
278 | 114 | GtkWidget *menu, *item; | 148 | GtkWidget *menu, *item; |
282 | 115 | GSList *pads, *l; | 149 | GSList *pads; |
283 | 116 | gint n; | 150 | gboolean no_any_pad = FALSE; |
281 | 117 | |||
284 | 118 | menu = gtk_menu_new (); | 151 | menu = gtk_menu_new (); |
285 | 119 | pads = xpad_pad_group_get_pads (xpad_app_get_pad_group ()); | 152 | pads = xpad_pad_group_get_pads (xpad_app_get_pad_group ()); |
286 | 153 | if (!pads) | ||
287 | 154 | no_any_pad = TRUE; | ||
288 | 155 | g_slist_free (pads); | ||
289 | 120 | 156 | ||
290 | 121 | item = gtk_image_menu_item_new_from_stock (GTK_STOCK_NEW, NULL); | 157 | item = gtk_image_menu_item_new_from_stock (GTK_STOCK_NEW, NULL); |
291 | 122 | g_signal_connect_swapped (item, "activate", G_CALLBACK (menu_spawn), xpad_app_get_pad_group ()); | 158 | g_signal_connect_swapped (item, "activate", G_CALLBACK (menu_spawn), xpad_app_get_pad_group ()); |
292 | @@ -131,28 +167,72 @@ | |||
293 | 131 | g_signal_connect_swapped (item, "activate", G_CALLBACK (menu_show_all), xpad_app_get_pad_group ()); | 167 | g_signal_connect_swapped (item, "activate", G_CALLBACK (menu_show_all), xpad_app_get_pad_group ()); |
294 | 132 | gtk_container_add (GTK_CONTAINER (menu), item); | 168 | gtk_container_add (GTK_CONTAINER (menu), item); |
295 | 133 | gtk_widget_show (item); | 169 | gtk_widget_show (item); |
297 | 134 | if (!pads) | 170 | if (no_any_pad) |
298 | 135 | gtk_widget_set_sensitive (item, FALSE); | 171 | gtk_widget_set_sensitive (item, FALSE); |
299 | 136 | 172 | ||
300 | 137 | item = gtk_image_menu_item_new_with_mnemonic (_("_Close All")); | 173 | item = gtk_image_menu_item_new_with_mnemonic (_("_Close All")); |
301 | 138 | g_signal_connect_swapped (item, "activate", G_CALLBACK (xpad_pad_group_close_all), xpad_app_get_pad_group ()); | 174 | g_signal_connect_swapped (item, "activate", G_CALLBACK (xpad_pad_group_close_all), xpad_app_get_pad_group ()); |
302 | 139 | gtk_container_add (GTK_CONTAINER (menu), item); | 175 | gtk_container_add (GTK_CONTAINER (menu), item); |
303 | 140 | gtk_widget_show (item); | 176 | gtk_widget_show (item); |
305 | 141 | if (!pads) | 177 | if (no_any_pad) |
306 | 142 | gtk_widget_set_sensitive (item, FALSE); | 178 | gtk_widget_set_sensitive (item, FALSE); |
307 | 143 | 179 | ||
308 | 144 | item = gtk_separator_menu_item_new (); | 180 | item = gtk_separator_menu_item_new (); |
309 | 145 | gtk_container_add (GTK_CONTAINER (menu), item); | 181 | gtk_container_add (GTK_CONTAINER (menu), item); |
310 | 146 | gtk_widget_show (item); | 182 | gtk_widget_show (item); |
311 | 147 | 183 | ||
315 | 148 | /** | 184 | // append window titles |
316 | 149 | * Order pads according to title. | 185 | xpad_tray_append_pad_window_titles_to_menu (menu); |
317 | 150 | */ | 186 | |
318 | 187 | item = gtk_image_menu_item_new_from_stock (GTK_STOCK_PREFERENCES, NULL); | ||
319 | 188 | g_signal_connect (item, "activate", G_CALLBACK (xpad_preferences_open), NULL); | ||
320 | 189 | gtk_container_add (GTK_CONTAINER (menu), item); | ||
321 | 190 | gtk_widget_show (item); | ||
322 | 191 | |||
323 | 192 | item = gtk_image_menu_item_new_from_stock (GTK_STOCK_QUIT, NULL); | ||
324 | 193 | g_signal_connect (item, "activate", G_CALLBACK (gtk_main_quit), NULL); | ||
325 | 194 | gtk_container_add (GTK_CONTAINER (menu), item); | ||
326 | 195 | gtk_widget_show (item); | ||
327 | 196 | |||
328 | 197 | gtk_menu_popup (GTK_MENU (menu), NULL, NULL, gtk_status_icon_position_menu, icon, button, time); | ||
329 | 198 | } | ||
330 | 199 | |||
331 | 200 | static void | ||
332 | 201 | xpad_tray_activate_cb (GtkStatusIcon *icon) | ||
333 | 202 | { | ||
334 | 203 | switch (xpad_settings_get_tray_click_handler(xpad_settings())) | ||
335 | 204 | { | ||
336 | 205 | case TOGGLE_SHOW_ALL: | ||
337 | 206 | xpad_tray_show_hide_all(); | ||
338 | 207 | break; | ||
339 | 208 | case LIST_OF_PADS: | ||
340 | 209 | xpad_tray_show_windows_list(icon); | ||
341 | 210 | break; | ||
342 | 211 | case NEW_PAD: | ||
343 | 212 | menu_spawn(xpad_app_get_pad_group()); | ||
344 | 213 | break; | ||
345 | 214 | } | ||
346 | 215 | } | ||
347 | 216 | |||
348 | 217 | static void | ||
349 | 218 | xpad_tray_show_windows_list (GtkStatusIcon *icon) | ||
350 | 219 | { | ||
351 | 220 | GtkWidget* menu = gtk_menu_new (); | ||
352 | 221 | xpad_tray_append_pad_window_titles_to_menu (menu); | ||
353 | 222 | gtk_menu_popup (GTK_MENU (menu), NULL, NULL, gtk_status_icon_position_menu, icon, 0, gtk_get_current_event_time()); | ||
354 | 223 | } | ||
355 | 224 | |||
356 | 225 | static void | ||
357 | 226 | xpad_tray_append_pad_window_titles_to_menu (GtkWidget *menu) | ||
358 | 227 | { | ||
359 | 228 | GSList *pads, *l; | ||
360 | 229 | GtkWidget *item; | ||
361 | 230 | gint n; | ||
362 | 231 | |||
363 | 232 | pads = xpad_pad_group_get_pads (xpad_app_get_pad_group ()); | ||
364 | 233 | // Order pads according to title. | ||
365 | 151 | pads = g_slist_sort (pads, (GCompareFunc) menu_title_compare); | 234 | pads = g_slist_sort (pads, (GCompareFunc) menu_title_compare); |
370 | 152 | 235 | // Populate list of windows. | |
367 | 153 | /** | ||
368 | 154 | * Populate list of windows. | ||
369 | 155 | */ | ||
371 | 156 | for (l = pads, n = 1; l; l = l->next, n++) | 236 | for (l = pads, n = 1; l; l = l->next, n++) |
372 | 157 | { | 237 | { |
373 | 158 | gchar *title; | 238 | gchar *title; |
374 | @@ -174,6 +254,7 @@ | |||
375 | 174 | g_free (title); | 254 | g_free (title); |
376 | 175 | } | 255 | } |
377 | 176 | g_slist_free (pads); | 256 | g_slist_free (pads); |
378 | 257 | <<<<<<< TREE | ||
379 | 177 | 258 | ||
380 | 178 | if (pads) | 259 | if (pads) |
381 | 179 | { | 260 | { |
382 | @@ -203,3 +284,6 @@ | |||
383 | 203 | g_slist_free (pads); | 284 | g_slist_free (pads); |
384 | 204 | } | 285 | } |
385 | 205 | 286 | ||
386 | 287 | ======= | ||
387 | 288 | } | ||
388 | 289 | >>>>>>> MERGE-SOURCE |
Hi Sachin,
Thanks for proposing your code for merging. I would like to finish my
current work first (garbage collection with the two bugs). Once the
"garbage counter" is at 0, and the application is still working, I will
upload my code and start merging yours in the main branch, ok?
Some introduction from my side:
I'm Dutch (= The Netherlands), 34 years old, male (duhh), and currently
travelling through South-America by bike. Well, travelling, I am staying in
a nice appartment in Lima, right now. :)
How's life coping for you? You are Indian, am I right?
On 14 October 2013 12:37, Sachin Raut <email address hidden> wrote:
> Sachin Raut has proposed merging lp:~sachinr/xpad/xpad-tray-config into /bugs.launchpad .net/xpad/ +bug/304331 /bugs.launchpad .net/xpad/ +bug/345278 /code.launchpad .net/~sachinr/ xpad/xpad- tray-config/ +merge/ 191013 /code.launchpad .net/~sachinr/ xpad/xpad- tray-config/ +merge/ 191013 preferences. c' preferences. c 2008-09-21 00:03:40 +0000 preferences. c 2013-10-14 17:36:30 +0000 font_handler; back_handler; text_handler; tray_handler; handler; handler; tray_click_ configuration( GtkComboBox *box, s_finalize (GObject *object); s_response (GtkDialog *dialog, gint response);
> lp:xpad.
>
> Requested reviews:
> Xpad Administrators (xpad-team)
> Related bugs:
> Bug #304331 in Xpad: "controlling right/left click on tray icon"
> https:/
> Bug #345278 in Xpad: "toggle on left mouse click"
> https:/
>
> For more details, see:
> https:/
>
> fixed Bug #304331: controlling right/left click on tray icon.
> fixed Bug #345278: toggle on left mouse click.
> --
> https:/
> You are subscribed to branch lp:xpad.
>
> === modified file 'src/xpad-
> --- src/xpad-
> +++ src/xpad-
> @@ -39,6 +39,7 @@
> GtkWidget *editcheck;
> GtkWidget *stickycheck;
> GtkWidget *confirmcheck;
> + GtkWidget *trayconfigbox;
>
> GtkWidget *textbutton;
> GtkWidget *backbutton;
> @@ -50,6 +51,7 @@
> guint notify_
> guint notify_
> guint notify_
> + guint notify_
> guint font_handler;
> guint back_handler;
> guint text_handler;
> @@ -58,6 +60,7 @@
> guint editcheck_handler;
> guint stickycheck_
> guint confirmcheck_
> + guint trayclick_handler;
> };
>
> static void change_edit_check (GtkToggleButton *button, XpadPreferences
> *pref);
> @@ -68,12 +71,14 @@
> static void change_text_color (GtkColorButton *button, XpadPreferences
> *pref);
> static void change_back_color (GtkColorButton *button, XpadPreferences
> *pref);
> static void change_font_face (GtkFontButton *button, XpadPreferences
> *pref);
> +static void change_
> XpadPreferences *pref);
> static void notify_edit (XpadPreferences *pref);
> static void notify_sticky (XpadPreferences *pref);
> static void notify_confirm (XpadPreferences *pref);
> static void notify_fontname (XpadPreferences *pref);
> static void notify_text_color (XpadPreferences *pref);
> static void notify_back_color (XpadPreferences *pref);
> +static void notify_tray_click (XpadPreferences *pref);
> static void xpad_preference
> static void xpad_preference
>
> @@ -112,7 +117,7 @@
> const gchar *fo...