diff options
-rw-r--r-- | configure.ac | 6 | ||||
-rw-r--r-- | libdbusmenu-glib/Makefile.am | 5 | ||||
-rw-r--r-- | libdbusmenu-glib/client.c | 15 | ||||
-rw-r--r-- | libdbusmenu-glib/dbusmenu-glib.h | 37 | ||||
-rw-r--r-- | libdbusmenu-glib/server.c | 61 | ||||
-rw-r--r-- | libdbusmenu-gtk/Makefile.am | 3 | ||||
-rw-r--r-- | libdbusmenu-gtk/client.c | 2 | ||||
-rw-r--r-- | libdbusmenu-gtk/dbusmenu-gtk.h | 40 |
8 files changed, 151 insertions, 18 deletions
diff --git a/configure.ac b/configure.ac index 5c85da8..c46afe0 100644 --- a/configure.ac +++ b/configure.ac @@ -1,11 +1,11 @@ -AC_INIT(libdbusmenu, 0.3.92, ted@canonical.com) +AC_INIT(libdbusmenu, 0.3.93, ted@canonical.com) AC_COPYRIGHT([Copyright 2009,2010 Canonical]) AC_PREREQ(2.62) AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(libdbusmenu, 0.3.92, [-Wno-portability]) +AM_INIT_AUTOMAKE(libdbusmenu, 0.3.93, [-Wno-portability]) AM_MAINTAINER_MODE @@ -136,7 +136,7 @@ AC_PATH_PROG([XSLT_PROC], [xsltproc]) ########################### LIBDBUSMENU_CURRENT=3 -LIBDBUSMENU_REVISION=0 +LIBDBUSMENU_REVISION=1 LIBDBUSMENU_AGE=0 AC_SUBST(LIBDBUSMENU_CURRENT) diff --git a/libdbusmenu-glib/Makefile.am b/libdbusmenu-glib/Makefile.am index f502fb3..a139f7c 100644 --- a/libdbusmenu-glib/Makefile.am +++ b/libdbusmenu-glib/Makefile.am @@ -15,6 +15,7 @@ lib_LTLIBRARIES = \ libdbusmenu_glibincludedir=$(includedir)/libdbusmenu-0.4/libdbusmenu-glib/ libdbusmenu_glibinclude_HEADERS = \ + dbusmenu-glib.h \ menuitem.h \ menuitem-proxy.h \ server.h \ @@ -119,12 +120,14 @@ INTROSPECTION_GIRS = if INTROSPECTION_TEN INTROSPECTION_SCANNER_ARGS = --add-include-path=$(srcdir) \ + --warn-all \ --add-include-path=$(srcdir) \ $(addprefix --c-include=libdbusmenu-glib/, $(introspection_sources)) \ --symbol-prefix=dbusmenu \ --identifier-prefix=Dbusmenu else INTROSPECTION_SCANNER_ARGS = --add-include-path=$(srcdir) \ + --warn-all \ --add-include-path=$(srcdir) \ $(addprefix --c-include=libdbusmenu-glib/, $(introspection_sources)) endif @@ -138,7 +141,7 @@ introspection_sources = $(libdbusmenu_glibinclude_HEADERS) Dbusmenu_Glib-0.4.gir: libdbusmenu-glib.la Dbusmenu_Glib_0_4_gir_INCLUDES = \ GObject-2.0 -Dbusmenu_Glib_0_4_gir_CFLAGS = $(DBUSMENUGLIB_CFLAGS) +Dbusmenu_Glib_0_4_gir_CFLAGS = $(DBUSMENUGLIB_CFLAGS) -I$(top_srcdir) Dbusmenu_Glib_0_4_gir_LIBS = libdbusmenu-glib.la Dbusmenu_Glib_0_4_gir_FILES = $(addprefix $(srcdir)/, $(introspection_sources)) Dbusmenu_Glib_0_4_gir_NAMESPACE = Dbusmenu diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index f84d6e0..ea0f0f7 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -1548,6 +1548,14 @@ parse_layout (DbusmenuClient * client, const gchar * layout) static void update_layout_cb (GObject * proxy, GAsyncResult * res, gpointer data) { + DbusmenuClient * client = DBUSMENU_CLIENT(data); + DbusmenuClientPrivate * priv = DBUSMENU_CLIENT_GET_PRIVATE(client); + + if (priv->layoutcall != NULL) { + g_object_unref(priv->layoutcall); + priv->layoutcall = NULL; + } + GError * error = NULL; GVariant * params = NULL; @@ -1564,9 +1572,6 @@ update_layout_cb (GObject * proxy, GAsyncResult * res, gpointer data) g_variant_get(params, "(us)", &rev, &xml); g_variant_unref(params); - DbusmenuClient * client = DBUSMENU_CLIENT(data); - DbusmenuClientPrivate * priv = DBUSMENU_CLIENT_GET_PRIVATE(client); - guint parseable = parse_layout(client, xml); g_free(xml); @@ -1577,10 +1582,6 @@ update_layout_cb (GObject * proxy, GAsyncResult * res, gpointer data) priv->my_revision = rev; /* g_debug("Root is now: 0x%X", (unsigned int)priv->root); */ - if (priv->layoutcall != NULL) { - g_object_unref(priv->layoutcall); - priv->layoutcall = NULL; - } #ifdef MASSIVEDEBUGGING g_debug("Client signaling layout has changed."); #endif diff --git a/libdbusmenu-glib/dbusmenu-glib.h b/libdbusmenu-glib/dbusmenu-glib.h new file mode 100644 index 0000000..9c377ca --- /dev/null +++ b/libdbusmenu-glib/dbusmenu-glib.h @@ -0,0 +1,37 @@ +/* +A library to communicate a menu object set accross DBus and +track updates and maintain consistency. + +Copyright 2011 Canonical Ltd. + +Authors: + Ted Gould <ted@canonical.com> + +This program is free software: you can redistribute it and/or modify it +under the terms of either or both of the following licenses: + +1) the GNU Lesser General Public License version 3, as published by the +Free Software Foundation; and/or +2) the GNU Lesser General Public License version 2.1, as published by +the Free Software Foundation. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranties of +MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR +PURPOSE. See the applicable version of the GNU Lesser General Public +License for more details. + +You should have received a copy of both the GNU Lesser General Public +License version 3 and version 2.1 along with this program. If not, see +<http://www.gnu.org/licenses/> +*/ + +#ifndef __DBUSMENU_GLIB_H__ +#define __DBUSMENU_GLIB_H__ + +#include <libdbusmenu-glib/client.h> +#include <libdbusmenu-glib/menuitem.h> +#include <libdbusmenu-glib/menuitem-proxy.h> +#include <libdbusmenu-glib/server.h> + +#endif /* __DBUSMENU_GLIB_H__ */ diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c index 100eb14..095f333 100644 --- a/libdbusmenu-glib/server.c +++ b/libdbusmenu-glib/server.c @@ -506,6 +506,19 @@ register_object (DbusmenuServer * server) if (error != NULL) { g_warning("Unable to register object on bus: %s", error->message); g_error_free(error); + return; + } + + /* If we've got it registered let's tell everyone about it */ + g_signal_emit(G_OBJECT(server), signals[LAYOUT_UPDATED], 0, priv->layout_revision, 0, TRUE); + if (priv->dbusobject != NULL && priv->bus != NULL) { + g_dbus_connection_emit_signal(priv->bus, + NULL, + priv->dbusobject, + DBUSMENU_INTERFACE, + "LayoutUpdated", + g_variant_new("(ui)", priv->layout_revision, 0), + NULL); } return; @@ -894,20 +907,31 @@ bus_get_group_properties (DbusmenuServer * server, GVariant * params, GDBusMetho g_variant_iter_init(&ids, g_variant_get_child_value(params, 0)); GVariantBuilder builder; - g_variant_builder_init(&builder, G_VARIANT_TYPE_ARRAY); + gboolean builder_init = FALSE; gint id; while (g_variant_iter_next(&ids, "i", &id)) { DbusmenuMenuitem * mi = dbusmenu_menuitem_find_id(priv->root, id); if (mi == NULL) continue; + if (!builder_init) { + g_variant_builder_init(&builder, G_VARIANT_TYPE_ARRAY); + builder_init = TRUE; + } + GVariantBuilder wbuilder; g_variant_builder_init(&wbuilder, G_VARIANT_TYPE_TUPLE); g_variant_builder_add(&wbuilder, "i", id); GVariant * props = dbusmenu_menuitem_properties_variant(mi); if (props == NULL) { - props = g_variant_parse(g_variant_type_new("a{sv}"), "{}", NULL, NULL, NULL); + GError * error = NULL; + props = g_variant_parse(g_variant_type_new("a{sv}"), "{}", NULL, NULL, &error); + if (error != NULL) { + g_warning("Unable to parse '{}' as a 'a{sv}': %s", error->message); + g_error_free(error); + props = NULL; + } } g_variant_builder_add_value(&wbuilder, props); @@ -916,11 +940,28 @@ bus_get_group_properties (DbusmenuServer * server, GVariant * params, GDBusMetho g_variant_builder_add_value(&builder, mi_data); } - GVariant * ret = g_variant_builder_end(&builder); + GVariant * ret = NULL; + + if (builder_init) { + ret = g_variant_builder_end(&builder); + } else { + GError * error = NULL; + ret = g_variant_parse(g_variant_type_new("a(ia(sv))"), "[]", NULL, NULL, NULL); + if (error != NULL) { + g_warning("Unable to parse '[]' as a 'a(ia(sv))': %s", error->message); + g_error_free(error); + ret = NULL; + } + } - g_variant_builder_init(&builder, G_VARIANT_TYPE_TUPLE); - g_variant_builder_add_value(&builder, ret); - GVariant * final = g_variant_builder_end(&builder); + GVariant * final = NULL; + if (ret != NULL) { + g_variant_builder_init(&builder, G_VARIANT_TYPE_TUPLE); + g_variant_builder_add_value(&builder, ret); + final = g_variant_builder_end(&builder); + } else { + g_warning("Error building property list, final variant is NULL"); + } g_dbus_method_invocation_return_value(invocation, final); @@ -981,7 +1022,13 @@ bus_get_children (DbusmenuServer * server, GVariant * params, GDBusMethodInvocat ret = g_variant_new("(a(ia{svg}))", g_variant_builder_end(&builder)); } else { - ret = g_variant_parse(g_variant_type_new("(a(ia{sv}))"), "([(0, {})],)", NULL, NULL, NULL); + GError * error = NULL; + ret = g_variant_parse(g_variant_type_new("(a(ia{sv}))"), "([(0, {})],)", NULL, NULL, &error); + if (error != NULL) { + g_warning("Unable to parse '([(0, {})],)' as a '(a(ia{sv}))': %s", error->message); + g_error_free(error); + ret = NULL; + } } g_dbus_method_invocation_return_value(invocation, ret); diff --git a/libdbusmenu-gtk/Makefile.am b/libdbusmenu-gtk/Makefile.am index a424d4a..754ed3e 100644 --- a/libdbusmenu-gtk/Makefile.am +++ b/libdbusmenu-gtk/Makefile.am @@ -20,6 +20,7 @@ EXTRA_DIST = \ libdbusmenu_gtkincludedir=$(includedir)/libdbusmenu-0.4/libdbusmenu-gtk$(VER)/ libdbusmenu_gtkinclude_HEADERS = \ + dbusmenu-gtk.h \ client.h \ menu.h \ menuitem.h \ @@ -72,12 +73,14 @@ INTROSPECTION_GIRS = if INTROSPECTION_TEN INTROSPECTION_SCANNER_ARGS = --add-include-path=$(srcdir) \ + --warn-all \ --add-include-path=$(top_builddir)/libdbusmenu-glib \ $(addprefix --c-include=libdbusmenu-gtk/, $(introspection_sources)) \ --symbol-prefix=dbusmenu \ --identifier-prefix=DbusmenuGtk else INTROSPECTION_SCANNER_ARGS = --add-include-path=$(srcdir) \ + --warn-all \ --add-include-path=$(top_builddir)/libdbusmenu-glib \ $(addprefix --c-include=libdbusmenu-gtk/, $(introspection_sources)) endif diff --git a/libdbusmenu-gtk/client.c b/libdbusmenu-gtk/client.c index af7768a..d957f25 100644 --- a/libdbusmenu-gtk/client.c +++ b/libdbusmenu-gtk/client.c @@ -789,6 +789,7 @@ image_property_handle (DbusmenuMenuitem * item, const gchar * property, GVariant gtkimage = NULL; } else if (g_strcmp0(iconname, DBUSMENU_MENUITEM_ICON_NAME_BLANK) == 0) { gtkimage = gtk_image_new(); + g_object_set(G_OBJECT(gtkimage), "use-fallback", TRUE, NULL); } else { /* Look to see if we want to have an icon with the 'ltr' or 'rtl' depending on what we're doing. */ @@ -807,6 +808,7 @@ image_property_handle (DbusmenuMenuitem * item, const gchar * property, GVariant can just convert it to this name. */ if (gtkimage == NULL) { gtkimage = gtk_image_new_from_icon_name(finaliconname, GTK_ICON_SIZE_MENU); + g_object_set(G_OBJECT(gtkimage), "use-fallback", TRUE, NULL); } else { gtk_image_set_from_icon_name(GTK_IMAGE(gtkimage), finaliconname, GTK_ICON_SIZE_MENU); } diff --git a/libdbusmenu-gtk/dbusmenu-gtk.h b/libdbusmenu-gtk/dbusmenu-gtk.h new file mode 100644 index 0000000..de63c61 --- /dev/null +++ b/libdbusmenu-gtk/dbusmenu-gtk.h @@ -0,0 +1,40 @@ +/* +A library to communicate a menu object set accross DBus and +track updates and maintain consistency. + +Copyright 2011 Canonical Ltd. + +Authors: + Ted Gould <ted@canonical.com> + +This program is free software: you can redistribute it and/or modify it +under the terms of either or both of the following licenses: + +1) the GNU Lesser General Public License version 3, as published by the +Free Software Foundation; and/or +2) the GNU Lesser General Public License version 2.1, as published by +the Free Software Foundation. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranties of +MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR +PURPOSE. See the applicable version of the GNU Lesser General Public +License for more details. + +You should have received a copy of both the GNU Lesser General Public +License version 3 and version 2.1 along with this program. If not, see +<http://www.gnu.org/licenses/> +*/ + +#ifndef __DBUSMENU_GTK_H__ +#define __DBUSMENU_GTK_H__ + +/* Start with the glib stuff */ +#include <libdbusmenu-glib/dbusmenu-glib.h> + +/* Now get the GTK stuff */ +#include <libdbusmenu-gtk/client.h> +#include <libdbusmenu-gtk/menu.h> +#include <libdbusmenu-gtk/menuitem.h> + +#endif /* __DBUSMENU_GLIB_H__ */ |