diff options
author | Ted Gould <ted@gould.cx> | 2010-02-03 18:09:57 -0800 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2010-02-03 18:09:57 -0800 |
commit | 167062acbd9cddb34596328404fe648f68cc6999 (patch) | |
tree | f674c1d9b2c221eeea48b75e1e00a3c46c33957c /libdbusmenu-glib | |
parent | 9b7020779b1b334d696e6d165d1d61f95c12fc0a (diff) | |
download | libdbusmenu-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.c | 12 | ||||
-rw-r--r-- | libdbusmenu-glib/client.c | 13 | ||||
-rw-r--r-- | libdbusmenu-glib/client.h | 5 |
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 |