← Back to team overview

ayatana-commits team mailing list archive

[Merge] lp:~ted/dbusmenu/destroy-prototype-change into lp:dbusmenu

 

Ted Gould has proposed merging lp:~ted/dbusmenu/destroy-prototype-change into lp:dbusmenu.

Requested reviews:
  DBus Menu Team (dbusmenu-team)

For more details, see:
https://code.launchpad.net/~ted/dbusmenu/destroy-prototype-change/+merge/51922

Change the prototype to be a GDestroyNotify so that it works better with GIR parsing.
-- 
https://code.launchpad.net/~ted/dbusmenu/destroy-prototype-change/+merge/51922
Your team ayatana-commits is subscribed to branch lp:dbusmenu.
=== modified file 'docs/libdbusmenu-glib/reference/libdbusmenu-glib-sections.txt'
--- docs/libdbusmenu-glib/reference/libdbusmenu-glib-sections.txt	2011-02-24 16:40:09 +0000
+++ docs/libdbusmenu-glib/reference/libdbusmenu-glib-sections.txt	2011-03-02 16:39:09 +0000
@@ -17,7 +17,6 @@
 DbusmenuClient
 DbusmenuClientClass
 DbusmenuClientTypeHandler
-DbusmenuClientTypeDestroyHandler
 dbusmenu_client_new
 dbusmenu_client_get_root
 dbusmenu_client_get_status

=== modified file 'libdbusmenu-glib/client.c'
--- libdbusmenu-glib/client.c	2011-03-02 15:35:04 +0000
+++ libdbusmenu-glib/client.c	2011-03-02 16:39:09 +0000
@@ -129,7 +129,7 @@
 struct _type_handler_t {
 	DbusmenuClient * client;
 	DbusmenuClientTypeHandler cb;
-	DbusmenuClientTypeDestroyHandler destroy_cb;
+	GDestroyNotify destroy_cb;
 	gpointer user_data;
 	gchar * type;
 };
@@ -1881,7 +1881,7 @@
 {
 	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);
@@ -1893,7 +1893,7 @@
  * @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.
@@ -1920,7 +1920,7 @@
  * @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
@@ -1941,7 +1941,7 @@
  * 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);

=== modified file 'libdbusmenu-glib/client.h'
--- libdbusmenu-glib/client.h	2011-02-24 15:38:18 +0000
+++ libdbusmenu-glib/client.h	2011-03-02 16:39:09 +0000
@@ -198,18 +198,6 @@
 */
 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 @@
                                                         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);
 

=== modified file 'libdbusmenu-gtk/serializablemenuitem.c'
--- libdbusmenu-gtk/serializablemenuitem.c	2011-02-21 16:05:04 +0000
+++ libdbusmenu-gtk/serializablemenuitem.c	2011-03-02 16:39:09 +0000
@@ -215,7 +215,7 @@
 
 /* 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 @@
 	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 */


Follow ups