aboutsummaryrefslogtreecommitdiff
path: root/libdbusmenu-glib
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-02-03 18:09:57 -0800
committerTed Gould <ted@gould.cx>2010-02-03 18:09:57 -0800
commit167062acbd9cddb34596328404fe648f68cc6999 (patch)
treef674c1d9b2c221eeea48b75e1e00a3c46c33957c /libdbusmenu-glib
parent9b7020779b1b334d696e6d165d1d61f95c12fc0a (diff)
downloadlibdbusmenu-167062acbd9cddb34596328404fe648f68cc6999.tar.gz
libdbusmenu-167062acbd9cddb34596328404fe648f68cc6999.tar.bz2
libdbusmenu-167062acbd9cddb34596328404fe648f68cc6999.zip
Bringing through the handling of events through the local subclass of the item.
Diffstat (limited to 'libdbusmenu-glib')
-rw-r--r--libdbusmenu-glib/client-menuitem.c12
-rw-r--r--libdbusmenu-glib/client.c13
-rw-r--r--libdbusmenu-glib/client.h5
3 files changed, 22 insertions, 8 deletions
diff --git a/libdbusmenu-glib/client-menuitem.c b/libdbusmenu-glib/client-menuitem.c
index e77461d..cd4fdad 100644
--- a/libdbusmenu-glib/client-menuitem.c
+++ b/libdbusmenu-glib/client-menuitem.c
@@ -18,6 +18,7 @@ static void dbusmenu_client_menuitem_class_init (DbusmenuClientMenuitemClass *kl
static void dbusmenu_client_menuitem_init (DbusmenuClientMenuitem *self);
static void dbusmenu_client_menuitem_dispose (GObject *object);
static void dbusmenu_client_menuitem_finalize (GObject *object);
+static void handle_event (DbusmenuMenuitem * mi, const gchar * name, const GValue * value, guint timestamp);
G_DEFINE_TYPE (DbusmenuClientMenuitem, dbusmenu_client_menuitem, DBUSMENU_TYPE_MENUITEM);
@@ -31,6 +32,9 @@ dbusmenu_client_menuitem_class_init (DbusmenuClientMenuitemClass *klass)
object_class->dispose = dbusmenu_client_menuitem_dispose;
object_class->finalize = dbusmenu_client_menuitem_finalize;
+ DbusmenuMenuitemClass * mclass = DBUSMENU_MENUITEM_CLASS(klass);
+ mclass->handle_event = handle_event;
+
return;
}
@@ -65,3 +69,11 @@ dbusmenu_client_menuitem_new (gint id, DbusmenuClient * client)
priv->client = client;
return mi;
}
+
+static void
+handle_event (DbusmenuMenuitem * mi, const gchar * name, const GValue * value, guint timestamp)
+{
+ DbusmenuClientMenuitemPrivate * priv = DBUSMENU_CLIENT_MENUITEM_GET_PRIVATE(mi);
+ dbusmenu_client_send_event(priv->client, dbusmenu_menuitem_get_id(mi), name, value, timestamp);
+ return;
+}
diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c
index 720c8e2..f5ebbd1 100644
--- a/libdbusmenu-glib/client.c
+++ b/libdbusmenu-glib/client.c
@@ -35,6 +35,7 @@ License version 3 and version 2.1 along with this program. If not, see
#include "client.h"
#include "menuitem.h"
+#include "client-menuitem.h"
#include "dbusmenu-client.h"
#include "server-marshal.h"
@@ -626,14 +627,11 @@ menuitem_call_cb (DBusGProxy * proxy, GError * error, gpointer userdata)
return;
}
-static void
-menuitem_activate (DbusmenuMenuitem * mi, DbusmenuClient * client)
+void
+dbusmenu_client_send_event (DbusmenuClient * client, gint id, const gchar * name, const GValue * value, guint timestamp)
{
DbusmenuClientPrivate * priv = DBUSMENU_CLIENT_GET_PRIVATE(client);
- 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, 0, menuitem_call_cb, mi);
+ org_ayatana_dbusmenu_event_async (priv->menuproxy, id, name, value, timestamp, menuitem_call_cb, GINT_TO_POINTER(id));
return;
}
@@ -661,11 +659,10 @@ parse_layout_xml(DbusmenuClient * client, xmlNodePtr node, DbusmenuMenuitem * it
}
/* Build a new item */
- item = dbusmenu_menuitem_new_with_id(id);
+ item = DBUSMENU_MENUITEM(dbusmenu_client_menuitem_new(id, client));
if (parent == NULL) {
dbusmenu_menuitem_set_root(item, TRUE);
}
- g_signal_connect(G_OBJECT(item), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(menuitem_activate), client);
/* Get the properties queued up for this item */
/* Not happy about this, but I need these :( */
diff --git a/libdbusmenu-glib/client.h b/libdbusmenu-glib/client.h
index b42bc83..1c92e92 100644
--- a/libdbusmenu-glib/client.h
+++ b/libdbusmenu-glib/client.h
@@ -104,6 +104,11 @@ DbusmenuMenuitem * dbusmenu_client_get_root (DbusmenuClient * client)
gboolean dbusmenu_client_add_type_handler (DbusmenuClient * client,
const gchar * type,
DbusmenuClientTypeHandler newfunc);
+void dbusmenu_client_send_event (DbusmenuClient * client,
+ gint id,
+ const gchar * name,
+ const GValue * value,
+ guint timestamp);
/**
SECTION:client