Merge lp:~ted/indicator-applet/code-unification into lp:indicator-applet/0.4
- code-unification
- Merge into applet
Proposed by
Ted Gould
Status: | Merged |
---|---|
Merged at revision: | not available |
Proposed branch: | lp:~ted/indicator-applet/code-unification |
Merge into: | lp:indicator-applet/0.4 |
Diff against target: |
612 lines (+122/-344) 10 files modified
.bzrignore (+3/-0) Makefile.am (+0/-1) configure.ac (+0/-1) data/GNOME_IndicatorAppletComplete.server.in.in (+28/-0) data/Makefile.am (+2/-0) po/POTFILES.in (+1/-1) src-session/Makefile.am (+0/-17) src-session/applet-main.c (+0/-320) src/Makefile.am (+35/-2) src/applet-main.c (+53/-2) |
To merge this branch: | bzr merge lp:~ted/indicator-applet/code-unification |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Robert Collins (community) | Approve | ||
Review via email: mp+16809@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
Revision history for this message
Ted Gould (ted) wrote : | # |
Revision history for this message
Robert Collins (lifeless) wrote : | # |
review: approve
This is a clear reduction in duplicate code so +1. I'll note though that
it may be a little hard to scale up and work with vs structuring it as
some code with overridable helpers, or a set of callable trivial
functions. But that can be examined in future.
-Rob
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file '.bzrignore' |
2 | --- .bzrignore 2009-08-18 15:50:35 +0000 |
3 | +++ .bzrignore 2010-01-04 20:49:11 +0000 |
4 | @@ -104,3 +104,6 @@ |
5 | data/GNOME_IndicatorAppletSUS.server.in |
6 | src-session/indicator-applet-no-sus |
7 | src-session/indicator-applet-session |
8 | +src/indicator-applet-complete |
9 | +src/indicator-applet-session |
10 | +data/GNOME_IndicatorAppletComplete.server |
11 | |
12 | === modified file 'Makefile.am' |
13 | --- Makefile.am 2009-08-24 18:22:32 +0000 |
14 | +++ Makefile.am 2010-01-04 20:49:11 +0000 |
15 | @@ -1,7 +1,6 @@ |
16 | |
17 | SUBDIRS = \ |
18 | src \ |
19 | - src-session \ |
20 | data \ |
21 | po |
22 | |
23 | |
24 | === modified file 'configure.ac' |
25 | --- configure.ac 2009-12-10 17:27:22 +0000 |
26 | +++ configure.ac 2010-01-04 20:49:11 +0000 |
27 | @@ -124,7 +124,6 @@ |
28 | AC_OUTPUT([ |
29 | Makefile |
30 | src/Makefile |
31 | -src-session/Makefile |
32 | data/Makefile |
33 | po/Makefile.in |
34 | ]) |
35 | |
36 | === added file 'data/GNOME_IndicatorAppletComplete.server.in.in' |
37 | --- data/GNOME_IndicatorAppletComplete.server.in.in 1970-01-01 00:00:00 +0000 |
38 | +++ data/GNOME_IndicatorAppletComplete.server.in.in 2010-01-04 20:49:11 +0000 |
39 | @@ -0,0 +1,28 @@ |
40 | +<oaf_info> |
41 | + <oaf_server iid="OAFIID:GNOME_IndicatorAppletComplete_Factory" type="exe" |
42 | + location="@LIBEXECDIR@/indicator-applet-complete"> |
43 | + |
44 | + <oaf_attribute name="repo_ids" type="stringv"> |
45 | + <item value="IDL:Bonobo/GenericFactory:1.0"/> |
46 | + <item value="IDL:Bonobo/Unknown:1.0"/> |
47 | + </oaf_attribute> |
48 | + <oaf_attribute name="name" type="string" value="Indicator Applet Complete Factory"/> |
49 | + <oaf_attribute name="description" type="string" value="Indicator Applet Complete Factory"/> |
50 | + <oaf_attribute name="bonobo:environment" type="stringv"> |
51 | + <item value="DBUS_SESSION_BUS_ADDRESS"/> |
52 | + </oaf_attribute> |
53 | + </oaf_server> |
54 | + |
55 | + <oaf_server iid="OAFIID:GNOME_IndicatorAppletComplete" type="factory" |
56 | + location="OAFIID:GNOME_IndicatorAppletComplete_Factory"> |
57 | + |
58 | + <oaf_attribute name="repo_ids" type="stringv"> |
59 | + <item value="IDL:GNOME/Vertigo/PanelAppletShell:1.0"/> |
60 | + <item value="IDL:Bonobo/Control:1.0"/> |
61 | + <item value="IDL:Bonobo/Unknown:1.0"/> |
62 | + </oaf_attribute> |
63 | + <oaf_attribute name="name" type="string" _value="Indicator Applet Complete"/> |
64 | + <oaf_attribute name="description" type="string" _value="A unified applet containing all of the indicators."/> |
65 | + <oaf_attribute name="panel:icon" type="string" value="indicator-applet"/> |
66 | + </oaf_server> |
67 | +</oaf_info> |
68 | |
69 | === modified file 'data/Makefile.am' |
70 | --- data/Makefile.am 2009-08-07 17:47:02 +0000 |
71 | +++ data/Makefile.am 2010-01-04 20:49:11 +0000 |
72 | @@ -8,6 +8,7 @@ |
73 | $(libdir)/bonobo/servers |
74 | server_in_files = \ |
75 | GNOME_IndicatorApplet.server.in \ |
76 | + GNOME_IndicatorAppletComplete.server.in \ |
77 | GNOME_FastUserSwitchApplet.server.in |
78 | server_DATA = \ |
79 | $(server_in_files:.server.in=.server) |
80 | @@ -68,6 +69,7 @@ |
81 | EXTRA_DIST = \ |
82 | $(icons_DATA) \ |
83 | GNOME_IndicatorApplet.server.in.in \ |
84 | + GNOME_IndicatorAppletComplete.server.in.in \ |
85 | GNOME_FastUserSwitchApplet.server.in.in \ |
86 | $(schema_in_files) |
87 | |
88 | |
89 | === modified file 'po/POTFILES.in' |
90 | --- po/POTFILES.in 2009-08-18 16:03:40 +0000 |
91 | +++ po/POTFILES.in 2010-01-04 20:49:11 +0000 |
92 | @@ -1,6 +1,6 @@ |
93 | [encoding: UTF-8] |
94 | data/GNOME_IndicatorApplet.server.in.in |
95 | +data/GNOME_IndicatorAppletComplete.server.in.in |
96 | data/GNOME_FastUserSwitchApplet.server.in.in |
97 | data/indicator-applet.schemas.in |
98 | src/applet-main.c |
99 | -src-session/applet-main.c |
100 | |
101 | === removed directory 'src-session' |
102 | === removed file 'src-session/Makefile.am' |
103 | --- src-session/Makefile.am 2009-08-24 18:22:32 +0000 |
104 | +++ src-session/Makefile.am 1970-01-01 00:00:00 +0000 |
105 | @@ -1,17 +0,0 @@ |
106 | - |
107 | -libexec_PROGRAMS = \ |
108 | - indicator-applet-session |
109 | - |
110 | -indicator_applet_session_CFLAGS = \ |
111 | - -DG_LOG_DOMAIN=\""Indicator-Applet"\" \ |
112 | - -DDATADIR=\""$(datadir)"\" \ |
113 | - -DINDICATOR_DIR=\""$(INDICATORDIR)"\" \ |
114 | - -DINDICATOR_ICONS_DIR=\""$(INDICATORICONSDIR)"\" \ |
115 | - -I$(srcdir)/.. \ |
116 | - $(APPLET_CFLAGS) |
117 | - |
118 | -indicator_applet_session_SOURCES = \ |
119 | - applet-main.c |
120 | - |
121 | -indicator_applet_session_LDADD = \ |
122 | - $(APPLET_LIBS) |
123 | |
124 | === removed file 'src-session/applet-main.c' |
125 | --- src-session/applet-main.c 2009-12-24 16:43:37 +0000 |
126 | +++ src-session/applet-main.c 1970-01-01 00:00:00 +0000 |
127 | @@ -1,320 +0,0 @@ |
128 | -/* |
129 | -A small wrapper utility to load indicators and put them as menu items |
130 | -into the gnome-panel using it's applet interface. |
131 | - |
132 | -Copyright 2009 Canonical Ltd. |
133 | - |
134 | -Authors: |
135 | - Ted Gould <ted@canonical.com> |
136 | - |
137 | -This program is free software: you can redistribute it and/or modify it |
138 | -under the terms of the GNU General Public License version 3, as published |
139 | -by the Free Software Foundation. |
140 | - |
141 | -This program is distributed in the hope that it will be useful, but |
142 | -WITHOUT ANY WARRANTY; without even the implied warranties of |
143 | -MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR |
144 | -PURPOSE. See the GNU General Public License for more details. |
145 | - |
146 | -You should have received a copy of the GNU General Public License along |
147 | -with this program. If not, see <http://www.gnu.org/licenses/>. |
148 | -*/ |
149 | - |
150 | -#include <config.h> |
151 | -#include <panel-applet.h> |
152 | - |
153 | -#include "libindicator/indicator-object.h" |
154 | - |
155 | -static gboolean applet_fill_cb (PanelApplet * applet, const gchar * iid, gpointer data); |
156 | - |
157 | - |
158 | -static void cw_panel_background_changed (PanelApplet *applet, |
159 | - PanelAppletBackgroundType type, |
160 | - GdkColor *colour, |
161 | - GdkPixmap *pixmap, |
162 | - GtkWidget *menubar); |
163 | - |
164 | -/************* |
165 | - * main |
166 | - * ***********/ |
167 | - |
168 | -PANEL_APPLET_BONOBO_FACTORY ("OAFIID:GNOME_FastUserSwitchApplet_Factory", |
169 | - PANEL_TYPE_APPLET, |
170 | - "indicator-applet-session", "0", |
171 | - applet_fill_cb, NULL); |
172 | - |
173 | -/************* |
174 | - * init function |
175 | - * ***********/ |
176 | -static gboolean |
177 | -load_module (const gchar * name, GtkWidget * menu) |
178 | -{ |
179 | - g_debug("Looking at Module: %s", name); |
180 | - g_return_val_if_fail(name != NULL, FALSE); |
181 | - |
182 | - if (!g_str_has_suffix(name, G_MODULE_SUFFIX)) { |
183 | - return FALSE; |
184 | - } |
185 | - |
186 | - g_debug("Loading Module: %s", name); |
187 | - |
188 | - gchar * fullpath = g_build_filename(INDICATOR_DIR, name, NULL); |
189 | - IndicatorObject * io = indicator_object_new_from_file(fullpath); |
190 | - g_free(fullpath); |
191 | - |
192 | - GList * entries = indicator_object_get_entries(io); |
193 | - GList * entry = NULL; |
194 | - |
195 | - for (entry = entries; entry != NULL; entry = g_list_next(entry)) { |
196 | - IndicatorObjectEntry * entrydata = (IndicatorObjectEntry *)entry->data; |
197 | - |
198 | - GtkWidget * menuitem = gtk_menu_item_new(); |
199 | - GtkWidget * hbox = gtk_hbox_new(FALSE, 3); |
200 | - if (entrydata->image != NULL) { |
201 | - gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(entrydata->image), FALSE, FALSE, 0); |
202 | - } |
203 | - if (entrydata->label != NULL) { |
204 | - gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(entrydata->label), FALSE, FALSE, 0); |
205 | - } |
206 | - gtk_container_add(GTK_CONTAINER(menuitem), hbox); |
207 | - gtk_widget_show(hbox); |
208 | - |
209 | - if (entrydata->menu != NULL) { |
210 | - gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), GTK_WIDGET(entrydata->menu)); |
211 | - } |
212 | - |
213 | - gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); |
214 | - gtk_widget_show(menuitem); |
215 | - } |
216 | - |
217 | - g_list_free(entries); |
218 | - |
219 | - return TRUE; |
220 | -} |
221 | - |
222 | -static gboolean |
223 | -menubar_press (GtkWidget * widget, |
224 | - GdkEventButton *event, |
225 | - gpointer data) |
226 | -{ |
227 | - if (event->button != 1) { |
228 | - g_signal_stop_emission_by_name(widget, "button-press-event"); |
229 | - } |
230 | - |
231 | - return FALSE; |
232 | -} |
233 | - |
234 | -static gboolean |
235 | -menubar_on_expose (GtkWidget * widget, |
236 | - GdkEventExpose *event, |
237 | - GtkWidget * menubar) |
238 | -{ |
239 | - if (GTK_WIDGET_HAS_FOCUS(menubar)) |
240 | - gtk_paint_focus(widget->style, widget->window, GTK_WIDGET_STATE(menubar), |
241 | - NULL, widget, "menubar-applet", 0, 0, -1, -1); |
242 | - |
243 | - return FALSE; |
244 | -} |
245 | - |
246 | -static void |
247 | -about_cb (BonoboUIComponent *ui_container, |
248 | - gpointer data, |
249 | - const gchar *cname) |
250 | -{ |
251 | - static const gchar *authors[] = { |
252 | - "Ted Gould <ted@canonical.com>", |
253 | - NULL |
254 | - }; |
255 | - |
256 | - static gchar *license[] = { |
257 | - N_("This program is free software: you can redistribute it and/or modify it " |
258 | - "under the terms of the GNU General Public License version 3, as published " |
259 | - "by the Free Software Foundation."), |
260 | - N_("This program is distributed in the hope that it will be useful, but " |
261 | - "WITHOUT ANY WARRANTY; without even the implied warranties of " |
262 | - "MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR " |
263 | - "PURPOSE. See the GNU General Public License for more details."), |
264 | - N_("You should have received a copy of the GNU General Public License along " |
265 | - "with this program. If not, see <http://www.gnu.org/licenses/>."), |
266 | - NULL |
267 | - }; |
268 | - gchar *license_i18n; |
269 | - |
270 | - license_i18n = g_strconcat (_(license[0]), "\n\n", _(license[1]), "\n\n", _(license[2]), NULL); |
271 | - |
272 | - gtk_show_about_dialog(NULL, |
273 | - "version", VERSION, |
274 | - "copyright", "Copyright \xc2\xa9 2009 Canonical, Ltd.", |
275 | - "comments", _("A place to adjust your status, change users or exit your session."), |
276 | - "authors", authors, |
277 | - "license", license_i18n, |
278 | - "wrap-license", TRUE, |
279 | - "translator-credits", _("translator-credits"), |
280 | - "logo-icon-name", "indicator-applet", |
281 | - "icon-name", "indicator-applet", |
282 | - "website", "http://launchpad.net/indicator-applet", |
283 | - "website-label", _("Indicator Applet Website"), |
284 | - NULL |
285 | - ); |
286 | - |
287 | - g_free (license_i18n); |
288 | - |
289 | - return; |
290 | -} |
291 | - |
292 | -#ifdef N_ |
293 | -#undef N_ |
294 | -#endif |
295 | -#define N_(x) x |
296 | - |
297 | -static gboolean |
298 | -applet_fill_cb (PanelApplet * applet, const gchar * iid, gpointer data) |
299 | -{ |
300 | - static const BonoboUIVerb menu_verbs[] = { |
301 | - BONOBO_UI_VERB ("IndicatorAppletAbout", about_cb), |
302 | - BONOBO_UI_VERB_END |
303 | - }; |
304 | - static const gchar * menu_xml = |
305 | - "<popup name=\"button3\">" |
306 | - "<menuitem name=\"About Item\" verb=\"IndicatorAppletAbout\" _label=\"" N_("_About") "\" pixtype=\"stock\" pixname=\"gtk-about\"/>" |
307 | - "</popup>"; |
308 | - |
309 | - GtkWidget *menubar; |
310 | - gint i; |
311 | - gint indicators_loaded = 0; |
312 | - static gboolean first_time = FALSE; |
313 | - |
314 | - /* check if we are running stracciatella session */ |
315 | - if (g_strcmp0(g_getenv("GDMSESSION"), "gnome-stracciatella") == 0) { |
316 | - g_debug("Running stracciatella GNOME session, disabling myself"); |
317 | - return TRUE; |
318 | - } |
319 | - |
320 | - if (!first_time) |
321 | - { |
322 | - first_time = TRUE; |
323 | - g_set_application_name(_("Indicator Applet Session")); |
324 | - } |
325 | - |
326 | - /* Set panel options */ |
327 | - gtk_container_set_border_width(GTK_CONTAINER (applet), 0); |
328 | - panel_applet_set_flags(applet, PANEL_APPLET_EXPAND_MINOR); |
329 | - panel_applet_setup_menu(applet, menu_xml, menu_verbs, NULL); |
330 | - atk_object_set_name (gtk_widget_get_accessible (GTK_WIDGET (applet)), |
331 | - "indicator-applet-session"); |
332 | - |
333 | - /* Init some theme/icon stuff */ |
334 | - gtk_icon_theme_append_search_path(gtk_icon_theme_get_default(), |
335 | - INDICATOR_ICONS_DIR); |
336 | - /* g_debug("Icons directory: %s", INDICATOR_ICONS_DIR); */ |
337 | - gtk_rc_parse_string ( |
338 | - "style \"indicator-applet-style\"\n" |
339 | - "{\n" |
340 | - " GtkMenuBar::shadow-type = none\n" |
341 | - " GtkMenuBar::internal-padding = 0\n" |
342 | - " GtkWidget::focus-line-width = 0\n" |
343 | - " GtkWidget::focus-padding = 0\n" |
344 | - "}\n" |
345 | - "style \"indicator-applet-menubar-style\"\n" |
346 | - "{\n" |
347 | - " GtkMenuBar::shadow-type = none\n" |
348 | - " GtkMenuBar::internal-padding = 0\n" |
349 | - " GtkWidget::focus-line-width = 0\n" |
350 | - " GtkWidget::focus-padding = 0\n" |
351 | - " GtkMenuItem::horizontal-padding = 0\n" |
352 | - "}\n" |
353 | - "style \"indicator-applet-menuitem-style\"\n" |
354 | - "{\n" |
355 | - " GtkWidget::focus-line-width = 0\n" |
356 | - " GtkWidget::focus-padding = 0\n" |
357 | - " GtkMenuItem::horizontal-padding = 0\n" |
358 | - "}\n" |
359 | - "widget \"*.fast-user-switch-applet\" style \"indicator-applet-style\"" |
360 | - "widget \"*.fast-user-switch-menuitem\" style \"indicator-applet-menuitem-style\"" |
361 | - "widget \"*.fast-user-switch-menubar\" style \"indicator-applet-menubar-style\""); |
362 | - //gtk_widget_set_name(GTK_WIDGET (applet), "indicator-applet-menubar"); |
363 | - gtk_widget_set_name(GTK_WIDGET (applet), "fast-user-switch-applet"); |
364 | - |
365 | - /* Build menubar */ |
366 | - menubar = gtk_menu_bar_new(); |
367 | - GTK_WIDGET_SET_FLAGS (menubar, GTK_WIDGET_FLAGS(menubar) | GTK_CAN_FOCUS); |
368 | - gtk_widget_set_name(GTK_WIDGET (menubar), "fast-user-switch-menubar"); |
369 | - g_signal_connect(menubar, "button-press-event", G_CALLBACK(menubar_press), NULL); |
370 | - g_signal_connect_after(menubar, "expose-event", G_CALLBACK(menubar_on_expose), menubar); |
371 | - gtk_container_set_border_width(GTK_CONTAINER(menubar), 0); |
372 | - |
373 | - /* load 'em */ |
374 | - if (g_file_test(INDICATOR_DIR, (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR))) { |
375 | - GDir * dir = g_dir_open(INDICATOR_DIR, 0, NULL); |
376 | - |
377 | - const gchar * name; |
378 | - while ((name = g_dir_read_name(dir)) != NULL) { |
379 | - if (g_strcmp0(name, "libsession.so") && g_strcmp0(name, "libme.so")) { |
380 | - continue; |
381 | - } |
382 | - if (load_module(name, menubar)) { |
383 | - indicators_loaded++; |
384 | - } |
385 | - } |
386 | - g_dir_close (dir); |
387 | - } |
388 | - |
389 | - if (indicators_loaded == 0) { |
390 | - /* A label to allow for click through */ |
391 | - GtkWidget * item = gtk_label_new(_("No Indicators")); |
392 | - gtk_container_add(GTK_CONTAINER(applet), item); |
393 | - gtk_widget_show(item); |
394 | - } else { |
395 | - gtk_container_add(GTK_CONTAINER(applet), menubar); |
396 | - panel_applet_set_background_widget(applet, menubar); |
397 | - gtk_widget_show(menubar); |
398 | - } |
399 | - |
400 | - /* Background of applet */ |
401 | - g_signal_connect(applet, "change-background", |
402 | - G_CALLBACK(cw_panel_background_changed), menubar); |
403 | - |
404 | - gtk_widget_show(GTK_WIDGET(applet)); |
405 | - |
406 | - return TRUE; |
407 | -} |
408 | - |
409 | -static void |
410 | -cw_panel_background_changed (PanelApplet *applet, |
411 | - PanelAppletBackgroundType type, |
412 | - GdkColor *colour, |
413 | - GdkPixmap *pixmap, |
414 | - GtkWidget *menubar) |
415 | -{ |
416 | - GtkRcStyle *rc_style; |
417 | - GtkStyle *style; |
418 | - |
419 | - /* reset style */ |
420 | - gtk_widget_set_style(GTK_WIDGET (applet), NULL); |
421 | - gtk_widget_set_style(menubar, NULL); |
422 | - rc_style = gtk_rc_style_new (); |
423 | - gtk_widget_modify_style(GTK_WIDGET (applet), rc_style); |
424 | - gtk_widget_modify_style(menubar, rc_style); |
425 | - gtk_rc_style_unref(rc_style); |
426 | - |
427 | - switch (type) |
428 | - { |
429 | - case PANEL_NO_BACKGROUND: |
430 | - break; |
431 | - case PANEL_COLOR_BACKGROUND: |
432 | - gtk_widget_modify_bg(GTK_WIDGET (applet), GTK_STATE_NORMAL, colour); |
433 | - gtk_widget_modify_bg(menubar, GTK_STATE_NORMAL, colour); |
434 | - break; |
435 | - |
436 | - case PANEL_PIXMAP_BACKGROUND: |
437 | - style = gtk_style_copy(GTK_WIDGET (applet)->style); |
438 | - if (style->bg_pixmap[GTK_STATE_NORMAL]) |
439 | - g_object_unref(style->bg_pixmap[GTK_STATE_NORMAL]); |
440 | - style->bg_pixmap[GTK_STATE_NORMAL] = g_object_ref (pixmap); |
441 | - gtk_widget_set_style(GTK_WIDGET (applet), style); |
442 | - gtk_widget_set_style(GTK_WIDGET (menubar), style); |
443 | - g_object_unref(style); |
444 | - break; |
445 | - } |
446 | -} |
447 | - |
448 | |
449 | === modified file 'src/Makefile.am' |
450 | --- src/Makefile.am 2009-08-24 18:22:32 +0000 |
451 | +++ src/Makefile.am 2010-01-04 20:49:11 +0000 |
452 | @@ -1,17 +1,50 @@ |
453 | |
454 | libexec_PROGRAMS = \ |
455 | - indicator-applet |
456 | + indicator-applet \ |
457 | + indicator-applet-session \ |
458 | + indicator-applet-complete |
459 | |
460 | indicator_applet_CFLAGS = \ |
461 | -DG_LOG_DOMAIN=\""Indicator-Applet"\" \ |
462 | -DDATADIR=\""$(datadir)"\" \ |
463 | -DINDICATOR_DIR=\""$(INDICATORDIR)"\" \ |
464 | -DINDICATOR_ICONS_DIR=\""$(INDICATORICONSDIR)"\" \ |
465 | + -DINDICATOR_APPLET \ |
466 | -I$(srcdir)/.. \ |
467 | $(APPLET_CFLAGS) |
468 | |
469 | -indicator_applet_SOURCES = \ |
470 | +indicator_applet_SOURCES = \ |
471 | applet-main.c |
472 | |
473 | indicator_applet_LDADD = \ |
474 | $(APPLET_LIBS) |
475 | + |
476 | +indicator_applet_session_CFLAGS = \ |
477 | + -DG_LOG_DOMAIN=\""Indicator-Applet-Session"\" \ |
478 | + -DDATADIR=\""$(datadir)"\" \ |
479 | + -DINDICATOR_DIR=\""$(INDICATORDIR)"\" \ |
480 | + -DINDICATOR_ICONS_DIR=\""$(INDICATORICONSDIR)"\" \ |
481 | + -DINDICATOR_APPLET_SESSION \ |
482 | + -I$(srcdir)/.. \ |
483 | + $(APPLET_CFLAGS) |
484 | + |
485 | +indicator_applet_session_SOURCES = \ |
486 | + applet-main.c |
487 | + |
488 | +indicator_applet_session_LDADD = \ |
489 | + $(APPLET_LIBS) |
490 | + |
491 | +indicator_applet_complete_CFLAGS = \ |
492 | + -DG_LOG_DOMAIN=\""Indicator-Applet-Complete"\" \ |
493 | + -DDATADIR=\""$(datadir)"\" \ |
494 | + -DINDICATOR_DIR=\""$(INDICATORDIR)"\" \ |
495 | + -DINDICATOR_ICONS_DIR=\""$(INDICATORICONSDIR)"\" \ |
496 | + -DINDICATOR_APPLET_COMPLETE \ |
497 | + -I$(srcdir)/.. \ |
498 | + $(APPLET_CFLAGS) |
499 | + |
500 | +indicator_applet_complete_SOURCES = \ |
501 | + applet-main.c |
502 | + |
503 | +indicator_applet_complete_LDADD = \ |
504 | + $(APPLET_LIBS) |
505 | |
506 | === modified file 'src/applet-main.c' |
507 | --- src/applet-main.c 2010-01-04 02:23:10 +0000 |
508 | +++ src/applet-main.c 2010-01-04 20:49:11 +0000 |
509 | @@ -40,10 +40,24 @@ |
510 | * main |
511 | * ***********/ |
512 | |
513 | +#ifdef INDICATOR_APPLET |
514 | PANEL_APPLET_BONOBO_FACTORY ("OAFIID:GNOME_IndicatorApplet_Factory", |
515 | PANEL_TYPE_APPLET, |
516 | "indicator-applet", "0", |
517 | applet_fill_cb, NULL); |
518 | +#endif |
519 | +#ifdef INDICATOR_APPLET_SESSION |
520 | +PANEL_APPLET_BONOBO_FACTORY ("OAFIID:GNOME_FastUserSwitchApplet_Factory", |
521 | + PANEL_TYPE_APPLET, |
522 | + "indicator-applet-session", "0", |
523 | + applet_fill_cb, NULL); |
524 | +#endif |
525 | +#ifdef INDICATOR_APPLET_COMPLETE |
526 | +PANEL_APPLET_BONOBO_FACTORY ("OAFIID:GNOME_IndicatorAppletComplete_Factory", |
527 | + PANEL_TYPE_APPLET, |
528 | + "indicator-applet-complete", "0", |
529 | + applet_fill_cb, NULL); |
530 | +#endif |
531 | |
532 | /************* |
533 | * init function |
534 | @@ -188,7 +202,11 @@ |
535 | gtk_show_about_dialog(NULL, |
536 | "version", VERSION, |
537 | "copyright", "Copyright \xc2\xa9 2009 Canonical, Ltd.", |
538 | +#ifdef INDICATOR_APPLET_SESSION |
539 | + "comments", _("A place to adjust your status, change users or exit your session."), |
540 | +#else |
541 | "comments", _("An applet to hold all of the system indicators."), |
542 | +#endif |
543 | "authors", authors, |
544 | "license", license_i18n, |
545 | "wrap-license", TRUE, |
546 | @@ -227,18 +245,44 @@ |
547 | gint indicators_loaded = 0; |
548 | static gboolean first_time = FALSE; |
549 | |
550 | +#ifdef INDICATOR_APPLET_SESSION |
551 | + /* check if we are running stracciatella session */ |
552 | + if (g_strcmp0(g_getenv("GDMSESSION"), "gnome-stracciatella") == 0) { |
553 | + g_debug("Running stracciatella GNOME session, disabling myself"); |
554 | + return TRUE; |
555 | + } |
556 | +#endif |
557 | + |
558 | if (!first_time) |
559 | { |
560 | first_time = TRUE; |
561 | +#ifdef INDICATOR_APPLET |
562 | g_set_application_name(_("Indicator Applet")); |
563 | +#endif |
564 | +#ifdef INDICATOR_APPLET_SESSION |
565 | + g_set_application_name(_("Indicator Applet Session")); |
566 | +#endif |
567 | +#ifdef INDICATOR_APPLET_COMPLETE |
568 | + g_set_application_name(_("Indicator Applet Complete")); |
569 | +#endif |
570 | } |
571 | |
572 | /* Set panel options */ |
573 | gtk_container_set_border_width(GTK_CONTAINER (applet), 0); |
574 | panel_applet_set_flags(applet, PANEL_APPLET_EXPAND_MINOR); |
575 | panel_applet_setup_menu(applet, menu_xml, menu_verbs, NULL); |
576 | - atk_object_set_name (gtk_widget_get_accessible (GTK_WIDGET (applet)), |
577 | - "indicator-applet"); |
578 | +#ifdef INDICATOR_APPLET |
579 | + atk_object_set_name (gtk_widget_get_accessible (GTK_WIDGET (applet)), |
580 | + "indicator-applet"); |
581 | +#endif |
582 | +#ifdef INDICATOR_APPLET_SESSION |
583 | + atk_object_set_name (gtk_widget_get_accessible (GTK_WIDGET (applet)), |
584 | + "indicator-applet-session"); |
585 | +#endif |
586 | +#ifdef INDICATOR_APPLET_COMPLETE |
587 | + atk_object_set_name (gtk_widget_get_accessible (GTK_WIDGET (applet)), |
588 | + "indicator-applet-complete"); |
589 | +#endif |
590 | |
591 | /* Init some theme/icon stuff */ |
592 | gtk_icon_theme_append_search_path(gtk_icon_theme_get_default(), |
593 | @@ -286,12 +330,19 @@ |
594 | |
595 | const gchar * name; |
596 | while ((name = g_dir_read_name(dir)) != NULL) { |
597 | +#ifdef INDICATOR_APPLET |
598 | if (!g_strcmp0(name, "libsession.so")) { |
599 | continue; |
600 | } |
601 | if (!g_strcmp0(name, "libme.so")) { |
602 | continue; |
603 | } |
604 | +#endif |
605 | +#ifdef INDICATOR_APPLET_SESSION |
606 | + if (g_strcmp0(name, "libsession.so") && g_strcmp0(name, "libme.so")) { |
607 | + continue; |
608 | + } |
609 | +#endif |
610 | if (load_module(name, menubar)) { |
611 | indicators_loaded++; |
612 | } |
Makes it so the majority of code is all in one file, then #defined off into the different applets that we need.