← Back to team overview

ayatana-commits team mailing list archive

[Branch ~dbusmenu-team/dbusmenu/trunk] Rev 254: Changing the destroy prototype for better GIR support

 

Merge authors:
  Ted Gould (ted)
Related merge proposals:
  https://code.launchpad.net/~ted/dbusmenu/destroy-prototype-change/+merge/51922
  proposed by: Ted Gould (ted)
  review: Approve - Conor Curran (cjcurran)
------------------------------------------------------------
revno: 254 [merge]
committer: Ted Gould <ted@xxxxxxxx>
branch nick: trunk
timestamp: Thu 2011-03-03 12:27:37 -0600
message:
  Changing the destroy prototype for better GIR support
modified:
  docs/libdbusmenu-glib/reference/libdbusmenu-glib-sections.txt
  libdbusmenu-glib/client.c
  libdbusmenu-glib/client.h
  libdbusmenu-gtk/serializablemenuitem.c


--
lp:dbusmenu
https://code.launchpad.net/~dbusmenu-team/dbusmenu/trunk

Your team ayatana-commits is subscribed to branch lp:dbusmenu.
To unsubscribe from this branch go to https://code.launchpad.net/~dbusmenu-team/dbusmenu/trunk/+edit-subscription
=== modified file 'docs/libdbusmenu-glib/reference/libdbusmenu-glib-sections.txt'
--- docs/libdbusmenu-glib/reference/libdbusmenu-glib-sections.txt	2011-03-03 17:00:53 +0000
+++ docs/libdbusmenu-glib/reference/libdbusmenu-glib-sections.txt	2011-03-03 18:27:37 +0000
@@ -17,7 +17,6 @@
 DbusmenuClient
 DbusmenuClientClass
 DbusmenuClientTypeHandler
-DbusmenuClientTypeDestroyHandler
 dbusmenu_client_new
 dbusmenu_client_get_icon_paths
 dbusmenu_client_get_root

=== modified file 'libdbusmenu-glib/client.c'
--- libdbusmenu-glib/client.c	2011-03-03 16:43:26 +0000
+++ libdbusmenu-glib/client.c	2011-03-03 18:27:37 +0000
@@ -131,7 +131,7 @@
 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_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 @@
  * @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 @@
  * @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 @@
  * 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-03-03 16:43:26 +0000
+++ libdbusmenu-glib/client.h	2011-03-03 18:27:37 +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);
 const GStrv          dbusmenu_client_get_icon_paths    (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:05:54 +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 */