From 31d28c2b7f818749973aa528fca53632a129f83d Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 18 Jan 2011 10:32:29 -0600 Subject: Fixing builder to only init/finish if there are entries we get. --- libdbusmenu-glib/server.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c index 100eb14..03886bb 100644 --- a/libdbusmenu-glib/server.c +++ b/libdbusmenu-glib/server.c @@ -894,13 +894,18 @@ 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); @@ -916,7 +921,13 @@ 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 { + ret = g_variant_parse(g_variant_type_new("a(ia(sv))"), "[]", NULL, NULL, NULL); + } g_variant_builder_init(&builder, G_VARIANT_TYPE_TUPLE); g_variant_builder_add_value(&builder, ret); -- cgit v1.2.3 From 4c8f8ca605bb7e2780c089c42ca58e8c0c7aa7dd Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 18 Jan 2011 10:34:22 -0600 Subject: Protecting the final tuple from errors. --- libdbusmenu-glib/server.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c index 03886bb..39176c2 100644 --- a/libdbusmenu-glib/server.c +++ b/libdbusmenu-glib/server.c @@ -929,9 +929,14 @@ bus_get_group_properties (DbusmenuServer * server, GVariant * params, GDBusMetho ret = g_variant_parse(g_variant_type_new("a(ia(sv))"), "[]", NULL, NULL, 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); -- cgit v1.2.3 From 72a77bdfbe9dd9925648b2cfa8b11804758def40 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 18 Jan 2011 10:38:27 -0600 Subject: Adding warnings on g_variant_parse errors --- libdbusmenu-glib/server.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c index 39176c2..8d18feb 100644 --- a/libdbusmenu-glib/server.c +++ b/libdbusmenu-glib/server.c @@ -912,7 +912,13 @@ bus_get_group_properties (DbusmenuServer * server, GVariant * params, GDBusMetho 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}'"); + g_error_free(error); + props = NULL; + } } g_variant_builder_add_value(&wbuilder, props); @@ -926,7 +932,13 @@ bus_get_group_properties (DbusmenuServer * server, GVariant * params, GDBusMetho 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))'"); + g_error_free(error); + ret = NULL; + } } GVariant * final = NULL; -- cgit v1.2.3 From 74ccb9b179c63ae79719b480247bb844326ab675 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 18 Jan 2011 10:39:09 -0600 Subject: Use the message string. --- libdbusmenu-glib/server.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c index 8d18feb..75a305c 100644 --- a/libdbusmenu-glib/server.c +++ b/libdbusmenu-glib/server.c @@ -915,7 +915,7 @@ bus_get_group_properties (DbusmenuServer * server, GVariant * params, GDBusMetho 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}'"); + g_warning("Unable to parse '{}' as a 'a{sv}': %s", error->message); g_error_free(error); props = NULL; } @@ -935,7 +935,7 @@ bus_get_group_properties (DbusmenuServer * server, GVariant * params, GDBusMetho 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))'"); + g_warning("Unable to parse '[]' as a 'a(ia(sv))': %s", error->message); g_error_free(error); ret = NULL; } -- cgit v1.2.3 From 6cb4e78579f4d202ca797dfbc9a998e1cc58186a Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 18 Jan 2011 10:47:32 -0600 Subject: Warn when can't parse. --- libdbusmenu-glib/server.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c index 75a305c..6be2a60 100644 --- a/libdbusmenu-glib/server.c +++ b/libdbusmenu-glib/server.c @@ -1009,7 +1009,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); -- cgit v1.2.3 -- cgit v1.2.3 From 88a9ad428716c028fc8de094b814623af07adec6 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 18 Jan 2011 12:39:57 -0600 Subject: Send a LayoutUpdated when we register the object. --- libdbusmenu-glib/server.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c index 100eb14..51a47b2 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; -- cgit v1.2.3 From cedc4584f11e6fa90ae73db5ecc3019868a6323e Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 18 Jan 2011 15:59:36 -0600 Subject: Set the use-fallback property to TRUE on all our Images --- libdbusmenu-gtk/client.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libdbusmenu-gtk/client.c b/libdbusmenu-gtk/client.c index b01156f..18a2cdd 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); } -- cgit v1.2.3 From be239149b9b3b875f9c52137e6bdc19a78724f72 Mon Sep 17 00:00:00 2001 From: Chris Coulson Date: Wed, 19 Jan 2011 14:55:37 +0000 Subject: Ensure that we can recover from GetLayout failing --- libdbusmenu-glib/client.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index 58d6360..29ed4a0 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -1538,6 +1538,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; @@ -1554,9 +1562,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); @@ -1567,10 +1572,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 -- cgit v1.2.3 From 58677931dde065b11f7010ad1443c6d4d1b20d7d Mon Sep 17 00:00:00 2001 From: Ken VanDine Date: Wed, 19 Jan 2011 22:50:25 -0500 Subject: added --warn-all to scanner flags so the build log will warn us about missing annotations --- libdbusmenu-glib/Makefile.am | 2 ++ libdbusmenu-gtk/Makefile.am | 2 ++ 2 files changed, 4 insertions(+) diff --git a/libdbusmenu-glib/Makefile.am b/libdbusmenu-glib/Makefile.am index f502fb3..8ab36f7 100644 --- a/libdbusmenu-glib/Makefile.am +++ b/libdbusmenu-glib/Makefile.am @@ -119,12 +119,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 diff --git a/libdbusmenu-gtk/Makefile.am b/libdbusmenu-gtk/Makefile.am index 0b939c0..b8e1170 100644 --- a/libdbusmenu-gtk/Makefile.am +++ b/libdbusmenu-gtk/Makefile.am @@ -69,12 +69,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 -- cgit v1.2.3 From 97fe110d8f5b65fb39737b7d525db47becd27971 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 20 Jan 2011 08:33:53 -0600 Subject: 0.3.93 --- configure.ac | 6 +++--- 1 file changed, 3 insertions(+), 3 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) -- cgit v1.2.3 From 64baf8e0dafe24dc1be97cca5b8838e784f6c181 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 21 Jan 2011 10:31:25 -0600 Subject: Add a single include file for dbus-glib --- libdbusmenu-glib/Makefile.am | 1 + libdbusmenu-glib/dbusmenu-glib.h | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 libdbusmenu-glib/dbusmenu-glib.h diff --git a/libdbusmenu-glib/Makefile.am b/libdbusmenu-glib/Makefile.am index 8ab36f7..7dd69de 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 \ 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 + +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 + +*/ + +#ifndef __DBUSMENU_GLIB_H__ +#define __DBUSMENU_GLIB_H__ + +#include +#include +#include +#include + +#endif /* __DBUSMENU_GLIB_H__ */ -- cgit v1.2.3 From 1a4efa01c312cf8c54d7d158385b5208f1cdb841 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 21 Jan 2011 10:35:55 -0600 Subject: Add a single include for dbusmenu-gtk --- libdbusmenu-gtk/Makefile.am | 1 + libdbusmenu-gtk/dbusmenu-gtk.h | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 libdbusmenu-gtk/dbusmenu-gtk.h diff --git a/libdbusmenu-gtk/Makefile.am b/libdbusmenu-gtk/Makefile.am index b8e1170..e5df6b1 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 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 + +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 + +*/ + +#ifndef __DBUSMENU_GTK_H__ +#define __DBUSMENU_GTK_H__ + +/* Start with the glib stuff */ +#include + +/* Now get the GTK stuff */ +#include +#include +#include + +#endif /* __DBUSMENU_GLIB_H__ */ -- cgit v1.2.3 From 30063701c33d46754ac528f35c70bed08cd11cd3 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 21 Jan 2011 10:38:05 -0600 Subject: Add an include directory for the headers --- libdbusmenu-glib/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libdbusmenu-glib/Makefile.am b/libdbusmenu-glib/Makefile.am index 7dd69de..a139f7c 100644 --- a/libdbusmenu-glib/Makefile.am +++ b/libdbusmenu-glib/Makefile.am @@ -141,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 -- cgit v1.2.3