aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-02-03 17:36:50 -0800
committerTed Gould <ted@gould.cx>2010-02-03 17:36:50 -0800
commiteed846366d326c8f42ecb323abdb0794fae6f85e (patch)
tree63f503054fe780e81f53c381e8e774091e6dc640
parent48d1f0b6902b4833460c6562603d6a8c9555aad5 (diff)
downloadlibdbusmenu-eed846366d326c8f42ecb323abdb0794fae6f85e.tar.gz
libdbusmenu-eed846366d326c8f42ecb323abdb0794fae6f85e.tar.bz2
libdbusmenu-eed846366d326c8f42ecb323abdb0794fae6f85e.zip
Creating the local default for event handling
-rw-r--r--libdbusmenu-glib/menuitem.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c
index bc2e748..90abb9d 100644
--- a/libdbusmenu-glib/menuitem.c
+++ b/libdbusmenu-glib/menuitem.c
@@ -92,6 +92,7 @@ static void set_property (GObject * obj, guint id, const GValue * value, GParamS
static void get_property (GObject * obj, guint id, GValue * value, GParamSpec * pspec);
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);
/* GObject stuff */
G_DEFINE_TYPE (DbusmenuMenuitem, dbusmenu_menuitem, G_TYPE_OBJECT);
@@ -108,6 +109,8 @@ dbusmenu_menuitem_class_init (DbusmenuMenuitemClass *klass)
object_class->set_property = set_property;
object_class->get_property = get_property;
+ klass->handle_event = handle_event;
+
/**
DbusmenuMenuitem::property-changed:
@arg0: The #DbusmenuMenuitem object.
@@ -342,6 +345,16 @@ get_property (GObject * obj, guint id, GValue * value, GParamSpec * pspec)
return;
}
+/* Handles the activate event if it is sent. */
+static void
+handle_event (DbusmenuMenuitem * mi, const gchar * name, const GValue * value, guint timestamp)
+{
+ if (g_strcmp0(name, "clicked") == 0) {
+ g_signal_emit(G_OBJECT(mi), signals[ITEM_ACTIVATED], 0, timestamp, TRUE);
+ }
+
+ return;
+}
/* Public interface */
@@ -1146,6 +1159,5 @@ dbusmenu_menuitem_handle_event (DbusmenuMenuitem * mi, const gchar * name, const
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;
}