Merge lp:~jconti/indicator-applet/gnome3 into lp:indicator-applet/0.4
- gnome3
- Merge into applet
Status: | Superseded | ||||
---|---|---|---|---|---|
Proposed branch: | lp:~jconti/indicator-applet/gnome3 | ||||
Merge into: | lp:indicator-applet/0.4 | ||||
Diff against target: |
1835 lines (+732/-741) 8 files modified
.bzrignore (+3/-0) configure.ac (+13/-8) data/Makefile.am (+1/-1) src/Makefile.am (+8/-0) src/applet-main.c (+694/-718) src/eggaccelerators.c (+9/-9) src/eggaccelerators.h (+1/-1) src/tomboykeybinder.c (+3/-4) |
||||
To merge this branch: | bzr merge lp:~jconti/indicator-applet/gnome3 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Sebastian Geiger (community) | code review and test | Approve | |
Ted Gould (community) | Approve | ||
Marco Trevisan (Treviño) | Approve | ||
Dmitry Shachnev | Approve | ||
Review via email: mp+80877@code.launchpad.net |
This proposal has been superseded by a proposal from 2012-02-07.
Commit message
Description of the change
It looks like this branch is the only code base that works with GNOME3. Someone should take the responsibility to merge it and to make a new official release of it.
Without this release, the package is going to be dropped from Debian testing (unless we decide to package this branch directly, but it would be weird to have to do that...).
I put Ted as reviewer since he's the only upstream person that has worked on a port.
Sebastien Bacher (seb128) wrote : | # |
Thanks for the work there, the people working on this code are at the ubuntu summit this week so it might take a few extra fays before getting a review but it's on the list of things to review
Jason Conti (jconti) wrote : | # |
I unfortunately converted the tabs to spaces in src/applet-main.c, which makes the diff kind of ugly, so I did the same with Ted's branch and posted a slightly better diff here: http://
It is worth noting that I took a look at Ted's branch after seeing the merge proposal, and it appears to work correctly with just the updated configure.ac, data/Makefile.am and src/tomboykeybi
Dmitry Shachnev (mitya57) wrote : | # |
@Jason: I've updated indicator-session package in my ppa (it's now based on 0.7.3.1), can you please copy it to yours?
Marco Trevisan (Treviño) (3v1n0) wrote : | # |
Missing support for secondary-activate event (i.e. middle-click) and I'd suggest to use something like the indicator-priority that we used in unity-panel-service to show some app-indicators (like bluetooth, keyboard and network ones) in the proper place.
For the rest, it seems good.
- 405. By Jason Conti
-
Add indicator secondary-activate signal
- 406. By Jason Conti
-
* Prepare indicator_order array for name-hints.
* Clean up menuitem data:
- Remove old "indicator" data
- Add new definitions for box and secondary-activate signal data - 407. By Jason Conti
-
* Refactor place_in_menu into a separate function using place_in_menu_cb.
* If an entry has name-hint, it is used to position the entry. - 408. By Jason Conti
-
Bump version to 0.4.14
Jason Conti (jconti) wrote : | # |
Added secondary-activate signal and name-hint for positioning support. I'll update the ppa tomorrow for testing.
Marco Trevisan (Treviño) (3v1n0) wrote : | # |
Code looks good. Thanks.
I've also planned to make the indicator order configurable via gsettings, so stay tuned on this side.
Ted Gould (ted) wrote : | # |
Great, thanks for the work on this. A few comments:
* Please don't change the version number in configure.ac, it really confuses things if there are multiple version numbers in "the wild" so it's better just to have one place define it. I'll fix this on merge, no worries there.
* Love that you changed the strings to #defines. I think that's a wonderful thing :-)
Thanks again for your work.
Sebastian Geiger (lanoxx) wrote : | # |
This was approved by Marco and Ted back in November, but the merge status is still set to 'Needs Review' could some body please update the status and tell if this is going to be merge upstream?
I also reviewed the code and can approve it. And also the ppa works on my oneric installation right now.
Unmerged revisions
- 408. By Jason Conti
-
Bump version to 0.4.14
- 407. By Jason Conti
-
* Refactor place_in_menu into a separate function using place_in_menu_cb.
* If an entry has name-hint, it is used to position the entry. - 406. By Jason Conti
-
* Prepare indicator_order array for name-hints.
* Clean up menuitem data:
- Remove old "indicator" data
- Add new definitions for box and secondary-activate signal data - 405. By Jason Conti
-
Add indicator secondary-activate signal
- 404. By Jason Conti
-
Bump version to 0.4.13
- 403. By Jason Conti
-
Missed a dollar sign in configure.ac.
- 402. By Jason Conti
-
Drop the default css code, it seems to be causing theming issues in the about
dialog when using the Ambiance theme. - 401. By Jason Conti
-
Forgot to update the location of the applets.
- 400. By Jason Conti
-
Updated indicator_order to match the order in unity-panel-
service. - 399. By Jason Conti
-
Dropped menubar_on_expose and cw_panel_
background_ changed, I'm not sure they
are necessary anymore (the indicator applet seems to respond correctly to
changes in the panel background).
Preview Diff
1 | === modified file '.bzrignore' |
2 | --- .bzrignore 2010-04-27 22:02:51 +0000 |
3 | +++ .bzrignore 2011-11-26 02:05:26 +0000 |
4 | @@ -4,8 +4,11 @@ |
5 | data/GNOME_IndicatorApplet.server |
6 | data/GNOME_IndicatorApplet.server.in |
7 | data/indicator-applet.schemas |
8 | +data/*.panel-applet |
9 | +data/*.service |
10 | po/@GETTEXT_PACKAGE@.pot |
11 | po/indicator-applet.pot |
12 | +po/*.gmo |
13 | src/indicator-applet |
14 | dbus-indicate-client.h |
15 | dbus-indicate-server.h |
16 | |
17 | === modified file 'configure.ac' |
18 | --- configure.ac 2011-04-15 02:32:33 +0000 |
19 | +++ configure.ac 2011-11-26 02:05:26 +0000 |
20 | @@ -4,7 +4,7 @@ |
21 | AC_PREREQ(2.53) |
22 | |
23 | AM_CONFIG_HEADER(config.h) |
24 | -AM_INIT_AUTOMAKE(indicator-applet, 0.4.12) |
25 | +AM_INIT_AUTOMAKE(indicator-applet, 0.4.14) |
26 | |
27 | AM_MAINTAINER_MODE |
28 | m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES]) |
29 | @@ -25,13 +25,15 @@ |
30 | # Dependencies |
31 | ########################### |
32 | |
33 | -GTK_REQUIRED_VERSION=2.12 |
34 | -INDICATOR_REQUIRED_VERSION=0.3.22 |
35 | +GTK_REQUIRED_VERSION=3.1 |
36 | +INDICATOR_REQUIRED_VERSION=0.3.92 |
37 | +INDICATOR_PKG=indicator3-0.4 |
38 | +APPLET_PKG=libpanelapplet-4.0 |
39 | |
40 | -PKG_CHECK_MODULES(APPLET, gtk+-2.0 >= $GTK_REQUIRED_VERSION |
41 | +PKG_CHECK_MODULES(APPLET, gtk+-3.0 >= $GTK_REQUIRED_VERSION |
42 | x11 |
43 | - libpanelapplet-3.0 |
44 | - indicator >= $INDICATOR_REQUIRED_VERSION) |
45 | + $APPLET_PKG |
46 | + $INDICATOR_PKG >= $INDICATOR_REQUIRED_VERSION) |
47 | AC_SUBST(APPLET_CFLAGS) |
48 | AC_SUBST(APPLET_LIBS) |
49 | |
50 | @@ -47,13 +49,16 @@ |
51 | ########################### |
52 | |
53 | if test "x$with_localinstall" = "xyes"; then |
54 | + APPLETDIR="${datadir}/gnome-panel/applets/" |
55 | INDICATORDIR="${libdir}/indicators/2/" |
56 | INDICATORICONSDIR="${datadir}/indicator-applet/icons/" |
57 | else |
58 | - INDICATORDIR=`$PKG_CONFIG --variable=indicatordir indicator` |
59 | - INDICATORICONSDIR=`$PKG_CONFIG --variable=iconsdir indicator` |
60 | + APPLETDIR=`$PKG_CONFIG --variable=libpanel_applet_dir $APPLET_PKG` |
61 | + INDICATORDIR=`$PKG_CONFIG --variable=indicatordir $INDICATOR_PKG` |
62 | + INDICATORICONSDIR=`$PKG_CONFIG --variable=iconsdir $INDICATOR_PKG` |
63 | fi |
64 | |
65 | +AC_SUBST(APPLETDIR) |
66 | AC_SUBST(INDICATORDIR) |
67 | AC_SUBST(INDICATORICONSDIR) |
68 | |
69 | |
70 | === modified file 'data/Makefile.am' |
71 | --- data/Makefile.am 2010-11-10 18:28:18 +0000 |
72 | +++ data/Makefile.am 2011-11-26 02:05:26 +0000 |
73 | @@ -4,7 +4,7 @@ |
74 | # Applets |
75 | ############################## |
76 | |
77 | -appletdir = $(datadir)/gnome-panel/applets |
78 | +appletdir = $(APPLETDIR) |
79 | applet_in_files = \ |
80 | org.ayatana.panel.IndicatorApplet.panel-applet.in \ |
81 | org.ayatana.panel.IndicatorAppletComplete.panel-applet.in \ |
82 | |
83 | === modified file 'src/Makefile.am' |
84 | --- src/Makefile.am 2010-04-26 15:21:06 +0000 |
85 | +++ src/Makefile.am 2011-11-26 02:05:26 +0000 |
86 | @@ -11,6 +11,8 @@ |
87 | -DINDICATOR_DIR=\""$(INDICATORDIR)"\" \ |
88 | -DINDICATOR_ICONS_DIR=\""$(INDICATORICONSDIR)"\" \ |
89 | -DINDICATOR_APPLET \ |
90 | + -DGDK_DISABLE_DEPRECATED \ |
91 | + -DGTK_DISABLE_DEPRECATED \ |
92 | -I$(srcdir)/.. \ |
93 | $(APPLET_CFLAGS) |
94 | |
95 | @@ -30,6 +32,8 @@ |
96 | -DINDICATOR_DIR=\""$(INDICATORDIR)"\" \ |
97 | -DINDICATOR_ICONS_DIR=\""$(INDICATORICONSDIR)"\" \ |
98 | -DINDICATOR_APPLET_APPMENU \ |
99 | + -DGDK_DISABLE_DEPRECATED \ |
100 | + -DGTK_DISABLE_DEPRECATED \ |
101 | -I$(srcdir)/.. \ |
102 | $(APPLET_CFLAGS) |
103 | |
104 | @@ -49,6 +53,8 @@ |
105 | -DINDICATOR_DIR=\""$(INDICATORDIR)"\" \ |
106 | -DINDICATOR_ICONS_DIR=\""$(INDICATORICONSDIR)"\" \ |
107 | -DINDICATOR_APPLET_SESSION \ |
108 | + -DGDK_DISABLE_DEPRECATED \ |
109 | + -DGTK_DISABLE_DEPRECATED \ |
110 | -I$(srcdir)/.. \ |
111 | $(APPLET_CFLAGS) |
112 | |
113 | @@ -68,6 +74,8 @@ |
114 | -DINDICATOR_DIR=\""$(INDICATORDIR)"\" \ |
115 | -DINDICATOR_ICONS_DIR=\""$(INDICATORICONSDIR)"\" \ |
116 | -DINDICATOR_APPLET_COMPLETE \ |
117 | + -DGDK_DISABLE_DEPRECATED \ |
118 | + -DGTK_DISABLE_DEPRECATED \ |
119 | -I$(srcdir)/.. \ |
120 | $(APPLET_CFLAGS) |
121 | |
122 | |
123 | === modified file 'src/applet-main.c' |
124 | --- src/applet-main.c 2011-04-13 16:22:14 +0000 |
125 | +++ src/applet-main.c 2011-11-26 02:05:26 +0000 |
126 | @@ -30,31 +30,36 @@ |
127 | #include "libindicator/indicator-object.h" |
128 | #include "tomboykeybinder.h" |
129 | |
130 | -static gchar * indicator_order[] = { |
131 | - "libapplication.so", |
132 | - "libsoundmenu.so", |
133 | - "libmessaging.so", |
134 | - "libdatetime.so", |
135 | - "libme.so", |
136 | - "libsession.so", |
137 | - NULL |
138 | +static gchar * indicator_order[][2] = { |
139 | + {"libappmenu.so", NULL}, |
140 | + {"libapplication.so", NULL}, |
141 | + {"libapplication.so", "gst-keyboard-xkb"}, |
142 | + {"libmessaging.so", NULL}, |
143 | + {"libpower.so", NULL}, |
144 | + {"libapplication.so", "bluetooth-manager"}, |
145 | + {"libnetwork.so", NULL}, |
146 | + {"libnetworkmenu.so", NULL}, |
147 | + {"libapplication.so", "nm-applet"}, |
148 | + {"libsoundmenu.so", NULL}, |
149 | + {"libdatetime.so", NULL}, |
150 | + {"libsession.so", NULL}, |
151 | + {NULL, NULL} |
152 | }; |
153 | |
154 | static GtkPackDirection packdirection; |
155 | static PanelAppletOrient orient; |
156 | |
157 | +#define MENU_DATA_BOX "box" |
158 | #define MENU_DATA_INDICATOR_OBJECT "indicator-object" |
159 | #define MENU_DATA_INDICATOR_ENTRY "indicator-entry" |
160 | +#define MENU_DATA_IN_MENUITEM "in-menuitem" |
161 | +#define MENU_DATA_MENUITEM_PRESSED "menuitem-pressed" |
162 | |
163 | +#define IO_DATA_NAME "indicator-name" |
164 | #define IO_DATA_ORDER_NUMBER "indicator-order-number" |
165 | |
166 | -static gboolean applet_fill_cb (PanelApplet * applet, const gchar * iid, gpointer data); |
167 | +static gboolean applet_fill_cb (PanelApplet * applet, const gchar * iid, gpointer data); |
168 | |
169 | -static void cw_panel_background_changed (PanelApplet *applet, |
170 | - PanelAppletBackgroundType type, |
171 | - GdkColor *colour, |
172 | - GdkPixmap *pixmap, |
173 | - GtkWidget *menubar); |
174 | static void update_accessible_desc (IndicatorObjectEntry * entry, GtkWidget * menuitem); |
175 | |
176 | /************* |
177 | @@ -64,25 +69,21 @@ |
178 | #ifdef INDICATOR_APPLET |
179 | PANEL_APPLET_OUT_PROCESS_FACTORY ("IndicatorAppletFactory", |
180 | PANEL_TYPE_APPLET, |
181 | - "indicator-applet", |
182 | applet_fill_cb, NULL); |
183 | #endif |
184 | #ifdef INDICATOR_APPLET_SESSION |
185 | PANEL_APPLET_OUT_PROCESS_FACTORY ("FastUserSwitchAppletFactory", |
186 | PANEL_TYPE_APPLET, |
187 | - "indicator-applet-session", |
188 | applet_fill_cb, NULL); |
189 | #endif |
190 | #ifdef INDICATOR_APPLET_COMPLETE |
191 | PANEL_APPLET_OUT_PROCESS_FACTORY ("IndicatorAppletCompleteFactory", |
192 | PANEL_TYPE_APPLET, |
193 | - "indicator-applet-complete", |
194 | applet_fill_cb, NULL); |
195 | #endif |
196 | #ifdef INDICATOR_APPLET_APPMENU |
197 | PANEL_APPLET_OUT_PROCESS_FACTORY ("IndicatorAppletAppmenuFactory", |
198 | PANEL_TYPE_APPLET, |
199 | - "indicator-applet-appmenu", |
200 | applet_fill_cb, NULL); |
201 | #endif |
202 | |
203 | @@ -101,7 +102,7 @@ |
204 | #ifdef INDICATOR_APPLET_APPMENU |
205 | #define LOG_FILE_NAME "indicator-applet-appmenu.log" |
206 | #endif |
207 | -GOutputStream * log_file = NULL; |
208 | +static FILE *log_file = NULL; |
209 | |
210 | /***************** |
211 | * Hotkey support |
212 | @@ -136,34 +137,31 @@ |
213 | #endif |
214 | |
215 | static const gchar * indicator_env[] = { |
216 | - "indicator-applet", |
217 | - INDICATOR_SPECIFIC_ENV, |
218 | - NULL |
219 | + "indicator-applet", |
220 | + INDICATOR_SPECIFIC_ENV, |
221 | + NULL |
222 | }; |
223 | |
224 | -/************* |
225 | - * init function |
226 | - * ***********/ |
227 | - |
228 | static gint |
229 | -name2order (const gchar * name) { |
230 | - int i; |
231 | - |
232 | - for (i = 0; indicator_order[i] != NULL; i++) { |
233 | - if (g_strcmp0(name, indicator_order[i]) == 0) { |
234 | - return i; |
235 | - } |
236 | - } |
237 | - |
238 | - return -1; |
239 | +name2order (const gchar * name, const gchar * hint) { |
240 | + int i; |
241 | + |
242 | + for (i = 0; indicator_order[i][0] != NULL; i++) { |
243 | + if (g_strcmp0(name, indicator_order[i][0]) == 0 && |
244 | + g_strcmp0(hint, indicator_order[i][1]) == 0) { |
245 | + return i; |
246 | + } |
247 | + } |
248 | + |
249 | + return -1; |
250 | } |
251 | |
252 | typedef struct _incoming_position_t incoming_position_t; |
253 | struct _incoming_position_t { |
254 | - gint objposition; |
255 | - gint entryposition; |
256 | - gint menupos; |
257 | - gboolean found; |
258 | + gint objposition; |
259 | + gint entryposition; |
260 | + gint menupos; |
261 | + gboolean found; |
262 | }; |
263 | |
264 | /* This function helps by determining where in the menu list |
265 | @@ -171,263 +169,337 @@ |
266 | that they're on, and then the individual entries. Each |
267 | is progressively more expensive. */ |
268 | static void |
269 | -place_in_menu (GtkWidget * widget, gpointer user_data) |
270 | -{ |
271 | - incoming_position_t * position = (incoming_position_t *)user_data; |
272 | - if (position->found) { |
273 | - /* We've already been placed, just finish the foreach */ |
274 | - return; |
275 | - } |
276 | - |
277 | - IndicatorObject * io = INDICATOR_OBJECT(g_object_get_data(G_OBJECT(widget), MENU_DATA_INDICATOR_OBJECT)); |
278 | - g_assert(io != NULL); |
279 | - |
280 | - gint objposition = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(io), IO_DATA_ORDER_NUMBER)); |
281 | - /* We've already passed it, well, then this is where |
282 | - we should be be. Stop! */ |
283 | - if (objposition > position->objposition) { |
284 | - position->found = TRUE; |
285 | - return; |
286 | - } |
287 | - |
288 | - /* The objects don't match yet, keep looking */ |
289 | - if (objposition < position->objposition) { |
290 | - position->menupos++; |
291 | - return; |
292 | - } |
293 | - |
294 | - /* The objects are the same, let's start looking at entries. */ |
295 | - IndicatorObjectEntry * entry = (IndicatorObjectEntry *)g_object_get_data(G_OBJECT(widget), MENU_DATA_INDICATOR_ENTRY); |
296 | - gint entryposition = indicator_object_get_location(io, entry); |
297 | - |
298 | - if (entryposition > position->entryposition) { |
299 | - position->found = TRUE; |
300 | - return; |
301 | - } |
302 | - |
303 | - if (entryposition < position->entryposition) { |
304 | - position->menupos++; |
305 | - return; |
306 | - } |
307 | - |
308 | - /* We've got the same object and the same entry. Well, |
309 | - let's just put it right here then. */ |
310 | - position->found = TRUE; |
311 | - return; |
312 | +place_in_menu_cb (GtkWidget * widget, gpointer user_data) |
313 | +{ |
314 | + incoming_position_t * position = (incoming_position_t *)user_data; |
315 | + if (position->found) { |
316 | + /* We've already been placed, just finish the foreach */ |
317 | + return; |
318 | + } |
319 | + |
320 | + IndicatorObject * io = INDICATOR_OBJECT(g_object_get_data(G_OBJECT(widget), MENU_DATA_INDICATOR_OBJECT)); |
321 | + g_return_if_fail(INDICATOR_IS_OBJECT(io)); |
322 | + |
323 | + gint objposition = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(io), IO_DATA_ORDER_NUMBER)); |
324 | + /* We've already passed it, well, then this is where |
325 | + we should be be. Stop! */ |
326 | + if (objposition > position->objposition) { |
327 | + position->found = TRUE; |
328 | + return; |
329 | + } |
330 | + |
331 | + /* The objects don't match yet, keep looking */ |
332 | + if (objposition < position->objposition) { |
333 | + position->menupos++; |
334 | + return; |
335 | + } |
336 | + |
337 | + /* The objects are the same, let's start looking at entries. */ |
338 | + IndicatorObjectEntry * entry = (IndicatorObjectEntry *)g_object_get_data(G_OBJECT(widget), MENU_DATA_INDICATOR_ENTRY); |
339 | + gint entryposition = indicator_object_get_location(io, entry); |
340 | + |
341 | + if (entryposition > position->entryposition) { |
342 | + position->found = TRUE; |
343 | + return; |
344 | + } |
345 | + |
346 | + if (entryposition < position->entryposition) { |
347 | + position->menupos++; |
348 | + return; |
349 | + } |
350 | + |
351 | + /* We've got the same object and the same entry. Well, |
352 | + let's just put it right here then. */ |
353 | + position->found = TRUE; |
354 | + return; |
355 | +} |
356 | + |
357 | +/* Position the entry */ |
358 | +static void |
359 | +place_in_menu (GtkWidget *menubar, |
360 | + GtkWidget *menuitem, |
361 | + IndicatorObject *io, |
362 | + IndicatorObjectEntry *entry) |
363 | +{ |
364 | + incoming_position_t position; |
365 | + |
366 | + /* Start with the default position for this indicator object */ |
367 | + gint io_position = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(io), IO_DATA_ORDER_NUMBER)); |
368 | + |
369 | + /* If name-hint is set, try to find the entry's position */ |
370 | + if (entry->name_hint != NULL) { |
371 | + const gchar *name = (const gchar *)g_object_get_data(G_OBJECT(io), IO_DATA_NAME); |
372 | + gint entry_position = name2order(name, entry->name_hint); |
373 | + |
374 | + /* If we don't find the entry, fall back to the indicator object's position */ |
375 | + if (entry_position > -1) |
376 | + io_position = entry_position; |
377 | + } |
378 | + |
379 | + position.objposition = io_position; |
380 | + position.entryposition = indicator_object_get_location(io, entry); |
381 | + position.menupos = 0; |
382 | + position.found = FALSE; |
383 | + |
384 | + gtk_container_foreach(GTK_CONTAINER(menubar), place_in_menu_cb, &position); |
385 | + |
386 | + gtk_menu_shell_insert(GTK_MENU_SHELL(menubar), menuitem, position.menupos); |
387 | } |
388 | |
389 | static void |
390 | something_shown (GtkWidget * widget, gpointer user_data) |
391 | { |
392 | - GtkWidget * menuitem = GTK_WIDGET(user_data); |
393 | - gtk_widget_show(menuitem); |
394 | + GtkWidget * menuitem = GTK_WIDGET(user_data); |
395 | + gtk_widget_show(menuitem); |
396 | } |
397 | |
398 | static void |
399 | something_hidden (GtkWidget * widget, gpointer user_data) |
400 | { |
401 | - GtkWidget * menuitem = GTK_WIDGET(user_data); |
402 | - gtk_widget_hide(menuitem); |
403 | + GtkWidget * menuitem = GTK_WIDGET(user_data); |
404 | + gtk_widget_hide(menuitem); |
405 | } |
406 | |
407 | static void |
408 | sensitive_cb (GObject * obj, GParamSpec * pspec, gpointer user_data) |
409 | { |
410 | - g_return_if_fail(GTK_IS_WIDGET(obj)); |
411 | - g_return_if_fail(GTK_IS_WIDGET(user_data)); |
412 | + g_return_if_fail(GTK_IS_WIDGET(obj)); |
413 | + g_return_if_fail(GTK_IS_WIDGET(user_data)); |
414 | |
415 | - gtk_widget_set_sensitive(GTK_WIDGET(user_data), gtk_widget_get_sensitive(GTK_WIDGET(obj))); |
416 | - return; |
417 | + gtk_widget_set_sensitive(GTK_WIDGET(user_data), gtk_widget_get_sensitive(GTK_WIDGET(obj))); |
418 | + return; |
419 | } |
420 | |
421 | static void |
422 | entry_activated (GtkWidget * widget, gpointer user_data) |
423 | { |
424 | - g_return_if_fail(GTK_IS_WIDGET(widget)); |
425 | - gpointer pio = g_object_get_data(G_OBJECT(widget), "indicator"); |
426 | - g_return_if_fail(INDICATOR_IS_OBJECT(pio)); |
427 | - IndicatorObject * io = INDICATOR_OBJECT(pio); |
428 | - |
429 | - return indicator_object_entry_activate(io, (IndicatorObjectEntry *)user_data, gtk_get_current_event_time()); |
430 | + g_return_if_fail(GTK_IS_WIDGET(widget)); |
431 | + |
432 | + IndicatorObject *io = g_object_get_data (G_OBJECT (widget), MENU_DATA_INDICATOR_OBJECT); |
433 | + IndicatorObjectEntry *entry = g_object_get_data (G_OBJECT (widget), MENU_DATA_INDICATOR_ENTRY); |
434 | + |
435 | + g_return_if_fail(INDICATOR_IS_OBJECT(io)); |
436 | + |
437 | + return indicator_object_entry_activate(io, entry, gtk_get_current_event_time()); |
438 | +} |
439 | + |
440 | +static gboolean |
441 | +entry_secondary_activated (GtkWidget * widget, GdkEvent * event, gpointer user_data) |
442 | +{ |
443 | + g_return_val_if_fail(GTK_IS_WIDGET(widget), FALSE); |
444 | + |
445 | + switch (event->type) { |
446 | + case GDK_ENTER_NOTIFY: |
447 | + g_object_set_data(G_OBJECT(widget), MENU_DATA_IN_MENUITEM, GINT_TO_POINTER(TRUE)); |
448 | + break; |
449 | + |
450 | + case GDK_LEAVE_NOTIFY: |
451 | + g_object_set_data(G_OBJECT(widget), MENU_DATA_IN_MENUITEM, GINT_TO_POINTER(FALSE)); |
452 | + g_object_set_data(G_OBJECT(widget), MENU_DATA_MENUITEM_PRESSED, GINT_TO_POINTER(FALSE)); |
453 | + break; |
454 | + |
455 | + case GDK_BUTTON_PRESS: |
456 | + if (event->button.button == 2) { |
457 | + g_object_set_data(G_OBJECT(widget), MENU_DATA_MENUITEM_PRESSED, GINT_TO_POINTER(TRUE)); |
458 | + } |
459 | + break; |
460 | + |
461 | + case GDK_BUTTON_RELEASE: |
462 | + if (event->button.button == 2) { |
463 | + gboolean in_menuitem = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), MENU_DATA_IN_MENUITEM)); |
464 | + gboolean menuitem_pressed = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), MENU_DATA_MENUITEM_PRESSED)); |
465 | + |
466 | + if (in_menuitem && menuitem_pressed) { |
467 | + g_object_set_data(G_OBJECT(widget), MENU_DATA_MENUITEM_PRESSED, GINT_TO_POINTER(FALSE)); |
468 | + |
469 | + IndicatorObject *io = g_object_get_data(G_OBJECT(widget), MENU_DATA_INDICATOR_OBJECT); |
470 | + IndicatorObjectEntry *entry = g_object_get_data(G_OBJECT(widget), MENU_DATA_INDICATOR_ENTRY); |
471 | + |
472 | + g_return_val_if_fail(INDICATOR_IS_OBJECT(io), FALSE); |
473 | + |
474 | + g_signal_emit_by_name(io, INDICATOR_OBJECT_SIGNAL_SECONDARY_ACTIVATE, |
475 | + entry, event->button.time); |
476 | + } |
477 | + } |
478 | + break; |
479 | + } |
480 | + |
481 | + return FALSE; |
482 | } |
483 | |
484 | static gboolean |
485 | entry_scrolled (GtkWidget *menuitem, GdkEventScroll *event, gpointer data) |
486 | { |
487 | - IndicatorObject *io = g_object_get_data (G_OBJECT (menuitem), MENU_DATA_INDICATOR_OBJECT); |
488 | - IndicatorObjectEntry *entry = g_object_get_data (G_OBJECT (menuitem), MENU_DATA_INDICATOR_ENTRY); |
489 | - |
490 | - g_return_val_if_fail(INDICATOR_IS_OBJECT(io), FALSE); |
491 | - |
492 | - g_signal_emit_by_name (io, "scroll", 1, event->direction); |
493 | - g_signal_emit_by_name (io, "scroll-entry", entry, 1, event->direction); |
494 | - |
495 | - return FALSE; |
496 | + g_return_val_if_fail(GTK_IS_WIDGET(menuitem), FALSE); |
497 | + |
498 | + IndicatorObject *io = g_object_get_data (G_OBJECT (menuitem), MENU_DATA_INDICATOR_OBJECT); |
499 | + IndicatorObjectEntry *entry = g_object_get_data (G_OBJECT (menuitem), MENU_DATA_INDICATOR_ENTRY); |
500 | + |
501 | + g_return_val_if_fail(INDICATOR_IS_OBJECT(io), FALSE); |
502 | + |
503 | + g_signal_emit_by_name (io, INDICATOR_OBJECT_SIGNAL_ENTRY_SCROLLED, entry, 1, event->direction); |
504 | + |
505 | + return FALSE; |
506 | } |
507 | |
508 | static void |
509 | accessible_desc_update_cb (GtkWidget * widget, gpointer userdata) |
510 | { |
511 | - gpointer data = g_object_get_data(G_OBJECT(widget), MENU_DATA_INDICATOR_ENTRY); |
512 | - |
513 | - if (data != userdata) { |
514 | - return; |
515 | - } |
516 | - |
517 | - IndicatorObjectEntry * entry = (IndicatorObjectEntry *)data; |
518 | - update_accessible_desc(entry, widget); |
519 | + gpointer data = g_object_get_data(G_OBJECT(widget), MENU_DATA_INDICATOR_ENTRY); |
520 | + |
521 | + if (data != userdata) { |
522 | + return; |
523 | + } |
524 | + |
525 | + IndicatorObjectEntry * entry = (IndicatorObjectEntry *)data; |
526 | + update_accessible_desc(entry, widget); |
527 | } |
528 | |
529 | static void |
530 | accessible_desc_update (IndicatorObject * io, IndicatorObjectEntry * entry, GtkWidget * menubar) |
531 | { |
532 | - gtk_container_foreach(GTK_CONTAINER(menubar), accessible_desc_update_cb, entry); |
533 | - return; |
534 | + gtk_container_foreach(GTK_CONTAINER(menubar), accessible_desc_update_cb, entry); |
535 | + return; |
536 | } |
537 | |
538 | static void |
539 | entry_added (IndicatorObject * io, IndicatorObjectEntry * entry, GtkWidget * menubar) |
540 | { |
541 | - g_debug("Signal: Entry Added"); |
542 | - gboolean something_visible = FALSE; |
543 | - gboolean something_sensitive = FALSE; |
544 | - |
545 | - GtkWidget * menuitem = gtk_menu_item_new(); |
546 | - GtkWidget * box = (packdirection == GTK_PACK_DIRECTION_LTR) ? |
547 | - gtk_hbox_new(FALSE, 3) : gtk_vbox_new(FALSE, 3); |
548 | - |
549 | - g_object_set_data (G_OBJECT (menuitem), "indicator", io); |
550 | - g_object_set_data (G_OBJECT (menuitem), "box", box); |
551 | - |
552 | - g_signal_connect(G_OBJECT(menuitem), "activate", G_CALLBACK(entry_activated), entry); |
553 | - g_signal_connect(G_OBJECT(menuitem), "scroll-event", G_CALLBACK(entry_scrolled), entry); |
554 | - |
555 | - if (entry->image != NULL) { |
556 | - gtk_box_pack_start(GTK_BOX(box), GTK_WIDGET(entry->image), FALSE, FALSE, 1); |
557 | - if (gtk_widget_get_visible(GTK_WIDGET(entry->image))) { |
558 | - something_visible = TRUE; |
559 | - } |
560 | - |
561 | - if (gtk_widget_get_sensitive(GTK_WIDGET(entry->image))) { |
562 | - something_sensitive = TRUE; |
563 | - } |
564 | - |
565 | - g_signal_connect(G_OBJECT(entry->image), "show", G_CALLBACK(something_shown), menuitem); |
566 | - g_signal_connect(G_OBJECT(entry->image), "hide", G_CALLBACK(something_hidden), menuitem); |
567 | - |
568 | - g_signal_connect(G_OBJECT(entry->image), "notify::sensitive", G_CALLBACK(sensitive_cb), menuitem); |
569 | - } |
570 | - if (entry->label != NULL) { |
571 | - switch(packdirection) { |
572 | - case GTK_PACK_DIRECTION_LTR: |
573 | - gtk_label_set_angle(GTK_LABEL(entry->label), 0.0); |
574 | - break; |
575 | - case GTK_PACK_DIRECTION_TTB: |
576 | - gtk_label_set_angle(GTK_LABEL(entry->label), |
577 | - (orient == PANEL_APPLET_ORIENT_LEFT) ? |
578 | - 270.0 : 90.0); |
579 | - break; |
580 | - default: |
581 | - break; |
582 | - } |
583 | - gtk_box_pack_start(GTK_BOX(box), GTK_WIDGET(entry->label), FALSE, FALSE, 1); |
584 | - |
585 | - if (gtk_widget_get_visible(GTK_WIDGET(entry->label))) { |
586 | - something_visible = TRUE; |
587 | - } |
588 | - |
589 | - if (gtk_widget_get_sensitive(GTK_WIDGET(entry->label))) { |
590 | - something_sensitive = TRUE; |
591 | - } |
592 | - |
593 | - g_signal_connect(G_OBJECT(entry->label), "show", G_CALLBACK(something_shown), menuitem); |
594 | - g_signal_connect(G_OBJECT(entry->label), "hide", G_CALLBACK(something_hidden), menuitem); |
595 | - |
596 | - g_signal_connect(G_OBJECT(entry->label), "notify::sensitive", G_CALLBACK(sensitive_cb), menuitem); |
597 | - } |
598 | - gtk_container_add(GTK_CONTAINER(menuitem), box); |
599 | - gtk_widget_show(box); |
600 | - |
601 | - if (entry->menu != NULL) { |
602 | - gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), GTK_WIDGET(entry->menu)); |
603 | - } |
604 | - |
605 | - incoming_position_t position; |
606 | - position.objposition = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(io), IO_DATA_ORDER_NUMBER)); |
607 | - position.entryposition = indicator_object_get_location(io, entry); |
608 | - position.menupos = 0; |
609 | - position.found = FALSE; |
610 | - |
611 | - gtk_container_foreach(GTK_CONTAINER(menubar), place_in_menu, &position); |
612 | - |
613 | - gtk_menu_shell_insert(GTK_MENU_SHELL(menubar), menuitem, position.menupos); |
614 | - |
615 | - if (something_visible) { |
616 | - if (entry->accessible_desc != NULL) { |
617 | - update_accessible_desc(entry, menuitem); |
618 | - } |
619 | - gtk_widget_show(menuitem); |
620 | - } |
621 | - gtk_widget_set_sensitive(menuitem, something_sensitive); |
622 | - |
623 | - g_object_set_data(G_OBJECT(menuitem), MENU_DATA_INDICATOR_ENTRY, entry); |
624 | - g_object_set_data(G_OBJECT(menuitem), MENU_DATA_INDICATOR_OBJECT, io); |
625 | - |
626 | - return; |
627 | + const char *indicator_name = (const gchar *)g_object_get_data(G_OBJECT(io), IO_DATA_NAME); |
628 | + g_debug("Signal: Entry Added from %s", indicator_name); |
629 | + gboolean something_visible = FALSE; |
630 | + gboolean something_sensitive = FALSE; |
631 | + |
632 | + GtkWidget * menuitem = gtk_menu_item_new(); |
633 | + GtkWidget * box = (packdirection == GTK_PACK_DIRECTION_LTR) ? |
634 | + gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 3) : gtk_box_new(GTK_ORIENTATION_VERTICAL, 3); |
635 | + |
636 | + g_object_set_data (G_OBJECT (menuitem), MENU_DATA_BOX, box); |
637 | + g_object_set_data(G_OBJECT(menuitem), MENU_DATA_INDICATOR_ENTRY, entry); |
638 | + g_object_set_data(G_OBJECT(menuitem), MENU_DATA_INDICATOR_OBJECT, io); |
639 | + |
640 | + g_signal_connect(G_OBJECT(menuitem), "activate", G_CALLBACK(entry_activated), NULL); |
641 | + g_signal_connect(G_OBJECT(menuitem), "button-press-event", G_CALLBACK(entry_secondary_activated), NULL); |
642 | + g_signal_connect(G_OBJECT(menuitem), "button-release-event", G_CALLBACK(entry_secondary_activated), NULL); |
643 | + g_signal_connect(G_OBJECT(menuitem), "enter-notify-event", G_CALLBACK(entry_secondary_activated), NULL); |
644 | + g_signal_connect(G_OBJECT(menuitem), "leave-notify-event", G_CALLBACK(entry_secondary_activated), NULL); |
645 | + g_signal_connect(G_OBJECT(menuitem), "scroll-event", G_CALLBACK(entry_scrolled), NULL); |
646 | + |
647 | + if (entry->image != NULL) { |
648 | + gtk_box_pack_start(GTK_BOX(box), GTK_WIDGET(entry->image), FALSE, FALSE, 1); |
649 | + if (gtk_widget_get_visible(GTK_WIDGET(entry->image))) { |
650 | + something_visible = TRUE; |
651 | + } |
652 | + |
653 | + if (gtk_widget_get_sensitive(GTK_WIDGET(entry->image))) { |
654 | + something_sensitive = TRUE; |
655 | + } |
656 | + |
657 | + g_signal_connect(G_OBJECT(entry->image), "show", G_CALLBACK(something_shown), menuitem); |
658 | + g_signal_connect(G_OBJECT(entry->image), "hide", G_CALLBACK(something_hidden), menuitem); |
659 | + |
660 | + g_signal_connect(G_OBJECT(entry->image), "notify::sensitive", G_CALLBACK(sensitive_cb), menuitem); |
661 | + } |
662 | + if (entry->label != NULL) { |
663 | + switch(packdirection) { |
664 | + case GTK_PACK_DIRECTION_LTR: |
665 | + gtk_label_set_angle(GTK_LABEL(entry->label), 0.0); |
666 | + break; |
667 | + case GTK_PACK_DIRECTION_TTB: |
668 | + gtk_label_set_angle(GTK_LABEL(entry->label), |
669 | + (orient == PANEL_APPLET_ORIENT_LEFT) ? |
670 | + 270.0 : 90.0); |
671 | + break; |
672 | + default: |
673 | + break; |
674 | + } |
675 | + gtk_box_pack_start(GTK_BOX(box), GTK_WIDGET(entry->label), FALSE, FALSE, 1); |
676 | + |
677 | + if (gtk_widget_get_visible(GTK_WIDGET(entry->label))) { |
678 | + something_visible = TRUE; |
679 | + } |
680 | + |
681 | + if (gtk_widget_get_sensitive(GTK_WIDGET(entry->label))) { |
682 | + something_sensitive = TRUE; |
683 | + } |
684 | + |
685 | + g_signal_connect(G_OBJECT(entry->label), "show", G_CALLBACK(something_shown), menuitem); |
686 | + g_signal_connect(G_OBJECT(entry->label), "hide", G_CALLBACK(something_hidden), menuitem); |
687 | + |
688 | + g_signal_connect(G_OBJECT(entry->label), "notify::sensitive", G_CALLBACK(sensitive_cb), menuitem); |
689 | + } |
690 | + gtk_container_add(GTK_CONTAINER(menuitem), box); |
691 | + gtk_widget_show(box); |
692 | + |
693 | + if (entry->menu != NULL) { |
694 | + gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), GTK_WIDGET(entry->menu)); |
695 | + } |
696 | + |
697 | + place_in_menu(menubar, menuitem, io, entry); |
698 | + |
699 | + if (something_visible) { |
700 | + if (entry->accessible_desc != NULL) { |
701 | + update_accessible_desc(entry, menuitem); |
702 | + } |
703 | + gtk_widget_show(menuitem); |
704 | + } |
705 | + gtk_widget_set_sensitive(menuitem, something_sensitive); |
706 | + |
707 | + return; |
708 | } |
709 | |
710 | static void |
711 | entry_removed_cb (GtkWidget * widget, gpointer userdata) |
712 | { |
713 | - gpointer data = g_object_get_data(G_OBJECT(widget), MENU_DATA_INDICATOR_ENTRY); |
714 | - |
715 | - if (data != userdata) { |
716 | - return; |
717 | - } |
718 | - |
719 | - IndicatorObjectEntry * entry = (IndicatorObjectEntry *)data; |
720 | - if (entry->label != NULL) { |
721 | - g_signal_handlers_disconnect_by_func(G_OBJECT(entry->label), G_CALLBACK(something_shown), widget); |
722 | - g_signal_handlers_disconnect_by_func(G_OBJECT(entry->label), G_CALLBACK(something_hidden), widget); |
723 | - g_signal_handlers_disconnect_by_func(G_OBJECT(entry->label), G_CALLBACK(sensitive_cb), widget); |
724 | - } |
725 | - if (entry->image != NULL) { |
726 | - g_signal_handlers_disconnect_by_func(G_OBJECT(entry->image), G_CALLBACK(something_shown), widget); |
727 | - g_signal_handlers_disconnect_by_func(G_OBJECT(entry->image), G_CALLBACK(something_hidden), widget); |
728 | - g_signal_handlers_disconnect_by_func(G_OBJECT(entry->image), G_CALLBACK(sensitive_cb), widget); |
729 | - } |
730 | - |
731 | - gtk_widget_destroy(widget); |
732 | - return; |
733 | + gpointer data = g_object_get_data(G_OBJECT(widget), MENU_DATA_INDICATOR_ENTRY); |
734 | + |
735 | + if (data != userdata) { |
736 | + return; |
737 | + } |
738 | + |
739 | + IndicatorObjectEntry * entry = (IndicatorObjectEntry *)data; |
740 | + if (entry->label != NULL) { |
741 | + g_signal_handlers_disconnect_by_func(G_OBJECT(entry->label), G_CALLBACK(something_shown), widget); |
742 | + g_signal_handlers_disconnect_by_func(G_OBJECT(entry->label), G_CALLBACK(something_hidden), widget); |
743 | + g_signal_handlers_disconnect_by_func(G_OBJECT(entry->label), G_CALLBACK(sensitive_cb), widget); |
744 | + } |
745 | + if (entry->image != NULL) { |
746 | + g_signal_handlers_disconnect_by_func(G_OBJECT(entry->image), G_CALLBACK(something_shown), widget); |
747 | + g_signal_handlers_disconnect_by_func(G_OBJECT(entry->image), G_CALLBACK(something_hidden), widget); |
748 | + g_signal_handlers_disconnect_by_func(G_OBJECT(entry->image), G_CALLBACK(sensitive_cb), widget); |
749 | + } |
750 | + |
751 | + gtk_widget_destroy(widget); |
752 | + return; |
753 | } |
754 | |
755 | static void |
756 | entry_removed (IndicatorObject * io G_GNUC_UNUSED, IndicatorObjectEntry * entry, |
757 | gpointer user_data) |
758 | { |
759 | - g_debug("Signal: Entry Removed"); |
760 | - |
761 | - gtk_container_foreach(GTK_CONTAINER(user_data), entry_removed_cb, entry); |
762 | - |
763 | - return; |
764 | + g_debug("Signal: Entry Removed"); |
765 | + |
766 | + gtk_container_foreach(GTK_CONTAINER(user_data), entry_removed_cb, entry); |
767 | + |
768 | + return; |
769 | } |
770 | |
771 | static void |
772 | entry_moved_find_cb (GtkWidget * widget, gpointer userdata) |
773 | { |
774 | - gpointer * array = (gpointer *)userdata; |
775 | - if (array[1] != NULL) { |
776 | - return; |
777 | - } |
778 | - |
779 | - gpointer data = g_object_get_data(G_OBJECT(widget), MENU_DATA_INDICATOR_ENTRY); |
780 | - |
781 | - if (data != array[0]) { |
782 | - return; |
783 | - } |
784 | - |
785 | - array[1] = widget; |
786 | - return; |
787 | + gpointer * array = (gpointer *)userdata; |
788 | + if (array[1] != NULL) { |
789 | + return; |
790 | + } |
791 | + |
792 | + gpointer data = g_object_get_data(G_OBJECT(widget), MENU_DATA_INDICATOR_ENTRY); |
793 | + |
794 | + if (data != array[0]) { |
795 | + return; |
796 | + } |
797 | + |
798 | + array[1] = widget; |
799 | + return; |
800 | } |
801 | |
802 | /* Gets called when an entry for an object was moved. */ |
803 | @@ -435,147 +507,135 @@ |
804 | entry_moved (IndicatorObject * io, IndicatorObjectEntry * entry, |
805 | gint old G_GNUC_UNUSED, gint new G_GNUC_UNUSED, gpointer user_data) |
806 | { |
807 | - GtkWidget * menubar = GTK_WIDGET(user_data); |
808 | - |
809 | - gpointer array[2]; |
810 | - array[0] = entry; |
811 | - array[1] = NULL; |
812 | - |
813 | - gtk_container_foreach(GTK_CONTAINER(menubar), entry_moved_find_cb, array); |
814 | - if (array[1] == NULL) { |
815 | - g_warning("Moving an entry that isn't in our menus."); |
816 | - return; |
817 | - } |
818 | - |
819 | - GtkWidget * mi = GTK_WIDGET(array[1]); |
820 | - g_object_ref(G_OBJECT(mi)); |
821 | - gtk_container_remove(GTK_CONTAINER(menubar), mi); |
822 | - |
823 | - incoming_position_t position; |
824 | - position.objposition = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(io), IO_DATA_ORDER_NUMBER)); |
825 | - position.entryposition = indicator_object_get_location(io, entry); |
826 | - position.menupos = 0; |
827 | - position.found = FALSE; |
828 | - |
829 | - gtk_container_foreach(GTK_CONTAINER(menubar), place_in_menu, &position); |
830 | - |
831 | - gtk_menu_shell_insert(GTK_MENU_SHELL(menubar), mi, position.menupos); |
832 | - g_object_unref(G_OBJECT(mi)); |
833 | - |
834 | - return; |
835 | + GtkWidget * menubar = GTK_WIDGET(user_data); |
836 | + |
837 | + gpointer array[2]; |
838 | + array[0] = entry; |
839 | + array[1] = NULL; |
840 | + |
841 | + gtk_container_foreach(GTK_CONTAINER(menubar), entry_moved_find_cb, array); |
842 | + if (array[1] == NULL) { |
843 | + g_warning("Moving an entry that isn't in our menus."); |
844 | + return; |
845 | + } |
846 | + |
847 | + GtkWidget * mi = GTK_WIDGET(array[1]); |
848 | + g_object_ref(G_OBJECT(mi)); |
849 | + gtk_container_remove(GTK_CONTAINER(menubar), mi); |
850 | + place_in_menu(menubar, mi, io, entry); |
851 | + g_object_unref(G_OBJECT(mi)); |
852 | + |
853 | + return; |
854 | } |
855 | |
856 | static void |
857 | menu_show (IndicatorObject * io, IndicatorObjectEntry * entry, |
858 | guint32 timestamp, gpointer user_data) |
859 | { |
860 | - GtkWidget * menubar = GTK_WIDGET(user_data); |
861 | - |
862 | - if (entry == NULL) { |
863 | - /* Close any open menus instead of opening one */ |
864 | - GList * entries = indicator_object_get_entries(io); |
865 | - GList * entry = NULL; |
866 | - for (entry = entries; entry != NULL; entry = g_list_next(entry)) { |
867 | - IndicatorObjectEntry * entrydata = (IndicatorObjectEntry *)entry->data; |
868 | - gtk_menu_popdown(entrydata->menu); |
869 | - } |
870 | - g_list_free(entries); |
871 | - |
872 | - /* And tell the menubar to exit activation mode too */ |
873 | - gtk_menu_shell_cancel(GTK_MENU_SHELL(menubar)); |
874 | - return; |
875 | - } |
876 | - |
877 | - // TODO: do something sensible here |
878 | + GtkWidget * menubar = GTK_WIDGET(user_data); |
879 | + |
880 | + if (entry == NULL) { |
881 | + /* Close any open menus instead of opening one */ |
882 | + GList * entries = indicator_object_get_entries(io); |
883 | + GList * entry = NULL; |
884 | + for (entry = entries; entry != NULL; entry = g_list_next(entry)) { |
885 | + IndicatorObjectEntry * entrydata = (IndicatorObjectEntry *)entry->data; |
886 | + gtk_menu_popdown(entrydata->menu); |
887 | + } |
888 | + g_list_free(entries); |
889 | + |
890 | + /* And tell the menubar to exit activation mode too */ |
891 | + gtk_menu_shell_cancel(GTK_MENU_SHELL(menubar)); |
892 | + return; |
893 | + } |
894 | + |
895 | + // TODO: do something sensible here |
896 | } |
897 | |
898 | static void |
899 | update_accessible_desc(IndicatorObjectEntry * entry, GtkWidget * menuitem) |
900 | { |
901 | - /* FIXME: We need to deal with the use case where the contents of the |
902 | - label overrides what is found in the atk object's name, or at least |
903 | - orca speaks the label instead of the atk object name. |
904 | - */ |
905 | - AtkObject * menuitem_obj = gtk_widget_get_accessible(menuitem); |
906 | - if (menuitem_obj == NULL) { |
907 | - /* Should there be an error printed here? */ |
908 | - return; |
909 | - } |
910 | + /* FIXME: We need to deal with the use case where the contents of the |
911 | + label overrides what is found in the atk object's name, or at least |
912 | + orca speaks the label instead of the atk object name. |
913 | + */ |
914 | + AtkObject * menuitem_obj = gtk_widget_get_accessible(menuitem); |
915 | + if (menuitem_obj == NULL) { |
916 | + /* Should there be an error printed here? */ |
917 | + return; |
918 | + } |
919 | |
920 | - if (entry->accessible_desc != NULL) { |
921 | - atk_object_set_name(menuitem_obj, entry->accessible_desc); |
922 | - } else { |
923 | - atk_object_set_name(menuitem_obj, ""); |
924 | - } |
925 | - return; |
926 | + if (entry->accessible_desc != NULL) { |
927 | + atk_object_set_name(menuitem_obj, entry->accessible_desc); |
928 | + } else { |
929 | + atk_object_set_name(menuitem_obj, ""); |
930 | + } |
931 | + return; |
932 | } |
933 | |
934 | |
935 | static gboolean |
936 | load_module (const gchar * name, GtkWidget * menubar) |
937 | { |
938 | - g_debug("Looking at Module: %s", name); |
939 | - g_return_val_if_fail(name != NULL, FALSE); |
940 | - |
941 | - if (!g_str_has_suffix(name, G_MODULE_SUFFIX)) { |
942 | - return FALSE; |
943 | - } |
944 | - |
945 | - g_debug("Loading Module: %s", name); |
946 | - |
947 | - /* Build the object for the module */ |
948 | - gchar * fullpath = g_build_filename(INDICATOR_DIR, name, NULL); |
949 | - IndicatorObject * io = indicator_object_new_from_file(fullpath); |
950 | - g_free(fullpath); |
951 | - |
952 | - /* Set the environment it's in */ |
953 | - indicator_object_set_environment(io, (const GStrv)indicator_env); |
954 | - |
955 | - /* Attach the 'name' to the object */ |
956 | - g_object_set_data(G_OBJECT(io), IO_DATA_ORDER_NUMBER, GINT_TO_POINTER(name2order(name))); |
957 | - |
958 | - /* Connect to its signals */ |
959 | - g_signal_connect(G_OBJECT(io), INDICATOR_OBJECT_SIGNAL_ENTRY_ADDED, G_CALLBACK(entry_added), menubar); |
960 | - g_signal_connect(G_OBJECT(io), INDICATOR_OBJECT_SIGNAL_ENTRY_REMOVED, G_CALLBACK(entry_removed), menubar); |
961 | - g_signal_connect(G_OBJECT(io), INDICATOR_OBJECT_SIGNAL_ENTRY_MOVED, G_CALLBACK(entry_moved), menubar); |
962 | - g_signal_connect(G_OBJECT(io), INDICATOR_OBJECT_SIGNAL_MENU_SHOW, G_CALLBACK(menu_show), menubar); |
963 | - g_signal_connect(G_OBJECT(io), INDICATOR_OBJECT_SIGNAL_ACCESSIBLE_DESC_UPDATE, G_CALLBACK(accessible_desc_update), menubar); |
964 | - |
965 | - /* Work on the entries */ |
966 | - GList * entries = indicator_object_get_entries(io); |
967 | - GList * entry = NULL; |
968 | - |
969 | - for (entry = entries; entry != NULL; entry = g_list_next(entry)) { |
970 | - IndicatorObjectEntry * entrydata = (IndicatorObjectEntry *)entry->data; |
971 | - entry_added(io, entrydata, menubar); |
972 | - } |
973 | - |
974 | - g_list_free(entries); |
975 | - |
976 | - return TRUE; |
977 | + g_debug("Looking at Module: %s", name); |
978 | + g_return_val_if_fail(name != NULL, FALSE); |
979 | + |
980 | + if (!g_str_has_suffix(name, G_MODULE_SUFFIX)) { |
981 | + return FALSE; |
982 | + } |
983 | + |
984 | + g_debug("Loading Module: %s", name); |
985 | + |
986 | + /* Build the object for the module */ |
987 | + gchar * fullpath = g_build_filename(INDICATOR_DIR, name, NULL); |
988 | + IndicatorObject * io = indicator_object_new_from_file(fullpath); |
989 | + g_free(fullpath); |
990 | + |
991 | + /* Set the environment it's in */ |
992 | + indicator_object_set_environment(io, (const GStrv)indicator_env); |
993 | + |
994 | + /* Attach the 'name' to the object */ |
995 | + g_object_set_data_full(G_OBJECT(io), IO_DATA_NAME, g_strdup(name), g_free); |
996 | + g_object_set_data(G_OBJECT(io), IO_DATA_ORDER_NUMBER, GINT_TO_POINTER(name2order(name, NULL))); |
997 | + |
998 | + /* Connect to its signals */ |
999 | + g_signal_connect(G_OBJECT(io), INDICATOR_OBJECT_SIGNAL_ENTRY_ADDED, G_CALLBACK(entry_added), menubar); |
1000 | + g_signal_connect(G_OBJECT(io), INDICATOR_OBJECT_SIGNAL_ENTRY_REMOVED, G_CALLBACK(entry_removed), menubar); |
1001 | + g_signal_connect(G_OBJECT(io), INDICATOR_OBJECT_SIGNAL_ENTRY_MOVED, G_CALLBACK(entry_moved), menubar); |
1002 | + g_signal_connect(G_OBJECT(io), INDICATOR_OBJECT_SIGNAL_MENU_SHOW, G_CALLBACK(menu_show), menubar); |
1003 | + g_signal_connect(G_OBJECT(io), INDICATOR_OBJECT_SIGNAL_ACCESSIBLE_DESC_UPDATE, G_CALLBACK(accessible_desc_update), menubar); |
1004 | + |
1005 | + /* Work on the entries */ |
1006 | + GList * entries = indicator_object_get_entries(io); |
1007 | + GList * entry = NULL; |
1008 | + |
1009 | + for (entry = entries; entry != NULL; entry = g_list_next(entry)) { |
1010 | + IndicatorObjectEntry * entrydata = (IndicatorObjectEntry *)entry->data; |
1011 | + entry_added(io, entrydata, menubar); |
1012 | + } |
1013 | + |
1014 | + g_list_free(entries); |
1015 | + |
1016 | + return TRUE; |
1017 | } |
1018 | |
1019 | static void |
1020 | -hotkey_filter (char * keystring G_GNUC_UNUSED, gpointer data) |
1021 | +hotkey_filter (char * keystring, gpointer data) |
1022 | { |
1023 | - g_return_if_fail(GTK_IS_MENU_SHELL(data)); |
1024 | - |
1025 | - /* Oh, wow, it's us! */ |
1026 | - GList * children = gtk_container_get_children(GTK_CONTAINER(data)); |
1027 | - if (children == NULL) { |
1028 | - g_debug("Menubar has no children"); |
1029 | - return; |
1030 | - } |
1031 | - |
1032 | - if (!GTK_MENU_SHELL(data)->active) { |
1033 | - gtk_grab_add (GTK_WIDGET(data)); |
1034 | - GTK_MENU_SHELL(data)->have_grab = TRUE; |
1035 | - GTK_MENU_SHELL(data)->active = TRUE; |
1036 | - } |
1037 | - |
1038 | - gtk_menu_shell_select_item(GTK_MENU_SHELL(data), GTK_WIDGET(g_list_last(children)->data)); |
1039 | - g_list_free(children); |
1040 | - return; |
1041 | + g_return_if_fail(GTK_IS_MENU_SHELL(data)); |
1042 | + |
1043 | + g_debug ("Hotkey: %s", keystring); |
1044 | + |
1045 | + /* Oh, wow, it's us! */ |
1046 | + GList * children = gtk_container_get_children(GTK_CONTAINER(data)); |
1047 | + if (children == NULL) { |
1048 | + g_debug("Menubar has no children"); |
1049 | + return; |
1050 | + } |
1051 | + |
1052 | + gtk_menu_shell_select_item(GTK_MENU_SHELL(data), GTK_WIDGET(g_list_last(children)->data)); |
1053 | + g_list_free(children); |
1054 | + return; |
1055 | } |
1056 | |
1057 | static gboolean |
1058 | @@ -583,35 +643,23 @@ |
1059 | GdkEventButton *event, |
1060 | gpointer data G_GNUC_UNUSED) |
1061 | { |
1062 | - if (event->button != 1) { |
1063 | - g_signal_stop_emission_by_name(widget, "button-press-event"); |
1064 | - } |
1065 | - |
1066 | - return FALSE; |
1067 | -} |
1068 | - |
1069 | -static gboolean |
1070 | -menubar_on_expose (GtkWidget * widget, |
1071 | - GdkEventExpose *event G_GNUC_UNUSED, |
1072 | - GtkWidget * menubar) |
1073 | -{ |
1074 | - if (GTK_WIDGET_HAS_FOCUS(menubar)) |
1075 | - gtk_paint_focus(widget->style, widget->window, GTK_WIDGET_STATE(menubar), |
1076 | - NULL, widget, "menubar-applet", 0, 0, -1, -1); |
1077 | - |
1078 | - return FALSE; |
1079 | + if (event->button != 1) { |
1080 | + g_signal_stop_emission_by_name(widget, "button-press-event"); |
1081 | + } |
1082 | + |
1083 | + return FALSE; |
1084 | } |
1085 | |
1086 | static void |
1087 | about_cb (GtkAction *action G_GNUC_UNUSED, |
1088 | gpointer data G_GNUC_UNUSED) |
1089 | { |
1090 | - static const gchar *authors[] = { |
1091 | - "Ted Gould <ted@canonical.com>", |
1092 | - NULL |
1093 | - }; |
1094 | + static const gchar *authors[] = { |
1095 | + "Ted Gould <ted@canonical.com>", |
1096 | + NULL |
1097 | + }; |
1098 | |
1099 | - static gchar *license[] = { |
1100 | + static gchar *license[] = { |
1101 | N_("This program is free software: you can redistribute it and/or modify it " |
1102 | "under the terms of the GNU General Public License version 3, as published " |
1103 | "by the Free Software Foundation."), |
1104 | @@ -621,103 +669,103 @@ |
1105 | "PURPOSE. See the GNU General Public License for more details."), |
1106 | N_("You should have received a copy of the GNU General Public License along " |
1107 | "with this program. If not, see <http://www.gnu.org/licenses/>."), |
1108 | - NULL |
1109 | - }; |
1110 | - gchar *license_i18n; |
1111 | - |
1112 | - license_i18n = g_strconcat (_(license[0]), "\n\n", _(license[1]), "\n\n", _(license[2]), NULL); |
1113 | - |
1114 | - gtk_show_about_dialog(NULL, |
1115 | - "version", VERSION, |
1116 | - "copyright", "Copyright \xc2\xa9 2009-2010 Canonical, Ltd.", |
1117 | + NULL |
1118 | + }; |
1119 | + gchar *license_i18n; |
1120 | + |
1121 | + license_i18n = g_strconcat (_(license[0]), "\n\n", _(license[1]), "\n\n", _(license[2]), NULL); |
1122 | + |
1123 | + gtk_show_about_dialog(NULL, |
1124 | + "version", VERSION, |
1125 | + "copyright", "Copyright \xc2\xa9 2009-2010 Canonical, Ltd.", |
1126 | #ifdef INDICATOR_APPLET_SESSION |
1127 | - "comments", _("A place to adjust your status, change users or exit your session."), |
1128 | + "comments", _("A place to adjust your status, change users or exit your session."), |
1129 | #else |
1130 | #ifdef INDICATOR_APPLET_APPMENU |
1131 | - "comments", _("An applet to hold your application menus."), |
1132 | -#endif |
1133 | - "comments", _("An applet to hold all of the system indicators."), |
1134 | -#endif |
1135 | - "authors", authors, |
1136 | - "license", license_i18n, |
1137 | - "wrap-license", TRUE, |
1138 | - "translator-credits", _("translator-credits"), |
1139 | - "logo-icon-name", "indicator-applet", |
1140 | - "icon-name", "indicator-applet", |
1141 | - "website", "http://launchpad.net/indicator-applet", |
1142 | - "website-label", _("Indicator Applet Website"), |
1143 | - NULL |
1144 | - ); |
1145 | - |
1146 | - g_free (license_i18n); |
1147 | - |
1148 | - return; |
1149 | + "comments", _("An applet to hold your application menus."), |
1150 | +#endif |
1151 | + "comments", _("An applet to hold all of the system indicators."), |
1152 | +#endif |
1153 | + "authors", authors, |
1154 | + "license", license_i18n, |
1155 | + "wrap-license", TRUE, |
1156 | + "translator-credits", _("translator-credits"), |
1157 | + "logo-icon-name", "indicator-applet", |
1158 | + "icon-name", "indicator-applet", |
1159 | + "website", "http://launchpad.net/indicator-applet", |
1160 | + "website-label", _("Indicator Applet Website"), |
1161 | + NULL |
1162 | + ); |
1163 | + |
1164 | + g_free (license_i18n); |
1165 | + |
1166 | + return; |
1167 | } |
1168 | |
1169 | static gboolean |
1170 | swap_orient_cb (GtkWidget *item, gpointer data) |
1171 | { |
1172 | - GtkWidget *from = (GtkWidget *) data; |
1173 | - GtkWidget *to = (GtkWidget *) g_object_get_data(G_OBJECT(from), "to"); |
1174 | - g_object_ref(G_OBJECT(item)); |
1175 | - gtk_container_remove(GTK_CONTAINER(from), item); |
1176 | - if (GTK_IS_LABEL(item)) { |
1177 | - switch(packdirection) { |
1178 | - case GTK_PACK_DIRECTION_LTR: |
1179 | - gtk_label_set_angle(GTK_LABEL(item), 0.0); |
1180 | - break; |
1181 | - case GTK_PACK_DIRECTION_TTB: |
1182 | - gtk_label_set_angle(GTK_LABEL(item), |
1183 | - (orient == PANEL_APPLET_ORIENT_LEFT) ? |
1184 | - 270.0 : 90.0); |
1185 | - break; |
1186 | - default: |
1187 | - break; |
1188 | - } |
1189 | - } |
1190 | - gtk_box_pack_start(GTK_BOX(to), item, FALSE, FALSE, 0); |
1191 | - return TRUE; |
1192 | + GtkWidget *from = (GtkWidget *) data; |
1193 | + GtkWidget *to = (GtkWidget *) g_object_get_data(G_OBJECT(from), "to"); |
1194 | + g_object_ref(G_OBJECT(item)); |
1195 | + gtk_container_remove(GTK_CONTAINER(from), item); |
1196 | + if (GTK_IS_LABEL(item)) { |
1197 | + switch(packdirection) { |
1198 | + case GTK_PACK_DIRECTION_LTR: |
1199 | + gtk_label_set_angle(GTK_LABEL(item), 0.0); |
1200 | + break; |
1201 | + case GTK_PACK_DIRECTION_TTB: |
1202 | + gtk_label_set_angle(GTK_LABEL(item), |
1203 | + (orient == PANEL_APPLET_ORIENT_LEFT) ? |
1204 | + 270.0 : 90.0); |
1205 | + break; |
1206 | + default: |
1207 | + break; |
1208 | + } |
1209 | + } |
1210 | + gtk_box_pack_start(GTK_BOX(to), item, FALSE, FALSE, 0); |
1211 | + return TRUE; |
1212 | } |
1213 | |
1214 | static gboolean |
1215 | reorient_box_cb (GtkWidget *menuitem, gpointer data) |
1216 | { |
1217 | - GtkWidget *from = g_object_get_data(G_OBJECT(menuitem), "box"); |
1218 | - GtkWidget *to = (packdirection == GTK_PACK_DIRECTION_LTR) ? |
1219 | - gtk_hbox_new(FALSE, 0) : gtk_vbox_new(FALSE, 0); |
1220 | - g_object_set_data(G_OBJECT(from), "to", to); |
1221 | - gtk_container_foreach(GTK_CONTAINER(from), (GtkCallback)swap_orient_cb, |
1222 | - from); |
1223 | - gtk_container_remove(GTK_CONTAINER(menuitem), from); |
1224 | - gtk_container_add(GTK_CONTAINER(menuitem), to); |
1225 | - g_object_set_data(G_OBJECT(menuitem), "box", to); |
1226 | - gtk_widget_show_all(menuitem); |
1227 | - return TRUE; |
1228 | + GtkWidget *from = g_object_get_data(G_OBJECT(menuitem), MENU_DATA_BOX); |
1229 | + GtkWidget *to = (packdirection == GTK_PACK_DIRECTION_LTR) ? |
1230 | + gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0) : gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); |
1231 | + g_object_set_data(G_OBJECT(from), "to", to); |
1232 | + gtk_container_foreach(GTK_CONTAINER(from), (GtkCallback)swap_orient_cb, |
1233 | + from); |
1234 | + gtk_container_remove(GTK_CONTAINER(menuitem), from); |
1235 | + gtk_container_add(GTK_CONTAINER(menuitem), to); |
1236 | + g_object_set_data(G_OBJECT(menuitem), MENU_DATA_BOX, to); |
1237 | + gtk_widget_show_all(menuitem); |
1238 | + return TRUE; |
1239 | } |
1240 | |
1241 | static gboolean |
1242 | panelapplet_reorient_cb (GtkWidget *applet, PanelAppletOrient neworient, |
1243 | - gpointer data) |
1244 | + gpointer data) |
1245 | { |
1246 | - GtkWidget *menubar = (GtkWidget *)data; |
1247 | - if ((((neworient == PANEL_APPLET_ORIENT_UP) || |
1248 | - (neworient == PANEL_APPLET_ORIENT_DOWN)) && |
1249 | - ((orient == PANEL_APPLET_ORIENT_LEFT) || |
1250 | - (orient == PANEL_APPLET_ORIENT_RIGHT))) || |
1251 | - (((neworient == PANEL_APPLET_ORIENT_LEFT) || |
1252 | - (neworient == PANEL_APPLET_ORIENT_RIGHT)) && |
1253 | - ((orient == PANEL_APPLET_ORIENT_UP) || |
1254 | - (orient == PANEL_APPLET_ORIENT_DOWN)))) { |
1255 | - packdirection = (packdirection == GTK_PACK_DIRECTION_LTR) ? |
1256 | - GTK_PACK_DIRECTION_TTB : GTK_PACK_DIRECTION_LTR; |
1257 | - gtk_menu_bar_set_pack_direction(GTK_MENU_BAR(menubar), |
1258 | - packdirection); |
1259 | - orient = neworient; |
1260 | - gtk_container_foreach(GTK_CONTAINER(menubar), |
1261 | - (GtkCallback)reorient_box_cb, NULL); |
1262 | - } |
1263 | - orient = neworient; |
1264 | - return FALSE; |
1265 | + GtkWidget *menubar = (GtkWidget *)data; |
1266 | + if ((((neworient == PANEL_APPLET_ORIENT_UP) || |
1267 | + (neworient == PANEL_APPLET_ORIENT_DOWN)) && |
1268 | + ((orient == PANEL_APPLET_ORIENT_LEFT) || |
1269 | + (orient == PANEL_APPLET_ORIENT_RIGHT))) || |
1270 | + (((neworient == PANEL_APPLET_ORIENT_LEFT) || |
1271 | + (neworient == PANEL_APPLET_ORIENT_RIGHT)) && |
1272 | + ((orient == PANEL_APPLET_ORIENT_UP) || |
1273 | + (orient == PANEL_APPLET_ORIENT_DOWN)))) { |
1274 | + packdirection = (packdirection == GTK_PACK_DIRECTION_LTR) ? |
1275 | + GTK_PACK_DIRECTION_TTB : GTK_PACK_DIRECTION_LTR; |
1276 | + gtk_menu_bar_set_pack_direction(GTK_MENU_BAR(menubar), |
1277 | + packdirection); |
1278 | + orient = neworient; |
1279 | + gtk_container_foreach(GTK_CONTAINER(menubar), |
1280 | + (GtkCallback)reorient_box_cb, NULL); |
1281 | + } |
1282 | + orient = neworient; |
1283 | + return FALSE; |
1284 | } |
1285 | |
1286 | #ifdef N_ |
1287 | @@ -726,277 +774,205 @@ |
1288 | #define N_(x) x |
1289 | |
1290 | static void |
1291 | -log_to_file_cb (GObject * source_obj G_GNUC_UNUSED, |
1292 | - GAsyncResult * result G_GNUC_UNUSED, gpointer user_data) |
1293 | -{ |
1294 | - g_free(user_data); |
1295 | - return; |
1296 | -} |
1297 | - |
1298 | -static void |
1299 | -log_to_file (const gchar * domain G_GNUC_UNUSED, |
1300 | - GLogLevelFlags level G_GNUC_UNUSED, |
1301 | +log_to_file (const gchar * domain, |
1302 | + GLogLevelFlags level, |
1303 | const gchar * message, |
1304 | - gpointer data G_GNUC_UNUSED) |
1305 | + gpointer data) |
1306 | { |
1307 | - if (log_file == NULL) { |
1308 | - GError * error = NULL; |
1309 | - gchar * filename = g_build_filename(g_get_user_cache_dir(), LOG_FILE_NAME, NULL); |
1310 | - GFile * file = g_file_new_for_path(filename); |
1311 | - g_free(filename); |
1312 | - |
1313 | - if (!g_file_test(g_get_user_cache_dir(), G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR)) { |
1314 | - GFile * cachedir = g_file_new_for_path(g_get_user_cache_dir()); |
1315 | - g_file_make_directory_with_parents(cachedir, NULL, &error); |
1316 | - |
1317 | - if (error != NULL) { |
1318 | - g_error("Unable to make directory '%s' for log file: %s", g_get_user_cache_dir(), error->message); |
1319 | - return; |
1320 | - } |
1321 | - } |
1322 | - |
1323 | - g_file_delete(file, NULL, NULL); |
1324 | - |
1325 | - GFileIOStream * io = g_file_create_readwrite(file, |
1326 | - G_FILE_CREATE_REPLACE_DESTINATION, /* flags */ |
1327 | - NULL, /* cancelable */ |
1328 | - &error); /* error */ |
1329 | - if (error != NULL) { |
1330 | - g_error("Unable to replace file: %s", error->message); |
1331 | - return; |
1332 | - } |
1333 | - |
1334 | - log_file = g_io_stream_get_output_stream(G_IO_STREAM(io)); |
1335 | - } |
1336 | - |
1337 | - gchar * outputstring = g_strdup_printf("%s\n", message); |
1338 | - g_output_stream_write_async(log_file, |
1339 | - outputstring, /* data */ |
1340 | - strlen(outputstring), /* length */ |
1341 | - G_PRIORITY_LOW, /* priority */ |
1342 | - NULL, /* cancelable */ |
1343 | - log_to_file_cb, /* callback */ |
1344 | - outputstring); /* data */ |
1345 | - |
1346 | - return; |
1347 | + if (log_file == NULL) { |
1348 | + gchar *path; |
1349 | + |
1350 | + g_mkdir_with_parents(g_get_user_cache_dir(), 0755); |
1351 | + path = g_build_filename(g_get_user_cache_dir(), LOG_FILE_NAME, NULL); |
1352 | + |
1353 | + log_file = fopen(path, "w"); |
1354 | + |
1355 | + g_free(path); |
1356 | + } |
1357 | + |
1358 | + if(log_file) { |
1359 | + const gchar *prefix; |
1360 | + |
1361 | + switch(level & G_LOG_LEVEL_MASK) { |
1362 | + case G_LOG_LEVEL_ERROR: |
1363 | + prefix = "ERROR:"; |
1364 | + break; |
1365 | + case G_LOG_LEVEL_CRITICAL: |
1366 | + prefix = "CRITICAL:"; |
1367 | + break; |
1368 | + case G_LOG_LEVEL_WARNING: |
1369 | + prefix = "WARNING:"; |
1370 | + break; |
1371 | + case G_LOG_LEVEL_MESSAGE: |
1372 | + prefix = "MESSAGE:"; |
1373 | + break; |
1374 | + case G_LOG_LEVEL_INFO: |
1375 | + prefix = "INFO:"; |
1376 | + break; |
1377 | + case G_LOG_LEVEL_DEBUG: |
1378 | + prefix = "DEBUG:"; |
1379 | + break; |
1380 | + default: |
1381 | + prefix = "LOG:"; |
1382 | + break; |
1383 | + } |
1384 | + |
1385 | + fprintf(log_file, "%s %s - %s\n", prefix, domain, message); |
1386 | + fflush(log_file); |
1387 | + } |
1388 | + |
1389 | + g_log_default_handler(domain, level, message, data); |
1390 | + |
1391 | + return; |
1392 | } |
1393 | |
1394 | static gboolean |
1395 | applet_fill_cb (PanelApplet * applet, const gchar * iid G_GNUC_UNUSED, |
1396 | gpointer data G_GNUC_UNUSED) |
1397 | { |
1398 | - static const GtkActionEntry menu_actions[] = { |
1399 | - {"About", GTK_STOCK_ABOUT, N_("_About"), NULL, NULL, G_CALLBACK(about_cb)} |
1400 | - }; |
1401 | - static const gchar *menu_xml = "<menuitem name=\"About\" action=\"About\"/>"; |
1402 | - |
1403 | - static gboolean first_time = FALSE; |
1404 | - GtkWidget *menubar; |
1405 | - gint indicators_loaded = 0; |
1406 | - GtkActionGroup *action_group; |
1407 | - |
1408 | -#ifdef INDICATOR_APPLET_SESSION |
1409 | - /* check if we are running stracciatella session */ |
1410 | - if (g_strcmp0(g_getenv("GDMSESSION"), "gnome-stracciatella") == 0) { |
1411 | - g_debug("Running stracciatella GNOME session, disabling myself"); |
1412 | - return TRUE; |
1413 | - } |
1414 | -#endif |
1415 | - |
1416 | - if (!first_time) |
1417 | - { |
1418 | - first_time = TRUE; |
1419 | -#ifdef INDICATOR_APPLET |
1420 | - g_set_application_name(_("Indicator Applet")); |
1421 | -#endif |
1422 | -#ifdef INDICATOR_APPLET_SESSION |
1423 | - g_set_application_name(_("Indicator Applet Session")); |
1424 | -#endif |
1425 | -#ifdef INDICATOR_APPLET_COMPLETE |
1426 | - g_set_application_name(_("Indicator Applet Complete")); |
1427 | -#endif |
1428 | -#ifdef INDICATOR_APPLET_APPMENU |
1429 | - g_set_application_name(_("Indicator Applet Application Menu")); |
1430 | -#endif |
1431 | - |
1432 | - g_log_set_default_handler(log_to_file, NULL); |
1433 | - |
1434 | - tomboy_keybinder_init(); |
1435 | - } |
1436 | - |
1437 | - /* Set panel options */ |
1438 | - gtk_container_set_border_width(GTK_CONTAINER (applet), 0); |
1439 | - panel_applet_set_flags(applet, PANEL_APPLET_EXPAND_MINOR); |
1440 | - menubar = gtk_menu_bar_new(); |
1441 | - action_group = gtk_action_group_new ("Indicator Applet Actions"); |
1442 | - gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE); |
1443 | - gtk_action_group_add_actions (action_group, menu_actions, |
1444 | - G_N_ELEMENTS (menu_actions), |
1445 | - menubar); |
1446 | - panel_applet_setup_menu(applet, menu_xml, action_group); |
1447 | - g_object_unref(action_group); |
1448 | -#ifdef INDICATOR_APPLET |
1449 | - atk_object_set_name (gtk_widget_get_accessible (GTK_WIDGET (applet)), |
1450 | - "indicator-applet"); |
1451 | -#endif |
1452 | -#ifdef INDICATOR_APPLET_SESSION |
1453 | - atk_object_set_name (gtk_widget_get_accessible (GTK_WIDGET (applet)), |
1454 | - "indicator-applet-session"); |
1455 | -#endif |
1456 | -#ifdef INDICATOR_APPLET_COMPLETE |
1457 | - atk_object_set_name (gtk_widget_get_accessible (GTK_WIDGET (applet)), |
1458 | - "indicator-applet-complete"); |
1459 | -#endif |
1460 | -#ifdef INDICATOR_APPLET_APPMENU |
1461 | - atk_object_set_name (gtk_widget_get_accessible (GTK_WIDGET (applet)), |
1462 | - "indicator-applet-appmenu"); |
1463 | -#endif |
1464 | - |
1465 | - /* Init some theme/icon stuff */ |
1466 | - gtk_icon_theme_append_search_path(gtk_icon_theme_get_default(), |
1467 | - INDICATOR_ICONS_DIR); |
1468 | - /* g_debug("Icons directory: %s", INDICATOR_ICONS_DIR); */ |
1469 | - gtk_rc_parse_string ( |
1470 | - "style \"indicator-applet-style\"\n" |
1471 | - "{\n" |
1472 | - " GtkMenuBar::shadow-type = none\n" |
1473 | - " GtkMenuBar::internal-padding = 0\n" |
1474 | - " GtkWidget::focus-line-width = 0\n" |
1475 | - " GtkWidget::focus-padding = 0\n" |
1476 | - "}\n" |
1477 | - "style \"indicator-applet-menubar-style\"\n" |
1478 | - "{\n" |
1479 | - " GtkMenuBar::shadow-type = none\n" |
1480 | - " GtkMenuBar::internal-padding = 0\n" |
1481 | - " GtkWidget::focus-line-width = 0\n" |
1482 | - " GtkWidget::focus-padding = 0\n" |
1483 | - " GtkMenuItem::horizontal-padding = 0\n" |
1484 | - "}\n" |
1485 | - "style \"indicator-applet-menuitem-style\"\n" |
1486 | - "{\n" |
1487 | - " GtkWidget::focus-line-width = 0\n" |
1488 | - " GtkWidget::focus-padding = 0\n" |
1489 | - " GtkMenuItem::horizontal-padding = 0\n" |
1490 | - "}\n" |
1491 | - "widget \"*.fast-user-switch-applet\" style \"indicator-applet-style\"" |
1492 | - "widget \"*.fast-user-switch-menuitem\" style \"indicator-applet-menuitem-style\"" |
1493 | - "widget \"*.fast-user-switch-menubar\" style \"indicator-applet-menubar-style\""); |
1494 | - //gtk_widget_set_name(GTK_WIDGET (applet), "indicator-applet-menubar"); |
1495 | - gtk_widget_set_name(GTK_WIDGET (applet), "fast-user-switch-applet"); |
1496 | - |
1497 | - /* Build menubar */ |
1498 | - orient = (panel_applet_get_orient(applet)); |
1499 | - packdirection = ((orient == PANEL_APPLET_ORIENT_UP) || |
1500 | - (orient == PANEL_APPLET_ORIENT_DOWN)) ? |
1501 | - GTK_PACK_DIRECTION_LTR : GTK_PACK_DIRECTION_TTB; |
1502 | - gtk_menu_bar_set_pack_direction(GTK_MENU_BAR(menubar), |
1503 | - packdirection); |
1504 | - GTK_WIDGET_SET_FLAGS (menubar, GTK_WIDGET_FLAGS(menubar) | GTK_CAN_FOCUS); |
1505 | - gtk_widget_set_name(GTK_WIDGET (menubar), "fast-user-switch-menubar"); |
1506 | - g_signal_connect(menubar, "button-press-event", G_CALLBACK(menubar_press), NULL); |
1507 | - g_signal_connect_after(menubar, "expose-event", G_CALLBACK(menubar_on_expose), menubar); |
1508 | - g_signal_connect(applet, "change-orient", |
1509 | - G_CALLBACK(panelapplet_reorient_cb), menubar); |
1510 | - gtk_container_set_border_width(GTK_CONTAINER(menubar), 0); |
1511 | - |
1512 | - /* Add in filter func */ |
1513 | - tomboy_keybinder_bind(hotkey_keycode, hotkey_filter, menubar); |
1514 | - |
1515 | - /* load 'em */ |
1516 | - if (g_file_test(INDICATOR_DIR, (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR))) { |
1517 | - GDir * dir = g_dir_open(INDICATOR_DIR, 0, NULL); |
1518 | - |
1519 | - const gchar * name; |
1520 | - while ((name = g_dir_read_name(dir)) != NULL) { |
1521 | -#ifdef INDICATOR_APPLET_APPMENU |
1522 | - if (g_strcmp0(name, "libappmenu.so")) { |
1523 | - continue; |
1524 | - } |
1525 | + static const GtkActionEntry menu_actions[] = { |
1526 | + {"About", GTK_STOCK_ABOUT, N_("_About"), NULL, NULL, G_CALLBACK(about_cb)} |
1527 | + }; |
1528 | + static const gchar *menu_xml = "<menuitem name=\"About\" action=\"About\"/>"; |
1529 | + |
1530 | + static gboolean first_time = FALSE; |
1531 | + GtkWidget *menubar; |
1532 | + gint indicators_loaded = 0; |
1533 | + GtkActionGroup *action_group; |
1534 | + GError *error = NULL; |
1535 | + |
1536 | +#ifdef INDICATOR_APPLET_SESSION |
1537 | + /* check if we are running stracciatella session */ |
1538 | + if (g_strcmp0(g_getenv("GDMSESSION"), "gnome-stracciatella") == 0) { |
1539 | + g_debug("Running stracciatella GNOME session, disabling myself"); |
1540 | + return TRUE; |
1541 | + } |
1542 | +#endif |
1543 | + |
1544 | + if (!first_time) |
1545 | + { |
1546 | + first_time = TRUE; |
1547 | +#ifdef INDICATOR_APPLET |
1548 | + g_set_application_name(_("Indicator Applet")); |
1549 | +#endif |
1550 | +#ifdef INDICATOR_APPLET_SESSION |
1551 | + g_set_application_name(_("Indicator Applet Session")); |
1552 | +#endif |
1553 | +#ifdef INDICATOR_APPLET_COMPLETE |
1554 | + g_set_application_name(_("Indicator Applet Complete")); |
1555 | +#endif |
1556 | +#ifdef INDICATOR_APPLET_APPMENU |
1557 | + g_set_application_name(_("Indicator Applet Application Menu")); |
1558 | +#endif |
1559 | + |
1560 | + g_log_set_default_handler(log_to_file, NULL); |
1561 | + |
1562 | + tomboy_keybinder_init(); |
1563 | + } |
1564 | + |
1565 | + /* Set panel options */ |
1566 | + gtk_container_set_border_width(GTK_CONTAINER (applet), 0); |
1567 | + panel_applet_set_flags(applet, PANEL_APPLET_EXPAND_MINOR); |
1568 | + menubar = gtk_menu_bar_new(); |
1569 | + action_group = gtk_action_group_new ("Indicator Applet Actions"); |
1570 | + gtk_action_group_set_translation_domain (action_group, GETTEXT_PACKAGE); |
1571 | + gtk_action_group_add_actions (action_group, menu_actions, |
1572 | + G_N_ELEMENTS (menu_actions), |
1573 | + menubar); |
1574 | + panel_applet_setup_menu(applet, menu_xml, action_group); |
1575 | + g_object_unref(action_group); |
1576 | +#ifdef INDICATOR_APPLET |
1577 | + atk_object_set_name (gtk_widget_get_accessible (GTK_WIDGET (applet)), |
1578 | + "indicator-applet"); |
1579 | +#endif |
1580 | +#ifdef INDICATOR_APPLET_SESSION |
1581 | + atk_object_set_name (gtk_widget_get_accessible (GTK_WIDGET (applet)), |
1582 | + "indicator-applet-session"); |
1583 | +#endif |
1584 | +#ifdef INDICATOR_APPLET_COMPLETE |
1585 | + atk_object_set_name (gtk_widget_get_accessible (GTK_WIDGET (applet)), |
1586 | + "indicator-applet-complete"); |
1587 | +#endif |
1588 | +#ifdef INDICATOR_APPLET_APPMENU |
1589 | + atk_object_set_name (gtk_widget_get_accessible (GTK_WIDGET (applet)), |
1590 | + "indicator-applet-appmenu"); |
1591 | +#endif |
1592 | + |
1593 | + /* Init some theme/icon stuff */ |
1594 | + gtk_icon_theme_append_search_path(gtk_icon_theme_get_default(), |
1595 | + INDICATOR_ICONS_DIR); |
1596 | + g_debug("Icons directory: %s", INDICATOR_ICONS_DIR); |
1597 | + |
1598 | + gtk_widget_set_name(GTK_WIDGET (applet), "fast-user-switch-applet"); |
1599 | + |
1600 | + /* Build menubar */ |
1601 | + orient = (panel_applet_get_orient(applet)); |
1602 | + packdirection = ((orient == PANEL_APPLET_ORIENT_UP) || |
1603 | + (orient == PANEL_APPLET_ORIENT_DOWN)) ? |
1604 | + GTK_PACK_DIRECTION_LTR : GTK_PACK_DIRECTION_TTB; |
1605 | + gtk_menu_bar_set_pack_direction(GTK_MENU_BAR(menubar), |
1606 | + packdirection); |
1607 | + gtk_widget_set_can_focus (GTK_WIDGET (menubar), TRUE); |
1608 | + gtk_widget_set_name(GTK_WIDGET (menubar), "fast-user-switch-menubar"); |
1609 | + g_signal_connect(menubar, "button-press-event", G_CALLBACK(menubar_press), NULL); |
1610 | + g_signal_connect(applet, "change-orient", |
1611 | + G_CALLBACK(panelapplet_reorient_cb), menubar); |
1612 | + gtk_container_set_border_width(GTK_CONTAINER(menubar), 0); |
1613 | + |
1614 | + /* Add in filter func */ |
1615 | + tomboy_keybinder_bind(hotkey_keycode, hotkey_filter, menubar); |
1616 | + |
1617 | + /* load 'em */ |
1618 | + if (g_file_test(INDICATOR_DIR, (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR))) { |
1619 | + GDir * dir = g_dir_open(INDICATOR_DIR, 0, NULL); |
1620 | + |
1621 | + const gchar * name; |
1622 | + while ((name = g_dir_read_name(dir)) != NULL) { |
1623 | +#ifdef INDICATOR_APPLET_APPMENU |
1624 | + if (g_strcmp0(name, "libappmenu.so")) { |
1625 | + continue; |
1626 | + } |
1627 | #else |
1628 | - if (!g_strcmp0(name, "libappmenu.so")) { |
1629 | - continue; |
1630 | - } |
1631 | + if (!g_strcmp0(name, "libappmenu.so")) { |
1632 | + continue; |
1633 | + } |
1634 | #endif |
1635 | #ifdef INDICATOR_APPLET |
1636 | - if (!g_strcmp0(name, "libsession.so")) { |
1637 | - continue; |
1638 | - } |
1639 | - if (!g_strcmp0(name, "libme.so")) { |
1640 | - continue; |
1641 | - } |
1642 | - if (!g_strcmp0(name, "libdatetime.so")) { |
1643 | - continue; |
1644 | - } |
1645 | + if (!g_strcmp0(name, "libsession.so")) { |
1646 | + continue; |
1647 | + } |
1648 | + if (!g_strcmp0(name, "libme.so")) { |
1649 | + continue; |
1650 | + } |
1651 | + if (!g_strcmp0(name, "libdatetime.so")) { |
1652 | + continue; |
1653 | + } |
1654 | #endif |
1655 | #ifdef INDICATOR_APPLET_SESSION |
1656 | - if (g_strcmp0(name, "libsession.so") && g_strcmp0(name, "libme.so")) { |
1657 | - continue; |
1658 | - } |
1659 | + if (g_strcmp0(name, "libsession.so") && g_strcmp0(name, "libme.so")) { |
1660 | + continue; |
1661 | + } |
1662 | #endif |
1663 | - if (load_module(name, menubar)) { |
1664 | - indicators_loaded++; |
1665 | - } |
1666 | - } |
1667 | - g_dir_close (dir); |
1668 | - } |
1669 | - |
1670 | - if (indicators_loaded == 0) { |
1671 | - /* A label to allow for click through */ |
1672 | - GtkWidget * item = gtk_label_new(_("No Indicators")); |
1673 | - gtk_container_add(GTK_CONTAINER(applet), item); |
1674 | - gtk_widget_show(item); |
1675 | - } else { |
1676 | - gtk_container_add(GTK_CONTAINER(applet), menubar); |
1677 | - panel_applet_set_background_widget(applet, menubar); |
1678 | - gtk_widget_show(menubar); |
1679 | - } |
1680 | - |
1681 | - /* Background of applet */ |
1682 | - g_signal_connect(applet, "change-background", |
1683 | - G_CALLBACK(cw_panel_background_changed), menubar); |
1684 | - |
1685 | - gtk_widget_show(GTK_WIDGET(applet)); |
1686 | - |
1687 | - return TRUE; |
1688 | - |
1689 | -} |
1690 | - |
1691 | -static void |
1692 | -cw_panel_background_changed (PanelApplet *applet, |
1693 | - PanelAppletBackgroundType type, |
1694 | - GdkColor *colour, |
1695 | - GdkPixmap *pixmap, |
1696 | - GtkWidget *menubar) |
1697 | -{ |
1698 | - GtkRcStyle *rc_style; |
1699 | - GtkStyle *style; |
1700 | - |
1701 | - /* reset style */ |
1702 | - gtk_widget_set_style(GTK_WIDGET (applet), NULL); |
1703 | - gtk_widget_set_style(menubar, NULL); |
1704 | - rc_style = gtk_rc_style_new (); |
1705 | - gtk_widget_modify_style(GTK_WIDGET (applet), rc_style); |
1706 | - gtk_widget_modify_style(menubar, rc_style); |
1707 | - gtk_rc_style_unref(rc_style); |
1708 | - |
1709 | - switch (type) |
1710 | - { |
1711 | - case PANEL_NO_BACKGROUND: |
1712 | - break; |
1713 | - case PANEL_COLOR_BACKGROUND: |
1714 | - gtk_widget_modify_bg(GTK_WIDGET (applet), GTK_STATE_NORMAL, colour); |
1715 | - gtk_widget_modify_bg(menubar, GTK_STATE_NORMAL, colour); |
1716 | - break; |
1717 | - |
1718 | - case PANEL_PIXMAP_BACKGROUND: |
1719 | - style = gtk_style_copy(GTK_WIDGET (applet)->style); |
1720 | - if (style->bg_pixmap[GTK_STATE_NORMAL]) |
1721 | - g_object_unref(style->bg_pixmap[GTK_STATE_NORMAL]); |
1722 | - style->bg_pixmap[GTK_STATE_NORMAL] = g_object_ref (pixmap); |
1723 | - gtk_widget_set_style(GTK_WIDGET (applet), style); |
1724 | - gtk_widget_set_style(GTK_WIDGET (menubar), style); |
1725 | - g_object_unref(style); |
1726 | - break; |
1727 | - } |
1728 | + if (load_module(name, menubar)) { |
1729 | + indicators_loaded++; |
1730 | + } |
1731 | + } |
1732 | + g_dir_close (dir); |
1733 | + } |
1734 | + |
1735 | + if (indicators_loaded == 0) { |
1736 | + /* A label to allow for click through */ |
1737 | + GtkWidget * item = gtk_label_new(_("No Indicators")); |
1738 | + gtk_container_add(GTK_CONTAINER(applet), item); |
1739 | + gtk_widget_show(item); |
1740 | + } else { |
1741 | + gtk_container_add(GTK_CONTAINER(applet), menubar); |
1742 | + panel_applet_set_background_widget(applet, menubar); |
1743 | + gtk_widget_show(menubar); |
1744 | + } |
1745 | + |
1746 | + gtk_widget_show(GTK_WIDGET(applet)); |
1747 | + |
1748 | + return TRUE; |
1749 | } |
1750 | |
1751 | |
1752 | === modified file 'src/eggaccelerators.c' |
1753 | --- src/eggaccelerators.c 2010-03-02 22:24:00 +0000 |
1754 | +++ src/eggaccelerators.c 2011-11-26 02:05:26 +0000 |
1755 | @@ -578,20 +578,20 @@ |
1756 | j = 0; |
1757 | while (j < n_entries) |
1758 | { |
1759 | - if (keyvals[j] == GDK_Num_Lock) |
1760 | + if (keyvals[j] == GDK_KEY_Num_Lock) |
1761 | mask |= EGG_VIRTUAL_NUM_LOCK_MASK; |
1762 | - else if (keyvals[j] == GDK_Scroll_Lock) |
1763 | + else if (keyvals[j] == GDK_KEY_Scroll_Lock) |
1764 | mask |= EGG_VIRTUAL_SCROLL_LOCK_MASK; |
1765 | - else if (keyvals[j] == GDK_Meta_L || |
1766 | - keyvals[j] == GDK_Meta_R) |
1767 | + else if (keyvals[j] == GDK_KEY_Meta_L || |
1768 | + keyvals[j] == GDK_KEY_Meta_R) |
1769 | mask |= EGG_VIRTUAL_META_MASK; |
1770 | - else if (keyvals[j] == GDK_Hyper_L || |
1771 | - keyvals[j] == GDK_Hyper_R) |
1772 | + else if (keyvals[j] == GDK_KEY_Hyper_L || |
1773 | + keyvals[j] == GDK_KEY_Hyper_R) |
1774 | mask |= EGG_VIRTUAL_HYPER_MASK; |
1775 | - else if (keyvals[j] == GDK_Super_L || |
1776 | - keyvals[j] == GDK_Super_R) |
1777 | + else if (keyvals[j] == GDK_KEY_Super_L || |
1778 | + keyvals[j] == GDK_KEY_Super_R) |
1779 | mask |= EGG_VIRTUAL_SUPER_MASK; |
1780 | - else if (keyvals[j] == GDK_Mode_switch) |
1781 | + else if (keyvals[j] == GDK_KEY_Mode_switch) |
1782 | mask |= EGG_VIRTUAL_MODE_SWITCH_MASK; |
1783 | |
1784 | ++j; |
1785 | |
1786 | === modified file 'src/eggaccelerators.h' |
1787 | --- src/eggaccelerators.h 2010-03-02 22:24:00 +0000 |
1788 | +++ src/eggaccelerators.h 2011-11-26 02:05:26 +0000 |
1789 | @@ -20,7 +20,7 @@ |
1790 | #ifndef __EGG_ACCELERATORS_H__ |
1791 | #define __EGG_ACCELERATORS_H__ |
1792 | |
1793 | -#include <gtk/gtkaccelgroup.h> |
1794 | +#include <gtk/gtk.h> |
1795 | #include <gdk/gdk.h> |
1796 | |
1797 | G_BEGIN_DECLS |
1798 | |
1799 | === modified file 'src/tomboykeybinder.c' |
1800 | --- src/tomboykeybinder.c 2010-05-04 16:54:22 +0000 |
1801 | +++ src/tomboykeybinder.c 2011-11-26 02:05:26 +0000 |
1802 | @@ -18,7 +18,6 @@ |
1803 | #include <string.h> |
1804 | |
1805 | #include <gdk/gdk.h> |
1806 | -#include <gdk/gdkwindow.h> |
1807 | #include <gdk/gdkx.h> |
1808 | #include <X11/Xlib.h> |
1809 | |
1810 | @@ -86,7 +85,7 @@ |
1811 | XGrabKey (GDK_WINDOW_XDISPLAY (rootwin), |
1812 | binding->keycode, |
1813 | binding->modifiers | mod_masks [i], |
1814 | - GDK_WINDOW_XWINDOW (rootwin), |
1815 | + GDK_WINDOW_XID (rootwin), |
1816 | False, |
1817 | GrabModeAsync, |
1818 | GrabModeAsync); |
1819 | @@ -94,7 +93,7 @@ |
1820 | XUngrabKey (GDK_WINDOW_XDISPLAY (rootwin), |
1821 | binding->keycode, |
1822 | binding->modifiers | mod_masks [i], |
1823 | - GDK_WINDOW_XWINDOW (rootwin)); |
1824 | + GDK_WINDOW_XID (rootwin)); |
1825 | } |
1826 | } |
1827 | } |
1828 | @@ -312,7 +311,7 @@ |
1829 | XModifierKeymap *mod_keymap; |
1830 | gboolean retval = FALSE; |
1831 | |
1832 | - mod_keymap = XGetModifierMapping (gdk_display); |
1833 | + mod_keymap = XGetModifierMapping (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ())); |
1834 | |
1835 | map_size = 8 * mod_keymap->max_keypermod; |
1836 |
Builds and works for me™, though not for all (see https:/ /bugs.launchpad .net/indicator- applet/ +bug/724369/ comments/ 27).
Note that my branch lp:~mitya57/indicator-session/fix-lp-881832 should be merged as well to get this working properly.