← Back to team overview

ayatana-commits team mailing list archive

[Branch ~dbusmenu-team/dbusmenu/trunk] Rev 57: Adding a parameter on the event function so that the timestamp is always passed.

 

Merge authors:
  Ted Gould (ted)
Related merge proposals:
  https://code.launchpad.net/~ted/dbusmenu/event-timestamp/+merge/17923
  proposed by: Ted Gould (ted)
  review: Approve - Cody Russell (bratsche)
------------------------------------------------------------
revno: 57 [merge]
committer: Ted Gould <ted@xxxxxxxx>
branch nick: trunk
timestamp: Sun 2010-01-24 14:08:51 -0600
message:
  Adding a parameter on the event function so that the timestamp is always passed.
modified:
  libdbusmenu-glib/client.c
  libdbusmenu-glib/dbus-menu.xml
  libdbusmenu-glib/menuitem-marshal.list
  libdbusmenu-glib/menuitem.c
  libdbusmenu-glib/menuitem.h
  libdbusmenu-glib/server.c
  libdbusmenu-gtk/client.c
  tests/test-gtk-label-server.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/client.c'
--- libdbusmenu-glib/client.c	2010-01-22 21:22:54 +0000
+++ libdbusmenu-glib/client.c	2010-01-24 20:08:51 +0000
@@ -633,7 +633,7 @@
 	GValue value = {0};
 	g_value_init(&value, G_TYPE_INT);
 	g_value_set_int(&value, 0);
-	org_ayatana_dbusmenu_event_async (priv->menuproxy, dbusmenu_menuitem_get_id(mi), "clicked", &value, menuitem_call_cb, mi);
+	org_ayatana_dbusmenu_event_async (priv->menuproxy, dbusmenu_menuitem_get_id(mi), "clicked", &value, 0, menuitem_call_cb, mi);
 	return;
 }
 

=== modified file 'libdbusmenu-glib/dbus-menu.xml'
--- libdbusmenu-glib/dbus-menu.xml	2010-01-22 21:22:54 +0000
+++ libdbusmenu-glib/dbus-menu.xml	2010-01-24 20:08:51 +0000
@@ -141,6 +141,7 @@
 @param id the id of the item which received the event
 @param type the type of event
 @param data event-specific data
+@param timestamp The time that the event occured if available or the time the message was sent if not.
 
 @a type can be one of the following:
 
@@ -153,6 +154,7 @@
 			<arg type="u" name="id" direction="in" />
 			<arg type="s" name="eventId" direction="in" />
 			<arg type="v" name="data" direction="in" />
+			<arg type="u" name="timestamp" direction="in" />
 		</method>
 
 <!-- Signals -->

=== modified file 'libdbusmenu-glib/menuitem-marshal.list'
--- libdbusmenu-glib/menuitem-marshal.list	2009-12-19 03:58:26 +0000
+++ libdbusmenu-glib/menuitem-marshal.list	2010-01-22 20:10:27 +0000
@@ -3,3 +3,4 @@
 VOID: OBJECT, UINT
 VOID: OBJECT
 VOID: VOID
+VOID: UINT

=== modified file 'libdbusmenu-glib/menuitem.c'
--- libdbusmenu-glib/menuitem.c	2010-01-21 23:13:52 +0000
+++ libdbusmenu-glib/menuitem.c	2010-01-22 20:53:39 +0000
@@ -127,6 +127,7 @@
 	/**
 		DbusmenuMenuitem::item-activated:
 		@arg0: The #DbusmenuMenuitem object.
+		@arg1: The timestamp of when it was activated
 
 		Emitted on the objects on the server side when
 		they are signaled on the client side.
@@ -136,8 +137,8 @@
 	                                           G_SIGNAL_RUN_LAST,
 	                                           G_STRUCT_OFFSET(DbusmenuMenuitemClass, item_activated),
 	                                           NULL, NULL,
-	                                           _dbusmenu_menuitem_marshal_VOID__VOID,
-	                                           G_TYPE_NONE, 0, G_TYPE_NONE);
+	                                           _dbusmenu_menuitem_marshal_VOID__UINT,
+	                                           G_TYPE_NONE, 1, G_TYPE_UINT, G_TYPE_NONE);
 	/**
 		DbusmenuMenuitem::child-added:
 		@arg0: The #DbusmenuMenuitem which is the parent.
@@ -1117,18 +1118,19 @@
 /**
 	dbusmenu_menuitem_activate:
 	@mi: The #DbusmenuMenuitem to send the signal on.
+	@timestamp: The timestamp of when the event happened
 
 	Emits the #DbusmenuMenuitem::item-activate signal on this
 	menu item.  Called by server objects when they get the
 	appropriate DBus signals from the client.
 */
 void
