[pygobject] Drop dead code from pygi-callbacks.[hc]



commit cec5d1a55347b81c1ae4ddc47ea2b4fbf964d239
Author: Martin Pitt <martinpitt gnome org>
Date:   Wed Nov 14 06:47:23 2012 +0100

    Drop dead code from pygi-callbacks.[hc]
    
    _pygi_create_callback() and _pygi_scan_for_callbacks() are not used anywhere.
    _pygi_destroy_notify_create() fits better in pygi-marshal-from-py.c, so move it
    there, and drop pygi-callbacks.[hc] completely.

 gi/Makefile.am            |    2 -
 gi/pygi-callbacks.c       |  217 ---------------------------------------------
 gi/pygi-callbacks.h       |   48 ----------
 gi/pygi-marshal-from-py.c |   44 +++++++++
 gi/pygi-private.h         |    1 -
 5 files changed, 44 insertions(+), 268 deletions(-)
---
diff --git a/gi/Makefile.am b/gi/Makefile.am
index 0489c9b..cc45189 100644
--- a/gi/Makefile.am
+++ b/gi/Makefile.am
@@ -58,8 +58,6 @@ _gi_la_SOURCES = \
 	pygi-closure.h \
 	pygi-ccallback.c \
 	pygi-ccallback.h \
-	pygi-callbacks.c \
-	pygi-callbacks.h \
 	pygi.h \
 	pygi-private.h \
 	pygi-property.c \
diff --git a/gi/pygi-marshal-from-py.c b/gi/pygi-marshal-from-py.c
index c20e023..dc14ca5 100644
--- a/gi/pygi-marshal-from-py.c
+++ b/gi/pygi-marshal-from-py.c
@@ -1343,6 +1343,50 @@ static void
 _pygi_destroy_notify_dummy (gpointer data) {
 }
 
+static PyGICClosure *global_destroy_notify;
+
+static void
+_pygi_destroy_notify_callback_closure (ffi_cif *cif,
+                                       void *result,
+                                       void **args,
+                                       void *data)
+{
+    PyGICClosure *info = * (void**) (args[0]);
+
+    g_assert (info);
+
+    _pygi_invoke_closure_free (info);
+}
+
+/* _pygi_destroy_notify_create:
+ *
+ * Method used in the occasion when a method has a GDestroyNotify
+ * argument with user data.
+ */
+static PyGICClosure*
+_pygi_destroy_notify_create (void)
+{
+    if (!global_destroy_notify) {
+
+        PyGICClosure *destroy_notify = g_slice_new0 (PyGICClosure);
+
+        g_assert (destroy_notify);
+
+        GIBaseInfo* glib_destroy_notify = g_irepository_find_by_name (NULL, "GLib", "DestroyNotify");
+        g_assert (glib_destroy_notify != NULL);
+        g_assert (g_base_info_get_type (glib_destroy_notify) == GI_INFO_TYPE_CALLBACK);
+
+        destroy_notify->closure = g_callable_info_prepare_closure ( (GICallableInfo*) glib_destroy_notify,
+                                                                    &destroy_notify->cif,
+                                                                    _pygi_destroy_notify_callback_closure,
+                                                                    NULL);
+
+        global_destroy_notify = destroy_notify;
+    }
+
+    return global_destroy_notify;
+}
+
 gboolean
 _pygi_marshal_from_py_interface_callback (PyGIInvokeState   *state,
                                           PyGICallableCache *callable_cache,
diff --git a/gi/pygi-private.h b/gi/pygi-private.h
index b8ef175..1f59fdf 100644
--- a/gi/pygi-private.h
+++ b/gi/pygi-private.h
@@ -27,7 +27,6 @@
 #include "pygi-foreign.h"
 #include "pygi-closure.h"
 #include "pygi-ccallback.h"
-#include "pygi-callbacks.h"
 #include "pygi-property.h"
 #include "pygi-signal-closure.h"
 #include "pygi-invoke.h"



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]