aboutsummaryrefslogtreecommitdiff
path: root/libdbusmenu-glib/menuitem.c
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-02-03 17:31:17 -0800
committerTed Gould <ted@gould.cx>2010-02-03 17:31:17 -0800
commit48d1f0b6902b4833460c6562603d6a8c9555aad5 (patch)
treebac174feca3526ce570b08c5639acd7ba1e67786 /libdbusmenu-glib/menuitem.c
parent775a2e8e5e9af958455a55b1278eff526924db1a (diff)
downloadlibdbusmenu-48d1f0b6902b4833460c6562603d6a8c9555aad5.tar.gz
libdbusmenu-48d1f0b6902b4833460c6562603d6a8c9555aad5.tar.bz2
libdbusmenu-48d1f0b6902b4833460c6562603d6a8c9555aad5.zip
Creating a handle event function and a wrapper for it.
Diffstat (limited to 'libdbusmenu-glib/menuitem.c')
-rw-r--r--libdbusmenu-glib/menuitem.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c
index 06d6200..bc2e748 100644
--- a/libdbusmenu-glib/menuitem.c
+++ b/libdbusmenu-glib/menuitem.c
@@ -1116,21 +1116,36 @@ dbusmenu_menuitem_foreach (DbusmenuMenuitem * mi, void (*func) (DbusmenuMenuitem
}
/**
- dbusmenu_menuitem_activate:
+ dbusmenu_menuitem_handle_event:
@mi: The #DbusmenuMenuitem to send the signal on.
+ @name: The name of the signal
+ @value: A value that could be set for the event
@timestamp: The timestamp of when the event happened
+ This function is called to create an event. It is likely
+ to be overrided by subclasses. The default menu item
+ will respond to the activate signal and do:
+
Emits the #DbusmenuMenuitem::item-activate signal on this
menu item. Called by server objects when they get the
appropriate DBus signals from the client.
+
+ If you subclass this function you should really think
+ about calling the parent function unless you have a good
+ reason not to.
*/
void
-dbusmenu_menuitem_activate (DbusmenuMenuitem * mi, guint timestamp)
+dbusmenu_menuitem_handle_event (DbusmenuMenuitem * mi, const gchar * name, const GValue * value, guint timestamp)
{
g_return_if_fail(DBUSMENU_IS_MENUITEM(mi));
#ifdef MASSIVEDEBUGGING
- g_debug("Menuitem %d (%s) activated", ID(mi), LABEL(mi));
+ g_debug("Menuitem %d (%s) is getting event '%s'", ID(mi), LABEL(mi), name);
#endif
- g_signal_emit(G_OBJECT(mi), signals[ITEM_ACTIVATED], 0, timestamp, TRUE);
+ DbusmenuMenuitemClass * class = DBUSMENU_MENUITEM_GET_CLASS(mi);
+
+ if (class->handle_event != NULL) {
+ return class->handle_event(mi, name, value, timestamp);
+ }
+ //g_signal_emit(G_OBJECT(mi), signals[ITEM_ACTIVATED], 0, timestamp, TRUE);
return;
}