Merge lp:~ted/libdbusmenu/about-to-show-is-activate into lp:libdbusmenu/0.5

Proposed by Ted Gould
Status: Merged
Merged at revision: 163
Proposed branch: lp:~ted/libdbusmenu/about-to-show-is-activate
Merge into: lp:libdbusmenu/0.5
Diff against target: 48 lines (+24/-0)
1 file modified
libdbusmenu-glib/menuitem.c (+24/-0)
To merge this branch: bzr merge lp:~ted/libdbusmenu/about-to-show-is-activate
Reviewer Review Type Date Requested Status
David Barth (community) Approve
Review via email: mp+35892@code.launchpad.net

Description of the change

Making it so that we pass about-to-show up to menu items with children as activate

To post a comment you must log in.
Revision history for this message
David Barth (dbarth) wrote :

What's the rational for not sending activate signals if there are no submenus?

Otherwise looks like what is needed. Glad to see about-to-show connected on the gtk side as well.

Revision history for this message
David Barth (dbarth) wrote :

Moving on with the merge proposal: +1, as anyway it's a new feature, so the submenu restriction doesn't impact existing code.

review: Approve
Revision history for this message
Ted Gould (ted) wrote :

On Mon, 2010-09-20 at 15:51 +0000, David Barth wrote:
> What's the rational for not sending activate signals if there are no submenus?

Basically because GTK doesn't separate between "about to show" and
"activate." So it seems that some people (Shotwell) are using the
"activate" signal as about-to-show, but in reality if we did that for
other menus items people would be pressing things all over the place :)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'libdbusmenu-glib/menuitem.c'
--- libdbusmenu-glib/menuitem.c 2010-08-20 19:49:33 +0000
+++ libdbusmenu-glib/menuitem.c 2010-09-17 21:38:43 +0000
@@ -97,6 +97,7 @@
97static void g_value_transform_STRING_BOOLEAN (const GValue * in, GValue * out);97static void g_value_transform_STRING_BOOLEAN (const GValue * in, GValue * out);
98static void g_value_transform_STRING_INT (const GValue * in, GValue * out);98static void g_value_transform_STRING_INT (const GValue * in, GValue * out);
99static void handle_event (DbusmenuMenuitem * mi, const gchar * name, const GValue * value, guint timestamp);99static void handle_event (DbusmenuMenuitem * mi, const gchar * name, const GValue * value, guint timestamp);
100static void send_about_to_show (DbusmenuMenuitem * mi, dbusmenu_menuitem_about_to_show_cb cb, gpointer cb_data);
100101
101/* GObject stuff */102/* GObject stuff */
102G_DEFINE_TYPE (DbusmenuMenuitem, dbusmenu_menuitem, G_TYPE_OBJECT);103G_DEFINE_TYPE (DbusmenuMenuitem, dbusmenu_menuitem, G_TYPE_OBJECT);
@@ -114,6 +115,7 @@
114 object_class->get_property = get_property;115 object_class->get_property = get_property;
115116
116 klass->handle_event = handle_event;117 klass->handle_event = handle_event;
118 klass->send_about_to_show = send_about_to_show;
117119
118 /**120 /**
119 DbusmenuMenuitem::property-changed:121 DbusmenuMenuitem::property-changed:
@@ -387,6 +389,28 @@
387 return;389 return;
388}390}
389391
392/* Handles our about to show signal on items that submenus
393 exist. This is sending just activate now, but we should
394 probably consider a special signal in the future if GTK
395 gets more sophisticated about this. */
396static void
397send_about_to_show (DbusmenuMenuitem * mi, dbusmenu_menuitem_about_to_show_cb cb, gpointer cb_data)
398{
399 g_return_if_fail(DBUSMENU_IS_MENUITEM(mi));
400
401 if (dbusmenu_menuitem_get_children(mi) == NULL) {
402 g_warning("About to Show called on an item wihtout submenus. We're ignoring it.");
403 } else {
404 g_signal_emit(G_OBJECT(mi), signals[ITEM_ACTIVATED], 0, 0 /* timestamp */, TRUE);
405 }
406
407 if (cb != NULL) {
408 cb(mi, cb_data);
409 }
410
411 return;
412}
413
390/* Public interface */414/* Public interface */
391415
392/**416/**

Subscribers

People subscribed via source and target branches