support setting gobjects and ginterfaces in struct fields
authorJohn (J5) Palmieri <johnp@redhat.com>
Mon, 14 Mar 2011 18:18:22 +0000 (14:18 -0400)
committerJohn (J5) Palmieri <johnp@redhat.com>
Wed, 16 Mar 2011 18:33:05 +0000 (14:33 -0400)
https://bugzilla.gnome.org/show_bug.cgi?id=644749

girepository/gifieldinfo.c

index d4fd14e..cf5c233 100644 (file)
@@ -512,6 +512,23 @@ g_field_info_set_field (GIFieldInfo     *field_info,
          }
          break;
        }
+    } else {
+      switch (g_type_info_get_tag (type_info))
+        {
+        case GI_TYPE_TAG_INTERFACE:
+          {
+           GIBaseInfo *interface = g_type_info_get_interface (type_info);
+           switch (g_base_info_get_type (interface))
+              {
+                case GI_INFO_TYPE_OBJECT:
+                case GI_INFO_TYPE_INTERFACE:
+                  G_STRUCT_MEMBER (gpointer, mem, offset) = (gpointer)value->v_pointer;
+                  result = TRUE;
+                  break;
+              }
+              g_base_info_unref ((GIBaseInfo *)interface);
+          }
+        }
     }
 
   g_base_info_unref ((GIBaseInfo *)type_info);