[gobject-introspection] Add foreign struct funcs to Everything



commit d5e9f88c1ac94b126c5ee2eb54483be839255f0d
Author: Tomeu Vizoso <tomeu sugarlabs org>
Date:   Thu Apr 15 17:44:42 2010 -0400

    Add foreign struct funcs to Everything
    
    https://bugzilla.gnome.org/show_bug.cgi?id=615773

 gir/Everything-1.0-expected.gir |   52 ++++++++++++++++++++++++++
 gir/Makefile.am                 |    4 +-
 gir/everything.c                |   78 +++++++++++++++++++++++++++++++++++++++
 gir/everything.h                |   11 +++++
 4 files changed, 143 insertions(+), 2 deletions(-)
---
diff --git a/gir/Everything-1.0-expected.gir b/gir/Everything-1.0-expected.gir
index 6c468f8..812041d 100644
--- a/gir/Everything-1.0-expected.gir
+++ b/gir/Everything-1.0-expected.gir
@@ -8,6 +8,7 @@ and/or use gtk-doc annotations.  -->
             xmlns:glib="http://www.gtk.org/introspection/glib/1.0";>
   <include name="GLib" version="2.0"/>
   <include name="GObject" version="2.0"/>
+  <include name="cairo" version="1.0"/>
   <package name="gobject-2.0"/>
   <namespace name="Everything"
              version="1.0"
@@ -771,6 +772,57 @@ case.">
         </parameter>
       </parameters>
     </function>
+    <function name="test_cairo_context_full_return"
+              c:identifier="test_cairo_context_full_return">
+      <return-value transfer-ownership="full">
+        <type name="cairo.Context" c:type="cairo_t*"/>
+      </return-value>
+    </function>
+    <function name="test_cairo_context_none_in"
+              c:identifier="test_cairo_context_none_in">
+      <return-value transfer-ownership="none">
+        <type name="none" c:type="void"/>
+      </return-value>
+      <parameters>
+        <parameter name="context" transfer-ownership="none">
+          <type name="cairo.Context" c:type="cairo_t*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="test_cairo_surface_full_out"
+              c:identifier="test_cairo_surface_full_out">
+      <return-value transfer-ownership="none">
+        <type name="none" c:type="void"/>
+      </return-value>
+      <parameters>
+        <parameter name="surface" direction="out" transfer-ownership="full">
+          <type name="cairo.Surface" c:type="cairo_surface_t**"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="test_cairo_surface_full_return"
+              c:identifier="test_cairo_surface_full_return">
+      <return-value transfer-ownership="full">
+        <type name="cairo.Surface" c:type="cairo_surface_t*"/>
+      </return-value>
+    </function>
+    <function name="test_cairo_surface_none_in"
+              c:identifier="test_cairo_surface_none_in">
+      <return-value transfer-ownership="none">
+        <type name="none" c:type="void"/>
+      </return-value>
+      <parameters>
+        <parameter name="surface" transfer-ownership="none">
+          <type name="cairo.Surface" c:type="cairo_surface_t*"/>
+        </parameter>
+      </parameters>
+    </function>
+    <function name="test_cairo_surface_none_return"
+              c:identifier="test_cairo_surface_none_return">
+      <return-value transfer-ownership="none">
+        <type name="cairo.Surface" c:type="cairo_surface_t*"/>
+      </return-value>
+    </function>
     <function name="test_callback" c:identifier="test_callback">
       <return-value transfer-ownership="none">
         <type name="int" c:type="int"/>
diff --git a/gir/Makefile.am b/gir/Makefile.am
index 7cdbed8..24e7675 100644
--- a/gir/Makefile.am
+++ b/gir/Makefile.am
@@ -161,7 +161,7 @@ lib_LTLIBRARIES = libgirepository-everything-1.0.la
 libgirepository_everything_1_0_la_SOURCES = $(srcdir)/everything.c $(srcdir)/everything.h
 libgirepository_everything_1_0_la_CFLAGS = $(GOBJECT_CFLAGS)
 libgirepository_everything_1_0_la_LDFLAGS = -version-info $(LT_VERSION)
