Add TestObj with static methods
authorColin Walters <walters@src.gnome.org>
Wed, 19 Nov 2008 22:38:47 +0000 (22:38 +0000)
committerColin Walters <walters@src.gnome.org>
Wed, 19 Nov 2008 22:38:47 +0000 (22:38 +0000)
Static methods and ctors are a useful semi-corner case for bindings.

svn path=/trunk/; revision=952

tests/everything/everything.c
tests/everything/everything.h

index 6e90d7c..d90c98f 100644 (file)
@@ -582,3 +582,26 @@ test_boxed_get_type (void)
   return our_type;
 }
 
+G_DEFINE_TYPE(TestObj, test_obj, G_TYPE_OBJECT);
+
+static void
+test_obj_class_init (TestObjClass *klass)
+{
+}
+
+static void
+test_obj_init (TestObj *obj)
+{
+}
+
+TestObj *
+test_obj_new_from_file (const char *x, GError **error)
+{
+  return g_object_new (TEST_TYPE_OBJ, NULL);
+}
+
+double
+test_obj_static_method (int x)
+{
+  return x;
+}
index a09132c..541e51c 100644 (file)
@@ -154,4 +154,24 @@ TestBoxed *test_boxed_copy     (TestBoxed *boxed);
 gboolean   test_boxed_equals   (TestBoxed *boxed,
                                TestBoxed *other);
 
+#define TEST_TYPE_OBJ              (test_obj_get_type ())
+#define TEST_OBJECT(object)        (G_TYPE_CHECK_INSTANCE_CAST ((object), TEST_TYPE_OBJ, TestObj))
+#define TEST_IS_OBJECT(object)     (G_TYPE_CHECK_INSTANCE_TYPE ((object), TEST_TYPE_OBJ))
+
+typedef struct _TestObj          TestObj;
+typedef struct _TestObjClass     TestObjClass;
+struct _TestObj
+{
+  GObject parent_instance;
+};
+
+struct _TestObjClass
+{
+  GObjectClass parent_class;
+};
+
+GType      test_obj_get_type (void);
+TestObj*   test_obj_new_from_file (const char *x, GError **error);
+double     test_obj_static_method (int x);
+
 #endif /* __GITESTTYPES_H__ */