← Back to team overview

ayatana-commits team mailing list archive

[Branch ~dbusmenu-team/dbusmenu/trunk] Rev 163: Activating items with submenus on about to show

 

Merge authors:
  Ted Gould (ted)
Related merge proposals:
  https://code.launchpad.net/~ted/dbusmenu/about-to-show-is-activate/+merge/35892
  proposed by: Ted Gould (ted)
  review: Approve - David Barth (dbarth)
------------------------------------------------------------
revno: 163 [merge]
committer: Ted Gould <ted@xxxxxxxx>
branch nick: trunk
timestamp: Tue 2010-09-21 16:41:18 -0500
message:
  Activating items with submenus on about to show
modified:
  libdbusmenu-glib/menuitem.c


--
lp:dbusmenu
https://code.launchpad.net/~dbusmenu-team/dbusmenu/trunk

Your team ayatana-commits is subscribed to branch lp:dbusmenu.
To unsubscribe from this branch go to https://code.launchpad.net/~dbusmenu-team/dbusmenu/trunk/+edit-subscription
=== 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:33:38 +0000
@@ -97,6 +97,7 @@
 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 send_about_to_show (DbusmenuMenuitem * mi, dbusmenu_menuitem_about_to_show_cb cb, gpointer cb_data);
 
 /* GObject stuff */
 G_DEFINE_TYPE (DbusmenuMenuitem, dbusmenu_menuitem, G_TYPE_OBJECT);
@@ -114,6 +115,7 @@
 	object_class->get_property = get_property;
 
 	klass->handle_event = handle_event;
+	klass->send_about_to_show = send_about_to_show;
 
 	/**
 		DbusmenuMenuitem::property-changed:
@@ -387,6 +389,28 @@
 	return;
 }
 
+/* Handles our about to show signal on items that submenus
+   exist.  This is sending just activate now, but we should
+   probably consider a special signal in the future if GTK
+   gets more sophisticated about this. */
+static void
+send_about_to_show (DbusmenuMenuitem * mi, dbusmenu_menuitem_about_to_show_cb cb, gpointer cb_data)
+{
+	g_return_if_fail(DBUSMENU_IS_MENUITEM(mi));
+
+	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);
+	}
+
+	if (cb != NULL) {
+		cb(mi, cb_data);
+	}
+
+	return;
+}
+
 /* Public interface */
 
 /**