From 46cf6414f55a027f0eaf3b85701479fb5fe12441 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 24 Sep 2010 14:38:24 -0500 Subject: Making sure to reference the accel group --- libdbusmenu-gtk/client.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libdbusmenu-gtk/client.c b/libdbusmenu-gtk/client.c index 6970d59..0f8592c 100644 --- a/libdbusmenu-gtk/client.c +++ b/libdbusmenu-gtk/client.c @@ -249,6 +249,7 @@ dbusmenu_gtkclient_set_accel_group (DbusmenuGtkClient * client, GtkAccelGroup * } priv->agroup = agroup; + g_object_ref(priv->agroup); return; } -- cgit v1.2.3 From bcf8f4955ec6f6fce426a71fddb5c28bcc7dd804 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 13 Oct 2010 16:05:17 -0500 Subject: Dropping dbus-glib from the build requirements --- configure.ac | 3 --- 1 file changed, 3 deletions(-) diff --git a/configure.ac b/configure.ac index 23680b7..c8d18b1 100644 --- a/configure.ac +++ b/configure.ac @@ -33,11 +33,9 @@ GNOME_DOC_INIT ########################### GLIB_REQUIRED_VERSION=2.18 -DBUS_REQUIRED_VERSION=0.76 XML_REQUIRED_VERSION=2.6 PKG_CHECK_MODULES(DBUSMENUGLIB, glib-2.0 >= $GLIB_REQUIRED_VERSION - dbus-glib-1 >= $DBUS_REQUIRED_VERSION libxml-2.0 >= $XML_REQUIRED_VERSION) AC_SUBST(DBUSMENUGLIB_CFLAGS) @@ -51,7 +49,6 @@ GTK_REQUIRED_VERSION=2.16 PKG_CHECK_MODULES(DBUSMENUGTK, gtk+-2.0 >= $GTK_REQUIRED_VERSION glib-2.0 >= $GLIB_REQUIRED_VERSION - dbus-glib-1 >= $DBUS_REQUIRED_VERSION libxml-2.0 >= $XML_REQUIRED_VERSION) AC_SUBST(DBUSMENUGTK_CFLAGS) -- cgit v1.2.3 From 43ed1f7c65381c84da61998066ef45c89e0ed035 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 13 Oct 2010 16:07:36 -0500 Subject: Dropping the built headers from the build --- libdbusmenu-glib/Makefile.am | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/libdbusmenu-glib/Makefile.am b/libdbusmenu-glib/Makefile.am index 0a6513f..faf0634 100644 --- a/libdbusmenu-glib/Makefile.am +++ b/libdbusmenu-glib/Makefile.am @@ -20,8 +20,6 @@ libdbusmenu_glibinclude_HEADERS = \ client.h libdbusmenu_glib_la_SOURCES = \ - dbusmenu-server.h \ - dbusmenu-client.h \ menuitem.h \ menuitem.c \ menuitem-marshal.h \ @@ -55,8 +53,6 @@ pkgconfig_DATA = dbusmenu-glib.pc pkgconfigdir = $(libdir)/pkgconfig BUILT_SOURCES = \ - dbusmenu-client.h \ - dbusmenu-server.h \ client-marshal.h \ client-marshal.c \ menuitem-marshal.h \ @@ -64,20 +60,6 @@ BUILT_SOURCES = \ server-marshal.h \ server-marshal.c -dbusmenu-server.h: dbus-menu.xml - dbus-binding-tool \ - --prefix=_dbusmenu_server \ - --mode=glib-server \ - --output=dbusmenu-server.h \ - $(srcdir)/dbus-menu.xml - -dbusmenu-client.h: dbus-menu.xml - dbus-binding-tool \ - --prefix=_dbusmenu_client \ - --mode=glib-client \ - --output=dbusmenu-client.h \ - $(srcdir)/dbus-menu.xml - client-marshal.h: $(srcdir)/client-marshal.list glib-genmarshal --header \ --prefix=_dbusmenu_client_marshal $(srcdir)/client-marshal.list \ -- cgit v1.2.3 From 096f22a1b8fb8052e78ede98257556cef332da7a Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 13 Oct 2010 16:54:03 -0500 Subject: Make the XML into something we can include in the source --- libdbusmenu-glib/Makefile.am | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/libdbusmenu-glib/Makefile.am b/libdbusmenu-glib/Makefile.am index faf0634..be70cfa 100644 --- a/libdbusmenu-glib/Makefile.am +++ b/libdbusmenu-glib/Makefile.am @@ -20,6 +20,8 @@ libdbusmenu_glibinclude_HEADERS = \ client.h libdbusmenu_glib_la_SOURCES = \ + dbus-menu.xml.h \ + dbus-menu.xml.c \ menuitem.h \ menuitem.c \ menuitem-marshal.h \ @@ -52,7 +54,18 @@ libdbusmenu_glib_la_LIBADD = \ pkgconfig_DATA = dbusmenu-glib.pc pkgconfigdir = $(libdir)/pkgconfig +%.xml.h: %.xml + echo "extern const char * $(subst -,_,$(subst .,_,$(basename $@)));" > $@ + +%.xml.c: %.xml + echo "const char * $(subst -,_,$(subst .,_,$(basename $@))) = " > $@ + sed -e "s:\":\\\\\":g" -e s:^:\": -e s:\$$:\\\\n\": $< >> $@ + echo ";" >> $@ + + BUILT_SOURCES = \ + dbus-menu.xml.c \ + dbus-menu.xml.h \ client-marshal.h \ client-marshal.c \ menuitem-marshal.h \ @@ -60,6 +73,8 @@ BUILT_SOURCES = \ server-marshal.h \ server-marshal.c +CLEANFILES += $(BUILT_SOURCES) + client-marshal.h: $(srcdir)/client-marshal.list glib-genmarshal --header \ --prefix=_dbusmenu_client_marshal $(srcdir)/client-marshal.list \ -- cgit v1.2.3 From d998c52eb34f2203d6c322528497486f493470a8 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 14 Oct 2010 09:54:58 -0500 Subject: Ignoring our new file friends --- .bzrignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.bzrignore b/.bzrignore index c1088c1..c60cc9c 100644 --- a/.bzrignore +++ b/.bzrignore @@ -194,3 +194,6 @@ libdbusmenu-glib/libdbusmenu_glib_la-client-marshal.lo tests/test-glib-events tests/test-glib-events-client tests/test-glib-events-server +libdbusmenu-glib/dbus-menu.xml.c +libdbusmenu-glib/dbus-menu.xml.h +libdbusmenu-glib/libdbusmenu_glib_la-dbus-menu.xml.lo -- cgit v1.2.3 From f309ec2bb22cda3e2f763f96bb6a08652d9373d8 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 14 Oct 2010 10:55:58 -0500 Subject: Changing the way the static interface information is generated --- libdbusmenu-glib/server.c | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c index c5cf2fe..bbccd73 100644 --- a/libdbusmenu-glib/server.c +++ b/libdbusmenu-glib/server.c @@ -30,10 +30,14 @@ License version 3 and version 2.1 along with this program. If not, see #include "config.h" #endif +#include + #include "menuitem-private.h" #include "server.h" #include "server-marshal.h" +#include "dbus-menu.xml.h" + /* DBus Prototypes */ static gboolean _dbusmenu_server_get_layout (DbusmenuServer * server, gint parent, guint * revision, gchar ** layout, GError ** error); static gboolean _dbusmenu_server_get_property (DbusmenuServer * server, gint id, gchar * property, gchar ** value, GError ** error); @@ -46,8 +50,6 @@ static gboolean _dbusmenu_server_about_to_show (DbusmenuServer * server, gint id static void _gvalue_array_append_int(GValueArray *array, gint i); static void _gvalue_array_append_hashtable(GValueArray *array, GHashTable * dict); -#include "dbusmenu-server.h" - static void layout_update_signal (DbusmenuServer * server); #define DBUSMENU_VERSION_NUMBER 2 @@ -91,6 +93,10 @@ enum { LAST_ERROR }; +/* Globals */ +static GDBusNodeInfo * dbusmenu_node_info = NULL; +static GDBusInterfaceInfo * dbusmenu_interface_info = NULL; + /* Prototype */ static void dbusmenu_server_class_init (DbusmenuServerClass *class); static void dbusmenu_server_init (DbusmenuServer *self); @@ -203,7 +209,23 @@ dbusmenu_server_class_init (DbusmenuServerClass *class) DBUSMENU_VERSION_NUMBER, DBUSMENU_VERSION_NUMBER, DBUSMENU_VERSION_NUMBER, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); - dbus_g_object_type_install_info(DBUSMENU_TYPE_SERVER, &dbus_glib__dbusmenu_server_object_info); + if (dbusmenu_node_info == NULL) { + GError * error = NULL; + + dbusmenu_node_info = g_dbus_node_info_new_for_xml(dbus_menu_xml, &error); + if (error != NULL) { + g_error("Unable to parse DBusmenu Interface description: %s", error->message); + g_error_free(error); + } + } + + if (dbusmenu_interface_info == NULL) { + dbusmenu_interface_info = g_dbus_node_info_lookup_interface(dbusmenu_node_info, "org.ayatana.dbusmenu"); + + if (dbusmenu_interface_info == NULL) { + g_error("Unable to find interface 'org.ayatana.dbusmenu'"); + } + } return; } -- cgit v1.2.3 From 23b8623959467e965c83b8bd6458575c0eca34cb Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 14 Oct 2010 11:17:23 -0500 Subject: Setting up the private variables that we're going to do need to set this stuff up --- libdbusmenu-glib/server.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c index bbccd73..6f5d45c 100644 --- a/libdbusmenu-glib/server.c +++ b/libdbusmenu-glib/server.c @@ -61,6 +61,10 @@ struct _DbusmenuServerPrivate gchar * dbusobject; gint layout_revision; guint layout_idle; + + GDBusConnection * bus; + GCancellable * bus_lookup; + guint dbus_registration; }; #define DBUSMENU_SERVER_GET_PRIVATE(o) (DBUSMENU_SERVER(o)->priv) @@ -241,6 +245,9 @@ dbusmenu_server_init (DbusmenuServer *self) priv->dbusobject = NULL; priv->layout_revision = 1; priv->layout_idle = 0; + priv->bus = NULL; + priv->bus_lookup = NULL; + priv->dbus_registration = 0; return; } @@ -259,6 +266,27 @@ dbusmenu_server_dispose (GObject *object) g_object_unref(priv->root); } + if (priv->dbus_registration != 0) { + g_dbus_connection_unregister_object(priv->bus, priv->dbus_registration); + priv->dbus_registration = 0; + } + + if (priv->bus != NULL) { + g_object_unref(priv->bus); + priv->bus = NULL; + } + + if (priv->bus_lookup != NULL) { + if (!g_cancellable_is_cancelled(priv->bus_lookup)) { + /* Note, this may case the async function to run at + some point in the future. That's okay, it'll get an + error, but just FYI */ + g_cancellable_cancel(priv->bus_lookup); + } + g_object_unref(priv->bus_lookup); + priv->bus_lookup = NULL; + } + G_OBJECT_CLASS (dbusmenu_server_parent_class)->dispose (object); return; } -- cgit v1.2.3 From a797369ae885c2df81620b90ce6eaa2a9de1de87 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 14 Oct 2010 11:47:18 -0500 Subject: Changing the registration of the object on the bus --- libdbusmenu-glib/server.c | 87 +++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 77 insertions(+), 10 deletions(-) diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c index 6f5d45c..5729128 100644 --- a/libdbusmenu-glib/server.c +++ b/libdbusmenu-glib/server.c @@ -98,8 +98,9 @@ enum { }; /* Globals */ -static GDBusNodeInfo * dbusmenu_node_info = NULL; -static GDBusInterfaceInfo * dbusmenu_interface_info = NULL; +static GDBusNodeInfo * dbusmenu_node_info = NULL; +static GDBusInterfaceInfo * dbusmenu_interface_info = NULL; +static const GDBusInterfaceVTable dbusmenu_interface_table = {0}; /* Prototype */ static void dbusmenu_server_class_init (DbusmenuServerClass *class); @@ -108,6 +109,8 @@ static void dbusmenu_server_dispose (GObject *object); static void dbusmenu_server_finalize (GObject *object); static void set_property (GObject * obj, guint id, const GValue * value, GParamSpec * pspec); static void get_property (GObject * obj, guint id, GValue * value, GParamSpec * pspec); +static void register_object (DbusmenuServer * server); +static void bus_got_cb (GObject * obj, GAsyncResult * result, gpointer user_data); static void menuitem_property_changed (DbusmenuMenuitem * mi, gchar * property, GValue * value, DbusmenuServer * server); static void menuitem_child_added (DbusmenuMenuitem * parent, DbusmenuMenuitem * child, guint pos, DbusmenuServer * server); static void menuitem_child_removed (DbusmenuMenuitem * parent, DbusmenuMenuitem * child, DbusmenuServer * server); @@ -302,21 +305,21 @@ static void set_property (GObject * obj, guint id, const GValue * value, GParamSpec * pspec) { DbusmenuServerPrivate * priv = DBUSMENU_SERVER_GET_PRIVATE(obj); - GError * error = NULL; switch (id) { case PROP_DBUS_OBJECT: g_return_if_fail(priv->dbusobject == NULL); priv->dbusobject = g_value_dup_string(value); - DBusGConnection * connection = dbus_g_bus_get(DBUS_BUS_SESSION, &error); - if (connection == NULL || error != NULL) { - g_warning("Unable to get session bus: %s", error == NULL ? "No message" : error->message); - if (error != NULL) { g_error_free(error); } + if (priv->bus == NULL) { + if (priv->bus_lookup == NULL) { + priv->bus_lookup = g_cancellable_new(); + g_return_if_fail(priv->bus_lookup != NULL); + } + + g_bus_get(G_BUS_TYPE_SESSION, priv->bus_lookup, bus_got_cb, obj); } else { - dbus_g_connection_register_g_object(connection, - priv->dbusobject, - obj); + register_object(DBUSMENU_SERVER(obj)); } break; case PROP_ROOT_NODE: @@ -378,6 +381,70 @@ get_property (GObject * obj, guint id, GValue * value, GParamSpec * pspec) return; } +/* Register the object on the dbus bus */ +static void +register_object (DbusmenuServer * server) +{ + DbusmenuServerPrivate * priv = DBUSMENU_SERVER_GET_PRIVATE(server); + + /* Object info */ + g_return_if_fail(priv->bus != NULL); + g_return_if_fail(priv->dbusobject != NULL); + + /* Class info */ + g_return_if_fail(dbusmenu_node_info != NULL); + g_return_if_fail(dbusmenu_interface_info != NULL); + + /* We might block on this in the future, but it'd be nice if + we could change the object path. Thinking about it... */ + if (priv->dbus_registration != 0) { + g_dbus_connection_unregister_object(priv->bus, priv->dbus_registration); + priv->dbus_registration = 0; + } + + GError * error = NULL; + priv->dbus_registration = g_dbus_connection_register_object(priv->bus, + priv->dbusobject, + dbusmenu_interface_info, + &dbusmenu_interface_table, + server, + NULL, + &error); + + if (error != NULL) { + g_warning("Unable to register object on bus: %s", error->message); + g_error_free(error); + } + + return; +} + +/* Callback from asking GIO to get us the session bus */ +static void +bus_got_cb (GObject * obj, GAsyncResult * result, gpointer user_data) +{ + GError * error = NULL; + + GDBusConnection * bus = g_bus_get_finish(result, &error); + + if (error != NULL) { + g_warning("Unable to get session bus: %s", error->message); + g_error_free(error); + return; + } + + /* Note: We're not using the user_data before we check for + the error so that in the cancelled case at destruction of + the object we don't end up with an invalid object. */ + + DbusmenuServerPrivate * priv = DBUSMENU_SERVER_GET_PRIVATE(user_data); + priv->bus = bus; + + register_object(DBUSMENU_SERVER(user_data)); + + return; +} + /* Handle actually signalling in the idle loop. This way we collect all the updates. */ static gboolean -- cgit v1.2.3 From 0db52d9f483d8d63024c3dc83d1cb5709c4b3f81 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 14 Oct 2010 11:59:43 -0500 Subject: Moving globals --- libdbusmenu-glib/server.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c index 5729128..3a45f62 100644 --- a/libdbusmenu-glib/server.c +++ b/libdbusmenu-glib/server.c @@ -97,11 +97,6 @@ enum { LAST_ERROR }; -/* Globals */ -static GDBusNodeInfo * dbusmenu_node_info = NULL; -static GDBusInterfaceInfo * dbusmenu_interface_info = NULL; -static const GDBusInterfaceVTable dbusmenu_interface_table = {0}; - /* Prototype */ static void dbusmenu_server_class_init (DbusmenuServerClass *class); static void dbusmenu_server_init (DbusmenuServer *self); @@ -118,6 +113,11 @@ static void menuitem_signals_create (DbusmenuMenuitem * mi, gpointer data); static void menuitem_signals_remove (DbusmenuMenuitem * mi, gpointer data); static GQuark error_quark (void); +/* Globals */ +static GDBusNodeInfo * dbusmenu_node_info = NULL; +static GDBusInterfaceInfo * dbusmenu_interface_info = NULL; +static const GDBusInterfaceVTable dbusmenu_interface_table = {0}; + G_DEFINE_TYPE (DbusmenuServer, dbusmenu_server, G_TYPE_OBJECT); static void -- cgit v1.2.3 From e80a7c4d027837c6d67fd4de52914b32b0bc30d4 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 14 Oct 2010 12:11:41 -0500 Subject: Filling out the vtable --- libdbusmenu-glib/server.c | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c index 3a45f62..df57994 100644 --- a/libdbusmenu-glib/server.c +++ b/libdbusmenu-glib/server.c @@ -106,6 +106,21 @@ static void set_property (GObject * obj, guint id, const GValue * value, GParamS static void get_property (GObject * obj, guint id, GValue * value, GParamSpec * pspec); static void register_object (DbusmenuServer * server); static void bus_got_cb (GObject * obj, GAsyncResult * result, gpointer user_data); +static void bus_method_call (GDBusConnection * connection, + const gchar * sender, + const gchar * path, + const gchar * interface, + const gchar * method, + GVariant * params, + GDBusMethodInvocation * invocation, + gpointer user_data); +static GVariant * bus_get_prop (GDBusConnection * connection, + const gchar * sender, + const gchar * path, + const gchar * interface, + const gchar * property, + GError ** error, + gpointer user_data); static void menuitem_property_changed (DbusmenuMenuitem * mi, gchar * property, GValue * value, DbusmenuServer * server); static void menuitem_child_added (DbusmenuMenuitem * parent, DbusmenuMenuitem * child, guint pos, DbusmenuServer * server); static void menuitem_child_removed (DbusmenuMenuitem * parent, DbusmenuMenuitem * child, DbusmenuServer * server); @@ -116,7 +131,11 @@ static GQuark error_quark (void); /* Globals */ static GDBusNodeInfo * dbusmenu_node_info = NULL; static GDBusInterfaceInfo * dbusmenu_interface_info = NULL; -static const GDBusInterfaceVTable dbusmenu_interface_table = {0}; +static const GDBusInterfaceVTable dbusmenu_interface_table = { + method_call: bus_method_call, + get_property: bus_get_prop, + set_property: NULL /* No properties that can be set */ +}; G_DEFINE_TYPE (DbusmenuServer, dbusmenu_server, G_TYPE_OBJECT); @@ -445,6 +464,24 @@ bus_got_cb (GObject * obj, GAsyncResult * result, gpointer user_data) return; } +/* Function for the GDBus vtable to handle all method calls and dish + them out the appropriate functions */ +static void +bus_method_call (GDBusConnection * connection, const gchar * sender, const gchar * path, const gchar * interface, const gchar * method, GVariant * params, GDBusMethodInvocation * invocation, gpointer user_data) +{ + + return; +} + +/* For the GDBus vtable but we only have one property so it's pretty + simple. */ +static GVariant * +bus_get_prop (GDBusConnection * connection, const gchar * sender, const gchar * path, const gchar * interface, const gchar * property, GError ** error, gpointer user_data) +{ + + return NULL; +} + /* Handle actually signalling in the idle loop. This way we collect all the updates. */ static gboolean -- cgit v1.2.3 From 53eee1c44b504a06ca72c0f7e3d21d2b69bc6905 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 14 Oct 2010 12:18:08 -0500 Subject: Whitespace --- libdbusmenu-glib/server.c | 46 ++++++++++++++++++++++++++++++++-------------- 1 file changed, 32 insertions(+), 14 deletions(-) diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c index df57994..d7ccaf8 100644 --- a/libdbusmenu-glib/server.c +++ b/libdbusmenu-glib/server.c @@ -98,14 +98,22 @@ enum { }; /* Prototype */ -static void dbusmenu_server_class_init (DbusmenuServerClass *class); -static void dbusmenu_server_init (DbusmenuServer *self); -static void dbusmenu_server_dispose (GObject *object); -static void dbusmenu_server_finalize (GObject *object); -static void set_property (GObject * obj, guint id, const GValue * value, GParamSpec * pspec); -static void get_property (GObject * obj, guint id, GValue * value, GParamSpec * pspec); -static void register_object (DbusmenuServer * server); -static void bus_got_cb (GObject * obj, GAsyncResult * result, gpointer user_data); +static void dbusmenu_server_class_init (DbusmenuServerClass *class); +static void dbusmenu_server_init (DbusmenuServer *self); +static void dbusmenu_server_dispose (GObject *object); +static void dbusmenu_server_finalize (GObject *object); +static void set_property (GObject * obj, + guint id, + const GValue * value, + GParamSpec * pspec); +static void get_property (GObject * obj, + guint id, + GValue * value, + GParamSpec * pspec); +static void register_object (DbusmenuServer * server); +static void bus_got_cb (GObject * obj, + GAsyncResult * result, + gpointer user_data); static void bus_method_call (GDBusConnection * connection, const gchar * sender, const gchar * path, @@ -121,12 +129,22 @@ static GVariant * bus_get_prop (GDBusConnection * connection, const gchar * property, GError ** error, gpointer user_data); -static void menuitem_property_changed (DbusmenuMenuitem * mi, gchar * property, GValue * value, DbusmenuServer * server); -static void menuitem_child_added (DbusmenuMenuitem * parent, DbusmenuMenuitem * child, guint pos, DbusmenuServer * server); -static void menuitem_child_removed (DbusmenuMenuitem * parent, DbusmenuMenuitem * child, DbusmenuServer * server); -static void menuitem_signals_create (DbusmenuMenuitem * mi, gpointer data); -static void menuitem_signals_remove (DbusmenuMenuitem * mi, gpointer data); -static GQuark error_quark (void); +static void menuitem_property_changed (DbusmenuMenuitem * mi, + gchar * property, + GValue * value, + DbusmenuServer * server); +static void menuitem_child_added (DbusmenuMenuitem * parent, + DbusmenuMenuitem * child, + guint pos, + DbusmenuServer * server); +static void menuitem_child_removed (DbusmenuMenuitem * parent, + DbusmenuMenuitem * child, + DbusmenuServer * server); +static void menuitem_signals_create (DbusmenuMenuitem * mi, + gpointer data); +static void menuitem_signals_remove (DbusmenuMenuitem * mi, + gpointer data); +static GQuark error_quark (void); /* Globals */ static GDBusNodeInfo * dbusmenu_node_info = NULL; -- cgit v1.2.3 From 9b7061a33a014f2b83d970698b31ff5e0e33e129 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 14 Oct 2010 12:20:29 -0500 Subject: Moving the interface name into a define --- libdbusmenu-glib/server.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c index d7ccaf8..aabad9a 100644 --- a/libdbusmenu-glib/server.c +++ b/libdbusmenu-glib/server.c @@ -52,7 +52,8 @@ static void _gvalue_array_append_hashtable(GValueArray *array, GHashTable * dict static void layout_update_signal (DbusmenuServer * server); -#define DBUSMENU_VERSION_NUMBER 2 +#define DBUSMENU_VERSION_NUMBER 2 +#define DBUSMENU_INTERFACE "org.ayatana.dbusmenu" /* Privates, I'll show you mine... */ struct _DbusmenuServerPrivate @@ -264,10 +265,10 @@ dbusmenu_server_class_init (DbusmenuServerClass *class) } if (dbusmenu_interface_info == NULL) { - dbusmenu_interface_info = g_dbus_node_info_lookup_interface(dbusmenu_node_info, "org.ayatana.dbusmenu"); + dbusmenu_interface_info = g_dbus_node_info_lookup_interface(dbusmenu_node_info, DBUSMENU_INTERFACE); if (dbusmenu_interface_info == NULL) { - g_error("Unable to find interface 'org.ayatana.dbusmenu'"); + g_error("Unable to find interface '" DBUSMENU_INTERFACE "'"); } } -- cgit v1.2.3 From 1f98fff4723354444fe41fe3492b4a1681fdef14 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 14 Oct 2010 12:27:33 -0500 Subject: Fleshing out the property get function --- 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 aabad9a..7a1b98e 100644 --- a/libdbusmenu-glib/server.c +++ b/libdbusmenu-glib/server.c @@ -497,8 +497,14 @@ bus_method_call (GDBusConnection * connection, const gchar * sender, const gchar static GVariant * bus_get_prop (GDBusConnection * connection, const gchar * sender, const gchar * path, const gchar * interface, const gchar * property, GError ** error, gpointer user_data) { + DbusmenuServerPrivate * priv = DBUSMENU_SERVER_GET_PRIVATE(user_data); + + /* None of these should happen */ + g_return_val_if_fail(g_strcmp0(interface, DBUSMENU_INTERFACE) == 0, NULL); + g_return_val_if_fail(g_strcmp0(path, priv->dbusobject) == 0, NULL); + g_return_val_if_fail(g_strcmp0(property, "version") == 0, NULL); - return NULL; + return g_variant_new_uint32(DBUSMENU_VERSION_NUMBER); } /* Handle actually signalling in the idle loop. This way we collect all -- cgit v1.2.3 From 2cc94b5a4b7016d8bf01eec34b6ff7e771d8e682 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 14 Oct 2010 13:42:38 -0500 Subject: Setting up a method table for the dbus interface --- libdbusmenu-glib/server.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c index 7a1b98e..ddf242f 100644 --- a/libdbusmenu-glib/server.c +++ b/libdbusmenu-glib/server.c @@ -98,6 +98,21 @@ enum { LAST_ERROR }; +/* Method Table */ +typedef void (*MethodTableFunc) (DbusmenuServer * server, GVariant * params, GDBusMethodInvocation * invocation); + +typedef struct _method_table_t method_table_t; +struct _method_table_t { + const gchar * interned_name; + MethodTableFunc func; +}; + +enum { + METHOD_GET_LAYOUT = 0, + /* Counter, do not remove! */ + METHOD_COUNT +}; + /* Prototype */ static void dbusmenu_server_class_init (DbusmenuServerClass *class); static void dbusmenu_server_init (DbusmenuServer *self); @@ -155,6 +170,7 @@ static const GDBusInterfaceVTable dbusmenu_interface_table = { get_property: bus_get_prop, set_property: NULL /* No properties that can be set */ }; +static method_table_t dbusmenu_method_table[METHOD_COUNT]; G_DEFINE_TYPE (DbusmenuServer, dbusmenu_server, G_TYPE_OBJECT); @@ -272,6 +288,10 @@ dbusmenu_server_class_init (DbusmenuServerClass *class) } } + /* Building our Method table :( */ + dbusmenu_method_table[METHOD_GET_LAYOUT].interned_name = g_intern_static_string("GetLayout"); + dbusmenu_method_table[METHOD_GET_LAYOUT].func = NULL; + return; } -- cgit v1.2.3 From e170f6516419cf403931916ac9f6a4b3a0b1997c Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 14 Oct 2010 13:43:09 -0500 Subject: Fleshing out the method call function to use the table --- libdbusmenu-glib/server.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c index ddf242f..493bbdf 100644 --- a/libdbusmenu-glib/server.c +++ b/libdbusmenu-glib/server.c @@ -508,7 +508,27 @@ bus_got_cb (GObject * obj, GAsyncResult * result, gpointer user_data) static void bus_method_call (GDBusConnection * connection, const gchar * sender, const gchar * path, const gchar * interface, const gchar * method, GVariant * params, GDBusMethodInvocation * invocation, gpointer user_data) { + int i; + const gchar * interned_method = g_intern_string(method); + + for (i = 0; i < METHOD_COUNT; i++) { + if (dbusmenu_method_table[i].interned_name == interned_method) { + if (dbusmenu_method_table[i].func != NULL) { + return dbusmenu_method_table[i].func(DBUSMENU_SERVER(user_data), params, invocation); + } else { + /* If we have a null function we're responding but nothing else. */ + g_dbus_method_invocation_return_value(invocation, NULL); + return; + } + } + } + /* We're here because there's an error */ + g_dbus_method_invocation_return_error(invocation, + error_quark(), + NOT_IMPLEMENTED, + "Unable to find method '%s'", + method); return; } -- cgit v1.2.3 From a7ec487bdcf1383fc5ccbd69af543b1f6f93fd1a Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 14 Oct 2010 13:54:49 -0500 Subject: Porting over GetLayout --- libdbusmenu-glib/server.c | 40 +++++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c index 493bbdf..cc0d0b3 100644 --- a/libdbusmenu-glib/server.c +++ b/libdbusmenu-glib/server.c @@ -39,7 +39,6 @@ License version 3 and version 2.1 along with this program. If not, see #include "dbus-menu.xml.h" /* DBus Prototypes */ -static gboolean _dbusmenu_server_get_layout (DbusmenuServer * server, gint parent, guint * revision, gchar ** layout, GError ** error); static gboolean _dbusmenu_server_get_property (DbusmenuServer * server, gint id, gchar * property, gchar ** value, GError ** error); static gboolean _dbusmenu_server_get_properties (DbusmenuServer * server, gint id, gchar ** properties, GHashTable ** dict, GError ** error); static gboolean _dbusmenu_server_get_group_properties (DbusmenuServer * server, GArray * ids, gchar ** properties, GPtrArray ** values, GError ** error); @@ -161,6 +160,9 @@ static void menuitem_signals_create (DbusmenuMenuitem * mi, static void menuitem_signals_remove (DbusmenuMenuitem * mi, gpointer data); static GQuark error_quark (void); +static void bus_get_layout (DbusmenuServer * server, + GVariant * params, + GDBusMethodInvocation * invocation); /* Globals */ static GDBusNodeInfo * dbusmenu_node_info = NULL; @@ -290,7 +292,7 @@ dbusmenu_server_class_init (DbusmenuServerClass *class) /* Building our Method table :( */ dbusmenu_method_table[METHOD_GET_LAYOUT].interned_name = g_intern_static_string("GetLayout"); - dbusmenu_method_table[METHOD_GET_LAYOUT].func = NULL; + dbusmenu_method_table[METHOD_GET_LAYOUT].func = bus_get_layout; return; } @@ -670,12 +672,15 @@ error_quark (void) } /* DBus interface */ -static gboolean -_dbusmenu_server_get_layout (DbusmenuServer * server, gint parent, guint * revision, gchar ** layout, GError ** error) +static void +bus_get_layout (DbusmenuServer * server, GVariant * params, GDBusMethodInvocation * invocation) { DbusmenuServerPrivate * priv = DBUSMENU_SERVER_GET_PRIVATE(server); - *revision = priv->layout_revision; + gint parent = 0; + g_variant_get(params, "(i)", &parent); + + guint revision = priv->layout_revision; GPtrArray * xmlarray = g_ptr_array_new(); if (parent == 0) { @@ -688,26 +693,31 @@ _dbusmenu_server_get_layout (DbusmenuServer * server, gint parent, guint * revis } else { DbusmenuMenuitem * item = dbusmenu_menuitem_find_id(priv->root, parent); if (item == NULL) { - if (error != NULL) { - g_set_error(error, - error_quark(), - INVALID_MENUITEM_ID, - "The ID supplied %d does not refer to a menu item we have", - parent); - } - return FALSE; + g_dbus_method_invocation_return_error(invocation, + error_quark(), + INVALID_MENUITEM_ID, + "The ID supplied %d does not refer to a menu item we have", + parent); + return; } dbusmenu_menuitem_buildxml(item, xmlarray); } g_ptr_array_add(xmlarray, NULL); /* build string */ - *layout = g_strjoinv("", (gchar **)xmlarray->pdata); + gchar * layout = g_strjoinv("", (gchar **)xmlarray->pdata); g_ptr_array_foreach(xmlarray, xmlarray_foreach_free, NULL); g_ptr_array_free(xmlarray, TRUE); - return TRUE; + g_dbus_method_invocation_return_value(invocation, + g_variant_new("(us)", + revision, + layout)); + + g_free(layout); + + return; } static gboolean -- cgit v1.2.3 From 92942cc10074b24d7e0c13e76754ab149c27b923 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 14 Oct 2010 16:00:38 -0500 Subject: Adding a helper function to get the menuitem properties as a variant --- libdbusmenu-glib/menuitem-private.h | 1 + libdbusmenu-glib/menuitem.c | 44 +++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/libdbusmenu-glib/menuitem-private.h b/libdbusmenu-glib/menuitem-private.h index 3a0c026..2028464 100644 --- a/libdbusmenu-glib/menuitem-private.h +++ b/libdbusmenu-glib/menuitem-private.h @@ -36,6 +36,7 @@ G_BEGIN_DECLS void dbusmenu_menuitem_buildxml (DbusmenuMenuitem * mi, GPtrArray * array); gboolean dbusmenu_menuitem_realized (DbusmenuMenuitem * mi); void dbusmenu_menuitem_set_realized (DbusmenuMenuitem * mi); +GVariant * dbusmenu_menuitem_properties_variant (DbusmenuMenuitem * mi); G_END_DECLS diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index 73b765b..5e700a5 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -1220,6 +1220,50 @@ dbusmenu_menuitem_properties_copy (DbusmenuMenuitem * mi) return ret; } +/* Looks at each value in the hashtable and tries to convert it + into a variant and add it to our variant builder */ +static void +variant_helper (gpointer in_key, gpointer in_value, gpointer user_data) +{ + GValue vval = {0}; + g_value_init(&vval, G_TYPE_VARIANT); + + if (!g_value_transform((GValue *)in_value, &vval)) { + g_warning("Unable to convert property '%s' of type '%s'", (gchar *)in_key, G_VALUE_TYPE_NAME(in_value)); + return; + } + + g_variant_builder_add((GVariantBuilder *)user_data, "{sv}", in_key, g_value_get_variant(&vval)); + g_value_unset(&vval); + + return; +} + +/** + dbusmenu_menuitem_properties_variant: + @mi: #DbusmenuMenuitem to get properties from + + Grabs the properties of the menuitem as a GVariant with the + type "a{sv}". + + Return Value: A GVariant of type "a{sv}" or NULL on error. +*/ +GVariant * +dbusmenu_menuitem_properties_variant (DbusmenuMenuitem * mi) +{ + g_return_val_if_fail(DBUSMENU_IS_MENUITEM(mi), NULL); + + DbusmenuMenuitemPrivate * priv = DBUSMENU_MENUITEM_GET_PRIVATE(mi); + + GVariantBuilder * builder = g_variant_builder_new(G_VARIANT_TYPE("a{sv}")); + + g_hash_table_foreach(priv->properties, variant_helper, builder); + + GVariant * final_variant = g_variant_builder_end(builder); + g_variant_builder_unref(builder); + return final_variant; +} + /** dbusmenu_menuitem_set_root: @mi: #DbusmenuMenuitem to set whether it's root -- cgit v1.2.3 From d11d10ce3d399be36d889d386a3a88a8487ca4fd Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 14 Oct 2010 16:17:19 -0500 Subject: Implement the get_properties function --- libdbusmenu-glib/server.c | 47 +++++++++++++++++++++++------------------------ 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c index cc0d0b3..73aa3c2 100644 --- a/libdbusmenu-glib/server.c +++ b/libdbusmenu-glib/server.c @@ -41,7 +41,6 @@ License version 3 and version 2.1 along with this program. If not, see /* DBus Prototypes */ static gboolean _dbusmenu_server_get_property (DbusmenuServer * server, gint id, gchar * property, gchar ** value, GError ** error); static gboolean _dbusmenu_server_get_properties (DbusmenuServer * server, gint id, gchar ** properties, GHashTable ** dict, GError ** error); -static gboolean _dbusmenu_server_get_group_properties (DbusmenuServer * server, GArray * ids, gchar ** properties, GPtrArray ** values, GError ** error); static gboolean _dbusmenu_server_event (DbusmenuServer * server, gint id, gchar * eventid, GValue * data, guint timestamp, GError ** error); static gboolean _dbusmenu_server_get_children (DbusmenuServer * server, gint id, GPtrArray * properties, GPtrArray ** output, GError ** error); static gboolean _dbusmenu_server_about_to_show (DbusmenuServer * server, gint id, gboolean * need_update, GError ** error); @@ -108,6 +107,7 @@ struct _method_table_t { enum { METHOD_GET_LAYOUT = 0, + METHOD_GET_GROUP_PROPERTIES, /* Counter, do not remove! */ METHOD_COUNT }; @@ -163,6 +163,9 @@ static GQuark error_quark (void); static void bus_get_layout (DbusmenuServer * server, GVariant * params, GDBusMethodInvocation * invocation); +static void bus_get_group_properties (DbusmenuServer * server, + GVariant * params, + GDBusMethodInvocation * invocation); /* Globals */ static GDBusNodeInfo * dbusmenu_node_info = NULL; @@ -294,6 +297,9 @@ dbusmenu_server_class_init (DbusmenuServerClass *class) dbusmenu_method_table[METHOD_GET_LAYOUT].interned_name = g_intern_static_string("GetLayout"); dbusmenu_method_table[METHOD_GET_LAYOUT].func = bus_get_layout; + dbusmenu_method_table[METHOD_GET_GROUP_PROPERTIES].interned_name = g_intern_static_string("GetGroupProperties"); + dbusmenu_method_table[METHOD_GET_GROUP_PROPERTIES].func = bus_get_group_properties; + return; } @@ -789,36 +795,29 @@ _dbusmenu_server_get_properties (DbusmenuServer * server, gint id, gchar ** prop /* Handles getting a bunch of properties from a variety of menu items to make one mega dbus message */ -static gboolean -_dbusmenu_server_get_group_properties (DbusmenuServer * server, GArray * ids, gchar ** properties, GPtrArray ** values, GError ** error) +static void +bus_get_group_properties (DbusmenuServer * server, GVariant * params, GDBusMethodInvocation * invocation) { - /* Build an initial pointer array */ - *values = g_ptr_array_new(); + DbusmenuServerPrivate * priv = DBUSMENU_SERVER_GET_PRIVATE(server); + GVariantIter * ids = NULL; + g_variant_get_child(params, 0, "ai", &ids); - /* Go through each ID to get that ID's properties */ - int idcnt; - for (idcnt = 0; idcnt < ids->len; idcnt++) { - GHashTable * idprops = NULL; - GError * error = NULL; - gint id = g_array_index(ids, int, idcnt); + GVariantBuilder * builder = g_variant_builder_new(G_VARIANT_TYPE("a(ia{sv})")); - /* Get the properties for this ID the old fashioned way. */ - if (!_dbusmenu_server_get_properties(server, id, properties, &idprops, &error)) { - g_warning("Error getting the properties from ID %d: %s", id, error->message); - g_error_free(error); - error = NULL; - continue; - } + GVariant * id; + while ((id = g_variant_iter_next_value(ids)) != NULL) { + DbusmenuMenuitem * mi = dbusmenu_menuitem_find_id(priv->root, g_variant_get_int32(id)); + if (mi == NULL) continue; - GValueArray * valarray = g_value_array_new(2); + g_variant_builder_add(builder, "ia{sv}", g_variant_get_int32(id), dbusmenu_menuitem_properties_variant(mi)); + } - _gvalue_array_append_int(valarray, id); - _gvalue_array_append_hashtable(valarray, idprops); + GVariant * ret = g_variant_builder_end(builder); + g_variant_builder_unref(builder); - g_ptr_array_add(*values, valarray); - } + g_dbus_method_invocation_return_value(invocation, ret); - return TRUE; + return; } /* Allocate a value on the stack for the int and append -- cgit v1.2.3 From 1487c6bc178268b128982b40fa8d4a315dc3c72a Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 14 Oct 2010 16:31:14 -0500 Subject: Converting over GetChildren --- libdbusmenu-glib/server.c | 83 ++++++++++++++++++----------------------------- 1 file changed, 31 insertions(+), 52 deletions(-) diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c index 73aa3c2..f3fb197 100644 --- a/libdbusmenu-glib/server.c +++ b/libdbusmenu-glib/server.c @@ -42,11 +42,7 @@ License version 3 and version 2.1 along with this program. If not, see static gboolean _dbusmenu_server_get_property (DbusmenuServer * server, gint id, gchar * property, gchar ** value, GError ** error); static gboolean _dbusmenu_server_get_properties (DbusmenuServer * server, gint id, gchar ** properties, GHashTable ** dict, GError ** error); static gboolean _dbusmenu_server_event (DbusmenuServer * server, gint id, gchar * eventid, GValue * data, guint timestamp, GError ** error); -static gboolean _dbusmenu_server_get_children (DbusmenuServer * server, gint id, GPtrArray * properties, GPtrArray ** output, GError ** error); static gboolean _dbusmenu_server_about_to_show (DbusmenuServer * server, gint id, gboolean * need_update, GError ** error); -/* DBus Helpers */ -static void _gvalue_array_append_int(GValueArray *array, gint i); -static void _gvalue_array_append_hashtable(GValueArray *array, GHashTable * dict); static void layout_update_signal (DbusmenuServer * server); @@ -108,6 +104,7 @@ struct _method_table_t { enum { METHOD_GET_LAYOUT = 0, METHOD_GET_GROUP_PROPERTIES, + METHOD_GET_CHILDREN, /* Counter, do not remove! */ METHOD_COUNT }; @@ -166,6 +163,9 @@ static void bus_get_layout (DbusmenuServer * server, static void bus_get_group_properties (DbusmenuServer * server, GVariant * params, GDBusMethodInvocation * invocation); +static void bus_get_children (DbusmenuServer * server, + GVariant * params, + GDBusMethodInvocation * invocation); /* Globals */ static GDBusNodeInfo * dbusmenu_node_info = NULL; @@ -300,6 +300,9 @@ dbusmenu_server_class_init (DbusmenuServerClass *class) dbusmenu_method_table[METHOD_GET_GROUP_PROPERTIES].interned_name = g_intern_static_string("GetGroupProperties"); dbusmenu_method_table[METHOD_GET_GROUP_PROPERTIES].func = bus_get_group_properties; + dbusmenu_method_table[METHOD_GET_CHILDREN].interned_name = g_intern_static_string("GetChildren"); + dbusmenu_method_table[METHOD_GET_CHILDREN].func = bus_get_children; + return; } @@ -820,74 +823,50 @@ bus_get_group_properties (DbusmenuServer * server, GVariant * params, GDBusMetho return; } -/* Allocate a value on the stack for the int and append - it to the array. */ -static void -_gvalue_array_append_int(GValueArray *array, gint i) -{ - GValue value = {0}; - - g_value_init(&value, G_TYPE_INT); - g_value_set_int(&value, i); - g_value_array_append(array, &value); - g_value_unset(&value); -} - -/* Allocate a value on the stack for the hashtable and append - it to the array. */ -static void -_gvalue_array_append_hashtable(GValueArray *array, GHashTable * dict) -{ - GValue value = {0}; - - g_value_init(&value, dbus_g_type_get_map("GHashTable", G_TYPE_STRING, G_TYPE_VALUE)); - g_value_set_boxed(&value, dict); - g_value_array_append(array, &value); - g_value_unset(&value); -} - +/* Turn a menuitem into an variant and attach it to the + VariantBuilder we passed in */ static void serialize_menuitem(gpointer data, gpointer user_data) { DbusmenuMenuitem * mi = DBUSMENU_MENUITEM(data); - GPtrArray * output = (GPtrArray *)(user_data); + GVariantBuilder * builder = (GVariantBuilder *)(user_data); gint id = dbusmenu_menuitem_get_id(mi); - GHashTable * dict = dbusmenu_menuitem_properties_copy(mi); + GVariant * props = dbusmenu_menuitem_properties_variant(mi); - GValueArray * item = g_value_array_new(2); - _gvalue_array_append_int(item, id); - _gvalue_array_append_hashtable(item, dict); - - g_ptr_array_add(output, item); - - g_hash_table_unref(dict); + g_variant_builder_add(builder, "ia{sv}", id, props); return; } -static gboolean -_dbusmenu_server_get_children (DbusmenuServer * server, gint id, GPtrArray * properties, GPtrArray ** output, GError ** error) +/* Gets the children and their properties of the ID that is + passed into the function */ +static void +bus_get_children (DbusmenuServer * server, GVariant * params, GDBusMethodInvocation * invocation) { DbusmenuServerPrivate * priv = DBUSMENU_SERVER_GET_PRIVATE(server); + gint id = g_variant_get_int32(g_variant_get_child_value(params, 0)); DbusmenuMenuitem * mi = dbusmenu_menuitem_find_id(priv->root, id); if (mi == NULL) { - if (error != NULL) { - g_set_error(error, - error_quark(), - INVALID_MENUITEM_ID, - "The ID supplied %d does not refer to a menu item we have", - id); - } - return FALSE; + g_dbus_method_invocation_return_error(invocation, + error_quark(), + INVALID_MENUITEM_ID, + "The ID supplied %d does not refer to a menu item we have", + id); + return; } - *output = g_ptr_array_new(); + GVariantBuilder * builder = g_variant_builder_new(G_VARIANT_TYPE("a(ia{sv})")); + GList * children = dbusmenu_menuitem_get_children(mi); - g_list_foreach(children, serialize_menuitem, *output); + g_list_foreach(children, serialize_menuitem, builder); - return TRUE; + GVariant * ret = g_variant_builder_end(builder); + g_variant_builder_unref(builder); + + g_dbus_method_invocation_return_value(invocation, ret); + return; } /* Structure for holding the event data for the idle function -- cgit v1.2.3 From 966d397a36971552609e24bb8071fdb69c4c279a Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 14 Oct 2010 16:49:47 -0500 Subject: Coverting GetProperty --- libdbusmenu-glib/server.c | 49 ++++++++++++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 22 deletions(-) diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c index f3fb197..e83015a 100644 --- a/libdbusmenu-glib/server.c +++ b/libdbusmenu-glib/server.c @@ -39,7 +39,6 @@ License version 3 and version 2.1 along with this program. If not, see #include "dbus-menu.xml.h" /* DBus Prototypes */ -static gboolean _dbusmenu_server_get_property (DbusmenuServer * server, gint id, gchar * property, gchar ** value, GError ** error); static gboolean _dbusmenu_server_get_properties (DbusmenuServer * server, gint id, gchar ** properties, GHashTable ** dict, GError ** error); static gboolean _dbusmenu_server_event (DbusmenuServer * server, gint id, gchar * eventid, GValue * data, guint timestamp, GError ** error); static gboolean _dbusmenu_server_about_to_show (DbusmenuServer * server, gint id, gboolean * need_update, GError ** error); @@ -105,6 +104,7 @@ enum { METHOD_GET_LAYOUT = 0, METHOD_GET_GROUP_PROPERTIES, METHOD_GET_CHILDREN, + METHOD_GET_PROPERTY, /* Counter, do not remove! */ METHOD_COUNT }; @@ -166,6 +166,9 @@ static void bus_get_group_properties (DbusmenuServer * server, static void bus_get_children (DbusmenuServer * server, GVariant * params, GDBusMethodInvocation * invocation); +static void bus_get_property (DbusmenuServer * server, + GVariant * params, + GDBusMethodInvocation * invocation); /* Globals */ static GDBusNodeInfo * dbusmenu_node_info = NULL; @@ -303,6 +306,9 @@ dbusmenu_server_class_init (DbusmenuServerClass *class) dbusmenu_method_table[METHOD_GET_CHILDREN].interned_name = g_intern_static_string("GetChildren"); dbusmenu_method_table[METHOD_GET_CHILDREN].func = bus_get_children; + dbusmenu_method_table[METHOD_GET_PROPERTY].interned_name = g_intern_static_string("GetProperty"); + dbusmenu_method_table[METHOD_GET_PROPERTY].func = bus_get_property; + return; } @@ -729,49 +735,48 @@ bus_get_layout (DbusmenuServer * server, GVariant * params, GDBusMethodInvocatio return; } -static gboolean -_dbusmenu_server_get_property (DbusmenuServer * server, gint id, gchar * property, gchar ** value, GError ** error) +/* Get a single property off of a single menuitem */ +static void +bus_get_property (DbusmenuServer * server, GVariant * params, GDBusMethodInvocation * invocation) { DbusmenuServerPrivate * priv = DBUSMENU_SERVER_GET_PRIVATE(server); + + gint id = g_variant_get_int32(g_variant_get_child_value(params, 0)); + const gchar * property = g_variant_get_string(g_variant_get_child_value(params, 1), NULL); + DbusmenuMenuitem * mi = dbusmenu_menuitem_find_id(priv->root, id); if (mi == NULL) { - if (error != NULL) { - g_set_error(error, + g_dbus_method_invocation_return_error(invocation, error_quark(), INVALID_MENUITEM_ID, "The ID supplied %d does not refer to a menu item we have", id); - } - return FALSE; + return; } - const gchar * prop = dbusmenu_menuitem_property_get(mi, property); + const GValue * prop = dbusmenu_menuitem_property_get_value(mi, property); if (prop == NULL) { - if (error != NULL) { - g_set_error(error, + g_dbus_method_invocation_return_error(invocation, error_quark(), INVALID_PROPERTY_NAME, "The property '%s' does not exist on menuitem with ID of %d", property, id); - } - return FALSE; + return; } - if (value == NULL) { - if (error != NULL) { - g_set_error(error, - error_quark(), - UNKNOWN_DBUS_ERROR, - "Uhm, yeah. We didn't get anywhere to put the value, that's really weird. Seems impossible really."); - } - return FALSE; + GValue vval = {0}; + g_value_init(&vval, G_TYPE_VARIANT); + + if (!g_value_transform(prop, &vval)) { + g_warning("Unable to convert property '%s' value from type '%s' to variant", property, G_VALUE_TYPE_NAME(prop)); } - *value = g_strdup(prop); + g_dbus_method_invocation_return_value(invocation, g_value_get_variant(&vval)); + g_value_unset(&vval); - return TRUE; + return; } static gboolean -- cgit v1.2.3 From abfd276f1d5aa79ebc30d9dccbe4e4d58315c499 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 15 Oct 2010 11:47:09 -0500 Subject: Converting GetProperties --- libdbusmenu-glib/server.c | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c index e83015a..a2d34d5 100644 --- a/libdbusmenu-glib/server.c +++ b/libdbusmenu-glib/server.c @@ -39,7 +39,6 @@ License version 3 and version 2.1 along with this program. If not, see #include "dbus-menu.xml.h" /* DBus Prototypes */ -static gboolean _dbusmenu_server_get_properties (DbusmenuServer * server, gint id, gchar ** properties, GHashTable ** dict, GError ** error); static gboolean _dbusmenu_server_event (DbusmenuServer * server, gint id, gchar * eventid, GValue * data, guint timestamp, GError ** error); static gboolean _dbusmenu_server_about_to_show (DbusmenuServer * server, gint id, gboolean * need_update, GError ** error); @@ -105,6 +104,7 @@ enum { METHOD_GET_GROUP_PROPERTIES, METHOD_GET_CHILDREN, METHOD_GET_PROPERTY, + METHOD_GET_PROPERTIES, /* Counter, do not remove! */ METHOD_COUNT }; @@ -169,6 +169,9 @@ static void bus_get_children (DbusmenuServer * server, static void bus_get_property (DbusmenuServer * server, GVariant * params, GDBusMethodInvocation * invocation); +static void bus_get_properties (DbusmenuServer * server, + GVariant * params, + GDBusMethodInvocation * invocation); /* Globals */ static GDBusNodeInfo * dbusmenu_node_info = NULL; @@ -309,6 +312,9 @@ dbusmenu_server_class_init (DbusmenuServerClass *class) dbusmenu_method_table[METHOD_GET_PROPERTY].interned_name = g_intern_static_string("GetProperty"); dbusmenu_method_table[METHOD_GET_PROPERTY].func = bus_get_property; + dbusmenu_method_table[METHOD_GET_PROPERTIES].interned_name = g_intern_static_string("GetProperties"); + dbusmenu_method_table[METHOD_GET_PROPERTIES].func = bus_get_properties; + return; } @@ -779,26 +785,30 @@ bus_get_property (DbusmenuServer * server, GVariant * params, GDBusMethodInvocat return; } -static gboolean -_dbusmenu_server_get_properties (DbusmenuServer * server, gint id, gchar ** properties, GHashTable ** dict, GError ** error) +/* Get some properties off of a single menuitem */ +static void +bus_get_properties (DbusmenuServer * server, GVariant * params, GDBusMethodInvocation * invocation) { DbusmenuServerPrivate * priv = DBUSMENU_SERVER_GET_PRIVATE(server); + + gint id = g_variant_get_int32(g_variant_get_child_value(params, 0)); + DbusmenuMenuitem * mi = dbusmenu_menuitem_find_id(priv->root, id); if (mi == NULL) { - if (error != NULL) { - g_set_error(error, + g_dbus_method_invocation_return_error(invocation, error_quark(), INVALID_MENUITEM_ID, "The ID supplied %d does not refer to a menu item we have", id); - } - return FALSE; + return; } - *dict = dbusmenu_menuitem_properties_copy(mi); + GVariant * dict = dbusmenu_menuitem_properties_variant(mi); - return TRUE; + g_dbus_method_invocation_return_value(invocation, dict); + + return; } /* Handles getting a bunch of properties from a variety of menu items -- cgit v1.2.3 From 41df5ff0de7c2b9391acf93b58a5f1c803878a05 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 15 Oct 2010 13:41:58 -0500 Subject: Porting over the event function --- libdbusmenu-glib/server.c | 43 ++++++++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c index a2d34d5..2fdc1ef 100644 --- a/libdbusmenu-glib/server.c +++ b/libdbusmenu-glib/server.c @@ -39,7 +39,6 @@ License version 3 and version 2.1 along with this program. If not, see #include "dbus-menu.xml.h" /* DBus Prototypes */ -static gboolean _dbusmenu_server_event (DbusmenuServer * server, gint id, gchar * eventid, GValue * data, guint timestamp, GError ** error); static gboolean _dbusmenu_server_about_to_show (DbusmenuServer * server, gint id, gboolean * need_update, GError ** error); static void layout_update_signal (DbusmenuServer * server); @@ -105,6 +104,7 @@ enum { METHOD_GET_CHILDREN, METHOD_GET_PROPERTY, METHOD_GET_PROPERTIES, + METHOD_EVENT, /* Counter, do not remove! */ METHOD_COUNT }; @@ -172,6 +172,9 @@ static void bus_get_property (DbusmenuServer * server, static void bus_get_properties (DbusmenuServer * server, GVariant * params, GDBusMethodInvocation * invocation); +static void bus_event (DbusmenuServer * server, + GVariant * params, + GDBusMethodInvocation * invocation); /* Globals */ static GDBusNodeInfo * dbusmenu_node_info = NULL; @@ -315,6 +318,9 @@ dbusmenu_server_class_init (DbusmenuServerClass *class) dbusmenu_method_table[METHOD_GET_PROPERTIES].interned_name = g_intern_static_string("GetProperties"); dbusmenu_method_table[METHOD_GET_PROPERTIES].func = bus_get_properties; + dbusmenu_method_table[METHOD_EVENT].interned_name = g_intern_static_string("Event"); + dbusmenu_method_table[METHOD_EVENT].func = bus_event; + return; } @@ -910,34 +916,37 @@ event_local_handler (gpointer user_data) return FALSE; } -/* Handles the even coming off of DBus */ -static gboolean -_dbusmenu_server_event (DbusmenuServer * server, gint id, gchar * eventid, GValue * data, guint timestamp, GError ** error) +/* Handles the events coming off of DBus */ +static void +bus_event (DbusmenuServer * server, GVariant * params, GDBusMethodInvocation * invocation) { DbusmenuServerPrivate * priv = DBUSMENU_SERVER_GET_PRIVATE(server); + gint id = g_variant_get_int32(g_variant_get_child_value(params, 0)); DbusmenuMenuitem * mi = dbusmenu_menuitem_find_id(priv->root, id); if (mi == NULL) { - if (error != NULL) { - g_set_error(error, - error_quark(), - INVALID_MENUITEM_ID, - "The ID supplied %d does not refer to a menu item we have", - id); - } - return FALSE; + g_dbus_method_invocation_return_error(invocation, + error_quark(), + INVALID_MENUITEM_ID, + "The ID supplied %d does not refer to a menu item we have", + id); + return; } idle_event_t * event_data = g_new0(idle_event_t, 1); event_data->mi = mi; g_object_ref(event_data->mi); - event_data->eventid = g_strdup(eventid); - event_data->timestamp = timestamp; - g_value_init(&(event_data->data), G_VALUE_TYPE(data)); - g_value_copy(data, &(event_data->data)); + event_data->eventid = g_strdup(g_variant_get_string(g_variant_get_child_value(params, 1), NULL)); + event_data->timestamp = g_variant_get_uint32(g_variant_get_child_value(params, 3)); + + /* TODO: Need to figure out converting a variant to a value */ + g_value_init(&(event_data->data), G_TYPE_INT); + g_value_set_int(&(event_data->data), 0); g_timeout_add(0, event_local_handler, event_data); - return TRUE; + + g_dbus_method_invocation_return_value(invocation, NULL); + return; } /* Recieve the About To Show function. Pass it to our menu item. */ -- cgit v1.2.3 From 5c07a374c78a73fee4030a61c74ab3a99fc8bcc5 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 15 Oct 2010 13:48:05 -0500 Subject: Porting over AboutToShow --- libdbusmenu-glib/server.c | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c index 2fdc1ef..42463a9 100644 --- a/libdbusmenu-glib/server.c +++ b/libdbusmenu-glib/server.c @@ -38,9 +38,6 @@ License version 3 and version 2.1 along with this program. If not, see #include "dbus-menu.xml.h" -/* DBus Prototypes */ -static gboolean _dbusmenu_server_about_to_show (DbusmenuServer * server, gint id, gboolean * need_update, GError ** error); - static void layout_update_signal (DbusmenuServer * server); #define DBUSMENU_VERSION_NUMBER 2 @@ -105,6 +102,7 @@ enum { METHOD_GET_PROPERTY, METHOD_GET_PROPERTIES, METHOD_EVENT, + METHOD_ABOUT_TO_SHOW, /* Counter, do not remove! */ METHOD_COUNT }; @@ -175,6 +173,9 @@ static void bus_get_properties (DbusmenuServer * server, static void bus_event (DbusmenuServer * server, GVariant * params, GDBusMethodInvocation * invocation); +static void bus_about_to_show (DbusmenuServer * server, + GVariant * params, + GDBusMethodInvocation * invocation); /* Globals */ static GDBusNodeInfo * dbusmenu_node_info = NULL; @@ -321,6 +322,9 @@ dbusmenu_server_class_init (DbusmenuServerClass *class) dbusmenu_method_table[METHOD_EVENT].interned_name = g_intern_static_string("Event"); dbusmenu_method_table[METHOD_EVENT].func = bus_event; + dbusmenu_method_table[METHOD_ABOUT_TO_SHOW].interned_name = g_intern_static_string("AboutToShow"); + dbusmenu_method_table[METHOD_ABOUT_TO_SHOW].func = bus_about_to_show; + return; } @@ -950,26 +954,26 @@ bus_event (DbusmenuServer * server, GVariant * params, GDBusMethodInvocation * i } /* Recieve the About To Show function. Pass it to our menu item. */ -static gboolean -_dbusmenu_server_about_to_show (DbusmenuServer * server, gint id, gboolean * need_update, GError ** error) +static void +bus_about_to_show (DbusmenuServer * server, GVariant * params, GDBusMethodInvocation * invocation) { DbusmenuServerPrivate * priv = DBUSMENU_SERVER_GET_PRIVATE(server); + gint id = g_variant_get_int32(g_variant_get_child_value(params, 0)); DbusmenuMenuitem * mi = dbusmenu_menuitem_find_id(priv->root, id); if (mi == NULL) { - if (error != NULL) { - g_set_error(error, - error_quark(), - INVALID_MENUITEM_ID, - "The ID supplied %d does not refer to a menu item we have", - id); - } - return FALSE; + g_dbus_method_invocation_return_error(invocation, + error_quark(), + INVALID_MENUITEM_ID, + "The ID supplied %d does not refer to a menu item we have", + id); + return; } /* GTK+ does not support about-to-show concept for now */ - *need_update = FALSE; - return TRUE; + g_dbus_method_invocation_return_value(invocation, + g_variant_new_boolean(FALSE)); + return; } /* Public Interface */ -- cgit v1.2.3 From 37596991960990c127336ccc8527832a35d595ad Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 15 Oct 2010 16:10:55 -0500 Subject: Making signals emit on dbus as well as locally. --- libdbusmenu-glib/server.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c index 42463a9..652b2a8 100644 --- a/libdbusmenu-glib/server.c +++ b/libdbusmenu-glib/server.c @@ -589,6 +589,15 @@ layout_update_idle (gpointer user_data) DbusmenuServerPrivate * priv = DBUSMENU_SERVER_GET_PRIVATE(server); 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); + } priv->layout_idle = 0; @@ -612,7 +621,29 @@ layout_update_signal (DbusmenuServer * server) static void menuitem_property_changed (DbusmenuMenuitem * mi, gchar * property, GValue * value, DbusmenuServer * server) { + DbusmenuServerPrivate * priv = DBUSMENU_SERVER_GET_PRIVATE(server); + g_signal_emit(G_OBJECT(server), signals[ID_PROP_UPDATE], 0, dbusmenu_menuitem_get_id(mi), property, value, TRUE); + + if (priv->dbusobject != NULL && priv->bus != NULL) { + GValue variantval = {0}; + g_value_init(&variantval, G_TYPE_VARIANT); + + if (!g_value_transform(value, &variantval)) { + g_warning("Unable to convert property '%s' of type %s to a variant", property, G_VALUE_TYPE_NAME(value)); + } + GVariant * variant = g_value_get_variant(&variantval); + + g_dbus_connection_emit_signal(priv->bus, + NULL, + priv->dbusobject, + DBUSMENU_INTERFACE, + "ItemPropertyUpdated", + g_variant_new("(isv)", dbusmenu_menuitem_get_id(mi), property, variant), + NULL); + + g_value_unset(&variantval); + } return; } @@ -663,7 +694,20 @@ menuitem_child_moved (DbusmenuMenuitem * parent, DbusmenuMenuitem * child, guint static void menuitem_shown (DbusmenuMenuitem * mi, guint timestamp, DbusmenuServer * server) { + DbusmenuServerPrivate * priv = DBUSMENU_SERVER_GET_PRIVATE(server); + g_signal_emit(G_OBJECT(server), signals[ITEM_ACTIVATION], 0, dbusmenu_menuitem_get_id(mi), timestamp, TRUE); + + if (priv->dbusobject != NULL && priv->bus != NULL) { + g_dbus_connection_emit_signal(priv->bus, + NULL, + priv->dbusobject, + DBUSMENU_INTERFACE, + "ItemPropertyUpdated", + g_variant_new("(iu)", dbusmenu_menuitem_get_id(mi), timestamp), + NULL); + } + return; } -- cgit v1.2.3 From e4b55fd76e9506e3ecfe98b60518849c8b1ac87d Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 12 Nov 2010 13:20:29 -0600 Subject: Switching the headers and private variables --- libdbusmenu-glib/client.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index 6a51764..2aa938c 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -30,7 +30,7 @@ License version 3 and version 2.1 along with this program. If not, see #include "config.h" #endif -#include +#include #include #include @@ -39,7 +39,6 @@ License version 3 and version 2.1 along with this program. If not, see #include "menuitem.h" #include "menuitem-private.h" #include "client-menuitem.h" -#include "dbusmenu-client.h" #include "server-marshal.h" #include "client-marshal.h" @@ -69,15 +68,15 @@ struct _DbusmenuClientPrivate gchar * dbus_object; gchar * dbus_name; - DBusGConnection * session_bus; - DBusGProxy * menuproxy; - DBusGProxy * propproxy; - DBusGProxyCall * layoutcall; + GDBusConnection * session_bus; + GDBusProxy * menuproxy; + GDBusProxy * propproxy; + GCancellable * layoutcall; gint current_revision; gint my_revision; - DBusGProxy * dbusproxy; + GDBusProxy * dbusproxy; GHashTable * type_handlers; -- cgit v1.2.3 From 6d36d55acf43696ba371d1af757e0662d89918d3 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 12 Nov 2010 13:20:48 -0600 Subject: Changing the flush --- libdbusmenu-glib/client.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index 2aa938c..8ede85d 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -562,6 +562,21 @@ get_properties_idle (gpointer user_data) return FALSE; } +/* Report and error if we're unable to flush the connection, likely + to be a cause of some other issues. */ +static void +connection_flush_cb (GObject * object, GAsyncResult * result, gpointer user_data) +{ + GError * error = NULL; + + if (!g_dbus_connection_flush_finish(G_DBUS_CONNECTION(object), result, &error)) { + g_warning("Unable to flush DBus connection: %s", error->message); + g_error_free(error); + } + + return; +} + /* Forces a call out to start getting properties with the menu items that we have queued up already. */ static void @@ -578,7 +593,11 @@ get_properties_flush (DbusmenuClient * client) get_properties_idle(client); - dbus_g_connection_flush(priv->session_bus); + /* I'm not sure this flush is necissary with GDBus running the + DBus connection in another thread. But, I don't think that + it'll hurt anything either, so I'm leaving it in. */ + g_return_if_fail(priv->session_bus != NULL); + g_dbus_connection_flush(priv->session_bus, NULL, connection_flush_cb, NULL); return; } -- cgit v1.2.3 From 51c9cc0eb87f0a379c891a23162e232b1f597bd6 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 12 Nov 2010 13:57:22 -0600 Subject: Changing the flow for creating the async session bus. It is now cancellable. --- libdbusmenu-glib/client.c | 65 ++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 59 insertions(+), 6 deletions(-) diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index 8ede85d..f662f74 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -69,6 +69,8 @@ struct _DbusmenuClientPrivate gchar * dbus_name; GDBusConnection * session_bus; + GCancelable * session_bus_cancel; + GDBusProxy * menuproxy; GDBusProxy * propproxy; GCancellable * layoutcall; @@ -261,6 +263,8 @@ dbusmenu_client_init (DbusmenuClient *self) priv->dbus_name = NULL; priv->session_bus = NULL; + priv->session_bus_cancel = NULL; + priv->menuproxy = NULL; priv->propproxy = NULL; priv->layoutcall = NULL; @@ -339,7 +343,16 @@ dbusmenu_client_dispose (GObject *object) g_object_unref(G_OBJECT(priv->dbusproxy)); priv->dbusproxy = NULL; } - priv->session_bus = NULL; + + if (priv->session_bus_cancel != NULL) { + g_cancellable_cancel(priv->session_bus_cancel); + g_object_unref(priv->session_bus_cancel); + priv->session_bus_cancel = NULL; + } + if (priv->session_bus != NULL) { + g_object_unref(priv->session_bus); + priv->session_bus = NULL; + } if (priv->root != NULL) { g_object_unref(G_OBJECT(priv->root)); @@ -848,6 +861,37 @@ proxy_destroyed (GObject * gobj_proxy, gpointer userdata) return; } +/* Respond to us getting the session bus (hopefully) or handle + the error if not */ +void +session_bus_cb (GObject * object, GAsyncResult * res, gpointer user_data) +{ + GError * error = NULL; + + /* NOTE: We're not using any other variables before checking + the result because they could be destroyed and thus invalid */ + GDBusConnection * bus = g_bus_get_finish(res, &error); + if (error != NULL) { + g_warning("Unable to get session bus: %s", error->message); + g_error_free(error); + return; + } + + /* If this wasn't cancelled, we should be good */ + DbusmenuClientPrivate * priv = DBUSMENU_CLIENT_GET_PRIVATE(client); + priv->session_bus = bus; + + if (priv->session_bus_cancel != NULL) { + g_object_unref(priv->session_bus_cancel); + priv->session_bus_cancel = NULL; + } + + /* Retry to build the proxies now that we have a bus */ + build_proxies(DBUSMENU_CLIENT(user_data)); + + return; +} + /* When we have a name and an object, build the two proxies and get the first version of the layout */ static void @@ -859,11 +903,20 @@ build_proxies (DbusmenuClient * client) g_return_if_fail(priv->dbus_object != NULL); g_return_if_fail(priv->dbus_name != NULL); - priv->session_bus = dbus_g_bus_get(DBUS_BUS_SESSION, &error); - if (error != NULL) { - g_error("Unable to get session bus: %s", error->message); - g_error_free(error); - build_dbus_proxy(client); + if (priv->session_bus == NULL) { + /* We don't have the session bus yet, that's okay, but + we need to handle that. */ + + /* If we're already running we don't need to look again. */ + if (priv->session_bus_cancel == NULL) { + priv->session_bus_cancel = g_cancellable_new(); + + /* Async get the session bus */ + g_bus_get(G_BUS_SESSION, priv->session_bus_cancel, session_bus_cb, client); + } + + /* This function exists, it'll be called again when we get + the session bus so this condition will be ignored */ return; } -- cgit v1.2.3 From 030de7ba74d6560ef61b31913c244a4be1d5116b Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 12 Nov 2010 14:26:31 -0600 Subject: Removing the proxy for the property interface on the object as GDBus puts that in the standard proxy now --- libdbusmenu-glib/client.c | 26 +------------------------- 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index f662f74..f672696 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -69,10 +69,9 @@ struct _DbusmenuClientPrivate gchar * dbus_name; GDBusConnection * session_bus; - GCancelable * session_bus_cancel; + GCancellable * session_bus_cancel; GDBusProxy * menuproxy; - GDBusProxy * propproxy; GCancellable * layoutcall; gint current_revision; @@ -266,7 +265,6 @@ dbusmenu_client_init (DbusmenuClient *self) priv->session_bus_cancel = NULL; priv->menuproxy = NULL; - priv->propproxy = NULL; priv->layoutcall = NULL; priv->current_revision = 0; @@ -335,10 +333,6 @@ dbusmenu_client_dispose (GObject *object) g_object_unref(G_OBJECT(priv->menuproxy)); priv->menuproxy = NULL; } - if (priv->propproxy != NULL) { - g_object_unref(G_OBJECT(priv->propproxy)); - priv->propproxy = NULL; - } if (priv->dbusproxy != NULL) { g_object_unref(G_OBJECT(priv->dbusproxy)); priv->dbusproxy = NULL; @@ -920,20 +914,6 @@ build_proxies (DbusmenuClient * client) return; } - priv->propproxy = dbus_g_proxy_new_for_name_owner(priv->session_bus, - priv->dbus_name, - priv->dbus_object, - DBUS_INTERFACE_PROPERTIES, - &error); - if (error != NULL) { - g_warning("Unable to get property proxy for %s on %s: %s", priv->dbus_name, priv->dbus_object, error->message); - g_error_free(error); - build_dbus_proxy(client); - return; - } - g_object_add_weak_pointer(G_OBJECT(priv->propproxy), (gpointer *)&priv->propproxy); - g_signal_connect(G_OBJECT(priv->propproxy), "destroy", G_CALLBACK(proxy_destroyed), client); - priv->menuproxy = dbus_g_proxy_new_for_name_owner(priv->session_bus, priv->dbus_name, priv->dbus_object, @@ -1551,10 +1531,6 @@ dbusmenu_client_get_root (DbusmenuClient * client) DbusmenuClientPrivate * priv = DBUSMENU_CLIENT_GET_PRIVATE(client); - if (priv->propproxy == NULL) { - return NULL; - } - #ifdef MASSIVEDEBUGGING g_debug("Client get root: %X", (guint)priv->root); #endif -- cgit v1.2.3 From efd88243d8e4e8911f08e86744ef13387ac4ae6a Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 12 Nov 2010 14:30:46 -0600 Subject: Including the interface description and building the objects from it once --- libdbusmenu-glib/client.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index f672696..30dce89 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -41,6 +41,7 @@ License version 3 and version 2.1 along with this program. If not, see #include "client-menuitem.h" #include "server-marshal.h" #include "client-marshal.h" +#include "dbus-menu.xml.h" /* Properties */ enum { @@ -136,6 +137,10 @@ static void get_properties_globber (DbusmenuClient * client, gint id, const gcha static GQuark error_domain (void); static void item_activated (DBusGProxy * proxy, gint id, guint timestamp, DbusmenuClient * client); +/* Globals */ +static GDBusNodeInfo * dbusmenu_node_info = NULL; +static GDBusInterfaceInfo * dbusmenu_interface_info = NULL; + /* Build a type */ G_DEFINE_TYPE (DbusmenuClient, dbusmenu_client, G_TYPE_OBJECT); @@ -246,6 +251,24 @@ dbusmenu_client_class_init (DbusmenuClientClass *klass) NULL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS)); + if (dbusmenu_node_info == NULL) { + GError * error = NULL; + + dbusmenu_node_info = g_dbus_node_info_new_for_xml(dbus_menu_xml, &error); + if (error != NULL) { + g_error("Unable to parse DBusmenu Interface description: %s", error->message); + g_error_free(error); + } + } + + if (dbusmenu_interface_info == NULL) { + dbusmenu_interface_info = g_dbus_node_info_lookup_interface(dbusmenu_node_info, DBUSMENU_INTERFACE); + + if (dbusmenu_interface_info == NULL) { + g_error("Unable to find interface '" DBUSMENU_INTERFACE "'"); + } + } + return; } -- cgit v1.2.3 From 08053906621fc5240e7bb7a549a09b0acf930809 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 12 Nov 2010 15:04:45 -0600 Subject: Adding a cancellable for the menu proxy in the private object --- libdbusmenu-glib/client.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index 30dce89..17f52b4 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -73,6 +73,8 @@ struct _DbusmenuClientPrivate GCancellable * session_bus_cancel; GDBusProxy * menuproxy; + GCancellable * menuproxy_cancel; + GCancellable * layoutcall; gint current_revision; @@ -288,6 +290,8 @@ dbusmenu_client_init (DbusmenuClient *self) priv->session_bus_cancel = NULL; priv->menuproxy = NULL; + priv->menuproxy_cancel = NULL; + priv->layoutcall = NULL; priv->current_revision = 0; @@ -352,15 +356,26 @@ dbusmenu_client_dispose (GObject *object) dbus_g_proxy_cancel_call(priv->menuproxy, priv->layoutcall); priv->layoutcall = NULL; } + + /* Bring down the menu proxy, ensure we're not + looking for one at the same time. */ + if (priv->menuproxy_cancel != NULL) { + g_cancellable_cancel(priv->menuproxy_cancel); + g_object_unref(priv->menuproxy_cancel); + priv->menuproxy_cancel = NULL; + } if (priv->menuproxy != NULL) { g_object_unref(G_OBJECT(priv->menuproxy)); priv->menuproxy = NULL; } + if (priv->dbusproxy != NULL) { g_object_unref(G_OBJECT(priv->dbusproxy)); priv->dbusproxy = NULL; } + /* Bring down the session bus, ensure we're not + looking for one at the same time. */ if (priv->session_bus_cancel != NULL) { g_cancellable_cancel(priv->session_bus_cancel); g_object_unref(priv->session_bus_cancel); -- cgit v1.2.3 From 88cc4c919ee836870a326f22eb0b773f8395aeec Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 12 Nov 2010 15:05:22 -0600 Subject: Reshuffling the creation of the menu proxy to be async with a callback. --- libdbusmenu-glib/client.c | 37 +++++++++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index 17f52b4..42144ae 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -138,6 +138,7 @@ static void menuitem_get_properties_cb (DBusGProxy * proxy, GHashTable * propert static void get_properties_globber (DbusmenuClient * client, gint id, const gchar ** properties, org_ayatana_dbusmenu_get_properties_reply callback, gpointer user_data); static GQuark error_domain (void); static void item_activated (DBusGProxy * proxy, gint id, guint timestamp, DbusmenuClient * client); +static void menuproxy_build_cb (GObject * object, GAsyncResult * res, gpointer user_data); /* Globals */ static GDBusNodeInfo * dbusmenu_node_info = NULL; @@ -952,17 +953,33 @@ build_proxies (DbusmenuClient * client) return; } - priv->menuproxy = dbus_g_proxy_new_for_name_owner(priv->session_bus, - priv->dbus_name, - priv->dbus_object, - "org.ayatana.dbusmenu", - &error); - if (error != NULL) { - g_warning("Unable to get dbusmenu proxy for %s on %s: %s", priv->dbus_name, priv->dbus_object, error->message); - g_error_free(error); - build_dbus_proxy(client); - return; + /* Build us a menu proxy */ + if (priv->menuproxy == NULL) { + + /* Check to see if we're already building one */ + if (priv->menuproxy_cancel == NULL) { + priv->menuproxy_cancel = g_cancellable_new(); + + g_dbus_proxy_new(priv->session_bus, + G_DBUS_PROXY_FLAGS_NONE, + dbusmenu_interface_info, + priv->dbus_name, + priv->dbus_object, + DBUSMENU_INTERFACE, + priv->menuproxy_cancel, + menuproxy_build_cb, + client); + } } + + return; +} + +/* Callback when we know if the menu proxy can be created or + not and do something with it! */ +static void +menuproxy_build_cb (GObject * object, GAsyncResult * res, gpointer user_data) +{ g_object_add_weak_pointer(G_OBJECT(priv->menuproxy), (gpointer *)&priv->menuproxy); g_signal_connect(G_OBJECT(priv->menuproxy), "destroy", G_CALLBACK(proxy_destroyed), client); -- cgit v1.2.3 From 567ff35378371596e1304cad97f634969e954cc1 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 12 Nov 2010 16:56:07 -0600 Subject: Adjusting how the menu proxy gets built up and signals connected --- libdbusmenu-glib/client.c | 83 +++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 69 insertions(+), 14 deletions(-) diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index 42144ae..d2bfc8f 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -139,6 +139,8 @@ static void get_properties_globber (DbusmenuClient * client, gint id, const gcha static GQuark error_domain (void); static void item_activated (DBusGProxy * proxy, gint id, guint timestamp, DbusmenuClient * client); static void menuproxy_build_cb (GObject * object, GAsyncResult * res, gpointer user_data); +static void menuproxy_name_changed_cb (GObject * object, GParamSpec * pspec, gpointer user_data); +static void menuproxy_signal_cb (GDBusProxy * proxy, gchar * sender, gchar * signal, GVariant * params, gpointer user_data); /* Globals */ static GDBusNodeInfo * dbusmenu_node_info = NULL; @@ -980,8 +982,25 @@ build_proxies (DbusmenuClient * client) static void menuproxy_build_cb (GObject * object, GAsyncResult * res, gpointer user_data) { - g_object_add_weak_pointer(G_OBJECT(priv->menuproxy), (gpointer *)&priv->menuproxy); - g_signal_connect(G_OBJECT(priv->menuproxy), "destroy", G_CALLBACK(proxy_destroyed), client); + GError * error = NULL; + + /* NOTE: We're not using any other variables before checking + the result because they could be destroyed and thus invalid */ + GDBusProxy * proxy = g_dbus_proxy_new_finish(res, &error); + if (error != NULL) { + g_warning("Unable to get menu proxy: %s", error->message); + g_error_free(error); + return; + } + + /* If this wasn't cancelled, we should be good */ + DbusmenuClientPrivate * priv = DBUSMENU_CLIENT_GET_PRIVATE(user_data); + priv->menuproxy = proxy; + + if (priv->menuproxy_cancel != NULL) { + g_object_unref(priv->menuproxy_cancel); + priv->menuproxy_cancel = NULL; + } /* If we get here, we don't need the DBus proxy */ if (priv->dbusproxy != NULL) { @@ -989,22 +1008,58 @@ menuproxy_build_cb (GObject * object, GAsyncResult * res, gpointer user_data) priv->dbusproxy = NULL; } - dbus_g_object_register_marshaller(_dbusmenu_server_marshal_VOID__UINT_INT, G_TYPE_NONE, G_TYPE_UINT, G_TYPE_INT, G_TYPE_INVALID); - dbus_g_proxy_add_signal(priv->menuproxy, "LayoutUpdated", G_TYPE_UINT, G_TYPE_INT, G_TYPE_INVALID); - dbus_g_proxy_connect_signal(priv->menuproxy, "LayoutUpdated", G_CALLBACK(layout_update), client, NULL); + g_signal_connect(priv->menuproxy, "g-signal", G_CALLBACK(menuproxy_signal_cb), client); + g_signal_connect(priv->menuproxy, "notify::g-name-owner", G_CALLBACK(menuproxy_name_changed_cb), client); - dbus_g_object_register_marshaller(_dbusmenu_server_marshal_VOID__INT_STRING_POINTER, G_TYPE_NONE, G_TYPE_INT, G_TYPE_STRING, G_TYPE_VALUE, G_TYPE_INVALID); - dbus_g_proxy_add_signal(priv->menuproxy, "ItemPropertyUpdated", G_TYPE_INT, G_TYPE_STRING, G_TYPE_VALUE, G_TYPE_INVALID); - dbus_g_proxy_connect_signal(priv->menuproxy, "ItemPropertyUpdated", G_CALLBACK(id_prop_update), client, NULL); + update_layout(client); - dbus_g_proxy_add_signal(priv->menuproxy, "ItemUpdated", G_TYPE_INT, G_TYPE_INVALID); - dbus_g_proxy_connect_signal(priv->menuproxy, "ItemUpdated", G_CALLBACK(id_update), client, NULL); + return; +} + +/* Handle the case where we change owners */ +static void +menuproxy_name_changed_cb (GObject * object, GParamSpec * pspec, gpointer user_data) +{ + GDBusProxy * proxy = G_DBUS_PROXY(object); - dbus_g_object_register_marshaller(_dbusmenu_server_marshal_VOID__INT_UINT, G_TYPE_NONE, G_TYPE_INT, G_TYPE_UINT, G_TYPE_INVALID); - dbus_g_proxy_add_signal(priv->menuproxy, "ItemActivationRequested", G_TYPE_INT, G_TYPE_UINT, G_TYPE_INVALID); - dbus_g_proxy_connect_signal(priv->menuproxy, "ItemActivationRequested", G_CALLBACK(item_activated), client, NULL); + gchar * owner = g_dbus_proxy_get_name_owner(proxy); - update_layout(client); + if (owner == NULL) { + /* Oh, no! We lost our owner! */ + proxy_destroyed(G_OBJECT(proxy), user_data); + } else { + g_free(owner); + } + + return; +} + +/* Handle the signals out of the proxy */ +static void +menuproxy_signal_cb (GDBusProxy * proxy, gchar * sender, gchar * signal, GVariant * params, gpointer user_data) +{ + g_return_if_fail(DBUSMENU_IS_CLIENT(user_data)); + DbusmenuClient * client = DBUSMENU_CLIENT(user_data); + + if (g_strcmp0(signal, "LayoutUpdated") == 0) { + guint revision; gint parent; + g_variant_get(params, "(ui)", &revision, &parent); + layout_update(proxy, revision, parent, client); + } else if (g_strcmp0(signal, "ItemPropertyUpdated") == 0) { + gint id; gchar * property; GVariant * value; + g_variant_get(params, "(isv)", &id, &property, &value); + id_prop_update(proxy, id, property, value, client); + } else if (g_strcmp0(signal, "ItemUpdated") == 0) { + gint id; + g_variant_get(params, "(i)", &id); + id_update(proxy, id, client); + } else if (g_strcmp0(signal, "ItemActivationRequested") == 0) { + gint id; guint timestamp; + g_variant_get(params, "(iu)", &id, ×tamp); + item_activated(proxy, id, timestamp, client); + } else { + g_warning("Received signal '%s' from menu proxy that is unknown", signal); + } return; } -- cgit v1.2.3 From a71b34a9103a9a383cff69bfe7b44319f7cb114c Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 15 Nov 2010 08:45:02 -0600 Subject: Changing the function prototype for properties callback to be local, and make more sense. --- libdbusmenu-glib/client.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index d2bfc8f..6f31354 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -60,6 +60,8 @@ enum { LAST_SIGNAL }; +typedef void (*properties_func) (DbusmenuClient * client, GVariant * properties); + static guint signals[LAST_SIGNAL] = { 0 }; struct _DbusmenuClientPrivate @@ -100,7 +102,7 @@ struct _newItemPropData typedef struct _properties_listener_t properties_listener_t; struct _properties_listener_t { gint id; - org_ayatana_dbusmenu_get_properties_reply callback; + properties_func callback; gpointer user_data; gboolean replied; }; @@ -135,7 +137,7 @@ static gint parse_layout (DbusmenuClient * client, const gchar * layout); static void update_layout_cb (DBusGProxy * proxy, guint rev, gchar * xml, GError * in_error, void * data); static void update_layout (DbusmenuClient * client); static void menuitem_get_properties_cb (DBusGProxy * proxy, GHashTable * properties, GError * error, gpointer data); -static void get_properties_globber (DbusmenuClient * client, gint id, const gchar ** properties, org_ayatana_dbusmenu_get_properties_reply callback, gpointer user_data); +static void get_properties_globber (DbusmenuClient * client, gint id, const gchar ** properties, properties_func callback, gpointer user_data); static GQuark error_domain (void); static void item_activated (DBusGProxy * proxy, gint id, guint timestamp, DbusmenuClient * client); static void menuproxy_build_cb (GObject * object, GAsyncResult * res, gpointer user_data); @@ -653,7 +655,7 @@ get_properties_flush (DbusmenuClient * client) /* A function to group all the get_properties commands to make them more efficient over dbus. */ static void -get_properties_globber (DbusmenuClient * client, gint id, const gchar ** properties, org_ayatana_dbusmenu_get_properties_reply callback, gpointer user_data) +get_properties_globber (DbusmenuClient * client, gint id, const gchar ** properties, properties_func callback, gpointer user_data) { DbusmenuClientPrivate * priv = DBUSMENU_CLIENT_GET_PRIVATE(client); if (find_listener(priv->delayed_property_listeners, 0, id) != NULL) { -- cgit v1.2.3 From fb510a52796e9ff1a5bfc52fad72e94c22efc6e1 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 15 Nov 2010 08:47:36 -0600 Subject: Blanket replace of DBusGProxy with GDBusProxy --- libdbusmenu-glib/client.c | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index 6f31354..92991b3 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -127,19 +127,19 @@ static void dbusmenu_client_finalize (GObject *object); static void set_property (GObject * obj, guint id, const GValue * value, GParamSpec * pspec); static void get_property (GObject * obj, guint id, GValue * value, GParamSpec * pspec); /* Private Funcs */ -static void layout_update (DBusGProxy * proxy, guint revision, gint parent, DbusmenuClient * client); -static void id_prop_update (DBusGProxy * proxy, gint id, gchar * property, GValue * value, DbusmenuClient * client); -static void id_update (DBusGProxy * proxy, gint id, DbusmenuClient * client); +static void layout_update (GDBusProxy * proxy, guint revision, gint parent, DbusmenuClient * client); +static void id_prop_update (GDBusProxy * proxy, gint id, gchar * property, GValue * value, DbusmenuClient * client); +static void id_update (GDBusProxy * proxy, gint id, DbusmenuClient * client); static void build_proxies (DbusmenuClient * client); static gint parse_node_get_id (xmlNodePtr node); -static DbusmenuMenuitem * parse_layout_xml(DbusmenuClient * client, xmlNodePtr node, DbusmenuMenuitem * item, DbusmenuMenuitem * parent, DBusGProxy * proxy); +static DbusmenuMenuitem * parse_layout_xml(DbusmenuClient * client, xmlNodePtr node, DbusmenuMenuitem * item, DbusmenuMenuitem * parent, GDBusProxy * proxy); static gint parse_layout (DbusmenuClient * client, const gchar * layout); -static void update_layout_cb (DBusGProxy * proxy, guint rev, gchar * xml, GError * in_error, void * data); +static void update_layout_cb (GDBusProxy * proxy, guint rev, gchar * xml, GError * in_error, void * data); static void update_layout (DbusmenuClient * client); -static void menuitem_get_properties_cb (DBusGProxy * proxy, GHashTable * properties, GError * error, gpointer data); +static void menuitem_get_properties_cb (GDBusProxy * proxy, GHashTable * properties, GError * error, gpointer data); static void get_properties_globber (DbusmenuClient * client, gint id, const gchar ** properties, properties_func callback, gpointer user_data); static GQuark error_domain (void); -static void item_activated (DBusGProxy * proxy, gint id, guint timestamp, DbusmenuClient * client); +static void item_activated (GDBusProxy * proxy, gint id, guint timestamp, DbusmenuClient * client); static void menuproxy_build_cb (GObject * object, GAsyncResult * res, gpointer user_data); static void menuproxy_name_changed_cb (GObject * object, GParamSpec * pspec, gpointer user_data); static void menuproxy_signal_cb (GDBusProxy * proxy, gchar * sender, gchar * signal, GVariant * params, gpointer user_data); @@ -494,7 +494,7 @@ find_listener (GArray * listeners, guint index, gint id) /* Call back from getting the group properties, now we need to unwind and call the various functions. */ static void -get_properties_callback (DBusGProxy *proxy, GPtrArray *OUT_properties, GError *error, gpointer userdata) +get_properties_callback (GDBusProxy *proxy, GPtrArray *OUT_properties, GError *error, gpointer userdata) { GArray * listeners = (GArray *)userdata; int i; @@ -701,7 +701,7 @@ get_properties_globber (DbusmenuClient * client, gint id, const gchar ** propert /* Called when a server item wants to activate the menu */ static void -item_activated (DBusGProxy * proxy, gint id, guint timestamp, DbusmenuClient * client) +item_activated (GDBusProxy * proxy, gint id, guint timestamp, DbusmenuClient * client) { g_return_if_fail(DBUSMENU_IS_CLIENT(client)); @@ -725,7 +725,7 @@ item_activated (DBusGProxy * proxy, gint id, guint timestamp, DbusmenuClient * c /* Annoying little wrapper to make the right function update */ static void -layout_update (DBusGProxy * proxy, guint revision, gint parent, DbusmenuClient * client) +layout_update (GDBusProxy * proxy, guint revision, gint parent, DbusmenuClient * client) { DbusmenuClientPrivate * priv = DBUSMENU_CLIENT_GET_PRIVATE(client); priv->current_revision = revision; @@ -738,7 +738,7 @@ layout_update (DBusGProxy * proxy, guint revision, gint parent, DbusmenuClient * /* Signal from the server that a property has changed on one of our menuitems */ static void -id_prop_update (DBusGProxy * proxy, gint id, gchar * property, GValue * value, DbusmenuClient * client) +id_prop_update (GDBusProxy * proxy, gint id, gchar * property, GValue * value, DbusmenuClient * client) { #ifdef MASSIVEDEBUGGING GValue valstr = {0}; @@ -768,7 +768,7 @@ id_prop_update (DBusGProxy * proxy, gint id, gchar * property, GValue * value, D /* Oh, lots of updates now. That silly server, they want to change all kinds of stuff! */ static void -id_update (DBusGProxy * proxy, gint id, DbusmenuClient * client) +id_update (GDBusProxy * proxy, gint id, DbusmenuClient * client) { #ifdef MASSIVEDEBUGGING g_debug("Client side ID update: %d", id); @@ -788,7 +788,7 @@ id_update (DBusGProxy * proxy, gint id, DbusmenuClient * client) /* Watches to see if our DBus savior comes onto the bus */ static void -dbus_owner_change (DBusGProxy * proxy, const gchar * name, const gchar * prev, const gchar * new, DbusmenuClient * client) +dbus_owner_change (GDBusProxy * proxy, const gchar * name, const gchar * prev, const gchar * new, DbusmenuClient * client) { DbusmenuClientPrivate * priv = DBUSMENU_CLIENT_GET_PRIVATE(client); /* g_debug("Owner change: %s %s %s", name, prev, new); */ @@ -815,7 +815,7 @@ dbus_owner_change (DBusGProxy * proxy, const gchar * name, const gchar * prev, c it does, then we should build the proxies here. Race condition check. */ static void -name_owner_check (DBusGProxy *proxy, gboolean has_owner, GError *error, gpointer userdata) +name_owner_check (GDBusProxy *proxy, gboolean has_owner, GError *error, gpointer userdata) { if (error != NULL) { return; @@ -1115,7 +1115,7 @@ get_properties_helper (gpointer key, gpointer value, gpointer data) This isn't the most efficient way. We can optimize this by somehow removing the foreach. But that is for later. */ static void -menuitem_get_properties_cb (DBusGProxy * proxy, GHashTable * properties, GError * error, gpointer data) +menuitem_get_properties_cb (GDBusProxy * proxy, GHashTable * properties, GError * error, gpointer data) { g_return_if_fail(DBUSMENU_IS_MENUITEM(data)); if (error != NULL) { @@ -1133,7 +1133,7 @@ menuitem_get_properties_cb (DBusGProxy * proxy, GHashTable * properties, GError is getting recycled with the update, but we think might have prop changes. */ static void -menuitem_get_properties_replace_cb (DBusGProxy * proxy, GHashTable * properties, GError * error, gpointer data) +menuitem_get_properties_replace_cb (GDBusProxy * proxy, GHashTable * properties, GError * error, gpointer data) { g_return_if_fail(DBUSMENU_IS_MENUITEM(data)); gboolean have_error = FALSE; @@ -1164,7 +1164,7 @@ menuitem_get_properties_replace_cb (DBusGProxy * proxy, GHashTable * properties, /* This is a different get properites call back that also sends new signals. It basically is a small wrapper around the original. */ static void -menuitem_get_properties_new_cb (DBusGProxy * proxy, GHashTable * properties, GError * error, gpointer data) +menuitem_get_properties_new_cb (GDBusProxy * proxy, GHashTable * properties, GError * error, gpointer data) { g_return_if_fail(data != NULL); newItemPropData * propdata = (newItemPropData *)data; @@ -1216,7 +1216,7 @@ menuitem_get_properties_new_cb (DBusGProxy * proxy, GHashTable * properties, GEr /* Respond to the call function to make sure that the other side got it, or print a warning. */ static void -menuitem_call_cb (DBusGProxy * proxy, GError * error, gpointer userdata) +menuitem_call_cb (GDBusProxy * proxy, GError * error, gpointer userdata) { event_data_t * edata = (event_data_t *)userdata; @@ -1285,7 +1285,7 @@ struct _about_to_show_t { /* Reports errors and responds to update request that were a result of sending the about to show signal. */ static void -about_to_show_cb (DBusGProxy * proxy, gboolean need_update, GError * error, gpointer userdata) +about_to_show_cb (GDBusProxy * proxy, gboolean need_update, GError * error, gpointer userdata) { about_to_show_t * data = (about_to_show_t *)userdata; @@ -1369,7 +1369,7 @@ parse_layout_update (DbusmenuMenuitem * item, DbusmenuClient * client) /* Parse recursively through the XML and make it into objects as need be */ static DbusmenuMenuitem * -parse_layout_xml(DbusmenuClient * client, xmlNodePtr node, DbusmenuMenuitem * item, DbusmenuMenuitem * parent, DBusGProxy * proxy) +parse_layout_xml(DbusmenuClient * client, xmlNodePtr node, DbusmenuMenuitem * item, DbusmenuMenuitem * parent, GDBusProxy * proxy) { /* First verify and figure out what we've got */ gint id = parse_node_get_id(node); @@ -1540,7 +1540,7 @@ parse_layout (DbusmenuClient * client, const gchar * layout) /* When the layout property returns, here's where we take care of that. */ static void -update_layout_cb (DBusGProxy * proxy, guint rev, gchar * xml, GError * error, void * data) +update_layout_cb (GDBusProxy * proxy, guint rev, gchar * xml, GError * error, void * data) { DbusmenuClient * client = DBUSMENU_CLIENT(data); DbusmenuClientPrivate * priv = DBUSMENU_CLIENT_GET_PRIVATE(client); -- cgit v1.2.3 From 5a5e31fd65810bd106f01833c5b66545d936e831 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 15 Nov 2010 08:49:20 -0600 Subject: Adding in the dbusmenu interface --- libdbusmenu-glib/client.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index 92991b3..e24a182 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -118,6 +118,7 @@ struct _event_data_t { #define DBUSMENU_CLIENT_GET_PRIVATE(o) (DBUSMENU_CLIENT(o)->priv) +#define DBUSMENU_INTERFACE "org.ayatana.dbusmenu" /* GObject Stuff */ static void dbusmenu_client_class_init (DbusmenuClientClass *klass); -- cgit v1.2.3 From dbb933c7da1d7ec7d3a40b7f0aead90aafe87911 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 15 Nov 2010 08:54:03 -0600 Subject: Changing the prototype for one call to the callback, need a different approach --- libdbusmenu-glib/client.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index e24a182..b80999e 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -60,7 +60,7 @@ enum { LAST_SIGNAL }; -typedef void (*properties_func) (DbusmenuClient * client, GVariant * properties); +typedef void (*properties_func) (DbusmenuClient * client, GVariant * properties, GError * error); static guint signals[LAST_SIGNAL] = { 0 }; @@ -318,6 +318,7 @@ dbusmenu_client_init (DbusmenuClient *self) static void dbusmenu_client_dispose (GObject *object) { + DbusmenuClient * client = DBUSMENU_CLIENT(object); DbusmenuClientPrivate * priv = DBUSMENU_CLIENT_GET_PRIVATE(object); if (priv->delayed_idle != 0) { @@ -347,7 +348,7 @@ dbusmenu_client_dispose (GObject *object) if (localerror == NULL) { g_set_error_literal(&localerror, error_domain(), 0, "DbusmenuClient Shutdown"); } - listener->callback(priv->menuproxy, NULL, localerror, listener->user_data); + listener->callback(client, NULL, localerror); } } if (localerror != NULL) { -- cgit v1.2.3 From 80fe2298aff27d9c10b3fbb8bbab120954e7f2be Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 15 Nov 2010 14:24:14 -0600 Subject: Changing the properties callback to use the proper prototype and GVariant --- libdbusmenu-glib/client.c | 57 +++++++++++++++++++++++------------------------ 1 file changed, 28 insertions(+), 29 deletions(-) diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index b80999e..50b379c 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -60,7 +60,7 @@ enum { LAST_SIGNAL }; -typedef void (*properties_func) (DbusmenuClient * client, GVariant * properties, GError * error); +typedef void (*properties_func) (GVariant * properties, GError * error, gpointer user_data); static guint signals[LAST_SIGNAL] = { 0 }; @@ -348,7 +348,7 @@ dbusmenu_client_dispose (GObject *object) if (localerror == NULL) { g_set_error_literal(&localerror, error_domain(), 0, "DbusmenuClient Shutdown"); } - listener->callback(client, NULL, localerror); + listener->callback(NULL, localerror, listener->user_data); } } if (localerror != NULL) { @@ -496,47 +496,37 @@ find_listener (GArray * listeners, guint index, gint id) /* Call back from getting the group properties, now we need to unwind and call the various functions. */ static void -get_properties_callback (GDBusProxy *proxy, GPtrArray *OUT_properties, GError *error, gpointer userdata) +get_properties_callback (GObject *obj, GAsyncResult * res, gpointer user_data) { - GArray * listeners = (GArray *)userdata; + GArray * listeners = (GArray *)user_data; int i; + GError * error = NULL; + GVariant * params = NULL; - #ifdef MASSIVEDEBUGGING - g_debug("Get properties callback: %d", OUT_properties->len); - #endif + params = g_dbus_proxy_call_finish(G_DBUS_PROXY(obj), res, &error); if (error != NULL) { /* If we get an error, all our callbacks need to hear about it. */ g_warning("Group Properties error: %s", error->message); for (i = 0; i < listeners->len; i++) { properties_listener_t * listener = &g_array_index(listeners, properties_listener_t, i); - listener->callback(proxy, NULL, error, listener->user_data); + listener->callback(NULL, error, listener->user_data); } g_array_free(listeners, TRUE); return; } /* Callback all the folks we can find */ - for (i = 0; i < OUT_properties->len; i++) { - GValueArray * varray = (GValueArray *)g_ptr_array_index(OUT_properties, i); - - if (varray->n_values != 2) { - g_warning("Value Array is %d entries long but we expected 2.", varray->n_values); + GVariantIter * iter = g_variant_iter_new(params); + GVariant * child; + while ((child = g_variant_iter_next_value(iter)) != NULL) { + if (g_strcmp0(g_variant_get_type_string(child), "ia(sv)") != 0) { + g_warning("Properties return signature is not 'ia(sv)' it is '%s'", g_variant_get_type_string(child)); continue; } - GValue * vid = g_value_array_get_nth(varray, 0); - GValue * vproperties = g_value_array_get_nth(varray, 1); - - if (G_VALUE_TYPE(vid) != G_TYPE_INT) { - g_warning("ID Entry not holding an int: %s", G_VALUE_TYPE_NAME(vid)); - } - if (G_VALUE_TYPE(vproperties) != dbus_g_type_get_map("GHashTable", G_TYPE_STRING, G_TYPE_VALUE)) { - g_warning("Properties Entry not holding an a{sv}: %s", G_VALUE_TYPE_NAME(vproperties)); - } - - gint id = g_value_get_int(vid); - GHashTable * properties = g_value_get_boxed(vproperties); + gint id = g_variant_get_int32(g_variant_get_child_value(child, 0)); + GVariant * properties = g_variant_get_child_value(child, 1); properties_listener_t * listener = find_listener(listeners, 0, id); if (listener == NULL) { @@ -545,12 +535,13 @@ get_properties_callback (GDBusProxy *proxy, GPtrArray *OUT_properties, GError *e } if (!listener->replied) { - listener->callback(proxy, properties, NULL, listener->user_data); + listener->callback(properties, NULL, listener->user_data); listener->replied = TRUE; } else { g_warning("Odd, we've already replied to the listener on ID %d", id); } } + g_variant_iter_free(iter); /* Provide errors for those who we can't */ GError * localerror = NULL; @@ -560,7 +551,7 @@ get_properties_callback (GDBusProxy *proxy, GPtrArray *OUT_properties, GError *e if (localerror == NULL) { g_set_error_literal(&localerror, error_domain(), 0, "Error getting properties for ID"); } - listener->callback(proxy, NULL, localerror, listener->user_data); + listener->callback(NULL, localerror, listener->user_data); } } if (localerror != NULL) { @@ -579,7 +570,7 @@ static gboolean get_properties_idle (gpointer user_data) { DbusmenuClientPrivate * priv = DBUSMENU_CLIENT_GET_PRIVATE(user_data); - //org_ayatana_dbusmenu_get_properties_async(priv->menuproxy, id, properties, callback, user_data); + g_return_val_if_fail(priv->menuproxy != NULL, TRUE); if (priv->delayed_property_listeners->len == 0) { g_warning("Odd, idle func got no listeners."); @@ -593,7 +584,15 @@ get_properties_idle (gpointer user_data) g_array_append_val(idlist, g_array_index(priv->delayed_property_listeners, properties_listener_t, i).id); } - org_ayatana_dbusmenu_get_group_properties_async(priv->menuproxy, idlist, (const gchar **)priv->delayed_property_list->data, get_properties_callback, priv->delayed_property_listeners); + GVariant * variant_params = g_variant_new("a(s)", (const gchar **)priv->delayed_property_list->data); + g_dbus_proxy_call(priv->menuproxy, + "GetGroupProperties", + variant_params, + G_DBUS_CALL_FLAGS_NONE, + -1, /* timeout */ + NULL, /* cancellable */ + get_properties_callback, + priv->delayed_property_listeners); /* Free ID List */ g_array_free(idlist, TRUE); -- cgit v1.2.3 From 26311e4db0f50c805374a1cf2265e7a5c81dd083 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 15 Nov 2010 14:37:53 -0600 Subject: Fixing the menuitem_get_properties_cb to use Variants and match the right prototype --- libdbusmenu-glib/client.c | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index 50b379c..23981de 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -137,7 +137,7 @@ static DbusmenuMenuitem * parse_layout_xml(DbusmenuClient * client, xmlNodePtr n static gint parse_layout (DbusmenuClient * client, const gchar * layout); static void update_layout_cb (GDBusProxy * proxy, guint rev, gchar * xml, GError * in_error, void * data); static void update_layout (DbusmenuClient * client); -static void menuitem_get_properties_cb (GDBusProxy * proxy, GHashTable * properties, GError * error, gpointer data); +static void menuitem_get_properties_cb (GVariant * properties, GError * error, gpointer data); static void get_properties_globber (DbusmenuClient * client, gint id, const gchar ** properties, properties_func callback, gpointer user_data); static GQuark error_domain (void); static void item_activated (GDBusProxy * proxy, gint id, guint timestamp, DbusmenuClient * client); @@ -542,6 +542,7 @@ get_properties_callback (GObject *obj, GAsyncResult * res, gpointer user_data) } } g_variant_iter_free(iter); + g_variant_unref(params); /* Provide errors for those who we can't */ GError * localerror = NULL; @@ -1116,17 +1117,32 @@ get_properties_helper (gpointer key, gpointer value, gpointer data) This isn't the most efficient way. We can optimize this by somehow removing the foreach. But that is for later. */ static void -menuitem_get_properties_cb (GDBusProxy * proxy, GHashTable * properties, GError * error, gpointer data) +menuitem_get_properties_cb (GVariant * properties, GError * error, gpointer data) { g_return_if_fail(DBUSMENU_IS_MENUITEM(data)); + DbusmenuMenuitem * item = DBUSMENU_MENUITEM(data); + if (error != NULL) { g_warning("Error getting properties on a menuitem: %s", error->message); g_object_unref(data); return; } - g_hash_table_foreach(properties, get_properties_helper, data); - g_hash_table_destroy(properties); + + GVariantIter * iter = g_variant_iter_new(properties); + gchar * key; + GVariant * value; + + while (g_variant_iter_next(iter, "{sv}", &key, &value)) { + dbusmenu_menuitem_property_set_variant(item, key, value); + + g_variant_unref(value); + g_free(key); + } + + g_variant_iter_free(iter); + g_object_unref(data); + return; } @@ -1154,7 +1170,7 @@ menuitem_get_properties_replace_cb (GDBusProxy * proxy, GHashTable * properties, } if (!have_error) { - menuitem_get_properties_cb(proxy, properties, error, data); + menuitem_get_properties_cb(properties, error, data); } else { g_object_unref(data); } @@ -1181,7 +1197,7 @@ menuitem_get_properties_new_cb (GDBusProxy * proxy, GHashTable * properties, GEr /* Extra ref as get_properties will unref once itself */ g_object_ref(propdata->item); - menuitem_get_properties_cb (proxy, properties, error, propdata->item); + menuitem_get_properties_cb (properties, error, propdata->item); gboolean handled = FALSE; -- cgit v1.2.3 From a03c508bbeb1267d2f3e9062f5d75b5fdbee9b05 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 15 Nov 2010 14:39:30 -0600 Subject: Adding prototypes for the variant functions we're going to need in menuitem --- libdbusmenu-glib/menuitem.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libdbusmenu-glib/menuitem.h b/libdbusmenu-glib/menuitem.h index ff8d713..802a8c4 100644 --- a/libdbusmenu-glib/menuitem.h +++ b/libdbusmenu-glib/menuitem.h @@ -189,10 +189,12 @@ DbusmenuMenuitem * dbusmenu_menuitem_find_id (DbusmenuMenuitem * mi, gint id); gboolean dbusmenu_menuitem_property_set (DbusmenuMenuitem * mi, const gchar * property, const gchar * value); gboolean dbusmenu_menuitem_property_set_value (DbusmenuMenuitem * mi, const gchar * property, const GValue * value); +gboolean dbusmenu_menuitem_property_set_variant (DbusmenuMenuitem * mi, const gchar * property, const GVariant * value); gboolean dbusmenu_menuitem_property_set_bool (DbusmenuMenuitem * mi, const gchar * property, const gboolean value); gboolean dbusmenu_menuitem_property_set_int (DbusmenuMenuitem * mi, const gchar * property, const gint value); const gchar * dbusmenu_menuitem_property_get (DbusmenuMenuitem * mi, const gchar * property); const GValue * dbusmenu_menuitem_property_get_value (DbusmenuMenuitem * mi, const gchar * property); +const GVariant * dbusmenu_menuitem_property_get_variant (DbusmenuMenuitem * mi, const gchar * property); gboolean dbusmenu_menuitem_property_get_bool (DbusmenuMenuitem * mi, const gchar * property); gint dbusmenu_menuitem_property_get_int (DbusmenuMenuitem * mi, const gchar * property); gboolean dbusmenu_menuitem_property_exist (DbusmenuMenuitem * mi, const gchar * property); -- cgit v1.2.3 From cbabf67cabb66079fa89d3972fea2aaee9543b5e Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 15 Nov 2010 14:46:12 -0600 Subject: Changing the prototypes for the get_properties wrappers --- libdbusmenu-glib/client.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index 23981de..c206e47 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -1150,7 +1150,7 @@ menuitem_get_properties_cb (GVariant * properties, GError * error, gpointer data is getting recycled with the update, but we think might have prop changes. */ static void -menuitem_get_properties_replace_cb (GDBusProxy * proxy, GHashTable * properties, GError * error, gpointer data) +menuitem_get_properties_replace_cb (GVariant * properties, GError * error, gpointer data) { g_return_if_fail(DBUSMENU_IS_MENUITEM(data)); gboolean have_error = FALSE; @@ -1181,7 +1181,7 @@ menuitem_get_properties_replace_cb (GDBusProxy * proxy, GHashTable * properties, /* This is a different get properites call back that also sends new signals. It basically is a small wrapper around the original. */ static void -menuitem_get_properties_new_cb (GDBusProxy * proxy, GHashTable * properties, GError * error, gpointer data) +menuitem_get_properties_new_cb (GVariant * properties, GError * error, gpointer data) { g_return_if_fail(data != NULL); newItemPropData * propdata = (newItemPropData *)data; -- cgit v1.2.3 From e911ad73aadd6cb2cb58771a750df1e600613c08 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 15 Nov 2010 15:20:38 -0600 Subject: Completely change layoutcall to be a GCancellable --- libdbusmenu-glib/client.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index c206e47..51113f0 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -360,7 +360,8 @@ dbusmenu_client_dispose (GObject *object) } if (priv->layoutcall != NULL) { - dbus_g_proxy_cancel_call(priv->menuproxy, priv->layoutcall); + g_cancellable_cancel(priv->layoutcall); + g_object_unref(priv->layoutcall); priv->layoutcall = NULL; } @@ -890,7 +891,11 @@ proxy_destroyed (GObject * gobj_proxy, gpointer userdata) } if ((gpointer)priv->menuproxy == (gpointer)gobj_proxy) { - priv->layoutcall = NULL; + if (priv->layoutcall != NULL) { + g_cancellable_cancel(priv->layoutcall); + g_object_unref(priv->layoutcall); + priv->layoutcall = NULL; + } } priv->current_revision = 0; @@ -1574,7 +1579,10 @@ update_layout_cb (GDBusProxy * proxy, guint rev, gchar * xml, GError * error, vo priv->my_revision = rev; /* g_debug("Root is now: 0x%X", (unsigned int)priv->root); */ - priv->layoutcall = NULL; + if (priv->layoutcall != NULL) { + g_object_unref(priv->layoutcall); + priv->layoutcall = NULL; + } #ifdef MASSIVEDEBUGGING g_debug("Client signaling layout has changed."); #endif @@ -1604,7 +1612,9 @@ update_layout (DbusmenuClient * client) return; } - priv->layoutcall = org_ayatana_dbusmenu_get_layout_async(priv->menuproxy, + priv->layoutcall = g_cancellable_new(); + + org_ayatana_dbusmenu_get_layout_async(priv->menuproxy, 0, /* Parent is the root */ update_layout_cb, client); -- cgit v1.2.3 From 187694edd077b979c6e19c511b5227791c3cd3f6 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 15 Nov 2010 15:21:48 -0600 Subject: A couple of clean ups from the compiler --- libdbusmenu-glib/client.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index 51113f0..2027e7a 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -318,7 +318,6 @@ dbusmenu_client_init (DbusmenuClient *self) static void dbusmenu_client_dispose (GObject *object) { - DbusmenuClient * client = DBUSMENU_CLIENT(object); DbusmenuClientPrivate * priv = DBUSMENU_CLIENT_GET_PRIVATE(object); if (priv->delayed_idle != 0) { @@ -665,7 +664,7 @@ get_properties_globber (DbusmenuClient * client, gint id, const gchar ** propert g_warning("Asking for properties from same ID twice: %d", id); GError * localerror = NULL; g_set_error_literal(&localerror, error_domain(), 0, "ID already queued"); - callback(priv->menuproxy, NULL, localerror, user_data); + callback(NULL, localerror, user_data); g_error_free(localerror); return; } -- cgit v1.2.3 From c4882fb11cece780073e56ba186e87b9cc2e90d7 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 15 Nov 2010 15:29:34 -0600 Subject: Switching over our call to AboutToShow --- libdbusmenu-glib/client.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index 2027e7a..ab3730d 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -1306,14 +1306,22 @@ struct _about_to_show_t { /* Reports errors and responds to update request that were a result of sending the about to show signal. */ static void -about_to_show_cb (GDBusProxy * proxy, gboolean need_update, GError * error, gpointer userdata) +about_to_show_cb (GObject * proxy, GAsyncResult * res, gpointer userdata) { + gboolean need_update = FALSE; + GError * error = NULL; about_to_show_t * data = (about_to_show_t *)userdata; + GVariant * params = NULL; + + params = g_dbus_proxy_call_finish(G_DBUS_PROXY(proxy), res, &error); if (error != NULL) { g_warning("Unable to send about_to_show: %s", error->message); /* Note: we're just ensuring only the callback gets called */ need_update = FALSE; + } else { + g_variant_get(params, "b", &need_update); + g_variant_unref(params); } /* If we need to update, do that first. */ @@ -1344,7 +1352,14 @@ dbusmenu_client_send_about_to_show(DbusmenuClient * client, gint id, void (*cb)( data->cb_data = cb_data; g_object_ref(client); - org_ayatana_dbusmenu_about_to_show_async (priv->menuproxy, id, about_to_show_cb, data); + g_dbus_proxy_call(priv->menuproxy, + "AboutToShow", + g_variant_new("i", id), + G_DBUS_CALL_FLAGS_NONE, + -1, /* timeout */ + NULL, /* cancellable */ + about_to_show_cb, + data); return; } -- cgit v1.2.3 From f60be7e8228a685fadc88e4b41ae707b5c67ec94 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 15 Nov 2010 15:39:00 -0600 Subject: Reshuffling update layout to use GDBus and GVariants --- libdbusmenu-glib/client.c | 38 ++++++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index ab3730d..7f6da7b 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -135,7 +135,7 @@ static void build_proxies (DbusmenuClient * client); static gint parse_node_get_id (xmlNodePtr node); static DbusmenuMenuitem * parse_layout_xml(DbusmenuClient * client, xmlNodePtr node, DbusmenuMenuitem * item, DbusmenuMenuitem * parent, GDBusProxy * proxy); static gint parse_layout (DbusmenuClient * client, const gchar * layout); -static void update_layout_cb (GDBusProxy * proxy, guint rev, gchar * xml, GError * in_error, void * data); +static void update_layout_cb (GObject * proxy, GAsyncResult * res, gpointer data); static void update_layout (DbusmenuClient * client); static void menuitem_get_properties_cb (GVariant * properties, GError * error, gpointer data); static void get_properties_globber (DbusmenuClient * client, gint id, const gchar ** properties, properties_func callback, gpointer user_data); @@ -1576,17 +1576,31 @@ parse_layout (DbusmenuClient * client, const gchar * layout) /* When the layout property returns, here's where we take care of that. */ static void -update_layout_cb (GDBusProxy * proxy, guint rev, gchar * xml, GError * error, void * data) +update_layout_cb (GObject * proxy, GAsyncResult * res, gpointer data) { - DbusmenuClient * client = DBUSMENU_CLIENT(data); - DbusmenuClientPrivate * priv = DBUSMENU_CLIENT_GET_PRIVATE(client); + GError * error = NULL; + GVariant * params = NULL; + + params = g_dbus_proxy_call_finish(G_DBUS_PROXY(proxy), res, &error); if (error != NULL) { - g_warning("Getting layout failed on client %s object %s: %s", priv->dbus_name, priv->dbus_object, error->message); + g_warning("Getting layout failed: %s", error->message); return; } - if (!parse_layout(client, xml)) { + guint rev; + gchar * xml; + + 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); + + if (parseable == 0) { g_warning("Unable to parse layout!"); return; } @@ -1628,10 +1642,14 @@ update_layout (DbusmenuClient * client) priv->layoutcall = g_cancellable_new(); - org_ayatana_dbusmenu_get_layout_async(priv->menuproxy, - 0, /* Parent is the root */ - update_layout_cb, - client); + g_dbus_proxy_call(priv->menuproxy, + "GetLayout", + g_variant_new("i", 0), /* root */ + G_DBUS_CALL_FLAGS_NONE, + -1, /* timeout */ + priv->layoutcall, /* cancellable */ + update_layout_cb, + client); return; } -- cgit v1.2.3 From 4d1386938c19e6819c3d7ae631336bc8f37bfc48 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 15 Nov 2010 15:51:03 -0600 Subject: Changing the 'Event' call to use GDBus and GVariant --- libdbusmenu-glib/client.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index 7f6da7b..3a47465 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -1237,9 +1237,13 @@ menuitem_get_properties_new_cb (GVariant * properties, GError * error, gpointer /* Respond to the call function to make sure that the other side got it, or print a warning. */ static void -menuitem_call_cb (GDBusProxy * proxy, GError * error, gpointer userdata) +menuitem_call_cb (GObject * proxy, GAsyncResult * res, gpointer userdata) { + GError * error = NULL; event_data_t * edata = (event_data_t *)userdata; + GVariant * params; + + params = g_dbus_proxy_call_finish(G_DBUS_PROXY(proxy), res, &error); if (error != NULL) { g_warning("Unable to call event '%s' on menu item %d: %s", edata->event, dbusmenu_menuitem_get_id(edata->menuitem), error->message); @@ -1252,6 +1256,11 @@ menuitem_call_cb (GDBusProxy * proxy, GError * error, gpointer userdata) g_object_unref(edata->menuitem); g_free(edata); + if (error != NULL) { + g_error_free(error); + } + g_variant_unref(params); + return; } @@ -1287,11 +1296,14 @@ dbusmenu_client_send_event (DbusmenuClient * client, gint id, const gchar * name g_value_copy(value, &edata->data); edata->timestamp = timestamp; - DBusGAsyncData *stuff; - stuff = g_slice_new (DBusGAsyncData); - stuff->cb = G_CALLBACK (menuitem_call_cb); - stuff->userdata = edata; - dbus_g_proxy_begin_call_with_timeout (priv->menuproxy, "Event", org_ayatana_dbusmenu_event_async_callback, stuff, _dbus_glib_async_data_free, 1000, G_TYPE_INT, id, G_TYPE_STRING, name, G_TYPE_VALUE, value, G_TYPE_UINT, timestamp, G_TYPE_INVALID); + g_dbus_proxy_call(priv->menuproxy, + "Event", + g_variant_new("isvu", id, name, value, timestamp), + G_DBUS_CALL_FLAGS_NONE, + 1000, /* timeout */ + NULL, /* cancellable */ + menuitem_call_cb, + edata); return; } -- cgit v1.2.3 From c5ddb96e4b861edf0d0281942bea99d22296d077 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 15 Nov 2010 16:00:35 -0600 Subject: Changing how the watcher is setup --- libdbusmenu-glib/client.c | 59 +++++++++++++++-------------------------------- 1 file changed, 19 insertions(+), 40 deletions(-) diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index 3a47465..f9584a9 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -82,7 +82,7 @@ struct _DbusmenuClientPrivate gint current_revision; gint my_revision; - GDBusProxy * dbusproxy; + guint dbusproxy; GHashTable * type_handlers; @@ -303,7 +303,7 @@ dbusmenu_client_init (DbusmenuClient *self) priv->current_revision = 0; priv->my_revision = 0; - priv->dbusproxy = NULL; + priv->dbusproxy = 0; priv->type_handlers = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); @@ -376,9 +376,9 @@ dbusmenu_client_dispose (GObject *object) priv->menuproxy = NULL; } - if (priv->dbusproxy != NULL) { - g_object_unref(G_OBJECT(priv->dbusproxy)); - priv->dbusproxy = NULL; + if (priv->dbusproxy != 0) { + g_bus_unwatch_name(priv->dbusproxy); + priv->dbusproxy = 0; } /* Bring down the session bus, ensure we're not @@ -790,23 +790,11 @@ id_update (GDBusProxy * proxy, gint id, DbusmenuClient * client) /* Watches to see if our DBus savior comes onto the bus */ static void -dbus_owner_change (GDBusProxy * proxy, const gchar * name, const gchar * prev, const gchar * new, DbusmenuClient * client) +dbus_owner_change (GDBusConnection * connection, const gchar * name, const gchar * owner, gpointer user_data) { - DbusmenuClientPrivate * priv = DBUSMENU_CLIENT_GET_PRIVATE(client); - /* g_debug("Owner change: %s %s %s", name, prev, new); */ - - if (!(new[0] != '\0' && prev[0] == '\0')) { - /* If it's not someone new getting on the bus, sorry we - simply just don't care. It's not that your service isn't - important to someone, just not us. You'll find the right - process someday, there's lots of processes out there. */ - return; - } + g_return_if_fail(DBUSMENU_IS_CLIENT(user_data)); - if (g_strcmp0(name, priv->dbus_name)) { - /* Again, someone else's service. */ - return; - } + DbusmenuClient * client = DBUSMENU_CLIENT(user_data); /* Woot! A service for us to love and to hold for ever and ever and ever! */ @@ -840,26 +828,17 @@ build_dbus_proxy (DbusmenuClient * client) DbusmenuClientPrivate * priv = DBUSMENU_CLIENT_GET_PRIVATE(client); GError * error = NULL; - if (priv->dbusproxy != NULL) { - return; - } - - priv->dbusproxy = dbus_g_proxy_new_for_name_owner (priv->session_bus, - DBUS_SERVICE_DBUS, - DBUS_PATH_DBUS, - DBUS_INTERFACE_DBUS, - &error); - if (error != NULL) { - g_debug("Oh, that's bad. That's really bad. We can't get a proxy to DBus itself? Seriously? Here's all I know: %s", error->message); - g_error_free(error); + if (priv->dbusproxy != 0) { return; } - dbus_g_proxy_add_signal(priv->dbusproxy, "NameOwnerChanged", - G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, - G_TYPE_INVALID); - dbus_g_proxy_connect_signal(priv->dbusproxy, "NameOwnerChanged", - G_CALLBACK(dbus_owner_change), client, NULL); + priv->dbusproxy = g_bus_watch_name_on_connection(priv->session_bus, + priv->dbus_name, + G_BUS_NAME_WATCHER_FLAGS_NONE, + dbus_owner_change, + NULL, + client, + NULL); /* Now let's check to make sure we're not in some race condition case. */ @@ -1011,9 +990,9 @@ menuproxy_build_cb (GObject * object, GAsyncResult * res, gpointer user_data) } /* If we get here, we don't need the DBus proxy */ - if (priv->dbusproxy != NULL) { - g_object_unref(G_OBJECT(priv->dbusproxy)); - priv->dbusproxy = NULL; + if (priv->dbusproxy != 0) { + g_bus_unwatch(priv->dbusproxy); + priv->dbusproxy = 0; } g_signal_connect(priv->menuproxy, "g-signal", G_CALLBACK(menuproxy_signal_cb), client); -- cgit v1.2.3 From 7fd7547baeb728c162de08b7278ebbbff81832d3 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 15 Nov 2010 16:09:34 -0600 Subject: Dropping the name check, need to figure out another way to do this. --- libdbusmenu-glib/client.c | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index f9584a9..563fbe0 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -801,25 +801,6 @@ dbus_owner_change (GDBusConnection * connection, const gchar * name, const gchar return build_proxies(client); } -/* This is the response to see if the name has an owner. If - it does, then we should build the proxies here. Race condition - check. */ -static void -name_owner_check (GDBusProxy *proxy, gboolean has_owner, GError *error, gpointer userdata) -{ - if (error != NULL) { - return; - } - - if (!has_owner) { - return; - } - - DbusmenuClient * client = DBUSMENU_CLIENT(userdata); - build_proxies(client); - return; -} - /* This function builds the DBus proxy which will look out for the service coming up. */ static void @@ -842,10 +823,7 @@ build_dbus_proxy (DbusmenuClient * client) /* Now let's check to make sure we're not in some race condition case. */ - org_freedesktop_DBus_name_has_owner_async(priv->dbusproxy, - priv->dbus_name, - name_owner_check, - client); + /* TODO: Not sure how to check for names in GDBus */ return; } -- cgit v1.2.3 From fb8c8e53f6bcbac9e589e1ee86a364765ce4ec83 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 15 Nov 2010 16:15:04 -0600 Subject: A set of basically typos caught by the compiler --- libdbusmenu-glib/client.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index 563fbe0..8658104 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -807,7 +807,6 @@ static void build_dbus_proxy (DbusmenuClient * client) { DbusmenuClientPrivate * priv = DBUSMENU_CLIENT_GET_PRIVATE(client); - GError * error = NULL; if (priv->dbusproxy != 0) { return; @@ -878,6 +877,7 @@ session_bus_cb (GObject * object, GAsyncResult * res, gpointer user_data) } /* If this wasn't cancelled, we should be good */ + DbusmenuClient * client = DBUSMENU_CLIENT(user_data); DbusmenuClientPrivate * priv = DBUSMENU_CLIENT_GET_PRIVATE(client); priv->session_bus = bus; @@ -898,7 +898,6 @@ static void build_proxies (DbusmenuClient * client) { DbusmenuClientPrivate * priv = DBUSMENU_CLIENT_GET_PRIVATE(client); - GError * error = NULL; g_return_if_fail(priv->dbus_object != NULL); g_return_if_fail(priv->dbus_name != NULL); @@ -912,7 +911,7 @@ build_proxies (DbusmenuClient * client) priv->session_bus_cancel = g_cancellable_new(); /* Async get the session bus */ - g_bus_get(G_BUS_SESSION, priv->session_bus_cancel, session_bus_cb, client); + g_bus_get(G_BUS_TYPE_SESSION, priv->session_bus_cancel, session_bus_cb, client); } /* This function exists, it'll be called again when we get @@ -959,7 +958,8 @@ menuproxy_build_cb (GObject * object, GAsyncResult * res, gpointer user_data) } /* If this wasn't cancelled, we should be good */ - DbusmenuClientPrivate * priv = DBUSMENU_CLIENT_GET_PRIVATE(user_data); + DbusmenuClient * client = DBUSMENU_CLIENT(user_data); + DbusmenuClientPrivate * priv = DBUSMENU_CLIENT_GET_PRIVATE(client); priv->menuproxy = proxy; if (priv->menuproxy_cancel != NULL) { @@ -969,7 +969,7 @@ menuproxy_build_cb (GObject * object, GAsyncResult * res, gpointer user_data) /* If we get here, we don't need the DBus proxy */ if (priv->dbusproxy != 0) { - g_bus_unwatch(priv->dbusproxy); + g_bus_unwatch_name(priv->dbusproxy); priv->dbusproxy = 0; } -- cgit v1.2.3 From 1b970b18f1ef93c597ae4d079eba78340eaced20 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 15 Nov 2010 16:16:29 -0600 Subject: Changing property update to use variants --- libdbusmenu-glib/client.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index 8658104..18cbfce 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -129,7 +129,7 @@ static void set_property (GObject * obj, guint id, const GValue * value, GParamS static void get_property (GObject * obj, guint id, GValue * value, GParamSpec * pspec); /* Private Funcs */ static void layout_update (GDBusProxy * proxy, guint revision, gint parent, DbusmenuClient * client); -static void id_prop_update (GDBusProxy * proxy, gint id, gchar * property, GValue * value, DbusmenuClient * client); +static void id_prop_update (GDBusProxy * proxy, gint id, gchar * property, GVariant * value, DbusmenuClient * client); static void id_update (GDBusProxy * proxy, gint id, DbusmenuClient * client); static void build_proxies (DbusmenuClient * client); static gint parse_node_get_id (xmlNodePtr node); @@ -740,16 +740,8 @@ layout_update (GDBusProxy * proxy, guint revision, gint parent, DbusmenuClient * /* Signal from the server that a property has changed on one of our menuitems */ static void -id_prop_update (GDBusProxy * proxy, gint id, gchar * property, GValue * value, DbusmenuClient * client) +id_prop_update (GDBusProxy * proxy, gint id, gchar * property, GVariant * value, DbusmenuClient * client) { - #ifdef MASSIVEDEBUGGING - GValue valstr = {0}; - g_value_init(&valstr, G_TYPE_STRING); - g_value_transform(value, &valstr); - g_debug("Property change sent to client for item %d property %s value %s", id, property, g_utf8_strlen(g_value_get_string(&valstr), 50) < 25 ? g_value_get_string(&valstr) : ""); - g_value_unset(&valstr); - #endif - DbusmenuClientPrivate * priv = DBUSMENU_CLIENT_GET_PRIVATE(client); g_return_if_fail(priv->root != NULL); @@ -762,7 +754,7 @@ id_prop_update (GDBusProxy * proxy, gint id, gchar * property, GValue * value, D return; } - dbusmenu_menuitem_property_set_value(menuitem, property, value); + dbusmenu_menuitem_property_set_variant(menuitem, property, value); return; } -- cgit v1.2.3 From ab90d78d2079ac5dbdd8c6ae259e893559307246 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 15 Nov 2010 16:20:35 -0600 Subject: Removing the lookup in the properties to see if an item should be replaced, since we're calling all of them, I don't think we want any leftovers. --- libdbusmenu-glib/client.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index 18cbfce..f25ed7d 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -1116,11 +1116,11 @@ menuitem_get_properties_replace_cb (GVariant * properties, GError * error, gpoin GList * current_props = NULL; for (current_props = dbusmenu_menuitem_properties_list(DBUSMENU_MENUITEM(data)); - current_props != NULL ; current_props = g_list_next(current_props)) { - if (have_error || g_hash_table_lookup(properties, current_props->data) == NULL) { - dbusmenu_menuitem_property_remove(DBUSMENU_MENUITEM(data), (const gchar *)current_props->data); - } + current_props != NULL && have_error == FALSE; + current_props = g_list_next(current_props)) { + dbusmenu_menuitem_property_remove(DBUSMENU_MENUITEM(data), (const gchar *)current_props->data); } + g_list_free(current_props); if (!have_error) { menuitem_get_properties_cb(properties, error, data); -- cgit v1.2.3 From 80ab7485e816b687caeee4d6f0395ba010b99d2e Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 15 Nov 2010 16:21:07 -0600 Subject: Oops, unused helper --- libdbusmenu-glib/client.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index f25ed7d..ff7d5ec 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -1055,15 +1055,6 @@ parse_node_get_id (xmlNodePtr node) return -1; } -/* A small helper that calls _property_set on each hash table - entry in the properties hash. */ -static void -get_properties_helper (gpointer key, gpointer value, gpointer data) -{ - dbusmenu_menuitem_property_set_value((DbusmenuMenuitem *)data, (gchar *)key, (GValue *)value); - return; -} - /* This is the callback for the properties on a menu item. There should be all of them in the Hash, and they we use foreach to copy them into the menuitem. -- cgit v1.2.3 From bf33041c44cc9edd029a2ebe1359a78103f8e9f9 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 15 Nov 2010 16:25:49 -0600 Subject: Some stub functions so that we can compile --- libdbusmenu-glib/menuitem.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index 5e700a5..7497697 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -1021,6 +1021,13 @@ dbusmenu_menuitem_property_set_value (DbusmenuMenuitem * mi, const gchar * prope return TRUE; } +gboolean +dbusmenu_menuitem_property_set_variant (DbusmenuMenuitem * mi, const gchar * property, const GVariant * value) +{ + + return FALSE; +} + /** dbusmenu_menuitem_property_get: @mi: The #DbusmenuMenuitem to look for the property on. @@ -1065,6 +1072,13 @@ dbusmenu_menuitem_property_get_value (DbusmenuMenuitem * mi, const gchar * prope return (const GValue *)g_hash_table_lookup(priv->properties, property); } +const GVariant * +dbusmenu_menuitem_property_get_variant (DbusmenuMenuitem * mi, const gchar * property) +{ + + return NULL; +} + /** dbusmenu_menuitem_property_get_bool: @mi: The #DbusmenuMenuitem to look for the property on. -- cgit v1.2.3 From 080cf37f48dba3dc521167bd3ddc51f45681ea1d Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 15 Nov 2010 16:55:43 -0600 Subject: Cleaning out namespaces from the XML so that GDBus will read it. --- libdbusmenu-glib/Makefile.am | 13 +++++++++---- libdbusmenu-glib/clean-namespaces.xslt | 9 +++++++++ libdbusmenu-glib/client.c | 4 ++-- libdbusmenu-glib/server.c | 4 ++-- 4 files changed, 22 insertions(+), 8 deletions(-) create mode 100644 libdbusmenu-glib/clean-namespaces.xslt diff --git a/libdbusmenu-glib/Makefile.am b/libdbusmenu-glib/Makefile.am index be70cfa..4e97428 100644 --- a/libdbusmenu-glib/Makefile.am +++ b/libdbusmenu-glib/Makefile.am @@ -2,6 +2,7 @@ CLEANFILES = EXTRA_DIST = \ + clean-namespaces.xslt \ dbusmenu-glib.pc.in \ dbus-menu.xml \ client-marshal.list \ @@ -20,8 +21,8 @@ libdbusmenu_glibinclude_HEADERS = \ client.h libdbusmenu_glib_la_SOURCES = \ - dbus-menu.xml.h \ - dbus-menu.xml.c \ + dbus-menu-clean.xml.h \ + dbus-menu-clean.xml.c \ menuitem.h \ menuitem.c \ menuitem-marshal.h \ @@ -62,10 +63,14 @@ pkgconfigdir = $(libdir)/pkgconfig sed -e "s:\":\\\\\":g" -e s:^:\": -e s:\$$:\\\\n\": $< >> $@ echo ";" >> $@ +dbus-menu-clean.xml: dbus-menu.xml + xsltproc $(srcdir)/clean-namespaces.xslt $< > $@ + +CLEANFILES += dbus-menu-clean.xml BUILT_SOURCES = \ - dbus-menu.xml.c \ - dbus-menu.xml.h \ + dbus-menu-clean.xml.c \ + dbus-menu-clean.xml.h \ client-marshal.h \ client-marshal.c \ menuitem-marshal.h \ diff --git a/libdbusmenu-glib/clean-namespaces.xslt b/libdbusmenu-glib/clean-namespaces.xslt new file mode 100644 index 0000000..125a10f --- /dev/null +++ b/libdbusmenu-glib/clean-namespaces.xslt @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index ff7d5ec..7c90fa6 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -41,7 +41,7 @@ License version 3 and version 2.1 along with this program. If not, see #include "client-menuitem.h" #include "server-marshal.h" #include "client-marshal.h" -#include "dbus-menu.xml.h" +#include "dbus-menu-clean.xml.h" /* Properties */ enum { @@ -262,7 +262,7 @@ dbusmenu_client_class_init (DbusmenuClientClass *klass) if (dbusmenu_node_info == NULL) { GError * error = NULL; - dbusmenu_node_info = g_dbus_node_info_new_for_xml(dbus_menu_xml, &error); + dbusmenu_node_info = g_dbus_node_info_new_for_xml(dbus_menu_clean_xml, &error); if (error != NULL) { g_error("Unable to parse DBusmenu Interface description: %s", error->message); g_error_free(error); diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c index 652b2a8..63d237f 100644 --- a/libdbusmenu-glib/server.c +++ b/libdbusmenu-glib/server.c @@ -36,7 +36,7 @@ License version 3 and version 2.1 along with this program. If not, see #include "server.h" #include "server-marshal.h" -#include "dbus-menu.xml.h" +#include "dbus-menu-clean.xml.h" static void layout_update_signal (DbusmenuServer * server); @@ -288,7 +288,7 @@ dbusmenu_server_class_init (DbusmenuServerClass *class) if (dbusmenu_node_info == NULL) { GError * error = NULL; - dbusmenu_node_info = g_dbus_node_info_new_for_xml(dbus_menu_xml, &error); + dbusmenu_node_info = g_dbus_node_info_new_for_xml(dbus_menu_clean_xml, &error); if (error != NULL) { g_error("Unable to parse DBusmenu Interface description: %s", error->message); g_error_free(error); -- cgit v1.2.3 From d40345acf5e69fea2e87f03cc94cc6c29cadd421 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 15 Nov 2010 16:58:01 -0600 Subject: Ignoring the new temp files --- .bzrignore | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.bzrignore b/.bzrignore index c60cc9c..b6ed6f4 100644 --- a/.bzrignore +++ b/.bzrignore @@ -197,3 +197,7 @@ tests/test-glib-events-server libdbusmenu-glib/dbus-menu.xml.c libdbusmenu-glib/dbus-menu.xml.h libdbusmenu-glib/libdbusmenu_glib_la-dbus-menu.xml.lo +libdbusmenu-glib/dbus-menu-clean.xml +libdbusmenu-glib/dbus-menu-clean.xml.c +libdbusmenu-glib/dbus-menu-clean.xml.h +libdbusmenu-glib/libdbusmenu_glib_la-dbus-menu-clean.xml.lo -- cgit v1.2.3 From a8fc233f37e08f52ed7ca80fbd284277ca1bd33e Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 16 Nov 2010 11:23:46 -0600 Subject: Taking out the dbus-glib specialized types for now --- tests/json-loader.c | 51 ++------------------------------------------------- 1 file changed, 2 insertions(+), 49 deletions(-) diff --git a/tests/json-loader.c b/tests/json-loader.c index aad4295..9e67666 100644 --- a/tests/json-loader.c +++ b/tests/json-loader.c @@ -20,7 +20,6 @@ with this program. If not, see . */ #include "json-loader.h" -#include static GValue * node2value (JsonNode * node) @@ -74,58 +73,12 @@ node2value (JsonNode * node) } } else { - GValue * subvalue = node2value(first); - GType type = dbus_g_type_get_collection("GPtrArray", G_VALUE_TYPE(subvalue)); - gpointer * wrapper = dbus_g_type_specialized_construct(type); - - g_value_init(value, type); - g_value_take_boxed(value, wrapper); - - DBusGTypeSpecializedAppendContext ctx; - dbus_g_type_specialized_init_append(value, &ctx); - - dbus_g_type_specialized_collection_append(&ctx, subvalue); - int i; - for (i = 1; i < json_array_get_length(array); i++) { - GValue * subvalue = node2value(node); - dbus_g_type_specialized_collection_append(&ctx, subvalue); - } - - dbus_g_type_specialized_collection_end_append(&ctx); + g_warning("Complex array not supported"); } } if (JSON_NODE_TYPE(node) == JSON_NODE_OBJECT) { - JsonObject * obj = json_node_get_object(node); - - GType type = dbus_g_type_get_map("GHashTable", G_TYPE_STRING, G_TYPE_VALUE); - GHashTable * hash = (GHashTable *)dbus_g_type_specialized_construct(type); - - g_value_init(value, type); - g_value_take_boxed(value, hash); - - DBusGTypeSpecializedAppendContext ctx; - dbus_g_type_specialized_init_append(value, &ctx); - - GList * members = NULL; - for (members = json_object_get_members(obj); members != NULL; members = g_list_next(members)) { - const gchar * member = members->data; - - JsonNode * lnode = json_object_get_member(obj, member); - GValue * value = node2value(lnode); - - if (value != NULL) { - GValue name = {0}; - g_value_init(&name, G_TYPE_STRING); - g_value_set_static_string(&name, member); - - dbus_g_type_specialized_map_append(&ctx, &name, value); - - g_value_unset(&name); - g_value_unset(value); - g_free(value); - } - } + g_warning("Object nodes are a problem"); } return value; -- cgit v1.2.3 From 5d804e383706aba3c7e8014931d88378a1774c85 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 16 Nov 2010 12:59:06 -0600 Subject: Glib version is using GIO now --- configure.ac | 1 + 1 file changed, 1 insertion(+) diff --git a/configure.ac b/configure.ac index c8d18b1..e0d4b28 100644 --- a/configure.ac +++ b/configure.ac @@ -36,6 +36,7 @@ GLIB_REQUIRED_VERSION=2.18 XML_REQUIRED_VERSION=2.6 PKG_CHECK_MODULES(DBUSMENUGLIB, glib-2.0 >= $GLIB_REQUIRED_VERSION + gio-2.0 >= $GLIB_REQUIRED_VERSION libxml-2.0 >= $XML_REQUIRED_VERSION) AC_SUBST(DBUSMENUGLIB_CFLAGS) -- cgit v1.2.3 From 94d5da983e2d1d64d6cf4249237b6ba009102286 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 16 Nov 2010 13:46:26 -0600 Subject: Switching to GDBus from dbus-glib --- tests/test-glib-events-server.c | 55 +++++++++++++++++++++-------------------- 1 file changed, 28 insertions(+), 27 deletions(-) diff --git a/tests/test-glib-events-server.c b/tests/test-glib-events-server.c index 0d1e0b1..ab72c6b 100644 --- a/tests/test-glib-events-server.c +++ b/tests/test-glib-events-server.c @@ -20,11 +20,7 @@ with this program. If not, see . */ #include - -#include -#include -#include -#include +#include #include #include @@ -49,35 +45,40 @@ timer_func (gpointer data) return FALSE; } -int -main (int argc, char ** argv) +static void +on_bus (GDBusConnection * connection, const gchar * name, gpointer user_data) { - GError * error = NULL; - - g_type_init(); - - DBusGConnection * connection = dbus_g_bus_get(DBUS_BUS_SESSION, NULL); - g_debug("DBus ID: %s", dbus_connection_get_server_id(dbus_g_connection_get_connection(dbus_g_bus_get(DBUS_BUS_SESSION, NULL)))); - - DBusGProxy * bus_proxy = dbus_g_proxy_new_for_name(connection, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS); - guint nameret = 0; - - if (!org_freedesktop_DBus_request_name(bus_proxy, "org.dbusmenu.test", 0, &nameret, &error)) { - g_error("Unable to call to request name"); - return 1; - } - - if (nameret != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) { - g_error("Unable to get name"); - return 1; - } - server = dbusmenu_server_new("/org/test"); DbusmenuMenuitem * menuitem = dbusmenu_menuitem_new(); dbusmenu_server_set_root(server, menuitem); g_signal_connect(G_OBJECT(menuitem), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(handle_event), NULL); + return; +} + +static void +name_lost (GDBusConnection * connection, const gchar * name, gpointer user_data) +{ + g_error("Unable to get name '%s' on DBus", name); + g_main_loop_quit(mainloop); + return; +} + +int +main (int argc, char ** argv) +{ + g_type_init(); + + g_bus_own_name(G_BUS_TYPE_SESSION, + "org.dbusmenu.test", + G_BUS_NAME_OWNER_FLAGS_NONE, + on_bus, + NULL, + name_lost, + NULL, + NULL); + g_timeout_add_seconds(3, timer_func, NULL); mainloop = g_main_loop_new(NULL, FALSE); -- cgit v1.2.3 From 9bdfb119a18873a4c564865fd7b399940f0ad9bb Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 16 Nov 2010 14:16:06 -0600 Subject: Fix error handling on the xslt script --- 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 4e97428..3746b49 100644 --- a/libdbusmenu-glib/Makefile.am +++ b/libdbusmenu-glib/Makefile.am @@ -64,7 +64,7 @@ pkgconfigdir = $(libdir)/pkgconfig echo ";" >> $@ dbus-menu-clean.xml: dbus-menu.xml - xsltproc $(srcdir)/clean-namespaces.xslt $< > $@ + xsltproc $(srcdir)/clean-namespaces.xslt $< > $@ || rm -f $@ && /bin/false CLEANFILES += dbus-menu-clean.xml -- cgit v1.2.3 From d16f4ab9fee7ebc3a38631ab8efc4e0464923e8f Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 16 Nov 2010 14:29:35 -0600 Subject: Ooops, fix the booleans --- 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 3746b49..db4ed4b 100644 --- a/libdbusmenu-glib/Makefile.am +++ b/libdbusmenu-glib/Makefile.am @@ -64,7 +64,7 @@ pkgconfigdir = $(libdir)/pkgconfig echo ";" >> $@ dbus-menu-clean.xml: dbus-menu.xml - xsltproc $(srcdir)/clean-namespaces.xslt $< > $@ || rm -f $@ && /bin/false + xsltproc $(srcdir)/clean-namespaces.xslt $< > $@ || (rm -f $@ && /bin/false) CLEANFILES += dbus-menu-clean.xml -- cgit v1.2.3 From e53602cd25b7057c02e95a9e49363acb32ae47a7 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 16 Nov 2010 15:14:33 -0600 Subject: Wow, that blows things out. Nice! --- libdbusmenu-glib/clean-namespaces.xslt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libdbusmenu-glib/clean-namespaces.xslt b/libdbusmenu-glib/clean-namespaces.xslt index 125a10f..8344a71 100644 --- a/libdbusmenu-glib/clean-namespaces.xslt +++ b/libdbusmenu-glib/clean-namespaces.xslt @@ -5,5 +5,10 @@ + + + + + -- cgit v1.2.3 From 6fc56d02acbb80a166837ed226fbe24bd3635fca Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 16 Nov 2010 15:30:39 -0600 Subject: Switching to GDBus for getting the name --- tests/test-glib-layout-server.c | 53 +++++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/tests/test-glib-layout-server.c b/tests/test-glib-layout-server.c index 111e164..e289349 100644 --- a/tests/test-glib-layout-server.c +++ b/tests/test-glib-layout-server.c @@ -20,11 +20,7 @@ with this program. If not, see . */ #include - -#include -#include -#include -#include +#include #include #include @@ -72,33 +68,38 @@ timer_func (gpointer data) return TRUE; } -int -main (int argc, char ** argv) +static void +on_bus (GDBusConnection * connection, const gchar * name, gpointer user_data) { - GError * error = NULL; - - g_type_init(); - - DBusGConnection * connection = dbus_g_bus_get(DBUS_BUS_SESSION, NULL); - g_debug("DBus ID: %s", dbus_connection_get_server_id(dbus_g_connection_get_connection(dbus_g_bus_get(DBUS_BUS_SESSION, NULL)))); + server = dbusmenu_server_new("/org/test"); - DBusGProxy * bus_proxy = dbus_g_proxy_new_for_name(connection, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS); - guint nameret = 0; + timer_func(NULL); + g_timeout_add(2500, timer_func, NULL); - if (!org_freedesktop_DBus_request_name(bus_proxy, "org.dbusmenu.test", 0, &nameret, &error)) { - g_error("Unable to call to request name"); - return 1; - } + return; +} - if (nameret != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) { - g_error("Unable to get name"); - return 1; - } +static void +name_lost (GDBusConnection * connection, const gchar * name, gpointer user_data) +{ + g_error("Unable to get name '%s' on DBus", name); + g_main_loop_quit(mainloop); + return; +} - server = dbusmenu_server_new("/org/test"); +int +main (int argc, char ** argv) +{ + g_type_init(); - timer_func(NULL); - g_timeout_add(2500, timer_func, NULL); + g_bus_own_name(G_BUS_TYPE_SESSION, + "org.dbusmenu.test", + G_BUS_NAME_OWNER_FLAGS_NONE, + on_bus, + NULL, + name_lost, + NULL, + NULL); mainloop = g_main_loop_new(NULL, FALSE); g_main_loop_run(mainloop); -- cgit v1.2.3 From b09ed309175070d38bc4351d02f23b0ef757008c Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 16 Nov 2010 15:47:10 -0600 Subject: More name grabbing porting from dbus-glib to GDBus --- tests/test-glib-properties-server.c | 7 +---- tests/test-glib-proxy-proxy.c | 55 +++++++++++++++++++------------------ tests/test-glib-proxy-server.c | 51 +++++++++++++++++----------------- 3 files changed, 55 insertions(+), 58 deletions(-) diff --git a/tests/test-glib-properties-server.c b/tests/test-glib-properties-server.c index 091e550..4248ea2 100644 --- a/tests/test-glib-properties-server.c +++ b/tests/test-glib-properties-server.c @@ -20,10 +20,7 @@ with this program. If not, see . */ #include - -#include -#include -#include +#include #include #include @@ -91,8 +88,6 @@ main (int argc, char ** argv) { g_type_init(); - g_debug("DBus ID: %s", dbus_connection_get_server_id(dbus_g_connection_get_connection(dbus_g_bus_get(DBUS_BUS_SESSION, NULL)))); - server = dbusmenu_server_new("/org/test"); timer_func(NULL); diff --git a/tests/test-glib-proxy-proxy.c b/tests/test-glib-proxy-proxy.c index 722cf1f..b9db620 100644 --- a/tests/test-glib-proxy-proxy.c +++ b/tests/test-glib-proxy-proxy.c @@ -1,9 +1,5 @@ #include - -#include -#include -#include -#include +#include #include #include @@ -32,6 +28,25 @@ root_changed (DbusmenuClient * client, DbusmenuMenuitem * newroot, gpointer user return; } +static void +on_bus (GDBusConnection * connection, const gchar * name, gpointer user_data) +{ + server = dbusmenu_server_new("/org/test"); + client = dbusmenu_client_new((gchar *)user_data, "/org/test"); + + g_signal_connect(client, DBUSMENU_CLIENT_SIGNAL_ROOT_CHANGED, G_CALLBACK(root_changed), server); + + return; +} + +static void +name_lost (GDBusConnection * connection, const gchar * name, gpointer user_data) +{ + g_error("Unable to get name '%s' on DBus", name); + g_main_loop_quit(mainloop); + return; +} + int main (int argc, char ** argv) { @@ -47,28 +62,14 @@ main (int argc, char ** argv) g_debug("I am '%s' and I'm proxying '%s'", whoami, myproxy); - GError * error = NULL; - DBusGConnection * connection = dbus_g_bus_get(DBUS_BUS_SESSION, NULL); - - g_debug("DBus ID: %s", dbus_connection_get_server_id(dbus_g_connection_get_connection(connection))); - - DBusGProxy * bus_proxy = dbus_g_proxy_new_for_name(connection, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS); - guint nameret = 0; - - if (!org_freedesktop_DBus_request_name(bus_proxy, whoami, 0, &nameret, &error)) { - g_error("Unable to call to request name"); - return 1; - } - - if (nameret != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) { - g_error("Unable to get name"); - return 1; - } - - server = dbusmenu_server_new("/org/test"); - client = dbusmenu_client_new(myproxy, "/org/test"); - - g_signal_connect(client, DBUSMENU_CLIENT_SIGNAL_ROOT_CHANGED, G_CALLBACK(root_changed), server); + g_bus_own_name(G_BUS_TYPE_SESSION, + "org.dbusmenu.test", + G_BUS_NAME_OWNER_FLAGS_NONE, + on_bus, + NULL, + name_lost, + myproxy, + NULL); mainloop = g_main_loop_new(NULL, FALSE); g_main_loop_run(mainloop); diff --git a/tests/test-glib-proxy-server.c b/tests/test-glib-proxy-server.c index f32b426..c12a584 100644 --- a/tests/test-glib-proxy-server.c +++ b/tests/test-glib-proxy-server.c @@ -20,11 +20,7 @@ with this program. If not, see . */ #include - -#include -#include -#include -#include +#include #include #include @@ -104,31 +100,36 @@ layout_change (DbusmenuMenuitem * oldroot, guint timestamp, gpointer data) return; } -int -main (int argc, char ** argv) +static void +on_bus (GDBusConnection * connection, const gchar * name, gpointer user_data) { - g_type_init(); - - GError * error = NULL; - DBusGConnection * connection = dbus_g_bus_get(DBUS_BUS_SESSION, NULL); - - g_debug("DBus ID: %s", dbus_connection_get_server_id(dbus_g_connection_get_connection(connection))); + server = dbusmenu_server_new("/org/test"); + layout_change(NULL, 0, NULL); - DBusGProxy * bus_proxy = dbus_g_proxy_new_for_name(connection, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS); - guint nameret = 0; + return; +} - if (!org_freedesktop_DBus_request_name(bus_proxy, "test.proxy.server", 0, &nameret, &error)) { - g_error("Unable to call to request name"); - return 1; - } +static void +name_lost (GDBusConnection * connection, const gchar * name, gpointer user_data) +{ + g_error("Unable to get name '%s' on DBus", name); + g_main_loop_quit(mainloop); + return; +} - if (nameret != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) { - g_error("Unable to get name"); - return 1; - } +int +main (int argc, char ** argv) +{ + g_type_init(); - server = dbusmenu_server_new("/org/test"); - layout_change(NULL, 0, NULL); + g_bus_own_name(G_BUS_TYPE_SESSION, + "org.dbusmenu.test", + G_BUS_NAME_OWNER_FLAGS_NONE, + on_bus, + NULL, + name_lost, + NULL, + NULL); mainloop = g_main_loop_new(NULL, FALSE); g_main_loop_run(mainloop); -- cgit v1.2.3 From d2eaaa6de0019da3bb9202dc0cb194ca5ef9d79f Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 16 Nov 2010 16:25:24 -0600 Subject: It doesn't really match standard GVariant syntax to have this be a const --- libdbusmenu-glib/menuitem.c | 2 +- libdbusmenu-glib/menuitem.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index 7497697..80d9df4 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -1072,7 +1072,7 @@ dbusmenu_menuitem_property_get_value (DbusmenuMenuitem * mi, const gchar * prope return (const GValue *)g_hash_table_lookup(priv->properties, property); } -const GVariant * +GVariant * dbusmenu_menuitem_property_get_variant (DbusmenuMenuitem * mi, const gchar * property) { diff --git a/libdbusmenu-glib/menuitem.h b/libdbusmenu-glib/menuitem.h index 802a8c4..1dbad9d 100644 --- a/libdbusmenu-glib/menuitem.h +++ b/libdbusmenu-glib/menuitem.h @@ -194,7 +194,7 @@ gboolean dbusmenu_menuitem_property_set_bool (DbusmenuMenuitem * mi, const gchar gboolean dbusmenu_menuitem_property_set_int (DbusmenuMenuitem * mi, const gchar * property, const gint value); const gchar * dbusmenu_menuitem_property_get (DbusmenuMenuitem * mi, const gchar * property); const GValue * dbusmenu_menuitem_property_get_value (DbusmenuMenuitem * mi, const gchar * property); -const GVariant * dbusmenu_menuitem_property_get_variant (DbusmenuMenuitem * mi, const gchar * property); +GVariant * dbusmenu_menuitem_property_get_variant (DbusmenuMenuitem * mi, const gchar * property); gboolean dbusmenu_menuitem_property_get_bool (DbusmenuMenuitem * mi, const gchar * property); gint dbusmenu_menuitem_property_get_int (DbusmenuMenuitem * mi, const gchar * property); gboolean dbusmenu_menuitem_property_exist (DbusmenuMenuitem * mi, const gchar * property); -- cgit v1.2.3 From 726e8b11f2938a229b5ff75979031aafdbacf60d Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 16 Nov 2010 16:27:53 -0600 Subject: Redoing the handling of shortcuts to use GVariants rather than GValues --- libdbusmenu-gtk/menuitem.c | 128 +++++++++++++++------------------------------ 1 file changed, 41 insertions(+), 87 deletions(-) diff --git a/libdbusmenu-gtk/menuitem.c b/libdbusmenu-gtk/menuitem.c index 5846aa7..9c1cfd2 100644 --- a/libdbusmenu-gtk/menuitem.c +++ b/libdbusmenu-gtk/menuitem.c @@ -29,7 +29,6 @@ License version 3 and version 2.1 along with this program. If not, see #include "menuitem.h" #include #include -#include /** dbusmenu_menuitem_property_set_image: @@ -201,25 +200,16 @@ dbusmenu_menuitem_property_set_shortcut (DbusmenuMenuitem * menuitem, guint key, const gchar * keyname = gdk_keyval_name(key); g_array_append_val(array, keyname); - GType type = dbus_g_type_get_collection("GPtrArray", G_TYPE_STRV); - GPtrArray * wrapper = (GPtrArray *)dbus_g_type_specialized_construct(type); + GVariant * inside = g_variant_new("as", array->data); + GVariantBuilder builder; + g_variant_builder_init(&builder, G_VARIANT_TYPE("av")); + g_variant_builder_add_value(&builder, inside); + GVariant * outsidevariant = g_variant_builder_end(&builder); - GValue value = {0,}; - g_value_init(&value, type); - g_value_take_boxed(&value, wrapper); + dbusmenu_menuitem_property_set_variant(menuitem, DBUSMENU_MENUITEM_PROP_SHORTCUT, outsidevariant); - DBusGTypeSpecializedAppendContext ctx; - dbus_g_type_specialized_init_append(&value, &ctx); - - GValue strval = {0,}; - g_value_init(&strval, G_TYPE_STRV); - g_value_take_boxed(&strval, array->data); - g_array_free(array, FALSE); - - dbus_g_type_specialized_collection_append(&ctx, &strval); - dbus_g_type_specialized_collection_end_append(&ctx); - - dbusmenu_menuitem_property_set_value(menuitem, DBUSMENU_MENUITEM_PROP_SHORTCUT, &value); + g_variant_unref(outsidevariant); + g_variant_unref(inside); return TRUE; } @@ -279,68 +269,6 @@ dbusmenu_menuitem_property_set_shortcut_menuitem (DbusmenuMenuitem * menuitem, c return dbusmenu_menuitem_property_set_shortcut(menuitem, key->accel_key, key->accel_mods); } -/* A set of typed data for the interator */ -typedef struct _iter_data_t iter_data_t; -struct _iter_data_t { - guint * key; - GdkModifierType * modifier; -}; - -/* Goes through the wrapper items. In reality we only support one - so it checks to see if a key is set first. But, we could possibly, - support more in the future. */ -static void -_wrapper_iterator (const GValue * value, gpointer user_data) -{ - iter_data_t * iter_data = (iter_data_t *)user_data; - - if (*iter_data->key != 0) { - g_warning("Shortcut is more than one entry. Which we don't currently support. Taking the first."); - return; - } - - if (!G_VALUE_HOLDS(value, G_TYPE_STRV)) { - g_warning("Unexpected shortcut structure. Value array is: %s", G_VALUE_TYPE_NAME(value)); - return; - } - - gchar ** stringarray = (gchar **)g_value_get_boxed(value); - if (stringarray == NULL) { - return; - } - - const gchar * last_string = NULL; - int i; - - for (i = 0; stringarray[i] != NULL; i++) { - last_string = stringarray[i]; - - if (g_strcmp0(last_string, DBUSMENU_MENUITEM_SHORTCUT_CONTROL) == 0) { - *iter_data->modifier |= GDK_CONTROL_MASK; - continue; - } - if (g_strcmp0(last_string, DBUSMENU_MENUITEM_SHORTCUT_ALT) == 0) { - *iter_data->modifier |= GDK_MOD1_MASK; - continue; - } - if (g_strcmp0(last_string, DBUSMENU_MENUITEM_SHORTCUT_SHIFT) == 0) { - *iter_data->modifier |= GDK_SHIFT_MASK; - continue; - } - if (g_strcmp0(last_string, DBUSMENU_MENUITEM_SHORTCUT_SUPER) == 0) { - *iter_data->modifier |= GDK_SUPER_MASK; - continue; - } - } - - if (last_string != NULL) { - GdkModifierType tempmod; - gtk_accelerator_parse(last_string, iter_data->key, &tempmod); - } - - return; -} - /** dbusmenu_menuitem_property_get_shortcut: @menuitem: The #DbusmenuMenuitem to get the shortcut off @@ -358,20 +286,46 @@ dbusmenu_menuitem_property_get_shortcut (DbusmenuMenuitem * menuitem, guint * ke g_return_if_fail(DBUSMENU_IS_MENUITEM(menuitem)); - const GValue * wrapper = dbusmenu_menuitem_property_get_value(menuitem, DBUSMENU_MENUITEM_PROP_SHORTCUT); + GVariant * wrapper = dbusmenu_menuitem_property_get_variant(menuitem, DBUSMENU_MENUITEM_PROP_SHORTCUT); if (wrapper == NULL) { return; } - if (!dbus_g_type_is_collection(G_VALUE_TYPE(wrapper))) { - g_warning("Unexpected shortcut structure. Wrapper is: %s", G_VALUE_TYPE_NAME(wrapper)); + + if (g_variant_n_children(wrapper) != 1) { + g_warning("Unable to parse shortcut, too many keys"); + g_variant_unref(wrapper); return; } - iter_data_t iter_data; - iter_data.key = key; - iter_data.modifier = modifier; + GVariantIter outsideiter; + GVariant * inside; + g_variant_iter_init(&outsideiter, wrapper); + + while(g_variant_iter_next(&outsideiter, "v", &inside)) { + GVariantIter insideiter; + g_variant_iter_init(&insideiter, inside); + gchar * string; + + while(g_variant_iter_next(&insideiter, "s", &string)) { + if (g_strcmp0(string, DBUSMENU_MENUITEM_SHORTCUT_CONTROL) == 0) { + *modifier |= GDK_CONTROL_MASK; + } else if (g_strcmp0(string, DBUSMENU_MENUITEM_SHORTCUT_ALT) == 0) { + *modifier |= GDK_MOD1_MASK; + } else if (g_strcmp0(string, DBUSMENU_MENUITEM_SHORTCUT_SHIFT) == 0) { + *modifier |= GDK_SHIFT_MASK; + } else if (g_strcmp0(string, DBUSMENU_MENUITEM_SHORTCUT_SUPER) == 0) { + *modifier |= GDK_SUPER_MASK; + } else { + GdkModifierType tempmod; + gtk_accelerator_parse(string, key, &tempmod); + } + + g_free(string); + } - dbus_g_type_collection_value_iterate(wrapper, _wrapper_iterator, &iter_data); + g_variant_unref(inside); + } + g_variant_unref(wrapper); return; } -- cgit v1.2.3 From b856f7cd47db470f4369aa28ad87dc1925bf68a5 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 16 Nov 2010 16:31:51 -0600 Subject: Switching to getting the name with GDBus --- tools/testapp/main.c | 49 +++++++++++++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 22 deletions(-) diff --git a/tools/testapp/main.c b/tools/testapp/main.c index f489407..67e962d 100644 --- a/tools/testapp/main.c +++ b/tools/testapp/main.c @@ -26,9 +26,7 @@ License version 3 and version 2.1 along with this program. If not, see */ #include - -#include -#include +#include #include @@ -117,6 +115,24 @@ void init_menu(DbusmenuMenuitem *root, const char *filename) } } +static void +on_bus (GDBusConnection * connection, const gchar * name, gpointer user_data) +{ + DbusmenuServer *server = dbusmenu_server_new("/MenuBar"); + DbusmenuMenuitem *root = dbusmenu_menuitem_new_with_id(0); + init_menu(root, (gchar *)user_data); + dbusmenu_server_set_root(server, root); + + return; +} + +static void +name_lost (GDBusConnection * connection, const gchar * name, gpointer user_data) +{ + g_error("Unable to get name '%s' on DBus", name); + return; +} + int main (int argc, char ** argv) { g_type_init(); @@ -127,25 +143,14 @@ int main (int argc, char ** argv) } const char *filename = argv[1]; - GError * error = NULL; - DBusGConnection * connection = dbus_g_bus_get(DBUS_BUS_SESSION, NULL); - DBusGProxy * bus_proxy = dbus_g_proxy_new_for_name(connection, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS); - guint nameret = 0; - - if (!org_freedesktop_DBus_request_name(bus_proxy, "org.dbusmenu.test", 0, &nameret, &error)) { - g_error("Unable to call to request name"); - return 1; - } - - if (nameret != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) { - g_error("Unable to get name"); - return 1; - } - - DbusmenuServer *server = dbusmenu_server_new("/MenuBar"); - DbusmenuMenuitem *root = dbusmenu_menuitem_new_with_id(0); - init_menu(root, filename); - dbusmenu_server_set_root(server, root); + g_bus_own_name(G_BUS_TYPE_SESSION, + "org.dbusmenu.test", + G_BUS_NAME_OWNER_FLAGS_NONE, + on_bus, + NULL, + name_lost, + (gpointer)filename, + NULL); g_main_loop_run(g_main_loop_new(NULL, FALSE)); -- cgit v1.2.3 From b0a7118fc4581f07b42c25ce02bda01fd1604097 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 16 Nov 2010 17:16:45 -0600 Subject: Chaning to get dbus names via GDBus --- tests/test-glib-simple-items.c | 3 --- tests/test-glib-submenu-server.c | 53 +++++++++++++++++++------------------- tests/test-gtk-label-server.c | 52 +++++++++++++++++++------------------ tests/test-gtk-reorder-server.c | 55 ++++++++++++++++++++-------------------- tests/test-gtk-shortcut-server.c | 53 +++++++++++++++++++------------------- 5 files changed, 110 insertions(+), 106 deletions(-) diff --git a/tests/test-glib-simple-items.c b/tests/test-glib-simple-items.c index 5b9f538..3ea5480 100644 --- a/tests/test-glib-simple-items.c +++ b/tests/test-glib-simple-items.c @@ -1,6 +1,3 @@ -#include -#include - #include #include diff --git a/tests/test-glib-submenu-server.c b/tests/test-glib-submenu-server.c index 68f7004..73362c1 100644 --- a/tests/test-glib-submenu-server.c +++ b/tests/test-glib-submenu-server.c @@ -20,11 +20,7 @@ with this program. If not, see . */ #include - -#include -#include -#include -#include +#include #include #include @@ -72,33 +68,38 @@ timer_func (gpointer data) return TRUE; } -int -main (int argc, char ** argv) +static void +on_bus (GDBusConnection * connection, const gchar * name, gpointer user_data) { - GError * error = NULL; - - g_type_init(); - - DBusGConnection * connection = dbus_g_bus_get(DBUS_BUS_SESSION, NULL); - g_debug("DBus ID: %s", dbus_connection_get_server_id(dbus_g_connection_get_connection(dbus_g_bus_get(DBUS_BUS_SESSION, NULL)))); + server = dbusmenu_server_new("/org/test"); - DBusGProxy * bus_proxy = dbus_g_proxy_new_for_name(connection, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS); - guint nameret = 0; + timer_func(NULL); + g_timeout_add(2500, timer_func, NULL); - if (!org_freedesktop_DBus_request_name(bus_proxy, "org.dbusmenu.test", 0, &nameret, &error)) { - g_error("Unable to call to request name"); - return 1; - } + return; +} - if (nameret != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) { - g_error("Unable to get name"); - return 1; - } +static void +name_lost (GDBusConnection * connection, const gchar * name, gpointer user_data) +{ + g_error("Unable to get name '%s' on DBus", name); + g_main_loop_quit(mainloop); + return; +} - server = dbusmenu_server_new("/org/test"); +int +main (int argc, char ** argv) +{ + g_type_init(); - timer_func(NULL); - g_timeout_add(2500, timer_func, NULL); + g_bus_own_name(G_BUS_TYPE_SESSION, + "org.dbusmenu.test", + G_BUS_NAME_OWNER_FLAGS_NONE, + on_bus, + NULL, + name_lost, + NULL, + NULL); mainloop = g_main_loop_new(NULL, FALSE); g_main_loop_run(mainloop); diff --git a/tests/test-gtk-label-server.c b/tests/test-gtk-label-server.c index 32572fc..ddf8fcf 100644 --- a/tests/test-gtk-label-server.c +++ b/tests/test-gtk-label-server.c @@ -20,11 +20,7 @@ with this program. If not, see . */ #include - -#include -#include -#include -#include +#include #include #include @@ -53,6 +49,25 @@ timer_func (gpointer data) return TRUE; } +static void +on_bus (GDBusConnection * connection, const gchar * name, gpointer user_data) +{ + server = dbusmenu_server_new("/org/test"); + + timer_func(NULL); + g_timeout_add_seconds(5, timer_func, NULL); + + return; +} + +static void +name_lost (GDBusConnection * connection, const gchar * name, gpointer user_data) +{ + g_error("Unable to get name '%s' on DBus", name); + g_main_loop_quit(mainloop); + return; +} + int main (int argc, char ** argv) { @@ -73,26 +88,15 @@ main (int argc, char ** argv) root_array = json_node_get_array(root_node); g_debug("%d layouts in test description '%s'", json_array_get_length(root_array), argv[1]); - DBusGConnection * connection = dbus_g_bus_get(DBUS_BUS_SESSION, NULL); - g_debug("DBus ID: %s", dbus_connection_get_server_id(dbus_g_connection_get_connection(dbus_g_bus_get(DBUS_BUS_SESSION, NULL)))); - DBusGProxy * bus_proxy = dbus_g_proxy_new_for_name(connection, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS); - guint nameret = 0; - - if (!org_freedesktop_DBus_request_name(bus_proxy, "glib.label.test", 0, &nameret, &error)) { - g_error("Unable to call to request name"); - return 1; - } - - if (nameret != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) { - g_error("Unable to get name"); - return 1; - } - - server = dbusmenu_server_new("/org/test"); - - timer_func(NULL); - g_timeout_add_seconds(5, timer_func, NULL); + g_bus_own_name(G_BUS_TYPE_SESSION, + "glib.label.test", + G_BUS_NAME_OWNER_FLAGS_NONE, + on_bus, + NULL, + name_lost, + NULL, + NULL); mainloop = g_main_loop_new(NULL, FALSE); g_main_loop_run(mainloop); diff --git a/tests/test-gtk-reorder-server.c b/tests/test-gtk-reorder-server.c index eee9bb8..44209f1 100644 --- a/tests/test-gtk-reorder-server.c +++ b/tests/test-gtk-reorder-server.c @@ -20,11 +20,7 @@ with this program. If not, see . */ #include - -#include -#include -#include -#include +#include #include #include @@ -73,29 +69,9 @@ timer_func (gpointer data) return TRUE; } -int -main (int argc, char ** argv) +static void +on_bus (GDBusConnection * connection, const gchar * name, gpointer user_data) { - GError * error = NULL; - - g_type_init(); - - DBusGConnection * connection = dbus_g_bus_get(DBUS_BUS_SESSION, NULL); - g_debug("DBus ID: %s", dbus_connection_get_server_id(dbus_g_connection_get_connection(dbus_g_bus_get(DBUS_BUS_SESSION, NULL)))); - - DBusGProxy * bus_proxy = dbus_g_proxy_new_for_name(connection, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS); - guint nameret = 0; - - if (!org_freedesktop_DBus_request_name(bus_proxy, "glib.label.test", 0, &nameret, &error)) { - g_error("Unable to call to request name"); - return 1; - } - - if (nameret != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) { - g_error("Unable to get name"); - return 1; - } - server = dbusmenu_server_new("/org/test"); root = dbusmenu_menuitem_new(); dbusmenu_server_set_root(server, root); @@ -109,6 +85,31 @@ main (int argc, char ** argv) timer_func(NULL); g_timeout_add_seconds(5, timer_func, NULL); + return; +} + +static void +name_lost (GDBusConnection * connection, const gchar * name, gpointer user_data) +{ + g_error("Unable to get name '%s' on DBus", name); + g_main_loop_quit(mainloop); + return; +} + +int +main (int argc, char ** argv) +{ + g_type_init(); + + g_bus_own_name(G_BUS_TYPE_SESSION, + "glib.label.test", + G_BUS_NAME_OWNER_FLAGS_NONE, + on_bus, + NULL, + name_lost, + NULL, + NULL); + mainloop = g_main_loop_new(NULL, FALSE); g_main_loop_run(mainloop); diff --git a/tests/test-gtk-shortcut-server.c b/tests/test-gtk-shortcut-server.c index 3b703a1..b205d03 100644 --- a/tests/test-gtk-shortcut-server.c +++ b/tests/test-gtk-shortcut-server.c @@ -20,13 +20,9 @@ with this program. If not, see . */ #include +#include #include -#include -#include -#include -#include - #include #include #include @@ -61,33 +57,38 @@ build_menu (void) return; } -int -main (int argc, char ** argv) +static void +on_bus (GDBusConnection * connection, const gchar * name, gpointer user_data) { - GError * error = NULL; - - g_type_init(); - - DBusGConnection * connection = dbus_g_bus_get(DBUS_BUS_SESSION, NULL); - g_debug("DBus ID: %s", dbus_connection_get_server_id(dbus_g_connection_get_connection(dbus_g_bus_get(DBUS_BUS_SESSION, NULL)))); + server = dbusmenu_server_new("/org/test"); + build_menu(); - DBusGProxy * bus_proxy = dbus_g_proxy_new_for_name(connection, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS); - guint nameret = 0; + g_timeout_add_seconds(10, timer_func, NULL); - if (!org_freedesktop_DBus_request_name(bus_proxy, "glib.label.test", 0, &nameret, &error)) { - g_error("Unable to call to request name"); - return 1; - } + return; +} - if (nameret != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) { - g_error("Unable to get name"); - return 1; - } +static void +name_lost (GDBusConnection * connection, const gchar * name, gpointer user_data) +{ + g_error("Unable to get name '%s' on DBus", name); + g_main_loop_quit(mainloop); + return; +} - server = dbusmenu_server_new("/org/test"); - build_menu(); +int +main (int argc, char ** argv) +{ + g_type_init(); - g_timeout_add_seconds(10, timer_func, NULL); + g_bus_own_name(G_BUS_TYPE_SESSION, + "glib.label.test", + G_BUS_NAME_OWNER_FLAGS_NONE, + on_bus, + NULL, + name_lost, + NULL, + NULL); mainloop = g_main_loop_new(NULL, FALSE); g_main_loop_run(mainloop); -- cgit v1.2.3 From f6108371c958c994b451d9c7c80f530bae4fd7c3 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 16 Nov 2010 21:57:32 -0600 Subject: Making a test do a name detection, but kinda making it async at the same time. --- tests/test-json-client.c | 60 ++++++++++++++++++++++++++---------------------- 1 file changed, 32 insertions(+), 28 deletions(-) diff --git a/tests/test-json-client.c b/tests/test-json-client.c index f9da55e..d4e782b 100644 --- a/tests/test-json-client.c +++ b/tests/test-json-client.c @@ -21,38 +21,21 @@ with this program. If not, see . #include #include -#include -#include -#include GMainLoop * mainloop = NULL; -int -main (int argc, char ** argv) +gboolean +timeout_func (gpointer user_data) { - g_type_init(); - g_debug("Wait for friends"); - - GError * error = NULL; - DBusGConnection * session_bus = dbus_g_bus_get(DBUS_BUS_SESSION, &error); - if (error != NULL) { - g_error("Unable to get session bus: %s", error->message); - return 1; - } - - DBusGProxy * bus_proxy = dbus_g_proxy_new_for_name(session_bus, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS); - - gboolean has_owner = FALSE; - gint owner_count = 0; - while (!has_owner && owner_count < 10000) { - org_freedesktop_DBus_name_has_owner(bus_proxy, "org.dbusmenu.test", &has_owner, NULL); - owner_count++; - } + g_warning("Timeout without getting name"); + g_main_loop_quit(mainloop); + return FALSE; +} - if (owner_count == 10000) { - g_error("Unable to get name owner after 10000 tries"); - return 1; - } +void +name_appeared (GDBusConnection * connection, const gchar * name, const gchar * owner, gpointer user_data) +{ + char ** argv = (char **)user_data; g_usleep(500000); @@ -69,7 +52,28 @@ main (int argc, char ** argv) g_file_replace_contents(ofile, output, g_utf8_strlen(output, -1), NULL, FALSE, 0, NULL, NULL, NULL); } - g_debug("Exiting"); + g_main_loop_quit(mainloop); + return; +} + +int +main (int argc, char ** argv) +{ + g_type_init(); + g_debug("Wait for friends"); + + g_bus_watch_name(G_BUS_TYPE_SESSION, + "org.dbusmenu.test", + G_BUS_NAME_WATCHER_FLAGS_NONE, + name_appeared, + NULL, + argv, + NULL); + + g_timeout_add_seconds(2, timeout_func, NULL); + + mainloop = g_main_loop_new(NULL, FALSE); + g_main_loop_run(mainloop); return 0; } -- cgit v1.2.3 From 1100e05ca534449b557a1f2993c405f01781bd72 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 16 Nov 2010 22:04:47 -0600 Subject: Getting names the GDBus way --- tests/test-gtk-submenu-server.c | 55 +++++++++++++++++++------------------ tests/test-json-server.c | 61 +++++++++++++++++++++++------------------ 2 files changed, 62 insertions(+), 54 deletions(-) diff --git a/tests/test-gtk-submenu-server.c b/tests/test-gtk-submenu-server.c index 11cede0..9c4d7d4 100644 --- a/tests/test-gtk-submenu-server.c +++ b/tests/test-gtk-submenu-server.c @@ -20,11 +20,7 @@ with this program. If not, see . */ #include - -#include -#include -#include -#include +#include #include #include @@ -59,29 +55,9 @@ add_item(DbusmenuMenuitem * parent, const char * label) return item; } -int -main (int argc, char ** argv) +static void +on_bus (GDBusConnection * connection, const gchar * name, gpointer user_data) { - GError * error = NULL; - - g_type_init(); - - DBusGConnection * connection = dbus_g_bus_get(DBUS_BUS_SESSION, NULL); - g_debug("DBus ID: %s", dbus_connection_get_server_id(dbus_g_connection_get_connection(dbus_g_bus_get(DBUS_BUS_SESSION, NULL)))); - - DBusGProxy * bus_proxy = dbus_g_proxy_new_for_name(connection, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS); - guint nameret = 0; - - if (!org_freedesktop_DBus_request_name(bus_proxy, "glib.label.test", 0, &nameret, &error)) { - g_error("Unable to call to request name"); - return 1; - } - - if (nameret != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) { - g_error("Unable to get name"); - return 1; - } - DbusmenuServer * server = dbusmenu_server_new("/org/test"); DbusmenuMenuitem * root = dbusmenu_menuitem_new(); dbusmenu_server_set_root(server, root); @@ -101,6 +77,31 @@ main (int argc, char ** argv) g_timeout_add_seconds(4, show_item, item); + return; +} + +static void +name_lost (GDBusConnection * connection, const gchar * name, gpointer user_data) +{ + g_error("Unable to get name '%s' on DBus", name); + g_main_loop_quit(mainloop); + return; +} + +int +main (int argc, char ** argv) +{ + g_type_init(); + + g_bus_own_name(G_BUS_TYPE_SESSION, + "glib.label.test", + G_BUS_NAME_OWNER_FLAGS_NONE, + on_bus, + NULL, + name_lost, + NULL, + NULL); + g_timeout_add_seconds(6, timer_func, NULL); mainloop = g_main_loop_new(NULL, FALSE); diff --git a/tests/test-json-server.c b/tests/test-json-server.c index fe9507a..083de60 100644 --- a/tests/test-json-server.c +++ b/tests/test-json-server.c @@ -20,11 +20,7 @@ with this program. If not, see . */ #include - -#include -#include -#include -#include +#include #include #include @@ -40,38 +36,49 @@ timer_func (gpointer data) return FALSE; } -int -main (int argc, char ** argv) +static void +on_bus (GDBusConnection * connection, const gchar * name, gpointer user_data) { - GError * error = NULL; - - g_type_init(); - - DBusGConnection * connection = dbus_g_bus_get(DBUS_BUS_SESSION, NULL); - g_debug("DBus ID: %s", dbus_connection_get_server_id(dbus_g_connection_get_connection(dbus_g_bus_get(DBUS_BUS_SESSION, NULL)))); - - DBusGProxy * bus_proxy = dbus_g_proxy_new_for_name(connection, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS); - guint nameret = 0; - - if (!org_freedesktop_DBus_request_name(bus_proxy, "org.dbusmenu.test", 0, &nameret, &error)) { - g_error("Unable to call to request name"); - return 1; - } - - if (nameret != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) { - g_error("Unable to get name"); - return 1; - } + gchar ** argv = (gchar **)user_data; DbusmenuServer * server = dbusmenu_server_new("/org/test"); DbusmenuMenuitem * root = dbusmenu_json_build_from_file(argv[1]); - g_return_val_if_fail(root!=NULL, 1); + if (root == NULL) { + g_warning("Unable to build root"); + g_main_loop_quit(mainloop); + return; + } dbusmenu_server_set_root(server, root); g_timeout_add(10000, timer_func, NULL); + return; +} + +static void +name_lost (GDBusConnection * connection, const gchar * name, gpointer user_data) +{ + g_error("Unable to get name '%s' on DBus", name); + g_main_loop_quit(mainloop); + return; +} + +int +main (int argc, char ** argv) +{ + g_type_init(); + + g_bus_own_name(G_BUS_TYPE_SESSION, + "org.dbusmenu.test", + G_BUS_NAME_OWNER_FLAGS_NONE, + on_bus, + NULL, + name_lost, + argv, + NULL); + mainloop = g_main_loop_new(NULL, FALSE); g_main_loop_run(mainloop); -- cgit v1.2.3 From e9e8e1c31e0a32e23e2526622d2435f60c24a084 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 17 Nov 2010 11:12:28 -0600 Subject: Porting the dumper to GDBus --- tools/dbusmenu-dumper.c | 154 ++++++++++-------------------------------------- 1 file changed, 30 insertions(+), 124 deletions(-) diff --git a/tools/dbusmenu-dumper.c b/tools/dbusmenu-dumper.c index 3256f7e..4580e4c 100644 --- a/tools/dbusmenu-dumper.c +++ b/tools/dbusmenu-dumper.c @@ -21,7 +21,6 @@ with this program. If not, see . */ #include -#include #include #include @@ -30,111 +29,10 @@ with this program. If not, see . #include #include -#include #include static GMainLoop * mainloop = NULL; -static gchar * value2string (const GValue * value, int depth); - -static gchar * -strv_dumper(const GValue * value) -{ - gchar ** strv = (gchar **)g_value_get_boxed(value); - - gchar * joined = g_strjoinv("\", \"", strv); - gchar * retval = g_strdup_printf("[\"%s\"]", joined); - g_free(joined); - return retval; -} - -typedef struct _collection_iterator_t collection_iterator_t; -struct _collection_iterator_t { - gchar * space; - GPtrArray * array; - gboolean first; - int depth; -}; - -static void -collection_iterate (const GValue * value, gpointer user_data) -{ - collection_iterator_t * iter = (collection_iterator_t *)user_data; - - gchar * str = value2string(value, iter->depth); - gchar * retval = NULL; - - if (iter->first) { - iter->first = FALSE; - retval = g_strdup_printf("\n%s%s", iter->space, str); - } else { - retval = g_strdup_printf(",\n%s%s", iter->space, str); - } - - g_ptr_array_add(iter->array, retval); - g_free(str); - - return; -} - -static gchar * -collection_dumper (const GValue * value, int depth) -{ - gchar * space = g_strnfill(depth, ' '); - GPtrArray * array = g_ptr_array_new_with_free_func(g_free); - - g_ptr_array_add(array, g_strdup("[")); - - collection_iterator_t iter; - iter.space = space; - iter.array = array; - iter.first = TRUE; - iter.depth = depth + 2; - - dbus_g_type_collection_value_iterate(value, collection_iterate, &iter); - - g_ptr_array_add(array, g_strdup_printf("\n%s]", space)); - - g_free(space); - - gchar * retstr = NULL; - if (array->len == 3) { - retstr = g_strdup_printf("[%s]", ((gchar *)array->pdata[1]) + depth + 1/*for newline*/); - } else { - retstr = g_strjoinv(NULL, (gchar **)array->pdata); - } - - g_ptr_array_free(array, TRUE); - - return retstr; -} - -static gchar * -value2string (const GValue * value, int depth) -{ - gchar * str = NULL; - - if (value == NULL) { - return g_strdup("(null)"); - } - - if (dbus_g_type_is_collection(G_VALUE_TYPE(value))) { - str = collection_dumper(value, depth); - } else if (G_VALUE_TYPE(value) == G_TYPE_STRV) { - str = strv_dumper(value); - } else if (G_VALUE_TYPE(value) == G_TYPE_BOOLEAN) { - if (g_value_get_boolean(value)) { - str = g_strdup("true"); - } else { - str = g_strdup("false"); - } - } else { - str = g_strdup_value_contents(value); - } - - return str; -} - static gint list_str_cmp (gconstpointer a, gconstpointer b) { @@ -151,10 +49,11 @@ print_menuitem (DbusmenuMenuitem * item, int depth) GList * properties = g_list_sort(properties_raw, list_str_cmp); GList * property; for (property = properties; property != NULL; property = g_list_next(property)) { - const GValue * value = dbusmenu_menuitem_property_get_value(item, (gchar *)property->data); - gchar * str = value2string(value, depth + g_utf8_strlen((gchar *)property->data, -1) + 2 /*quotes*/ + 2 /*: */); + GVariant * variant = dbusmenu_menuitem_property_get_variant(item, (gchar *)property->data); + gchar * str = g_variant_print(variant, FALSE); g_print(",\n%s\"%s\": %s", space, (gchar *)property->data, str); g_free(str); + g_variant_unref(variant); } g_list_free(properties); @@ -350,39 +249,46 @@ static gchar * dbusobject = NULL; static gboolean init_dbus_vars_from_window(Window window) { - DBusGConnection *connection; GError *error; - DBusGProxy *proxy; + GDBusProxy *proxy; error = NULL; - connection = dbus_g_bus_get(DBUS_BUS_SESSION, &error); - if (connection == NULL) { - g_printerr("Failed to open connection to bus: %s\n", error->message); + + proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION, + G_DBUS_PROXY_FLAGS_NONE, + NULL, + "org.ayatana.AppMenu.Registrar", + "/org/ayatana/AppMenu/Registrar", + "org.ayatana.AppMenu.Registrar", + NULL, + &error); + if (error != NULL) { + g_warning("Unable to get registrar proxy: %s", error->message); g_error_free(error); return FALSE; } - proxy = dbus_g_proxy_new_for_name (connection, - "org.ayatana.AppMenu.Registrar", - "/org/ayatana/AppMenu/Registrar", - "org.ayatana.AppMenu.Registrar"); - error = NULL; - if (!dbus_g_proxy_call (proxy, "GetMenuForWindow", &error, - G_TYPE_UINT, window, G_TYPE_INVALID, - G_TYPE_STRING, &dbusname, DBUS_TYPE_G_OBJECT_PATH, &dbusobject, G_TYPE_INVALID)) - { - g_printerr("ERROR: %s\n", error->message); + GVariant * retval; + + retval = g_dbus_proxy_call_sync(proxy, + "GetMenuForWindow", + g_variant_new("u", window), + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + &error); + + if (error != NULL) { + g_warning("Unable to call 'GetMenuForWindow' on registrar: %s", error->message); g_error_free(error); - g_object_unref(proxy); return FALSE; } - if (!g_strcmp0(dbusobject, "/")) { - return FALSE; - } + g_variant_get(retval, "so", &dbusname, &dbusobject); - g_object_unref (proxy); + g_variant_unref(retval); + g_object_unref(proxy); return TRUE; } -- cgit v1.2.3 From f39b7fe067855d42dd79300d2d283b02eef48a03 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 17 Nov 2010 16:25:52 -0600 Subject: Switch the internal hash table to be variant and implement the set and get functions. Also TODOs around other needed changes. --- libdbusmenu-glib/menuitem.c | 80 ++++++++++++++++++++++++++++++++++++++------- libdbusmenu-glib/menuitem.h | 2 +- 2 files changed, 70 insertions(+), 12 deletions(-) diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index 80d9df4..28a711a 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -271,15 +271,12 @@ g_value_transform_STRING_INT (const GValue * in, GValue * out) static gint menuitem_next_id = 1; -/* A small little function to both clear the insides of a - value as well as the memory it itself uses. */ +/* Make the unref function match the prototype need for the + hashtable destructor */ static void -_g_value_free (gpointer data) +_g_variant_unref (gpointer data) { - if (data == NULL) return; - GValue * value = (GValue*)data; - g_value_unset(value); - g_free(data); + g_variant_unref((GVariant *)data); return; } @@ -295,7 +292,7 @@ dbusmenu_menuitem_init (DbusmenuMenuitem *self) priv->id = -1; priv->children = NULL; - priv->properties = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, _g_value_free); + priv->properties = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, _g_variant_unref); priv->root = FALSE; priv->realized = FALSE; @@ -919,6 +916,7 @@ dbusmenu_menuitem_property_set (DbusmenuMenuitem * mi, const gchar * property, c GValue val = {0}; g_value_init(&val, G_TYPE_STRING); g_value_set_static_string(&val, value); + /* TODO: Switch to use variant */ return dbusmenu_menuitem_property_set_value(mi, property, &val); } @@ -943,6 +941,7 @@ dbusmenu_menuitem_property_set_bool (DbusmenuMenuitem * mi, const gchar * proper GValue val = {0}; g_value_init(&val, G_TYPE_BOOLEAN); g_value_set_boolean(&val, value); + /* TODO: Switch to use variant */ return dbusmenu_menuitem_property_set_value(mi, property, &val); } @@ -967,11 +966,12 @@ dbusmenu_menuitem_property_set_int (DbusmenuMenuitem * mi, const gchar * propert GValue val = {0}; g_value_init(&val, G_TYPE_INT); g_value_set_int(&val, value); + /* TODO: Switch to use variant */ return dbusmenu_menuitem_property_set_value(mi, property, &val); } /** - dbusmenu_menuitem_property_set: + dbusmenu_menuitem_property_set_value: @mi: The #DbusmenuMenuitem to set the property on. @property: Name of the property to set. @value: The value of the property. @@ -988,6 +988,7 @@ dbusmenu_menuitem_property_set_int (DbusmenuMenuitem * mi, const gchar * propert gboolean dbusmenu_menuitem_property_set_value (DbusmenuMenuitem * mi, const gchar * property, const GValue * value) { + /* TODO: Switch to use variant */ g_return_val_if_fail(DBUSMENU_IS_MENUITEM(mi), FALSE); g_return_val_if_fail(property != NULL, FALSE); g_return_val_if_fail(G_IS_VALUE(value), FALSE); @@ -1021,9 +1022,46 @@ dbusmenu_menuitem_property_set_value (DbusmenuMenuitem * mi, const gchar * prope return TRUE; } +/** + dbusmenu_menuitem_property_set_variant: + @mi: The #DbusmenuMenuitem to set the property on. + @property: Name of the property to set. + @value: The value of the property. + + Takes the pair of @property and @value and places them as a + property on @mi. If a property already exists by that name, + then the value is set to the new value. If not, the property + is added. If the value is changed or the property was previously + unset then the signal #DbusmenuMenuitem::prop-changed will be + emitted by this function. + + Return value: A boolean representing if the property value was set. +*/ gboolean -dbusmenu_menuitem_property_set_variant (DbusmenuMenuitem * mi, const gchar * property, const GVariant * value) +dbusmenu_menuitem_property_set_variant (DbusmenuMenuitem * mi, const gchar * property, GVariant * value) { + g_return_val_if_fail(DBUSMENU_IS_MENUITEM(mi), FALSE); + g_return_val_if_fail(property != NULL, FALSE); + + DbusmenuMenuitemPrivate * priv = DBUSMENU_MENUITEM_GET_PRIVATE(mi); + + gchar * lprop = g_strdup(property); + g_variant_ref(value); + + gboolean replaced = FALSE; + gpointer currentval = g_hash_table_lookup(priv->properties, lprop); + if (currentval == NULL || !g_variant_equal((GVariant*)currentval, value)) { + g_hash_table_replace(priv->properties, lprop, value); + replaced = TRUE; + } + + /* NOTE: The actual value is invalid at this point + becuse it has been unref'd when replaced in the hash + table. But the fact that there was a value is + the imporant part. */ + if (currentval != NULL && replaced) { + g_signal_emit(G_OBJECT(mi), signals[PROPERTY_CHANGED], 0, lprop, value, TRUE); + } return FALSE; } @@ -1044,6 +1082,7 @@ dbusmenu_menuitem_property_set_variant (DbusmenuMenuitem * mi, const gchar * pro const gchar * dbusmenu_menuitem_property_get (DbusmenuMenuitem * mi, const gchar * property) { + /* TODO: Switch to use variant */ const GValue * value = dbusmenu_menuitem_property_get_value(mi, property); if (value == NULL) return NULL; if (G_VALUE_TYPE(value) != G_TYPE_STRING) return NULL; @@ -1064,6 +1103,7 @@ dbusmenu_menuitem_property_get (DbusmenuMenuitem * mi, const gchar * property) const GValue * dbusmenu_menuitem_property_get_value (DbusmenuMenuitem * mi, const gchar * property) { + /* TODO: Switch to use variant */ g_return_val_if_fail(DBUSMENU_IS_MENUITEM(mi), NULL); g_return_val_if_fail(property != NULL, NULL); @@ -1072,11 +1112,26 @@ dbusmenu_menuitem_property_get_value (DbusmenuMenuitem * mi, const gchar * prope return (const GValue *)g_hash_table_lookup(priv->properties, property); } +/** + dbusmenu_menuitem_property_get_variant: + @mi: The #DbusmenuMenuitem to look for the property on. + @property: The property to grab. + + Look up a property on @mi and return the value of it if + it exits. #NULL will be returned if the property doesn't + exist. + + Return value: A GVariant for the property. +*/ GVariant * dbusmenu_menuitem_property_get_variant (DbusmenuMenuitem * mi, const gchar * property) { + g_return_val_if_fail(DBUSMENU_IS_MENUITEM(mi), NULL); + g_return_val_if_fail(property != NULL, NULL); - return NULL; + DbusmenuMenuitemPrivate * priv = DBUSMENU_MENUITEM_GET_PRIVATE(mi); + + return (GVariant *)g_hash_table_lookup(priv->properties, property); } /** @@ -1092,6 +1147,7 @@ dbusmenu_menuitem_property_get_variant (DbusmenuMenuitem * mi, const gchar * pro gboolean dbusmenu_menuitem_property_get_bool (DbusmenuMenuitem * mi, const gchar * property) { + /* TODO: Switch to use variant */ const GValue * value = dbusmenu_menuitem_property_get_value(mi, property); if (value == NULL) return FALSE; if (G_VALUE_TYPE(value) != G_TYPE_BOOLEAN) { @@ -1120,6 +1176,7 @@ dbusmenu_menuitem_property_get_bool (DbusmenuMenuitem * mi, const gchar * proper gint dbusmenu_menuitem_property_get_int (DbusmenuMenuitem * mi, const gchar * property) { + /* TODO: Switch to use variant */ const GValue * value = dbusmenu_menuitem_property_get_value(mi, property); if (value == NULL) return 0; if (G_VALUE_TYPE(value) != G_TYPE_INT) { @@ -1239,6 +1296,7 @@ dbusmenu_menuitem_properties_copy (DbusmenuMenuitem * mi) static void variant_helper (gpointer in_key, gpointer in_value, gpointer user_data) { + /* TODO: Switch to being a variant */ GValue vval = {0}; g_value_init(&vval, G_TYPE_VARIANT); diff --git a/libdbusmenu-glib/menuitem.h b/libdbusmenu-glib/menuitem.h index 1dbad9d..438cdd1 100644 --- a/libdbusmenu-glib/menuitem.h +++ b/libdbusmenu-glib/menuitem.h @@ -189,7 +189,7 @@ DbusmenuMenuitem * dbusmenu_menuitem_find_id (DbusmenuMenuitem * mi, gint id); gboolean dbusmenu_menuitem_property_set (DbusmenuMenuitem * mi, const gchar * property, const gchar * value); gboolean dbusmenu_menuitem_property_set_value (DbusmenuMenuitem * mi, const gchar * property, const GValue * value); -gboolean dbusmenu_menuitem_property_set_variant (DbusmenuMenuitem * mi, const gchar * property, const GVariant * value); +gboolean dbusmenu_menuitem_property_set_variant (DbusmenuMenuitem * mi, const gchar * property, GVariant * value); gboolean dbusmenu_menuitem_property_set_bool (DbusmenuMenuitem * mi, const gchar * property, const gboolean value); gboolean dbusmenu_menuitem_property_set_int (DbusmenuMenuitem * mi, const gchar * property, const gint value); const gchar * dbusmenu_menuitem_property_get (DbusmenuMenuitem * mi, const gchar * property); -- cgit v1.2.3 From 7352a7e71fbe842b9429bb5fcc6ab23e6578d4d1 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 17 Nov 2010 17:22:59 -0600 Subject: Replacing the value based functions with variants instead of values. --- libdbusmenu-glib/menuitem.c | 81 +++++++++++++++++++++------------------------ 1 file changed, 38 insertions(+), 43 deletions(-) diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index 28a711a..a9036f0 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -913,11 +913,8 @@ dbusmenu_menuitem_find_id (DbusmenuMenuitem * mi, gint id) gboolean dbusmenu_menuitem_property_set (DbusmenuMenuitem * mi, const gchar * property, const gchar * value) { - GValue val = {0}; - g_value_init(&val, G_TYPE_STRING); - g_value_set_static_string(&val, value); - /* TODO: Switch to use variant */ - return dbusmenu_menuitem_property_set_value(mi, property, &val); + GVariant * variant = g_variant_new("s", value); + return dbusmenu_menuitem_property_set_variant(mi, property, variant); } /** @@ -938,11 +935,8 @@ dbusmenu_menuitem_property_set (DbusmenuMenuitem * mi, const gchar * property, c gboolean dbusmenu_menuitem_property_set_bool (DbusmenuMenuitem * mi, const gchar * property, const gboolean value) { - GValue val = {0}; - g_value_init(&val, G_TYPE_BOOLEAN); - g_value_set_boolean(&val, value); - /* TODO: Switch to use variant */ - return dbusmenu_menuitem_property_set_value(mi, property, &val); + GVariant * variant = g_variant_new("b", value); + return dbusmenu_menuitem_property_set_variant(mi, property, variant); } /** @@ -963,11 +957,8 @@ dbusmenu_menuitem_property_set_bool (DbusmenuMenuitem * mi, const gchar * proper gboolean dbusmenu_menuitem_property_set_int (DbusmenuMenuitem * mi, const gchar * property, const gint value) { - GValue val = {0}; - g_value_init(&val, G_TYPE_INT); - g_value_set_int(&val, value); - /* TODO: Switch to use variant */ - return dbusmenu_menuitem_property_set_value(mi, property, &val); + GVariant * variant = g_variant_new("i", value); + return dbusmenu_menuitem_property_set_variant(mi, property, variant); } /** @@ -1082,11 +1073,10 @@ dbusmenu_menuitem_property_set_variant (DbusmenuMenuitem * mi, const gchar * pro const gchar * dbusmenu_menuitem_property_get (DbusmenuMenuitem * mi, const gchar * property) { - /* TODO: Switch to use variant */ - const GValue * value = dbusmenu_menuitem_property_get_value(mi, property); - if (value == NULL) return NULL; - if (G_VALUE_TYPE(value) != G_TYPE_STRING) return NULL; - return g_value_get_string(value); + GVariant * variant = dbusmenu_menuitem_property_get_variant(mi, property); + if (variant == NULL) return NULL; + if (!g_variant_type_equal(g_variant_get_type(variant), G_VARIANT_TYPE_STRING)) return NULL; + return g_variant_get_string(variant, NULL); } /** @@ -1147,20 +1137,25 @@ dbusmenu_menuitem_property_get_variant (DbusmenuMenuitem * mi, const gchar * pro gboolean dbusmenu_menuitem_property_get_bool (DbusmenuMenuitem * mi, const gchar * property) { - /* TODO: Switch to use variant */ - const GValue * value = dbusmenu_menuitem_property_get_value(mi, property); - if (value == NULL) return FALSE; - if (G_VALUE_TYPE(value) != G_TYPE_BOOLEAN) { - if (g_value_type_transformable(G_VALUE_TYPE(value), G_TYPE_BOOLEAN)) { - GValue boolval = {0}; - g_value_init(&boolval, G_TYPE_BOOLEAN); - g_value_transform(value, &boolval); - return g_value_get_boolean(&boolval); + GVariant * variant = dbusmenu_menuitem_property_get_variant(mi, property); + if (variant == NULL) return FALSE; + + if (g_variant_type_equal(g_variant_get_type(variant), G_VARIANT_TYPE_BOOLEAN)) { + return g_variant_get_boolean(variant); + } + + if (!g_variant_type_equal(g_variant_get_type(variant), G_VARIANT_TYPE_STRING)) { + const gchar * string = g_variant_get_string(variant, NULL); + + if (!g_strcmp0(string, "TRUE") || !g_strcmp0(string, "true") || !g_strcmp0(string, "True")) { + return TRUE; } else { return FALSE; } } - return g_value_get_boolean(value); + + g_warning("Property '%s' has been requested as an boolean but is not one.", property); + return FALSE; } /** @@ -1176,20 +1171,20 @@ dbusmenu_menuitem_property_get_bool (DbusmenuMenuitem * mi, const gchar * proper gint dbusmenu_menuitem_property_get_int (DbusmenuMenuitem * mi, const gchar * property) { - /* TODO: Switch to use variant */ - const GValue * value = dbusmenu_menuitem_property_get_value(mi, property); - if (value == NULL) return 0; - if (G_VALUE_TYPE(value) != G_TYPE_INT) { - if (g_value_type_transformable(G_VALUE_TYPE(value), G_TYPE_INT)) { - GValue intval = {0}; - g_value_init(&intval, G_TYPE_INT); - g_value_transform(value, &intval); - return g_value_get_int(&intval); - } else { - return 0; - } + GVariant * variant = dbusmenu_menuitem_property_get_variant(mi, property); + if (variant == NULL) return 0; + + if (g_variant_type_equal(g_variant_get_type(variant), G_VARIANT_TYPE_INT32)) { + return g_variant_get_int32(variant); + } + + if (!g_variant_type_equal(g_variant_get_type(variant), G_VARIANT_TYPE_STRING)) { + const gchar * string = g_variant_get_string(variant, NULL); + return atoi(string); } - return g_value_get_int(value); + + g_warning("Property '%s' has been requested as an int but is not one.", property); + return 0; } -- cgit v1.2.3 From 31034648055ad0fc3e022f43b3a3b3033972a008 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 17 Nov 2010 20:06:31 -0600 Subject: Adding some deprectated flags for the value functions. --- libdbusmenu-glib/menuitem.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libdbusmenu-glib/menuitem.h b/libdbusmenu-glib/menuitem.h index 438cdd1..77bca4b 100644 --- a/libdbusmenu-glib/menuitem.h +++ b/libdbusmenu-glib/menuitem.h @@ -188,12 +188,16 @@ DbusmenuMenuitem * dbusmenu_menuitem_child_find (DbusmenuMenuitem * mi, gint id) DbusmenuMenuitem * dbusmenu_menuitem_find_id (DbusmenuMenuitem * mi, gint id); gboolean dbusmenu_menuitem_property_set (DbusmenuMenuitem * mi, const gchar * property, const gchar * value); +#ifndef DBUSMENU_DISABLE_DEPRECATED gboolean dbusmenu_menuitem_property_set_value (DbusmenuMenuitem * mi, const gchar * property, const GValue * value); +#endif gboolean dbusmenu_menuitem_property_set_variant (DbusmenuMenuitem * mi, const gchar * property, GVariant * value); gboolean dbusmenu_menuitem_property_set_bool (DbusmenuMenuitem * mi, const gchar * property, const gboolean value); gboolean dbusmenu_menuitem_property_set_int (DbusmenuMenuitem * mi, const gchar * property, const gint value); const gchar * dbusmenu_menuitem_property_get (DbusmenuMenuitem * mi, const gchar * property); +#ifndef DBUSMENU_DISABLE_DEPRECATED const GValue * dbusmenu_menuitem_property_get_value (DbusmenuMenuitem * mi, const gchar * property); +#endif GVariant * dbusmenu_menuitem_property_get_variant (DbusmenuMenuitem * mi, const gchar * property); gboolean dbusmenu_menuitem_property_get_bool (DbusmenuMenuitem * mi, const gchar * property); gint dbusmenu_menuitem_property_get_int (DbusmenuMenuitem * mi, const gchar * property); -- cgit v1.2.3 From 353802f51c23447bcc905767014dcc37b5b76e20 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 17 Nov 2010 20:08:39 -0600 Subject: Adding deprecation comment to the documentation. --- libdbusmenu-glib/menuitem.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index a9036f0..d5d4d26 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -975,6 +975,7 @@ dbusmenu_menuitem_property_set_int (DbusmenuMenuitem * mi, const gchar * propert emitted by this function. Return value: A boolean representing if the property value was set. + Deprecated: Use dbusmenu_menuitem_property_set_variant() instead */ gboolean dbusmenu_menuitem_property_set_value (DbusmenuMenuitem * mi, const gchar * property, const GValue * value) @@ -1089,6 +1090,7 @@ dbusmenu_menuitem_property_get (DbusmenuMenuitem * mi, const gchar * property) exist. Return value: A GValue for the property. + Deprecated: Use dbusmenu_menuitem_property_get_variant() instead */ const GValue * dbusmenu_menuitem_property_get_value (DbusmenuMenuitem * mi, const gchar * property) -- cgit v1.2.3 From 17af43e09f01979a4ab660bbd2a60d9212a8ef13 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 17 Nov 2010 20:12:53 -0600 Subject: Removing the set_value and get_value functions from being used elsewhere in -glib --- libdbusmenu-glib/menuitem-proxy.c | 6 +++--- libdbusmenu-glib/server.c | 15 +++------------ 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/libdbusmenu-glib/menuitem-proxy.c b/libdbusmenu-glib/menuitem-proxy.c index 7acb541..68bdcc6 100644 --- a/libdbusmenu-glib/menuitem-proxy.c +++ b/libdbusmenu-glib/menuitem-proxy.c @@ -173,10 +173,10 @@ handle_event (DbusmenuMenuitem * mi, const gchar * name, const GValue * value, g /* Watches a property change and makes sure to put that value into our property list. */ static void -proxy_item_property_changed (DbusmenuMenuitem * mi, gchar * property, GValue * value, gpointer user_data) +proxy_item_property_changed (DbusmenuMenuitem * mi, gchar * property, GVariant * variant, gpointer user_data) { DbusmenuMenuitemProxy * pmi = DBUSMENU_MENUITEM_PROXY(user_data); - dbusmenu_menuitem_property_set_value(DBUSMENU_MENUITEM(pmi), property, value); + dbusmenu_menuitem_property_set_variant(DBUSMENU_MENUITEM(pmi), property, variant); return; } @@ -273,7 +273,7 @@ add_menuitem (DbusmenuMenuitemProxy * pmi, DbusmenuMenuitem * mi) GList * prop; for (prop = props; prop != NULL; prop = g_list_next(prop)) { gchar * prop_name = (gchar *)prop->data; - dbusmenu_menuitem_property_set_value(DBUSMENU_MENUITEM(pmi), prop_name, dbusmenu_menuitem_property_get_value(priv->mi, prop_name)); + dbusmenu_menuitem_property_set_variant(DBUSMENU_MENUITEM(pmi), prop_name, dbusmenu_menuitem_property_get_variant(priv->mi, prop_name)); } g_list_free(props); diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c index 63d237f..4fdd6f8 100644 --- a/libdbusmenu-glib/server.c +++ b/libdbusmenu-glib/server.c @@ -815,8 +815,8 @@ bus_get_property (DbusmenuServer * server, GVariant * params, GDBusMethodInvocat return; } - const GValue * prop = dbusmenu_menuitem_property_get_value(mi, property); - if (prop == NULL) { + GVariant * variant = dbusmenu_menuitem_property_get_variant(mi, property); + if (variant == NULL) { g_dbus_method_invocation_return_error(invocation, error_quark(), INVALID_PROPERTY_NAME, @@ -826,16 +826,7 @@ bus_get_property (DbusmenuServer * server, GVariant * params, GDBusMethodInvocat return; } - GValue vval = {0}; - g_value_init(&vval, G_TYPE_VARIANT); - - if (!g_value_transform(prop, &vval)) { - g_warning("Unable to convert property '%s' value from type '%s' to variant", property, G_VALUE_TYPE_NAME(prop)); - } - - g_dbus_method_invocation_return_value(invocation, g_value_get_variant(&vval)); - g_value_unset(&vval); - + g_dbus_method_invocation_return_value(invocation, variant); return; } -- cgit v1.2.3 From 153a249f1029171cfcf40cf34ccc5157ba791c20 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 17 Nov 2010 20:37:01 -0600 Subject: Switching everything to start using variants... even ahead of GLib --- libdbusmenu-gtk/client.c | 71 ++++++++++++++++----------------------- libdbusmenu-gtk/genericmenuitem.c | 2 ++ 2 files changed, 31 insertions(+), 42 deletions(-) diff --git a/libdbusmenu-gtk/client.c b/libdbusmenu-gtk/client.c index 487971f..9dd18df 100644 --- a/libdbusmenu-gtk/client.c +++ b/libdbusmenu-gtk/client.c @@ -57,9 +57,9 @@ static void item_activate (DbusmenuClient * client, DbusmenuMenuitem * mi, guint static gboolean new_item_normal (DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, DbusmenuClient * client); static gboolean new_item_seperator (DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, DbusmenuClient * client); -static void process_visible (DbusmenuMenuitem * mi, GtkMenuItem * gmi, const GValue * value); -static void process_sensitive (DbusmenuMenuitem * mi, GtkMenuItem * gmi, const GValue * value); -static void image_property_handle (DbusmenuMenuitem * item, const gchar * property, const GValue * invalue, gpointer userdata); +static void process_visible (DbusmenuMenuitem * mi, GtkMenuItem * gmi, GVariant * value); +static void process_sensitive (DbusmenuMenuitem * mi, GtkMenuItem * gmi, GVariant * value); +static void image_property_handle (DbusmenuMenuitem * item, const gchar * property, GVariant * invalue, gpointer userdata); /* GObject Stuff */ G_DEFINE_TYPE (DbusmenuGtkClient, dbusmenu_gtkclient, DBUSMENU_TYPE_CLIENT); @@ -283,10 +283,8 @@ static gboolean menu_pressed_cb (GtkMenuItem * gmi, DbusmenuMenuitem * mi) { if (gtk_menu_item_get_submenu(gmi) == NULL) { - GValue value = {0}; - g_value_init(&value, G_TYPE_INT); - g_value_set_int(&value, 0); - dbusmenu_menuitem_handle_event(mi, "clicked", &value, gtk_get_current_event_time()); + GVariant * variant = g_variant_new("i", 0); + dbusmenu_menuitem_handle_event(mi, "clicked", variant, gtk_get_current_event_time()); } else { /* TODO: We need to stop the display of the submenu until this callback returns. */ @@ -297,7 +295,7 @@ menu_pressed_cb (GtkMenuItem * gmi, DbusmenuMenuitem * mi) /* Process the visible property */ static void -process_visible (DbusmenuMenuitem * mi, GtkMenuItem * gmi, const GValue * value) +process_visible (DbusmenuMenuitem * mi, GtkMenuItem * gmi, GVariant * value) { gboolean val = TRUE; if (value != NULL) { @@ -314,7 +312,7 @@ process_visible (DbusmenuMenuitem * mi, GtkMenuItem * gmi, const GValue * value) /* Process the sensitive property */ static void -process_sensitive (DbusmenuMenuitem * mi, GtkMenuItem * gmi, const GValue * value) +process_sensitive (DbusmenuMenuitem * mi, GtkMenuItem * gmi, GVariant * value) { gboolean val = TRUE; if (value != NULL) { @@ -326,26 +324,21 @@ process_sensitive (DbusmenuMenuitem * mi, GtkMenuItem * gmi, const GValue * valu /* Process the sensitive property */ static void -process_toggle_type (DbusmenuMenuitem * mi, GtkMenuItem * gmi, const GValue * value) +process_toggle_type (DbusmenuMenuitem * mi, GtkMenuItem * gmi, GVariant * variant) { if (!IS_GENERICMENUITEM(gmi)) return; - if (value == NULL) return; + if (variant == NULL) return; GenericmenuitemCheckType type = GENERICMENUITEM_CHECK_TYPE_NONE; - GValue strvalue = {0}; - g_value_init(&strvalue, G_TYPE_STRING); - - if (value != NULL && g_value_transform(value, &strvalue)) { - const gchar * strval = g_value_get_string(&strvalue); + if (variant != NULL) { + const gchar * strval = g_variant_get_string(variant, NULL); if (!g_strcmp0(strval, DBUSMENU_MENUITEM_TOGGLE_CHECK)) { type = GENERICMENUITEM_CHECK_TYPE_CHECKBOX; } else if (!g_strcmp0(strval, DBUSMENU_MENUITEM_TOGGLE_RADIO)) { type = GENERICMENUITEM_CHECK_TYPE_RADIO; } - - g_value_unset(&strvalue); } genericmenuitem_set_check_type(GENERICMENUITEM(gmi), type); @@ -355,17 +348,14 @@ process_toggle_type (DbusmenuMenuitem * mi, GtkMenuItem * gmi, const GValue * va /* Process the sensitive property */ static void -process_toggle_state (DbusmenuMenuitem * mi, GtkMenuItem * gmi, const GValue * value) +process_toggle_state (DbusmenuMenuitem * mi, GtkMenuItem * gmi, GVariant * variant) { if (!IS_GENERICMENUITEM(gmi)) return; GenericmenuitemState state = GENERICMENUITEM_STATE_UNCHECKED; - GValue intvalue = {0}; - g_value_init(&intvalue, G_TYPE_INT); - - if (value != NULL && g_value_transform(value, &intvalue)) { - int val = g_value_get_int(&intvalue); + if (variant != NULL) { + int val = g_variant_get_int32(variant); if (val == DBUSMENU_MENUITEM_TOGGLE_STATE_CHECKED) { state = GENERICMENUITEM_STATE_CHECKED; @@ -381,18 +371,18 @@ process_toggle_state (DbusmenuMenuitem * mi, GtkMenuItem * gmi, const GValue * v /* Whenever we have a property change on a DbusmenuMenuitem we need to be responsive to that. */ static void -menu_prop_change_cb (DbusmenuMenuitem * mi, gchar * prop, GValue * value, GtkMenuItem * gmi) +menu_prop_change_cb (DbusmenuMenuitem * mi, gchar * prop, GVariant * variant, GtkMenuItem * gmi) { if (!g_strcmp0(prop, DBUSMENU_MENUITEM_PROP_LABEL)) { - gtk_menu_item_set_label(gmi, g_value_get_string(value)); + gtk_menu_item_set_label(gmi, g_variant_get_string(variant, NULL)); } else if (!g_strcmp0(prop, DBUSMENU_MENUITEM_PROP_VISIBLE)) { - process_visible(mi, gmi, value); + process_visible(mi, gmi, variant); } else if (!g_strcmp0(prop, DBUSMENU_MENUITEM_PROP_ENABLED)) { - process_sensitive(mi, gmi, value); + process_sensitive(mi, gmi, variant); } else if (!g_strcmp0(prop, DBUSMENU_MENUITEM_PROP_TOGGLE_TYPE)) { - process_toggle_type(mi, gmi, value); + process_toggle_type(mi, gmi, variant); } else if (!g_strcmp0(prop, DBUSMENU_MENUITEM_PROP_TOGGLE_STATE)) { - process_toggle_state(mi, gmi, value); + process_toggle_state(mi, gmi, variant); } return; @@ -401,7 +391,7 @@ menu_prop_change_cb (DbusmenuMenuitem * mi, gchar * prop, GValue * value, GtkMen /* Special handler for the shortcut changing as we need to have the client for that one to get the accel group. */ static void -menu_shortcut_change_cb (DbusmenuMenuitem * mi, gchar * prop, GValue * value, DbusmenuGtkClient * client) +menu_shortcut_change_cb (DbusmenuMenuitem * mi, gchar * prop, GVariant * value, DbusmenuGtkClient * client) { if (!g_strcmp0(prop, DBUSMENU_MENUITEM_PROP_SHORTCUT)) { refresh_shortcut(client, mi); @@ -537,10 +527,10 @@ dbusmenu_gtkclient_newitem_base (DbusmenuGtkClient * client, DbusmenuMenuitem * g_object_weak_ref(G_OBJECT(item), destoryed_dbusmenuitem_cb, gmi); /* Check our set of props to see if any are set already */ - process_visible(item, gmi, dbusmenu_menuitem_property_get_value(item, DBUSMENU_MENUITEM_PROP_VISIBLE)); - process_sensitive(item, gmi, dbusmenu_menuitem_property_get_value(item, DBUSMENU_MENUITEM_PROP_ENABLED)); - process_toggle_type(item, gmi, dbusmenu_menuitem_property_get_value(item, DBUSMENU_MENUITEM_PROP_TOGGLE_TYPE)); - process_toggle_state(item, gmi, dbusmenu_menuitem_property_get_value(item, DBUSMENU_MENUITEM_PROP_TOGGLE_STATE)); + process_visible(item, gmi, dbusmenu_menuitem_property_get_variant(item, DBUSMENU_MENUITEM_PROP_VISIBLE)); + process_sensitive(item, gmi, dbusmenu_menuitem_property_get_variant(item, DBUSMENU_MENUITEM_PROP_ENABLED)); + process_toggle_type(item, gmi, dbusmenu_menuitem_property_get_variant(item, DBUSMENU_MENUITEM_PROP_TOGGLE_TYPE)); + process_toggle_state(item, gmi, dbusmenu_menuitem_property_get_variant(item, DBUSMENU_MENUITEM_PROP_TOGGLE_STATE)); refresh_shortcut(client, item); /* Oh, we're a child, let's deal with that */ @@ -705,11 +695,11 @@ new_item_normal (DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, Dbusmenu image_property_handle(newitem, DBUSMENU_MENUITEM_PROP_ICON_NAME, - dbusmenu_menuitem_property_get_value(newitem, DBUSMENU_MENUITEM_PROP_ICON_NAME), + dbusmenu_menuitem_property_get_variant(newitem, DBUSMENU_MENUITEM_PROP_ICON_NAME), client); image_property_handle(newitem, DBUSMENU_MENUITEM_PROP_ICON_DATA, - dbusmenu_menuitem_property_get_value(newitem, DBUSMENU_MENUITEM_PROP_ICON_DATA), + dbusmenu_menuitem_property_get_variant(newitem, DBUSMENU_MENUITEM_PROP_ICON_DATA), client); g_signal_connect(G_OBJECT(newitem), DBUSMENU_MENUITEM_SIGNAL_PROPERTY_CHANGED, @@ -743,7 +733,7 @@ new_item_seperator (DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, Dbusm /* This handler looks at property changes for items that are image menu items. */ static void -image_property_handle (DbusmenuMenuitem * item, const gchar * property, const GValue * invalue, gpointer userdata) +image_property_handle (DbusmenuMenuitem * item, const gchar * property, GVariant * variant, gpointer userdata) { /* We're only looking at these two properties here */ if (g_strcmp0(property, DBUSMENU_MENUITEM_PROP_ICON_NAME) != 0 && @@ -752,11 +742,8 @@ image_property_handle (DbusmenuMenuitem * item, const gchar * property, const GV } const gchar * value = NULL; + value = g_variant_get_string(variant, NULL); - if (invalue != NULL && G_VALUE_TYPE(invalue) == G_TYPE_STRING) { - value = g_value_get_string(invalue); - } - if (value == NULL || value[0] == '\0') { /* This means that we're unsetting a value. */ /* Try to use the other one */ diff --git a/libdbusmenu-gtk/genericmenuitem.c b/libdbusmenu-gtk/genericmenuitem.c index 30b072f..cb76964 100644 --- a/libdbusmenu-gtk/genericmenuitem.c +++ b/libdbusmenu-gtk/genericmenuitem.c @@ -298,6 +298,8 @@ genericmenuitem_set_check_type (Genericmenuitem * item, GenericmenuitemCheckType return; } + g_value_unset(&value); + gtk_widget_queue_draw(GTK_WIDGET(item)); return; -- cgit v1.2.3 From 01603a653335b7f4f09120fc5e04f3273c36a8b5 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 17 Nov 2010 20:50:45 -0600 Subject: Change all the event handling to use GVariants --- libdbusmenu-glib/client-menuitem.c | 6 +++--- libdbusmenu-glib/client.c | 21 +++++++++------------ libdbusmenu-glib/client.h | 2 +- libdbusmenu-glib/menuitem-proxy.c | 6 +++--- libdbusmenu-glib/menuitem.c | 10 +++++----- libdbusmenu-glib/menuitem.h | 12 +++--------- libdbusmenu-glib/server.c | 11 ++++------- 7 files changed, 28 insertions(+), 40 deletions(-) diff --git a/libdbusmenu-glib/client-menuitem.c b/libdbusmenu-glib/client-menuitem.c index 9c21065..0f14b85 100644 --- a/libdbusmenu-glib/client-menuitem.c +++ b/libdbusmenu-glib/client-menuitem.c @@ -45,7 +45,7 @@ static void dbusmenu_client_menuitem_class_init (DbusmenuClientMenuitemClass *kl static void dbusmenu_client_menuitem_init (DbusmenuClientMenuitem *self); static void dbusmenu_client_menuitem_dispose (GObject *object); static void dbusmenu_client_menuitem_finalize (GObject *object); -static void handle_event (DbusmenuMenuitem * mi, const gchar * name, const GValue * value, guint timestamp); +static void handle_event (DbusmenuMenuitem * mi, const gchar * name, GVariant * value, guint timestamp); static void send_about_to_show (DbusmenuMenuitem * mi, void (*cb) (DbusmenuMenuitem * mi, gpointer user_data), gpointer cb_data); G_DEFINE_TYPE (DbusmenuClientMenuitem, dbusmenu_client_menuitem, DBUSMENU_TYPE_MENUITEM); @@ -102,10 +102,10 @@ dbusmenu_client_menuitem_new (gint id, DbusmenuClient * client) /* Passes the event signal on through the client. */ static void -handle_event (DbusmenuMenuitem * mi, const gchar * name, const GValue * value, guint timestamp) +handle_event (DbusmenuMenuitem * mi, const gchar * name, GVariant * variant, guint timestamp) { DbusmenuClientMenuitemPrivate * priv = DBUSMENU_CLIENT_MENUITEM_GET_PRIVATE(mi); - dbusmenu_client_send_event(priv->client, dbusmenu_menuitem_get_id(mi), name, value, timestamp); + dbusmenu_client_send_event(priv->client, dbusmenu_menuitem_get_id(mi), name, variant, timestamp); return; } diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index 7c90fa6..6f16eb2 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -112,7 +112,7 @@ struct _event_data_t { DbusmenuClient * client; DbusmenuMenuitem * menuitem; gchar * event; - GValue data; + GVariant * variant; guint timestamp; }; @@ -1189,9 +1189,9 @@ menuitem_call_cb (GObject * proxy, GAsyncResult * res, gpointer userdata) g_warning("Unable to call event '%s' on menu item %d: %s", edata->event, dbusmenu_menuitem_get_id(edata->menuitem), error->message); } - g_signal_emit(edata->client, signals[EVENT_RESULT], 0, edata->menuitem, edata->event, &edata->data, edata->timestamp, error, TRUE); + g_signal_emit(edata->client, signals[EVENT_RESULT], 0, edata->menuitem, edata->event, edata->variant, edata->timestamp, error, TRUE); - g_value_unset(&edata->data); + g_variant_unref(edata->variant); g_free(edata->event); g_object_unref(edata->menuitem); g_free(edata); @@ -1207,7 +1207,7 @@ menuitem_call_cb (GObject * proxy, GAsyncResult * res, gpointer userdata) /* Sends the event over DBus to the server on the other side of the bus. */ void -dbusmenu_client_send_event (DbusmenuClient * client, gint id, const gchar * name, const GValue * value, guint timestamp) +dbusmenu_client_send_event (DbusmenuClient * client, gint id, const gchar * name, GVariant * variant, guint timestamp) { g_return_if_fail(DBUSMENU_IS_CLIENT(client)); g_return_if_fail(id >= 0); @@ -1220,11 +1220,8 @@ dbusmenu_client_send_event (DbusmenuClient * client, gint id, const gchar * name return; } - if (value == NULL) { - GValue internalval = {0}; - g_value_init(&internalval, G_TYPE_INT); - g_value_set_int(&internalval, 0); - value = &internalval; + if (variant == NULL) { + variant = g_variant_new("i", 0); } event_data_t * edata = g_new0(event_data_t, 1); @@ -1232,13 +1229,13 @@ dbusmenu_client_send_event (DbusmenuClient * client, gint id, const gchar * name edata->menuitem = mi; g_object_ref(edata->menuitem); edata->event = g_strdup(name); - g_value_init(&edata->data, G_VALUE_TYPE(value)); - g_value_copy(value, &edata->data); edata->timestamp = timestamp; + edata->variant = variant; + g_variant_ref(variant); g_dbus_proxy_call(priv->menuproxy, "Event", - g_variant_new("isvu", id, name, value, timestamp), + g_variant_new("isvu", id, name, variant, timestamp), G_DBUS_CALL_FLAGS_NONE, 1000, /* timeout */ NULL, /* cancellable */ diff --git a/libdbusmenu-glib/client.h b/libdbusmenu-glib/client.h index 32813d9..3a3a988 100644 --- a/libdbusmenu-glib/client.h +++ b/libdbusmenu-glib/client.h @@ -122,7 +122,7 @@ gboolean dbusmenu_client_add_type_handler (DbusmenuClient * client, void dbusmenu_client_send_event (DbusmenuClient * client, gint id, const gchar * name, - const GValue * value, + GVariant * variant, guint timestamp); void dbusmenu_client_send_about_to_show(DbusmenuClient * client, gint id, diff --git a/libdbusmenu-glib/menuitem-proxy.c b/libdbusmenu-glib/menuitem-proxy.c index 68bdcc6..1d97c4c 100644 --- a/libdbusmenu-glib/menuitem-proxy.c +++ b/libdbusmenu-glib/menuitem-proxy.c @@ -56,7 +56,7 @@ static void dbusmenu_menuitem_proxy_dispose (GObject *object); static void dbusmenu_menuitem_proxy_finalize (GObject *object); static void set_property (GObject * obj, guint id, const GValue * value, GParamSpec * pspec); static void get_property (GObject * obj, guint id, GValue * value, GParamSpec * pspec); -static void handle_event (DbusmenuMenuitem * mi, const gchar * name, const GValue * value, guint timestamp); +static void handle_event (DbusmenuMenuitem * mi, const gchar * name, GVariant * variant, guint timestamp); static void add_menuitem (DbusmenuMenuitemProxy * pmi, DbusmenuMenuitem * mi); static void remove_menuitem (DbusmenuMenuitemProxy * pmi); @@ -162,12 +162,12 @@ get_property (GObject * obj, guint id, GValue * value, GParamSpec * pspec) /* Takes the event and passes it along to the item that we're playing proxy for. */ static void -handle_event (DbusmenuMenuitem * mi, const gchar * name, const GValue * value, guint timestamp) +handle_event (DbusmenuMenuitem * mi, const gchar * name, GVariant * variant, guint timestamp) { g_return_if_fail(DBUSMENU_IS_MENUITEM_PROXY(mi)); DbusmenuMenuitemProxyPrivate * priv = DBUSMENU_MENUITEM_PROXY_GET_PRIVATE(mi); g_return_if_fail(priv->mi != NULL); - return dbusmenu_menuitem_handle_event(priv->mi, name, value, timestamp); + return dbusmenu_menuitem_handle_event(priv->mi, name, variant, timestamp); } /* Watches a property change and makes sure to put that value diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index d5d4d26..643321a 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -94,7 +94,7 @@ static void set_property (GObject * obj, guint id, const GValue * value, GParamS static void get_property (GObject * obj, guint id, GValue * value, GParamSpec * pspec); static void g_value_transform_STRING_BOOLEAN (const GValue * in, GValue * out); static void g_value_transform_STRING_INT (const GValue * in, GValue * out); -static void handle_event (DbusmenuMenuitem * mi, const gchar * name, const GValue * value, guint timestamp); +static void handle_event (DbusmenuMenuitem * mi, const gchar * name, GVariant * value, guint timestamp); static void send_about_to_show (DbusmenuMenuitem * mi, void (*cb) (DbusmenuMenuitem * mi, gpointer user_data), gpointer cb_data); /* GObject stuff */ @@ -377,7 +377,7 @@ get_property (GObject * obj, guint id, GValue * value, GParamSpec * pspec) /* Handles the activate event if it is sent. */ static void -handle_event (DbusmenuMenuitem * mi, const gchar * name, const GValue * value, guint timestamp) +handle_event (DbusmenuMenuitem * mi, const gchar * name, GVariant * value, guint timestamp) { if (g_strcmp0(name, "clicked") == 0) { g_signal_emit(G_OBJECT(mi), signals[ITEM_ACTIVATED], 0, timestamp, TRUE); @@ -1445,7 +1445,7 @@ dbusmenu_menuitem_foreach (DbusmenuMenuitem * mi, void (*func) (DbusmenuMenuitem dbusmenu_menuitem_handle_event: @mi: The #DbusmenuMenuitem to send the signal on. @name: The name of the signal - @value: A value that could be set for the event + @variant: A value that could be set for the event @timestamp: The timestamp of when the event happened This function is called to create an event. It is likely @@ -1461,7 +1461,7 @@ dbusmenu_menuitem_foreach (DbusmenuMenuitem * mi, void (*func) (DbusmenuMenuitem reason not to. */ void -dbusmenu_menuitem_handle_event (DbusmenuMenuitem * mi, const gchar * name, const GValue * value, guint timestamp) +dbusmenu_menuitem_handle_event (DbusmenuMenuitem * mi, const gchar * name, GVariant * variant, guint timestamp) { g_return_if_fail(DBUSMENU_IS_MENUITEM(mi)); #ifdef MASSIVEDEBUGGING @@ -1470,7 +1470,7 @@ dbusmenu_menuitem_handle_event (DbusmenuMenuitem * mi, const gchar * name, const DbusmenuMenuitemClass * class = DBUSMENU_MENUITEM_GET_CLASS(mi); if (class->handle_event != NULL) { - return class->handle_event(mi, name, value, timestamp); + return class->handle_event(mi, name, variant, timestamp); } return; } diff --git a/libdbusmenu-glib/menuitem.h b/libdbusmenu-glib/menuitem.h index 77bca4b..9158f3e 100644 --- a/libdbusmenu-glib/menuitem.h +++ b/libdbusmenu-glib/menuitem.h @@ -145,7 +145,7 @@ struct _DbusmenuMenuitemClass GObjectClass parent_class; /* Signals */ - void (*property_changed) (gchar * property, GValue * value); + void (*property_changed) (gchar * property, GVariant * value); void (*item_activated) (guint timestamp); void (*child_added) (DbusmenuMenuitem * child, guint position); void (*child_removed) (DbusmenuMenuitem * child); @@ -154,7 +154,7 @@ struct _DbusmenuMenuitemClass /* Virtual functions */ dbusmenu_menuitem_buildxml_slot_t buildxml; - void (*handle_event) (DbusmenuMenuitem * mi, const gchar * name, const GValue * value, guint timestamp); + void (*handle_event) (DbusmenuMenuitem * mi, const gchar * name, GVariant * value, guint timestamp); void (*send_about_to_show) (DbusmenuMenuitem * mi, void (*cb) (DbusmenuMenuitem * mi, gpointer user_data), gpointer cb_data); void (*show_to_user) (DbusmenuMenuitem * mi, guint timestamp, gpointer cb_data); @@ -188,16 +188,10 @@ DbusmenuMenuitem * dbusmenu_menuitem_child_find (DbusmenuMenuitem * mi, gint id) DbusmenuMenuitem * dbusmenu_menuitem_find_id (DbusmenuMenuitem * mi, gint id); gboolean dbusmenu_menuitem_property_set (DbusmenuMenuitem * mi, const gchar * property, const gchar * value); -#ifndef DBUSMENU_DISABLE_DEPRECATED -gboolean dbusmenu_menuitem_property_set_value (DbusmenuMenuitem * mi, const gchar * property, const GValue * value); -#endif gboolean dbusmenu_menuitem_property_set_variant (DbusmenuMenuitem * mi, const gchar * property, GVariant * value); gboolean dbusmenu_menuitem_property_set_bool (DbusmenuMenuitem * mi, const gchar * property, const gboolean value); gboolean dbusmenu_menuitem_property_set_int (DbusmenuMenuitem * mi, const gchar * property, const gint value); const gchar * dbusmenu_menuitem_property_get (DbusmenuMenuitem * mi, const gchar * property); -#ifndef DBUSMENU_DISABLE_DEPRECATED -const GValue * dbusmenu_menuitem_property_get_value (DbusmenuMenuitem * mi, const gchar * property); -#endif GVariant * dbusmenu_menuitem_property_get_variant (DbusmenuMenuitem * mi, const gchar * property); gboolean dbusmenu_menuitem_property_get_bool (DbusmenuMenuitem * mi, const gchar * property); gint dbusmenu_menuitem_property_get_int (DbusmenuMenuitem * mi, const gchar * property); @@ -210,7 +204,7 @@ void dbusmenu_menuitem_set_root (DbusmenuMenuitem * mi, gboolean root); gboolean dbusmenu_menuitem_get_root (DbusmenuMenuitem * mi); void dbusmenu_menuitem_foreach (DbusmenuMenuitem * mi, void (*func) (DbusmenuMenuitem * mi, gpointer data), gpointer data); -void dbusmenu_menuitem_handle_event (DbusmenuMenuitem * mi, const gchar * name, const GValue * value, guint timestamp); +void dbusmenu_menuitem_handle_event (DbusmenuMenuitem * mi, const gchar * name, GVariant * value, guint timestamp); void dbusmenu_menuitem_send_about_to_show (DbusmenuMenuitem * mi, void (*cb) (DbusmenuMenuitem * mi, gpointer user_data), gpointer cb_data); void dbusmenu_menuitem_show_to_user (DbusmenuMenuitem * mi, guint timestamp); diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c index 4fdd6f8..bd5c2ac 100644 --- a/libdbusmenu-glib/server.c +++ b/libdbusmenu-glib/server.c @@ -935,7 +935,7 @@ typedef struct _idle_event_t idle_event_t; struct _idle_event_t { DbusmenuMenuitem * mi; gchar * eventid; - GValue data; + GVariant * variant; guint timestamp; }; @@ -946,11 +946,11 @@ event_local_handler (gpointer user_data) { idle_event_t * data = (idle_event_t *)user_data; - dbusmenu_menuitem_handle_event(data->mi, data->eventid, &data->data, data->timestamp); + dbusmenu_menuitem_handle_event(data->mi, data->eventid, data->variant, data->timestamp); g_object_unref(data->mi); g_free(data->eventid); - g_value_unset(&data->data); + g_variant_unref(data->variant); g_free(data); return FALSE; } @@ -977,10 +977,7 @@ bus_event (DbusmenuServer * server, GVariant * params, GDBusMethodInvocation * i g_object_ref(event_data->mi); event_data->eventid = g_strdup(g_variant_get_string(g_variant_get_child_value(params, 1), NULL)); event_data->timestamp = g_variant_get_uint32(g_variant_get_child_value(params, 3)); - - /* TODO: Need to figure out converting a variant to a value */ - g_value_init(&(event_data->data), G_TYPE_INT); - g_value_set_int(&(event_data->data), 0); + event_data->variant = g_variant_get_child_value(params, 2); g_timeout_add(0, event_local_handler, event_data); -- cgit v1.2.3 From a1c3b2b9d5ad5a8444a972a04faff1e70f9b2ad7 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 17 Nov 2010 20:55:15 -0600 Subject: Dropping set and get value --- libdbusmenu-glib/menuitem.c | 77 --------------------------------------------- 1 file changed, 77 deletions(-) diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index 643321a..47fbdf9 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -961,59 +961,6 @@ dbusmenu_menuitem_property_set_int (DbusmenuMenuitem * mi, const gchar * propert return dbusmenu_menuitem_property_set_variant(mi, property, variant); } -/** - dbusmenu_menuitem_property_set_value: - @mi: The #DbusmenuMenuitem to set the property on. - @property: Name of the property to set. - @value: The value of the property. - - Takes the pair of @property and @value and places them as a - property on @mi. If a property already exists by that name, - then the value is set to the new value. If not, the property - is added. If the value is changed or the property was previously - unset then the signal #DbusmenuMenuitem::prop-changed will be - emitted by this function. - - Return value: A boolean representing if the property value was set. - Deprecated: Use dbusmenu_menuitem_property_set_variant() instead -*/ -gboolean -dbusmenu_menuitem_property_set_value (DbusmenuMenuitem * mi, const gchar * property, const GValue * value) -{ - /* TODO: Switch to use variant */ - g_return_val_if_fail(DBUSMENU_IS_MENUITEM(mi), FALSE); - g_return_val_if_fail(property != NULL, FALSE); - g_return_val_if_fail(G_IS_VALUE(value), FALSE); - - DbusmenuMenuitemPrivate * priv = DBUSMENU_MENUITEM_GET_PRIVATE(mi); - /* g_debug("Setting a property. ID: %d Prop: %s Value: %s", priv->id, property, value); */ - - #if 0 - gpointer lookup = g_hash_table_lookup(priv->properties, property); - if (g_strcmp0((gchar *)lookup, value) == 0) { - /* The value is the same as the value currently in the - table so we don't really care. Just say everything's okay */ - return TRUE; - } - #endif - - gchar * lprop = g_strdup(property); - GValue * lval = g_new0(GValue, 1); - g_value_init(lval, G_VALUE_TYPE(value)); - g_value_copy(value, lval); - - g_hash_table_replace(priv->properties, lprop, lval); - #ifdef MASSIVEDEBUGGING - gchar * valstr = g_strdup_value_contents(lval); - g_debug("Menuitem %d (%s) signalling property '%s' changed to '%s'", ID(mi), LABEL(mi), property, g_utf8_strlen(valstr, 50) < 25 ? valstr : ""); - g_free(valstr); - #endif - - g_signal_emit(G_OBJECT(mi), signals[PROPERTY_CHANGED], 0, lprop, lval, TRUE); - - return TRUE; -} - /** dbusmenu_menuitem_property_set_variant: @mi: The #DbusmenuMenuitem to set the property on. @@ -1080,30 +1027,6 @@ dbusmenu_menuitem_property_get (DbusmenuMenuitem * mi, const gchar * property) return g_variant_get_string(variant, NULL); } -/** - dbusmenu_menuitem_property_get_value: - @mi: The #DbusmenuMenuitem to look for the property on. - @property: The property to grab. - - Look up a property on @mi and return the value of it if - it exits. #NULL will be returned if the property doesn't - exist. - - Return value: A GValue for the property. - Deprecated: Use dbusmenu_menuitem_property_get_variant() instead -*/ -const GValue * -dbusmenu_menuitem_property_get_value (DbusmenuMenuitem * mi, const gchar * property) -{ - /* TODO: Switch to use variant */ - g_return_val_if_fail(DBUSMENU_IS_MENUITEM(mi), NULL); - g_return_val_if_fail(property != NULL, NULL); - - DbusmenuMenuitemPrivate * priv = DBUSMENU_MENUITEM_GET_PRIVATE(mi); - - return (const GValue *)g_hash_table_lookup(priv->properties, property); -} - /** dbusmenu_menuitem_property_get_variant: @mi: The #DbusmenuMenuitem to look for the property on. -- cgit v1.2.3 From 050ca49a1179f4c04d6c175e8005e8516fd80654 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 17 Nov 2010 21:07:51 -0600 Subject: Variants in sending over the server connection --- libdbusmenu-glib/client.h | 2 +- libdbusmenu-glib/server.c | 16 +++------------- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/libdbusmenu-glib/client.h b/libdbusmenu-glib/client.h index 3a3a988..1ae89fa 100644 --- a/libdbusmenu-glib/client.h +++ b/libdbusmenu-glib/client.h @@ -84,7 +84,7 @@ struct _DbusmenuClientClass { void (*root_changed) (DbusmenuMenuitem * newroot); void (*new_menuitem) (DbusmenuMenuitem * newitem); void (*item_activate) (DbusmenuMenuitem * item, guint timestamp); - void (*event_result) (DbusmenuMenuitem * item, gchar * event, GValue * data, guint timestamp, GError * error); + void (*event_result) (DbusmenuMenuitem * item, gchar * event, GVariant * data, guint timestamp, GError * error); /*< Private >*/ void (*reserved1) (void); diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c index bd5c2ac..1005e1b 100644 --- a/libdbusmenu-glib/server.c +++ b/libdbusmenu-glib/server.c @@ -141,7 +141,7 @@ static GVariant * bus_get_prop (GDBusConnection * connection, gpointer user_data); static void menuitem_property_changed (DbusmenuMenuitem * mi, gchar * property, - GValue * value, + GVariant * variant, DbusmenuServer * server); static void menuitem_child_added (DbusmenuMenuitem * parent, DbusmenuMenuitem * child, @@ -619,21 +619,13 @@ layout_update_signal (DbusmenuServer * server) } static void -menuitem_property_changed (DbusmenuMenuitem * mi, gchar * property, GValue * value, DbusmenuServer * server) +menuitem_property_changed (DbusmenuMenuitem * mi, gchar * property, GVariant * variant, DbusmenuServer * server) { DbusmenuServerPrivate * priv = DBUSMENU_SERVER_GET_PRIVATE(server); - g_signal_emit(G_OBJECT(server), signals[ID_PROP_UPDATE], 0, dbusmenu_menuitem_get_id(mi), property, value, TRUE); + g_signal_emit(G_OBJECT(server), signals[ID_PROP_UPDATE], 0, dbusmenu_menuitem_get_id(mi), property, variant, TRUE); if (priv->dbusobject != NULL && priv->bus != NULL) { - GValue variantval = {0}; - g_value_init(&variantval, G_TYPE_VARIANT); - - if (!g_value_transform(value, &variantval)) { - g_warning("Unable to convert property '%s' of type %s to a variant", property, G_VALUE_TYPE_NAME(value)); - } - GVariant * variant = g_value_get_variant(&variantval); - g_dbus_connection_emit_signal(priv->bus, NULL, priv->dbusobject, @@ -641,8 +633,6 @@ menuitem_property_changed (DbusmenuMenuitem * mi, gchar * property, GValue * val "ItemPropertyUpdated", g_variant_new("(isv)", dbusmenu_menuitem_get_id(mi), property, variant), NULL); - - g_value_unset(&variantval); } return; } -- cgit v1.2.3 From 0dea1bb0779b8cddbf631ee80f76d13aa8920ec5 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 17 Nov 2010 21:11:40 -0600 Subject: Fixing our signals and marshallers for them as well --- libdbusmenu-glib/client-marshal.list | 2 +- libdbusmenu-glib/client.c | 4 ++-- libdbusmenu-glib/menuitem-marshal.list | 2 +- libdbusmenu-glib/menuitem.c | 4 ++-- libdbusmenu-glib/server-marshal.list | 2 +- libdbusmenu-glib/server.c | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/libdbusmenu-glib/client-marshal.list b/libdbusmenu-glib/client-marshal.list index 2e14491..866dfa8 100644 --- a/libdbusmenu-glib/client-marshal.list +++ b/libdbusmenu-glib/client-marshal.list @@ -1,2 +1,2 @@ VOID: OBJECT, UINT -VOID: OBJECT, STRING, POINTER, UINT, POINTER +VOID: OBJECT, STRING, VARIANT, UINT, POINTER diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index 6f16eb2..629a1be 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -245,8 +245,8 @@ dbusmenu_client_class_init (DbusmenuClientClass *klass) G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (DbusmenuClientClass, event_result), NULL, NULL, - _dbusmenu_client_marshal_VOID__OBJECT_STRING_POINTER_UINT_POINTER, - G_TYPE_NONE, 5, G_TYPE_OBJECT, G_TYPE_STRING, G_TYPE_POINTER, G_TYPE_UINT, G_TYPE_POINTER); + _dbusmenu_client_marshal_VOID__OBJECT_STRING_VARIANT_UINT_POINTER, + G_TYPE_NONE, 5, G_TYPE_OBJECT, G_TYPE_STRING, G_TYPE_VARIANT, G_TYPE_UINT, G_TYPE_POINTER); g_object_class_install_property (object_class, PROP_DBUSOBJECT, g_param_spec_string(DBUSMENU_CLIENT_PROP_DBUS_OBJECT, "DBus Object we represent", diff --git a/libdbusmenu-glib/menuitem-marshal.list b/libdbusmenu-glib/menuitem-marshal.list index 654c91b..e3cb272 100644 --- a/libdbusmenu-glib/menuitem-marshal.list +++ b/libdbusmenu-glib/menuitem-marshal.list @@ -1,4 +1,4 @@ -VOID: STRING, POINTER +VOID: STRING, VARIANT VOID: OBJECT, UINT, UINT VOID: OBJECT, UINT VOID: OBJECT diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index 47fbdf9..24196fc 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -129,8 +129,8 @@ dbusmenu_menuitem_class_init (DbusmenuMenuitemClass *klass) G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET(DbusmenuMenuitemClass, property_changed), NULL, NULL, - _dbusmenu_menuitem_marshal_VOID__STRING_POINTER, - G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_POINTER); + _dbusmenu_menuitem_marshal_VOID__STRING_VARIANT, + G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_VARIANT); /** DbusmenuMenuitem::item-activated: @arg0: The #DbusmenuMenuitem object. diff --git a/libdbusmenu-glib/server-marshal.list b/libdbusmenu-glib/server-marshal.list index 0d68c4e..08ebf93 100644 --- a/libdbusmenu-glib/server-marshal.list +++ b/libdbusmenu-glib/server-marshal.list @@ -1,3 +1,3 @@ -VOID: INT, STRING, POINTER +VOID: INT, STRING, VARIANT VOID: UINT, INT VOID: INT, UINT diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c index 1005e1b..8d5c558 100644 --- a/libdbusmenu-glib/server.c +++ b/libdbusmenu-glib/server.c @@ -216,8 +216,8 @@ dbusmenu_server_class_init (DbusmenuServerClass *class) G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET(DbusmenuServerClass, id_prop_update), NULL, NULL, - _dbusmenu_server_marshal_VOID__INT_STRING_POINTER, - G_TYPE_NONE, 3, G_TYPE_INT, G_TYPE_STRING, G_TYPE_VALUE); + _dbusmenu_server_marshal_VOID__INT_STRING_VARIANT, + G_TYPE_NONE, 3, G_TYPE_INT, G_TYPE_STRING, G_TYPE_VARIANT); /** DbusmenuServer::id-update: @arg0: The #DbusmenuServer emitting the signal. -- cgit v1.2.3 From aabdcffea6b311cda25ad2937466d65fc4e36381 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 17 Nov 2010 21:23:27 -0600 Subject: Moving the GValues over to GVariant --- tests/test-glib-events-client.c | 14 ++++++-------- tests/test-glib-objects.c | 24 ++++++++++++------------ tests/test-glib-proxy-client.c | 7 +++---- tests/test-gtk-objects.c | 4 ++-- 4 files changed, 23 insertions(+), 26 deletions(-) diff --git a/tests/test-glib-events-client.c b/tests/test-glib-events-client.c index 97d5caf..ee0b821 100644 --- a/tests/test-glib-events-client.c +++ b/tests/test-glib-events-client.c @@ -35,7 +35,7 @@ static gboolean passed = TRUE; static gboolean first = TRUE; static void -event_status (DbusmenuClient * client, DbusmenuMenuitem * item, gchar * name, GValue * data, guint timestamp, GError * error, gpointer user_data) +event_status (DbusmenuClient * client, DbusmenuMenuitem * item, gchar * name, GVariant * data, guint timestamp, GError * error, gpointer user_data) { g_debug("Event status: %s", error == NULL ? "Sent" : "Error"); @@ -46,8 +46,8 @@ event_status (DbusmenuClient * client, DbusmenuMenuitem * item, gchar * name, GV return; } - if (g_value_get_int(data) != DATA_VALUE) { - g_debug("Data value pass fail got: %d", g_value_get_int(data)); + if (g_variant_get_int32(data) != DATA_VALUE) { + g_debug("Data value pass fail got: %d", g_variant_get_int32(data)); passed = FALSE; g_main_loop_quit(mainloop); return; @@ -96,11 +96,9 @@ layout_updated (DbusmenuClient * client, gpointer user_data) return; } - GValue data = {0}; - g_value_init(&data, G_TYPE_INT); - g_value_set_int(&data, DATA_VALUE); - - dbusmenu_menuitem_handle_event(menuroot, "clicked", &data, TIMESTAMP_VALUE); + GVariant * data = g_variant_new("i", DATA_VALUE); + dbusmenu_menuitem_handle_event(menuroot, "clicked", data, TIMESTAMP_VALUE); + g_variant_unref(data); return; } diff --git a/tests/test-glib-objects.c b/tests/test-glib-objects.c index 1d4f673..c6a8dc9 100644 --- a/tests/test-glib-objects.c +++ b/tests/test-glib-objects.c @@ -77,17 +77,17 @@ test_object_menuitem_props_string (void) { /* Build a menu item */ DbusmenuMenuitem * item = dbusmenu_menuitem_new(); - const GValue * out = NULL; + GVariant * out = NULL; /* Test to make sure it's a happy object */ g_assert(item != NULL); /* Setting a string */ dbusmenu_menuitem_property_set(item, "string", "value"); - out = dbusmenu_menuitem_property_get_value(item, "string"); + out = dbusmenu_menuitem_property_get_variant(item, "string"); g_assert(out != NULL); - g_assert(G_VALUE_TYPE(out) == G_TYPE_STRING); - g_assert(!g_strcmp0(g_value_get_string(out), "value")); + g_assert(g_variant_type_equal(g_variant_get_type(out), G_VARIANT_TYPE_STRING)); + g_assert(!g_strcmp0(g_variant_get_string(out, NULL), "value")); g_assert(!g_strcmp0(dbusmenu_menuitem_property_get(item, "string"), "value")); g_object_unref(item); @@ -101,17 +101,17 @@ test_object_menuitem_props_int (void) { /* Build a menu item */ DbusmenuMenuitem * item = dbusmenu_menuitem_new(); - const GValue * out = NULL; + GVariant * out = NULL; /* Test to make sure it's a happy object */ g_assert(item != NULL); /* Setting a string */ dbusmenu_menuitem_property_set_int(item, "int", 12345); - out = dbusmenu_menuitem_property_get_value(item, "int"); + out = dbusmenu_menuitem_property_get_variant(item, "int"); g_assert(out != NULL); - g_assert(G_VALUE_TYPE(out) == G_TYPE_INT); - g_assert(g_value_get_int(out) == 12345); + g_assert(g_variant_type_equal(g_variant_get_type(out), G_VARIANT_TYPE_INT32)); + g_assert(g_variant_get_int32(out) == 12345); g_assert(dbusmenu_menuitem_property_get_int(item, "int") == 12345); g_object_unref(item); @@ -125,17 +125,17 @@ test_object_menuitem_props_bool (void) { /* Build a menu item */ DbusmenuMenuitem * item = dbusmenu_menuitem_new(); - const GValue * out = NULL; + GVariant * out = NULL; /* Test to make sure it's a happy object */ g_assert(item != NULL); /* Setting a string */ dbusmenu_menuitem_property_set_bool(item, "boolean", TRUE); - out = dbusmenu_menuitem_property_get_value(item, "boolean"); + out = dbusmenu_menuitem_property_get_variant(item, "boolean"); g_assert(out != NULL); - g_assert(G_VALUE_TYPE(out) == G_TYPE_BOOLEAN); - g_assert(g_value_get_boolean(out)); + g_assert(g_variant_type_equal(g_variant_get_type(out), G_VARIANT_TYPE_BOOLEAN)); + g_assert(g_variant_get_boolean(out)); g_assert(dbusmenu_menuitem_property_get_int(item, "boolean")); g_object_unref(item); diff --git a/tests/test-glib-proxy-client.c b/tests/test-glib-proxy-client.c index 0ae2e20..2e1e2d2 100644 --- a/tests/test-glib-proxy-client.c +++ b/tests/test-glib-proxy-client.c @@ -150,10 +150,9 @@ layout_verify_timer (gpointer data) g_main_loop_quit(mainloop); } - GValue value = {0}; - g_value_init(&value, G_TYPE_INT); - g_value_set_int(&value, 0); - dbusmenu_menuitem_handle_event(menuroot, "clicked", &value, layouton); + GVariant * value = g_variant_new("i", 0); + dbusmenu_menuitem_handle_event(menuroot, "clicked", value, layouton); + g_variant_unref(value); return FALSE; } diff --git a/tests/test-gtk-objects.c b/tests/test-gtk-objects.c index 726f404..30fc022 100644 --- a/tests/test-gtk-objects.c +++ b/tests/test-gtk-objects.c @@ -72,7 +72,7 @@ test_object_prop_pixbuf (void) g_object_unref(pixbuf); /* Check to see if it's set */ - const GValue * val = dbusmenu_menuitem_property_get_value(item, prop_name); + GVariant * val = dbusmenu_menuitem_property_get_variant(item, prop_name); g_assert(val != NULL); /* Get the pixbuf back! */ @@ -105,7 +105,7 @@ test_object_prop_shortcut (void) g_assert(success); /* Check for value */ - const GValue * val = dbusmenu_menuitem_property_get_value(item, DBUSMENU_MENUITEM_PROP_SHORTCUT); + GVariant * val = dbusmenu_menuitem_property_get_variant(item, DBUSMENU_MENUITEM_PROP_SHORTCUT); g_assert(val != NULL); /* Check to see if we love it */ -- cgit v1.2.3 From cd8988a8dfd03a585860eabfc97c0e0aa8c6e912 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 18 Nov 2010 08:59:50 -0600 Subject: Switching to variants in the property changed signals --- tests/test-glib-objects.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/test-glib-objects.c b/tests/test-glib-objects.c index c6a8dc9..6afbe57 100644 --- a/tests/test-glib-objects.c +++ b/tests/test-glib-objects.c @@ -177,7 +177,7 @@ test_object_menuitem_props_swap (void) /* A helper to put a value into a pointer for eval. */ static void -test_object_menuitem_props_signals_helper (DbusmenuMenuitem * mi, gchar * property, GValue * value, GValue ** out) +test_object_menuitem_props_signals_helper (DbusmenuMenuitem * mi, gchar * property, GVariant * value, GVariant ** out) { if (!g_strcmp0(property, "swapper")) { *out = value; @@ -194,7 +194,7 @@ test_object_menuitem_props_signals (void) { /* Build a menu item */ DbusmenuMenuitem * item = dbusmenu_menuitem_new(); - GValue * out = NULL; + GVariant * out = NULL; /* Test to make sure it's a happy object */ g_assert(item != NULL); @@ -205,25 +205,25 @@ test_object_menuitem_props_signals (void) /* Setting a boolean */ dbusmenu_menuitem_property_set_bool(item, "swapper", TRUE); g_assert(out != NULL); - g_assert(g_value_get_boolean(out)); + g_assert(g_variant_get_boolean(out)); out = NULL; /* Setting a int */ dbusmenu_menuitem_property_set_int(item, "swapper", 5432); g_assert(out != NULL); - g_assert(g_value_get_int(out) == 5432); + g_assert(g_variant_get_int32(out) == 5432); out = NULL; /* Setting a string */ dbusmenu_menuitem_property_set(item, "swapper", "mystring"); g_assert(out != NULL); - g_assert(!g_strcmp0(g_value_get_string(out), "mystring")); + g_assert(!g_strcmp0(g_variant_get_string(out, NULL), "mystring")); out = NULL; /* Setting a boolean */ dbusmenu_menuitem_property_set_bool(item, "swapper", FALSE); g_assert(out != NULL); - g_assert(!g_value_get_boolean(out)); + g_assert(!g_variant_get_boolean(out)); out = NULL; g_object_unref(item); -- cgit v1.2.3 From 24ecbd99558d2ae2a65ad7407f547c55ffed2e4e Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 18 Nov 2010 09:00:45 -0600 Subject: This now generates a warning, but unfortunately gtester fails that. --- tests/test-glib-objects.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test-glib-objects.c b/tests/test-glib-objects.c index 6afbe57..7143814 100644 --- a/tests/test-glib-objects.c +++ b/tests/test-glib-objects.c @@ -136,7 +136,7 @@ test_object_menuitem_props_bool (void) g_assert(out != NULL); g_assert(g_variant_type_equal(g_variant_get_type(out), G_VARIANT_TYPE_BOOLEAN)); g_assert(g_variant_get_boolean(out)); - g_assert(dbusmenu_menuitem_property_get_int(item, "boolean")); + /* g_assert(dbusmenu_menuitem_property_get_int(item, "boolean") == 0); */ g_object_unref(item); -- cgit v1.2.3 From 1c2d3ea075efd02f8a655c45c89ec132d0e76828 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 18 Nov 2010 09:01:18 -0600 Subject: Eh, bad truth checking here. --- libdbusmenu-glib/menuitem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index 24196fc..3b5011b 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -1069,7 +1069,7 @@ dbusmenu_menuitem_property_get_bool (DbusmenuMenuitem * mi, const gchar * proper return g_variant_get_boolean(variant); } - if (!g_variant_type_equal(g_variant_get_type(variant), G_VARIANT_TYPE_STRING)) { + if (g_variant_type_equal(g_variant_get_type(variant), G_VARIANT_TYPE_STRING)) { const gchar * string = g_variant_get_string(variant, NULL); if (!g_strcmp0(string, "TRUE") || !g_strcmp0(string, "true") || !g_strcmp0(string, "True")) { @@ -1103,7 +1103,7 @@ dbusmenu_menuitem_property_get_int (DbusmenuMenuitem * mi, const gchar * propert return g_variant_get_int32(variant); } - if (!g_variant_type_equal(g_variant_get_type(variant), G_VARIANT_TYPE_STRING)) { + if (g_variant_type_equal(g_variant_get_type(variant), G_VARIANT_TYPE_STRING)) { const gchar * string = g_variant_get_string(variant, NULL); return atoi(string); } -- cgit v1.2.3 From f5227142593335542a62a8c7d3c122b8013cfead Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 18 Nov 2010 09:07:38 -0600 Subject: Fixing signal emition when there are new entries added to the property table. --- libdbusmenu-glib/menuitem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index 3b5011b..d9fbf25 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -998,7 +998,7 @@ dbusmenu_menuitem_property_set_variant (DbusmenuMenuitem * mi, const gchar * pro becuse it has been unref'd when replaced in the hash table. But the fact that there was a value is the imporant part. */ - if (currentval != NULL && replaced) { + if (currentval == NULL || replaced) { g_signal_emit(G_OBJECT(mi), signals[PROPERTY_CHANGED], 0, lprop, value, TRUE); } -- cgit v1.2.3 From 72da1b32a6a834de66496fbaa6f3c57cac4d4d7a Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 18 Nov 2010 09:13:19 -0600 Subject: Fixing our use of GVariant type strings --- libdbusmenu-glib/client.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index 629a1be..e0ab2d4 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -1221,7 +1221,7 @@ dbusmenu_client_send_event (DbusmenuClient * client, gint id, const gchar * name } if (variant == NULL) { - variant = g_variant_new("i", 0); + variant = g_variant_new("(i)", 0); } event_data_t * edata = g_new0(event_data_t, 1); @@ -1235,7 +1235,7 @@ dbusmenu_client_send_event (DbusmenuClient * client, gint id, const gchar * name g_dbus_proxy_call(priv->menuproxy, "Event", - g_variant_new("isvu", id, name, variant, timestamp), + g_variant_new("(isvu)", id, name, variant, timestamp), G_DBUS_CALL_FLAGS_NONE, 1000, /* timeout */ NULL, /* cancellable */ @@ -1303,7 +1303,7 @@ dbusmenu_client_send_about_to_show(DbusmenuClient * client, gint id, void (*cb)( g_dbus_proxy_call(priv->menuproxy, "AboutToShow", - g_variant_new("i", id), + g_variant_new("(i)", id), G_DBUS_CALL_FLAGS_NONE, -1, /* timeout */ NULL, /* cancellable */ @@ -1540,7 +1540,7 @@ update_layout_cb (GObject * proxy, GAsyncResult * res, gpointer data) guint rev; gchar * xml; - g_variant_get(params, "us", &rev, &xml); + g_variant_get(params, "(us)", &rev, &xml); g_variant_unref(params); DbusmenuClient * client = DBUSMENU_CLIENT(data); @@ -1593,7 +1593,7 @@ update_layout (DbusmenuClient * client) g_dbus_proxy_call(priv->menuproxy, "GetLayout", - g_variant_new("i", 0), /* root */ + g_variant_new("(i)", 0), /* root */ G_DBUS_CALL_FLAGS_NONE, -1, /* timeout */ priv->layoutcall, /* cancellable */ -- cgit v1.2.3 From acf4557c9c5b7d87c5b7b0f1df2b535a6dd11671 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 18 Nov 2010 09:22:24 -0600 Subject: Wow, I've learned a lot about better ways to do this :) --- libdbusmenu-glib/server.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c index 8d5c558..fd507a2 100644 --- a/libdbusmenu-glib/server.c +++ b/libdbusmenu-glib/server.c @@ -852,21 +852,21 @@ static void bus_get_group_properties (DbusmenuServer * server, GVariant * params, GDBusMethodInvocation * invocation) { DbusmenuServerPrivate * priv = DBUSMENU_SERVER_GET_PRIVATE(server); - GVariantIter * ids = NULL; - g_variant_get_child(params, 0, "ai", &ids); + GVariantIter ids; + g_variant_iter_init(&ids, params); - GVariantBuilder * builder = g_variant_builder_new(G_VARIANT_TYPE("a(ia{sv})")); + GVariantBuilder builder; + g_variant_builder_init(&builder, G_VARIANT_TYPE("a(ia{sv})")); - GVariant * id; - while ((id = g_variant_iter_next_value(ids)) != NULL) { - DbusmenuMenuitem * mi = dbusmenu_menuitem_find_id(priv->root, g_variant_get_int32(id)); + guint id; + while (g_variant_iter_next(&ids, "i", &id)) { + DbusmenuMenuitem * mi = dbusmenu_menuitem_find_id(priv->root, id); if (mi == NULL) continue; - g_variant_builder_add(builder, "ia{sv}", g_variant_get_int32(id), dbusmenu_menuitem_properties_variant(mi)); + g_variant_builder_add(&builder, "ia{sv}", id, dbusmenu_menuitem_properties_variant(mi)); } - GVariant * ret = g_variant_builder_end(builder); - g_variant_builder_unref(builder); + GVariant * ret = g_variant_builder_end(&builder); g_dbus_method_invocation_return_value(invocation, ret); -- cgit v1.2.3 From 62a03e300af33f8ad306c08337f33f59fb8511b3 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 18 Nov 2010 11:54:41 -0600 Subject: Cleaning up the building of the property requests --- libdbusmenu-glib/client.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index e0ab2d4..1e6e479 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -579,13 +579,26 @@ get_properties_idle (gpointer user_data) } /* Build up an ID list to pass */ - GArray * idlist = g_array_new(FALSE, FALSE, sizeof(gint)); + GVariantBuilder builder; + g_variant_builder_init(&builder, G_VARIANT_TYPE_ARRAY); + gint i; for (i = 0; i < priv->delayed_property_listeners->len; i++) { - g_array_append_val(idlist, g_array_index(priv->delayed_property_listeners, properties_listener_t, i).id); + g_variant_builder_add(&builder, "i", g_array_index(priv->delayed_property_listeners, properties_listener_t, i).id); } - GVariant * variant_params = g_variant_new("a(s)", (const gchar **)priv->delayed_property_list->data); + GVariant * variant_ids = g_variant_builder_end(&builder); + + /* Build up a prop list to pass */ + g_variant_builder_init(&builder, g_variant_type_new("as")); + GVariant * variant_props = g_variant_builder_end(&builder); + + /* Combine them into a value for the parameter */ + g_variant_builder_init(&builder, G_VARIANT_TYPE_TUPLE); + g_variant_builder_add_value(&builder, variant_ids); + g_variant_builder_add_value(&builder, variant_props); + GVariant * variant_params = g_variant_builder_end(&builder); + g_dbus_proxy_call(priv->menuproxy, "GetGroupProperties", variant_params, @@ -595,9 +608,6 @@ get_properties_idle (gpointer user_data) get_properties_callback, priv->delayed_property_listeners); - /* Free ID List */ - g_array_free(idlist, TRUE); - /* Free properties */ gchar ** dataregion = (gchar **)g_array_free(priv->delayed_property_list, FALSE); if (dataregion != NULL) { -- cgit v1.2.3 From 233eec5d073b4101b3100598c60e497cf5075586 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 18 Nov 2010 13:21:36 -0600 Subject: Cleaning up the building of a properties variant --- libdbusmenu-glib/menuitem.c | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index d9fbf25..66dfb66 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -1216,18 +1216,7 @@ dbusmenu_menuitem_properties_copy (DbusmenuMenuitem * mi) static void variant_helper (gpointer in_key, gpointer in_value, gpointer user_data) { - /* TODO: Switch to being a variant */ - GValue vval = {0}; - g_value_init(&vval, G_TYPE_VARIANT); - - if (!g_value_transform((GValue *)in_value, &vval)) { - g_warning("Unable to convert property '%s' of type '%s'", (gchar *)in_key, G_VALUE_TYPE_NAME(in_value)); - return; - } - - g_variant_builder_add((GVariantBuilder *)user_data, "{sv}", in_key, g_value_get_variant(&vval)); - g_value_unset(&vval); - + g_variant_builder_add((GVariantBuilder *)user_data, "sv", in_key, in_value); return; } @@ -1247,12 +1236,17 @@ dbusmenu_menuitem_properties_variant (DbusmenuMenuitem * mi) DbusmenuMenuitemPrivate * priv = DBUSMENU_MENUITEM_GET_PRIVATE(mi); - GVariantBuilder * builder = g_variant_builder_new(G_VARIANT_TYPE("a{sv}")); + GVariant * final_variant = NULL; + + if (g_hash_table_size(priv->properties) > 0) { + GVariantBuilder builder; + g_variant_builder_init(&builder, g_variant_type_new("a{sv}")); - g_hash_table_foreach(priv->properties, variant_helper, builder); + g_hash_table_foreach(priv->properties, variant_helper, &builder); + + final_variant = g_variant_builder_end(&builder); + } - GVariant * final_variant = g_variant_builder_end(builder); - g_variant_builder_unref(builder); return final_variant; } -- cgit v1.2.3 From 9ef52be8a4da1fc981e09079e142d2aea9793567 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 18 Nov 2010 13:49:27 -0600 Subject: Setting up the proper builders and interfaces for group_properties --- libdbusmenu-glib/server.c | 42 ++++++++++++++++++++++++++++++++---------- 1 file changed, 32 insertions(+), 10 deletions(-) diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c index fd507a2..b48b28a 100644 --- a/libdbusmenu-glib/server.c +++ b/libdbusmenu-glib/server.c @@ -851,25 +851,43 @@ bus_get_properties (DbusmenuServer * server, GVariant * params, GDBusMethodInvoc static void bus_get_group_properties (DbusmenuServer * server, GVariant * params, GDBusMethodInvocation * invocation) { + g_debug("Begin group prop: %s", g_variant_print(params, TRUE)); DbusmenuServerPrivate * priv = DBUSMENU_SERVER_GET_PRIVATE(server); GVariantIter ids; - g_variant_iter_init(&ids, params); + g_variant_iter_init(&ids, g_variant_get_child_value(params, 0)); GVariantBuilder builder; - g_variant_builder_init(&builder, G_VARIANT_TYPE("a(ia{sv})")); + g_variant_builder_init(&builder, G_VARIANT_TYPE_ARRAY); - guint id; + gint id; while (g_variant_iter_next(&ids, "i", &id)) { DbusmenuMenuitem * mi = dbusmenu_menuitem_find_id(priv->root, id); if (mi == NULL) continue; - g_variant_builder_add(&builder, "ia{sv}", id, dbusmenu_menuitem_properties_variant(mi)); + 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); + } + + g_variant_builder_add_value(&wbuilder, props); + GVariant * mi_data = g_variant_builder_end(&wbuilder); + + g_variant_builder_add_value(&builder, mi_data); } GVariant * ret = g_variant_builder_end(&builder); - g_dbus_method_invocation_return_value(invocation, ret); + g_variant_builder_init(&builder, G_VARIANT_TYPE_TUPLE); + g_variant_builder_add_value(&builder, ret); + GVariant * final = g_variant_builder_end(&builder); + g_dbus_method_invocation_return_value(invocation, final); + + g_debug("End group prop"); return; } @@ -907,13 +925,17 @@ bus_get_children (DbusmenuServer * server, GVariant * params, GDBusMethodInvocat return; } - GVariantBuilder * builder = g_variant_builder_new(G_VARIANT_TYPE("a(ia{sv})")); - GList * children = dbusmenu_menuitem_get_children(mi); - g_list_foreach(children, serialize_menuitem, builder); + GVariant * ret = NULL; + + if (children != NULL) { + GVariantBuilder builder; + g_variant_builder_init(&builder, G_VARIANT_TYPE_ARRAY); - GVariant * ret = g_variant_builder_end(builder); - g_variant_builder_unref(builder); + g_list_foreach(children, serialize_menuitem, &builder); + + ret = g_variant_builder_end(&builder); + } g_dbus_method_invocation_return_value(invocation, ret); return; -- cgit v1.2.3 From b5e90b0ce320570a1338e84538874a02c5dd5753 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 18 Nov 2010 13:49:50 -0600 Subject: Break out of the tuple --- libdbusmenu-glib/client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index 1e6e479..696f7c5 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -517,7 +517,7 @@ get_properties_callback (GObject *obj, GAsyncResult * res, gpointer user_data) } /* Callback all the folks we can find */ - GVariantIter * iter = g_variant_iter_new(params); + GVariantIter * iter = g_variant_iter_new(g_variant_get_child_value(params, 0)); GVariant * child; while ((child = g_variant_iter_next_value(iter)) != NULL) { if (g_strcmp0(g_variant_get_type_string(child), "ia(sv)") != 0) { -- cgit v1.2.3 From c35642d47693feb5dce6fc6b5e3e5f258b255982 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 18 Nov 2010 13:52:24 -0600 Subject: Correcting type check --- libdbusmenu-glib/client.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index 696f7c5..50df570 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -520,8 +520,8 @@ get_properties_callback (GObject *obj, GAsyncResult * res, gpointer user_data) GVariantIter * iter = g_variant_iter_new(g_variant_get_child_value(params, 0)); GVariant * child; while ((child = g_variant_iter_next_value(iter)) != NULL) { - if (g_strcmp0(g_variant_get_type_string(child), "ia(sv)") != 0) { - g_warning("Properties return signature is not 'ia(sv)' it is '%s'", g_variant_get_type_string(child)); + if (g_strcmp0(g_variant_get_type_string(child), "(ia{sv})") != 0) { + g_warning("Properties return signature is not '(ia{sv})' it is '%s'", g_variant_get_type_string(child)); continue; } -- cgit v1.2.3 From 9cae52b3bfcb2b86c6be362ddb03afb2ddd78e6d Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 18 Nov 2010 13:52:46 -0600 Subject: Oops, drop debug messages --- libdbusmenu-glib/server.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c index b48b28a..d9a3c64 100644 --- a/libdbusmenu-glib/server.c +++ b/libdbusmenu-glib/server.c @@ -851,7 +851,6 @@ bus_get_properties (DbusmenuServer * server, GVariant * params, GDBusMethodInvoc static void bus_get_group_properties (DbusmenuServer * server, GVariant * params, GDBusMethodInvocation * invocation) { - g_debug("Begin group prop: %s", g_variant_print(params, TRUE)); DbusmenuServerPrivate * priv = DBUSMENU_SERVER_GET_PRIVATE(server); GVariantIter ids; g_variant_iter_init(&ids, g_variant_get_child_value(params, 0)); @@ -887,7 +886,6 @@ bus_get_group_properties (DbusmenuServer * server, GVariant * params, GDBusMetho g_dbus_method_invocation_return_value(invocation, final); - g_debug("End group prop"); return; } -- cgit v1.2.3 From fc235b7eb4e7102b349fb711991e5c121a1c7a7d Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 18 Nov 2010 14:40:58 -0600 Subject: Switching to not put into a tuple --- libdbusmenu-glib/client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index 50df570..0479548 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -1231,7 +1231,7 @@ dbusmenu_client_send_event (DbusmenuClient * client, gint id, const gchar * name } if (variant == NULL) { - variant = g_variant_new("(i)", 0); + variant = g_variant_new_int32(0); } event_data_t * edata = g_new0(event_data_t, 1); -- cgit v1.2.3 From c40c70c6cee475ab2bf8d7e6e5804571b25deb9c Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 18 Nov 2010 14:41:27 -0600 Subject: Protect against NULL params (which they should be) but not leak just in case --- libdbusmenu-glib/client.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index 0479548..cb3377a 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -1206,10 +1206,12 @@ menuitem_call_cb (GObject * proxy, GAsyncResult * res, gpointer userdata) g_object_unref(edata->menuitem); g_free(edata); - if (error != NULL) { + if (G_UNLIKELY(error != NULL)) { g_error_free(error); } - g_variant_unref(params); + if (G_LIKELY(params != NULL)) { + g_variant_unref(params); + } return; } -- cgit v1.2.3 From 7380d970e2187af5e153250565d784abbe469bc8 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 18 Nov 2010 14:42:25 -0600 Subject: Don't unref the variant we send and fix up debugging messages. --- tests/test-glib-events-client.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/test-glib-events-client.c b/tests/test-glib-events-client.c index ee0b821..2cc5439 100644 --- a/tests/test-glib-events-client.c +++ b/tests/test-glib-events-client.c @@ -47,7 +47,7 @@ event_status (DbusmenuClient * client, DbusmenuMenuitem * item, gchar * name, GV } if (g_variant_get_int32(data) != DATA_VALUE) { - g_debug("Data value pass fail got: %d", g_variant_get_int32(data)); + g_debug("Data value pass fail got: %d", g_variant_get_int32(g_variant_get_child_value(data, 0))); passed = FALSE; g_main_loop_quit(mainloop); return; @@ -96,9 +96,8 @@ layout_updated (DbusmenuClient * client, gpointer user_data) return; } - GVariant * data = g_variant_new("i", DATA_VALUE); + GVariant * data = g_variant_new_int32(DATA_VALUE); dbusmenu_menuitem_handle_event(menuroot, "clicked", data, TIMESTAMP_VALUE); - g_variant_unref(data); return; } @@ -126,6 +125,7 @@ main (int argc, char ** argv) mainloop = g_main_loop_new(NULL, FALSE); g_main_loop_run(mainloop); + g_debug("Main loop complete"); g_object_unref(G_OBJECT(client)); if (passed) { -- cgit v1.2.3 From c80c863e4191fe9b5f20e65887db7c2e278b13fb Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 18 Nov 2010 14:45:15 -0600 Subject: Oops, messed up the format here. --- libdbusmenu-glib/menuitem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index 66dfb66..2f42704 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -1216,7 +1216,7 @@ dbusmenu_menuitem_properties_copy (DbusmenuMenuitem * mi) static void variant_helper (gpointer in_key, gpointer in_value, gpointer user_data) { - g_variant_builder_add((GVariantBuilder *)user_data, "sv", in_key, in_value); + g_variant_builder_add((GVariantBuilder *)user_data, "{sv}", in_key, in_value); return; } -- cgit v1.2.3 From caea84d6056d1ab1dd9744af5be9ac05670be8f9 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 18 Nov 2010 15:06:29 -0600 Subject: We can't really be autostarting as we don't know enough to make a judgement there. --- libdbusmenu-glib/client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index cb3377a..f283a78 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -929,7 +929,7 @@ build_proxies (DbusmenuClient * client) priv->menuproxy_cancel = g_cancellable_new(); g_dbus_proxy_new(priv->session_bus, - G_DBUS_PROXY_FLAGS_NONE, + G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START, dbusmenu_interface_info, priv->dbus_name, priv->dbus_object, -- cgit v1.2.3 From c2953a6f3f099db35bc79415f2bb0c767f325c44 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 18 Nov 2010 15:07:00 -0600 Subject: Using the name assigned instead of a default. --- tests/test-glib-proxy-proxy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test-glib-proxy-proxy.c b/tests/test-glib-proxy-proxy.c index b9db620..38c59e2 100644 --- a/tests/test-glib-proxy-proxy.c +++ b/tests/test-glib-proxy-proxy.c @@ -63,7 +63,7 @@ main (int argc, char ** argv) g_debug("I am '%s' and I'm proxying '%s'", whoami, myproxy); g_bus_own_name(G_BUS_TYPE_SESSION, - "org.dbusmenu.test", + whoami, G_BUS_NAME_OWNER_FLAGS_NONE, on_bus, NULL, -- cgit v1.2.3 From a3482b774239b10010fd9d9734333afc09c1beb8 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 18 Nov 2010 16:47:30 -0600 Subject: Protecting the invalid root a little bit more and returning a better error. --- libdbusmenu-glib/server.c | 66 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 65 insertions(+), 1 deletion(-) diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c index d9a3c64..c738537 100644 --- a/libdbusmenu-glib/server.c +++ b/libdbusmenu-glib/server.c @@ -83,6 +83,7 @@ enum { INVALID_PROPERTY_NAME, UNKNOWN_DBUS_ERROR, NOT_IMPLEMENTED, + NO_VALID_LAYOUT, LAST_ERROR }; @@ -756,7 +757,11 @@ bus_get_layout (DbusmenuServer * server, GVariant * params, GDBusMethodInvocatio dbusmenu_menuitem_buildxml(priv->root, xmlarray); } } else { - DbusmenuMenuitem * item = dbusmenu_menuitem_find_id(priv->root, parent); + DbusmenuMenuitem * item = NULL; + if (priv->root != NULL) { + item = dbusmenu_menuitem_find_id(priv->root, parent); + } + if (item == NULL) { g_dbus_method_invocation_return_error(invocation, error_quark(), @@ -790,6 +795,14 @@ static void bus_get_property (DbusmenuServer * server, GVariant * params, GDBusMethodInvocation * invocation) { DbusmenuServerPrivate * priv = DBUSMENU_SERVER_GET_PRIVATE(server); + + if (priv->root == NULL) { + g_dbus_method_invocation_return_error(invocation, + error_quark(), + NO_VALID_LAYOUT, + "There currently isn't a layout in this server"); + return; + } gint id = g_variant_get_int32(g_variant_get_child_value(params, 0)); const gchar * property = g_variant_get_string(g_variant_get_child_value(params, 1), NULL); @@ -826,6 +839,14 @@ bus_get_properties (DbusmenuServer * server, GVariant * params, GDBusMethodInvoc { DbusmenuServerPrivate * priv = DBUSMENU_SERVER_GET_PRIVATE(server); + if (priv->root == NULL) { + g_dbus_method_invocation_return_error(invocation, + error_quark(), + NO_VALID_LAYOUT, + "There currently isn't a layout in this server"); + return; + } + gint id = g_variant_get_int32(g_variant_get_child_value(params, 0)); DbusmenuMenuitem * mi = dbusmenu_menuitem_find_id(priv->root, id); @@ -852,6 +873,22 @@ static void bus_get_group_properties (DbusmenuServer * server, GVariant * params, GDBusMethodInvocation * invocation) { DbusmenuServerPrivate * priv = DBUSMENU_SERVER_GET_PRIVATE(server); + + if (priv->root == NULL) { + GVariant * idlist = g_variant_get_child_value(params, 0); + if (g_variant_n_children(idlist) == 1 && g_variant_get_int32(g_variant_get_child_value(idlist, 0)) == 0) { + GVariant * final = g_variant_parse(g_variant_type_new("(a(ia{sv}))"), "([(0, {})],)", NULL, NULL, NULL); + g_dbus_method_invocation_return_value(invocation, final); + return; + } + + g_dbus_method_invocation_return_error(invocation, + error_quark(), + NO_VALID_LAYOUT, + "There currently isn't a layout in this server"); + return; + } + GVariantIter ids; g_variant_iter_init(&ids, g_variant_get_child_value(params, 0)); @@ -912,6 +949,15 @@ bus_get_children (DbusmenuServer * server, GVariant * params, GDBusMethodInvocat { DbusmenuServerPrivate * priv = DBUSMENU_SERVER_GET_PRIVATE(server); gint id = g_variant_get_int32(g_variant_get_child_value(params, 0)); + + if (priv->root == NULL) { + g_dbus_method_invocation_return_error(invocation, + error_quark(), + NO_VALID_LAYOUT, + "There currently isn't a layout in this server"); + return; + } + DbusmenuMenuitem * mi = dbusmenu_menuitem_find_id(priv->root, id); if (mi == NULL) { @@ -970,6 +1016,15 @@ static void bus_event (DbusmenuServer * server, GVariant * params, GDBusMethodInvocation * invocation) { DbusmenuServerPrivate * priv = DBUSMENU_SERVER_GET_PRIVATE(server); + + if (priv->root == NULL) { + g_dbus_method_invocation_return_error(invocation, + error_quark(), + NO_VALID_LAYOUT, + "There currently isn't a layout in this server"); + return; + } + gint id = g_variant_get_int32(g_variant_get_child_value(params, 0)); DbusmenuMenuitem * mi = dbusmenu_menuitem_find_id(priv->root, id); @@ -1000,6 +1055,15 @@ static void bus_about_to_show (DbusmenuServer * server, GVariant * params, GDBusMethodInvocation * invocation) { DbusmenuServerPrivate * priv = DBUSMENU_SERVER_GET_PRIVATE(server); + + if (priv->root == NULL) { + g_dbus_method_invocation_return_error(invocation, + error_quark(), + NO_VALID_LAYOUT, + "There currently isn't a layout in this server"); + return; + } + gint id = g_variant_get_int32(g_variant_get_child_value(params, 0)); DbusmenuMenuitem * mi = dbusmenu_menuitem_find_id(priv->root, id); -- cgit v1.2.3 From f5cc5d5809ac1bc60ed2f90424e95988f84194db Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 19 Nov 2010 17:08:52 -0600 Subject: Wrong bus name --- tests/test-glib-proxy-server.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test-glib-proxy-server.c b/tests/test-glib-proxy-server.c index c12a584..a5dfd4e 100644 --- a/tests/test-glib-proxy-server.c +++ b/tests/test-glib-proxy-server.c @@ -123,7 +123,7 @@ main (int argc, char ** argv) g_type_init(); g_bus_own_name(G_BUS_TYPE_SESSION, - "org.dbusmenu.test", + "test.proxy.server", G_BUS_NAME_OWNER_FLAGS_NONE, on_bus, NULL, -- cgit v1.2.3 From 92d355c18217c43c358ccda9d6eb74af9eed30d9 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 23 Nov 2010 13:21:52 -0600 Subject: Protect update_layout from not having an owner yet, and if we get one immediately call update_layout() --- libdbusmenu-glib/client.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index f283a78..be35dde 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -978,7 +978,11 @@ menuproxy_build_cb (GObject * object, GAsyncResult * res, gpointer user_data) g_signal_connect(priv->menuproxy, "g-signal", G_CALLBACK(menuproxy_signal_cb), client); g_signal_connect(priv->menuproxy, "notify::g-name-owner", G_CALLBACK(menuproxy_name_changed_cb), client); - update_layout(client); + gchar * name_owner = g_dbus_proxy_get_name_owner(priv->menuproxy); + if (name_owner != NULL) { + update_layout(client); + g_free(name_owner); + } return; } @@ -996,6 +1000,7 @@ menuproxy_name_changed_cb (GObject * object, GParamSpec * pspec, gpointer user_d proxy_destroyed(G_OBJECT(proxy), user_data); } else { g_free(owner); + update_layout(DBUSMENU_CLIENT(user_data)); } return; @@ -1597,6 +1602,12 @@ update_layout (DbusmenuClient * client) return; } + gchar * name_owner = g_dbus_proxy_get_name_owner(priv->menuproxy); + if (name_owner == NULL) { + return; + } + g_free(name_owner); + if (priv->layoutcall != NULL) { return; } -- cgit v1.2.3 From c661b1ec2a71c8e78e72db7f72116a205059e292 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 23 Nov 2010 13:22:40 -0600 Subject: Adding another todo about the properties... need to do that everywhere --- libdbusmenu-glib/client.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index be35dde..a918f43 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -591,6 +591,7 @@ get_properties_idle (gpointer user_data) /* Build up a prop list to pass */ g_variant_builder_init(&builder, g_variant_type_new("as")); + /* TODO: need to use delayed property list here */ GVariant * variant_props = g_variant_builder_end(&builder); /* Combine them into a value for the parameter */ -- cgit v1.2.3 From e811c4f900545d37aecdf18cbce911ff23e684cd Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 23 Nov 2010 13:27:13 -0600 Subject: Exporting the server before getting the name --- tests/test-glib-proxy-proxy.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/test-glib-proxy-proxy.c b/tests/test-glib-proxy-proxy.c index 38c59e2..8a17ead 100644 --- a/tests/test-glib-proxy-proxy.c +++ b/tests/test-glib-proxy-proxy.c @@ -31,7 +31,6 @@ root_changed (DbusmenuClient * client, DbusmenuMenuitem * newroot, gpointer user static void on_bus (GDBusConnection * connection, const gchar * name, gpointer user_data) { - server = dbusmenu_server_new("/org/test"); client = dbusmenu_client_new((gchar *)user_data, "/org/test"); g_signal_connect(client, DBUSMENU_CLIENT_SIGNAL_ROOT_CHANGED, G_CALLBACK(root_changed), server); @@ -62,6 +61,8 @@ main (int argc, char ** argv) g_debug("I am '%s' and I'm proxying '%s'", whoami, myproxy); + server = dbusmenu_server_new("/org/test"); + g_bus_own_name(G_BUS_TYPE_SESSION, whoami, G_BUS_NAME_OWNER_FLAGS_NONE, -- cgit v1.2.3 From 784522930b3102d044000ef1dd6af1854548e3be Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 23 Nov 2010 14:40:11 -0600 Subject: Convert json loader to using variants --- tests/json-loader.c | 107 ++++++++++++++++++++++++++++------------------------ 1 file changed, 57 insertions(+), 50 deletions(-) diff --git a/tests/json-loader.c b/tests/json-loader.c index 9e67666..4d3e6aa 100644 --- a/tests/json-loader.c +++ b/tests/json-loader.c @@ -21,67 +21,75 @@ with this program. If not, see . #include "json-loader.h" -static GValue * -node2value (JsonNode * node) +static GVariant * node2variant (JsonNode * node); + +static void +array_foreach (JsonArray * array, guint index, JsonNode * node, gpointer user_data) +{ + GVariantBuilder * builder = (GVariantBuilder *)user_data; + GVariant * variant = node2variant(node); + if (variant != NULL) { + g_variant_builder_add_value(builder, variant); + } + return; +} + +static void +object_foreach (JsonObject * array, const gchar * member, JsonNode * node, gpointer user_data) +{ + GVariantBuilder * builder = (GVariantBuilder *)user_data; + GVariant * variant = node2variant(node); + if (variant != NULL) { + g_variant_builder_add(builder, "{sv}", member, variant); + } + return; +} + +static GVariant * +node2variant (JsonNode * node) { if (node == NULL) { return NULL; } - GValue * value = g_new0(GValue, 1); - if (JSON_NODE_TYPE(node) == JSON_NODE_VALUE) { - json_node_get_value(node, value); - return value; + switch (json_node_get_value_type(node)) { + case G_TYPE_INT: + case G_TYPE_INT64: + return g_variant_new_int64(json_node_get_int(node)); + case G_TYPE_DOUBLE: + case G_TYPE_FLOAT: + return g_variant_new_double(json_node_get_double(node)); + case G_TYPE_BOOLEAN: + return g_variant_new_boolean(json_node_get_boolean(node)); + case G_TYPE_STRING: + return g_variant_new_string(json_node_get_string(node)); + default: + g_assert_not_reached(); + } } if (JSON_NODE_TYPE(node) == JSON_NODE_ARRAY) { + GVariantBuilder builder; + g_variant_builder_init(&builder, G_VARIANT_TYPE_ARRAY); + JsonArray * array = json_node_get_array(node); - JsonNode * first = json_array_get_element(array, 0); - - if (JSON_NODE_TYPE(first) == JSON_NODE_VALUE) { - GValue subvalue = {0}; - json_node_get_value(first, &subvalue); - - if (G_VALUE_TYPE(&subvalue) == G_TYPE_STRING) { - GArray * garray = g_array_sized_new(TRUE, TRUE, sizeof(gchar *), json_array_get_length(array)); - g_value_init(value, G_TYPE_STRV); - g_value_take_boxed(value, garray->data); - - int i; - for (i = 0; i < json_array_get_length(array); i++) { - const gchar * str = json_node_get_string(json_array_get_element(array, i)); - gchar * dupstr = g_strdup(str); - g_array_append_val(garray, dupstr); - } - - g_array_free(garray, FALSE); - } else { - GValueArray * varray = g_value_array_new(json_array_get_length(array)); - g_value_init(value, G_TYPE_VALUE_ARRAY); - g_value_take_boxed(value, varray); - - g_value_array_append(varray, &subvalue); - g_value_unset(&subvalue); - - int i; - for (i = 1; i < json_array_get_length(array); i++) { - json_node_get_value(first, &subvalue); - g_value_array_append(varray, &subvalue); - g_value_unset(&subvalue); - } - } + json_array_foreach_element(array, array_foreach, &builder); - } else { - g_warning("Complex array not supported"); - } + return g_variant_builder_end(&builder); } if (JSON_NODE_TYPE(node) == JSON_NODE_OBJECT) { - g_warning("Object nodes are a problem"); + GVariantBuilder builder; + g_variant_builder_init(&builder, G_VARIANT_TYPE_DICTIONARY); + + JsonObject * array = json_node_get_object(node); + json_object_foreach_member(array, object_foreach, &builder); + + return g_variant_builder_end(&builder); } - return value; + return NULL; } static void @@ -97,12 +105,11 @@ set_props (DbusmenuMenuitem * mi, JsonObject * node) if (!g_strcmp0(member, "submenu")) { continue; } JsonNode * lnode = json_object_get_member(node, member); - GValue * value = node2value(lnode); + GVariant * variant = node2variant(lnode); - if (value != NULL) { - dbusmenu_menuitem_property_set_value(mi, member, value); - g_value_unset(value); - g_free(value); + if (variant != NULL) { + dbusmenu_menuitem_property_set_variant(mi, member, variant); + g_variant_unref(variant); } } -- cgit v1.2.3 From a7a7326946d7dd13c0ef5027d460662dfd04b1e7 Mon Sep 17 00:00:00 2001 From: Ken VanDine Date: Tue, 23 Nov 2010 15:53:10 -0500 Subject: Set more scanner flags to get the namespace right --- libdbusmenu-glib/Makefile.am | 12 +++++++++--- libdbusmenu-gtk/Makefile.am | 14 ++++++++++---- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/libdbusmenu-glib/Makefile.am b/libdbusmenu-glib/Makefile.am index 0a6513f..3d031dd 100644 --- a/libdbusmenu-glib/Makefile.am +++ b/libdbusmenu-glib/Makefile.am @@ -114,9 +114,13 @@ menuitem-marshal.c: $(srcdir)/menuitem-marshal.list -include $(INTROSPECTION_MAKEFILE) INTROSPECTION_GIRS = -INTROSPECTION_SCANNER_ARGS = \ - --add-include-path=$(srcdir) \ - $(addprefix --c-include=libdbusmenu-glib/, $(introspection_sources)) +INTROSPECTION_SCANNER_ARGS = --add-include-path=$(srcdir) \ + --add-include-path=$(srcdir) \ + $(addprefix --c-include=libdbusmenu-glib/, $(introspection_sources)) \ + --symbol-prefix=dbusmenu \ + --identifier-prefix=Dbusmenu \ + --pkg-export=dbusmenu-glib + INTROSPECTION_COMPILER_ARGS = --includedir=$(builddir) if HAVE_INTROSPECTION @@ -131,6 +135,8 @@ Dbusmenu_Glib_0_2_gir_LIBS = libdbusmenu-glib.la Dbusmenu_Glib_0_2_gir_FILES = $(addprefix $(srcdir)/, $(introspection_sources)) Dbusmenu_Glib_0_2_gir_NAMESPACE = Dbusmenu Dbusmenu_Glib_0_2_gir_VERSION = Glib-0.2 +Dbusmenu_Glib_0_2_gir_PACKAGES = dbusmenu-glib +Dbusmenu_Glib_0_2_gir_SCANNER_FLAGS = $(INTROSPECTION_SCANNER_ARGS) INTROSPECTION_GIRS += Dbusmenu-Glib-0.2.gir diff --git a/libdbusmenu-gtk/Makefile.am b/libdbusmenu-gtk/Makefile.am index b30cac9..bb3890e 100644 --- a/libdbusmenu-gtk/Makefile.am +++ b/libdbusmenu-gtk/Makefile.am @@ -66,10 +66,12 @@ pkgconfigdir = $(libdir)/pkgconfig -include $(INTROSPECTION_MAKEFILE) INTROSPECTION_GIRS = -INTROSPECTION_SCANNER_ARGS = \ - --add-include-path=$(srcdir) \ +INTROSPECTION_SCANNER_ARGS = --add-include-path=$(srcdir) \ --add-include-path=$(top_builddir)/libdbusmenu-glib \ - $(addprefix --c-include=libdbusmenu-gtk/, $(introspection_sources)) + $(addprefix --c-include=libdbusmenu-gtk/, $(introspection_sources)) \ + --symbol-prefix=dbusmenu \ + --identifier-prefix=DbusmenuGtk \ + --pkg-export=dbusmenu-gtk$(VER) INTROSPECTION_COMPILER_ARGS = --includedir=$(builddir) --includedir=$(top_builddir)/libdbusmenu-glib if HAVE_INTROSPECTION @@ -80,16 +82,20 @@ DbusmenuGtk$(VER)-0.2.gir: libdbusmenu-gtk$(VER).la DbusmenuGtk_0_2_gir_INCLUDES = \ GObject-2.0 \ $(GTKGIR) \ - Dbusmenu-Glib-0.2 + Dbusmenu-Glib-0.2 DbusmenuGtk_0_2_gir_CFLAGS = $(DBUSMENUGTK_CFLAGS) -I$(top_srcdir) DbusmenuGtk_0_2_gir_LIBS = libdbusmenu-gtk$(VER).la DbusmenuGtk_0_2_gir_FILES = $(addprefix $(srcdir)/, $(introspection_sources)) +DbusmenuGtk_0_2_gir_NAMESPACE = DbusmenuGtk$(VER) +DbusmenuGtk_0_2_gir_SCANNERFLAGS = $(INTROSPECTION_SCANNER_ARGS) # We duplicate these for the same reason as libdbusmenu_gtk3includedir above DbusmenuGtk3_0_2_gir_INCLUDES = $(DbusmenuGtk_0_2_gir_INCLUDES) DbusmenuGtk3_0_2_gir_CFLAGS = $(DbusmenuGtk_0_2_gir_CFLAGS) DbusmenuGtk3_0_2_gir_LIBS = $(DbusmenuGtk_0_2_gir_LIBS) DbusmenuGtk3_0_2_gir_FILES = $(DbusmenuGtk_0_2_gir_FILES) +DbusmenuGtk3_0_2_gir_NAMESPACE = $(DbusmenuGtk_0_2_gir_NAMESPACE) +DbusmenuGtk3_0_2_gir_SCANNERFLAGS = $(DbusmenuGtk_0_2_gir_SCANNERFLAGS) INTROSPECTION_GIRS += DbusmenuGtk$(VER)-0.2.gir -- cgit v1.2.3 From d9d3f22c4240b7b1479299167e8ce184fd0c5f3a Mon Sep 17 00:00:00 2001 From: Ken VanDine Date: Tue, 23 Nov 2010 16:06:30 -0500 Subject: Cleaned up the scanner flags some --- libdbusmenu-glib/Makefile.am | 3 +-- libdbusmenu-gtk/Makefile.am | 5 +++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libdbusmenu-glib/Makefile.am b/libdbusmenu-glib/Makefile.am index 3d031dd..adf4607 100644 --- a/libdbusmenu-glib/Makefile.am +++ b/libdbusmenu-glib/Makefile.am @@ -118,8 +118,7 @@ INTROSPECTION_SCANNER_ARGS = --add-include-path=$(srcdir) \ --add-include-path=$(srcdir) \ $(addprefix --c-include=libdbusmenu-glib/, $(introspection_sources)) \ --symbol-prefix=dbusmenu \ - --identifier-prefix=Dbusmenu \ - --pkg-export=dbusmenu-glib + --identifier-prefix=Dbusmenu INTROSPECTION_COMPILER_ARGS = --includedir=$(builddir) diff --git a/libdbusmenu-gtk/Makefile.am b/libdbusmenu-gtk/Makefile.am index bb3890e..e539aa6 100644 --- a/libdbusmenu-gtk/Makefile.am +++ b/libdbusmenu-gtk/Makefile.am @@ -70,8 +70,7 @@ INTROSPECTION_SCANNER_ARGS = --add-include-path=$(srcdir) \ --add-include-path=$(top_builddir)/libdbusmenu-glib \ $(addprefix --c-include=libdbusmenu-gtk/, $(introspection_sources)) \ --symbol-prefix=dbusmenu \ - --identifier-prefix=DbusmenuGtk \ - --pkg-export=dbusmenu-gtk$(VER) + --identifier-prefix=DbusmenuGtk INTROSPECTION_COMPILER_ARGS = --includedir=$(builddir) --includedir=$(top_builddir)/libdbusmenu-glib if HAVE_INTROSPECTION @@ -88,6 +87,7 @@ DbusmenuGtk_0_2_gir_LIBS = libdbusmenu-gtk$(VER).la DbusmenuGtk_0_2_gir_FILES = $(addprefix $(srcdir)/, $(introspection_sources)) DbusmenuGtk_0_2_gir_NAMESPACE = DbusmenuGtk$(VER) DbusmenuGtk_0_2_gir_SCANNERFLAGS = $(INTROSPECTION_SCANNER_ARGS) +DbusmenuGtk_0_2_gir_PACKAGES = dbusmenu-gtk$(VER) # We duplicate these for the same reason as libdbusmenu_gtk3includedir above DbusmenuGtk3_0_2_gir_INCLUDES = $(DbusmenuGtk_0_2_gir_INCLUDES) @@ -96,6 +96,7 @@ DbusmenuGtk3_0_2_gir_LIBS = $(DbusmenuGtk_0_2_gir_LIBS) DbusmenuGtk3_0_2_gir_FILES = $(DbusmenuGtk_0_2_gir_FILES) DbusmenuGtk3_0_2_gir_NAMESPACE = $(DbusmenuGtk_0_2_gir_NAMESPACE) DbusmenuGtk3_0_2_gir_SCANNERFLAGS = $(DbusmenuGtk_0_2_gir_SCANNERFLAGS) +DbusmenuGtk3_0_2_gir_PACKAGES = $(DbusmenuGtk_0_2_gir_PACKAGES) INTROSPECTION_GIRS += DbusmenuGtk$(VER)-0.2.gir -- cgit v1.2.3 From 12cc39d7e2b62a279377448338a0e8af384494f2 Mon Sep 17 00:00:00 2001 From: Ken VanDine Date: Tue, 23 Nov 2010 16:19:52 -0500 Subject: Make gtk-doc building gtk3 friendly --- docs/libdbusmenu-gtk/reference/Makefile.am | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/docs/libdbusmenu-gtk/reference/Makefile.am b/docs/libdbusmenu-gtk/reference/Makefile.am index ec1bd28..6e44a23 100644 --- a/docs/libdbusmenu-gtk/reference/Makefile.am +++ b/docs/libdbusmenu-gtk/reference/Makefile.am @@ -1,5 +1,12 @@ + ## Process this file with automake to produce Makefile.in +if USE_GTK3 +VER=3 +else +VER= +endif + # We require automake 1.6 at least. AUTOMAKE_OPTIONS = 1.6 @@ -9,7 +16,7 @@ AUTOMAKE_OPTIONS = 1.6 # of using the various options. # The name of the module, e.g. 'glib'. -DOC_MODULE=libdbusmenu-gtk +DOC_MODULE=libdbusmenu-gtk$(VER) # The top-level SGML file. You can change this if you want to. DOC_MAIN_SGML_FILE=$(DOC_MODULE)-docs.sgml @@ -68,7 +75,7 @@ expand_content_files= # e.g. INCLUDES=-I$(top_srcdir) -I$(top_builddir) $(GTK_DEBUG_FLAGS) # e.g. GTKDOC_LIBS=$(top_builddir)/gtk/$(gtktargetlib) INCLUDES=-I$(top_srcdir) $(DBUSMENUGLIB_CFLAGS) $(DBUSMENUGTK_CFLAGS) -GTKDOC_LIBS=$(top_builddir)/libdbusmenu-gtk/libdbusmenu-gtk.la +GTKDOC_LIBS=$(top_builddir)/libdbusmenu-gtk/libdbusmenu-gtk$(VER).la $(DBUSMENUGLIB_LIBS) $(DBUSMENUGTK_LIBS) # This includes the standard gtk-doc make rules, copied by gtkdocize. include $(top_srcdir)/gtk-doc.local.make -- cgit v1.2.3 From a25b09998a7b9a5a1e012b8648fdf135fdc59d33 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 23 Nov 2010 16:55:43 -0600 Subject: Uhm, there's no explaination for this one. Duh. --- libdbusmenu-glib/menuitem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index 2f42704..ad6472b 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -1002,7 +1002,7 @@ dbusmenu_menuitem_property_set_variant (DbusmenuMenuitem * mi, const gchar * pro g_signal_emit(G_OBJECT(mi), signals[PROPERTY_CHANGED], 0, lprop, value, TRUE); } - return FALSE; + return TRUE; } /** -- cgit v1.2.3 From 02be403c32b2228b33d3cb122750889f165419d1 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 23 Nov 2010 17:00:14 -0600 Subject: Fixing up variant usage --- libdbusmenu-gtk/menuitem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libdbusmenu-gtk/menuitem.c b/libdbusmenu-gtk/menuitem.c index 9c1cfd2..64913be 100644 --- a/libdbusmenu-gtk/menuitem.c +++ b/libdbusmenu-gtk/menuitem.c @@ -200,9 +200,9 @@ dbusmenu_menuitem_property_set_shortcut (DbusmenuMenuitem * menuitem, guint key, const gchar * keyname = gdk_keyval_name(key); g_array_append_val(array, keyname); - GVariant * inside = g_variant_new("as", array->data); + GVariant * inside = g_variant_new_strv((const gchar * const *)array->data, -1); GVariantBuilder builder; - g_variant_builder_init(&builder, G_VARIANT_TYPE("av")); + g_variant_builder_init(&builder, G_VARIANT_TYPE_ARRAY); g_variant_builder_add_value(&builder, inside); GVariant * outsidevariant = g_variant_builder_end(&builder); -- cgit v1.2.3 From 938856dbb01aa4e583ce637a0cd34846f8a940fd Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 29 Nov 2010 12:32:35 -0600 Subject: Switching shortcut parsing code to more directly use the variant iterator --- libdbusmenu-gtk/menuitem.c | 45 +++++++++++++++++++-------------------------- 1 file changed, 19 insertions(+), 26 deletions(-) diff --git a/libdbusmenu-gtk/menuitem.c b/libdbusmenu-gtk/menuitem.c index 64913be..872142b 100644 --- a/libdbusmenu-gtk/menuitem.c +++ b/libdbusmenu-gtk/menuitem.c @@ -297,35 +297,28 @@ dbusmenu_menuitem_property_get_shortcut (DbusmenuMenuitem * menuitem, guint * ke return; } - GVariantIter outsideiter; - GVariant * inside; - g_variant_iter_init(&outsideiter, wrapper); - - while(g_variant_iter_next(&outsideiter, "v", &inside)) { - GVariantIter insideiter; - g_variant_iter_init(&insideiter, inside); - gchar * string; - - while(g_variant_iter_next(&insideiter, "s", &string)) { - if (g_strcmp0(string, DBUSMENU_MENUITEM_SHORTCUT_CONTROL) == 0) { - *modifier |= GDK_CONTROL_MASK; - } else if (g_strcmp0(string, DBUSMENU_MENUITEM_SHORTCUT_ALT) == 0) { - *modifier |= GDK_MOD1_MASK; - } else if (g_strcmp0(string, DBUSMENU_MENUITEM_SHORTCUT_SHIFT) == 0) { - *modifier |= GDK_SHIFT_MASK; - } else if (g_strcmp0(string, DBUSMENU_MENUITEM_SHORTCUT_SUPER) == 0) { - *modifier |= GDK_SUPER_MASK; - } else { - GdkModifierType tempmod; - gtk_accelerator_parse(string, key, &tempmod); - } - - g_free(string); + g_debug("Data: %s", g_variant_print(wrapper, TRUE)); + + GVariantIter iter; + g_variant_iter_init(&iter, g_variant_get_child_value(wrapper, 0)); + gchar * string; + + while(g_variant_iter_next(&iter, "s", &string)) { + if (g_strcmp0(string, DBUSMENU_MENUITEM_SHORTCUT_CONTROL) == 0) { + *modifier |= GDK_CONTROL_MASK; + } else if (g_strcmp0(string, DBUSMENU_MENUITEM_SHORTCUT_ALT) == 0) { + *modifier |= GDK_MOD1_MASK; + } else if (g_strcmp0(string, DBUSMENU_MENUITEM_SHORTCUT_SHIFT) == 0) { + *modifier |= GDK_SHIFT_MASK; + } else if (g_strcmp0(string, DBUSMENU_MENUITEM_SHORTCUT_SUPER) == 0) { + *modifier |= GDK_SUPER_MASK; + } else { + GdkModifierType tempmod; + gtk_accelerator_parse(string, key, &tempmod); } - g_variant_unref(inside); + g_free(string); } - g_variant_unref(wrapper); return; } -- cgit v1.2.3 From de467d6d1231f6490b79ddc5a4966b9521fe8536 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 29 Nov 2010 13:40:07 -0600 Subject: Wrong signal name --- libdbusmenu-glib/server.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c index c738537..a2e0849 100644 --- a/libdbusmenu-glib/server.c +++ b/libdbusmenu-glib/server.c @@ -694,7 +694,7 @@ menuitem_shown (DbusmenuMenuitem * mi, guint timestamp, DbusmenuServer * server) NULL, priv->dbusobject, DBUSMENU_INTERFACE, - "ItemPropertyUpdated", + "ItemActivationRequested", g_variant_new("(iu)", dbusmenu_menuitem_get_id(mi), timestamp), NULL); } -- cgit v1.2.3 From 611103533121afca614b2e531c5e113a1a6122f4 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 29 Nov 2010 14:21:03 -0600 Subject: Protect against NULL variants to remove warnings --- libdbusmenu-gtk/client.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libdbusmenu-gtk/client.c b/libdbusmenu-gtk/client.c index 9dd18df..77935c5 100644 --- a/libdbusmenu-gtk/client.c +++ b/libdbusmenu-gtk/client.c @@ -374,7 +374,7 @@ static void menu_prop_change_cb (DbusmenuMenuitem * mi, gchar * prop, GVariant * variant, GtkMenuItem * gmi) { if (!g_strcmp0(prop, DBUSMENU_MENUITEM_PROP_LABEL)) { - gtk_menu_item_set_label(gmi, g_variant_get_string(variant, NULL)); + gtk_menu_item_set_label(gmi, variant == NULL ? NULL : g_variant_get_string(variant, NULL)); } else if (!g_strcmp0(prop, DBUSMENU_MENUITEM_PROP_VISIBLE)) { process_visible(mi, gmi, variant); } else if (!g_strcmp0(prop, DBUSMENU_MENUITEM_PROP_ENABLED)) { @@ -742,7 +742,9 @@ image_property_handle (DbusmenuMenuitem * item, const gchar * property, GVariant } const gchar * value = NULL; - value = g_variant_get_string(variant, NULL); + if (variant != NULL) { + value = g_variant_get_string(variant, NULL); + } if (value == NULL || value[0] == '\0') { /* This means that we're unsetting a value. */ -- cgit v1.2.3 From 7a12cdc4cff4546e911bd49fd38b6fed9511d506 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 29 Nov 2010 15:19:31 -0600 Subject: Fixing the return values from AboutToShow --- libdbusmenu-glib/client.c | 2 +- libdbusmenu-glib/server.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index a918f43..7a6d87c 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -1287,7 +1287,7 @@ about_to_show_cb (GObject * proxy, GAsyncResult * res, gpointer userdata) /* Note: we're just ensuring only the callback gets called */ need_update = FALSE; } else { - g_variant_get(params, "b", &need_update); + g_variant_get(params, "(b)", &need_update); g_variant_unref(params); } diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c index a2e0849..4202299 100644 --- a/libdbusmenu-glib/server.c +++ b/libdbusmenu-glib/server.c @@ -1078,7 +1078,7 @@ bus_about_to_show (DbusmenuServer * server, GVariant * params, GDBusMethodInvoca /* GTK+ does not support about-to-show concept for now */ g_dbus_method_invocation_return_value(invocation, - g_variant_new_boolean(FALSE)); + g_variant_new("(b)", FALSE)); return; } -- cgit v1.2.3 From d3c6ef0dd116d888e3415b2566d7bf14cb6ee0b7 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 29 Nov 2010 15:19:52 -0600 Subject: Ensuring all returns are protected by tuples for GDBus --- libdbusmenu-glib/server.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c index 4202299..8a10715 100644 --- a/libdbusmenu-glib/server.c +++ b/libdbusmenu-glib/server.c @@ -551,6 +551,7 @@ bus_method_call (GDBusConnection * connection, const gchar * sender, const gchar return dbusmenu_method_table[i].func(DBUSMENU_SERVER(user_data), params, invocation); } else { /* If we have a null function we're responding but nothing else. */ + g_warning("Invalid function call for '%s' with parameters: %s", method, g_variant_print(params, TRUE)); g_dbus_method_invocation_return_value(invocation, NULL); return; } @@ -829,7 +830,7 @@ bus_get_property (DbusmenuServer * server, GVariant * params, GDBusMethodInvocat return; } - g_dbus_method_invocation_return_value(invocation, variant); + g_dbus_method_invocation_return_value(invocation, g_variant_new("(v)", variant)); return; } @@ -862,7 +863,7 @@ bus_get_properties (DbusmenuServer * server, GVariant * params, GDBusMethodInvoc GVariant * dict = dbusmenu_menuitem_properties_variant(mi); - g_dbus_method_invocation_return_value(invocation, dict); + g_dbus_method_invocation_return_value(invocation, g_variant_new("(a{sv})", dict)); return; } @@ -978,7 +979,9 @@ bus_get_children (DbusmenuServer * server, GVariant * params, GDBusMethodInvocat g_list_foreach(children, serialize_menuitem, &builder); - ret = g_variant_builder_end(&builder); + 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); } g_dbus_method_invocation_return_value(invocation, ret); -- cgit v1.2.3 From e3097b569710d3cb8466f229571dc632decd1671 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 29 Nov 2010 15:38:21 -0600 Subject: Switching to use the builder all the way for the strings instead of the GArray --- libdbusmenu-gtk/menuitem.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/libdbusmenu-gtk/menuitem.c b/libdbusmenu-gtk/menuitem.c index 872142b..1b8cab1 100644 --- a/libdbusmenu-gtk/menuitem.c +++ b/libdbusmenu-gtk/menuitem.c @@ -177,31 +177,26 @@ dbusmenu_menuitem_property_set_shortcut (DbusmenuMenuitem * menuitem, guint key, g_return_val_if_fail(DBUSMENU_IS_MENUITEM(menuitem), FALSE); g_return_val_if_fail(gtk_accelerator_valid(key, modifier), FALSE); - GArray * array = g_array_sized_new(TRUE, TRUE, sizeof(gchar *), 4); /* Four seems like the max we'd need, plus it's still small */ - - const gchar * control_val = DBUSMENU_MENUITEM_SHORTCUT_CONTROL; - const gchar * alt_val = DBUSMENU_MENUITEM_SHORTCUT_ALT; - const gchar * shift_val = DBUSMENU_MENUITEM_SHORTCUT_SHIFT; - const gchar * super_val = DBUSMENU_MENUITEM_SHORTCUT_SUPER; + GVariantBuilder builder; + g_variant_builder_init(&builder, G_VARIANT_TYPE_ARRAY); if (modifier & GDK_CONTROL_MASK) { - g_array_append_val(array, control_val); + g_variant_builder_add(&builder, "s", DBUSMENU_MENUITEM_SHORTCUT_CONTROL); } if (modifier & GDK_MOD1_MASK) { - g_array_append_val(array, alt_val); + g_variant_builder_add(&builder, "s", DBUSMENU_MENUITEM_SHORTCUT_ALT); } if (modifier & GDK_SHIFT_MASK) { - g_array_append_val(array, shift_val); + g_variant_builder_add(&builder, "s", DBUSMENU_MENUITEM_SHORTCUT_SHIFT); } if (modifier & GDK_SUPER_MASK) { - g_array_append_val(array, super_val); + g_variant_builder_add(&builder, "s", DBUSMENU_MENUITEM_SHORTCUT_SUPER); } const gchar * keyname = gdk_keyval_name(key); - g_array_append_val(array, keyname); + g_variant_builder_add(&builder, "s", keyname); - GVariant * inside = g_variant_new_strv((const gchar * const *)array->data, -1); - GVariantBuilder builder; + GVariant * inside = g_variant_builder_end(&builder); g_variant_builder_init(&builder, G_VARIANT_TYPE_ARRAY); g_variant_builder_add_value(&builder, inside); GVariant * outsidevariant = g_variant_builder_end(&builder); -- cgit v1.2.3 From 675693fe90c242c4dc9d54d7d3ed34be49d931cc Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 29 Nov 2010 15:50:38 -0600 Subject: Ah, oops, we shouldn't unref these variants as they're kept in the hashtable, we have them as floating. --- libdbusmenu-gtk/menuitem.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/libdbusmenu-gtk/menuitem.c b/libdbusmenu-gtk/menuitem.c index 1b8cab1..2251efc 100644 --- a/libdbusmenu-gtk/menuitem.c +++ b/libdbusmenu-gtk/menuitem.c @@ -201,12 +201,7 @@ dbusmenu_menuitem_property_set_shortcut (DbusmenuMenuitem * menuitem, guint key, g_variant_builder_add_value(&builder, inside); GVariant * outsidevariant = g_variant_builder_end(&builder); - dbusmenu_menuitem_property_set_variant(menuitem, DBUSMENU_MENUITEM_PROP_SHORTCUT, outsidevariant); - - g_variant_unref(outsidevariant); - g_variant_unref(inside); - - return TRUE; + return dbusmenu_menuitem_property_set_variant(menuitem, DBUSMENU_MENUITEM_PROP_SHORTCUT, outsidevariant); } /* Look at the closures in an accel group and find -- cgit v1.2.3 From 9231081151c71846010c1be75277a4cc0afc29e3 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 29 Nov 2010 15:51:57 -0600 Subject: oops, forgot a debug message --- libdbusmenu-gtk/menuitem.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/libdbusmenu-gtk/menuitem.c b/libdbusmenu-gtk/menuitem.c index 2251efc..e27e6ff 100644 --- a/libdbusmenu-gtk/menuitem.c +++ b/libdbusmenu-gtk/menuitem.c @@ -287,8 +287,6 @@ dbusmenu_menuitem_property_get_shortcut (DbusmenuMenuitem * menuitem, guint * ke return; } - g_debug("Data: %s", g_variant_print(wrapper, TRUE)); - GVariantIter iter; g_variant_iter_init(&iter, g_variant_get_child_value(wrapper, 0)); gchar * string; -- cgit v1.2.3 From b953ca847127fcc9698b83dbfcb8f760b7b62b30 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 1 Dec 2010 14:40:30 -0600 Subject: Removing the flush. It seems to be broken in GDBus and I can't fix it. --- libdbusmenu-glib/client.c | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index 7a6d87c..454e8bb 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -549,6 +549,7 @@ get_properties_callback (GObject *obj, GAsyncResult * res, gpointer user_data) for (i = 0; i < listeners->len; i++) { properties_listener_t * listener = &g_array_index(listeners, properties_listener_t, i); if (!listener->replied) { + g_warning("Generating properties error for: %d", listener->id); if (localerror == NULL) { g_set_error_literal(&localerror, error_domain(), 0, "Error getting properties for ID"); } @@ -625,21 +626,6 @@ get_properties_idle (gpointer user_data) return FALSE; } -/* Report and error if we're unable to flush the connection, likely - to be a cause of some other issues. */ -static void -connection_flush_cb (GObject * object, GAsyncResult * result, gpointer user_data) -{ - GError * error = NULL; - - if (!g_dbus_connection_flush_finish(G_DBUS_CONNECTION(object), result, &error)) { - g_warning("Unable to flush DBus connection: %s", error->message); - g_error_free(error); - } - - return; -} - /* Forces a call out to start getting properties with the menu items that we have queued up already. */ static void @@ -656,12 +642,6 @@ get_properties_flush (DbusmenuClient * client) get_properties_idle(client); - /* I'm not sure this flush is necissary with GDBus running the - DBus connection in another thread. But, I don't think that - it'll hurt anything either, so I'm leaving it in. */ - g_return_if_fail(priv->session_bus != NULL); - g_dbus_connection_flush(priv->session_bus, NULL, connection_flush_cb, NULL); - return; } -- cgit v1.2.3 From cd6960896d1f3b6143737eadd53ba69561eba2a8 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 1 Dec 2010 15:48:08 -0600 Subject: Changing the quoting so that the test passes --- tests/test-json-01.json | 1644 +++++++++++++++++++++++------------------------ 1 file changed, 822 insertions(+), 822 deletions(-) diff --git a/tests/test-json-01.json b/tests/test-json-01.json index 08e9112..b626d20 100644 --- a/tests/test-json-01.json +++ b/tests/test-json-01.json @@ -1,127 +1,127 @@ { "id": 0, - "children-display": "submenu", + "children-display": 'submenu', "submenu": [ { "id": 5, - "children-display": "submenu", + "children-display": 'submenu', "enabled": true, - "label": "File", + "label": 'File', "visible": true, "submenu": [ { "id": 6, "enabled": true, - "label": "Quit", - "shortcut": [["Control", "q"]], + "label": 'Quit', + "shortcut": [['Control', 'q']], "visible": true }, { "id": 7, "enabled": true, - "label": "Close all", - "shortcut": [["Control", "Shift", "w"]], + "label": 'Close all', + "shortcut": [['Control', 'Shift', 'w']], "visible": true }, { "id": 8, "enabled": true, - "label": "Close", - "shortcut": [["Control", "w"]], + "label": 'Close', + "shortcut": [['Control', 'w']], "visible": true }, { "id": 9, - "type": "separator" + "type": 'separator' }, { "id": 10, "enabled": true, - "label": "Send by Email...", + "label": 'Send by Email...', "visible": true }, { "id": 11, "enabled": true, - "label": "Print...", - "shortcut": [["Control", "p"]], + "label": 'Print...', + "shortcut": [['Control', 'p']], "visible": true }, { "id": 12, "enabled": true, - "label": "Page Setup", + "label": 'Page Setup', "visible": true }, { "id": 13, - "type": "separator" + "type": 'separator' }, { "id": 14, "enabled": true, - "label": "Revert", + "label": 'Revert', "visible": true }, { "id": 15, "enabled": true, - "label": "Save as Template...", + "label": 'Save as Template...', "visible": true }, { "id": 16, "enabled": true, - "label": "Save a Copy...", + "label": 'Save a Copy...', "visible": true }, { "id": 17, "enabled": true, - "label": "Save As...", - "shortcut": [["Control", "Shift", "s"]], + "label": 'Save As...', + "shortcut": [['Control', 'Shift', 's']], "visible": true }, { "id": 18, "enabled": true, - "label": "Save", - "shortcut": [["Control", "s"]], + "label": 'Save', + "shortcut": [['Control', 's']], "visible": true }, { "id": 19, - "type": "separator" + "type": 'separator' }, { "id": 20, - "children-display": "submenu", + "children-display": 'submenu', "enabled": true, - "label": "Open Recent", + "label": 'Open Recent', "visible": true, "submenu": [ { "id": 21, "enabled": true, - "label": "Document History", + "label": 'Document History', "visible": true }, { "id": 22, - "type": "separator" + "type": 'separator' }, { "id": 23, "enabled": true, - "label": "giggity.jpg", - "shortcut": [["Control", "2"]], + "label": 'giggity.jpg', + "shortcut": [['Control', '2']], "visible": true }, { "id": 24, "enabled": true, - "label": "Icon Height.svg", - "shortcut": [["Control", "1"]], + "label": 'Icon Height.svg', + "shortcut": [['Control', '1']], "visible": true } ] @@ -129,150 +129,150 @@ { "id": 25, "enabled": true, - "label": "Open Location...", + "label": 'Open Location...', "visible": true }, { "id": 26, "enabled": true, - "label": "Open as Layers...", - "shortcut": [["Control", "Alt", "o"]], + "label": 'Open as Layers...', + "shortcut": [['Control', 'Alt', 'o']], "visible": true }, { "id": 27, "enabled": true, - "label": "Open...", - "shortcut": [["Control", "o"]], + "label": 'Open...', + "shortcut": [['Control', 'o']], "visible": true }, { "id": 28, - "children-display": "submenu", + "children-display": 'submenu', "enabled": true, - "label": "Create", + "label": 'Create', "visible": true, "submenu": [ { "id": 29, - "children-display": "submenu", + "children-display": 'submenu', "enabled": true, - "label": "Web Page Themes", + "label": 'Web Page Themes', "visible": true, "submenu": [ { "id": 30, - "children-display": "submenu", + "children-display": 'submenu', "enabled": true, - "label": "Classic.Gimp.Org", + "label": 'Classic.Gimp.Org', "visible": true, "submenu": [ { "id": 31, "enabled": true, - "label": "Tube Sub-Sub-Button Label...", + "label": 'Tube Sub-Sub-Button Label...', "visible": true }, { "id": 32, "enabled": true, - "label": "Tube Sub-Button Label...", + "label": 'Tube Sub-Button Label...', "visible": true }, { "id": 33, "enabled": true, - "label": "Tube Button Label...", + "label": 'Tube Button Label...', "visible": true }, { "id": 34, "enabled": true, - "label": "Small Header...", + "label": 'Small Header...', "visible": true }, { "id": 35, "enabled": true, - "label": "General Tube Labels...", + "label": 'General Tube Labels...', "visible": true }, { "id": 36, "enabled": true, - "label": "Big Header...", + "label": 'Big Header...', "visible": true } ] }, { "id": 37, - "children-display": "submenu", + "children-display": 'submenu', "enabled": true, - "label": "Beveled Pattern", + "label": 'Beveled Pattern', "visible": true, "submenu": [ { "id": 38, "enabled": true, - "label": "Hrule...", + "label": 'Hrule...', "visible": true }, { "id": 39, "enabled": true, - "label": "Heading...", + "label": 'Heading...', "visible": true }, { "id": 40, "enabled": true, - "label": "Button...", + "label": 'Button...', "visible": true }, { "id": 41, "enabled": true, - "label": "Bullet...", + "label": 'Bullet...', "visible": true }, { "id": 42, "enabled": true, - "label": "Arrow...", + "label": 'Arrow...', "visible": true } ] }, { "id": 43, - "children-display": "submenu", + "children-display": 'submenu', "enabled": true, - "label": "Alien Glow", + "label": 'Alien Glow', "visible": true, "submenu": [ { "id": 44, "enabled": true, - "label": "Hrule...", + "label": 'Hrule...', "visible": true }, { "id": 45, "enabled": true, - "label": "Button...", + "label": 'Button...', "visible": true }, { "id": 46, "enabled": true, - "label": "Bullet...", + "label": 'Bullet...', "visible": true }, { "id": 47, "enabled": true, - "label": "Arrow...", + "label": 'Arrow...', "visible": true } ] @@ -281,274 +281,274 @@ }, { "id": 48, - "children-display": "submenu", + "children-display": 'submenu', "enabled": true, - "label": "Patterns", + "label": 'Patterns', "visible": true, "submenu": [ { "id": 49, "enabled": true, - "label": "Truchet...", + "label": 'Truchet...', "visible": true }, { "id": 50, "enabled": true, - "label": "Swirly...", + "label": 'Swirly...', "visible": true }, { "id": 51, "enabled": true, - "label": "Swirl-Tile...", + "label": 'Swirl-Tile...', "visible": true }, { "id": 52, "enabled": true, - "label": "Render Map...", + "label": 'Render Map...', "visible": true }, { "id": 53, "enabled": true, - "label": "Land...", + "label": 'Land...', "visible": true }, { "id": 54, "enabled": true, - "label": "Flatland...", + "label": 'Flatland...', "visible": true }, { "id": 55, "enabled": true, - "label": "Camouflage...", + "label": 'Camouflage...', "visible": true }, { "id": 56, "enabled": true, - "label": "3D Truchet...", + "label": '3D Truchet...', "visible": true } ] }, { "id": 57, - "children-display": "submenu", + "children-display": 'submenu', "enabled": true, - "label": "Logos", + "label": 'Logos', "visible": true, "submenu": [ { "id": 58, "enabled": true, - "label": "Web Title Header...", + "label": 'Web Title Header...', "visible": true }, { "id": 59, "enabled": true, - "label": "Textured...", + "label": 'Textured...', "visible": true }, { "id": 60, "enabled": true, - "label": "Text Circle...", + "label": 'Text Circle...', "visible": true }, { "id": 61, "enabled": true, - "label": "Starscape...", + "label": 'Starscape...', "visible": true }, { "id": 62, "enabled": true, - "label": "Speed Text...", + "label": 'Speed Text...', "visible": true }, { "id": 63, "enabled": true, - "label": "SOTA Chrome...", + "label": 'SOTA Chrome...', "visible": true }, { "id": 64, "enabled": true, - "label": "Particle Trace...", + "label": 'Particle Trace...', "visible": true }, { "id": 65, "enabled": true, - "label": "Newsprint Text...", + "label": 'Newsprint Text...', "visible": true }, { "id": 66, "enabled": true, - "label": "Neon...", + "label": 'Neon...', "visible": true }, { "id": 67, "enabled": true, - "label": "Imigre-26...", + "label": 'Imigre-26...', "visible": true }, { "id": 68, "enabled": true, - "label": "Gradient Bevel...", + "label": 'Gradient Bevel...', "visible": true }, { "id": 69, "enabled": true, - "label": "Glowing Hot...", + "label": 'Glowing Hot...', "visible": true }, { "id": 70, "enabled": true, - "label": "Glossy...", + "label": 'Glossy...', "visible": true }, { "id": 71, "enabled": true, - "label": "Frosty...", + "label": 'Frosty...', "visible": true }, { "id": 72, "enabled": true, - "label": "Crystal...", + "label": 'Crystal...', "visible": true }, { "id": 73, "enabled": true, - "label": "Cool Metal...", + "label": 'Cool Metal...', "visible": true }, { "id": 74, "enabled": true, - "label": "Comic Book...", + "label": 'Comic Book...', "visible": true }, { "id": 75, "enabled": true, - "label": "Chrome...", + "label": 'Chrome...', "visible": true }, { "id": 76, "enabled": true, - "label": "Chip Away...", + "label": 'Chip Away...', "visible": true }, { "id": 77, "enabled": true, - "label": "Chalk...", + "label": 'Chalk...', "visible": true }, { "id": 78, "enabled": true, - "label": "Carved...", + "label": 'Carved...', "visible": true }, { "id": 79, "enabled": true, - "label": "Bovination...", + "label": 'Bovination...', "visible": true }, { "id": 80, "enabled": true, - "label": "Blended...", + "label": 'Blended...', "visible": true }, { "id": 81, "enabled": true, - "label": "Basic I...", + "label": 'Basic I...', "visible": true }, { "id": 82, "enabled": true, - "label": "Basic II...", + "label": 'Basic II...', "visible": true }, { "id": 83, "enabled": true, - "label": "Alien Neon...", + "label": 'Alien Neon...', "visible": true }, { "id": 84, "enabled": true, - "label": "Alien Glow...", + "label": 'Alien Glow...', "visible": true }, { "id": 85, "enabled": true, - "label": "3D Outline...", + "label": '3D Outline...', "visible": true } ] }, { "id": 86, - "children-display": "submenu", + "children-display": 'submenu', "enabled": true, - "label": "Buttons", + "label": 'Buttons', "visible": true, "submenu": [ { "id": 87, "enabled": true, - "label": "Simple Beveled Button...", + "label": 'Simple Beveled Button...', "visible": true }, { "id": 88, "enabled": true, - "label": "Round Button...", + "label": 'Round Button...', "visible": true } ] }, { "id": 89, - "type": "separator" + "type": 'separator' }, { "id": 90, - "children-display": "submenu", + "children-display": 'submenu', "enabled": true, - "label": "xscanimage", + "label": 'xscanimage', "visible": true, "submenu": [ { "id": 91, "enabled": false, - "label": "Device dialog...", + "label": 'Device dialog...', "visible": true } ] @@ -556,14 +556,14 @@ { "id": 92, "enabled": true, - "label": "Screenshot...", + "label": 'Screenshot...', "visible": true }, { "id": 93, "enabled": true, - "label": "From Clipboard", - "shortcut": [["Control", "Shift", "v"]], + "label": 'From Clipboard', + "shortcut": [['Control', 'Shift', 'v']], "visible": true } ] @@ -571,154 +571,154 @@ { "id": 94, "enabled": true, - "label": "New...", - "shortcut": [["Control", "n"]], + "label": 'New...', + "shortcut": [['Control', 'n']], "visible": true } ] }, { "id": 95, - "children-display": "submenu", + "children-display": 'submenu', "enabled": true, - "label": "Edit", + "label": 'Edit', "visible": true, "submenu": [ { "id": 96, "enabled": true, - "label": "Units", + "label": 'Units', "visible": true }, { "id": 97, "enabled": true, - "label": "Modules", + "label": 'Modules', "visible": true }, { "id": 98, "enabled": true, - "label": "Keyboard Shortcuts", + "label": 'Keyboard Shortcuts', "visible": true }, { "id": 99, "enabled": true, - "label": "Preferences", + "label": 'Preferences', "visible": true }, { "id": 100, - "type": "separator" + "type": 'separator' }, { "id": 101, "enabled": false, - "label": "Stroke Path...", + "label": 'Stroke Path...', "visible": true }, { "id": 102, "enabled": false, - "label": "Stroke Selection...", + "label": 'Stroke Selection...', "visible": true }, { "id": 103, "enabled": true, - "label": "Fill with Pattern", - "shortcut": [["Control", "semicolon"]], + "label": 'Fill with Pattern', + "shortcut": [['Control', 'semicolon']], "visible": true }, { "id": 104, "enabled": true, - "label": "Fill with BG Color", - "shortcut": [["Control", "period"]], + "label": 'Fill with BG Color', + "shortcut": [['Control', 'period']], "visible": true }, { "id": 105, "enabled": true, - "label": "Fill with FG Color", - "shortcut": [["Control", "comma"]], + "label": 'Fill with FG Color', + "shortcut": [['Control', 'comma']], "visible": true }, { "id": 106, "enabled": true, - "label": "Clear", - "shortcut": [["Delete"]], + "label": 'Clear', + "shortcut": [['Delete']], "visible": true }, { "id": 107, - "type": "separator" + "type": 'separator' }, { "id": 108, - "children-display": "submenu", + "children-display": 'submenu', "enabled": true, - "label": "Buffer", + "label": 'Buffer', "visible": true, "submenu": [ { "id": 109, "enabled": true, - "label": "Paste Named...", + "label": 'Paste Named...', "visible": true }, { "id": 110, "enabled": true, - "label": "Copy Visible Named...", + "label": 'Copy Visible Named...', "visible": true }, { "id": 111, "enabled": true, - "label": "Copy Named...", + "label": 'Copy Named...', "visible": true }, { "id": 112, "enabled": true, - "label": "Cut Named...", + "label": 'Cut Named...', "visible": true } ] }, { "id": 113, - "children-display": "submenu", + "children-display": 'submenu', "enabled": true, - "label": "Paste as", + "label": 'Paste as', "visible": true, "submenu": [ { "id": 114, "enabled": true, - "label": "New Pattern...", + "label": 'New Pattern...', "visible": true }, { "id": 115, "enabled": true, - "label": "New Brush...", + "label": 'New Brush...', "visible": true }, { "id": 116, "enabled": true, - "label": "New Layer", + "label": 'New Layer', "visible": true }, { "id": 117, "enabled": true, - "label": "New Image", - "shortcut": [["Control", "Shift", "v"]], + "label": 'New Image', + "shortcut": [['Control', 'Shift', 'v']], "visible": true } ] @@ -726,390 +726,390 @@ { "id": 118, "enabled": true, - "label": "Paste Into", + "label": 'Paste Into', "visible": true }, { "id": 119, "enabled": true, - "label": "Paste", - "shortcut": [["Control", "v"]], + "label": 'Paste', + "shortcut": [['Control', 'v']], "visible": true }, { "id": 120, "enabled": true, - "label": "Copy Visible", - "shortcut": [["Control", "Shift", "c"]], + "label": 'Copy Visible', + "shortcut": [['Control', 'Shift', 'c']], "visible": true }, { "id": 121, "enabled": true, - "label": "Copy", - "shortcut": [["Control", "c"]], + "label": 'Copy', + "shortcut": [['Control', 'c']], "visible": true }, { "id": 122, "enabled": true, - "label": "Cut", - "shortcut": [["Control", "x"]], + "label": 'Cut', + "shortcut": [['Control', 'x']], "visible": true }, { "id": 123, - "type": "separator" + "type": 'separator' }, { "id": 124, "enabled": true, - "label": "Undo History", + "label": 'Undo History', "visible": true }, { "id": 3, "enabled": false, - "label": "_Fade...", + "label": '_Fade...', "visible": true }, { "id": 2, "enabled": false, - "label": "_Redo", - "shortcut": [["Control", "y"]], + "label": '_Redo', + "shortcut": [['Control', 'y']], "visible": true }, { "id": 1, "enabled": false, - "label": "_Undo", - "shortcut": [["Control", "z"]], + "label": '_Undo', + "shortcut": [['Control', 'z']], "visible": true } ] }, { "id": 125, - "children-display": "submenu", + "children-display": 'submenu', "enabled": true, - "label": "Select", + "label": 'Select', "visible": true, "submenu": [ { "id": 126, "enabled": false, - "label": "To Path", + "label": 'To Path', "visible": true }, { "id": 127, "enabled": true, - "label": "Save to Channel", + "label": 'Save to Channel', "visible": true }, { "id": 128, "enabled": true, - "label": "Toggle Quick Mask", - "shortcut": [["Shift", "q"]], + "label": 'Toggle Quick Mask', + "shortcut": [['Shift', 'q']], "toggle-state": 0, - "toggle-type": "checkmark", + "toggle-type": 'checkmark', "visible": true }, { "id": 129, - "type": "separator" + "type": 'separator' }, { "id": 130, "enabled": true, - "label": "Distort...", + "label": 'Distort...', "visible": true }, { "id": 131, "enabled": false, - "label": "Border...", + "label": 'Border...', "visible": true }, { "id": 132, "enabled": false, - "label": "Grow...", + "label": 'Grow...', "visible": true }, { "id": 133, "enabled": false, - "label": "Shrink...", + "label": 'Shrink...', "visible": true }, { "id": 134, "enabled": false, - "label": "Sharpen", + "label": 'Sharpen', "visible": true }, { "id": 135, "enabled": false, - "label": "Feather...", + "label": 'Feather...', "visible": true }, { "id": 136, - "type": "separator" + "type": 'separator' }, { "id": 137, "enabled": true, - "label": "Selection Editor", + "label": 'Selection Editor', "visible": true }, { "id": 138, "enabled": false, - "label": "From Path", - "shortcut": [["Shift", "v"]], + "label": 'From Path', + "shortcut": [['Shift', 'v']], "visible": true }, { "id": 139, "enabled": true, - "label": "By Color", - "shortcut": [["Shift", "o"]], + "label": 'By Color', + "shortcut": [['Shift', 'o']], "visible": true }, { "id": 140, "enabled": false, - "label": "Float", - "shortcut": [["Control", "Shift", "l"]], + "label": 'Float', + "shortcut": [['Control', 'Shift', 'l']], "visible": true }, { "id": 141, "enabled": true, - "label": "Invert", - "shortcut": [["Control", "i"]], + "label": 'Invert', + "shortcut": [['Control', 'i']], "visible": true }, { "id": 142, "enabled": false, - "label": "None", - "shortcut": [["Control", "Shift", "a"]], + "label": 'None', + "shortcut": [['Control', 'Shift', 'a']], "visible": true }, { "id": 143, "enabled": true, - "label": "All", - "shortcut": [["Control", "a"]], + "label": 'All', + "shortcut": [['Control', 'a']], "visible": true } ] }, { "id": 144, - "children-display": "submenu", + "children-display": 'submenu', "enabled": true, - "label": "View", + "label": 'View', "visible": true, "submenu": [ { "id": 145, "enabled": true, - "label": "Show Statusbar", + "label": 'Show Statusbar', "toggle-state": 1, - "toggle-type": "checkmark", + "toggle-type": 'checkmark', "visible": true }, { "id": 146, "enabled": true, - "label": "Show Scrollbars", + "label": 'Show Scrollbars', "toggle-state": 0, - "toggle-type": "checkmark", + "toggle-type": 'checkmark', "visible": true }, { "id": 147, "enabled": true, - "label": "Show Rulers", - "shortcut": [["Control", "Shift", "r"]], + "label": 'Show Rulers', + "shortcut": [['Control', 'Shift', 'r']], "toggle-state": 0, - "toggle-type": "checkmark", + "toggle-type": 'checkmark', "visible": true }, { "id": 148, "enabled": true, - "label": "Show Menubar", + "label": 'Show Menubar', "toggle-state": 1, - "toggle-type": "checkmark", + "toggle-type": 'checkmark', "visible": true }, { "id": 149, - "children-display": "submenu", + "children-display": 'submenu', "enabled": true, - "label": "Padding Color", + "label": 'Padding Color', "visible": true, "submenu": [ { "id": 150, "enabled": true, - "label": "As in Preferences", + "label": 'As in Preferences', "visible": true }, { "id": 151, - "type": "separator" + "type": 'separator' }, { "id": 152, "enabled": true, - "label": "Select Custom Color...", + "label": 'Select Custom Color...', "visible": true }, { "id": 153, "enabled": true, - "label": "Dark Check Color", + "label": 'Dark Check Color', "visible": true }, { "id": 154, "enabled": true, - "label": "Light Check Color", + "label": 'Light Check Color', "visible": true }, { "id": 155, "enabled": true, - "label": "From Theme", + "label": 'From Theme', "visible": true } ] }, { "id": 156, - "type": "separator" + "type": 'separator' }, { "id": 157, "enabled": true, - "label": "Snap to Active Path", + "label": 'Snap to Active Path', "toggle-state": 0, - "toggle-type": "checkmark", + "toggle-type": 'checkmark', "visible": true }, { "id": 158, "enabled": true, - "label": "Snap to Canvas Edges", + "label": 'Snap to Canvas Edges', "toggle-state": 0, - "toggle-type": "checkmark", + "toggle-type": 'checkmark', "visible": true }, { "id": 159, "enabled": true, - "label": "Snap to Grid", + "label": 'Snap to Grid', "toggle-state": 0, - "toggle-type": "checkmark", + "toggle-type": 'checkmark', "visible": true }, { "id": 160, "enabled": true, - "label": "Snap to Guides", + "label": 'Snap to Guides', "toggle-state": 1, - "toggle-type": "checkmark", + "toggle-type": 'checkmark', "visible": true }, { "id": 161, - "type": "separator" + "type": 'separator' }, { "id": 162, "enabled": true, - "label": "Show Sample Points", + "label": 'Show Sample Points', "toggle-state": 0, - "toggle-type": "checkmark", + "toggle-type": 'checkmark', "visible": true }, { "id": 163, "enabled": true, - "label": "Show Grid", + "label": 'Show Grid', "toggle-state": 0, - "toggle-type": "checkmark", + "toggle-type": 'checkmark', "visible": true }, { "id": 164, "enabled": true, - "label": "Show Guides", - "shortcut": [["Control", "Shift", "t"]], + "label": 'Show Guides', + "shortcut": [['Control', 'Shift', 't']], "toggle-state": 0, - "toggle-type": "checkmark", + "toggle-type": 'checkmark', "visible": true }, { "id": 165, "enabled": true, - "label": "Show Layer Boundary", + "label": 'Show Layer Boundary', "toggle-state": 0, - "toggle-type": "checkmark", + "toggle-type": 'checkmark', "visible": true }, { "id": 166, "enabled": true, - "label": "Show Selection", - "shortcut": [["Control", "t"]], + "label": 'Show Selection', + "shortcut": [['Control', 't']], "toggle-state": 0, - "toggle-type": "checkmark", + "toggle-type": 'checkmark', "visible": true }, { "id": 167, - "type": "separator" + "type": 'separator' }, { "id": 168, "enabled": true, - "label": "Display Filters...", + "label": 'Display Filters...', "visible": true }, { "id": 169, "enabled": true, - "label": "Navigation Window", + "label": 'Navigation Window', "visible": true }, { "id": 170, - "type": "separator" + "type": 'separator' }, { "id": 171, - "children-display": "submenu", + "children-display": 'submenu', "enabled": true, - "label": "Fullscreen", - "shortcut": [["F11"]], + "label": 'Fullscreen', + "shortcut": [['F11']], "toggle-state": 0, - "toggle-type": "checkmark", + "toggle-type": 'checkmark', "visible": true, "submenu": [ { "id": 172, "enabled": true, - "label": "Open Display...", + "label": 'Open Display...', "visible": true } ] @@ -1117,142 +1117,142 @@ { "id": 173, "enabled": true, - "label": "Shrink Wrap", - "shortcut": [["Control", "e"]], + "label": 'Shrink Wrap', + "shortcut": [['Control', 'e']], "visible": true }, { "id": 174, - "type": "separator" + "type": 'separator' }, { "id": 175, - "children-display": "submenu", + "children-display": 'submenu', "enabled": true, - "label": "_Zoom (67%)", + "label": '_Zoom (67%)', "visible": true, "submenu": [ { "id": 176, "enabled": true, - "label": "Othe_r (67%)...", + "label": 'Othe_r (67%)...', "toggle-state": 0, - "toggle-type": "checkmark", + "toggle-type": 'checkmark', "visible": true }, { "id": 177, - "type": "separator" + "type": 'separator' }, { "id": 178, "enabled": true, - "label": "1:16 (6.25%)", + "label": '1:16 (6.25%)', "toggle-state": 0, - "toggle-type": "checkmark", + "toggle-type": 'checkmark', "visible": true }, { "id": 179, "enabled": true, - "label": "1:8 (12.5%)", + "label": '1:8 (12.5%)', "toggle-state": 0, - "toggle-type": "checkmark", + "toggle-type": 'checkmark', "visible": true }, { "id": 180, "enabled": true, - "label": "1:4 (25%)", + "label": '1:4 (25%)', "toggle-state": 0, - "toggle-type": "checkmark", + "toggle-type": 'checkmark', "visible": true }, { "id": 181, "enabled": true, - "label": "1:2 (50%)", + "label": '1:2 (50%)', "toggle-state": 0, - "toggle-type": "checkmark", + "toggle-type": 'checkmark', "visible": true }, { "id": 182, "enabled": true, - "label": "1:1 (100%)", - "shortcut": [["1"]], + "label": '1:1 (100%)', + "shortcut": [['1']], "toggle-state": 1, - "toggle-type": "checkmark", + "toggle-type": 'checkmark', "visible": true }, { "id": 183, "enabled": true, - "label": "2:1 (200%)", + "label": '2:1 (200%)', "toggle-state": 0, - "toggle-type": "checkmark", + "toggle-type": 'checkmark', "visible": true }, { "id": 184, "enabled": true, - "label": "4:1 (400%)", + "label": '4:1 (400%)', "toggle-state": 0, - "toggle-type": "checkmark", + "toggle-type": 'checkmark', "visible": true }, { "id": 185, "enabled": true, - "label": "8:1 (800%)", + "label": '8:1 (800%)', "toggle-state": 0, - "toggle-type": "checkmark", + "toggle-type": 'checkmark', "visible": true }, { "id": 186, "enabled": true, - "label": "16:1 (1600%)", + "label": '16:1 (1600%)', "toggle-state": 0, - "toggle-type": "checkmark", + "toggle-type": 'checkmark', "visible": true }, { "id": 187, - "type": "separator" + "type": 'separator' }, { "id": 188, "enabled": true, - "label": "Fill Window", + "label": 'Fill Window', "visible": true }, { "id": 189, "enabled": true, - "label": "Fit Image in Window", - "shortcut": [["Control", "Shift", "e"]], + "label": 'Fit Image in Window', + "shortcut": [['Control', 'Shift', 'e']], "visible": true }, { "id": 190, "enabled": true, - "label": "Zoom In", - "shortcut": [["plus"]], + "label": 'Zoom In', + "shortcut": [['plus']], "visible": true }, { "id": 191, "enabled": true, - "label": "Zoom Out", - "shortcut": [["minus"]], + "label": 'Zoom Out', + "shortcut": [['minus']], "visible": true }, { "id": 4, "enabled": true, - "label": "Re_vert Zoom (67%)", - "shortcut": [["grave"]], + "label": 'Re_vert Zoom (67%)', + "shortcut": [['grave']], "visible": true } ] @@ -1260,253 +1260,253 @@ { "id": 192, "enabled": true, - "label": "Dot for Dot", + "label": 'Dot for Dot', "toggle-state": 1, - "toggle-type": "checkmark", + "toggle-type": 'checkmark', "visible": true }, { "id": 193, "enabled": true, - "label": "New View", + "label": 'New View', "visible": true } ] }, { "id": 194, - "children-display": "submenu", + "children-display": 'submenu', "enabled": true, - "label": "Image", + "label": 'Image', "visible": true, "submenu": [ { "id": 195, "enabled": true, - "label": "Image Properties", - "shortcut": [["Alt", "Return"]], + "label": 'Image Properties', + "shortcut": [['Alt', 'Return']], "visible": true }, { "id": 196, "enabled": true, - "label": "Configure Grid...", + "label": 'Configure Grid...', "visible": true }, { "id": 197, - "children-display": "submenu", + "children-display": 'submenu', "enabled": true, - "label": "Guides", + "label": 'Guides', "visible": true, "submenu": [ { "id": 198, "enabled": true, - "label": "Remove all Guides", + "label": 'Remove all Guides', "visible": true }, { "id": 199, "enabled": true, - "label": "New Guides from Selection", + "label": 'New Guides from Selection', "visible": true }, { "id": 200, "enabled": true, - "label": "New Guide...", + "label": 'New Guide...', "visible": true }, { "id": 201, "enabled": true, - "label": "New Guide (by Percent)...", + "label": 'New Guide (by Percent)...', "visible": true } ] }, { "id": 202, - "type": "separator" + "type": 'separator' }, { "id": 203, "enabled": true, - "label": "Align Visible Layers...", + "label": 'Align Visible Layers...', "visible": true }, { "id": 204, "enabled": true, - "label": "Flatten Image", + "label": 'Flatten Image', "visible": true }, { "id": 205, "enabled": true, - "label": "Merge Visible Layers...", - "shortcut": [["Control", "m"]], + "label": 'Merge Visible Layers...', + "shortcut": [['Control', 'm']], "visible": true }, { "id": 206, - "type": "separator" + "type": 'separator' }, { "id": 207, "enabled": true, - "label": "Zealous Crop", + "label": 'Zealous Crop', "visible": true }, { "id": 208, "enabled": true, - "label": "Autocrop Image", + "label": 'Autocrop Image', "visible": true }, { "id": 209, "enabled": false, - "label": "Crop to Selection", + "label": 'Crop to Selection', "visible": true }, { "id": 210, - "type": "separator" + "type": 'separator' }, { "id": 211, "enabled": true, - "label": "Scale Image...", + "label": 'Scale Image...', "visible": true }, { "id": 212, "enabled": true, - "label": "Print Size...", + "label": 'Print Size...', "visible": true }, { "id": 213, "enabled": false, - "label": "Fit Canvas to Selection", + "label": 'Fit Canvas to Selection', "visible": true }, { "id": 214, "enabled": true, - "label": "Fit Canvas to Layers", + "label": 'Fit Canvas to Layers', "visible": true }, { "id": 215, "enabled": true, - "label": "Canvas Size...", + "label": 'Canvas Size...', "visible": true }, { "id": 216, - "type": "separator" + "type": 'separator' }, { "id": 217, - "children-display": "submenu", + "children-display": 'submenu', "enabled": true, - "label": "Transform", + "label": 'Transform', "visible": true, "submenu": [ { "id": 218, "enabled": true, - "label": "Guillotine", + "label": 'Guillotine', "visible": true }, { "id": 219, - "type": "separator" + "type": 'separator' }, { "id": 220, "enabled": true, - "label": "Rotate 180\302\260", + "label": 'Rotate 180?', "visible": true }, { "id": 221, "enabled": true, - "label": "Rotate 90\302\260 counter-clockwise", + "label": 'Rotate 90? counter-clockwise', "visible": true }, { "id": 222, "enabled": true, - "label": "Rotate 90\302\260 clockwise", + "label": 'Rotate 90? clockwise', "visible": true }, { "id": 223, - "type": "separator" + "type": 'separator' }, { "id": 224, "enabled": true, - "label": "Flip Vertically", + "label": 'Flip Vertically', "visible": true }, { "id": 225, "enabled": true, - "label": "Flip Horizontally", + "label": 'Flip Horizontally', "visible": true } ] }, { "id": 226, - "children-display": "submenu", + "children-display": 'submenu', "enabled": true, - "label": "Mode", + "label": 'Mode', "visible": true, "submenu": [ { "id": 227, "enabled": true, - "label": "Convert to Color Profile...", + "label": 'Convert to Color Profile...', "visible": true }, { "id": 228, "enabled": true, - "label": "Assign Color Profile...", + "label": 'Assign Color Profile...', "visible": true }, { "id": 229, - "type": "separator" + "type": 'separator' }, { "id": 230, "enabled": true, - "label": "Indexed...", + "label": 'Indexed...', "toggle-state": 0, - "toggle-type": "checkmark", + "toggle-type": 'checkmark', "visible": true }, { "id": 231, "enabled": true, - "label": "Grayscale", + "label": 'Grayscale', "toggle-state": 0, - "toggle-type": "checkmark", + "toggle-type": 'checkmark', "visible": true }, { "id": 232, "enabled": true, - "label": "RGB", + "label": 'RGB', "toggle-state": 1, - "toggle-type": "checkmark", + "toggle-type": 'checkmark', "visible": true } ] @@ -1514,347 +1514,347 @@ { "id": 233, "enabled": true, - "label": "Duplicate", - "shortcut": [["Control", "d"]], + "label": 'Duplicate', + "shortcut": [['Control', 'd']], "visible": true } ] }, { "id": 234, - "children-display": "submenu", + "children-display": 'submenu', "enabled": true, - "label": "Layer", + "label": 'Layer', "visible": true, "submenu": [ { "id": 235, "enabled": true, - "label": "Autocrop Layer", + "label": 'Autocrop Layer', "visible": true }, { "id": 236, "enabled": false, - "label": "Crop to Selection", + "label": 'Crop to Selection', "visible": true }, { "id": 237, "enabled": true, - "label": "Scale Layer...", + "label": 'Scale Layer...', "visible": true }, { "id": 238, "enabled": true, - "label": "Layer to Image Size", + "label": 'Layer to Image Size', "visible": true }, { "id": 239, "enabled": true, - "label": "Layer Boundary Size...", + "label": 'Layer Boundary Size...', "visible": true }, { "id": 240, - "type": "separator" + "type": 'separator' }, { "id": 241, - "children-display": "submenu", + "children-display": 'submenu', "enabled": true, - "label": "Transform", + "label": 'Transform', "visible": true, "submenu": [ { "id": 242, "enabled": true, - "label": "Offset...", - "shortcut": [["Control", "Shift", "o"]], + "label": 'Offset...', + "shortcut": [['Control', 'Shift', 'o']], "visible": true }, { "id": 243, - "type": "separator" + "type": 'separator' }, { "id": 244, "enabled": true, - "label": "Arbitrary Rotation...", + "label": 'Arbitrary Rotation...', "visible": true }, { "id": 245, "enabled": true, - "label": "Rotate 180\302\260", + "label": 'Rotate 180?', "visible": true }, { "id": 246, "enabled": true, - "label": "Rotate 90\302\260 counter-clockwise", + "label": 'Rotate 90? counter-clockwise', "visible": true }, { "id": 247, "enabled": true, - "label": "Rotate 90\302\260 clockwise", + "label": 'Rotate 90? clockwise', "visible": true }, { "id": 248, - "type": "separator" + "type": 'separator' }, { "id": 249, "enabled": true, - "label": "Flip Vertically", + "label": 'Flip Vertically', "visible": true }, { "id": 250, "enabled": true, - "label": "Flip Horizontally", + "label": 'Flip Horizontally', "visible": true } ] }, { "id": 251, - "children-display": "submenu", + "children-display": 'submenu', "enabled": true, - "label": "Transparency", + "label": 'Transparency', "visible": true, "submenu": [ { "id": 252, "enabled": true, - "label": "Intersect with Selection", + "label": 'Intersect with Selection', "visible": true }, { "id": 253, "enabled": true, - "label": "Subtract from Selection", + "label": 'Subtract from Selection', "visible": true }, { "id": 254, "enabled": true, - "label": "Add to Selection", + "label": 'Add to Selection', "visible": true }, { "id": 255, "enabled": true, - "label": "Alpha to Selection", + "label": 'Alpha to Selection', "visible": true }, { "id": 256, - "type": "separator" + "type": 'separator' }, { "id": 257, "enabled": true, - "label": "Threshold Alpha...", + "label": 'Threshold Alpha...', "visible": true }, { "id": 258, "enabled": true, - "label": "Semi-Flatten", + "label": 'Semi-Flatten', "visible": true }, { "id": 259, "enabled": true, - "label": "Color to Alpha...", + "label": 'Color to Alpha...', "visible": true }, { "id": 260, "enabled": true, - "label": "Remove Alpha Channel", + "label": 'Remove Alpha Channel', "visible": true }, { "id": 261, "enabled": false, - "label": "Add Alpha Channel", + "label": 'Add Alpha Channel', "visible": true } ] }, { "id": 262, - "children-display": "submenu", + "children-display": 'submenu', "enabled": true, - "label": "Mask", + "label": 'Mask', "visible": true, "submenu": [ { "id": 263, "enabled": false, - "label": "Intersect with Selection", + "label": 'Intersect with Selection', "visible": true }, { "id": 264, "enabled": false, - "label": "Subtract from Selection", + "label": 'Subtract from Selection', "visible": true }, { "id": 265, "enabled": false, - "label": "Add to Selection", + "label": 'Add to Selection', "visible": true }, { "id": 266, "enabled": false, - "label": "Mask to Selection", + "label": 'Mask to Selection', "visible": true }, { "id": 267, - "type": "separator" + "type": 'separator' }, { "id": 268, "enabled": false, - "label": "Disable Layer Mask", + "label": 'Disable Layer Mask', "toggle-state": 0, - "toggle-type": "checkmark", + "toggle-type": 'checkmark', "visible": true }, { "id": 269, "enabled": false, - "label": "Edit Layer Mask", + "label": 'Edit Layer Mask', "toggle-state": 0, - "toggle-type": "checkmark", + "toggle-type": 'checkmark', "visible": true }, { "id": 270, "enabled": false, - "label": "Show Layer Mask", + "label": 'Show Layer Mask', "toggle-state": 0, - "toggle-type": "checkmark", + "toggle-type": 'checkmark', "visible": true }, { "id": 271, - "type": "separator" + "type": 'separator' }, { "id": 272, "enabled": false, - "label": "Delete Layer Mask", + "label": 'Delete Layer Mask', "visible": true }, { "id": 273, "enabled": false, - "label": "Apply Layer Mask", + "label": 'Apply Layer Mask', "visible": true }, { "id": 274, "enabled": true, - "label": "Add Layer Mask...", + "label": 'Add Layer Mask...', "visible": true } ] }, { "id": 275, - "children-display": "submenu", + "children-display": 'submenu', "enabled": true, - "label": "Stack", + "label": 'Stack', "visible": true, "submenu": [ { "id": 276, "enabled": true, - "label": "Reverse Layer Order", + "label": 'Reverse Layer Order', "visible": true }, { "id": 277, - "type": "separator" + "type": 'separator' }, { "id": 278, "enabled": false, - "label": "Layer to Bottom", + "label": 'Layer to Bottom', "visible": true }, { "id": 279, "enabled": false, - "label": "Layer to Top", + "label": 'Layer to Top', "visible": true }, { "id": 280, "enabled": false, - "label": "Lower Layer", + "label": 'Lower Layer', "visible": true }, { "id": 281, "enabled": false, - "label": "Raise Layer", + "label": 'Raise Layer', "visible": true }, { "id": 282, - "type": "separator" + "type": 'separator' }, { "id": 283, "enabled": false, - "label": "Select Bottom Layer", - "shortcut": [["End"]], + "label": 'Select Bottom Layer', + "shortcut": [['End']], "visible": true }, { "id": 284, "enabled": false, - "label": "Select Top Layer", - "shortcut": [["Home"]], + "label": 'Select Top Layer', + "shortcut": [['Home']], "visible": true }, { "id": 285, "enabled": false, - "label": "Select Next Layer", - "shortcut": [["Page_Down"]], + "label": 'Select Next Layer', + "shortcut": [['Page_Down']], "visible": true }, { "id": 286, "enabled": false, - "label": "Select Previous Layer", - "shortcut": [["Page_Up"]], + "label": 'Select Previous Layer', + "shortcut": [['Page_Up']], "visible": true } ] }, { "id": 287, - "children-display": "submenu", - "type": "separator", + "children-display": 'submenu', + "type": 'separator', "submenu": [ { "id": 288, "enabled": false, - "label": "Empty", + "label": 'Empty', "visible": true } ] @@ -1862,704 +1862,704 @@ { "id": 289, "enabled": true, - "label": "Delete Layer", + "label": 'Delete Layer', "visible": true }, { "id": 290, "enabled": false, - "label": "Merge Down", + "label": 'Merge Down', "visible": true }, { "id": 291, "enabled": false, - "label": "Anchor Layer", - "shortcut": [["Control", "h"]], + "label": 'Anchor Layer', + "shortcut": [['Control', 'h']], "visible": true }, { "id": 292, "enabled": true, - "label": "Duplicate Layer", - "shortcut": [["Control", "Shift", "d"]], + "label": 'Duplicate Layer', + "shortcut": [['Control', 'Shift', 'd']], "visible": true }, { "id": 293, "enabled": true, - "label": "New from Visible", + "label": 'New from Visible', "visible": true }, { "id": 294, "enabled": true, - "label": "New Layer...", - "shortcut": [["Control", "Shift", "n"]], + "label": 'New Layer...', + "shortcut": [['Control', 'Shift', 'n']], "visible": true } ] }, { "id": 295, - "children-display": "submenu", + "children-display": 'submenu', "enabled": true, - "label": "Colors", + "label": 'Colors', "visible": true, "submenu": [ { "id": 296, "enabled": true, - "label": "Retinex...", + "label": 'Retinex...', "visible": true }, { "id": 297, "enabled": true, - "label": "Maximum RGB...", + "label": 'Maximum RGB...', "visible": true }, { "id": 298, "enabled": false, - "label": "Hot...", + "label": 'Hot...', "visible": true }, { "id": 299, "enabled": true, - "label": "Filter Pack...", + "label": 'Filter Pack...', "visible": true }, { "id": 300, "enabled": true, - "label": "Color to Alpha...", + "label": 'Color to Alpha...', "visible": true }, { "id": 301, "enabled": true, - "label": "Colorify...", + "label": 'Colorify...', "visible": true }, { "id": 302, - "type": "separator" + "type": 'separator' }, { "id": 303, - "children-display": "submenu", + "children-display": 'submenu', "enabled": true, - "label": "Info", + "label": 'Info', "visible": true, "submenu": [ { "id": 304, "enabled": true, - "label": "Smooth Palette...", + "label": 'Smooth Palette...', "visible": true }, { "id": 305, "enabled": true, - "label": "Colorcube Analysis...", + "label": 'Colorcube Analysis...', "visible": true }, { "id": 306, "enabled": true, - "label": "Border Average...", + "label": 'Border Average...', "visible": true }, { "id": 307, "enabled": true, - "label": "Histogram", + "label": 'Histogram', "visible": true } ] }, { "id": 308, - "children-display": "submenu", + "children-display": 'submenu', "enabled": true, - "label": "Map", + "label": 'Map', "visible": true, "submenu": [ { "id": 309, "enabled": true, - "label": "Sample Colorize...", + "label": 'Sample Colorize...', "visible": true }, { "id": 310, "enabled": true, - "label": "Rotate Colors...", + "label": 'Rotate Colors...', "visible": true }, { "id": 311, "enabled": true, - "label": "Palette Map", + "label": 'Palette Map', "visible": true }, { "id": 312, "enabled": true, - "label": "Gradient Map", + "label": 'Gradient Map', "visible": true }, { "id": 313, "enabled": true, - "label": "Color Exchange...", + "label": 'Color Exchange...', "visible": true }, { "id": 314, "enabled": true, - "label": "Alien Map...", + "label": 'Alien Map...', "visible": true }, { "id": 315, - "type": "separator" + "type": 'separator' }, { "id": 316, "enabled": false, - "label": "Set Colormap...", + "label": 'Set Colormap...', "visible": true }, { "id": 317, "enabled": false, - "label": "Rearrange Colormap...", + "label": 'Rearrange Colormap...', "visible": true } ] }, { "id": 318, - "children-display": "submenu", + "children-display": 'submenu', "enabled": true, - "label": "Components", + "label": 'Components', "visible": true, "submenu": [ { "id": 319, "enabled": false, - "label": "Recompose", + "label": 'Recompose', "visible": true }, { "id": 320, "enabled": true, - "label": "Decompose...", + "label": 'Decompose...', "visible": true }, { "id": 321, "enabled": false, - "label": "Compose...", + "label": 'Compose...', "visible": true }, { "id": 322, "enabled": true, - "label": "Channel Mixer...", + "label": 'Channel Mixer...', "visible": true } ] }, { "id": 323, - "children-display": "submenu", + "children-display": 'submenu', "enabled": true, - "label": "Auto", + "label": 'Auto', "visible": true, "submenu": [ { "id": 324, "enabled": true, - "label": "Stretch HSV", + "label": 'Stretch HSV', "visible": true }, { "id": 325, "enabled": true, - "label": "Stretch Contrast", + "label": 'Stretch Contrast', "visible": true }, { "id": 326, "enabled": true, - "label": "Normalize", + "label": 'Normalize', "visible": true }, { "id": 327, "enabled": true, - "label": "Color Enhance", + "label": 'Color Enhance', "visible": true }, { "id": 328, "enabled": true, - "label": "White Balance", + "label": 'White Balance', "visible": true }, { "id": 329, "enabled": true, - "label": "Equalize", + "label": 'Equalize', "visible": true } ] }, { "id": 330, - "type": "separator" + "type": 'separator' }, { "id": 331, "enabled": true, - "label": "Use GEGL", + "label": 'Use GEGL', "toggle-state": 0, - "toggle-type": "checkmark", + "toggle-type": 'checkmark', "visible": true }, { "id": 332, - "type": "separator" + "type": 'separator' }, { "id": 333, "enabled": true, - "label": "Value Invert", + "label": 'Value Invert', "visible": true }, { "id": 334, "enabled": true, - "label": "Invert", + "label": 'Invert', "visible": true }, { "id": 335, - "type": "separator" + "type": 'separator' }, { "id": 336, "enabled": true, - "label": "Desaturate...", + "label": 'Desaturate...', "visible": true }, { "id": 337, "enabled": true, - "label": "Posterize...", + "label": 'Posterize...', "visible": true }, { "id": 338, "enabled": true, - "label": "Curves...", + "label": 'Curves...', "visible": true }, { "id": 339, "enabled": true, - "label": "Levels...", + "label": 'Levels...', "visible": true }, { "id": 340, "enabled": true, - "label": "Threshold...", + "label": 'Threshold...', "visible": true }, { "id": 341, "enabled": true, - "label": "Brightness-Contrast...", + "label": 'Brightness-Contrast...', "visible": true }, { "id": 342, "enabled": true, - "label": "Colorize...", + "label": 'Colorize...', "visible": true }, { "id": 343, "enabled": true, - "label": "Hue-Saturation...", + "label": 'Hue-Saturation...', "visible": true }, { "id": 344, "enabled": true, - "label": "Color Balance...", + "label": 'Color Balance...', "visible": true } ] }, { "id": 345, - "children-display": "submenu", + "children-display": 'submenu', "enabled": true, - "label": "Tools", + "label": 'Tools', "visible": true, "submenu": [ { "id": 346, "enabled": true, - "label": "Swap Colors", - "shortcut": [["x"]], + "label": 'Swap Colors', + "shortcut": [['x']], "visible": true }, { "id": 347, "enabled": true, - "label": "Default Colors", - "shortcut": [["d"]], + "label": 'Default Colors', + "shortcut": [['d']], "visible": true }, { "id": 348, "enabled": true, - "label": "Toolbox", - "shortcut": [["Control", "b"]], + "label": 'Toolbox', + "shortcut": [['Control', 'b']], "visible": true }, { "id": 349, - "type": "separator" + "type": 'separator' }, { "id": 350, "enabled": true, - "label": "GEGL Operation...", + "label": 'GEGL Operation...', "visible": true }, { "id": 351, "enabled": true, - "label": "Text", - "shortcut": [["t"]], + "label": 'Text', + "shortcut": [['t']], "visible": true }, { "id": 352, "enabled": true, - "label": "Measure", - "shortcut": [["Shift", "m"]], + "label": 'Measure', + "shortcut": [['Shift', 'm']], "visible": true }, { "id": 353, "enabled": true, - "label": "Zoom", - "shortcut": [["z"]], + "label": 'Zoom', + "shortcut": [['z']], "visible": true }, { "id": 354, "enabled": true, - "label": "Color Picker", - "shortcut": [["o"]], + "label": 'Color Picker', + "shortcut": [['o']], "visible": true }, { "id": 355, "enabled": true, - "label": "Paths", - "shortcut": [["b"]], + "label": 'Paths', + "shortcut": [['b']], "visible": true }, { "id": 356, - "children-display": "submenu", + "children-display": 'submenu', "enabled": true, - "label": "Color Tools", + "label": 'Color Tools', "visible": true, "submenu": [ { "id": 357, "enabled": true, - "label": "Desaturate...", + "label": 'Desaturate...', "visible": true }, { "id": 358, "enabled": true, - "label": "Posterize...", + "label": 'Posterize...', "visible": true }, { "id": 359, "enabled": true, - "label": "Curves...", + "label": 'Curves...', "visible": true }, { "id": 360, "enabled": true, - "label": "Levels...", + "label": 'Levels...', "visible": true }, { "id": 361, "enabled": true, - "label": "Threshold...", + "label": 'Threshold...', "visible": true }, { "id": 362, "enabled": true, - "label": "Brightness-Contrast...", + "label": 'Brightness-Contrast...', "visible": true }, { "id": 363, "enabled": true, - "label": "Colorize...", + "label": 'Colorize...', "visible": true }, { "id": 364, "enabled": true, - "label": "Hue-Saturation...", + "label": 'Hue-Saturation...', "visible": true }, { "id": 365, "enabled": true, - "label": "Color Balance...", + "label": 'Color Balance...', "visible": true } ] }, { "id": 366, - "children-display": "submenu", + "children-display": 'submenu', "enabled": true, - "label": "Transform Tools", + "label": 'Transform Tools', "visible": true, "submenu": [ { "id": 367, "enabled": true, - "label": "Flip", - "shortcut": [["Shift", "f"]], + "label": 'Flip', + "shortcut": [['Shift', 'f']], "visible": true }, { "id": 368, "enabled": true, - "label": "Perspective", - "shortcut": [["Shift", "p"]], + "label": 'Perspective', + "shortcut": [['Shift', 'p']], "visible": true }, { "id": 369, "enabled": true, - "label": "Shear", - "shortcut": [["Shift", "s"]], + "label": 'Shear', + "shortcut": [['Shift', 's']], "visible": true }, { "id": 370, "enabled": true, - "label": "Scale", - "shortcut": [["Shift", "t"]], + "label": 'Scale', + "shortcut": [['Shift', 't']], "visible": true }, { "id": 371, "enabled": true, - "label": "Rotate", - "shortcut": [["Shift", "r"]], + "label": 'Rotate', + "shortcut": [['Shift', 'r']], "visible": true }, { "id": 372, "enabled": true, - "label": "Crop", - "shortcut": [["Shift", "c"]], + "label": 'Crop', + "shortcut": [['Shift', 'c']], "visible": true }, { "id": 373, "enabled": true, - "label": "Move", - "shortcut": [["m"]], + "label": 'Move', + "shortcut": [['m']], "visible": true }, { "id": 374, "enabled": true, - "label": "Align", - "shortcut": [["q"]], + "label": 'Align', + "shortcut": [['q']], "visible": true } ] }, { "id": 375, - "children-display": "submenu", + "children-display": 'submenu', "enabled": true, - "label": "Paint Tools", + "label": 'Paint Tools', "visible": true, "submenu": [ { "id": 376, "enabled": true, - "label": "Dodge / Burn", - "shortcut": [["Shift", "d"]], + "label": 'Dodge / Burn', + "shortcut": [['Shift', 'd']], "visible": true }, { "id": 377, "enabled": true, - "label": "Smudge", - "shortcut": [["s"]], + "label": 'Smudge', + "shortcut": [['s']], "visible": true }, { "id": 378, "enabled": true, - "label": "Blur / Sharpen", - "shortcut": [["Shift", "u"]], + "label": 'Blur / Sharpen', + "shortcut": [['Shift', 'u']], "visible": true }, { "id": 379, "enabled": true, - "label": "Perspective Clone", + "label": 'Perspective Clone', "visible": true }, { "id": 380, "enabled": true, - "label": "Heal", - "shortcut": [["h"]], + "label": 'Heal', + "shortcut": [['h']], "visible": true }, { "id": 381, "enabled": true, - "label": "Clone", - "shortcut": [["c"]], + "label": 'Clone', + "shortcut": [['c']], "visible": true }, { "id": 382, "enabled": true, - "label": "Ink", - "shortcut": [["k"]], + "label": 'Ink', + "shortcut": [['k']], "visible": true }, { "id": 383, "enabled": true, - "label": "Airbrush", - "shortcut": [["a"]], + "label": 'Airbrush', + "shortcut": [['a']], "visible": true }, { "id": 384, "enabled": true, - "label": "Eraser", - "shortcut": [["Shift", "e"]], + "label": 'Eraser', + "shortcut": [['Shift', 'e']], "visible": true }, { "id": 385, "enabled": true, - "label": "Paintbrush", - "shortcut": [["p"]], + "label": 'Paintbrush', + "shortcut": [['p']], "visible": true }, { "id": 386, "enabled": true, - "label": "Pencil", - "shortcut": [["n"]], + "label": 'Pencil', + "shortcut": [['n']], "visible": true }, { "id": 387, "enabled": true, - "label": "Blend", - "shortcut": [["l"]], + "label": 'Blend', + "shortcut": [['l']], "visible": true }, { "id": 388, "enabled": true, - "label": "Bucket Fill", - "shortcut": [["Shift", "b"]], + "label": 'Bucket Fill', + "shortcut": [['Shift', 'b']], "visible": true } ] }, { "id": 389, - "children-display": "submenu", + "children-display": 'submenu', "enabled": true, - "label": "Selection Tools", + "label": 'Selection Tools', "visible": true, "submenu": [ { "id": 390, "enabled": true, - "label": "Intelligent Scissors", - "shortcut": [["i"]], + "label": 'Intelligent Scissors', + "shortcut": [['i']], "visible": true }, { "id": 391, "enabled": true, - "label": "By Color Select", - "shortcut": [["Shift", "o"]], + "label": 'By Color Select', + "shortcut": [['Shift', 'o']], "visible": true }, { "id": 392, "enabled": true, - "label": "Fuzzy Select", - "shortcut": [["u"]], + "label": 'Fuzzy Select', + "shortcut": [['u']], "visible": true }, { "id": 393, "enabled": true, - "label": "Foreground Select", + "label": 'Foreground Select', "visible": true }, { "id": 394, "enabled": true, - "label": "Free Select", - "shortcut": [["f"]], + "label": 'Free Select', + "shortcut": [['f']], "visible": true }, { "id": 395, "enabled": true, - "label": "Ellipse Select", - "shortcut": [["e"]], + "label": 'Ellipse Select', + "shortcut": [['e']], "visible": true }, { "id": 396, "enabled": true, - "label": "Rectangle Select", - "shortcut": [["r"]], + "label": 'Rectangle Select', + "shortcut": [['r']], "visible": true } ] @@ -2568,438 +2568,438 @@ }, { "id": 397, - "children-display": "submenu", + "children-display": 'submenu', "enabled": true, - "label": "Filters", + "label": 'Filters', "visible": true, "submenu": [ { "id": 398, - "children-display": "submenu", + "children-display": 'submenu', "enabled": true, - "label": "Script-Fu", + "label": 'Script-Fu', "visible": true, "submenu": [ { "id": 399, "enabled": true, - "label": "Start Server...", + "label": 'Start Server...', "visible": true }, { "id": 400, "enabled": true, - "label": "Refresh Scripts", + "label": 'Refresh Scripts', "visible": true }, { "id": 401, "enabled": true, - "label": "Console", + "label": 'Console', "visible": true } ] }, { "id": 402, - "children-display": "submenu", + "children-display": 'submenu', "enabled": true, - "label": "Python-Fu", + "label": 'Python-Fu', "visible": true, "submenu": [ { "id": 403, "enabled": true, - "label": "Console", + "label": 'Console', "visible": true } ] }, { "id": 404, - "type": "separator" + "type": 'separator' }, { "id": 405, - "children-display": "submenu", + "children-display": 'submenu', "enabled": true, - "label": "Alpha to Logo", + "label": 'Alpha to Logo', "visible": true, "submenu": [ { "id": 406, "enabled": true, - "label": "Textured...", + "label": 'Textured...', "visible": true }, { "id": 407, "enabled": true, - "label": "Particle Trace...", + "label": 'Particle Trace...', "visible": true }, { "id": 408, "enabled": true, - "label": "Neon...", + "label": 'Neon...', "visible": true }, { "id": 409, "enabled": true, - "label": "Gradient Bevel...", + "label": 'Gradient Bevel...', "visible": true }, { "id": 410, "enabled": true, - "label": "Glowing Hot...", + "label": 'Glowing Hot...', "visible": true }, { "id": 411, "enabled": true, - "label": "Glossy...", + "label": 'Glossy...', "visible": true }, { "id": 412, "enabled": true, - "label": "Frosty...", + "label": 'Frosty...', "visible": true }, { "id": 413, "enabled": true, - "label": "Cool Metal...", + "label": 'Cool Metal...', "visible": true }, { "id": 414, "enabled": true, - "label": "Comic Book...", + "label": 'Comic Book...', "visible": true }, { "id": 415, "enabled": true, - "label": "Chrome...", + "label": 'Chrome...', "visible": true }, { "id": 416, "enabled": true, - "label": "Chip Away...", + "label": 'Chip Away...', "visible": true }, { "id": 417, "enabled": true, - "label": "Chalk...", + "label": 'Chalk...', "visible": true }, { "id": 418, "enabled": true, - "label": "Bovination...", + "label": 'Bovination...', "visible": true }, { "id": 419, "enabled": true, - "label": "Blended...", + "label": 'Blended...', "visible": true }, { "id": 420, "enabled": true, - "label": "Basic I...", + "label": 'Basic I...', "visible": true }, { "id": 421, "enabled": true, - "label": "Basic II...", + "label": 'Basic II...', "visible": true }, { "id": 422, "enabled": true, - "label": "Alien Neon...", + "label": 'Alien Neon...', "visible": true }, { "id": 423, "enabled": true, - "label": "Alien Glow...", + "label": 'Alien Glow...', "visible": true }, { "id": 424, "enabled": true, - "label": "3D Outline...", + "label": '3D Outline...', "visible": true } ] }, { "id": 425, - "type": "separator" + "type": 'separator' }, { "id": 426, - "children-display": "submenu", + "children-display": 'submenu', "enabled": true, - "label": "Animation", + "label": 'Animation', "visible": true, "submenu": [ { "id": 427, "enabled": true, - "label": "Unoptimize", + "label": 'Unoptimize', "visible": true }, { "id": 428, "enabled": true, - "label": "Playback...", + "label": 'Playback...', "visible": true }, { "id": 429, "enabled": true, - "label": "Optimize (for GIF)", + "label": 'Optimize (for GIF)', "visible": true }, { "id": 430, "enabled": true, - "label": "Optimize (Difference)", + "label": 'Optimize (Difference)', "visible": true }, { "id": 431, - "type": "separator" + "type": 'separator' }, { "id": 432, "enabled": true, - "label": "Waves...", + "label": 'Waves...', "visible": true }, { "id": 433, "enabled": true, - "label": "Spinning Globe...", + "label": 'Spinning Globe...', "visible": true }, { "id": 434, "enabled": true, - "label": "Rippling...", + "label": 'Rippling...', "visible": true }, { "id": 435, "enabled": true, - "label": "Burn-In...", + "label": 'Burn-In...', "visible": true }, { "id": 436, "enabled": true, - "label": "Blend...", + "label": 'Blend...', "visible": true } ] }, { "id": 437, - "children-display": "submenu", + "children-display": 'submenu', "enabled": true, - "label": "Web", + "label": 'Web', "visible": true, "submenu": [ { "id": 438, "enabled": true, - "label": "Slice...", + "label": 'Slice...', "visible": true }, { "id": 439, "enabled": true, - "label": "Semi-Flatten", + "label": 'Semi-Flatten', "visible": true }, { "id": 440, "enabled": true, - "label": "Image Map...", + "label": 'Image Map...', "visible": true } ] }, { "id": 441, - "children-display": "submenu", + "children-display": 'submenu', "enabled": true, - "label": "Render", + "label": 'Render', "visible": true, "submenu": [ { "id": 442, "enabled": true, - "label": "Spyrogimp...", + "label": 'Spyrogimp...', "visible": true }, { "id": 443, "enabled": true, - "label": "Sphere Designer...", + "label": 'Sphere Designer...', "visible": true }, { "id": 444, "enabled": true, - "label": "Line Nova...", + "label": 'Line Nova...', "visible": true }, { "id": 445, "enabled": true, - "label": "Lava...", + "label": 'Lava...', "visible": true }, { "id": 446, "enabled": true, - "label": "Gfig...", + "label": 'Gfig...', "visible": true }, { "id": 447, "enabled": true, - "label": "Fractal Explorer...", + "label": 'Fractal Explorer...', "visible": true }, { "id": 448, "enabled": true, - "label": "Circuit...", + "label": 'Circuit...', "visible": true }, { "id": 449, - "type": "separator" + "type": 'separator' }, { "id": 450, - "children-display": "submenu", + "children-display": 'submenu', "enabled": true, - "label": "Pattern", + "label": 'Pattern', "visible": true, "submenu": [ { "id": 451, "enabled": true, - "label": "Sinus...", + "label": 'Sinus...', "visible": true }, { "id": 452, "enabled": true, - "label": "Qbist...", + "label": 'Qbist...', "visible": true }, { "id": 453, "enabled": true, - "label": "Maze...", + "label": 'Maze...', "visible": true }, { "id": 454, "enabled": true, - "label": "Jigsaw...", + "label": 'Jigsaw...', "visible": true }, { "id": 455, "enabled": true, - "label": "Grid...", + "label": 'Grid...', "visible": true }, { "id": 456, "enabled": true, - "label": "Diffraction Patterns...", + "label": 'Diffraction Patterns...', "visible": true }, { "id": 457, "enabled": true, - "label": "CML Explorer...", + "label": 'CML Explorer...', "visible": true }, { "id": 458, "enabled": true, - "label": "Checkerboard...", + "label": 'Checkerboard...', "visible": true } ] }, { "id": 459, - "children-display": "submenu", + "children-display": 'submenu', "enabled": true, - "label": "Nature", + "label": 'Nature', "visible": true, "submenu": [ { "id": 460, "enabled": true, - "label": "IFS Fractal...", + "label": 'IFS Fractal...', "visible": true }, { "id": 461, "enabled": true, - "label": "Flame...", + "label": 'Flame...', "visible": true } ] }, { "id": 462, - "children-display": "submenu", + "children-display": 'submenu', "enabled": true, - "label": "Clouds", + "label": 'Clouds', "visible": true, "submenu": [ { "id": 463, "enabled": true, - "label": "Solid Noise...", + "label": 'Solid Noise...', "visible": true }, { "id": 464, "enabled": true, - "label": "Plasma...", + "label": 'Plasma...', "visible": true }, { "id": 465, "enabled": true, - "label": "Fog...", + "label": 'Fog...', "visible": true }, { "id": 466, "enabled": true, - "label": "Difference Clouds...", + "label": 'Difference Clouds...', "visible": true } ] @@ -3008,661 +3008,661 @@ }, { "id": 467, - "children-display": "submenu", + "children-display": 'submenu', "enabled": true, - "label": "Map", + "label": 'Map', "visible": true, "submenu": [ { "id": 468, "enabled": true, - "label": "Warp...", + "label": 'Warp...', "visible": true }, { "id": 469, "enabled": true, - "label": "Tile...", + "label": 'Tile...', "visible": true }, { "id": 470, "enabled": true, - "label": "Small Tiles...", + "label": 'Small Tiles...', "visible": true }, { "id": 471, "enabled": true, - "label": "Paper Tile...", + "label": 'Paper Tile...', "visible": true }, { "id": 472, "enabled": true, - "label": "Map Object...", + "label": 'Map Object...', "visible": true }, { "id": 473, "enabled": true, - "label": "Make Seamless", + "label": 'Make Seamless', "visible": true }, { "id": 474, "enabled": true, - "label": "Illusion...", + "label": 'Illusion...', "visible": true }, { "id": 475, "enabled": true, - "label": "Fractal Trace...", + "label": 'Fractal Trace...', "visible": true }, { "id": 476, "enabled": true, - "label": "Displace...", + "label": 'Displace...', "visible": true }, { "id": 477, "enabled": true, - "label": "Bump Map...", + "label": 'Bump Map...', "visible": true } ] }, { "id": 478, - "children-display": "submenu", + "children-display": 'submenu', "enabled": true, - "label": "Decor", + "label": 'Decor', "visible": true, "submenu": [ { "id": 479, "enabled": false, - "label": "Stencil Chrome...", + "label": 'Stencil Chrome...', "visible": true }, { "id": 480, "enabled": false, - "label": "Stencil Carve...", + "label": 'Stencil Carve...', "visible": true }, { "id": 481, "enabled": false, - "label": "Slide...", + "label": 'Slide...', "visible": true }, { "id": 482, "enabled": false, - "label": "Round Corners...", + "label": 'Round Corners...', "visible": true }, { "id": 483, "enabled": true, - "label": "Old Photo...", + "label": 'Old Photo...', "visible": true }, { "id": 484, "enabled": true, - "label": "Fuzzy Border...", + "label": 'Fuzzy Border...', "visible": true }, { "id": 485, "enabled": true, - "label": "Coffee Stain...", + "label": 'Coffee Stain...', "visible": true }, { "id": 486, "enabled": true, - "label": "Add Border...", + "label": 'Add Border...', "visible": true }, { "id": 487, "enabled": true, - "label": "Add Bevel...", + "label": 'Add Bevel...', "visible": true } ] }, { "id": 488, - "children-display": "submenu", + "children-display": 'submenu', "enabled": true, - "label": "Artistic", + "label": 'Artistic', "visible": true, "submenu": [ { "id": 489, "enabled": true, - "label": "Weave...", + "label": 'Weave...', "visible": true }, { "id": 490, "enabled": true, - "label": "Van Gogh (LIC)...", + "label": 'Van Gogh (LIC)...', "visible": true }, { "id": 491, "enabled": true, - "label": "Softglow...", + "label": 'Softglow...', "visible": true }, { "id": 492, "enabled": true, - "label": "Predator...", + "label": 'Predator...', "visible": true }, { "id": 493, "enabled": true, - "label": "Photocopy...", + "label": 'Photocopy...', "visible": true }, { "id": 494, "enabled": true, - "label": "Oilify...", + "label": 'Oilify...', "visible": true }, { "id": 495, "enabled": true, - "label": "GIMPressionist...", + "label": 'GIMPressionist...', "visible": true }, { "id": 496, "enabled": true, - "label": "Cubism...", + "label": 'Cubism...', "visible": true }, { "id": 497, "enabled": true, - "label": "Clothify...", + "label": 'Clothify...', "visible": true }, { "id": 498, "enabled": true, - "label": "Cartoon...", + "label": 'Cartoon...', "visible": true }, { "id": 499, "enabled": true, - "label": "Apply Canvas...", + "label": 'Apply Canvas...', "visible": true } ] }, { "id": 500, - "children-display": "submenu", + "children-display": 'submenu', "enabled": true, - "label": "Combine", + "label": 'Combine', "visible": true, "submenu": [ { "id": 501, "enabled": true, - "label": "Filmstrip...", + "label": 'Filmstrip...', "visible": true }, { "id": 502, "enabled": true, - "label": "Depth Merge...", + "label": 'Depth Merge...', "visible": true } ] }, { "id": 503, - "children-display": "submenu", + "children-display": 'submenu', "enabled": true, - "label": "Generic", + "label": 'Generic', "visible": true, "submenu": [ { "id": 504, "enabled": true, - "label": "Erode", + "label": 'Erode', "visible": true }, { "id": 505, "enabled": true, - "label": "Dilate", + "label": 'Dilate', "visible": true }, { "id": 506, "enabled": true, - "label": "Convolution Matrix...", + "label": 'Convolution Matrix...', "visible": true } ] }, { "id": 507, - "children-display": "submenu", + "children-display": 'submenu', "enabled": true, - "label": "Edge-Detect", + "label": 'Edge-Detect', "visible": true, "submenu": [ { "id": 508, "enabled": true, - "label": "Sobel...", + "label": 'Sobel...', "visible": true }, { "id": 509, "enabled": true, - "label": "Neon...", + "label": 'Neon...', "visible": true }, { "id": 510, "enabled": true, - "label": "Laplace", + "label": 'Laplace', "visible": true }, { "id": 511, "enabled": true, - "label": "Edge...", + "label": 'Edge...', "visible": true }, { "id": 512, "enabled": true, - "label": "Difference of Gaussians...", + "label": 'Difference of Gaussians...', "visible": true } ] }, { "id": 513, - "children-display": "submenu", + "children-display": 'submenu', "enabled": true, - "label": "Noise", + "label": 'Noise', "visible": true, "submenu": [ { "id": 514, "enabled": true, - "label": "Spread...", + "label": 'Spread...', "visible": true }, { "id": 515, "enabled": true, - "label": "Slur...", + "label": 'Slur...', "visible": true }, { "id": 516, "enabled": true, - "label": "RGB Noise...", + "label": 'RGB Noise...', "visible": true }, { "id": 517, "enabled": true, - "label": "Pick...", + "label": 'Pick...', "visible": true }, { "id": 518, "enabled": true, - "label": "Hurl...", + "label": 'Hurl...', "visible": true }, { "id": 519, "enabled": true, - "label": "HSV Noise...", + "label": 'HSV Noise...', "visible": true } ] }, { "id": 520, - "children-display": "submenu", + "children-display": 'submenu', "enabled": true, - "label": "Light and Shadow", + "label": 'Light and Shadow', "visible": true, "submenu": [ { "id": 521, "enabled": true, - "label": "Glass Tile...", + "label": 'Glass Tile...', "visible": true }, { "id": 522, "enabled": true, - "label": "Apply Lens...", + "label": 'Apply Lens...', "visible": true }, { "id": 523, - "type": "separator" + "type": 'separator' }, { "id": 524, "enabled": true, - "label": "Xach-Effect...", + "label": 'Xach-Effect...', "visible": true }, { "id": 525, "enabled": true, - "label": "Perspective...", + "label": 'Perspective...', "visible": true }, { "id": 526, "enabled": true, - "label": "Drop Shadow...", + "label": 'Drop Shadow...', "visible": true }, { "id": 527, - "type": "separator" + "type": 'separator' }, { "id": 528, "enabled": true, - "label": "Supernova...", + "label": 'Supernova...', "visible": true }, { "id": 529, "enabled": true, - "label": "Sparkle...", + "label": 'Sparkle...', "visible": true }, { "id": 530, "enabled": true, - "label": "Lighting Effects...", + "label": 'Lighting Effects...', "visible": true }, { "id": 531, "enabled": true, - "label": "Lens Flare...", + "label": 'Lens Flare...', "visible": true }, { "id": 532, "enabled": true, - "label": "Gradient Flare...", + "label": 'Gradient Flare...', "visible": true } ] }, { "id": 533, - "children-display": "submenu", + "children-display": 'submenu', "enabled": true, - "label": "Distorts", + "label": 'Distorts', "visible": true, "submenu": [ { "id": 534, "enabled": true, - "label": "Wind...", + "label": 'Wind...', "visible": true }, { "id": 535, "enabled": true, - "label": "Whirl and Pinch...", + "label": 'Whirl and Pinch...', "visible": true }, { "id": 536, "enabled": true, - "label": "Waves...", + "label": 'Waves...', "visible": true }, { "id": 537, "enabled": true, - "label": "Video...", + "label": 'Video...', "visible": true }, { "id": 538, "enabled": true, - "label": "Value Propagate...", + "label": 'Value Propagate...', "visible": true }, { "id": 539, "enabled": true, - "label": "Shift...", + "label": 'Shift...', "visible": true }, { "id": 540, "enabled": true, - "label": "Ripple...", + "label": 'Ripple...', "visible": true }, { "id": 541, "enabled": true, - "label": "Polar Coordinates...", + "label": 'Polar Coordinates...', "visible": true }, { "id": 542, "enabled": true, - "label": "Pagecurl...", + "label": 'Pagecurl...', "visible": true }, { "id": 543, "enabled": true, - "label": "Newsprint...", + "label": 'Newsprint...', "visible": true }, { "id": 544, "enabled": true, - "label": "Mosaic...", + "label": 'Mosaic...', "visible": true }, { "id": 545, "enabled": true, - "label": "Lens Distortion...", + "label": 'Lens Distortion...', "visible": true }, { "id": 546, "enabled": true, - "label": "IWarp...", + "label": 'IWarp...', "visible": true }, { "id": 547, "enabled": true, - "label": "Erase Every Other Row...", + "label": 'Erase Every Other Row...', "visible": true }, { "id": 548, "enabled": true, - "label": "Engrave...", + "label": 'Engrave...', "visible": true }, { "id": 549, "enabled": true, - "label": "Emboss...", + "label": 'Emboss...', "visible": true }, { "id": 550, "enabled": true, - "label": "Curve Bend...", + "label": 'Curve Bend...', "visible": true }, { "id": 551, "enabled": true, - "label": "Blinds...", + "label": 'Blinds...', "visible": true } ] }, { "id": 552, - "children-display": "submenu", + "children-display": 'submenu', "enabled": true, - "label": "Enhance", + "label": 'Enhance', "visible": true, "submenu": [ { "id": 553, "enabled": true, - "label": "Unsharp Mask...", + "label": 'Unsharp Mask...', "visible": true }, { "id": 554, "enabled": true, - "label": "Sharpen...", + "label": 'Sharpen...', "visible": true }, { "id": 555, "enabled": true, - "label": "Red Eye Removal...", + "label": 'Red Eye Removal...', "visible": true }, { "id": 556, "enabled": false, - "label": "NL Filter...", + "label": 'NL Filter...', "visible": true }, { "id": 557, "enabled": true, - "label": "Destripe...", + "label": 'Destripe...', "visible": true }, { "id": 558, "enabled": true, - "label": "Despeckle...", + "label": 'Despeckle...', "visible": true }, { "id": 559, "enabled": true, - "label": "Deinterlace...", + "label": 'Deinterlace...', "visible": true }, { "id": 560, "enabled": true, - "label": "Antialias", + "label": 'Antialias', "visible": true } ] }, { "id": 561, - "children-display": "submenu", + "children-display": 'submenu', "enabled": true, - "label": "Blur", + "label": 'Blur', "visible": true, "submenu": [ { "id": 562, "enabled": true, - "label": "Tileable Blur...", + "label": 'Tileable Blur...', "visible": true }, { "id": 563, "enabled": true, - "label": "Selective Gaussian Blur...", + "label": 'Selective Gaussian Blur...', "visible": true }, { "id": 564, "enabled": true, - "label": "Pixelize...", + "label": 'Pixelize...', "visible": true }, { "id": 565, "enabled": true, - "label": "Motion Blur...", + "label": 'Motion Blur...', "visible": true }, { "id": 566, "enabled": true, - "label": "Gaussian Blur...", + "label": 'Gaussian Blur...', "visible": true }, { "id": 567, "enabled": true, - "label": "Blur", + "label": 'Blur', "visible": true } ] }, { "id": 568, - "type": "separator" + "type": 'separator' }, { "id": 569, "enabled": true, - "label": "Reset all Filters", + "label": 'Reset all Filters', "visible": true }, { "id": 570, - "children-display": "submenu", + "children-display": 'submenu', "enabled": false, - "label": "Re-Show Last", - "shortcut": [["Control", "Shift", "f"]], + "label": 'Re-Show Last', + "shortcut": [['Control', 'Shift', 'f']], "visible": true, "submenu": [ { "id": 571, "enabled": false, - "label": "Empty", + "label": 'Empty', "visible": true } ] @@ -3670,210 +3670,210 @@ { "id": 572, "enabled": false, - "label": "Repeat Last", - "shortcut": [["Control", "f"]], + "label": 'Repeat Last', + "shortcut": [['Control', 'f']], "visible": true } ] }, { "id": 573, - "children-display": "submenu", + "children-display": 'submenu', "enabled": true, - "label": "Windows", + "label": 'Windows', "visible": true, "submenu": [ { "id": 574, "enabled": true, - "label": "Toolbox", - "shortcut": [["Control", "b"]], + "label": 'Toolbox', + "shortcut": [['Control', 'b']], "visible": true }, { "id": 575, - "type": "separator" + "type": 'separator' }, { "id": 576, - "children-display": "submenu", + "children-display": 'submenu', "enabled": true, - "label": "Dockable Dialogs", + "label": 'Dockable Dialogs', "visible": true, "submenu": [ { "id": 577, "enabled": true, - "label": "Error Console", + "label": 'Error Console', "visible": true }, { "id": 578, "enabled": true, - "label": "Tools", + "label": 'Tools', "visible": true }, { "id": 579, "enabled": true, - "label": "Templates", + "label": 'Templates', "visible": true }, { "id": 580, "enabled": true, - "label": "Document History", + "label": 'Document History', "visible": true }, { "id": 581, "enabled": true, - "label": "Images", + "label": 'Images', "visible": true }, { "id": 582, - "type": "separator" + "type": 'separator' }, { "id": 583, "enabled": true, - "label": "Buffers", + "label": 'Buffers', "visible": true }, { "id": 584, "enabled": true, - "label": "Fonts", + "label": 'Fonts', "visible": true }, { "id": 585, "enabled": true, - "label": "Palettes", + "label": 'Palettes', "visible": true }, { "id": 586, "enabled": true, - "label": "Gradients", - "shortcut": [["Control", "g"]], + "label": 'Gradients', + "shortcut": [['Control', 'g']], "visible": true }, { "id": 587, "enabled": true, - "label": "Patterns", - "shortcut": [["Control", "Shift", "p"]], + "label": 'Patterns', + "shortcut": [['Control', 'Shift', 'p']], "visible": true }, { "id": 588, "enabled": true, - "label": "Brushes", - "shortcut": [["Control", "Shift", "b"]], + "label": 'Brushes', + "shortcut": [['Control', 'Shift', 'b']], "visible": true }, { "id": 589, "enabled": true, - "label": "Colors", + "label": 'Colors', "visible": true }, { "id": 590, - "type": "separator" + "type": 'separator' }, { "id": 591, "enabled": true, - "label": "Sample Points", + "label": 'Sample Points', "visible": true }, { "id": 592, "enabled": true, - "label": "Pointer", + "label": 'Pointer', "visible": true }, { "id": 593, "enabled": true, - "label": "Undo History", + "label": 'Undo History', "visible": true }, { "id": 594, "enabled": true, - "label": "Navigation", + "label": 'Navigation', "visible": true }, { "id": 595, "enabled": true, - "label": "Selection Editor", + "label": 'Selection Editor', "visible": true }, { "id": 596, "enabled": true, - "label": "Histogram", + "label": 'Histogram', "visible": true }, { "id": 597, "enabled": true, - "label": "Colormap", + "label": 'Colormap', "visible": true }, { "id": 598, "enabled": true, - "label": "Paths", + "label": 'Paths', "visible": true }, { "id": 599, "enabled": true, - "label": "Channels", + "label": 'Channels', "visible": true }, { "id": 600, "enabled": true, - "label": "Layers", - "shortcut": [["Control", "l"]], + "label": 'Layers', + "shortcut": [['Control', 'l']], "visible": true }, { "id": 601, - "type": "separator" + "type": 'separator' }, { "id": 602, "enabled": true, - "label": "Device Status", + "label": 'Device Status', "visible": true }, { "id": 603, "enabled": true, - "label": "Tool Options", + "label": 'Tool Options', "visible": true } ] }, { "id": 604, - "children-display": "submenu", + "children-display": 'submenu', "enabled": true, - "label": "Recently Closed Docks", + "label": 'Recently Closed Docks', "visible": true, "submenu": [ { "id": 605, "enabled": false, - "label": "Empty", + "label": 'Empty', "visible": true } ] @@ -3882,139 +3882,139 @@ }, { "id": 606, - "children-display": "submenu", + "children-display": 'submenu', "enabled": true, - "label": "Help", + "label": 'Help', "visible": true, "submenu": [ { "id": 607, - "children-display": "submenu", + "children-display": 'submenu', "enabled": true, - "label": "User Manual", + "label": 'User Manual', "visible": true, "submenu": [ { "id": 608, "enabled": true, - "label": "Working with Digital Camera Photos", + "label": 'Working with Digital Camera Photos', "visible": true }, { "id": 609, "enabled": true, - "label": "Using Paths", + "label": 'Using Paths', "visible": true }, { "id": 610, "enabled": true, - "label": "Preparing your Images for the Web", + "label": 'Preparing your Images for the Web', "visible": true }, { "id": 611, "enabled": true, - "label": "How to Use Dialogs", + "label": 'How to Use Dialogs', "visible": true }, { "id": 612, "enabled": true, - "label": "Drawing Simple Objects", + "label": 'Drawing Simple Objects', "visible": true }, { "id": 613, "enabled": true, - "label": "Create, Open and Save Files", + "label": 'Create, Open and Save Files', "visible": true }, { "id": 614, "enabled": true, - "label": "Basic Concepts", + "label": 'Basic Concepts', "visible": true } ] }, { "id": 615, - "children-display": "submenu", + "children-display": 'submenu', "enabled": true, - "label": "GIMP Online", + "label": 'GIMP Online', "visible": true, "submenu": [ { "id": 616, "enabled": true, - "label": "User Manual Web Site", + "label": 'User Manual Web Site', "visible": true }, { "id": 617, "enabled": true, - "label": "Plug-in Registry", + "label": 'Plug-in Registry', "visible": true }, { "id": 618, "enabled": true, - "label": "Main Web Site", + "label": 'Main Web Site', "visible": true }, { "id": 619, "enabled": true, - "label": "Developer Web Site", + "label": 'Developer Web Site', "visible": true } ] }, { "id": 620, - "type": "separator" + "type": 'separator' }, { "id": 621, "enabled": true, - "label": "Procedure Browser", + "label": 'Procedure Browser', "visible": true }, { "id": 622, "enabled": true, - "label": "Plug-In Browser", + "label": 'Plug-In Browser', "visible": true }, { "id": 623, - "type": "separator" + "type": 'separator' }, { "id": 624, "enabled": true, - "label": "About", + "label": 'About', "visible": true }, { "id": 625, "enabled": true, - "label": "Tip of the Day", + "label": 'Tip of the Day', "visible": true }, { "id": 626, "enabled": true, - "label": "Context Help", - "shortcut": [["Shift", "F1"]], + "label": 'Context Help', + "shortcut": [['Shift', 'F1']], "visible": true }, { "id": 627, "enabled": true, - "label": "Help", - "shortcut": [["F1"]], + "label": 'Help', + "shortcut": [['F1']], "visible": true } ] -- cgit v1.2.3 From c0423dad5e66f491a7da1f19d472100af5e1afe7 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 1 Dec 2010 15:51:34 -0600 Subject: Switching API over to 0.4 --- libdbusmenu-glib/Makefile.am | 24 ++++++++++++------------ libdbusmenu-glib/dbusmenu-glib.pc.in | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/libdbusmenu-glib/Makefile.am b/libdbusmenu-glib/Makefile.am index db4ed4b..6db7e5d 100644 --- a/libdbusmenu-glib/Makefile.am +++ b/libdbusmenu-glib/Makefile.am @@ -12,7 +12,7 @@ EXTRA_DIST = \ lib_LTLIBRARIES = \ libdbusmenu-glib.la -libdbusmenu_glibincludedir=$(includedir)/libdbusmenu-0.1/libdbusmenu-glib/ +libdbusmenu_glibincludedir=$(includedir)/libdbusmenu-0.4/libdbusmenu-glib/ libdbusmenu_glibinclude_HEADERS = \ menuitem.h \ @@ -125,16 +125,16 @@ if HAVE_INTROSPECTION introspection_sources = $(libdbusmenu_glibinclude_HEADERS) -Dbusmenu_Glib-0.2.gir: libdbusmenu-glib.la -Dbusmenu_Glib_0_2_gir_INCLUDES = \ +Dbusmenu_Glib-0.4.gir: libdbusmenu-glib.la +Dbusmenu_Glib_0_4_gir_INCLUDES = \ GObject-2.0 -Dbusmenu_Glib_0_2_gir_CFLAGS = $(DBUSMENUGLIB_CFLAGS) -Dbusmenu_Glib_0_2_gir_LIBS = libdbusmenu-glib.la -Dbusmenu_Glib_0_2_gir_FILES = $(addprefix $(srcdir)/, $(introspection_sources)) -Dbusmenu_Glib_0_2_gir_NAMESPACE = Dbusmenu -Dbusmenu_Glib_0_2_gir_VERSION = Glib-0.2 +Dbusmenu_Glib_0_4_gir_CFLAGS = $(DBUSMENUGLIB_CFLAGS) +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 +Dbusmenu_Glib_0_4_gir_VERSION = Glib-0.2 -INTROSPECTION_GIRS += Dbusmenu-Glib-0.2.gir +INTROSPECTION_GIRS += Dbusmenu-Glib-0.4.gir girdir = $(datadir)/gir-1.0 gir_DATA = $(INTROSPECTION_GIRS) @@ -153,10 +153,10 @@ endif if HAVE_INTROSPECTION vapidir = $(datadir)/vala/vapi -vapi_DATA = Dbusmenu-Glib-0.2.vapi +vapi_DATA = Dbusmenu-Glib-0.4.vapi -Dbusmenu-Glib-0.2.vapi: Dbusmenu-Glib-0.2.gir - $(VALA_API_GEN) --library=Dbusmenu-Glib-0.2 $< +Dbusmenu-Glib-0.4.vapi: Dbusmenu-Glib-0.4.gir + $(VALA_API_GEN) --library=Dbusmenu-Glib-0.4 $< CLEANFILES += $(vapi_DATA) diff --git a/libdbusmenu-glib/dbusmenu-glib.pc.in b/libdbusmenu-glib/dbusmenu-glib.pc.in index dacd903..3f31664 100644 --- a/libdbusmenu-glib/dbusmenu-glib.pc.in +++ b/libdbusmenu-glib/dbusmenu-glib.pc.in @@ -4,7 +4,7 @@ libdir=@libdir@ bindir=@bindir@ includedir=@includedir@ -Cflags: -I${includedir}/libdbusmenu-0.1 +Cflags: -I${includedir}/libdbusmenu-0.4 Requires: dbus-glib-1 Libs: -L${libdir} -ldbusmenu-glib -- cgit v1.2.3 From 0ac0a85f42be1aa1c93cfc42a0b4d455f594ba2c Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 1 Dec 2010 15:53:09 -0600 Subject: Changing API to 0.4 --- libdbusmenu-gtk/Makefile.am | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/libdbusmenu-gtk/Makefile.am b/libdbusmenu-gtk/Makefile.am index 2be63b7..3a65b03 100644 --- a/libdbusmenu-gtk/Makefile.am +++ b/libdbusmenu-gtk/Makefile.am @@ -7,7 +7,7 @@ EXTRA_DIST = \ lib_LTLIBRARIES = \ libdbusmenu-gtk.la -libdbusmenu_gtkincludedir=$(includedir)/libdbusmenu-0.1/libdbusmenu-gtk/ +libdbusmenu_gtkincludedir=$(includedir)/libdbusmenu-0.4/libdbusmenu-gtk/ libdbusmenu_gtkinclude_HEADERS = \ client.h \ @@ -55,16 +55,16 @@ if HAVE_INTROSPECTION introspection_sources = $(libdbusmenu_gtkinclude_HEADERS) -DbusmenuGtk-0.2.gir: libdbusmenu-gtk.la -DbusmenuGtk_0_2_gir_INCLUDES = \ +DbusmenuGtk-0.4.gir: libdbusmenu-gtk.la +DbusmenuGtk_0_4_gir_INCLUDES = \ GObject-2.0 \ Gtk-2.0 \ - Dbusmenu-Glib-0.2 -DbusmenuGtk_0_2_gir_CFLAGS = $(DBUSMENUGTK_CFLAGS) -I$(top_srcdir) -DbusmenuGtk_0_2_gir_LIBS = libdbusmenu-gtk.la -DbusmenuGtk_0_2_gir_FILES = $(addprefix $(srcdir)/, $(introspection_sources)) + Dbusmenu-Glib-0.4 +DbusmenuGtk_0_4_gir_CFLAGS = $(DBUSMENUGTK_CFLAGS) -I$(top_srcdir) +DbusmenuGtk_0_4_gir_LIBS = libdbusmenu-gtk.la +DbusmenuGtk_0_4_gir_FILES = $(addprefix $(srcdir)/, $(introspection_sources)) -INTROSPECTION_GIRS += DbusmenuGtk-0.2.gir +INTROSPECTION_GIRS += DbusmenuGtk-0.4.gir girdir = $(datadir)/gir-1.0 gir_DATA = $(INTROSPECTION_GIRS) @@ -83,24 +83,24 @@ endif if HAVE_INTROSPECTION vapidir = $(datadir)/vala/vapi -vapi_DATA = DbusmenuGtk-0.2.vapi +vapi_DATA = DbusmenuGtk-0.4.vapi -DbusmenuGtk-0.2.vapi: DbusmenuGtk-0.2.tmp.gir Makefile.am - $(VALA_API_GEN) --library=DbusmenuGtk-0.2 \ +DbusmenuGtk-0.4.vapi: DbusmenuGtk-0.4.tmp.gir Makefile.am + $(VALA_API_GEN) --library=DbusmenuGtk-0.4 \ --pkg gdk-pixbuf-2.0 \ --pkg gtk+-2.0 \ --pkg atk \ - --pkg Dbusmenu-Glib-0.2 \ + --pkg Dbusmenu-Glib-0.4 \ --vapidir=$(top_builddir)/libdbusmenu-glib \ $< -DbusmenuGtk-0.2.tmp.gir: DbusmenuGtk-0.2.gir +DbusmenuGtk-0.4.tmp.gir: DbusmenuGtk-0.4.gir $(SED) \ -e "s|GdkPixbuf.Pixbuf|Gdk.Pixbuf|g" \ -e "s|Atk.ImplementorIface|Atk.Implementor|g" \ $< > $@ -CLEANFILES += $(vapi_DATA) DbusmenuGtk-0.2.tmp.gir +CLEANFILES += $(vapi_DATA) DbusmenuGtk-0.4.tmp.gir endif -- cgit v1.2.3 From 2a3d4ac52d20ea99e77b44749aaccb07a135fe25 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 1 Dec 2010 20:42:13 -0600 Subject: Changing the include directory to be the correct changed one. --- libdbusmenu-gtk/dbusmenu-gtk.pc.in | 2 +- libdbusmenu-gtk/dbusmenu-gtk3.pc.in | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libdbusmenu-gtk/dbusmenu-gtk.pc.in b/libdbusmenu-gtk/dbusmenu-gtk.pc.in index df4cb36..f35c621 100644 --- a/libdbusmenu-gtk/dbusmenu-gtk.pc.in +++ b/libdbusmenu-gtk/dbusmenu-gtk.pc.in @@ -4,7 +4,7 @@ libdir=@libdir@ bindir=@bindir@ includedir=@includedir@ -Cflags: -I${includedir}/libdbusmenu-0.1 +Cflags: -I${includedir}/libdbusmenu-0.4 Requires: dbus-glib-1 dbusmenu-glib Libs: -L${libdir} -ldbusmenu-gtk diff --git a/libdbusmenu-gtk/dbusmenu-gtk3.pc.in b/libdbusmenu-gtk/dbusmenu-gtk3.pc.in index 1a3410e..033c390 100644 --- a/libdbusmenu-gtk/dbusmenu-gtk3.pc.in +++ b/libdbusmenu-gtk/dbusmenu-gtk3.pc.in @@ -4,7 +4,7 @@ libdir=@libdir@ bindir=@bindir@ includedir=@includedir@ -Cflags: -I${includedir}/libdbusmenu-0.1 +Cflags: -I${includedir}/libdbusmenu-0.4 Requires: dbus-glib-1 dbusmenu-glib Libs: -L${libdir} -ldbusmenu-gtk3 -- cgit v1.2.3 From 7c45578e1fbaa08088d4f2d43bc3533e6b9112e1 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 1 Dec 2010 20:46:40 -0600 Subject: Moving the pc files to be parallel installable. --- configure.ac | 6 +++--- libdbusmenu-glib/Makefile.am | 4 ++-- libdbusmenu-glib/dbusmenu-glib-0.4.pc.in | 14 ++++++++++++++ libdbusmenu-glib/dbusmenu-glib.pc.in | 14 -------------- libdbusmenu-gtk/Makefile.am | 6 +++--- libdbusmenu-gtk/dbusmenu-gtk-0.4.pc.in | 14 ++++++++++++++ libdbusmenu-gtk/dbusmenu-gtk.pc.in | 14 -------------- libdbusmenu-gtk/dbusmenu-gtk3-0.4.pc.in | 14 ++++++++++++++ libdbusmenu-gtk/dbusmenu-gtk3.pc.in | 14 -------------- 9 files changed, 50 insertions(+), 50 deletions(-) create mode 100644 libdbusmenu-glib/dbusmenu-glib-0.4.pc.in delete mode 100644 libdbusmenu-glib/dbusmenu-glib.pc.in create mode 100644 libdbusmenu-gtk/dbusmenu-gtk-0.4.pc.in delete mode 100644 libdbusmenu-gtk/dbusmenu-gtk.pc.in create mode 100644 libdbusmenu-gtk/dbusmenu-gtk3-0.4.pc.in delete mode 100644 libdbusmenu-gtk/dbusmenu-gtk3.pc.in diff --git a/configure.ac b/configure.ac index bbc1aad..80519e8 100644 --- a/configure.ac +++ b/configure.ac @@ -159,10 +159,10 @@ AC_OUTPUT([ Makefile po/Makefile.in libdbusmenu-glib/Makefile -libdbusmenu-glib/dbusmenu-glib.pc +libdbusmenu-glib/dbusmenu-glib-0.4.pc libdbusmenu-gtk/Makefile -libdbusmenu-gtk/dbusmenu-gtk.pc -libdbusmenu-gtk/dbusmenu-gtk3.pc +libdbusmenu-gtk/dbusmenu-gtk-0.4.pc +libdbusmenu-gtk/dbusmenu-gtk3-0.4.pc tools/Makefile tools/testapp/Makefile tests/Makefile diff --git a/libdbusmenu-glib/Makefile.am b/libdbusmenu-glib/Makefile.am index 6db7e5d..e5a99a2 100644 --- a/libdbusmenu-glib/Makefile.am +++ b/libdbusmenu-glib/Makefile.am @@ -3,7 +3,7 @@ CLEANFILES = EXTRA_DIST = \ clean-namespaces.xslt \ - dbusmenu-glib.pc.in \ + dbusmenu-glib-0.4.pc.in \ dbus-menu.xml \ client-marshal.list \ menuitem-marshal.list \ @@ -52,7 +52,7 @@ libdbusmenu_glib_la_CFLAGS = \ libdbusmenu_glib_la_LIBADD = \ $(DBUSMENUGLIB_LIBS) -pkgconfig_DATA = dbusmenu-glib.pc +pkgconfig_DATA = dbusmenu-glib-0.4.pc pkgconfigdir = $(libdir)/pkgconfig %.xml.h: %.xml diff --git a/libdbusmenu-glib/dbusmenu-glib-0.4.pc.in b/libdbusmenu-glib/dbusmenu-glib-0.4.pc.in new file mode 100644 index 0000000..3f31664 --- /dev/null +++ b/libdbusmenu-glib/dbusmenu-glib-0.4.pc.in @@ -0,0 +1,14 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +bindir=@bindir@ +includedir=@includedir@ + +Cflags: -I${includedir}/libdbusmenu-0.4 +Requires: dbus-glib-1 +Libs: -L${libdir} -ldbusmenu-glib + +Name: libdbusmenu-glib +Description: libdbusmenu-glib. +Version: @VERSION@ + diff --git a/libdbusmenu-glib/dbusmenu-glib.pc.in b/libdbusmenu-glib/dbusmenu-glib.pc.in deleted file mode 100644 index 3f31664..0000000 --- a/libdbusmenu-glib/dbusmenu-glib.pc.in +++ /dev/null @@ -1,14 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -bindir=@bindir@ -includedir=@includedir@ - -Cflags: -I${includedir}/libdbusmenu-0.4 -Requires: dbus-glib-1 -Libs: -L${libdir} -ldbusmenu-glib - -Name: libdbusmenu-glib -Description: libdbusmenu-glib. -Version: @VERSION@ - diff --git a/libdbusmenu-gtk/Makefile.am b/libdbusmenu-gtk/Makefile.am index e512c4d..7eb725a 100644 --- a/libdbusmenu-gtk/Makefile.am +++ b/libdbusmenu-gtk/Makefile.am @@ -14,8 +14,8 @@ lib_LTLIBRARIES = libdbusmenu-gtk.la endif EXTRA_DIST = \ - dbusmenu-gtk.pc.in \ - dbusmenu-gtk3.pc.in + dbusmenu-gtk-0.4.pc.in \ + dbusmenu-gtk3-0.4.pc.in libdbusmenu_gtkincludedir=$(includedir)/libdbusmenu-0.4/libdbusmenu-gtk$(VER)/ @@ -57,7 +57,7 @@ libdbusmenu_gtk3_la_LDFLAGS = $(libdbusmenu_gtk_la_LDFLAGS) libdbusmenu_gtk3_la_CFLAGS = $(libdbusmenu_gtk_la_CFLAGS) libdbusmenu_gtk3_la_LIBADD = $(libdbusmenu_gtk_la_LIBADD) -pkgconfig_DATA = dbusmenu-gtk$(VER).pc +pkgconfig_DATA = dbusmenu-gtk$(VER)-0.4.pc pkgconfigdir = $(libdir)/pkgconfig ######################### diff --git a/libdbusmenu-gtk/dbusmenu-gtk-0.4.pc.in b/libdbusmenu-gtk/dbusmenu-gtk-0.4.pc.in new file mode 100644 index 0000000..f35c621 --- /dev/null +++ b/libdbusmenu-gtk/dbusmenu-gtk-0.4.pc.in @@ -0,0 +1,14 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +bindir=@bindir@ +includedir=@includedir@ + +Cflags: -I${includedir}/libdbusmenu-0.4 +Requires: dbus-glib-1 dbusmenu-glib +Libs: -L${libdir} -ldbusmenu-gtk + +Name: libdbusmenu-gtk +Description: libdbusmenu-gtk. +Version: @VERSION@ + diff --git a/libdbusmenu-gtk/dbusmenu-gtk.pc.in b/libdbusmenu-gtk/dbusmenu-gtk.pc.in deleted file mode 100644 index f35c621..0000000 --- a/libdbusmenu-gtk/dbusmenu-gtk.pc.in +++ /dev/null @@ -1,14 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -bindir=@bindir@ -includedir=@includedir@ - -Cflags: -I${includedir}/libdbusmenu-0.4 -Requires: dbus-glib-1 dbusmenu-glib -Libs: -L${libdir} -ldbusmenu-gtk - -Name: libdbusmenu-gtk -Description: libdbusmenu-gtk. -Version: @VERSION@ - diff --git a/libdbusmenu-gtk/dbusmenu-gtk3-0.4.pc.in b/libdbusmenu-gtk/dbusmenu-gtk3-0.4.pc.in new file mode 100644 index 0000000..033c390 --- /dev/null +++ b/libdbusmenu-gtk/dbusmenu-gtk3-0.4.pc.in @@ -0,0 +1,14 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +bindir=@bindir@ +includedir=@includedir@ + +Cflags: -I${includedir}/libdbusmenu-0.4 +Requires: dbus-glib-1 dbusmenu-glib +Libs: -L${libdir} -ldbusmenu-gtk3 + +Name: libdbusmenu-gtk3 +Description: libdbusmenu-gtk3. +Version: @VERSION@ + diff --git a/libdbusmenu-gtk/dbusmenu-gtk3.pc.in b/libdbusmenu-gtk/dbusmenu-gtk3.pc.in deleted file mode 100644 index 033c390..0000000 --- a/libdbusmenu-gtk/dbusmenu-gtk3.pc.in +++ /dev/null @@ -1,14 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -bindir=@bindir@ -includedir=@includedir@ - -Cflags: -I${includedir}/libdbusmenu-0.4 -Requires: dbus-glib-1 dbusmenu-glib -Libs: -L${libdir} -ldbusmenu-gtk3 - -Name: libdbusmenu-gtk3 -Description: libdbusmenu-gtk3. -Version: @VERSION@ - -- cgit v1.2.3 From 8d13b4941e5a520d9dbfffb87a03996c8cb38c98 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 1 Dec 2010 20:49:47 -0600 Subject: Ignore a bunch of new files. --- .bzrignore | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.bzrignore b/.bzrignore index 84b179c..d23b2d9 100644 --- a/.bzrignore +++ b/.bzrignore @@ -210,3 +210,13 @@ libdbusmenu-gtk/libdbusmenu_gtk3_la-client.lo libdbusmenu-gtk/libdbusmenu_gtk3_la-genericmenuitem.lo libdbusmenu-gtk/libdbusmenu_gtk3_la-menu.lo libdbusmenu-gtk/libdbusmenu_gtk3_la-menuitem.lo +libdbusmenu-glib/Dbusmenu-Glib-0.4.gir +libdbusmenu-glib/Dbusmenu-Glib-0.4.typelib +libdbusmenu-glib/Dbusmenu-Glib-0.4.vapi +libdbusmenu-glib/dbusmenu-glib-0.4.pc +libdbusmenu-gtk/DbusmenuGtk-0.4.gir +libdbusmenu-gtk/DbusmenuGtk-0.4.tmp.gir +libdbusmenu-gtk/DbusmenuGtk-0.4.typelib +libdbusmenu-gtk/DbusmenuGtk-0.4.vapi +libdbusmenu-gtk/dbusmenu-gtk-0.4.pc +libdbusmenu-gtk/dbusmenu-gtk3-0.4.pc -- cgit v1.2.3 From e3582434262f474412ac40b864f5bbc128973c40 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 1 Dec 2010 21:01:36 -0600 Subject: Putting the XSLT Processor into the configuration file. --- configure.ac | 6 ++++++ libdbusmenu-glib/Makefile.am | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 80519e8..c17b293 100644 --- a/configure.ac +++ b/configure.ac @@ -119,6 +119,12 @@ GOBJECT_INTROSPECTION_CHECK([0.6.7]) AC_PATH_PROG([VALA_API_GEN], [vapigen]) +########################### +# XSLT Processor +########################### + +AC_PATH_PROG([XSLT_PROC], [xsltproc]) + ########################### # Lib versioning ########################### diff --git a/libdbusmenu-glib/Makefile.am b/libdbusmenu-glib/Makefile.am index e5a99a2..0020d59 100644 --- a/libdbusmenu-glib/Makefile.am +++ b/libdbusmenu-glib/Makefile.am @@ -64,7 +64,7 @@ pkgconfigdir = $(libdir)/pkgconfig echo ";" >> $@ dbus-menu-clean.xml: dbus-menu.xml - xsltproc $(srcdir)/clean-namespaces.xslt $< > $@ || (rm -f $@ && /bin/false) + $(XSLT_PROC) $(srcdir)/clean-namespaces.xslt $< > $@ || (rm -f $@ && /bin/false) CLEANFILES += dbus-menu-clean.xml -- cgit v1.2.3 From 4bf64d184cb6eb7ac89d91705e947aedd2aa981a Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 1 Dec 2010 21:35:46 -0600 Subject: Making the ints from the JSON file int32s --- tests/json-loader.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/json-loader.c b/tests/json-loader.c index 4d3e6aa..14e90e0 100644 --- a/tests/json-loader.c +++ b/tests/json-loader.c @@ -56,7 +56,7 @@ node2variant (JsonNode * node) switch (json_node_get_value_type(node)) { case G_TYPE_INT: case G_TYPE_INT64: - return g_variant_new_int64(json_node_get_int(node)); + return g_variant_new_int32(json_node_get_int(node)); case G_TYPE_DOUBLE: case G_TYPE_FLOAT: return g_variant_new_double(json_node_get_double(node)); -- cgit v1.2.3 From 9dba82584abf181777b7bed4cca8202cf6652ff6 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 2 Dec 2010 13:52:54 -0600 Subject: Removing a GValue to use the direct functions --- libdbusmenu-gtk/genericmenuitem.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/libdbusmenu-gtk/genericmenuitem.c b/libdbusmenu-gtk/genericmenuitem.c index 990ca82..61881ef 100644 --- a/libdbusmenu-gtk/genericmenuitem.c +++ b/libdbusmenu-gtk/genericmenuitem.c @@ -291,7 +291,6 @@ genericmenuitem_set_check_type (Genericmenuitem * item, GenericmenuitemCheckType } item->priv->check_type = check_type; - GValue value = {0}; switch (item->priv->check_type) { case GENERICMENUITEM_CHECK_TYPE_NONE: @@ -300,22 +299,16 @@ genericmenuitem_set_check_type (Genericmenuitem * item, GenericmenuitemCheckType check on the item. */ break; case GENERICMENUITEM_CHECK_TYPE_CHECKBOX: - g_value_init(&value, G_TYPE_BOOLEAN); - g_value_set_boolean(&value, FALSE); - g_object_set_property(G_OBJECT(item), "draw-as-radio", &value); + gtk_check_menu_item_set_draw_as_radio(GTK_CHECK_MENU_ITEM(item), FALSE); break; case GENERICMENUITEM_CHECK_TYPE_RADIO: - g_value_init(&value, G_TYPE_BOOLEAN); - g_value_set_boolean(&value, TRUE); - g_object_set_property(G_OBJECT(item), "draw-as-radio", &value); + gtk_check_menu_item_set_draw_as_radio(GTK_CHECK_MENU_ITEM(item), TRUE); break; default: g_warning("Generic Menuitem invalid check type: %d", check_type); return; } - g_value_unset(&value); - gtk_widget_queue_draw(GTK_WIDGET(item)); return; -- cgit v1.2.3 From 837d3645ef5860c92dd5c1c82420c60a581b341f Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 2 Dec 2010 14:01:47 -0600 Subject: Renaming the jsonloader pc file --- configure.ac | 2 +- tests/Makefile.am | 2 +- tests/dbusmenu-jsonloader-0.4.pc.in | 14 ++++++++++++++ tests/dbusmenu-jsonloader.pc.in | 14 -------------- 4 files changed, 16 insertions(+), 16 deletions(-) create mode 100644 tests/dbusmenu-jsonloader-0.4.pc.in delete mode 100644 tests/dbusmenu-jsonloader.pc.in diff --git a/configure.ac b/configure.ac index c17b293..9aff3ce 100644 --- a/configure.ac +++ b/configure.ac @@ -172,7 +172,7 @@ libdbusmenu-gtk/dbusmenu-gtk3-0.4.pc tools/Makefile tools/testapp/Makefile tests/Makefile -tests/dbusmenu-jsonloader.pc +tests/dbusmenu-jsonloader-0.4.pc docs/Makefile docs/libdbusmenu-glib/Makefile docs/libdbusmenu-glib/reference/Makefile diff --git a/tests/Makefile.am b/tests/Makefile.am index aa79c8f..df2a364 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -80,7 +80,7 @@ libdbusmenu_jsonloader_la_LIBADD = \ $(DBUSMENUGLIB_LIBS) \ $(DBUSMENUTESTS_LIBS) -pkgconfig_DATA = dbusmenu-jsonloader.pc +pkgconfig_DATA = dbusmenu-jsonloader-0.4.pc pkgconfigdir = $(libdir)/pkgconfig ###################### diff --git a/tests/dbusmenu-jsonloader-0.4.pc.in b/tests/dbusmenu-jsonloader-0.4.pc.in new file mode 100644 index 0000000..d042132 --- /dev/null +++ b/tests/dbusmenu-jsonloader-0.4.pc.in @@ -0,0 +1,14 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +bindir=@bindir@ +includedir=@includedir@ + +Cflags: -I${includedir}/libdbusmenu-0.1 +Requires: dbus-glib-1,dbusmenu-glib,json-glib-1.0 +Libs: -L${libdir} -ldbusmenu-jsonloader + +Name: libdbusmenu-jsonloader +Description: A small library to load JSON descriptions of menus. Mostly for testing. +Version: @VERSION@ + diff --git a/tests/dbusmenu-jsonloader.pc.in b/tests/dbusmenu-jsonloader.pc.in deleted file mode 100644 index d042132..0000000 --- a/tests/dbusmenu-jsonloader.pc.in +++ /dev/null @@ -1,14 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -bindir=@bindir@ -includedir=@includedir@ - -Cflags: -I${includedir}/libdbusmenu-0.1 -Requires: dbus-glib-1,dbusmenu-glib,json-glib-1.0 -Libs: -L${libdir} -ldbusmenu-jsonloader - -Name: libdbusmenu-jsonloader -Description: A small library to load JSON descriptions of menus. Mostly for testing. -Version: @VERSION@ - -- cgit v1.2.3 From ffb9d313cf4f588fc6958eb7e4e30b272b00d10e Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 2 Dec 2010 14:13:09 -0600 Subject: Ignoring the new PC file --- .bzrignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.bzrignore b/.bzrignore index d23b2d9..44c6edb 100644 --- a/.bzrignore +++ b/.bzrignore @@ -182,7 +182,7 @@ docs/libdbusmenu-gtk/reference/tmpl/menuitem.sgml docs/libdbusmenu-gtk/reference/tmpl/menuitem.sgml.bak gtk-doc.make m4/gtk-doc.m4 -tests/dbusmenu-jsonloader.pc +tests/dbusmenu-jsonloader-0.4.pc tests/libdbusmenu-jsonloader.la tests/libdbusmenu_jsonloader_la-json-loader.lo tests/test-json-server -- cgit v1.2.3 From 5f1c15b654a09bf8d5ad04b8d8ff046cdf7068fa Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 6 Dec 2010 10:50:24 -0600 Subject: Add a check for GIR version less that 10 --- configure.ac | 6 ++++++ libdbusmenu-glib/Makefile.am | 7 +++++++ libdbusmenu-gtk/Makefile.am | 8 ++++++++ 3 files changed, 21 insertions(+) diff --git a/configure.ac b/configure.ac index 4a7bc86..a285ad9 100644 --- a/configure.ac +++ b/configure.ac @@ -116,6 +116,12 @@ AC_SUBST(DBUSMENUTESTS_LIBS) GOBJECT_INTROSPECTION_CHECK([0.6.7]) +PKG_CHECK_EXISTS([gobject-introspection-1.0 >= 0.10], + introspection_ten=yes, + introspection_ten=no) + +AM_CONDITIONAL(INTROSPECTION_TEN, [test "x$introspection_ten" = "xyes"]) + ########################### # Vala API Generation ########################### diff --git a/libdbusmenu-glib/Makefile.am b/libdbusmenu-glib/Makefile.am index adf4607..d33bc9b 100644 --- a/libdbusmenu-glib/Makefile.am +++ b/libdbusmenu-glib/Makefile.am @@ -114,11 +114,18 @@ menuitem-marshal.c: $(srcdir)/menuitem-marshal.list -include $(INTROSPECTION_MAKEFILE) INTROSPECTION_GIRS = + +if INTROSPECTION_TEN INTROSPECTION_SCANNER_ARGS = --add-include-path=$(srcdir) \ --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) \ + --add-include-path=$(srcdir) \ + $(addprefix --c-include=libdbusmenu-glib/, $(introspection_sources)) +endif INTROSPECTION_COMPILER_ARGS = --includedir=$(builddir) diff --git a/libdbusmenu-gtk/Makefile.am b/libdbusmenu-gtk/Makefile.am index e539aa6..19765d5 100644 --- a/libdbusmenu-gtk/Makefile.am +++ b/libdbusmenu-gtk/Makefile.am @@ -66,11 +66,19 @@ pkgconfigdir = $(libdir)/pkgconfig -include $(INTROSPECTION_MAKEFILE) INTROSPECTION_GIRS = + +if INTROSPECTION_TEN INTROSPECTION_SCANNER_ARGS = --add-include-path=$(srcdir) \ --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) \ + --add-include-path=$(top_builddir)/libdbusmenu-glib \ + $(addprefix --c-include=libdbusmenu-gtk/, $(introspection_sources)) +endif + INTROSPECTION_COMPILER_ARGS = --includedir=$(builddir) --includedir=$(top_builddir)/libdbusmenu-glib if HAVE_INTROSPECTION -- cgit v1.2.3 From 55ed277c86f90c7d31c6ab1cfd59f049ade329eb Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 7 Dec 2010 09:41:00 -0600 Subject: Oops, wrong version -- fixed --- 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 e6aecd6..e45f700 100644 --- a/libdbusmenu-glib/Makefile.am +++ b/libdbusmenu-glib/Makefile.am @@ -142,7 +142,7 @@ Dbusmenu_Glib_0_4_gir_CFLAGS = $(DBUSMENUGLIB_CFLAGS) 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 -Dbusmenu_Glib_0_4_gir_VERSION = Glib-0.2 +Dbusmenu_Glib_0_4_gir_VERSION = Glib-0.4 Dbusmenu_Glib_0_4_gir_PACKAGES = dbusmenu-glib Dbusmenu_Glib_0_4_gir_SCANNER_FLAGS = $(INTROSPECTION_SCANNER_ARGS) -- cgit v1.2.3 From 58c157738e5aae7a01422b21a3b1f0a6e3ca2ed9 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 7 Dec 2010 21:17:43 -0600 Subject: Wrong directory for jsonloader header files. --- tests/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Makefile.am b/tests/Makefile.am index df2a364..17b44d1 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -52,7 +52,7 @@ XVFB_RUN=". $(srcdir)/run-xvfb.sh" lib_LTLIBRARIES = libdbusmenu-jsonloader.la -libdbusmenu_jsonloaderincludedir=$(includedir)/libdbusmenu-0.1/libdbusmenu-jsonloader/ +libdbusmenu_jsonloaderincludedir=$(includedir)/libdbusmenu-0.4/libdbusmenu-jsonloader/ libdbusmenu_jsonloaderinclude_HEADERS = \ json-loader.h -- cgit v1.2.3 From 1a73825600508b5d7f027641b05a682a8ac81f5e Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 8 Dec 2010 09:27:48 -0600 Subject: Fixing the requires in the pc files --- libdbusmenu-glib/dbusmenu-glib-0.4.pc.in | 2 +- libdbusmenu-gtk/dbusmenu-gtk-0.4.pc.in | 2 +- libdbusmenu-gtk/dbusmenu-gtk3-0.4.pc.in | 2 +- tests/dbusmenu-jsonloader-0.4.pc.in | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libdbusmenu-glib/dbusmenu-glib-0.4.pc.in b/libdbusmenu-glib/dbusmenu-glib-0.4.pc.in index 3f31664..31a1eac 100644 --- a/libdbusmenu-glib/dbusmenu-glib-0.4.pc.in +++ b/libdbusmenu-glib/dbusmenu-glib-0.4.pc.in @@ -5,7 +5,7 @@ bindir=@bindir@ includedir=@includedir@ Cflags: -I${includedir}/libdbusmenu-0.4 -Requires: dbus-glib-1 +Requires: Libs: -L${libdir} -ldbusmenu-glib Name: libdbusmenu-glib diff --git a/libdbusmenu-gtk/dbusmenu-gtk-0.4.pc.in b/libdbusmenu-gtk/dbusmenu-gtk-0.4.pc.in index f35c621..8784556 100644 --- a/libdbusmenu-gtk/dbusmenu-gtk-0.4.pc.in +++ b/libdbusmenu-gtk/dbusmenu-gtk-0.4.pc.in @@ -5,7 +5,7 @@ bindir=@bindir@ includedir=@includedir@ Cflags: -I${includedir}/libdbusmenu-0.4 -Requires: dbus-glib-1 dbusmenu-glib +Requires: dbusmenu-glib-0.4 Libs: -L${libdir} -ldbusmenu-gtk Name: libdbusmenu-gtk diff --git a/libdbusmenu-gtk/dbusmenu-gtk3-0.4.pc.in b/libdbusmenu-gtk/dbusmenu-gtk3-0.4.pc.in index 033c390..804b13e 100644 --- a/libdbusmenu-gtk/dbusmenu-gtk3-0.4.pc.in +++ b/libdbusmenu-gtk/dbusmenu-gtk3-0.4.pc.in @@ -5,7 +5,7 @@ bindir=@bindir@ includedir=@includedir@ Cflags: -I${includedir}/libdbusmenu-0.4 -Requires: dbus-glib-1 dbusmenu-glib +Requires: dbusmenu-glib-0.4 Libs: -L${libdir} -ldbusmenu-gtk3 Name: libdbusmenu-gtk3 diff --git a/tests/dbusmenu-jsonloader-0.4.pc.in b/tests/dbusmenu-jsonloader-0.4.pc.in index d042132..62bfeb2 100644 --- a/tests/dbusmenu-jsonloader-0.4.pc.in +++ b/tests/dbusmenu-jsonloader-0.4.pc.in @@ -5,7 +5,7 @@ bindir=@bindir@ includedir=@includedir@ Cflags: -I${includedir}/libdbusmenu-0.1 -Requires: dbus-glib-1,dbusmenu-glib,json-glib-1.0 +Requires: dbusmenu-glib-0.4 json-glib-1.0 Libs: -L${libdir} -ldbusmenu-jsonloader Name: libdbusmenu-jsonloader -- cgit v1.2.3 From b29bfd7c365a6b768dcf4530c40e9220d9e8abd1 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 9 Dec 2010 10:18:26 -0600 Subject: Upping the library version as we're different ABI than 0.3.90 even :-/ --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index e18452b..cab1c42 100644 --- a/configure.ac +++ b/configure.ac @@ -135,7 +135,7 @@ AC_PATH_PROG([XSLT_PROC], [xsltproc]) # Lib versioning ########################### -LIBDBUSMENU_CURRENT=2 +LIBDBUSMENU_CURRENT=3 LIBDBUSMENU_REVISION=0 LIBDBUSMENU_AGE=0 -- cgit v1.2.3 From 1574d58e111bd80cbeb770ab3f603dca88a90341 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 9 Dec 2010 16:36:48 -0600 Subject: Switching away from using set_activate as that doesn't actually set the value, it just signals, but we're sucking up that signal already so we need to manually create it if we need it, which is the only way to set the active property. Goofy. --- libdbusmenu-gtk/genericmenuitem.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/libdbusmenu-gtk/genericmenuitem.c b/libdbusmenu-gtk/genericmenuitem.c index d507487..d3023ad 100644 --- a/libdbusmenu-gtk/genericmenuitem.c +++ b/libdbusmenu-gtk/genericmenuitem.c @@ -65,6 +65,7 @@ static void (*parent_draw_indicator) (GtkCheckMenuItem *check_menu_item, cairo_t static void draw_indicator (GtkCheckMenuItem *check_menu_item, GdkRectangle *area); static void (*parent_draw_indicator) (GtkCheckMenuItem *check_menu_item, GdkRectangle *area) = NULL; #endif +static void (*parent_menuitem_activate) (GtkMenuItem * mi) = NULL; /* Initializing all of the classes. Most notably we're disabling the drawing of the check early. */ @@ -86,6 +87,7 @@ genericmenuitem_class_init (GenericmenuitemClass *klass) GtkMenuItemClass * menuitem_class = GTK_MENU_ITEM_CLASS (klass); menuitem_class->set_label = set_label; menuitem_class->get_label = get_label; + parent_menuitem_activate = menuitem_class->activate; menuitem_class->activate = activate; return; @@ -338,21 +340,19 @@ genericmenuitem_set_state (Genericmenuitem * item, GenericmenuitemState state) item->priv->state = state; GtkCheckMenuItem * check = GTK_CHECK_MENU_ITEM(item); - - gboolean old_active = gtk_check_menu_item_get_active (check); - gboolean old_inconsist = gtk_check_menu_item_get_inconsistent (check); + gboolean goal_active = FALSE; switch (item->priv->state) { case GENERICMENUITEM_STATE_UNCHECKED: - gtk_check_menu_item_set_active (check, FALSE); + goal_active = FALSE; gtk_check_menu_item_set_inconsistent (check, FALSE); break; case GENERICMENUITEM_STATE_CHECKED: - gtk_check_menu_item_set_active (check, TRUE); + goal_active = TRUE; gtk_check_menu_item_set_inconsistent (check, FALSE); break; case GENERICMENUITEM_STATE_INDETERMINATE: - gtk_check_menu_item_set_active (check, TRUE); + goal_active = TRUE; gtk_check_menu_item_set_inconsistent (check, TRUE); break; default: @@ -360,16 +360,12 @@ genericmenuitem_set_state (Genericmenuitem * item, GenericmenuitemState state) return; } - if (old_active != gtk_check_menu_item_get_active (check)) { - g_object_notify(G_OBJECT(item), "active"); - } - - if (old_inconsist != gtk_check_menu_item_get_inconsistent (check)) { - g_object_notify(G_OBJECT(item), "inconsistent"); + if (goal_active != gtk_check_menu_item_get_active(check)) { + if (parent_menuitem_activate != NULL) { + parent_menuitem_activate(GTK_MENU_ITEM(check)); + } } - gtk_widget_queue_draw(GTK_WIDGET(item)); - return; } -- cgit v1.2.3 From 9ca2114ba780c0d7976e66fbc6e4ae750a7522c4 Mon Sep 17 00:00:00 2001 From: Chris Coulson Date: Mon, 13 Dec 2010 13:40:01 +0000 Subject: Bracked public libdbusmenu-gtk/menuitem.h header with G_{BEGIN/END}_DECLS, so it can be used from C++ consumers --- libdbusmenu-gtk/menuitem.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libdbusmenu-gtk/menuitem.h b/libdbusmenu-gtk/menuitem.h index 6960f76..a2b6652 100644 --- a/libdbusmenu-gtk/menuitem.h +++ b/libdbusmenu-gtk/menuitem.h @@ -35,6 +35,8 @@ License version 3 and version 2.1 along with this program. If not, see #include #include +G_BEGIN_DECLS + gboolean dbusmenu_menuitem_property_set_image (DbusmenuMenuitem * menuitem, const gchar * property, const GdkPixbuf * data); GdkPixbuf * dbusmenu_menuitem_property_get_image (DbusmenuMenuitem * menuitem, const gchar * property); @@ -43,4 +45,6 @@ gboolean dbusmenu_menuitem_property_set_shortcut_string (DbusmenuMenuitem * menu gboolean dbusmenu_menuitem_property_set_shortcut_menuitem (DbusmenuMenuitem * menuitem, const GtkMenuItem * gmi); void dbusmenu_menuitem_property_get_shortcut (DbusmenuMenuitem * menuitem, guint * key, GdkModifierType * modifiers); +G_END_DECLS + #endif -- cgit v1.2.3 From 84969770f06f78f92f8e587c779e148d1d240f99 Mon Sep 17 00:00:00 2001 From: Chris Coulson Date: Mon, 13 Dec 2010 13:45:05 +0000 Subject: * Hook in AboutToShow to the menu items --- libdbusmenu-glib/server.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c index 8a10715..d1d82bd 100644 --- a/libdbusmenu-glib/server.c +++ b/libdbusmenu-glib/server.c @@ -1079,6 +1079,8 @@ bus_about_to_show (DbusmenuServer * server, GVariant * params, GDBusMethodInvoca return; } + dbusmenu_menuitem_send_about_to_show(mi, NULL, NULL); + /* GTK+ does not support about-to-show concept for now */ g_dbus_method_invocation_return_value(invocation, g_variant_new("(b)", FALSE)); -- cgit v1.2.3 From 09cb60267e5a4773ec5965e7e1a2ff92a690d7f0 Mon Sep 17 00:00:00 2001 From: Chris Coulson Date: Mon, 13 Dec 2010 16:51:45 +0000 Subject: Add an about-to-show signal to the menu items and hook this up to be emitted when someone calls dbusmenu_menuitem_send_about_to_show --- libdbusmenu-glib/menuitem.c | 19 ++++++++++++++++++- libdbusmenu-glib/menuitem.h | 3 ++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index ad6472b..747cc01 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -70,6 +70,7 @@ enum { CHILD_MOVED, REALIZED, SHOW_TO_USER, + ABOUT_TO_SHOW, LAST_SIGNAL }; @@ -229,6 +230,21 @@ dbusmenu_menuitem_class_init (DbusmenuMenuitemClass *klass) g_cclosure_marshal_VOID__UINT, G_TYPE_NONE, 1, G_TYPE_UINT, G_TYPE_NONE); + /** + DbusmenuMenuitem::about-to-show: + @arg0: The #DbusmenuMenuitem object. + + Emitted when the submenu for this item + is about to be shown + */ + signals[ABOUT_TO_SHOW] = g_signal_new(DBUSMENU_MENUITEM_SIGNAL_ABOUT_TO_SHOW, + G_TYPE_FROM_CLASS(klass), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET(DbusmenuMenuitemClass, about_to_show), + NULL, NULL, + _dbusmenu_menuitem_marshal_VOID__VOID, + G_TYPE_BOOLEAN, 0, G_TYPE_NONE); + g_object_class_install_property (object_class, PROP_ID, g_param_spec_int(PROP_ID_S, "ID for the menu item", "This is a unique indentifier for the menu item.", @@ -398,7 +414,8 @@ send_about_to_show (DbusmenuMenuitem * mi, void (*cb) (DbusmenuMenuitem * mi, gp if (dbusmenu_menuitem_get_children(mi) == NULL) { g_warning("About to Show called on an item wihtout submenus. We're ignoring it."); } else { - g_signal_emit(G_OBJECT(mi), signals[ITEM_ACTIVATED], 0, 0 /* timestamp */, TRUE); + gboolean dummy; + g_signal_emit(G_OBJECT(mi), signals[ABOUT_TO_SHOW], 0, &dummy); } if (cb != NULL) { diff --git a/libdbusmenu-glib/menuitem.h b/libdbusmenu-glib/menuitem.h index 9158f3e..0058ded 100644 --- a/libdbusmenu-glib/menuitem.h +++ b/libdbusmenu-glib/menuitem.h @@ -50,6 +50,7 @@ G_BEGIN_DECLS #define DBUSMENU_MENUITEM_SIGNAL_REALIZED "realized" #define DBUSMENU_MENUITEM_SIGNAL_REALIZED_ID (g_signal_lookup(DBUSMENU_MENUITEM_SIGNAL_REALIZED, DBUSMENU_TYPE_MENUITEM)) #define DBUSMENU_MENUITEM_SIGNAL_SHOW_TO_USER "show-to-user" +#define DBUSMENU_MENUITEM_SIGNAL_ABOUT_TO_SHOW "about-to-show" #define DBUSMENU_MENUITEM_PROP_TYPE "type" #define DBUSMENU_MENUITEM_PROP_VISIBLE "visible" @@ -158,6 +159,7 @@ struct _DbusmenuMenuitemClass void (*send_about_to_show) (DbusmenuMenuitem * mi, void (*cb) (DbusmenuMenuitem * mi, gpointer user_data), gpointer cb_data); void (*show_to_user) (DbusmenuMenuitem * mi, guint timestamp, gpointer cb_data); + gboolean (*about_to_show) (void); /*< Private >*/ void (*reserved1) (void); @@ -165,7 +167,6 @@ struct _DbusmenuMenuitemClass void (*reserved3) (void); void (*reserved4) (void); void (*reserved5) (void); - void (*reserved6) (void); }; GType dbusmenu_menuitem_get_type (void); -- cgit v1.2.3 From a02639a8849df82b563331783f5d571622d65208 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 5 Jan 2011 16:58:37 -0600 Subject: Handling the case of a NULL variant by making it clear the hashtable of that property. --- libdbusmenu-glib/menuitem.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index ad6472b..50354ee 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -984,14 +984,22 @@ dbusmenu_menuitem_property_set_variant (DbusmenuMenuitem * mi, const gchar * pro DbusmenuMenuitemPrivate * priv = DBUSMENU_MENUITEM_GET_PRIVATE(mi); - gchar * lprop = g_strdup(property); - g_variant_ref(value); - gboolean replaced = FALSE; - gpointer currentval = g_hash_table_lookup(priv->properties, lprop); - if (currentval == NULL || !g_variant_equal((GVariant*)currentval, value)) { - g_hash_table_replace(priv->properties, lprop, value); - replaced = TRUE; + gpointer currentval = g_hash_table_lookup(priv->properties, property); + + if (value != NULL) { + gchar * lprop = g_strdup(property); + g_variant_ref(value); + + if (currentval == NULL || !g_variant_equal((GVariant*)currentval, value)) { + g_hash_table_replace(priv->properties, lprop, value); + replaced = TRUE; + } + } else { + if (currentval != NULL) { + g_hash_table_remove(priv->properties, property); + replaced = TRUE; + } } /* NOTE: The actual value is invalid at this point @@ -999,7 +1007,7 @@ dbusmenu_menuitem_property_set_variant (DbusmenuMenuitem * mi, const gchar * pro table. But the fact that there was a value is the imporant part. */ if (currentval == NULL || replaced) { - g_signal_emit(G_OBJECT(mi), signals[PROPERTY_CHANGED], 0, lprop, value, TRUE); + g_signal_emit(G_OBJECT(mi), signals[PROPERTY_CHANGED], 0, property, value, TRUE); } return TRUE; -- cgit v1.2.3 From e5f53f91d929c46914b4a02336e31724fb54ec95 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 5 Jan 2011 20:47:09 -0600 Subject: Adding a test to test removing of properties --- tests/test-glib-objects.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tests/test-glib-objects.c b/tests/test-glib-objects.c index 7143814..2c8eda9 100644 --- a/tests/test-glib-objects.c +++ b/tests/test-glib-objects.c @@ -274,6 +274,29 @@ test_object_menuitem_props_boolstr (void) return; } +/* Set and then remove a prop */ +static void +test_object_menuitem_props_removal (void) +{ + /* Build a menu item */ + DbusmenuMenuitem * item = dbusmenu_menuitem_new(); + + /* Test to make sure it's a happy object */ + g_assert(item != NULL); + + /* Set the property and ensure that it's set */ + dbusmenu_menuitem_property_set_variant(item, "myprop", g_variant_new_int32(34)); + g_assert(dbusmenu_menuitem_property_get_variant(item, "myprop") != NULL); + + /* Remove the property and ensure it goes away */ + dbusmenu_menuitem_property_set_variant(item, "myprop", NULL); + g_assert(dbusmenu_menuitem_property_get_variant(item, "myprop") == NULL); + + g_object_unref(item); + + return; +} + /* Build the test suite */ static void test_glib_objects_suite (void) @@ -286,6 +309,7 @@ test_glib_objects_suite (void) g_test_add_func ("/dbusmenu/glib/objects/menuitem/props_swap", test_object_menuitem_props_swap); g_test_add_func ("/dbusmenu/glib/objects/menuitem/props_signals", test_object_menuitem_props_signals); g_test_add_func ("/dbusmenu/glib/objects/menuitem/props_boolstr", test_object_menuitem_props_boolstr); + g_test_add_func ("/dbusmenu/glib/objects/menuitem/props_removal", test_object_menuitem_props_removal); return; } -- cgit v1.2.3 From 0c50ae11cafdd7ca04ae6d2a69390903d16daedd Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 5 Jan 2011 20:49:47 -0600 Subject: Adding a test for removal by string being NULL --- tests/test-glib-objects.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/test-glib-objects.c b/tests/test-glib-objects.c index 2c8eda9..9c99280 100644 --- a/tests/test-glib-objects.c +++ b/tests/test-glib-objects.c @@ -292,6 +292,14 @@ test_object_menuitem_props_removal (void) dbusmenu_menuitem_property_set_variant(item, "myprop", NULL); g_assert(dbusmenu_menuitem_property_get_variant(item, "myprop") == NULL); + /* Set the property again */ + dbusmenu_menuitem_property_set_variant(item, "myprop", g_variant_new_int32(34)); + g_assert(dbusmenu_menuitem_property_get_variant(item, "myprop") != NULL); + + /* Remove the property with a NULL string */ + dbusmenu_menuitem_property_set(item, "myprop", NULL); + g_assert(dbusmenu_menuitem_property_get_variant(item, "myprop") == NULL); + g_object_unref(item); return; -- cgit v1.2.3 From 47263d9b6c912d013a77ce2efda27df9c7571920 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 5 Jan 2011 20:51:51 -0600 Subject: Testing for the string being NULL before g_variant aborts on it. --- libdbusmenu-glib/menuitem.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index 50354ee..31c23f4 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -913,7 +913,10 @@ dbusmenu_menuitem_find_id (DbusmenuMenuitem * mi, gint id) gboolean dbusmenu_menuitem_property_set (DbusmenuMenuitem * mi, const gchar * property, const gchar * value) { - GVariant * variant = g_variant_new("s", value); + GVariant * variant = NULL; + if (value != NULL) { + g_variant_new_string(value); + } return dbusmenu_menuitem_property_set_variant(mi, property, variant); } -- cgit v1.2.3 From 1b77b621285fe681ca030bf3f548ad04b50dd242 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 5 Jan 2011 20:53:27 -0600 Subject: Oops, need to actually assign that return. --- libdbusmenu-glib/menuitem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index 31c23f4..1e892c3 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -915,7 +915,7 @@ dbusmenu_menuitem_property_set (DbusmenuMenuitem * mi, const gchar * property, c { GVariant * variant = NULL; if (value != NULL) { - g_variant_new_string(value); + variant = g_variant_new_string(value); } return dbusmenu_menuitem_property_set_variant(mi, property, variant); } -- cgit v1.2.3 From a8b425c5868c73739f60997ebc2013df3b3d6d4b Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 13 Jan 2011 09:53:15 -0600 Subject: Ayatana purge --- libdbusmenu-glib/clean-namespaces.xslt | 2 +- libdbusmenu-glib/client.c | 2 +- libdbusmenu-glib/dbus-menu.xml | 6 +++--- libdbusmenu-glib/server.c | 8 ++++---- tools/dbusmenu-bench | 2 +- tools/dbusmenu-dumper.c | 6 +++--- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/libdbusmenu-glib/clean-namespaces.xslt b/libdbusmenu-glib/clean-namespaces.xslt index 8344a71..8c0c521 100644 --- a/libdbusmenu-glib/clean-namespaces.xslt +++ b/libdbusmenu-glib/clean-namespaces.xslt @@ -1,4 +1,4 @@ - + diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index a15469b..58d6360 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -122,7 +122,7 @@ struct _event_data_t { #define DBUSMENU_CLIENT_GET_PRIVATE(o) (DBUSMENU_CLIENT(o)->priv) -#define DBUSMENU_INTERFACE "org.ayatana.dbusmenu" +#define DBUSMENU_INTERFACE "com.canonical.dbusmenu" /* GObject Stuff */ static void dbusmenu_client_class_init (DbusmenuClientClass *klass); diff --git a/libdbusmenu-glib/dbus-menu.xml b/libdbusmenu-glib/dbus-menu.xml index 9e8013c..042a24c 100644 --- a/libdbusmenu-glib/dbus-menu.xml +++ b/libdbusmenu-glib/dbus-menu.xml @@ -28,15 +28,15 @@ 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 --> - + - + Date: Thu, 13 Jan 2011 09:57:37 -0600 Subject: Fixing packages names for the gir scanner --- libdbusmenu-glib/Makefile.am | 2 +- libdbusmenu-gtk/Makefile.am | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libdbusmenu-glib/Makefile.am b/libdbusmenu-glib/Makefile.am index e45f700..4a65ac0 100644 --- a/libdbusmenu-glib/Makefile.am +++ b/libdbusmenu-glib/Makefile.am @@ -143,7 +143,7 @@ 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 Dbusmenu_Glib_0_4_gir_VERSION = Glib-0.4 -Dbusmenu_Glib_0_4_gir_PACKAGES = dbusmenu-glib +Dbusmenu_Glib_0_4_gir_PACKAGES = dbusmenu-glib-0.4 Dbusmenu_Glib_0_4_gir_SCANNER_FLAGS = $(INTROSPECTION_SCANNER_ARGS) INTROSPECTION_GIRS += Dbusmenu-Glib-0.4.gir diff --git a/libdbusmenu-gtk/Makefile.am b/libdbusmenu-gtk/Makefile.am index ac2eee9..1957820 100644 --- a/libdbusmenu-gtk/Makefile.am +++ b/libdbusmenu-gtk/Makefile.am @@ -95,7 +95,7 @@ DbusmenuGtk_0_4_gir_LIBS = libdbusmenu-gtk$(VER).la DbusmenuGtk_0_4_gir_FILES = $(addprefix $(srcdir)/, $(introspection_sources)) DbusmenuGtk_0_4_gir_NAMESPACE = DbusmenuGtk$(VER) DbusmenuGtk_0_4_gir_SCANNERFLAGS = $(INTROSPECTION_SCANNER_ARGS) -DbusmenuGtk_0_4_gir_PACKAGES = dbusmenu-gtk$(VER) +DbusmenuGtk_0_4_gir_PACKAGES = dbusmenu-gtk$(VER)-0.4 # We duplicate these for the same reason as libdbusmenu_gtk3includedir above DbusmenuGtk3_0_4_gir_INCLUDES = $(DbusmenuGtk_0_4_gir_INCLUDES) -- cgit v1.2.3 From 2cfbfcab8a2c73227619eb3cd7a79e1fe17a8b43 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 13 Jan 2011 10:03:21 -0600 Subject: 0.3.91 --- configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index cab1c42..f1920b9 100644 --- a/configure.ac +++ b/configure.ac @@ -1,11 +1,11 @@ -AC_INIT(libdbusmenu, 0.3.90, ted@canonical.com) +AC_INIT(libdbusmenu, 0.3.91, ted@canonical.com) AC_COPYRIGHT([Copyright 2009,2010 Canonical]) AC_PREREQ(2.62) AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(libdbusmenu, 0.3.90, [-Wno-portability]) +AM_INIT_AUTOMAKE(libdbusmenu, 0.3.91, [-Wno-portability]) AM_MAINTAINER_MODE -- cgit v1.2.3