Merge lp:~mterry/indicator-application/gtk3 into lp:indicator-application/0.4

Proposed by Michael Terry
Status: Merged
Merged at revision: 167
Proposed branch: lp:~mterry/indicator-application/gtk3
Merge into: lp:indicator-application/0.4
Diff against target: 444 lines (+246/-29) (has conflicts)
6 files modified
configure.ac (+31/-9)
src/Makefile.am (+40/-15)
src/app-indicator.c (+15/-5)
src/appindicator3-0.1.pc.in (+14/-0)
src/dbus-properties-client.h.OTHER (+139/-0)
src/indicator-application.c (+7/-0)
Contents conflict in src/dbus-properties-client.h
To merge this branch: bzr merge lp:~mterry/indicator-application/gtk3
Reviewer Review Type Date Requested Status
Ted Gould (community) Approve
Review via email: mp+27990@code.launchpad.net

Description of the change

Applications ported to GTK+ 3.0 cannot use libappindicator because it is built for GTK+ 2.0. This branch builds a parallel-installable version of the library (libappindicator3) so that GTK+ 3.0 apps can also use the app menu.

This merge requires merging:
lp:~mterry/dbusmenu/gtk3
lp:~mterry/libindicator/gtk3

To post a comment you must log in.
135. By Michael Terry

instead of always building gtk2 and gtk3, add a --with-gtk= flag to configure to specify which to build with

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

A couple of things:

 * Need to remove the file: src/dbus-properties-client.h.OTHER from Bazaar
 * EXTRA_DIST needs to have both pc.in files in it, not just the version that was built with dist.

Otherwise it looks good

review: Approve
136. By Michael Terry

ship both pc files in EXTRA_DIST

Revision history for this message
Michael Terry (mterry) wrote :

I updated EXTRA_DIST, but I'm not entirely sure what's going on with dbus-properties-client.h.OTHER. My previous commits made a small change to dbus-properties-client.h:

- GValue OUT_Value = {0};
+ GValue OUT_Value = { 0, };

That seemed to be done automatically by dbus-binding-tool, so I left it. I don't have OTHER in my tree. I think LP is showing it because there is a conflict in the .h file in my tree vs trunk. That can be resolved when merging.

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

On Wed, 2010-10-13 at 12:41 +0000, Michael Terry wrote:
> I updated EXTRA_DIST

Cool.

> , but I'm not entirely sure what's going on with dbus-properties-client.h.OTHER. My previous commits made a small change to dbus-properties-client.h:
>
> - GValue OUT_Value = {0};
> + GValue OUT_Value = { 0, };
>
> That seemed to be done automatically by dbus-binding-tool, so I left it. I don't have OTHER in my tree. I think LP is showing it because there is a conflict in the .h file in my tree vs trunk. That can be resolved when merging.

