ayatana-commits team mailing list archive
-
ayatana-commits team
-
Mailing list archive
-
Message #03712
[Merge] lp:~ted/libindicate/gtk3-and-stuff-like-that into lp:libindicate
Ted Gould has proposed merging lp:~ted/libindicate/gtk3-and-stuff-like-that into lp:libindicate.
Requested reviews:
Ken VanDine (ken-vandine)
For more details, see:
https://code.launchpad.net/~ted/libindicate/gtk3-and-stuff-like-that/+merge/69173
Porting this to use GTK3 and having to bump the GTK API version to 0.6
--
https://code.launchpad.net/~ted/libindicate/gtk3-and-stuff-like-that/+merge/69173
Your team ayatana-commits is subscribed to branch lp:libindicate.
=== modified file 'bindings/python/indicate.override'
--- bindings/python/indicate.override 2010-06-02 16:19:59 +0000
+++ bindings/python/indicate.override 2011-07-25 22:14:32 +0000
@@ -328,12 +328,12 @@
Py_INCREF(callback);
Py_INCREF(user_data);
- indicate_listener_get_property_icon(
+ indicate_gtk_listener_get_property_icon(
INDICATE_LISTENER(self->obj),
(IndicateListenerServer *)server->obj,
(IndicateListenerIndicator *)indicator->obj,
property,
- (indicate_listener_get_property_icon_cb)_listener_get_property_cb,
+ (indicate_gtk_listener_get_property_icon_cb)_listener_get_property_cb,
listener_property_cb_data);
Py_INCREF(Py_None);
=== modified file 'configure.ac'
--- configure.ac 2011-03-31 18:54:26 +0000
+++ configure.ac 2011-07-25 22:14:32 +0000
@@ -48,10 +48,9 @@
AC_SUBST(LIBINDICATEGTK_AGE)
###########################
-# Dependencies
+# Dependencies - GLib
###########################
-GTK_REQUIRED_VERSION=2.12
DBUS_REQUIRED_VERSION=0.76
GLIB_REQUIRED_VERSION=2.18
GIO_REQUIRED_VERSION=2.18
@@ -64,17 +63,45 @@
AC_SUBST(LIBINDICATE_CFLAGS)
AC_SUBST(LIBINDICATE_LIBS)
+###########################
+# Dependencies - GTK+
+###########################
+
+AC_ARG_WITH([gtk],
+ [AS_HELP_STRING([--with-gtk],
+ [Which version of gtk to use @<:@default=3@:>@])],
+ [],
+ [with_gtk=3])
+
+GTK_REQUIRED_VERSION=2.12
+GTK3_REQUIRED_VERSION=3.0
GDK_PIXBUF_REQUIRED_VERSION=2.12
-PKG_CHECK_MODULES(LIBINDICATEGTK, glib-2.0 >= $GLIB_REQUIRED_VERSION
- gio-2.0 >= $GIO_REQUIRED_VERSION
- gdk-pixbuf-2.0 >= $GDK_PIXBUF_REQUIRED_VERSION
- gtk+-2.0 >= $GTK_REQUIRED_VERSION
- dbusmenu-glib-0.4 >= $DBUSMENU_REQUIRED_VERSION
- dbus-glib-1 >= $DBUS_REQUIRED_VERSION)
+AS_IF([test "x$with_gtk" = x3],
+ [PKG_CHECK_MODULES(LIBINDICATEGTK, glib-2.0 >= $GLIB_REQUIRED_VERSION
+ gio-2.0 >= $GIO_REQUIRED_VERSION
+ gdk-pixbuf-2.0 >= $GDK_PIXBUF_REQUIRED_VERSION
+ gtk+-2.0 >= $GTK_REQUIRED_VERSION
+ dbusmenu-glib-0.4 >= $DBUSMENU_REQUIRED_VERSION
+ dbus-glib-1 >= $DBUS_REQUIRED_VERSION)
+ AC_DEFINE(HAVE_GTK3, 1, [whether gtk3 is available])
+ ],
+ [test "x$with_gtk" = x2],
+ [PKG_CHECK_MODULES(LIBINDICATEGTK, glib-2.0 >= $GLIB_REQUIRED_VERSION
+ gio-2.0 >= $GIO_REQUIRED_VERSION
+ gdk-pixbuf-3.0
+ gtk+-3.0 >= $GTK3_REQUIRED_VERSION
+ dbusmenu-glib-0.4 >= $DBUSMENU_REQUIRED_VERSION
+ dbus-glib-1 >= $DBUS_REQUIRED_VERSION)
+ ],
+ [AC_MSG_FAILURE([Value for --with-gtk was neither 2 nor 3])]
+)
+
AC_SUBST(LIBINDICATEGTK_CFLAGS)
AC_SUBST(LIBINDICATEGTK_LIBS)
+AM_CONDITIONAL(USE_GTK3, [test "x$with_gtk" = x3])
+
###########################
# GObject Introspection
###########################
@@ -234,7 +261,8 @@
libindicate/Makefile
libindicate/indicate-0.5.pc
libindicate-gtk/Makefile
-libindicate-gtk/indicate-gtk-0.5.pc
+libindicate-gtk/indicate-gtk-0.6.pc
+libindicate-gtk/indicate-gtk3-0.6.pc
examples/Makefile
examples/indicator-mono-example
tests/Makefile
@@ -264,4 +292,5 @@
Prefix: $prefix
GObject Introspection: $enable_introspection
+ GTK+ Version: $with_gtk
])
=== modified file 'examples/Makefile.am'
--- examples/Makefile.am 2010-06-02 16:19:59 +0000
+++ examples/Makefile.am 2011-07-25 22:14:32 +0000
@@ -1,3 +1,9 @@
+if USE_GTK3
+VER=3
+else
+VER=
+endif
+
ASSEMBLY = IndicatorMonoExample.exe
CSFILES = IndicatorMonoExample.cs
CLEANFILES = $(ASSEMBLY)
@@ -44,7 +50,7 @@
listen_and_print_LDADD = \
../libindicate/libindicate.la \
- ../libindicate-gtk/libindicate-gtk.la \
+ ../libindicate-gtk/libindicate-gtk$(VER).la \
$(LIBINDICATE_LIBS) \
$(LIBINDICATEGTK_LIBS)
@@ -59,7 +65,7 @@
im_client_LDADD = \
../libindicate/libindicate.la \
- ../libindicate-gtk/libindicate-gtk.la \
+ ../libindicate-gtk/libindicate-gtk$(VER).la \
$(LIBINDICATE_LIBS) \
$(LIBINDICATEGTK_LIBS)
=== modified file 'examples/im-client.c'
--- examples/im-client.c 2010-02-18 02:58:45 +0000
+++ examples/im-client.c 2011-07-25 22:14:32 +0000
@@ -48,7 +48,7 @@
GdkPixbuf * pixbuf = gdk_pixbuf_new_from_file(lastpath, NULL);
g_return_val_if_fail(pixbuf != NULL, TRUE);
- indicate_indicator_set_property_icon(INDICATE_INDICATOR(indicator), "icon", pixbuf);
+ indicate_gtk_indicator_set_property_icon(INDICATE_INDICATOR(indicator), "icon", pixbuf);
g_object_unref(G_OBJECT(pixbuf));
return TRUE;
=== modified file 'examples/listen-and-print.c'
--- examples/listen-and-print.c 2011-01-13 18:28:30 +0000
+++ examples/listen-and-print.c 2011-07-25 22:14:32 +0000
@@ -58,7 +58,7 @@
show_property (IndicateListener * listener, IndicateListenerServer * server, IndicateListenerIndicator * indicator, gchar * property)
{
if (!g_strcmp0(property, "icon")) {
- indicate_listener_get_property_icon(listener, server, indicator, property, show_property_icon_cb, NULL);
+ indicate_gtk_listener_get_property_icon(listener, server, indicator, property, show_property_icon_cb, NULL);
} else if (!g_strcmp0(property, "time")) {
indicate_listener_get_property_time(listener, server, indicator, property, show_property_time_cb, NULL);
} else {
=== modified file 'libindicate-gtk/Makefile.am'
--- libindicate-gtk/Makefile.am 2011-02-11 18:17:33 +0000
+++ libindicate-gtk/Makefile.am 2011-07-25 22:14:32 +0000
@@ -1,14 +1,26 @@
+if USE_GTK3
+VER=3
+GTKGIR=Gtk-3.0
+GTKVALA=gtk+-3.0
+lib_LTLIBRARIES = \
+ libindicate-gtk3.la
+else
+VER=
+GTKGIR=Gtk-2.0
+GTKVALA=gtk+-2.0
+lib_LTLIBRARIES = \
+ libindicate-gtk.la
+endif
+
INCLUDES= \
- -DG_LOG_DOMAIN=\"libindicate-gtk\"
+ -DG_LOG_DOMAIN=\"libindicate-gtk$(VER)\"
EXTRA_DIST = \
- indicate-gtk-0.5.pc.in
-
-lib_LTLIBRARIES = \
- libindicate-gtk.la
-
-libindicate_gtkincludedir=$(includedir)/libindicate-0.5/libindicate-gtk
+ indicate-gtk-0.6.pc.in \
+ indicate-gtk3-0.6.pc.in
+
+libindicate_gtkincludedir=$(includedir)/libindicate-0.6/libindicate-gtk
indicate_gtk_headers = \
indicator.h \
@@ -36,7 +48,18 @@
../libindicate/libindicate.la \
$(LIBINDICATEGTK_LIBS)
-pkgconfig_DATA = indicate-gtk-0.5.pc
+# We duplicate these here because Automake won't let us use $(VER) on the left hand side.
+# Since we carefully use $(VER) in the right hand side above, we can assign the same values.
+# Only one version of the library is every compiled at the same time, so it is safe to reuse
+# the right hand sides like this.
+libindicate_gtk3_la_LIBADD = $(libindicate_gtk_la_LIBADD)
+libindicate_gtk3_la_CFLAGS = $(libindicate_gtk_la_CFLAGS)
+libindicate_gtk3_la_LDFLAGS = $(libindicate_gtk_la_LDFLAGS)
+libindicate_gtk3_la_SOURCES = $(libindicate_gtk_la_SOURCES)
+libindicate_gtk3include_HEADERS = $(libindicate_gtkinclude_HEADERS)
+libindicate_gtk3includedir = $(libindicate_gtkincludedir)
+
+pkgconfig_DATA = indicate-gtk$(VER)-0.6.pc
pkgconfigdir = $(libdir)/pkgconfig
CLEANFILES =
@@ -50,29 +73,36 @@
INTROSPECTION_SCANNER_ARGS = \
--add-include-path=$(top_builddir)/libindicate \
$(introspection_sources) \
- --symbol-prefix=indicate \
+ --symbol-prefix=indicate_gtk \
--warn-all \
- --identifier-prefix=Indicate
+ --identifier-prefix=IndicateGtk
INTROSPECTION_COMPILER_ARGS = --includedir=$(builddir) --includedir=$(top_builddir)/libindicate
if HAVE_INTROSPECTION
introspection_sources = \
- $(addprefix $(srcdir)/,$(indicate_gtk_headers))
+ $(addprefix $(srcdir)/,$(libindicate_gtk_la_SOURCES))
-Indicate-Gtk-0.5.gir: libindicate-gtk.la
-Indicate_Gtk_0_5_gir_INCLUDES = \
+IndicateGtk$(VER)-0.6.gir: libindicate-gtk$(VER).la
+IndicateGtk_0_6_gir_INCLUDES = \
GObject-2.0 \
- Gtk-2.0 \
+ $(GTKGIR) \
GLib-2.0 \
GdkPixbuf-2.0 \
Indicate-0.5
-Indicate_Gtk_0_5_gir_CFLAGS = $(LIBINDICATEGTK_CFLAGS) -I$(top_builddir) -I$(top_srcdir) -I$(top_builddir)/libindicate
-Indicate_Gtk_0_5_gir_LIBS = libindicate-gtk.la
-Indicate_Gtk_0_5_gir_SCANNERFLAGS = $(INTROSPECTION_SCANNER_ARGS)
-Indicate_Gtk_0_5_gir_FILES = $(introspection_sources)
-
-INTROSPECTION_GIRS += Indicate-Gtk-0.5.gir
+IndicateGtk_0_6_gir_CFLAGS = $(LIBINDICATEGTK_CFLAGS) -I$(top_builddir) -I$(top_srcdir) -I$(top_builddir)/libindicate
+IndicateGtk_0_6_gir_LIBS = libindicate-gtk$(VER).la
+IndicateGtk_0_6_gir_SCANNERFLAGS = $(INTROSPECTION_SCANNER_ARGS)
+IndicateGtk_0_6_gir_FILES = $(introspection_sources)
+
+# Gotta be a better way
+IndicateGtk3_0_6_gir_INCLUDES = $(IndicateGtk_0_6_gir_INCLUDES)
+IndicateGtk3_0_6_gir_CFLAGS = $(IndicateGtk_0_6_gir_CFLAGS)
+IndicateGtk3_0_6_gir_LIBS = $(IndicateGtk_0_6_gir_LIBS)
+IndicateGtk3_0_6_gir_SCANNERFLAGS = $(IndicateGtk_0_6_gir_SCANNERFLAGS)
+IndicateGtk3_0_6_gir_FILES = $(IndicateGtk_0_6_gir_FILES)
+
+INTROSPECTION_GIRS += IndicateGtk$(VER)-0.6.gir
girdir = $(datadir)/gir-1.0
gir_DATA = $(INTROSPECTION_GIRS)
@@ -92,23 +122,23 @@
if HAVE_INTROSPECTION
vapidir = $(datadir)/vala/vapi
-vapi_DATA = Indicate-Gtk-0.5.vapi
+vapi_DATA = IndicateGtk$(VER)-0.6.vapi
-Indicate-Gtk-0.5.vapi: Indicate-Gtk-0.5.tmp.gir Makefile.am
- $(VALA_API_GEN) --library=Indicate-Gtk-0.5 \
- --pkg gtk+-2.0 \
+IndicateGtk$(VER)-0.6.vapi: IndicateGtk$(VER)-0.6.tmp.gir Makefile.am
+ $(VALA_API_GEN) --library=IndicateGtk$(VER)-0.6 \
+ --pkg $(GTKVALA) \
--pkg Dbusmenu-0.4 \
--pkg Indicate-0.5 \
--vapidir=$(top_builddir)/libindicate \
$<
-Indicate-Gtk-0.5.tmp.gir: Indicate-Gtk-0.5.gir
+IndicateGtk$(VER)-0.6.tmp.gir: IndicateGtk$(VER)-0.6.gir
$(SED) \
-e "s|GdkPixbuf.Pixbuf|Gdk.Pixbuf|g" \
-e "s|Atk.ImplementorIface|Atk.Implementor|g" \
$< > $@
-CLEANFILES += $(vapi_DATA) Indicate-Gtk-0.5.tmp.gir
+CLEANFILES += $(vapi_DATA) IndicateGtk$(VER)-0.6.tmp.gir
endif
=== renamed file 'libindicate-gtk/indicate-gtk-0.5.pc.in' => 'libindicate-gtk/indicate-gtk-0.6.pc.in'
=== added file 'libindicate-gtk/indicate-gtk3-0.6.pc.in'
--- libindicate-gtk/indicate-gtk3-0.6.pc.in 1970-01-01 00:00:00 +0000
+++ libindicate-gtk/indicate-gtk3-0.6.pc.in 2011-07-25 22:14:32 +0000
@@ -0,0 +1,14 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+bindir=@bindir@
+includedir=@includedir@
+
+Cflags: -I${includedir}/libindicate-0.5
+Requires: gtk+-2.0 indicate-0.5
+Libs: -L${libdir} -lindicate-gtk
+
+Name: libindicate-gtk
+Description: libindicate GTK stuff.
+Version: @VERSION@
+
=== modified file 'libindicate-gtk/indicator.c'
--- libindicate-gtk/indicator.c 2009-09-04 03:00:22 +0000
+++ libindicate-gtk/indicator.c 2011-07-25 22:14:32 +0000
@@ -41,7 +41,7 @@
uses that data to call #indicate_indicator_set_property.
*/
void
-indicate_indicator_set_property_icon (IndicateIndicator * indicator, const gchar * key, const GdkPixbuf * data)
+indicate_gtk_indicator_set_property_icon (IndicateIndicator * indicator, const gchar * key, const GdkPixbuf * data)
{
if (!GDK_IS_PIXBUF(data)) {
g_warning("Invalide GdkPixbuf");
=== modified file 'libindicate-gtk/indicator.h'
--- libindicate-gtk/indicator.h 2009-08-03 18:25:05 +0000
+++ libindicate-gtk/indicator.h 2011-07-25 22:14:32 +0000
@@ -37,7 +37,7 @@
G_BEGIN_DECLS
/* Properties handling */
-void indicate_indicator_set_property_icon (IndicateIndicator * indicator, const gchar * key, const GdkPixbuf * data);
+void indicate_gtk_indicator_set_property_icon (IndicateIndicator * indicator, const gchar * key, const GdkPixbuf * data);
G_END_DECLS
=== modified file 'libindicate-gtk/listener.c'
--- libindicate-gtk/listener.c 2011-01-13 06:14:52 +0000
+++ libindicate-gtk/listener.c 2011-07-25 22:14:32 +0000
@@ -65,7 +65,7 @@
switch (get_property_data->type) {
case PROPERTY_TYPE_ICON: {
- indicate_listener_get_property_icon_cb cb = (indicate_listener_get_property_icon_cb)get_property_data->cb;
+ indicate_gtk_listener_get_property_icon_cb cb = (indicate_gtk_listener_get_property_icon_cb)get_property_data->cb;
const gchar * OUT_value = g_variant_get_string(value, NULL);
/* There is no icon */
@@ -142,8 +142,25 @@
return;
}
+/**
+ * indicate_gtk_listener_get_property_icon:
+ * @listener: The #IndicateListener representing the connection
+ * @server: The server that the indicator is on
+ * @indicator: Which indicator is being queried
+ * @property: Name of the property to get
+ * @callback: (scope async): The callback function to call with the data
+ * @data: Arbitrary data to give the callback
+ *
+ * A function to get a property from an indicator on a server
+ * and bring it back locally. This wraps all the hassle of using
+ * the DBus API and makes it pretty easy to get properties.
+ *
+ * Very similar to #indicate_listener_get_property but converts
+ * the final value into an icon for easy (and type-safe)
+ * usage by listeners.
+ */
void
-indicate_listener_get_property_icon (IndicateListener * listener, IndicateListenerServer * server, IndicateListenerIndicator * indicator, gchar * property, indicate_listener_get_property_icon_cb callback, gpointer data)
+indicate_gtk_listener_get_property_icon (IndicateListener * listener, IndicateListenerServer * server, IndicateListenerIndicator * indicator, gchar * property, indicate_gtk_listener_get_property_icon_cb callback, gpointer data)
{
return get_property_helper(listener, server, indicator, property, G_CALLBACK(callback), data, PROPERTY_TYPE_ICON);
}
=== modified file 'libindicate-gtk/listener.h'
--- libindicate-gtk/listener.h 2009-08-03 22:43:37 +0000
+++ libindicate-gtk/listener.h 2011-07-25 22:14:32 +0000
@@ -37,19 +37,31 @@
G_BEGIN_DECLS
-typedef void (*indicate_listener_get_property_icon_cb) (IndicateListener * listener,
- IndicateListenerServer * server,
- IndicateListenerIndicator * indicator,
- gchar * property,
- GdkPixbuf * propertydata,
- gpointer data);
+/**
+ * indicate_gtk_listener_get_property_icon_cb:
+ * @listener: The #IndicateListener representing the connection
+ * @server: The server that the indicator is on
+ * @indicator: Which indicator is being queried
+ * @property: Name of the property to get
+ * @propertydata: Image data from the library
+ * @data: Arbitrary data to give the callback
+ *
+ * A callback that is called when the image data is gotten from
+ * a server.
+ */
+typedef void (*indicate_gtk_listener_get_property_icon_cb) (IndicateListener * listener,
+ IndicateListenerServer * server,
+ IndicateListenerIndicator * indicator,
+ gchar * property,
+ GdkPixbuf * propertydata,
+ gpointer data);
-void indicate_listener_get_property_icon (IndicateListener * listener,
- IndicateListenerServer * server,
- IndicateListenerIndicator * indicator,
- gchar * property,
- indicate_listener_get_property_icon_cb callback,
- gpointer data);
+void indicate_gtk_listener_get_property_icon (IndicateListener * listener,
+ IndicateListenerServer * server,
+ IndicateListenerIndicator * indicator,
+ gchar * property,
+ indicate_gtk_listener_get_property_icon_cb callback,
+ gpointer data);
G_END_DECLS
Follow ups