aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2011-03-03 12:27:37 -0600
committerTed Gould <ted@gould.cx>2011-03-03 12:27:37 -0600
commit5df1e8714522ef4ec18d7b08bb571d7614c1859e (patch)
tree1c3f84667662a88bd4d9e8692c8a06a8032f1f22
parent83d4a60eb146ed757e319db6f2e63f905dc342fb (diff)
parent45962d68b2e1dcac1443f9e56b6a597cdd2816c8 (diff)
downloadlibdbusmenu-5df1e8714522ef4ec18d7b08bb571d7614c1859e.tar.gz
libdbusmenu-5df1e8714522ef4ec18d7b08bb571d7614c1859e.tar.bz2
libdbusmenu-5df1e8714522ef4ec18d7b08bb571d7614c1859e.zip
Changing the destroy prototype for better GIR support
-rw-r--r--docs/libdbusmenu-glib/reference/libdbusmenu-glib-sections.txt1
-rw-r--r--libdbusmenu-glib/client.c10
-rw-r--r--libdbusmenu-glib/client.h14
-rw-r--r--libdbusmenu-gtk/serializablemenuitem.c4
4 files changed, 8 insertions, 21 deletions
diff --git a/docs/libdbusmenu-glib/reference/libdbusmenu-glib-sections.txt b/docs/libdbusmenu-glib/reference/libdbusmenu-glib-sections.txt
index 4ee1401..84d8257 100644
--- a/docs/libdbusmenu-glib/reference/libdbusmenu-glib-sections.txt
+++ b/docs/libdbusmenu-glib/reference/libdbusmenu-glib-sections.txt
@@ -17,7 +17,6 @@ DBUSMENU_CLIENT_TYPES_IMAGE
DbusmenuClient
DbusmenuClientClass
DbusmenuClientTypeHandler
-DbusmenuClientTypeDestroyHandler
dbusmenu_client_new
dbusmenu_client_get_icon_paths
dbusmenu_client_get_root
diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c
index f041730..c95b161 100644
--- a/libdbusmenu-glib/client.c
+++ b/libdbusmenu-glib/client.c
@@ -131,7 +131,7 @@ typedef struct _type_handler_t type_handler_t;
struct _type_handler_t {
DbusmenuClient * client;
DbusmenuClientTypeHandler cb;
- DbusmenuClientTypeDestroyHandler destroy_cb;
+ GDestroyNotify destroy_cb;
gpointer user_data;
gchar * type;
};
@@ -1924,7 +1924,7 @@ type_handler_destroy (gpointer user_data)
{
type_handler_t * th = (type_handler_t *)user_data;
if (th->destroy_cb != NULL) {
- th->destroy_cb(th->client, th->type, th->user_data);
+ th->destroy_cb(th->user_data);
}
g_free(th->type);
g_free(th);
@@ -1936,7 +1936,7 @@ type_handler_destroy (gpointer user_data)
* @client: Client where we're getting types coming in
* @type: A text string that will be matched with the 'type'
* property on incoming menu items
- * @newfunc: The function that will be executed with those new
+ * @newfunc: (scope notified): The function that will be executed with those new
* items when they come in.
*
* This function connects into the type handling of the #DbusmenuClient.
@@ -1963,7 +1963,7 @@ dbusmenu_client_add_type_handler (DbusmenuClient * client, const gchar * type, D
* @client: Client where we're getting types coming in
* @type: A text string that will be matched with the 'type'
* property on incoming menu items
- * @newfunc: The function that will be executed with those new
+ * @newfunc: (scope notified): The function that will be executed with those new
* items when they come in.
* @user_data: Data passed to @newfunc when it is called
* @destroy_func: A function that is called when the type handler is
@@ -1984,7 +1984,7 @@ dbusmenu_client_add_type_handler (DbusmenuClient * client, const gchar * type, D
* Return value: If registering the new type was successful.
*/
gboolean
-dbusmenu_client_add_type_handler_full (DbusmenuClient * client, const gchar * type, DbusmenuClientTypeHandler newfunc, gpointer user_data, DbusmenuClientTypeDestroyHandler destroy_func)
+dbusmenu_client_add_type_handler_full (DbusmenuClient * client, const gchar * type, DbusmenuClientTypeHandler newfunc, gpointer user_data, GDestroyNotify destroy_func)
{
g_return_val_if_fail(DBUSMENU_IS_CLIENT(client), FALSE);
g_return_val_if_fail(type != NULL, FALSE);
diff --git a/libdbusmenu-glib/client.h b/libdbusmenu-glib/client.h
index 93f4280..1cb9ee5 100644
--- a/libdbusmenu-glib/client.h
+++ b/libdbusmenu-glib/client.h
@@ -198,18 +198,6 @@ struct _DbusmenuClient {
*/
typedef gboolean (*DbusmenuClientTypeHandler) (DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, DbusmenuClient * client, gpointer user_data);
-/**
- DbusmenuClientTypeDestroyHandler:
- @client: A pointer to the #DbusmenuClient
- @type: The type that this handler was registered with
- @user_data: The data you gave us
-
- This handler is called when the type becomes unregistered by the
- client. This is usally caused by the #DbusmenuClient being destroyed
- and should free memory or unref objects in @user_data.
-*/
-typedef void (*DbusmenuClientTypeDestroyHandler) (DbusmenuClient * client, const gchar * type, gpointer user_data);
-
GType dbusmenu_client_get_type (void);
DbusmenuClient * dbusmenu_client_new (const gchar * name,
const gchar * object);
@@ -221,7 +209,7 @@ gboolean dbusmenu_client_add_type_handler_full (DbusmenuClient * cli
const gchar * type,
DbusmenuClientTypeHandler newfunc,
gpointer user_data,
- DbusmenuClientTypeDestroyHandler destroy_func);
+ GDestroyNotify destroy_func);
DbusmenuTextDirection dbusmenu_client_get_text_direction (DbusmenuClient * client);
DbusmenuStatus dbusmenu_client_get_status (DbusmenuClient * client);
const GStrv dbusmenu_client_get_icon_paths (DbusmenuClient * client);
diff --git a/libdbusmenu-gtk/serializablemenuitem.c b/libdbusmenu-gtk/serializablemenuitem.c
index 29f83a8..b560fe3 100644
--- a/libdbusmenu-gtk/serializablemenuitem.c
+++ b/libdbusmenu-gtk/serializablemenuitem.c
@@ -215,7 +215,7 @@ type_handler (DbusmenuMenuitem * newitem, DbusmenuMenuitem * parent, DbusmenuCli
/* Destruction is inevitable */
static void
-type_destroy_handler (DbusmenuClient * client, const gchar * type, gpointer user_data)
+type_destroy_handler (gpointer user_data)
{
g_return_if_fail(user_data != NULL);
type_handler_t * th = (type_handler_t *)user_data;
@@ -255,7 +255,7 @@ dbusmenu_gtk_serializable_menu_item_register_to_client (DbusmenuClient * client,
th->class = class;
th->type = item_type;
if (!dbusmenu_client_add_type_handler_full(client, class->get_type_string(), type_handler, th, type_destroy_handler)) {
- type_destroy_handler(client, class->get_type_string(), th);
+ type_destroy_handler(th);
}
/* Register defaults */