Okay. I deleted it because it was generated and shouldn't have been in
version control. Because you changed it Bazaar is bringing up the fact
that the change can't be merged in because the file doesn't exist.

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 2010-09-22 16:13:14 +0000
3+++ configure.ac 2010-10-13 12:41:21 +0000
4@@ -37,20 +37,40 @@
5 # Dependencies
6 ###########################
7
8-GTK_REQUIRED_VERSION=2.12
9+GTK_REQUIRED_VERSION=2.18
10+GTK3_REQUIRED_VERSION=2.91
11 INDICATOR_REQUIRED_VERSION=0.3.5
12 DBUSMENUGTK_REQUIRED_VERSION=0.2.2
13 JSON_GLIB_REQUIRED_VERSION=0.7.6
14 DBUS_GLIB_REQUIRED_VERSION=0.82
15
16-PKG_CHECK_MODULES(INDICATOR, gtk+-2.0 >= $GTK_REQUIRED_VERSION
17- indicator >= $INDICATOR_REQUIRED_VERSION
18- json-glib-1.0 >= $JSON_GLIB_REQUIRED_VERSION
19- dbus-glib-1 >= $DBUS_GLIB_REQUIRED_VERSION
20- dbusmenu-gtk >= $DBUSMENUGTK_REQUIRED_VERSION)
21-
22-AC_SUBST(INDICATOR_CFLAGS)
23-AC_SUBST(INDICATOR_LIBS)
24+AC_ARG_WITH([gtk],
25+ [AS_HELP_STRING([--with-gtk],
26+ [Which version of gtk to use @<:@default=2@:>@])],
27+ [],
28+ [with_gtk=2])
29+AS_IF([test "x$with_gtk" = x3],
30+ [PKG_CHECK_MODULES(INDICATOR, gtk+-3.0 >= $GTK3_REQUIRED_VERSION
31+ indicator3 >= $INDICATOR_REQUIRED_VERSION
32+ json-glib-1.0 >= $JSON_GLIB_REQUIRED_VERSION
33+ dbus-glib-1 >= $DBUS_GLIB_REQUIRED_VERSION
34+ dbusmenu-gtk3 >= $DBUSMENUGTK_REQUIRED_VERSION)
35+ AC_SUBST(INDICATOR_CFLAGS)
36+ AC_SUBST(INDICATOR_LIBS)
37+ AC_DEFINE(HAVE_GTK3, 1, [whether gtk3 is available])
38+ ],
39+ [test "x$with_gtk" = x2],
40+ [PKG_CHECK_MODULES(INDICATOR, gtk+-2.0 >= $GTK_REQUIRED_VERSION
41+ indicator >= $INDICATOR_REQUIRED_VERSION
42+ json-glib-1.0 >= $JSON_GLIB_REQUIRED_VERSION
43+ dbus-glib-1 >= $DBUS_GLIB_REQUIRED_VERSION
44+ dbusmenu-gtk >= $DBUSMENUGTK_REQUIRED_VERSION)
45+ AC_SUBST(INDICATOR_CFLAGS)
46+ AC_SUBST(INDICATOR_LIBS)
47+ ],
48+ [AC_MSG_FAILURE([Value for --with-gtk was neither 2 nor 3])]
49+)
50+AM_CONDITIONAL(USE_GTK3, [test "x$with_gtk" = x3])
51
52 ###########################
53 # GObject Introspection
54@@ -191,6 +211,7 @@
55 Makefile
56 src/Makefile
57 src/appindicator-0.1.pc
58+src/appindicator3-0.1.pc
59 bindings/Makefile
60 bindings/mono/Makefile
61 bindings/mono/appindicator-sharp.dll.config
62@@ -217,4 +238,5 @@
63
64 Prefix: $prefix
65 Indicator Dir: $INDICATORDIR
66+ GTK+ Version: $with_gtk
67 ])
68
69=== modified file 'src/Makefile.am'
70--- src/Makefile.am 2010-08-10 21:59:25 +0000
71+++ src/Makefile.am 2010-10-13 12:41:21 +0000
72@@ -1,7 +1,19 @@
73+if USE_GTK3
74+VER=3
75+lib_LTLIBRARIES = libappindicator3.la
76+GTKGIR = Gtk-3.0
77+GTKVAPI = gtk+-3.0
78+else
79+VER=
80+lib_LTLIBRARIES = libappindicator.la
81+GTKGIR = Gtk-2.0
82+GTKVAPI = gtk+-2.0
83+endif
84+
85 CLEANFILES =
86 DISTCLEANFILES =
87 BUILT_SOURCES =
88-EXTRA_DIST = appindicator-0.1.pc.in
89+EXTRA_DIST = appindicator-0.1.pc.in appindicator3-0.1.pc.in
90
91 include $(top_srcdir)/Makefile.am.enum
92 include $(top_srcdir)/Makefile.am.marshal
93@@ -60,7 +72,7 @@
94
95 indicator_application_service_LDADD = \
96 $(INDICATOR_LIBS) \
97- libappindicator.la
98+ libappindicator$(VER).la
99
100 glib_marshal_list = application-service-marshal.list
101 glib_marshal_prefix = _application_service_marshal
102@@ -69,7 +81,7 @@
103 # Library
104 ##################################
105
106-pkgconfig_DATA = appindicator-0.1.pc
107+pkgconfig_DATA = appindicator$(VER)-0.1.pc
108 pkgconfigdir = $(libdir)/pkgconfig
109
110 glib_enum_h = app-indicator-enum-types.h
111@@ -78,10 +90,7 @@
112
113 DISTCLEANFILES += app-indicator-enum-types.c
114
115-lib_LTLIBRARIES = \
116- libappindicator.la
117-
118-libappindicatorincludedir=$(includedir)/libappindicator-0.1/libappindicator
119+libappindicatorincludedir=$(includedir)/libappindicator$(VER)-0.1/libappindicator
120
121 libappindicator_headers = \
122 app-indicator.h
123@@ -115,6 +124,17 @@
124 libappindicator_la_LIBADD = \
125 $(INDICATOR_LIBS)
126
127+# We duplicate these here because Automake won't let us use $(VER) on the left hand side.
128+# Since we carefully use $(VER) in the right hand side above, we can assign the same values.
129+# Only one version of the library is every compiled at the same time, so it is safe to reuse
130+# the right hand sides like this.
131+libappindicator3includedir = $(libappindicatorincludedir)
132+libappindicator3include_HEADERS = $(libappindicatorinclude_HEADERS)
133+libappindicator3_la_SOURCES = $(libappindicator_la_SOURCES)
134+libappindicator3_la_LDFLAGS = $(libappindicator_la_LDFLAGS)
135+libappindicator3_la_CFLAGS = $(libappindicator_la_CFLAGS)
136+libappindicator3_la_LIBADD = $(libappindicator_la_LIBADD)
137+
138 ##################################
139 # DBus Specs
140 ##################################
141@@ -165,15 +185,20 @@
142 $(addprefix $(srcdir)/,$(libappindicator_headers)) \
143 $(addprefix $(top_builddir)/src/, $(glib_enum_h))
144
145-AppIndicator-0.1.gir: libappindicator.la $(glib_enum_h)
146+AppIndicator$(VER)-0.1.gir: libappindicator$(VER).la $(glib_enum_h)
147 AppIndicator_0_1_gir_INCLUDES = \
148 GObject-2.0 \
149- Gtk-2.0
150+ $(GTKGIR)
151 AppIndicator_0_1_gir_CFLAGS = $(INDICATOR_CFLAGS) -I$(srcdir) -I$(top_builddir)/src
152-AppIndicator_0_1_gir_LIBS = libappindicator.la
153+AppIndicator_0_1_gir_LIBS = libappindicator$(VER).la
154 AppIndicator_0_1_gir_FILES = $(introspection_sources)
155
156-INTROSPECTION_GIRS += AppIndicator-0.1.gir
157+AppIndicator3_0_1_gir_INCLUDES = $(AppIndicator_0_1_gir_INCLUDES)
158+AppIndicator3_0_1_gir_CFLAGS = $(AppIndicator_0_1_gir_CFLAGS)
159+AppIndicator3_0_1_gir_LIBS = $(AppIndicator_0_1_gir_LIBS)
160+AppIndicator3_0_1_gir_FILES = $(AppIndicator_0_1_gir_FILES)
161+
162+INTROSPECTION_GIRS += AppIndicator$(VER)-0.1.gir
163
164 girdir = $(datadir)/gir-1.0
165 gir_DATA = $(INTROSPECTION_GIRS)
166@@ -192,11 +217,11 @@
167 if HAVE_INTROSPECTION
168
169 vapidir = $(datadir)/vala/vapi
170-vapi_DATA = AppIndicator-0.1.vapi
171+vapi_DATA = AppIndicator$(VER)-0.1.vapi
172
173-AppIndicator-0.1.vapi: AppIndicator-0.1.gir Makefile.am
174- $(VALA_API_GEN) --library=AppIndicator-0.1 \
175- --pkg gtk+-2.0 \
176+AppIndicator$(VER)-0.1.vapi: AppIndicator$(VER)-0.1.gir Makefile.am
177+ $(VALA_API_GEN) --library=AppIndicator$(VER)-0.1 \
178+ --pkg $(GTKVAPI) \
179 --vapidir=$(top_builddir)/src \
180 $<
181
182
183=== modified file 'src/app-indicator.c'
184--- src/app-indicator.c 2010-09-21 19:22:16 +0000
185+++ src/app-indicator.c 2010-10-13 12:41:21 +0000
186@@ -33,7 +33,11 @@
187
188 #include <dbus/dbus-glib.h>
189 #include <libdbusmenu-glib/server.h>
190+#ifdef HAVE_GTK3
191+#include <libdbusmenu-gtk3/client.h>
192+#else
193 #include <libdbusmenu-gtk/client.h>
194+#endif
195
196 #include "app-indicator.h"
197 #include "app-indicator-enum-types.h"
198@@ -1525,13 +1529,17 @@
199 update_icon_name (DbusmenuMenuitem *menuitem,
200 GtkImage *image)
201 {
202+ const gchar *icon_name = NULL;
203+
204 if (gtk_image_get_storage_type (image) != GTK_IMAGE_ICON_NAME)
205 return;
206
207+ gtk_image_get_icon_name (image, &icon_name, NULL);
208+
209 if (should_show_image (image))
210 dbusmenu_menuitem_property_set (menuitem,
211 DBUSMENU_MENUITEM_PROP_ICON_NAME,
212- image->data.name.icon_name);
213+ icon_name);
214 else
215 dbusmenu_menuitem_property_remove (menuitem,
216 DBUSMENU_MENUITEM_PROP_ICON_NAME);
217@@ -1543,16 +1551,18 @@
218 GtkImage *image)
219 {
220 GtkStockItem stock;
221+ gchar *stock_id = NULL;
222
223 if (gtk_image_get_storage_type (image) != GTK_IMAGE_STOCK)
224 return FALSE;
225
226- gtk_stock_lookup (image->data.stock.stock_id, &stock);
227+ gtk_image_get_stock (image, &stock_id, NULL);
228+ gtk_stock_lookup (stock_id, &stock);
229
230 if (should_show_image (image))
231 dbusmenu_menuitem_property_set (menuitem,
232 DBUSMENU_MENUITEM_PROP_ICON_NAME,
233- image->data.stock.stock_id);
234+ stock_id);
235 else
236 dbusmenu_menuitem_property_remove (menuitem,
237 DBUSMENU_MENUITEM_PROP_ICON_NAME);
238@@ -1601,7 +1611,7 @@
239 {
240 dbusmenu_menuitem_property_set_bool (child,
241 DBUSMENU_MENUITEM_PROP_ENABLED,
242- GTK_WIDGET_IS_SENSITIVE (widget));
243+ gtk_widget_is_sensitive (widget));
244 }
245 else if (pspec->name == g_intern_static_string ("label"))
246 {
247@@ -1753,7 +1763,7 @@
248
249 dbusmenu_menuitem_property_set_bool (child,
250 DBUSMENU_MENUITEM_PROP_ENABLED,
251- GTK_WIDGET_IS_SENSITIVE (widget));
252+ gtk_widget_is_sensitive (widget));
253 dbusmenu_menuitem_property_set_bool (child,
254 DBUSMENU_MENUITEM_PROP_VISIBLE,
255 gtk_widget_get_visible (widget));
256
257=== added file 'src/appindicator3-0.1.pc.in'
258--- src/appindicator3-0.1.pc.in 1970-01-01 00:00:00 +0000
259+++ src/appindicator3-0.1.pc.in 2010-10-13 12:41:21 +0000
260@@ -0,0 +1,14 @@
261+prefix=@prefix@
262+exec_prefix=@exec_prefix@
263+libdir=@libdir@
264+bindir=@bindir@
265+includedir=@includedir@
266+
267+Cflags: -I${includedir}/libappindicator3-0.1
268+Requires: dbusmenu-glib gtk+-3.0
269+Libs: -L${libdir} -lappindicator3
270+
271+Name: appindicator3-0.1
272+Description: Application indicators
273+Version: @VERSION@
274+
275
276=== added file 'src/dbus-properties-client.h.OTHER'
277--- src/dbus-properties-client.h.OTHER 1970-01-01 00:00:00 +0000
278+++ src/dbus-properties-client.h.OTHER 2010-10-13 12:41:21 +0000
279@@ -0,0 +1,139 @@
280+/* Generated by dbus-binding-tool; do not edit! */
281+
282+#include <glib.h>
283+#include <dbus/dbus-glib.h>
284+
285+G_BEGIN_DECLS
286+
287+#ifndef _DBUS_GLIB_ASYNC_DATA_FREE
288+#define _DBUS_GLIB_ASYNC_DATA_FREE
289+static
290+#ifdef G_HAVE_INLINE
291+inline
292+#endif
293+void
294+_dbus_glib_async_data_free (gpointer stuff)
295+{
296+ g_slice_free (DBusGAsyncData, stuff);
297+}
298+#endif
299+
300+#ifndef DBUS_GLIB_CLIENT_WRAPPERS_org_freedesktop_DBus_Properties
301+#define DBUS_GLIB_CLIENT_WRAPPERS_org_freedesktop_DBus_Properties
302+
303+static
304+#ifdef G_HAVE_INLINE
305+inline
306+#endif
307+gboolean
308+org_freedesktop_DBus_Properties_get (DBusGProxy *proxy, const char * IN_Interface_Name, const char * IN_Property_Name, GValue* OUT_Value, GError **error)
309+
310+{
311+ return dbus_g_proxy_call (proxy, "Get", error, G_TYPE_STRING, IN_Interface_Name, G_TYPE_STRING, IN_Property_Name, G_TYPE_INVALID, G_TYPE_VALUE, OUT_Value, G_TYPE_INVALID);
312+}
313+
314+typedef void (*org_freedesktop_DBus_Properties_get_reply) (DBusGProxy *proxy, GValue OUT_Value, GError *error, gpointer userdata);
315+
316+static void
317+org_freedesktop_DBus_Properties_get_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data)
318+{
319+ DBusGAsyncData *data = (DBusGAsyncData*) user_data;
320+ GError *error = NULL;
321+ GValue OUT_Value = { 0, };
322+ dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_VALUE, &OUT_Value, G_TYPE_INVALID);
323+ (*(org_freedesktop_DBus_Properties_get_reply)data->cb) (proxy, OUT_Value, error, data->userdata);
324+ return;
325+}
326+
327+static
328+#ifdef G_HAVE_INLINE
329+inline
330+#endif
331+DBusGProxyCall*
332+org_freedesktop_DBus_Properties_get_async (DBusGProxy *proxy, const char * IN_Interface_Name, const char * IN_Property_Name, org_freedesktop_DBus_Properties_get_reply callback, gpointer userdata)
333+
334+{
335+ DBusGAsyncData *stuff;
336+ stuff = g_slice_new (DBusGAsyncData);
337+ stuff->cb = G_CALLBACK (callback);
338+ stuff->userdata = userdata;
339+ return dbus_g_proxy_begin_call (proxy, "Get", org_freedesktop_DBus_Properties_get_async_callback, stuff, _dbus_glib_async_data_free, G_TYPE_STRING, IN_Interface_Name, G_TYPE_STRING, IN_Property_Name, G_TYPE_INVALID);
340+}
341+static
342+#ifdef G_HAVE_INLINE
343+inline
344+#endif
345+gboolean
346+org_freedesktop_DBus_Properties_set (DBusGProxy *proxy, const char * IN_Interface_Name, const char * IN_Property_Name, const GValue* IN_Value, GError **error)
347+
348+{
349+ return dbus_g_proxy_call (proxy, "Set", error, G_TYPE_STRING, IN_Interface_Name, G_TYPE_STRING, IN_Property_Name, G_TYPE_VALUE, IN_Value, G_TYPE_INVALID, G_TYPE_INVALID);
350+}
351+
352+typedef void (*org_freedesktop_DBus_Properties_set_reply) (DBusGProxy *proxy, GError *error, gpointer userdata);
353+
354+static void
355+org_freedesktop_DBus_Properties_set_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data)
356+{
357+ DBusGAsyncData *data = (DBusGAsyncData*) user_data;
358+ GError *error = NULL;
359+ dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_INVALID);
360+ (*(org_freedesktop_DBus_Properties_set_reply)data->cb) (proxy, error, data->userdata);
361+ return;
362+}
363+
364+static
365+#ifdef G_HAVE_INLINE
366+inline
367+#endif
368+DBusGProxyCall*
369+org_freedesktop_DBus_Properties_set_async (DBusGProxy *proxy, const char * IN_Interface_Name, const char * IN_Property_Name, const GValue* IN_Value, org_freedesktop_DBus_Properties_set_reply callback, gpointer userdata)
370+
371+{
372+ DBusGAsyncData *stuff;
373+ stuff = g_slice_new (DBusGAsyncData);
374+ stuff->cb = G_CALLBACK (callback);
375+ stuff->userdata = userdata;
376+ return dbus_g_proxy_begin_call (proxy, "Set", org_freedesktop_DBus_Properties_set_async_callback, stuff, _dbus_glib_async_data_free, G_TYPE_STRING, IN_Interface_Name, G_TYPE_STRING, IN_Property_Name, G_TYPE_VALUE, IN_Value, G_TYPE_INVALID);
377+}
378+static
379+#ifdef G_HAVE_INLINE
380+inline
381+#endif
382+gboolean
383+org_freedesktop_DBus_Properties_get_all (DBusGProxy *proxy, const char * IN_Interface_Name, GHashTable** OUT_Properties, GError **error)
384+
385+{
386+ return dbus_g_proxy_call (proxy, "GetAll", error, G_TYPE_STRING, IN_Interface_Name, G_TYPE_INVALID, dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_VALUE), OUT_Properties, G_TYPE_INVALID);
387+}
388+
389+typedef void (*org_freedesktop_DBus_Properties_get_all_reply) (DBusGProxy *proxy, GHashTable *OUT_Properties, GError *error, gpointer userdata);
390+
391+static void
392+org_freedesktop_DBus_Properties_get_all_async_callback (DBusGProxy *proxy, DBusGProxyCall *call, void *user_data)
393+{
394+ DBusGAsyncData *data = (DBusGAsyncData*) user_data;
395+ GError *error = NULL;
396+ GHashTable* OUT_Properties;
397+ dbus_g_proxy_end_call (proxy, call, &error, dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_VALUE), &OUT_Properties, G_TYPE_INVALID);
398+ (*(org_freedesktop_DBus_Properties_get_all_reply)data->cb) (proxy, OUT_Properties, error, data->userdata);
399+ return;
400+}
401+
402+static
403+#ifdef G_HAVE_INLINE
404+inline
405+#endif
406+DBusGProxyCall*
407+org_freedesktop_DBus_Properties_get_all_async (DBusGProxy *proxy, const char * IN_Interface_Name, org_freedesktop_DBus_Properties_get_all_reply callback, gpointer userdata)
408+
409+{
410+ DBusGAsyncData *stuff;
411+ stuff = g_slice_new (DBusGAsyncData);
412+ stuff->cb = G_CALLBACK (callback);
413+ stuff->userdata = userdata;
414+ return dbus_g_proxy_begin_call (proxy, "GetAll", org_freedesktop_DBus_Properties_get_all_async_callback, stuff, _dbus_glib_async_data_free, G_TYPE_STRING, IN_Interface_Name, G_TYPE_INVALID);
415+}
416+#endif /* defined DBUS_GLIB_CLIENT_WRAPPERS_org_freedesktop_DBus_Properties */
417+
418+G_END_DECLS
419
420=== modified file 'src/indicator-application.c'
421--- src/indicator-application.c 2010-08-05 21:54:12 +0000
422+++ src/indicator-application.c 2010-10-13 12:41:21 +0000
423@@ -21,6 +21,9 @@
424 with this program. If not, see <http://www.gnu.org/licenses/>.
425 */
426
427+#ifdef HAVE_CONFIG_H
428+#include "config.h"
429+#endif
430
431 /* G Stuff */
432 #include <glib.h>
433@@ -29,7 +32,11 @@
434
435 /* DBus Stuff */
436 #include <dbus/dbus-glib.h>
437+#ifdef HAVE_GTK3
438+#include <libdbusmenu-gtk3/menu.h>
439+#else
440 #include <libdbusmenu-gtk/menu.h>
441+#endif
442
443 /* Indicator Stuff */
444 #include <libindicator/indicator.h>

Subscribers

People subscribed via source and target branches