-dbusmenu_menuitem_activate (DbusmenuMenuitem * mi)
+dbusmenu_menuitem_activate (DbusmenuMenuitem * mi, guint timestamp)
 {
 	g_return_if_fail(DBUSMENU_IS_MENUITEM(mi));
 	#ifdef MASSIVEDEBUGGING
 	g_debug("Menuitem %d (%s) activated", ID(mi), LABEL(mi));
 	#endif
-	g_signal_emit(G_OBJECT(mi), signals[ITEM_ACTIVATED], 0, TRUE);
+	g_signal_emit(G_OBJECT(mi), signals[ITEM_ACTIVATED], 0, timestamp, TRUE);
 	return;
 }

=== modified file 'libdbusmenu-glib/menuitem.h'
--- libdbusmenu-glib/menuitem.h	2010-01-07 16:49:35 +0000
+++ libdbusmenu-glib/menuitem.h	2010-01-22 20:10:27 +0000
@@ -104,7 +104,7 @@
 
 	/* Signals */
 	void (*property_changed) (gchar * property, GValue * value);
-	void (*item_activated) (void);
+	void (*item_activated) (guint timestamp);
 	void (*child_added) (DbusmenuMenuitem * child, guint position);
 	void (*child_removed) (DbusmenuMenuitem * child);
 	void (*child_moved) (DbusmenuMenuitem * child, guint newpos, guint oldpos);
@@ -153,7 +153,7 @@
 gboolean dbusmenu_menuitem_get_root (DbusmenuMenuitem * mi);
 
 void dbusmenu_menuitem_foreach (DbusmenuMenuitem * mi, void (*func) (DbusmenuMenuitem * mi, gpointer data), gpointer data);
-void dbusmenu_menuitem_activate (DbusmenuMenuitem * mi);
+void dbusmenu_menuitem_activate (DbusmenuMenuitem * mi, guint timestamp);
 
 /**
 	SECTION:menuitem

=== modified file 'libdbusmenu-glib/server.c'
--- libdbusmenu-glib/server.c	2010-01-22 21:22:54 +0000
+++ libdbusmenu-glib/server.c	2010-01-24 20:08:51 +0000
@@ -39,7 +39,7 @@
 static gboolean _dbusmenu_server_get_property (DbusmenuServer * server, guint id, gchar * property, gchar ** value, GError ** error);
 static gboolean _dbusmenu_server_get_properties (DbusmenuServer * server, guint id, GPtrArray * properties, GHashTable ** dict, GError ** error);
 static gboolean _dbusmenu_server_get_group_properties (DbusmenuServer * server, GArray * ids, GArray * properties, GHashTable ** values, GError ** error);
-static gboolean _dbusmenu_server_event (DbusmenuServer * server, guint id, gchar * eventid, GValue * data, GError ** error);
+static gboolean _dbusmenu_server_event (DbusmenuServer * server, guint id, gchar * eventid, GValue * data, guint timestamp, GError ** error);
 static gboolean _dbusmenu_server_get_children (DbusmenuServer * server, guint id, GPtrArray * properties, GPtrArray ** output, GError ** error);
 
 #include "dbusmenu-server.h"
@@ -537,7 +537,7 @@
 }
 
 static gboolean
-_dbusmenu_server_event (DbusmenuServer * server, guint id, gchar * eventid, GValue * data, GError ** error)
+_dbusmenu_server_event (DbusmenuServer * server, guint id, gchar * eventid, GValue * data, guint timestamp, GError ** error)
 {
 	DbusmenuServerPrivate * priv = DBUSMENU_SERVER_GET_PRIVATE(server);
 	DbusmenuMenuitem * mi = dbusmenu_menuitem_find_id(priv->root, id);
@@ -553,7 +553,7 @@
 		return FALSE;
 	}
 
-	dbusmenu_menuitem_activate(mi);
+	dbusmenu_menuitem_activate(mi, timestamp);
 	return TRUE;
 }
 

=== modified file 'libdbusmenu-gtk/client.c'
--- libdbusmenu-gtk/client.c	2010-01-11 18:42:55 +0000
+++ libdbusmenu-gtk/client.c	2010-01-22 20:18:46 +0000
@@ -109,7 +109,7 @@
 static gboolean
 menu_pressed_cb (GtkMenuItem * gmi, DbusmenuMenuitem * mi)
 {
-	dbusmenu_menuitem_activate(mi);
+	dbusmenu_menuitem_activate(mi, gtk_get_current_event_time());
 	return TRUE;
 }
 

=== modified file 'tests/test-gtk-label-server.c'
--- tests/test-gtk-label-server.c	2009-09-02 20:13:15 +0000
+++ tests/test-gtk-label-server.c	2010-01-22 20:26:34 +0000
@@ -32,9 +32,9 @@
 #include <json-glib/json-glib.h>
 
 static void
-menuitem_click(DbusmenuMenuitem * mi, gpointer user_data)
+menuitem_click(DbusmenuMenuitem * mi, guint32 time, gpointer user_data)
 {
-	g_debug("Clicked on: %d", dbusmenu_menuitem_get_id(mi));
+	g_debug("Clicked on: %d @ %d", dbusmenu_menuitem_get_id(mi), time);
 	return;
 }