← Back to team overview

ayatana-commits team mailing list archive

[Merge] lp:~ted/dbusmenu/open-menu-signal into lp:dbusmenu

 

Ted Gould has proposed merging lp:~ted/dbusmenu/open-menu-signal into lp:dbusmenu.

Requested reviews:
  DBus Menu Team (dbusmenu-team)


This is the signal for opening the menu from the application side.  Right now it just connects everything on the server side, but doesn't handle the client side.  Also it has no tests.  But it should be enough to not block folks, and you should be able to see the signal in bustle for testing.
-- 
https://code.launchpad.net/~ted/dbusmenu/open-menu-signal/+merge/30472
Your team ayatana-commits is subscribed to branch lp:dbusmenu.
=== modified file 'libdbusmenu-glib/dbus-menu.xml'
--- libdbusmenu-glib/dbus-menu.xml	2010-06-07 12:30:52 +0000
+++ libdbusmenu-glib/dbus-menu.xml	2010-07-20 21:32:50 +0000
@@ -344,6 +344,20 @@
 				</dox:d>
 			</arg>
 		</signal>
+		<signal name="ItemActivationRequested">
+			<dox:d>
+			  The server is requesting that all clients displaying this
+			  menu open it to the user.  This would be for things like
+			  hotkeys that when the user presses them the menu should
+			  open and display itself to the user.
+			</dox:d>
+			<arg type="i" name="id" direction="out" >
+				<dox:d>ID of the menu that should be activated</dox:d>
+			</arg>
+			<arg type="u" name="timestamp" direction="out" >
+				<dox:d>The time that the event occured</dox:d>
+			</arg>
+		</signal>
 
 <!-- End of interesting stuff -->
 

=== modified file 'libdbusmenu-glib/server-marshal.list'
--- libdbusmenu-glib/server-marshal.list	2010-02-09 16:52:21 +0000
+++ libdbusmenu-glib/server-marshal.list	2010-07-20 21:32:50 +0000
@@ -1,2 +1,3 @@
 VOID: INT, STRING, POINTER
 VOID: UINT, INT
+VOID: INT, UINT

=== modified file 'libdbusmenu-glib/server.c'
--- libdbusmenu-glib/server.c	2010-07-02 13:47:23 +0000
+++ libdbusmenu-glib/server.c	2010-07-20 21:32:50 +0000
@@ -65,6 +65,7 @@
 	ID_PROP_UPDATE,
 	ID_UPDATE,
 	LAYOUT_UPDATED,
+	ITEM_ACTIVATION,
 	LAST_SIGNAL
 };
 
@@ -165,6 +166,22 @@
 	                                         NULL, NULL,
 	                                         _dbusmenu_server_marshal_VOID__UINT_INT,
 	                                         G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_INT);
+	/**
+		DbusmenuServer::item-activation-requested:
+		@arg0: The #DbusmenuServer emitting the signal.
+		@arg1: The ID of the parent for this update.
+		@arg2: The timestamp of when the event happened
+
+		This is signaled when a menuitem under this server
+		sends it's activate signal.
+	*/
+	signals[ITEM_ACTIVATION] =  g_signal_new(DBUSMENU_SERVER_SIGNAL_ITEM_ACTIVATION,
+	                                         G_TYPE_FROM_CLASS(class),
+	                                         G_SIGNAL_RUN_LAST,
+	                                         G_STRUCT_OFFSET(DbusmenuServerClass, item_activation),
+	                                         NULL, NULL,
+	                                         _dbusmenu_server_marshal_VOID__INT_UINT,
+	                                         G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_UINT);
 
 
 	g_object_class_install_property (object_class, PROP_DBUS_OBJECT,
@@ -359,6 +376,15 @@
 	return;
 }
 
+/* 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)
+{
+	g_signal_emit(G_OBJECT(server), signals[ITEM_ACTIVATION], 0, dbusmenu_menuitem_get_id(mi), timestamp, TRUE);
+	return;
+}
+
 /* Connects all the signals that we're interested in
    coming from a menuitem */
 static void
@@ -368,6 +394,7 @@
 	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);
 	return;
 }
 

=== modified file 'libdbusmenu-glib/server.h'
--- libdbusmenu-glib/server.h	2010-02-03 00:32:49 +0000
+++ libdbusmenu-glib/server.h	2010-07-20 21:32:50 +0000
@@ -46,6 +46,7 @@
 #define DBUSMENU_SERVER_SIGNAL_ID_PROP_UPDATE  "item-property-updated"
 #define DBUSMENU_SERVER_SIGNAL_ID_UPDATE       "item-updated"
 #define DBUSMENU_SERVER_SIGNAL_LAYOUT_UPDATED  "layout-updated"
+#define DBUSMENU_SERVER_SIGNAL_ITEM_ACTIVATION "item-activation-requested"
 #define DBUSMENU_SERVER_SIGNAL_LAYOUT_UPDATE   DBUSMENU_SERVER_SIGNAL_LAYOUT_UPDATED
 
 #define DBUSMENU_SERVER_PROP_DBUS_OBJECT       "dbus-object"
@@ -58,10 +59,10 @@
 	@id_prop_update: Slot for #DbusmenuServer::id-prop-update.
 	@id_update: Slot for #DbusmenuServer::id-update.
 	@layout_updated: Slot for #DbusmenuServer::layout-update.
+	@item_activation_requested: Slot for #DbusmenuServer::item-activation-requested.
 	@dbusmenu_server_reserved1: Reserved for future use.
 	@dbusmenu_server_reserved2: Reserved for future use.
 	@dbusmenu_server_reserved3: Reserved for future use.
-	@dbusmenu_server_reserved4: Reserved for future use.
 
 	The class implementing the virtual functions for #DbusmenuServer.
 */
@@ -73,12 +74,12 @@
 	void (*id_prop_update)(gint id, gchar * property, gchar * value);
 	void (*id_update)(gint id);
 	void (*layout_updated)(gint revision);
+	void (*item_activation)(gint id, guint timestamp);
 
 	/* Reserved */
 	void (*dbusmenu_server_reserved1)(void);
 	void (*dbusmenu_server_reserved2)(void);
 	void (*dbusmenu_server_reserved3)(void);
-	void (*dbusmenu_server_reserved4)(void);
 };
 
 /**


Follow ups