From 98b759aaa21779694f5708a93d900c3204742133 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 17 Aug 2010 16:12:48 -0500 Subject: Getting the signal for the request to activate the item --- libdbusmenu-glib/client.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index 73a7aac..d127b21 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -123,6 +123,7 @@ 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 GQuark error_domain (void); +static void item_activated (DBusGProxy * proxy, gint id, gint timestamp, DbusmenuClient * client); /* Build a type */ G_DEFINE_TYPE (DbusmenuClient, dbusmenu_client, G_TYPE_OBJECT); @@ -582,6 +583,14 @@ get_properties_globber (DbusmenuClient * client, gint id, const gchar ** propert return; } +/* Called when a server item wants to activate the menu */ +static void +item_activated (DBusGProxy * proxy, gint id, gint timestamp, DbusmenuClient * client) +{ + + return; +} + /* Annoying little wrapper to make the right function update */ static void layout_update (DBusGProxy * proxy, guint revision, gint parent, DbusmenuClient * client) @@ -821,6 +830,10 @@ build_proxies (DbusmenuClient * 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); + 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); + update_layout(client); return; -- cgit v1.2.3 From 65d0fad51540858ca7a8cf850f6d0c3e0feaf949 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 17 Aug 2010 16:45:09 -0500 Subject: Getting to the menu item. --- libdbusmenu-glib/client.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index d127b21..25d64b6 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -123,7 +123,7 @@ 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 GQuark error_domain (void); -static void item_activated (DBusGProxy * proxy, gint id, gint timestamp, DbusmenuClient * client); +static void item_activated (DBusGProxy * proxy, gint id, guint timestamp, DbusmenuClient * client); /* Build a type */ G_DEFINE_TYPE (DbusmenuClient, dbusmenu_client, G_TYPE_OBJECT); @@ -585,8 +585,21 @@ 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, gint timestamp, DbusmenuClient * client) +item_activated (DBusGProxy * proxy, gint id, guint timestamp, DbusmenuClient * client) { + DbusmenuClientPrivate * priv = DBUSMENU_CLIENT_GET_PRIVATE(client); + + if (priv->root == NULL) { + g_warning("Asked to activate item %d when we don't have a menu structure.", id); + return; + } + + DbusmenuMenuitem * menuitem = dbusmenu_menuitem_find_id(priv->root, id); + if (menuitem == NULL) { + g_warning("Unable to find menu item %d to activate.", id); + return; + } + return; } -- cgit v1.2.3 From 6566022e1f2afc97d6ffafbec3ca54bf63fd19f9 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 17 Aug 2010 20:42:22 -0500 Subject: Adding a new signal for when items activate. --- .bzrignore | 3 +++ libdbusmenu-glib/Makefile.am | 15 +++++++++++++++ libdbusmenu-glib/client-marshal.list | 1 + libdbusmenu-glib/client.c | 18 ++++++++++++++++++ libdbusmenu-glib/client.h | 6 ++++-- 5 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 libdbusmenu-glib/client-marshal.list diff --git a/.bzrignore b/.bzrignore index ae6fc3d..b21c55f 100644 --- a/.bzrignore +++ b/.bzrignore @@ -188,3 +188,6 @@ tests/libdbusmenu_jsonloader_la-json-loader.lo tests/test-json-server tests/test-json-client tests/test-json +libdbusmenu-glib/client-marshal.c +libdbusmenu-glib/client-marshal.h +libdbusmenu-glib/libdbusmenu_glib_la-client-marshal.lo diff --git a/libdbusmenu-glib/Makefile.am b/libdbusmenu-glib/Makefile.am index 3df1513..0a6513f 100644 --- a/libdbusmenu-glib/Makefile.am +++ b/libdbusmenu-glib/Makefile.am @@ -4,6 +4,7 @@ CLEANFILES = EXTRA_DIST = \ dbusmenu-glib.pc.in \ dbus-menu.xml \ + client-marshal.list \ menuitem-marshal.list \ server-marshal.list @@ -32,6 +33,8 @@ libdbusmenu_glib_la_SOURCES = \ server.c \ server-marshal.h \ server-marshal.c \ + client-marshal.h \ + client-marshal.c \ client-menuitem.h \ client-menuitem.c \ client.h \ @@ -54,6 +57,8 @@ pkgconfigdir = $(libdir)/pkgconfig BUILT_SOURCES = \ dbusmenu-client.h \ dbusmenu-server.h \ + client-marshal.h \ + client-marshal.c \ menuitem-marshal.h \ menuitem-marshal.c \ server-marshal.h \ @@ -73,6 +78,16 @@ dbusmenu-client.h: dbus-menu.xml --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 \ + > client-marshal.h + +client-marshal.c: $(srcdir)/client-marshal.list + glib-genmarshal --body \ + --prefix=_dbusmenu_client_marshal $(srcdir)/client-marshal.list \ + > client-marshal.c + server-marshal.h: $(srcdir)/server-marshal.list glib-genmarshal --header \ --prefix=_dbusmenu_server_marshal $(srcdir)/server-marshal.list \ diff --git a/libdbusmenu-glib/client-marshal.list b/libdbusmenu-glib/client-marshal.list new file mode 100644 index 0000000..34e3956 --- /dev/null +++ b/libdbusmenu-glib/client-marshal.list @@ -0,0 +1 @@ +VOID: OBJECT, UINT diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index 25d64b6..7b1a762 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 "dbusmenu-client.h" #include "server-marshal.h" +#include "client-marshal.h" /* Properties */ enum { @@ -54,6 +55,7 @@ enum { LAYOUT_UPDATED, ROOT_CHANGED, NEW_MENUITEM, + ITEM_ACTIVATE, LAST_SIGNAL }; @@ -188,6 +190,22 @@ dbusmenu_client_class_init (DbusmenuClientClass *klass) NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, G_TYPE_OBJECT); + /** + DbusmenuClient::item-activate: + @arg0: The #DbusmenuClient object + @arg1: The #DbusmenuMenuitem activated + @arg2: A timestamp that the event happened at + + Signaled when the server wants to activate an item in + order to display the menu. + */ + signals[ITEM_ACTIVATE] = g_signal_new(DBUSMENU_CLIENT_SIGNAL_ITEM_ACTIVATE, + G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (DbusmenuClientClass, item_activate), + NULL, NULL, + _dbusmenu_client_marshal_VOID__OBJECT_UINT, + G_TYPE_NONE, 2, G_TYPE_OBJECT, G_TYPE_UINT); 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/client.h b/libdbusmenu-glib/client.h index 2b76f5e..6ca2232 100644 --- a/libdbusmenu-glib/client.h +++ b/libdbusmenu-glib/client.h @@ -46,6 +46,7 @@ G_BEGIN_DECLS #define DBUSMENU_CLIENT_SIGNAL_LAYOUT_UPDATED "layout-updated" #define DBUSMENU_CLIENT_SIGNAL_ROOT_CHANGED "root-changed" #define DBUSMENU_CLIENT_SIGNAL_NEW_MENUITEM "new-menuitem" +#define DBUSMENU_CLIENT_SIGNAL_ITEM_ACTIVATE "item-activate" #define DBUSMENU_CLIENT_PROP_DBUS_NAME "dbus-name" #define DBUSMENU_CLIENT_PROP_DBUS_OBJECT "dbus-object" @@ -59,10 +60,10 @@ G_BEGIN_DECLS @parent_class: #GObjectClass @layout_updated: Slot for #DbusmenuClient::layout-updated. @new_menuitem: Slot for #DbusmenuClient::new-menuitem. + @item_activate: Slote for #DbusmenuClient::item-activate. @reserved1: Reserved for future use. @reserved2: Reserved for future use. @reserved3: Reserved for future use. - @reserved4: Reserved for future use. A simple class that takes all of the information from a #DbusmenuServer over DBus and makes the same set of @@ -75,12 +76,13 @@ struct _DbusmenuClientClass { void (*layout_updated)(void); void (*root_changed) (DbusmenuMenuitem * newroot); void (*new_menuitem) (DbusmenuMenuitem * newitem); + void (*item_activate) (DbusmenuMenuitem * item, guint timestamp); /* Reserved for future use */ void (*reserved1) (void); void (*reserved2) (void); void (*reserved3) (void); - void (*reserved4) (void); + /* void (*reserved4) (void); */ }; /** -- cgit v1.2.3 From 8fd2e5cea3d717c2332aeefe9c74f6ac9bebe4af Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 17 Aug 2010 20:45:19 -0500 Subject: Passing the signal up the pipe --- libdbusmenu-glib/client.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index 7b1a762..cc91b32 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -618,6 +618,7 @@ item_activated (DBusGProxy * proxy, gint id, guint timestamp, DbusmenuClient * c return; } + g_signal_emit(G_OBJECT(client), signals[ITEM_ACTIVATE], 0, menuitem, timestamp, TRUE); return; } -- cgit v1.2.3 From 939c18d85dde7bdd5340c853c1f334b809fc65d1 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 17 Aug 2010 20:53:13 -0500 Subject: Connected into the item activate signal --- libdbusmenu-gtk/client.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/libdbusmenu-gtk/client.c b/libdbusmenu-gtk/client.c index b5b509f..e7761fb 100644 --- a/libdbusmenu-gtk/client.c +++ b/libdbusmenu-gtk/client.c @@ -54,6 +54,7 @@ static void new_menuitem (DbusmenuClient * client, DbusmenuMenuitem * mi, gpoint static void new_child (DbusmenuMenuitem * mi, DbusmenuMenuitem * child, guint position, DbusmenuGtkClient * gtkclient); static void delete_child (DbusmenuMenuitem * mi, DbusmenuMenuitem * child, DbusmenuGtkClient * gtkclient); static void move_child (DbusmenuMenuitem * mi, DbusmenuMenuitem * child, guint new, guint old, DbusmenuGtkClient * gtkclient); +static void item_activate (DbusmenuClient * client, DbusmenuMenuitem * mi, guint timestamp, gpointer userdata); static gboolean new_item_normal (DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, DbusmenuClient * client); static gboolean new_item_seperator (DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, DbusmenuClient * client); @@ -91,7 +92,9 @@ dbusmenu_gtkclient_init (DbusmenuGtkClient *self) dbusmenu_client_add_type_handler(DBUSMENU_CLIENT(self), DBUSMENU_CLIENT_TYPES_DEFAULT, new_item_normal); dbusmenu_client_add_type_handler(DBUSMENU_CLIENT(self), DBUSMENU_CLIENT_TYPES_SEPARATOR, new_item_seperator); + /* TODO: I think these can be handled in the class... */ g_signal_connect(G_OBJECT(self), DBUSMENU_CLIENT_SIGNAL_NEW_MENUITEM, G_CALLBACK(new_menuitem), NULL); + g_signal_connect(G_OBJECT(self), DBUSMENU_CLIENT_SIGNAL_ITEM_ACTIVATE, G_CALLBACK(item_activate), NULL); return; } @@ -431,6 +434,15 @@ new_menuitem (DbusmenuClient * client, DbusmenuMenuitem * mi, gpointer userdata) return; } +/* Signaled when we should show a menuitem at request of the application + that it is in. */ +static void +item_activate (DbusmenuClient * client, DbusmenuMenuitem * mi, guint timestamp, gpointer userdata) +{ + + return; +} + #ifdef MASSIVEDEBUGGING static void destroy_gmi (GtkMenuItem * gmi, DbusmenuMenuitem * mi) -- cgit v1.2.3 From 607107ea135b2579c30a9efff08c626538892045 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 18 Aug 2010 09:14:35 -0500 Subject: Activate the mnemonic when requested by the server --- libdbusmenu-gtk/client.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/libdbusmenu-gtk/client.c b/libdbusmenu-gtk/client.c index e7761fb..da81544 100644 --- a/libdbusmenu-gtk/client.c +++ b/libdbusmenu-gtk/client.c @@ -439,6 +439,22 @@ new_menuitem (DbusmenuClient * client, DbusmenuMenuitem * mi, gpointer userdata) static void item_activate (DbusmenuClient * client, DbusmenuMenuitem * mi, guint timestamp, gpointer userdata) { + gpointer pmenu = g_object_get_data(G_OBJECT(mi), data_menu); + if (pmenu == NULL) { + g_warning("Activated menu item doesn't have a menu? ID: %d", dbusmenu_menuitem_get_id(mi)); + return; + } + + GtkWidget * parent = gtk_widget_get_parent(GTK_WIDGET(pmenu)); + if (parent == NULL) { + g_warning("Activated menu item's menu doesn't have a parent? ID: %d", dbusmenu_menuitem_get_id(mi)); + return; + } + + if (!gtk_widget_mnemonic_activate(parent, FALSE)) { + g_warning("Unable to activate item: %d", dbusmenu_menuitem_get_id(mi)); + return; + } return; } -- cgit v1.2.3 From ced95a80cc2cf2664c171879069b5c9753379dd9 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 18 Aug 2010 09:39:11 -0500 Subject: releasing version 0.3.10-0ubuntu1~ppa2~activate1 --- debian/changelog | 5 +++-- libdbusmenu-glib/Makefile.in | 32 +++++++++++++++++++++++++++++++- 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/debian/changelog b/debian/changelog index e95d400..068282f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,9 +1,10 @@ -libdbusmenu (0.3.10-0ubuntu1~ppa2~activate1) UNRELEASED; urgency=low +libdbusmenu (0.3.10-0ubuntu1~ppa2~activate1) maverick; urgency=low * Upstream Merge * Support activation of menus client side + * Autogen - -- Ted Gould Wed, 18 Aug 2010 09:17:46 -0500 + -- Ted Gould Wed, 18 Aug 2010 09:39:09 -0500 libdbusmenu (0.3.10-0ubuntu1~ppa1) maverick; urgency=low diff --git a/libdbusmenu-glib/Makefile.in b/libdbusmenu-glib/Makefile.in index f04bf5a..2bcede7 100644 --- a/libdbusmenu-glib/Makefile.in +++ b/libdbusmenu-glib/Makefile.in @@ -43,7 +43,12 @@ subdir = libdbusmenu-glib DIST_COMMON = $(libdbusmenu_glibinclude_HEADERS) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/dbusmenu-glib.pc.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/gnome-doc-utils.m4 \ + $(top_srcdir)/m4/gtk-doc.m4 $(top_srcdir)/m4/intltool.m4 \ + $(top_srcdir)/m4/introspection.m4 $(top_srcdir)/m4/libtool.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs @@ -83,6 +88,7 @@ am_libdbusmenu_glib_la_OBJECTS = libdbusmenu_glib_la-menuitem.lo \ libdbusmenu_glib_la-menuitem-proxy.lo \ libdbusmenu_glib_la-server.lo \ libdbusmenu_glib_la-server-marshal.lo \ + libdbusmenu_glib_la-client-marshal.lo \ libdbusmenu_glib_la-client-menuitem.lo \ libdbusmenu_glib_la-client.lo libdbusmenu_glib_la_OBJECTS = $(am_libdbusmenu_glib_la_OBJECTS) @@ -297,6 +303,7 @@ CLEANFILES = $(am__append_2) EXTRA_DIST = \ dbusmenu-glib.pc.in \ dbus-menu.xml \ + client-marshal.list \ menuitem-marshal.list \ server-marshal.list @@ -324,6 +331,8 @@ libdbusmenu_glib_la_SOURCES = \ server.c \ server-marshal.h \ server-marshal.c \ + client-marshal.h \ + client-marshal.c \ client-menuitem.h \ client-menuitem.c \ client.h \ @@ -345,6 +354,8 @@ pkgconfigdir = $(libdir)/pkgconfig BUILT_SOURCES = \ dbusmenu-client.h \ dbusmenu-server.h \ + client-marshal.h \ + client-marshal.c \ menuitem-marshal.h \ menuitem-marshal.c \ server-marshal.h \ @@ -452,6 +463,7 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdbusmenu_glib_la-client-marshal.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdbusmenu_glib_la-client-menuitem.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdbusmenu_glib_la-client.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libdbusmenu_glib_la-menuitem-marshal.Plo@am__quote@ @@ -524,6 +536,14 @@ libdbusmenu_glib_la-server-marshal.lo: server-marshal.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdbusmenu_glib_la_CFLAGS) $(CFLAGS) -c -o libdbusmenu_glib_la-server-marshal.lo `test -f 'server-marshal.c' || echo '$(srcdir)/'`server-marshal.c +libdbusmenu_glib_la-client-marshal.lo: client-marshal.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdbusmenu_glib_la_CFLAGS) $(CFLAGS) -MT libdbusmenu_glib_la-client-marshal.lo -MD -MP -MF $(DEPDIR)/libdbusmenu_glib_la-client-marshal.Tpo -c -o libdbusmenu_glib_la-client-marshal.lo `test -f 'client-marshal.c' || echo '$(srcdir)/'`client-marshal.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libdbusmenu_glib_la-client-marshal.Tpo $(DEPDIR)/libdbusmenu_glib_la-client-marshal.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='client-marshal.c' object='libdbusmenu_glib_la-client-marshal.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdbusmenu_glib_la_CFLAGS) $(CFLAGS) -c -o libdbusmenu_glib_la-client-marshal.lo `test -f 'client-marshal.c' || echo '$(srcdir)/'`client-marshal.c + libdbusmenu_glib_la-client-menuitem.lo: client-menuitem.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libdbusmenu_glib_la_CFLAGS) $(CFLAGS) -MT libdbusmenu_glib_la-client-menuitem.lo -MD -MP -MF $(DEPDIR)/libdbusmenu_glib_la-client-menuitem.Tpo -c -o libdbusmenu_glib_la-client-menuitem.lo `test -f 'client-menuitem.c' || echo '$(srcdir)/'`client-menuitem.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libdbusmenu_glib_la-client-menuitem.Tpo $(DEPDIR)/libdbusmenu_glib_la-client-menuitem.Plo @@ -876,6 +896,16 @@ dbusmenu-client.h: dbus-menu.xml --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 \ + > client-marshal.h + +client-marshal.c: $(srcdir)/client-marshal.list + glib-genmarshal --body \ + --prefix=_dbusmenu_client_marshal $(srcdir)/client-marshal.list \ + > client-marshal.c + server-marshal.h: $(srcdir)/server-marshal.list glib-genmarshal --header \ --prefix=_dbusmenu_server_marshal $(srcdir)/server-marshal.list \ -- cgit v1.2.3 From 3cd94732c2393b0ff73b9e89f3ae4d300aedbaad Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 20 Aug 2010 09:21:21 -0500 Subject: Increasing the max size of the string --- libdbusmenu-glib/client.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index 73a7aac..4a93b8e 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -1225,7 +1225,8 @@ parse_layout (DbusmenuClient * client, const gchar * layout) xmlDocPtr xmldoc; - xmldoc = xmlReadMemory(layout, g_utf8_strlen(layout, 16*1024), "dbusmenu.xml", NULL, 0); + /* No one should need more characters than this! */ + xmldoc = xmlReadMemory(layout, g_utf8_strlen(layout, 1024*1024), "dbusmenu.xml", NULL, 0); xmlNodePtr root = xmlDocGetRootElement(xmldoc); -- cgit v1.2.3 From fc9d42883ae66f91ac330bd32bc3ffe31d88393c Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 20 Aug 2010 14:49:33 -0500 Subject: Adding the signal and function to show the menu item to the user. --- libdbusmenu-glib/menuitem.c | 36 ++++++++++++++++++++++++++++++++++++ libdbusmenu-glib/menuitem.h | 11 ++++++----- 2 files changed, 42 insertions(+), 5 deletions(-) diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index 623539c..ea69776 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -70,6 +70,7 @@ enum { CHILD_REMOVED, CHILD_MOVED, REALIZED, + SHOW_TO_USER, LAST_SIGNAL }; @@ -211,6 +212,22 @@ dbusmenu_menuitem_class_init (DbusmenuMenuitemClass *klass) NULL, NULL, _dbusmenu_menuitem_marshal_VOID__VOID, G_TYPE_NONE, 0, G_TYPE_NONE); + /** + DbusmenuMenuitem::show-to-user: + @arg0: The #DbusmenuMenuitem which should be shown. + @arg1: Timestamp the event happened at + + Signaled when the application would like the visualization + of this menu item shown to the user. This usually requires + going over the bus to get it done. + */ + signals[SHOW_TO_USER] = g_signal_new(DBUSMENU_MENUITEM_SIGNAL_SHOW_TO_USER, + G_TYPE_FROM_CLASS(klass), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET(DbusmenuMenuitemClass, show_to_user), + NULL, NULL, + g_cclosure_marshal_VOID__UINT, + G_TYPE_NONE, 1, G_TYPE_UINT, G_TYPE_NONE); g_object_class_install_property (object_class, PROP_ID, g_param_spec_int(PROP_ID_S, "ID for the menu item", @@ -1349,3 +1366,22 @@ dbusmenu_menuitem_send_about_to_show (DbusmenuMenuitem * mi, dbusmenu_menuitem_a return; } + +/** + dbusmenu_menuitem_show_to_user: + @mi: #DbusmenuMenuitem to show + @timestamp: The time that the user requested it to be shown + + Signals that this menu item should be shown to the user. If this is + server side the server will then take it and send it over the + bus. +*/ +void +dbusmenu_menuitem_show_to_user (DbusmenuMenuitem * mi, guint timestamp) +{ + g_return_if_fail(DBUSMENU_IS_MENUITEM(mi)); + + g_signal_emit(G_OBJECT(mi), signals[SHOW_TO_USER], 0, timestamp, TRUE); + + return; +} diff --git a/libdbusmenu-glib/menuitem.h b/libdbusmenu-glib/menuitem.h index e17d851..9be938b 100644 --- a/libdbusmenu-glib/menuitem.h +++ b/libdbusmenu-glib/menuitem.h @@ -49,6 +49,7 @@ G_BEGIN_DECLS #define DBUSMENU_MENUITEM_SIGNAL_CHILD_MOVED "child-moved" #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_PROP_TYPE "type" #define DBUSMENU_MENUITEM_PROP_VISIBLE "visible" @@ -124,10 +125,7 @@ typedef void (*dbusmenu_menuitem_buildxml_slot_t) (DbusmenuMenuitem * mi, GPtrAr * @buildxml: Virtual function that appends the strings required to represent this menu item in the menu XML file. * @handle_event: This function is to override how events are handled by subclasses. Look at #dbusmenu_menuitem_handle_event for lots of good information. * @send_about_to_show: Virtual function that notifies server that the client is about to show a menu. - * @reserved1: Reserved for future use. - * @reserved2: Reserved for future use. - * @reserved3: Reserved for future use. - * @reserved4: Reserved for future use. + * @show_to_user: Slot for #DbusmenuMenuitem::show-to-user. */ typedef struct _DbusmenuMenuitemClass DbusmenuMenuitemClass; struct _DbusmenuMenuitemClass @@ -147,7 +145,8 @@ struct _DbusmenuMenuitemClass void (*handle_event) (DbusmenuMenuitem * mi, const gchar * name, const GValue * value, guint timestamp); void (*send_about_to_show) (DbusmenuMenuitem * mi, dbusmenu_menuitem_about_to_show_cb cb, gpointer cb_data); - void (*reserved1) (void); + void (*show_to_user) (DbusmenuMenuitem * mi, guint timestamp, gpointer cb_data); + /* void (*reserved1) (void); */ /* void (*reserved2) (void); */ /* void (*reserved3) (void); */ /* void (*reserved4) (void); -- realized, realloc when bumping lib version */ @@ -192,6 +191,8 @@ void dbusmenu_menuitem_foreach (DbusmenuMenuitem * mi, void (*func) (DbusmenuMen void dbusmenu_menuitem_handle_event (DbusmenuMenuitem * mi, const gchar * name, const GValue * value, guint timestamp); void dbusmenu_menuitem_send_about_to_show (DbusmenuMenuitem * mi, dbusmenu_menuitem_about_to_show_cb cb, gpointer cb_data); +void dbusmenu_menuitem_show_to_user (DbusmenuMenuitem * mi, guint timestamp); + /** * SECTION:menuitem * @short_description: A lowlevel represenation of a menuitem -- cgit v1.2.3 From b2ab47c71a8a2e1d517c6594ae3f8bdf9e539285 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 20 Aug 2010 14:50:41 -0500 Subject: Changing to be the right signal in teh server --- libdbusmenu-glib/server.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c index d1b4888..26e7a0d 100644 --- a/libdbusmenu-glib/server.c +++ b/libdbusmenu-glib/server.c @@ -410,7 +410,7 @@ menuitem_child_moved (DbusmenuMenuitem * parent, DbusmenuMenuitem * child, guint /* Called when a menu item emits its activated signal so it gets passed across the bus. */ static void -menuitem_activated (DbusmenuMenuitem * mi, guint timestamp, DbusmenuServer * server) +menuitem_shown (DbusmenuMenuitem * mi, guint timestamp, DbusmenuServer * server) { g_signal_emit(G_OBJECT(server), signals[ITEM_ACTIVATION], 0, dbusmenu_menuitem_get_id(mi), timestamp, TRUE); return; @@ -425,7 +425,7 @@ menuitem_signals_create (DbusmenuMenuitem * mi, gpointer data) g_signal_connect(G_OBJECT(mi), DBUSMENU_MENUITEM_SIGNAL_CHILD_REMOVED, G_CALLBACK(menuitem_child_removed), data); g_signal_connect(G_OBJECT(mi), DBUSMENU_MENUITEM_SIGNAL_CHILD_MOVED, G_CALLBACK(menuitem_child_moved), data); g_signal_connect(G_OBJECT(mi), DBUSMENU_MENUITEM_SIGNAL_PROPERTY_CHANGED, G_CALLBACK(menuitem_property_changed), data); - g_signal_connect(G_OBJECT(mi), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(menuitem_activated), data); + g_signal_connect(G_OBJECT(mi), DBUSMENU_MENUITEM_SIGNAL_SHOW_TO_USER, G_CALLBACK(menuitem_shown), data); return; } -- cgit v1.2.3 From 8b9843002a14e8954404f4991db2a9a54988c06b Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 20 Aug 2010 16:39:12 -0500 Subject: Making it so that items show. --- libdbusmenu-gtk/client.c | 43 ++++++++++++++++++++++++++++++++++--------- 1 file changed, 34 insertions(+), 9 deletions(-) diff --git a/libdbusmenu-gtk/client.c b/libdbusmenu-gtk/client.c index da81544..4938601 100644 --- a/libdbusmenu-gtk/client.c +++ b/libdbusmenu-gtk/client.c @@ -434,27 +434,52 @@ new_menuitem (DbusmenuClient * client, DbusmenuMenuitem * mi, gpointer userdata) return; } +/* Goes through the tree of items and ensure's that all the items + above us are also displayed. */ +static void +activate_helper (GtkWidget * item) +{ + GtkWidget * parent = gtk_widget_get_parent(item); + + if (parent != NULL && GTK_IS_MENU_SHELL(parent)) { + GtkWidget * attach = NULL; + + if (GTK_IS_MENU(parent)) { + attach = gtk_menu_get_attach_widget(GTK_MENU(parent)); + } + + if (attach != NULL) { + activate_helper(attach); + } + + gtk_menu_shell_select_item(GTK_MENU_SHELL(parent), item); + } + + return; +} + /* Signaled when we should show a menuitem at request of the application that it is in. */ static void item_activate (DbusmenuClient * client, DbusmenuMenuitem * mi, guint timestamp, gpointer userdata) { - gpointer pmenu = g_object_get_data(G_OBJECT(mi), data_menu); - if (pmenu == NULL) { + gpointer pitem = g_object_get_data(G_OBJECT(mi), data_menuitem); + if (pitem == NULL) { g_warning("Activated menu item doesn't have a menu? ID: %d", dbusmenu_menuitem_get_id(mi)); return; } - GtkWidget * parent = gtk_widget_get_parent(GTK_WIDGET(pmenu)); - if (parent == NULL) { - g_warning("Activated menu item's menu doesn't have a parent? ID: %d", dbusmenu_menuitem_get_id(mi)); + gpointer pmenu = g_object_get_data(G_OBJECT(mi), data_menu); + if (pmenu == NULL) { + g_warning("Activated menu item doesn't have a menu? ID: %d", dbusmenu_menuitem_get_id(mi)); return; } - if (!gtk_widget_mnemonic_activate(parent, FALSE)) { - g_warning("Unable to activate item: %d", dbusmenu_menuitem_get_id(mi)); - return; - } + GtkWidget * item = GTK_WIDGET(pitem); + + activate_helper(item); + + gtk_menu_shell_select_first(GTK_MENU_SHELL(pmenu), FALSE); return; } -- cgit v1.2.3 From 49ff3029a6cc08287e39371f079dc2109a896901 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 20 Aug 2010 16:47:06 -0500 Subject: Restructuring so that we pass the menu --- libdbusmenu-gtk/client.c | 36 +++++++++++++++--------------------- 1 file changed, 15 insertions(+), 21 deletions(-) diff --git a/libdbusmenu-gtk/client.c b/libdbusmenu-gtk/client.c index 4938601..44f95fe 100644 --- a/libdbusmenu-gtk/client.c +++ b/libdbusmenu-gtk/client.c @@ -437,22 +437,25 @@ new_menuitem (DbusmenuClient * client, DbusmenuMenuitem * mi, gpointer userdata) /* Goes through the tree of items and ensure's that all the items above us are also displayed. */ static void -activate_helper (GtkWidget * item) +activate_helper (GtkMenuShell * shell) { - GtkWidget * parent = gtk_widget_get_parent(item); + if (shell == NULL) { + return; + } - if (parent != NULL && GTK_IS_MENU_SHELL(parent)) { - GtkWidget * attach = NULL; - - if (GTK_IS_MENU(parent)) { - attach = gtk_menu_get_attach_widget(GTK_MENU(parent)); - } + if (GTK_IS_MENU(shell)) { + GtkWidget * attach = gtk_menu_get_attach_widget(GTK_MENU(shell)); if (attach != NULL) { - activate_helper(attach); - } + GtkWidget * parent = gtk_widget_get_parent(GTK_WIDGET(attach)); - gtk_menu_shell_select_item(GTK_MENU_SHELL(parent), item); + if (parent != NULL) { + if (GTK_IS_MENU(parent)) { + activate_helper(GTK_MENU_SHELL(parent)); + } + gtk_menu_shell_select_item(GTK_MENU_SHELL(parent), attach); + } + } } return; @@ -463,22 +466,13 @@ activate_helper (GtkWidget * item) static void item_activate (DbusmenuClient * client, DbusmenuMenuitem * mi, guint timestamp, gpointer userdata) { - gpointer pitem = g_object_get_data(G_OBJECT(mi), data_menuitem); - if (pitem == NULL) { - g_warning("Activated menu item doesn't have a menu? ID: %d", dbusmenu_menuitem_get_id(mi)); - return; - } - gpointer pmenu = g_object_get_data(G_OBJECT(mi), data_menu); if (pmenu == NULL) { g_warning("Activated menu item doesn't have a menu? ID: %d", dbusmenu_menuitem_get_id(mi)); return; } - GtkWidget * item = GTK_WIDGET(pitem); - - activate_helper(item); - + activate_helper(GTK_MENU_SHELL(pmenu)); gtk_menu_shell_select_first(GTK_MENU_SHELL(pmenu), FALSE); return; -- cgit v1.2.3 From b8b16bdfc5f52a306bacaa34776c3d159e16fbc2 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 20 Aug 2010 16:52:02 -0500 Subject: Showing items as part of the test to ensure we don't break. --- tests/test-gtk-submenu-client.c | 9 ++++++++- tests/test-gtk-submenu-server.c | 17 ++++++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/tests/test-gtk-submenu-client.c b/tests/test-gtk-submenu-client.c index 2e1ef7a..ec46122 100644 --- a/tests/test-gtk-submenu-client.c +++ b/tests/test-gtk-submenu-client.c @@ -102,6 +102,12 @@ timer_func (gpointer data) } passed = TRUE; + return FALSE; +} + +gboolean +finished_func (gpointer user_data) +{ g_main_loop_quit(mainloop); return FALSE; } @@ -127,7 +133,8 @@ main (int argc, char ** argv) gtk_window_set_title(GTK_WINDOW(window), "libdbusmenu-gtk test"); gtk_widget_show(window); - g_timeout_add_seconds(1, timer_func, menuitem); + g_timeout_add_seconds(2, timer_func, menuitem); + g_timeout_add_seconds(6, finished_func, menuitem); g_debug("Entering Mainloop"); mainloop = g_main_loop_new(NULL, FALSE); diff --git a/tests/test-gtk-submenu-server.c b/tests/test-gtk-submenu-server.c index ba3993e..11cede0 100644 --- a/tests/test-gtk-submenu-server.c +++ b/tests/test-gtk-submenu-server.c @@ -39,6 +39,17 @@ timer_func (gpointer data) return FALSE; } +static gboolean +show_item (gpointer pmi) +{ + DbusmenuMenuitem * mi = DBUSMENU_MENUITEM(pmi); + g_debug("Showing item"); + + dbusmenu_menuitem_show_to_user(mi, 0); + + return FALSE; +} + DbusmenuMenuitem * add_item(DbusmenuMenuitem * parent, const char * label) { @@ -81,12 +92,16 @@ main (int argc, char ** argv) add_item(item, "1.2"); add_item(item, "1.3"); + g_timeout_add_seconds(2, show_item, item); + item = add_item(root, "Folder 2"); add_item(item, "2.1"); add_item(item, "2.2"); add_item(item, "2.3"); - g_timeout_add_seconds(3, timer_func, NULL); + g_timeout_add_seconds(4, show_item, item); + + g_timeout_add_seconds(6, timer_func, NULL); mainloop = g_main_loop_new(NULL, FALSE); g_main_loop_run(mainloop); -- cgit v1.2.3 From 8156d1d7abd95d7f4c0cb564bb9e3c4921a87b60 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 23 Aug 2010 09:25:40 -0500 Subject: Adding a check on the client object from code review --- libdbusmenu-glib/client.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index cc91b32..0a06c5e 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -605,6 +605,8 @@ get_properties_globber (DbusmenuClient * client, gint id, const gchar ** propert static void item_activated (DBusGProxy * proxy, gint id, guint timestamp, DbusmenuClient * client) { + g_return_if_fail(DBUSMENU_IS_CLIENT(client)); + DbusmenuClientPrivate * priv = DBUSMENU_CLIENT_GET_PRIVATE(client); if (priv->root == NULL) { -- cgit v1.2.3 From dbb73479cfd68cfc0e61dd8d9d65f5356e698aef Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 25 Aug 2010 13:26:19 -0500 Subject: releasing version 0.3.11-0ubuntu1~ppa2 --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 14081c6..abe3914 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,10 +1,10 @@ -libdbusmenu (0.3.11-0ubuntu1~ppa2) UNRELEASED; urgency=low +libdbusmenu (0.3.11-0ubuntu1~ppa2) maverick; urgency=low * Upstream Merge * Support activation of menus client side * Autogen - -- Ted Gould Wed, 25 Aug 2010 13:20:30 -0500 + -- Ted Gould Wed, 25 Aug 2010 13:26:16 -0500 libdbusmenu (0.3.11-0ubuntu1~ppa1) maverick; urgency=low -- cgit v1.2.3 From 985ae78d54febec59f11ce58984d8adc59e84baf Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 26 Aug 2010 10:28:12 -0500 Subject: Adding an event-error slot --- libdbusmenu-glib/client.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libdbusmenu-glib/client.h b/libdbusmenu-glib/client.h index 6ca2232..dcbe5c2 100644 --- a/libdbusmenu-glib/client.h +++ b/libdbusmenu-glib/client.h @@ -60,10 +60,10 @@ G_BEGIN_DECLS @parent_class: #GObjectClass @layout_updated: Slot for #DbusmenuClient::layout-updated. @new_menuitem: Slot for #DbusmenuClient::new-menuitem. - @item_activate: Slote for #DbusmenuClient::item-activate. + @item_activate: Slot for #DbusmenuClient::item-activate. + @event_error: Slot for #DbusmenuClient::event-error. @reserved1: Reserved for future use. @reserved2: Reserved for future use. - @reserved3: Reserved for future use. A simple class that takes all of the information from a #DbusmenuServer over DBus and makes the same set of @@ -77,11 +77,12 @@ struct _DbusmenuClientClass { void (*root_changed) (DbusmenuMenuitem * newroot); void (*new_menuitem) (DbusmenuMenuitem * newitem); void (*item_activate) (DbusmenuMenuitem * item, guint timestamp); + void (*event_error) (DbusmenuMenuitem * item, gchar * event, GValue * data, guint timestamp); /* Reserved for future use */ void (*reserved1) (void); void (*reserved2) (void); - void (*reserved3) (void); + /* void (*reserved3) (void); */ /* void (*reserved4) (void); */ }; -- cgit v1.2.3 From ffd29638de796d57380def939ef23c7ad8e892cd Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 26 Aug 2010 10:34:33 -0500 Subject: Creating a signal for the error situation on the signal. --- libdbusmenu-glib/client-marshal.list | 1 + libdbusmenu-glib/client.c | 19 +++++++++++++++++++ libdbusmenu-glib/client.h | 1 + 3 files changed, 21 insertions(+) diff --git a/libdbusmenu-glib/client-marshal.list b/libdbusmenu-glib/client-marshal.list index 34e3956..f1d6a9f 100644 --- a/libdbusmenu-glib/client-marshal.list +++ b/libdbusmenu-glib/client-marshal.list @@ -1 +1,2 @@ VOID: OBJECT, UINT +VOID: OBJECT, STRING, POINTER, UINT diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index d88478c..ac9561e 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -56,6 +56,7 @@ enum { ROOT_CHANGED, NEW_MENUITEM, ITEM_ACTIVATE, + EVENT_ERROR, LAST_SIGNAL }; @@ -206,6 +207,24 @@ dbusmenu_client_class_init (DbusmenuClientClass *klass) NULL, NULL, _dbusmenu_client_marshal_VOID__OBJECT_UINT, G_TYPE_NONE, 2, G_TYPE_OBJECT, G_TYPE_UINT); + /** + DbusmenuClient::event-error: + @arg0: The #DbusmenuClient object + @arg1: The #DbusmenuMenuitem sent an event + @arg2: The ID of the event sent + @arg3: The data sent along with the event + @arg4: A timestamp that the event happened at + + Signal sent to show that there was an error in sending the event + to the server. + */ + signals[ITEM_ACTIVATE] = g_signal_new(DBUSMENU_CLIENT_SIGNAL_EVENT_ERROR, + G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (DbusmenuClientClass, event_error), + NULL, NULL, + _dbusmenu_client_marshal_VOID__OBJECT_STRING_POINTER_UINT, + G_TYPE_NONE, 4, G_TYPE_OBJECT, G_TYPE_STRING, G_TYPE_POINTER, G_TYPE_UINT); 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/client.h b/libdbusmenu-glib/client.h index dcbe5c2..24d8f57 100644 --- a/libdbusmenu-glib/client.h +++ b/libdbusmenu-glib/client.h @@ -47,6 +47,7 @@ G_BEGIN_DECLS #define DBUSMENU_CLIENT_SIGNAL_ROOT_CHANGED "root-changed" #define DBUSMENU_CLIENT_SIGNAL_NEW_MENUITEM "new-menuitem" #define DBUSMENU_CLIENT_SIGNAL_ITEM_ACTIVATE "item-activate" +#define DBUSMENU_CLIENT_SIGNAL_EVENT_ERROR "event-error" #define DBUSMENU_CLIENT_PROP_DBUS_NAME "dbus-name" #define DBUSMENU_CLIENT_PROP_DBUS_OBJECT "dbus-object" -- cgit v1.2.3 From 9a8c525d75c3f92351c0e60f15504d061fde4160 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 26 Aug 2010 10:56:29 -0500 Subject: Building a data structure to track all the data we need to emit the event error signal --- libdbusmenu-glib/client.c | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index ac9561e..5d0325a 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -103,6 +103,16 @@ struct _properties_listener_t { gboolean replied; }; +typedef struct _event_data_t event_data_t; +struct _event_data_t { + DbusmenuClient * client; + DbusmenuMenuitem * menuitem; + gchar * event; + GValue data; + guint timestamp; +}; + + #define DBUSMENU_CLIENT_GET_PRIVATE(o) \ (G_TYPE_INSTANCE_GET_PRIVATE ((o), DBUSMENU_TYPE_CLIENT, DbusmenuClientPrivate)) @@ -1044,10 +1054,18 @@ menuitem_get_properties_new_cb (DBusGProxy * proxy, GHashTable * properties, GEr static void menuitem_call_cb (DBusGProxy * proxy, GError * error, gpointer userdata) { + event_data_t * edata = (event_data_t *)userdata; + if (error != NULL) { g_warning("Unable to call menu item %d: %s", GPOINTER_TO_INT(userdata), error->message); + g_signal_emit(edata->client, signals[EVENT_ERROR], 0, edata->menuitem, edata->event, edata->data, edata->timestamp, TRUE); } + g_value_unset(&edata->data); + g_free(edata->event); + g_object_unref(edata->menuitem); + g_free(edata); + return; } @@ -1060,6 +1078,13 @@ dbusmenu_client_send_event (DbusmenuClient * client, gint id, const gchar * name g_return_if_fail(id >= 0); g_return_if_fail(name != NULL); + DbusmenuClientPrivate * priv = DBUSMENU_CLIENT_GET_PRIVATE(client); + DbusmenuMenuitem * mi = dbusmenu_menuitem_find_id(priv->root, id); + if (mi == NULL) { + g_warning("Asked to activate a menuitem %d that we don't know about", id); + return; + } + if (value == NULL) { GValue internalval = {0}; g_value_init(&internalval, G_TYPE_INT); @@ -1067,8 +1092,16 @@ dbusmenu_client_send_event (DbusmenuClient * client, gint id, const gchar * name value = &internalval; } - DbusmenuClientPrivate * priv = DBUSMENU_CLIENT_GET_PRIVATE(client); - org_ayatana_dbusmenu_event_async (priv->menuproxy, id, name, value, timestamp, menuitem_call_cb, GINT_TO_POINTER(id)); + event_data_t * edata = g_new0(event_data_t, 1); + edata->client = client; + 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; + + org_ayatana_dbusmenu_event_async (priv->menuproxy, id, name, value, timestamp, menuitem_call_cb, edata); return; } -- cgit v1.2.3 From db3d95c01f91456d042c507c9dfe91e75276c5e8 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 26 Aug 2010 14:17:39 -0500 Subject: Removing death timer message --- tests/test-gtk-label-client.c | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/test-gtk-label-client.c b/tests/test-gtk-label-client.c index 070c278..4316b8e 100644 --- a/tests/test-gtk-label-client.c +++ b/tests/test-gtk-label-client.c @@ -105,7 +105,6 @@ verify_root_to_layout(DbusmenuMenuitem * mi, proplayout_t * layout) static gboolean timer_func (gpointer data) { - g_debug("Death timer. Oops. Got to: %d", layouton); passed = TRUE; g_main_loop_quit(mainloop); return FALSE; -- cgit v1.2.3 From 21e96fee225eab6ee2bee051c90a7458cf867b7f Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 26 Aug 2010 14:45:26 -0500 Subject: Changing to result instead of just errors. --- libdbusmenu-glib/client-marshal.list | 2 +- libdbusmenu-glib/client.c | 14 ++++++++------ libdbusmenu-glib/client.h | 6 +++--- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/libdbusmenu-glib/client-marshal.list b/libdbusmenu-glib/client-marshal.list index f1d6a9f..2e14491 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 +VOID: OBJECT, STRING, POINTER, UINT, POINTER diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index 5d0325a..43bde5f 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -56,7 +56,7 @@ enum { ROOT_CHANGED, NEW_MENUITEM, ITEM_ACTIVATE, - EVENT_ERROR, + EVENT_RESULT, LAST_SIGNAL }; @@ -224,17 +224,18 @@ dbusmenu_client_class_init (DbusmenuClientClass *klass) @arg2: The ID of the event sent @arg3: The data sent along with the event @arg4: A timestamp that the event happened at + @arg5: Possibly the error in sending the event (or NULL) Signal sent to show that there was an error in sending the event to the server. */ - signals[ITEM_ACTIVATE] = g_signal_new(DBUSMENU_CLIENT_SIGNAL_EVENT_ERROR, + signals[EVENT_RESULT] = g_signal_new(DBUSMENU_CLIENT_SIGNAL_EVENT_RESULT, G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (DbusmenuClientClass, event_error), + G_STRUCT_OFFSET (DbusmenuClientClass, event_result), NULL, NULL, - _dbusmenu_client_marshal_VOID__OBJECT_STRING_POINTER_UINT, - G_TYPE_NONE, 4, G_TYPE_OBJECT, G_TYPE_STRING, G_TYPE_POINTER, G_TYPE_UINT); + _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); g_object_class_install_property (object_class, PROP_DBUSOBJECT, g_param_spec_string(DBUSMENU_CLIENT_PROP_DBUS_OBJECT, "DBus Object we represent", @@ -1058,9 +1059,10 @@ menuitem_call_cb (DBusGProxy * proxy, GError * error, gpointer userdata) if (error != NULL) { g_warning("Unable to call menu item %d: %s", GPOINTER_TO_INT(userdata), error->message); - g_signal_emit(edata->client, signals[EVENT_ERROR], 0, edata->menuitem, edata->event, edata->data, edata->timestamp, TRUE); } + g_signal_emit(edata->client, signals[EVENT_RESULT], 0, edata->menuitem, edata->event, edata->data, edata->timestamp, error, TRUE); + g_value_unset(&edata->data); g_free(edata->event); g_object_unref(edata->menuitem); diff --git a/libdbusmenu-glib/client.h b/libdbusmenu-glib/client.h index 24d8f57..5d4b5c3 100644 --- a/libdbusmenu-glib/client.h +++ b/libdbusmenu-glib/client.h @@ -47,7 +47,7 @@ G_BEGIN_DECLS #define DBUSMENU_CLIENT_SIGNAL_ROOT_CHANGED "root-changed" #define DBUSMENU_CLIENT_SIGNAL_NEW_MENUITEM "new-menuitem" #define DBUSMENU_CLIENT_SIGNAL_ITEM_ACTIVATE "item-activate" -#define DBUSMENU_CLIENT_SIGNAL_EVENT_ERROR "event-error" +#define DBUSMENU_CLIENT_SIGNAL_EVENT_RESULT "event-result" #define DBUSMENU_CLIENT_PROP_DBUS_NAME "dbus-name" #define DBUSMENU_CLIENT_PROP_DBUS_OBJECT "dbus-object" @@ -62,7 +62,7 @@ G_BEGIN_DECLS @layout_updated: Slot for #DbusmenuClient::layout-updated. @new_menuitem: Slot for #DbusmenuClient::new-menuitem. @item_activate: Slot for #DbusmenuClient::item-activate. - @event_error: Slot for #DbusmenuClient::event-error. + @event_result: Slot for #DbusmenuClient::event-error. @reserved1: Reserved for future use. @reserved2: Reserved for future use. @@ -78,7 +78,7 @@ struct _DbusmenuClientClass { void (*root_changed) (DbusmenuMenuitem * newroot); void (*new_menuitem) (DbusmenuMenuitem * newitem); void (*item_activate) (DbusmenuMenuitem * item, guint timestamp); - void (*event_error) (DbusmenuMenuitem * item, gchar * event, GValue * data, guint timestamp); + void (*event_result) (DbusmenuMenuitem * item, gchar * event, GValue * data, guint timestamp, GError * error); /* Reserved for future use */ void (*reserved1) (void); -- cgit v1.2.3 From 510263800720ca5f8980ade0a3d0e9d564b3ddff Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 26 Aug 2010 15:18:19 -0500 Subject: Removing unused variable --- tests/test-gtk-label-client.c | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/test-gtk-label-client.c b/tests/test-gtk-label-client.c index 4316b8e..14eb5bd 100644 --- a/tests/test-gtk-label-client.c +++ b/tests/test-gtk-label-client.c @@ -22,7 +22,6 @@ with this program. If not, see . #include #include -static guint layouton = 0; static GMainLoop * mainloop = NULL; static gboolean passed = TRUE; static guint death_timer = 0; -- cgit v1.2.3 From 34824cf6f98cd623b0368e4dbc9eaf65110572d1 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 26 Aug 2010 15:21:59 -0500 Subject: 0.3.12 --- configure.ac | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index a5c8248..5ccf9c3 100644 --- a/configure.ac +++ b/configure.ac @@ -1,11 +1,11 @@ -AC_INIT(libdbusmenu, 0.3.11, ted@canonical.com) +AC_INIT(libdbusmenu, 0.3.12, ted@canonical.com) AC_COPYRIGHT([Copyright 2009,2010 Canonical]) AC_PREREQ(2.62) AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(libdbusmenu, 0.3.11, [-Wno-portability]) +AM_INIT_AUTOMAKE(libdbusmenu, 0.3.12, [-Wno-portability]) AM_MAINTAINER_MODE @@ -99,7 +99,7 @@ AC_PATH_PROG([VALA_API_GEN], [vapigen]) ########################### LIBDBUSMENU_CURRENT=1 -LIBDBUSMENU_REVISION=13 +LIBDBUSMENU_REVISION=14 LIBDBUSMENU_AGE=0 AC_SUBST(LIBDBUSMENU_CURRENT) -- cgit v1.2.3 From 411bc164d198eda669a4bf48de2510c80f94702d Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 26 Aug 2010 15:35:47 -0500 Subject: releasing version 0.3.12-0ubuntu1~ppa1 --- debian/changelog | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/debian/changelog b/debian/changelog index 1e422b0..af28c50 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,11 +1,11 @@ -libdbusmenu (0.3.12-0ubuntu1~ppa1) UNRELEASED; urgency=low +libdbusmenu (0.3.12-0ubuntu1~ppa1) maverick; urgency=low * New upstream release. * Support activation of menus client side - * Increase layout XML size + * Increase layout XML size (LP: #621238) * Display an event for the status of the signal to the server - -- Ted Gould Thu, 26 Aug 2010 15:27:19 -0500 + -- Ted Gould Thu, 26 Aug 2010 15:35:19 -0500 libdbusmenu (0.3.11-0ubuntu1) maverick; urgency=low -- cgit v1.2.3