diff options
author | Ted Gould <ted@gould.cx> | 2011-01-18 16:56:14 -0600 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2011-01-18 16:56:14 -0600 |
commit | 17632d1272a0741e5f5a11abcc4e8f758bc9e98c (patch) | |
tree | 1b3910b6eb95649f9264bc2174970f84d2965aa0 /libdbusmenu-glib | |
parent | 6ec53854067f149492c18d35d680c2dad01d0a41 (diff) | |
download | libdbusmenu-17632d1272a0741e5f5a11abcc4e8f758bc9e98c.tar.gz libdbusmenu-17632d1272a0741e5f5a11abcc4e8f758bc9e98c.tar.bz2 libdbusmenu-17632d1272a0741e5f5a11abcc4e8f758bc9e98c.zip |
Adding in a 'full' function to deal with user data and destruction.
Diffstat (limited to 'libdbusmenu-glib')
-rw-r--r-- | libdbusmenu-glib/client.c | 9 | ||||
-rw-r--r-- | libdbusmenu-glib/client.h | 8 |
2 files changed, 15 insertions, 2 deletions
diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index 58d6360..a57b7ba 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -1163,7 +1163,7 @@ menuitem_get_properties_new_cb (GVariant * properties, GError * error, gpointer } if (newfunc != NULL) { - handled = newfunc(propdata->item, propdata->parent, propdata->client); + handled = newfunc(propdata->item, propdata->parent, propdata->client, NULL); } #ifdef MASSIVEDEBUGGING @@ -1699,6 +1699,12 @@ dbusmenu_client_get_root (DbusmenuClient * client) gboolean dbusmenu_client_add_type_handler (DbusmenuClient * client, const gchar * type, DbusmenuClientTypeHandler newfunc) { + return dbusmenu_client_add_type_handler_full(client, type, newfunc, NULL, NULL); +} + +gboolean +dbusmenu_client_add_type_handler_full (DbusmenuClient * client, const gchar * type, DbusmenuClientTypeHandler newfunc, gpointer user_data, DbusmenuClientTypeDestroyHandler destory_func) +{ g_return_val_if_fail(DBUSMENU_IS_CLIENT(client), FALSE); g_return_val_if_fail(type != NULL, FALSE); @@ -1722,3 +1728,4 @@ dbusmenu_client_add_type_handler (DbusmenuClient * client, const gchar * type, D g_hash_table_insert(priv->type_handlers, g_strdup(type), newfunc); return TRUE; } + diff --git a/libdbusmenu-glib/client.h b/libdbusmenu-glib/client.h index 1ae89fa..323e142 100644 --- a/libdbusmenu-glib/client.h +++ b/libdbusmenu-glib/client.h @@ -110,7 +110,8 @@ struct _DbusmenuClient { DbusmenuClientPrivate * priv; }; -typedef gboolean (*DbusmenuClientTypeHandler) (DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, DbusmenuClient * client); +typedef gboolean (*DbusmenuClientTypeHandler) (DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, DbusmenuClient * client, gpointer user_data); +typedef gboolean (*DbusmenuClientTypeDestroyHandler) (DbusmenuClient * client, const gchar * type, gpointer user_data); GType dbusmenu_client_get_type (void); DbusmenuClient * dbusmenu_client_new (const gchar * name, @@ -119,6 +120,11 @@ DbusmenuMenuitem * dbusmenu_client_get_root (DbusmenuClient * client) gboolean dbusmenu_client_add_type_handler (DbusmenuClient * client, const gchar * type, DbusmenuClientTypeHandler newfunc); +gboolean dbusmenu_client_add_type_handler_full (DbusmenuClient * client, + const gchar * type, + DbusmenuClientTypeHandler newfunc, + gpointer user_data, + DbusmenuClientTypeDestroyHandler destory_func); void dbusmenu_client_send_event (DbusmenuClient * client, gint id, const gchar * name, |