[pygobject/invoke-rewrite] [gi-invoke-ng] handle foreign types correctly



commit af2ce400fcf771ee6c9bc01aecfb59467be5a0ce
Author: John (J5) Palmieri <johnp redhat com>
Date:   Fri Mar 25 18:39:06 2011 -0400

    [gi-invoke-ng] handle foreign types correctly

 gi/pygi-cache.c   |   22 ++++++----------------
 gi/pygi-marshal.c |    3 +++
 2 files changed, 9 insertions(+), 16 deletions(-)
---
diff --git a/gi/pygi-cache.c b/gi/pygi-cache.c
index 6cf4108..ae1c06d 100644
--- a/gi/pygi-cache.c
+++ b/gi/pygi-cache.c
@@ -669,20 +669,6 @@ _arg_cache_out_interface_object_setup(PyGIArgCache *arg_cache,
 }
 
 static inline void
-_arg_cache_in_interface_boxed_setup(PyGIArgCache *arg_cache,
-                                    GITransfer transfer)
-{
-    arg_cache->in_marshaller = _pygi_marshal_in_interface_boxed;
-}
-
-static inline void
-_arg_cache_out_interface_boxed_setup(PyGIArgCache *arg_cache,
-                                     GITransfer transfer)
-{
-    arg_cache->out_marshaller = _pygi_marshal_out_interface_struct;
-}
-
-static inline void
 _arg_cache_in_interface_callback_setup(PyGIArgCache *arg_cache,
                                        PyGIFunctionCache *function_cache)
 {
@@ -790,10 +776,14 @@ _arg_cache_new_from_interface_info (GIInterfaceInfo *iface_info,
             break;
         case GI_INFO_TYPE_BOXED:
             if (direction == GI_DIRECTION_IN || direction == GI_DIRECTION_INOUT)
-               _arg_cache_in_interface_boxed_setup(arg_cache, transfer);
+                _arg_cache_in_interface_struct_setup (arg_cache,
+                                                                                  iface_info,
+                                                                                  transfer);
 
             if (direction == GI_DIRECTION_OUT || direction == GI_DIRECTION_INOUT)
-               _arg_cache_out_interface_boxed_setup(arg_cache, transfer);
+                _arg_cache_out_interface_struct_setup (arg_cache,
+                                                                                     iface_info,
+                                                                                     transfer);
 
             break;
         case GI_INFO_TYPE_CALLBACK:
diff --git a/gi/pygi-marshal.c b/gi/pygi-marshal.c
index 812caca..cf737ae 100644
--- a/gi/pygi-marshal.c
+++ b/gi/pygi-marshal.c
@@ -1877,6 +1877,9 @@ _pygi_marshal_out_interface_struct (PyGIInvokeState   *state,
 
     if (g_type_is_a (type, G_TYPE_VALUE)) {
         py_obj = pyg_value_as_pyobject (arg->v_pointer, FALSE);
+    } else if (iface_cache->is_foreign) {
+        py_obj = pygi_struct_foreign_convert_from_g_argument (iface_cache->interface_info,
+                                                              arg->v_pointer);
     } else if (g_type_is_a (type, G_TYPE_BOXED)) {
         py_obj = _pygi_boxed_new ( (PyTypeObject *)iface_cache->py_type, arg->v_pointer, 
                                   arg_cache->transfer == GI_TRANSFER_EVERYTHING);



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