-libgirepository_everything_1_0_la_LIBADD = $(GOBJECT_LIBS)
+libgirepository_everything_1_0_la_LIBADD = $(GOBJECT_LIBS) -lcairo
 
 if OS_WIN32
 libgirepository_everything_1_0_la_LDFLAGS += -no-undefined
@@ -171,7 +171,7 @@ Everything-1.0.gir: Gio-2.0.gir libgirepository-everything-1.0.la
 
 Everything_1_0_gir_LIBS = libgirepository-everything-1.0.la
 Everything_1_0_gir_PACKAGES = gobject-2.0
-Everything_1_0_gir_INCLUDES = GObject-2.0
+Everything_1_0_gir_INCLUDES = GObject-2.0 cairo-1.0
 Everything_1_0_gir_FILES = $(srcdir)/everything.h $(srcdir)/everything.c
 
 INTROSPECTION_GIRS += Everything-$(TYPELIB_VERSION).gir
diff --git a/gir/everything.c b/gir/everything.c
index 7d10dbc..748b11a 100644
--- a/gir/everything.c
+++ b/gir/everything.c
@@ -209,6 +209,84 @@ const GValue *test_value_return(int i) {
   return &value;
 }
 
+/************************************************************************/
+/* foreign structs */
+
+/**
+ * test_cairo_context_full_return:
+ * Returns: (transfer full):
+ */
+cairo_t *
+test_cairo_context_full_return (void)
+{
+  cairo_surface_t *surface;
+  surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 10, 10);
+  return cairo_create (surface);
+}
+
+/**
+ * test_cairo_context_none_in:
+ * @context: (transfer none):
+ */
+void
+test_cairo_context_none_in (cairo_t *context)
+{
+  cairo_surface_t *surface = cairo_get_target (context);
+
+  g_assert (cairo_image_surface_get_format (surface) == CAIRO_FORMAT_ARGB32);
+  g_assert (cairo_image_surface_get_width (surface) == 10);
+  g_assert (cairo_image_surface_get_height (surface) == 10);
+}
+
+
+/**
+ * test_cairo_surface_none_return:
+ * Returns: (transfer none):
+ */
+cairo_surface_t *
+test_cairo_surface_none_return (void)
+{
+  static cairo_surface_t *surface;
+
+  if (surface == NULL) {
+    surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 10, 10);
+  }
+
+  return surface;
+}
+
+/**
+ * test_cairo_surface_full_return:
+ * Returns: (transfer full):
+ */
+cairo_surface_t *
+test_cairo_surface_full_return (void)
+{
+  return cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 10, 10);
+}
+
+/**
+ * test_cairo_surface_none_in:
+ * @surface: (transfer none):
+ */
+void
+test_cairo_surface_none_in (cairo_surface_t *surface)
+{
+  g_assert (cairo_image_surface_get_format (surface) == CAIRO_FORMAT_ARGB32);
+  g_assert (cairo_image_surface_get_width (surface) == 10);
+  g_assert (cairo_image_surface_get_height (surface) == 10);
+}
+
+/**
+ * test_cairo_surface_full_out:
+ * @surface: (out) (transfer full):
+ */
+void
+test_cairo_surface_full_out (cairo_surface_t **surface)
+{
+  *surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 10, 10);
+}
+
 
 /************************************************************************/
 /* utf8 */
diff --git a/gir/everything.h b/gir/everything.h
index f317a9d..7096017 100644
--- a/gir/everything.h
+++ b/gir/everything.h
@@ -1,6 +1,7 @@
 #ifndef __GITESTTYPES_H__
 #define __GITESTTYPES_H__
 
+#include <cairo/cairo.h>
 #include <glib-object.h>
 #include <time.h>
 
@@ -122,6 +123,16 @@ int test_closure_one_arg (GClosure *closure, int arg);
 int test_int_value_arg(const GValue *v);
 const GValue *test_value_return(int i);
 
+/* foreign structs */
+cairo_t *test_cairo_context_full_return (void);
+void test_cairo_context_none_in (cairo_t *context);
+
+cairo_surface_t *test_cairo_surface_none_return (void);
+cairo_surface_t *test_cairo_surface_full_return (void);
+void test_cairo_surface_none_in (cairo_surface_t *surface);
+void test_cairo_surface_full_out (cairo_surface_t **surface);
+
+
 /* enums / flags */
 
 typedef enum



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