Merge lp:~ted/indicator-applet/indicator-update into lp:indicator-applet/0.4

Proposed by Ted Gould
Status: Merged
Merged at revision: not available
Proposed branch: lp:~ted/indicator-applet/indicator-update
Merge into: lp:indicator-applet/0.4
Diff against target: 210 lines
3 files modified
configure.ac (+1/-1)
src-session/applet-main.c (+29/-51)
src/applet-main.c (+29/-51)
To merge this branch: bzr merge lp:~ted/indicator-applet/indicator-update
Reviewer Review Type Date Requested Status
Robert Collins (community) Approve
Review via email: mp+14460@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Ted Gould (ted) wrote :

Just enough changes to get this working with libindicator 0.3.0 development so that everything doesn't break.

Revision history for this message
Robert Collins (lifeless) wrote :

The two applets seem to have nearly identical layouts; is it worth
consolidating them?

 review +1

review: Approve
Revision history for this message
Ted Gould (ted) wrote :

On Thu, 2009-11-05 at 06:24 +0000, Robert Collins wrote:
> The two applets seem to have nearly identical layouts; is it worth
> consolidating them?

Mixed feelings.

In many ways I consider any time we spend on this code a total waste of
time as we don't want it and the interfaces it uses are all dying in
GNOME 3. But, now it looks like we're going to keep it for Lucid and
thus have to maintain it for 3 years. And, it looks like it'll probably
have to withstand two more feature branch merges :(

I think in many ways it's a management decision at this point as the
technical issues point to "Please roll again."

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'configure.ac'
2--- configure.ac 2009-10-26 19:39:01 +0000
3+++ configure.ac 2009-11-05 05:25:20 +0000
4@@ -28,7 +28,7 @@
5 GTK_REQUIRED_VERSION=2.12
6 PANEL_REQUIRED_VERSION=2.0.0
7 DBUS_REQUIRED_VERSION=0.76
8-INDICATOR_REQUIRED_VERSION=0.1.0
9+INDICATOR_REQUIRED_VERSION=0.3.0
10
11 PKG_CHECK_MODULES(APPLET, gtk+-2.0 >= $GTK_REQUIRED_VERSION
12 libpanelapplet-2.0 >= $PANEL_REQUIRED_VERSION
13
14=== modified file 'src-session/applet-main.c'
15--- src-session/applet-main.c 2009-10-26 19:52:45 +0000
16+++ src-session/applet-main.c 2009-11-05 05:25:20 +0000
17@@ -23,7 +23,7 @@
18 #include <config.h>
19 #include <panel-applet.h>
20
21-#include "libindicator/indicator.h"
22+#include "libindicator/indicator-object.h"
23
24 static gboolean applet_fill_cb (PanelApplet * applet, const gchar * iid, gpointer data);
25
26@@ -59,57 +59,35 @@
27 g_debug("Loading Module: %s", name);
28
29 gchar * fullpath = g_build_filename(INDICATOR_DIR, name, NULL);
30- GModule * module = g_module_open(fullpath,
31- G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL);
32+ IndicatorObject * io = indicator_object_new_from_file(fullpath);
33 g_free(fullpath);
34- g_return_val_if_fail(module != NULL, FALSE);
35-
36- get_version_t lget_version = NULL;
37- g_return_val_if_fail(g_module_symbol(module, INDICATOR_GET_VERSION_S, (gpointer *)(&lget_version)), FALSE);
38- if (!INDICATOR_VERSION_CHECK(lget_version())) {
39- g_warning("Indicator using API version '%s' we're expecting '%s'", lget_version(), INDICATOR_VERSION);
40- return FALSE;
41- }
42-
43- get_label_t lget_label = NULL;
44- g_return_val_if_fail(g_module_symbol(module, INDICATOR_GET_LABEL_S, (gpointer *)(&lget_label)), FALSE);
45- g_return_val_if_fail(lget_label != NULL, FALSE);
46- GtkLabel * label = lget_label();
47-
48- get_icon_t lget_icon = NULL;
49- g_return_val_if_fail(g_module_symbol(module, INDICATOR_GET_ICON_S, (gpointer *)(&lget_icon)), FALSE);
50- g_return_val_if_fail(lget_icon != NULL, FALSE);
51- GtkImage * icon = lget_icon();
52-
53- get_menu_t lget_menu = NULL;
54- g_return_val_if_fail(g_module_symbol(module, INDICATOR_GET_MENU_S, (gpointer *)(&lget_menu)), FALSE);
55- g_return_val_if_fail(lget_menu != NULL, FALSE);
56- GtkMenu * lmenu = lget_menu();
57-
58- if (label == NULL && icon == NULL) {
59- /* This is the case where there is nothing to display,
60- kinda odd that we'd have a module with nothing. */
61- g_warning("No label or icon. Odd.");
62- return FALSE;
63- }
64-
65- GtkWidget * menuitem = gtk_menu_item_new();
66- GtkWidget * hbox = gtk_hbox_new(FALSE, 3);
67- if (icon != NULL) {
68- gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(icon), FALSE, FALSE, 0);
69- }
70- if (label != NULL) {
71- gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(label), FALSE, FALSE, 0);
72- }
73- gtk_container_add(GTK_CONTAINER(menuitem), hbox);
74- gtk_widget_show(hbox);
75-
76- if (lmenu != NULL) {
77- gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), GTK_WIDGET(lmenu));
78- }
79-
80- gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
81- gtk_widget_show(menuitem);
82+
83+ GList * entries = indicator_object_get_entries(io);
84+ GList * entry = NULL;
85+
86+ for (entry = entries; entry != NULL; entry = g_list_next(entry)) {
87+ IndicatorObjectEntry * entrydata = (IndicatorObjectEntry *)entry->data;
88+
89+ GtkWidget * menuitem = gtk_menu_item_new();
90+ GtkWidget * hbox = gtk_hbox_new(FALSE, 3);
91+ if (entrydata->image != NULL) {
92+ gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(entrydata->image), FALSE, FALSE, 0);
93+ }
94+ if (entrydata->label != NULL) {
95+ gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(entrydata->label), FALSE, FALSE, 0);
96+ }
97+ gtk_container_add(GTK_CONTAINER(menuitem), hbox);
98+ gtk_widget_show(hbox);
99+
100+ if (entrydata->menu != NULL) {
101+ gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), GTK_WIDGET(entrydata->menu));
102+ }
103+
104+ gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
105+ gtk_widget_show(menuitem);
106+ }
107+
108+ g_list_free(entries);
109
110 return TRUE;
111 }
112
113=== modified file 'src/applet-main.c'
114--- src/applet-main.c 2009-10-26 19:52:45 +0000
115+++ src/applet-main.c 2009-11-05 05:25:20 +0000
116@@ -23,7 +23,7 @@
117 #include <config.h>
118 #include <panel-applet.h>
119
120-#include "libindicator/indicator.h"
121+#include "libindicator/indicator-object.h"
122
123 static gboolean applet_fill_cb (PanelApplet * applet, const gchar * iid, gpointer data);
124
125@@ -59,57 +59,35 @@
126 g_debug("Loading Module: %s", name);
127
128 gchar * fullpath = g_build_filename(INDICATOR_DIR, name, NULL);
129- GModule * module = g_module_open(fullpath,
130- G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL);
131+ IndicatorObject * io = indicator_object_new_from_file(fullpath);
132 g_free(fullpath);
133- g_return_val_if_fail(module != NULL, FALSE);
134-
135- get_version_t lget_version = NULL;
136- g_return_val_if_fail(g_module_symbol(module, INDICATOR_GET_VERSION_S, (gpointer *)(&lget_version)), FALSE);
137- if (!INDICATOR_VERSION_CHECK(lget_version())) {
138- g_warning("Indicator using API version '%s' we're expecting '%s'", lget_version(), INDICATOR_VERSION);
139- return FALSE;
140- }
141-
142- get_label_t lget_label = NULL;
143- g_return_val_if_fail(g_module_symbol(module, INDICATOR_GET_LABEL_S, (gpointer *)(&lget_label)), FALSE);
144- g_return_val_if_fail(lget_label != NULL, FALSE);
145- GtkLabel * label = lget_label();
146-
147- get_icon_t lget_icon = NULL;
148- g_return_val_if_fail(g_module_symbol(module, INDICATOR_GET_ICON_S, (gpointer *)(&lget_icon)), FALSE);
149- g_return_val_if_fail(lget_icon != NULL, FALSE);
150- GtkImage * icon = lget_icon();
151-
152- get_menu_t lget_menu = NULL;
153- g_return_val_if_fail(g_module_symbol(module, INDICATOR_GET_MENU_S, (gpointer *)(&lget_menu)), FALSE);
154- g_return_val_if_fail(lget_menu != NULL, FALSE);
155- GtkMenu * lmenu = lget_menu();
156-
157- if (label == NULL && icon == NULL) {
158- /* This is the case where there is nothing to display,
159- kinda odd that we'd have a module with nothing. */
160- g_warning("No label or icon. Odd.");
161- return FALSE;
162- }
163-
164- GtkWidget * menuitem = gtk_menu_item_new();
165- GtkWidget * hbox = gtk_hbox_new(FALSE, 3);
166- if (icon != NULL) {
167- gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(icon), FALSE, FALSE, 0);
168- }
169- if (label != NULL) {
170- gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(label), FALSE, FALSE, 0);
171- }
172- gtk_container_add(GTK_CONTAINER(menuitem), hbox);
173- gtk_widget_show(hbox);
174-
175- if (lmenu != NULL) {
176- gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), GTK_WIDGET(lmenu));
177- }
178-
179- gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
180- gtk_widget_show(menuitem);
181+
182+ GList * entries = indicator_object_get_entries(io);
183+ GList * entry = NULL;
184+
185+ for (entry = entries; entry != NULL; entry = g_list_next(entry)) {
186+ IndicatorObjectEntry * entrydata = (IndicatorObjectEntry *)entry->data;
187+
188+ GtkWidget * menuitem = gtk_menu_item_new();
189+ GtkWidget * hbox = gtk_hbox_new(FALSE, 3);
190+ if (entrydata->image != NULL) {
191+ gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(entrydata->image), FALSE, FALSE, 0);
192+ }
193+ if (entrydata->label != NULL) {
194+ gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(entrydata->label), FALSE, FALSE, 0);
195+ }
196+ gtk_container_add(GTK_CONTAINER(menuitem), hbox);
197+ gtk_widget_show(hbox);
198+
199+ if (entrydata->menu != NULL) {
200+ gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), GTK_WIDGET(entrydata->menu));
201+ }
202+
203+ gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
204+ gtk_widget_show(menuitem);
205+ }
206+
207+ g_list_free(entries);
208
209 return TRUE;
210 }

Subscribers

People subscribed via source and target branches

to status/vote changes: