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
1=== modified file 'libdbusmenu-glib/menuitem.c'
2--- libdbusmenu-glib/menuitem.c 2010-08-20 19:49:33 +0000
3+++ libdbusmenu-glib/menuitem.c 2010-09-17 21:38:43 +0000
4@@ -97,6 +97,7 @@
5 static void g_value_transform_STRING_BOOLEAN (const GValue * in, GValue * out);
6 static void g_value_transform_STRING_INT (const GValue * in, GValue * out);
7 static void handle_event (DbusmenuMenuitem * mi, const gchar * name, const GValue * value, guint timestamp);
8+static void send_about_to_show (DbusmenuMenuitem * mi, dbusmenu_menuitem_about_to_show_cb cb, gpointer cb_data);
9
10 /* GObject stuff */
11 G_DEFINE_TYPE (DbusmenuMenuitem, dbusmenu_menuitem, G_TYPE_OBJECT);
12@@ -114,6 +115,7 @@
13 object_class->get_property = get_property;
14
15 klass->handle_event = handle_event;
16+ klass->send_about_to_show = send_about_to_show;
17
18 /**
19 DbusmenuMenuitem::property-changed:
20@@ -387,6 +389,28 @@
21 return;
22 }
23
24+/* Handles our about to show signal on items that submenus
25+ exist. This is sending just activate now, but we should
26+ probably consider a special signal in the future if GTK
27+ gets more sophisticated about this. */
28+static void
29+send_about_to_show (DbusmenuMenuitem * mi, dbusmenu_menuitem_about_to_show_cb cb, gpointer cb_data)
30+{
31+ g_return_if_fail(DBUSMENU_IS_MENUITEM(mi));
32+
33+ if (dbusmenu_menuitem_get_children(mi) == NULL) {
34+ g_warning("About to Show called on an item wihtout submenus. We're ignoring it.");
35+ } else {
36+ g_signal_emit(G_OBJECT(mi), signals[ITEM_ACTIVATED], 0, 0 /* timestamp */, TRUE);
37+ }
38+
39+ if (cb != NULL) {
40+ cb(mi, cb_data);
41+ }
42+
43+ return;
44+}
45+
46 /* Public interface */
47
48 /**

Subscribers

People subscribed via source and target branches