Merge lp:~ted/indicator-applet/code-unification into lp:indicator-applet/0.4

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
Reviewer Review Type Date Requested Status
Robert Collins (community) Approve
Review via email: mp+16809@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Ted Gould (ted) wrote :

Makes it so the majority of code is all in one file, then #defined off into the different applets that we need.

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
=== modified file '.bzrignore'
--- .bzrignore 2009-08-18 15:50:35 +0000
+++ .bzrignore 2010-01-04 20:49:11 +0000
@@ -104,3 +104,6 @@
104data/GNOME_IndicatorAppletSUS.server.in104data/GNOME_IndicatorAppletSUS.server.in
105src-session/indicator-applet-no-sus105src-session/indicator-applet-no-sus
106src-session/indicator-applet-session106src-session/indicator-applet-session
107src/indicator-applet-complete
108src/indicator-applet-session
109data/GNOME_IndicatorAppletComplete.server
107110
=== modified file 'Makefile.am'
--- Makefile.am 2009-08-24 18:22:32 +0000
+++ Makefile.am 2010-01-04 20:49:11 +0000
@@ -1,7 +1,6 @@
11
2SUBDIRS = \2SUBDIRS = \
3 src \3 src \
4 src-session \
5 data \4 data \
6 po5 po
76
87
=== modified file 'configure.ac'
--- configure.ac 2009-12-10 17:27:22 +0000
+++ configure.ac 2010-01-04 20:49:11 +0000
@@ -124,7 +124,6 @@
124AC_OUTPUT([124AC_OUTPUT([
125Makefile125Makefile
126src/Makefile126src/Makefile
127src-session/Makefile
128data/Makefile127data/Makefile
129po/Makefile.in128po/Makefile.in
130])129])
131130
=== added file 'data/GNOME_IndicatorAppletComplete.server.in.in'
--- data/GNOME_IndicatorAppletComplete.server.in.in 1970-01-01 00:00:00 +0000
+++ data/GNOME_IndicatorAppletComplete.server.in.in 2010-01-04 20:49:11 +0000
@@ -0,0 +1,28 @@
1<oaf_info>
2 <oaf_server iid="OAFIID:GNOME_IndicatorAppletComplete_Factory" type="exe"
3 location="@LIBEXECDIR@/indicator-applet-complete">
4
5 <oaf_attribute name="repo_ids" type="stringv">
6 <item value="IDL:Bonobo/GenericFactory:1.0"/>
7 <item value="IDL:Bonobo/Unknown:1.0"/>
8 </oaf_attribute>
9 <oaf_attribute name="name" type="string" value="Indicator Applet Complete Factory"/>
10 <oaf_attribute name="description" type="string" value="Indicator Applet Complete Factory"/>
11 <oaf_attribute name="bonobo:environment" type="stringv">
12 <item value="DBUS_SESSION_BUS_ADDRESS"/>
13 </oaf_attribute>
14 </oaf_server>
15
16 <oaf_server iid="OAFIID:GNOME_IndicatorAppletComplete" type="factory"
17 location="OAFIID:GNOME_IndicatorAppletComplete_Factory">
18
19 <oaf_attribute name="repo_ids" type="stringv">
20 <item value="IDL:GNOME/Vertigo/PanelAppletShell:1.0"/>
21 <item value="IDL:Bonobo/Control:1.0"/>
22 <item value="IDL:Bonobo/Unknown:1.0"/>
23 </oaf_attribute>
24 <oaf_attribute name="name" type="string" _value="Indicator Applet Complete"/>
25 <oaf_attribute name="description" type="string" _value="A unified applet containing all of the indicators."/>
26 <oaf_attribute name="panel:icon" type="string" value="indicator-applet"/>
27 </oaf_server>
28</oaf_info>
029
=== modified file 'data/Makefile.am'
--- data/Makefile.am 2009-08-07 17:47:02 +0000
+++ data/Makefile.am 2010-01-04 20:49:11 +0000
@@ -8,6 +8,7 @@
8 $(libdir)/bonobo/servers8 $(libdir)/bonobo/servers
9server_in_files = \9server_in_files = \
10 GNOME_IndicatorApplet.server.in \10 GNOME_IndicatorApplet.server.in \
11 GNOME_IndicatorAppletComplete.server.in \
11 GNOME_FastUserSwitchApplet.server.in12 GNOME_FastUserSwitchApplet.server.in
12server_DATA = \13server_DATA = \
13 $(server_in_files:.server.in=.server)14 $(server_in_files:.server.in=.server)
@@ -68,6 +69,7 @@
68EXTRA_DIST = \69EXTRA_DIST = \
69 $(icons_DATA) \70 $(icons_DATA) \
70 GNOME_IndicatorApplet.server.in.in \71 GNOME_IndicatorApplet.server.in.in \
72 GNOME_IndicatorAppletComplete.server.in.in \
71 GNOME_FastUserSwitchApplet.server.in.in \73 GNOME_FastUserSwitchApplet.server.in.in \
72 $(schema_in_files)74 $(schema_in_files)
7375
7476
=== modified file 'po/POTFILES.in'
--- po/POTFILES.in 2009-08-18 16:03:40 +0000
+++ po/POTFILES.in 2010-01-04 20:49:11 +0000
@@ -1,6 +1,6 @@
1[encoding: UTF-8]1[encoding: UTF-8]
2data/GNOME_IndicatorApplet.server.in.in2data/GNOME_IndicatorApplet.server.in.in
3data/GNOME_IndicatorAppletComplete.server.in.in
3data/GNOME_FastUserSwitchApplet.server.in.in4data/GNOME_FastUserSwitchApplet.server.in.in
4data/indicator-applet.schemas.in5data/indicator-applet.schemas.in
5src/applet-main.c6src/applet-main.c
6src-session/applet-main.c
77
=== removed directory 'src-session'
=== removed file 'src-session/Makefile.am'
--- src-session/Makefile.am 2009-08-24 18:22:32 +0000
+++ src-session/Makefile.am 1970-01-01 00:00:00 +0000
@@ -1,17 +0,0 @@
1
2libexec_PROGRAMS = \
3 indicator-applet-session
4
5indicator_applet_session_CFLAGS = \
6 -DG_LOG_DOMAIN=\""Indicator-Applet"\" \
7 -DDATADIR=\""$(datadir)"\" \
8 -DINDICATOR_DIR=\""$(INDICATORDIR)"\" \
9 -DINDICATOR_ICONS_DIR=\""$(INDICATORICONSDIR)"\" \
10 -I$(srcdir)/.. \
11 $(APPLET_CFLAGS)
12
13indicator_applet_session_SOURCES = \
14 applet-main.c
15
16indicator_applet_session_LDADD = \
17 $(APPLET_LIBS)
180
=== removed file 'src-session/applet-main.c'
--- src-session/applet-main.c 2009-12-24 16:43:37 +0000
+++ src-session/applet-main.c 1970-01-01 00:00:00 +0000
@@ -1,320 +0,0 @@
1/*
2A small wrapper utility to load indicators and put them as menu items
3into the gnome-panel using it's applet interface.
4
5Copyright 2009 Canonical Ltd.
6
7Authors:
8 Ted Gould <ted@canonical.com>
9
10This program is free software: you can redistribute it and/or modify it
11under the terms of the GNU General Public License version 3, as published
12by the Free Software Foundation.
13
14This program is distributed in the hope that it will be useful, but
15WITHOUT ANY WARRANTY; without even the implied warranties of
16MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
17PURPOSE. See the GNU General Public License for more details.
18
19You should have received a copy of the GNU General Public License along
20with this program. If not, see <http://www.gnu.org/licenses/>.
21*/
22
23#include <config.h>
24#include <panel-applet.h>
25
26#include "libindicator/indicator-object.h"
27
28static gboolean applet_fill_cb (PanelApplet * applet, const gchar * iid, gpointer data);
29
30
31static void cw_panel_background_changed (PanelApplet *applet,
32 PanelAppletBackgroundType type,
33 GdkColor *colour,
34 GdkPixmap *pixmap,
35 GtkWidget *menubar);
36
37/*************
38 * main
39 * ***********/
40
41PANEL_APPLET_BONOBO_FACTORY ("OAFIID:GNOME_FastUserSwitchApplet_Factory",
42 PANEL_TYPE_APPLET,
43 "indicator-applet-session", "0",
44 applet_fill_cb, NULL);
45
46/*************
47 * init function
48 * ***********/
49static gboolean
50load_module (const gchar * name, GtkWidget * menu)
51{
52 g_debug("Looking at Module: %s", name);
53 g_return_val_if_fail(name != NULL, FALSE);
54
55 if (!g_str_has_suffix(name, G_MODULE_SUFFIX)) {
56 return FALSE;
57 }
58
59 g_debug("Loading Module: %s", name);
60
61 gchar * fullpath = g_build_filename(INDICATOR_DIR, name, NULL);
62 IndicatorObject * io = indicator_object_new_from_file(fullpath);
63 g_free(fullpath);
64
65 GList * entries = indicator_object_get_entries(io);
66 GList * entry = NULL;
67
68 for (entry = entries; entry != NULL; entry = g_list_next(entry)) {
69 IndicatorObjectEntry * entrydata = (IndicatorObjectEntry *)entry->data;
70
71 GtkWidget * menuitem = gtk_menu_item_new();
72 GtkWidget * hbox = gtk_hbox_new(FALSE, 3);
73 if (entrydata->image != NULL) {
74 gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(entrydata->image), FALSE, FALSE, 0);
75 }
76 if (entrydata->label != NULL) {
77 gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(entrydata->label), FALSE, FALSE, 0);
78 }
79 gtk_container_add(GTK_CONTAINER(menuitem), hbox);
80 gtk_widget_show(hbox);
81
82 if (entrydata->menu != NULL) {
83 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), GTK_WIDGET(entrydata->menu));
84 }
85
86 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
87 gtk_widget_show(menuitem);
88 }
89
90 g_list_free(entries);
91
92 return TRUE;
93}
94
95static gboolean
96menubar_press (GtkWidget * widget,
97 GdkEventButton *event,
98 gpointer data)
99{
100 if (event->button != 1) {
101 g_signal_stop_emission_by_name(widget, "button-press-event");
102 }
103
104 return FALSE;
105}
106
107static gboolean
108menubar_on_expose (GtkWidget * widget,
109 GdkEventExpose *event,
110 GtkWidget * menubar)
111{
112 if (GTK_WIDGET_HAS_FOCUS(menubar))
113 gtk_paint_focus(widget->style, widget->window, GTK_WIDGET_STATE(menubar),
114 NULL, widget, "menubar-applet", 0, 0, -1, -1);
115
116 return FALSE;
117}
118
119static void
120about_cb (BonoboUIComponent *ui_container,
121 gpointer data,
122 const gchar *cname)
123{
124 static const gchar *authors[] = {
125 "Ted Gould <ted@canonical.com>",
126 NULL
127 };
128
129 static gchar *license[] = {
130 N_("This program is free software: you can redistribute it and/or modify it "
131 "under the terms of the GNU General Public License version 3, as published "
132 "by the Free Software Foundation."),
133 N_("This program is distributed in the hope that it will be useful, but "
134 "WITHOUT ANY WARRANTY; without even the implied warranties of "
135 "MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR "
136 "PURPOSE. See the GNU General Public License for more details."),
137 N_("You should have received a copy of the GNU General Public License along "
138 "with this program. If not, see <http://www.gnu.org/licenses/>."),
139 NULL
140 };
141 gchar *license_i18n;
142
143 license_i18n = g_strconcat (_(license[0]), "\n\n", _(license[1]), "\n\n", _(license[2]), NULL);
144
145 gtk_show_about_dialog(NULL,
146 "version", VERSION,
147 "copyright", "Copyright \xc2\xa9 2009 Canonical, Ltd.",
148 "comments", _("A place to adjust your status, change users or exit your session."),
149 "authors", authors,
150 "license", license_i18n,
151 "wrap-license", TRUE,
152 "translator-credits", _("translator-credits"),
153 "logo-icon-name", "indicator-applet",
154 "icon-name", "indicator-applet",
155 "website", "http://launchpad.net/indicator-applet",
156 "website-label", _("Indicator Applet Website"),
157 NULL
158 );
159
160 g_free (license_i18n);
161
162 return;
163}
164
165#ifdef N_
166#undef N_
167#endif
168#define N_(x) x
169
170static gboolean
171applet_fill_cb (PanelApplet * applet, const gchar * iid, gpointer data)
172{
173 static const BonoboUIVerb menu_verbs[] = {
174 BONOBO_UI_VERB ("IndicatorAppletAbout", about_cb),
175 BONOBO_UI_VERB_END
176 };
177 static const gchar * menu_xml =
178 "<popup name=\"button3\">"
179 "<menuitem name=\"About Item\" verb=\"IndicatorAppletAbout\" _label=\"" N_("_About") "\" pixtype=\"stock\" pixname=\"gtk-about\"/>"
180 "</popup>";
181
182 GtkWidget *menubar;
183 gint i;
184 gint indicators_loaded = 0;
185 static gboolean first_time = FALSE;
186
187 /* check if we are running stracciatella session */
188 if (g_strcmp0(g_getenv("GDMSESSION"), "gnome-stracciatella") == 0) {
189 g_debug("Running stracciatella GNOME session, disabling myself");
190 return TRUE;
191 }
192
193 if (!first_time)
194 {
195 first_time = TRUE;
196 g_set_application_name(_("Indicator Applet Session"));
197 }
198
199 /* Set panel options */
200 gtk_container_set_border_width(GTK_CONTAINER (applet), 0);
201 panel_applet_set_flags(applet, PANEL_APPLET_EXPAND_MINOR);
202 panel_applet_setup_menu(applet, menu_xml, menu_verbs, NULL);
203 atk_object_set_name (gtk_widget_get_accessible (GTK_WIDGET (applet)),
204 "indicator-applet-session");
205
206 /* Init some theme/icon stuff */
207 gtk_icon_theme_append_search_path(gtk_icon_theme_get_default(),
208 INDICATOR_ICONS_DIR);
209 /* g_debug("Icons directory: %s", INDICATOR_ICONS_DIR); */
210 gtk_rc_parse_string (
211 "style \"indicator-applet-style\"\n"
212 "{\n"
213 " GtkMenuBar::shadow-type = none\n"
214 " GtkMenuBar::internal-padding = 0\n"
215 " GtkWidget::focus-line-width = 0\n"
216 " GtkWidget::focus-padding = 0\n"
217 "}\n"
218 "style \"indicator-applet-menubar-style\"\n"
219 "{\n"
220 " GtkMenuBar::shadow-type = none\n"
221 " GtkMenuBar::internal-padding = 0\n"
222 " GtkWidget::focus-line-width = 0\n"
223 " GtkWidget::focus-padding = 0\n"
224 " GtkMenuItem::horizontal-padding = 0\n"
225 "}\n"
226 "style \"indicator-applet-menuitem-style\"\n"
227 "{\n"
228 " GtkWidget::focus-line-width = 0\n"
229 " GtkWidget::focus-padding = 0\n"
230 " GtkMenuItem::horizontal-padding = 0\n"
231 "}\n"
232 "widget \"*.fast-user-switch-applet\" style \"indicator-applet-style\""
233 "widget \"*.fast-user-switch-menuitem\" style \"indicator-applet-menuitem-style\""
234 "widget \"*.fast-user-switch-menubar\" style \"indicator-applet-menubar-style\"");
235 //gtk_widget_set_name(GTK_WIDGET (applet), "indicator-applet-menubar");
236 gtk_widget_set_name(GTK_WIDGET (applet), "fast-user-switch-applet");
237
238 /* Build menubar */
239 menubar = gtk_menu_bar_new();
240 GTK_WIDGET_SET_FLAGS (menubar, GTK_WIDGET_FLAGS(menubar) | GTK_CAN_FOCUS);
241 gtk_widget_set_name(GTK_WIDGET (menubar), "fast-user-switch-menubar");
242 g_signal_connect(menubar, "button-press-event", G_CALLBACK(menubar_press), NULL);
243 g_signal_connect_after(menubar, "expose-event", G_CALLBACK(menubar_on_expose), menubar);
244 gtk_container_set_border_width(GTK_CONTAINER(menubar), 0);
245
246 /* load 'em */
247 if (g_file_test(INDICATOR_DIR, (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR))) {
248 GDir * dir = g_dir_open(INDICATOR_DIR, 0, NULL);
249
250 const gchar * name;
251 while ((name = g_dir_read_name(dir)) != NULL) {
252 if (g_strcmp0(name, "libsession.so") && g_strcmp0(name, "libme.so")) {
253 continue;
254 }
255 if (load_module(name, menubar)) {
256 indicators_loaded++;
257 }
258 }
259 g_dir_close (dir);
260 }
261
262 if (indicators_loaded == 0) {
263 /* A label to allow for click through */
264 GtkWidget * item = gtk_label_new(_("No Indicators"));
265 gtk_container_add(GTK_CONTAINER(applet), item);
266 gtk_widget_show(item);
267 } else {
268 gtk_container_add(GTK_CONTAINER(applet), menubar);
269 panel_applet_set_background_widget(applet, menubar);
270 gtk_widget_show(menubar);
271 }
272
273 /* Background of applet */
274 g_signal_connect(applet, "change-background",
275 G_CALLBACK(cw_panel_background_changed), menubar);
276
277 gtk_widget_show(GTK_WIDGET(applet));
278
279 return TRUE;
280}
281
282static void
283cw_panel_background_changed (PanelApplet *applet,
284 PanelAppletBackgroundType type,
285 GdkColor *colour,
286 GdkPixmap *pixmap,
287 GtkWidget *menubar)
288{
289 GtkRcStyle *rc_style;
290 GtkStyle *style;
291
292 /* reset style */
293 gtk_widget_set_style(GTK_WIDGET (applet), NULL);
294 gtk_widget_set_style(menubar, NULL);
295 rc_style = gtk_rc_style_new ();
296 gtk_widget_modify_style(GTK_WIDGET (applet), rc_style);
297 gtk_widget_modify_style(menubar, rc_style);
298 gtk_rc_style_unref(rc_style);
299
300 switch (type)
301 {
302 case PANEL_NO_BACKGROUND:
303 break;
304 case PANEL_COLOR_BACKGROUND:
305 gtk_widget_modify_bg(GTK_WIDGET (applet), GTK_STATE_NORMAL, colour);
306 gtk_widget_modify_bg(menubar, GTK_STATE_NORMAL, colour);
307 break;
308
309 case PANEL_PIXMAP_BACKGROUND:
310 style = gtk_style_copy(GTK_WIDGET (applet)->style);
311 if (style->bg_pixmap[GTK_STATE_NORMAL])
312 g_object_unref(style->bg_pixmap[GTK_STATE_NORMAL]);
313 style->bg_pixmap[GTK_STATE_NORMAL] = g_object_ref (pixmap);
314 gtk_widget_set_style(GTK_WIDGET (applet), style);
315 gtk_widget_set_style(GTK_WIDGET (menubar), style);
316 g_object_unref(style);
317 break;
318 }
319}
320
3210
=== modified file 'src/Makefile.am'
--- src/Makefile.am 2009-08-24 18:22:32 +0000
+++ src/Makefile.am 2010-01-04 20:49:11 +0000
@@ -1,17 +1,50 @@
11
2libexec_PROGRAMS = \2libexec_PROGRAMS = \
3 indicator-applet3 indicator-applet \
4 indicator-applet-session \
5 indicator-applet-complete
46
5indicator_applet_CFLAGS = \7indicator_applet_CFLAGS = \
6 -DG_LOG_DOMAIN=\""Indicator-Applet"\" \8 -DG_LOG_DOMAIN=\""Indicator-Applet"\" \
7 -DDATADIR=\""$(datadir)"\" \9 -DDATADIR=\""$(datadir)"\" \
8 -DINDICATOR_DIR=\""$(INDICATORDIR)"\" \10 -DINDICATOR_DIR=\""$(INDICATORDIR)"\" \
9 -DINDICATOR_ICONS_DIR=\""$(INDICATORICONSDIR)"\" \11 -DINDICATOR_ICONS_DIR=\""$(INDICATORICONSDIR)"\" \
12 -DINDICATOR_APPLET \
10 -I$(srcdir)/.. \13 -I$(srcdir)/.. \
11 $(APPLET_CFLAGS)14 $(APPLET_CFLAGS)
1215
13indicator_applet_SOURCES = \16indicator_applet_SOURCES = \
14 applet-main.c17 applet-main.c
1518
16indicator_applet_LDADD = \19indicator_applet_LDADD = \
17 $(APPLET_LIBS)20 $(APPLET_LIBS)
21
22indicator_applet_session_CFLAGS = \
23 -DG_LOG_DOMAIN=\""Indicator-Applet-Session"\" \
24 -DDATADIR=\""$(datadir)"\" \
25 -DINDICATOR_DIR=\""$(INDICATORDIR)"\" \
26 -DINDICATOR_ICONS_DIR=\""$(INDICATORICONSDIR)"\" \
27 -DINDICATOR_APPLET_SESSION \
28 -I$(srcdir)/.. \
29 $(APPLET_CFLAGS)
30
31indicator_applet_session_SOURCES = \
32 applet-main.c
33
34indicator_applet_session_LDADD = \
35 $(APPLET_LIBS)
36
37indicator_applet_complete_CFLAGS = \
38 -DG_LOG_DOMAIN=\""Indicator-Applet-Complete"\" \
39 -DDATADIR=\""$(datadir)"\" \
40 -DINDICATOR_DIR=\""$(INDICATORDIR)"\" \
41 -DINDICATOR_ICONS_DIR=\""$(INDICATORICONSDIR)"\" \
42 -DINDICATOR_APPLET_COMPLETE \
43 -I$(srcdir)/.. \
44 $(APPLET_CFLAGS)
45
46indicator_applet_complete_SOURCES = \
47 applet-main.c
48
49indicator_applet_complete_LDADD = \
50 $(APPLET_LIBS)
1851
=== modified file 'src/applet-main.c'
--- src/applet-main.c 2010-01-04 02:23:10 +0000
+++ src/applet-main.c 2010-01-04 20:49:11 +0000
@@ -40,10 +40,24 @@
40 * main40 * main
41 * ***********/41 * ***********/
4242
43#ifdef INDICATOR_APPLET
43PANEL_APPLET_BONOBO_FACTORY ("OAFIID:GNOME_IndicatorApplet_Factory",44PANEL_APPLET_BONOBO_FACTORY ("OAFIID:GNOME_IndicatorApplet_Factory",
44 PANEL_TYPE_APPLET,45 PANEL_TYPE_APPLET,
45 "indicator-applet", "0",46 "indicator-applet", "0",
46 applet_fill_cb, NULL);47 applet_fill_cb, NULL);
48#endif
49#ifdef INDICATOR_APPLET_SESSION
50PANEL_APPLET_BONOBO_FACTORY ("OAFIID:GNOME_FastUserSwitchApplet_Factory",
51 PANEL_TYPE_APPLET,
52 "indicator-applet-session", "0",
53 applet_fill_cb, NULL);
54#endif
55#ifdef INDICATOR_APPLET_COMPLETE
56PANEL_APPLET_BONOBO_FACTORY ("OAFIID:GNOME_IndicatorAppletComplete_Factory",
57 PANEL_TYPE_APPLET,
58 "indicator-applet-complete", "0",
59 applet_fill_cb, NULL);
60#endif
4761
48/*************62/*************
49 * init function63 * init function
@@ -188,7 +202,11 @@
188 gtk_show_about_dialog(NULL,202 gtk_show_about_dialog(NULL,
189 "version", VERSION,203 "version", VERSION,
190 "copyright", "Copyright \xc2\xa9 2009 Canonical, Ltd.",204 "copyright", "Copyright \xc2\xa9 2009 Canonical, Ltd.",
205#ifdef INDICATOR_APPLET_SESSION
206 "comments", _("A place to adjust your status, change users or exit your session."),
207#else
191 "comments", _("An applet to hold all of the system indicators."),208 "comments", _("An applet to hold all of the system indicators."),
209#endif
192 "authors", authors,210 "authors", authors,
193 "license", license_i18n,211 "license", license_i18n,
194 "wrap-license", TRUE,212 "wrap-license", TRUE,
@@ -227,18 +245,44 @@
227 gint indicators_loaded = 0;245 gint indicators_loaded = 0;
228 static gboolean first_time = FALSE;246 static gboolean first_time = FALSE;
229247
248#ifdef INDICATOR_APPLET_SESSION
249 /* check if we are running stracciatella session */
250 if (g_strcmp0(g_getenv("GDMSESSION"), "gnome-stracciatella") == 0) {
251 g_debug("Running stracciatella GNOME session, disabling myself");
252 return TRUE;
253 }
254#endif
255
230 if (!first_time)256 if (!first_time)
231 {257 {
232 first_time = TRUE;258 first_time = TRUE;
259#ifdef INDICATOR_APPLET
233 g_set_application_name(_("Indicator Applet"));260 g_set_application_name(_("Indicator Applet"));
261#endif
262#ifdef INDICATOR_APPLET_SESSION
263 g_set_application_name(_("Indicator Applet Session"));
264#endif
265#ifdef INDICATOR_APPLET_COMPLETE
266 g_set_application_name(_("Indicator Applet Complete"));
267#endif
234 }268 }
235269
236 /* Set panel options */270 /* Set panel options */
237 gtk_container_set_border_width(GTK_CONTAINER (applet), 0);271 gtk_container_set_border_width(GTK_CONTAINER (applet), 0);
238 panel_applet_set_flags(applet, PANEL_APPLET_EXPAND_MINOR);272 panel_applet_set_flags(applet, PANEL_APPLET_EXPAND_MINOR);
239 panel_applet_setup_menu(applet, menu_xml, menu_verbs, NULL);273 panel_applet_setup_menu(applet, menu_xml, menu_verbs, NULL);
240 atk_object_set_name (gtk_widget_get_accessible (GTK_WIDGET (applet)),274#ifdef INDICATOR_APPLET
241 "indicator-applet");275 atk_object_set_name (gtk_widget_get_accessible (GTK_WIDGET (applet)),
276 "indicator-applet");
277#endif
278#ifdef INDICATOR_APPLET_SESSION
279 atk_object_set_name (gtk_widget_get_accessible (GTK_WIDGET (applet)),
280 "indicator-applet-session");
281#endif
282#ifdef INDICATOR_APPLET_COMPLETE
283 atk_object_set_name (gtk_widget_get_accessible (GTK_WIDGET (applet)),
284 "indicator-applet-complete");
285#endif
242 286
243 /* Init some theme/icon stuff */287 /* Init some theme/icon stuff */
244 gtk_icon_theme_append_search_path(gtk_icon_theme_get_default(),288 gtk_icon_theme_append_search_path(gtk_icon_theme_get_default(),
@@ -286,12 +330,19 @@
286330
287 const gchar * name;331 const gchar * name;
288 while ((name = g_dir_read_name(dir)) != NULL) {332 while ((name = g_dir_read_name(dir)) != NULL) {
333#ifdef INDICATOR_APPLET
289 if (!g_strcmp0(name, "libsession.so")) {334 if (!g_strcmp0(name, "libsession.so")) {
290 continue;335 continue;
291 }336 }
292 if (!g_strcmp0(name, "libme.so")) {337 if (!g_strcmp0(name, "libme.so")) {
293 continue;338 continue;
294 }339 }
340#endif
341#ifdef INDICATOR_APPLET_SESSION
342 if (g_strcmp0(name, "libsession.so") && g_strcmp0(name, "libme.so")) {
343 continue;
344 }
345#endif
295 if (load_module(name, menubar)) {346 if (load_module(name, menubar)) {
296 indicators_loaded++;347 indicators_loaded++;
297 }348 }

Subscribers

People subscribed via source and target branches

to status/vote changes: