1 #define FOO_SUCCESS_INT 0x1138
3 #include "foo-object.h"
10 void foo_private_function (FooObject *foo)
16 foo_interface_get_type (void)
18 static GType object_type = 0;
22 object_type = g_type_register_static_simple (G_TYPE_INTERFACE,
24 sizeof (FooInterfaceIface),
27 g_type_interface_add_prerequisite (object_type, G_TYPE_OBJECT);
44 static guint foo_object_signals[LAST_SIGNAL] = { 0 };
46 G_DEFINE_TYPE (FooObject, foo_object, G_TYPE_OBJECT);
49 foo_object_set_property (GObject *object,
54 FooObject *foo = FOO_OBJECT (object);
61 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
67 foo_object_get_property (GObject *object,
72 FooObject *foo = FOO_OBJECT (object);
79 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
85 foo_object_class_init (FooObjectClass *klass)
87 GObjectClass *gobject_class;
89 gobject_class = G_OBJECT_CLASS (klass);
91 gobject_class->set_property = foo_object_set_property;
92 gobject_class->get_property = foo_object_get_property;
94 g_object_class_install_property (gobject_class,
96 g_param_spec_string ("string",
98 "The String Property Blurb",
100 G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
101 foo_object_signals[SIGNAL] =
102 g_signal_new ("signal",
103 G_OBJECT_CLASS_TYPE (gobject_class),
107 (GSignalCMarshaller)g_cclosure_marshal_STRING__OBJECT_POINTER,
108 G_TYPE_STRING, 2, G_TYPE_OBJECT, G_TYPE_POINTER);
113 foo_object_init (FooObject *object)
120 * @object: a #GObject
122 * Return value: an int
125 foo_object_method (FooObject *object)
131 foo_object_external_type (FooObject *object)
138 * @object: a #GObject
140 * This is a test for out arguments
142 * @outarg: (out): This is an argument test
143 * Return value: an int
146 foo_object_in (FooObject *object, int *outarg)
153 * @object: a #GObject
155 * This is a test for out arguments
157 * @outarg: (in): This is an argument test
158 * Return value: an int
161 foo_object_out (FooObject *object, int *outarg)
169 * @object: a #GObject
171 * This is a test for out arguments
173 * @inoutarg: (inout): This is an argument test
174 * Return value: an int
177 foo_object_inout (FooObject *object, int *inoutarg)
184 * @object: a #GObject
186 * This is a second test for out arguments
188 * @inoutarg: (in) (out): This is an argument test
189 * Return value: an int
192 foo_object_inout2 (FooObject *object, int *inoutarg)
200 * @object: a #GObject
202 * This is a 3th test for out arguments
204 * @inoutarg: (in-out): This is an argument test
205 * Return value: an int
208 foo_object_inout3 (FooObject *object, int *inoutarg)
214 * foo_object_calleeowns:
215 * @object: a #GObject
217 * This is a test for out arguments
219 * @toown: (callee-owns): a #GObject
220 * Return value: an int
223 foo_object_calleeowns (FooObject *object, GObject *toown)
230 * foo_object_calleesowns:
231 * @object: a #GObject
233 * This is a test for out arguments
235 * @toown1: (callee-owns): a #GObject
236 * @toown2: (callee-owns): a #GObject
237 * Return value: an int
240 foo_object_calleesowns (FooObject *object, GObject *toown1, GObject *toown2)
247 * foo_object_get_strings:
248 * @object: a #GObject
250 * This is a test for returning a list of strings
252 * Return value: (seq char* (callee-owns)) (caller-owns): list of strings
255 foo_object_get_strings (FooObject *object)
258 list = g_list_prepend (list, "foo");
259 list = g_list_prepend (list, "bar");
264 * foo_object_get_objects:
265 * @object: a #GObject
267 * This is a test for returning a list of objects.
268 * The list itself should be freed, but not the internal objects,
269 * intentionally similar example to gtk_container_get_children
271 * Return value: (seq FooObject* (callee-owns)) (caller-owns): a list
275 foo_object_get_objects (FooObject *object)
278 list = g_slist_prepend (list, object);
283 * foo_object_create_object:
284 * @object: a #GObject
286 * Test returning a caller-owned object
288 * Return value: (caller-owns): The object
291 foo_object_create_object (FooObject *object)
293 return g_object_ref (object);
296 G_DEFINE_TYPE (FooSubobject, foo_subobject, FOO_TYPE_OBJECT);
299 foo_subobject_class_init (FooSubobjectClass *klass)
305 foo_subobject_init (FooSubobject *object)
312 return FOO_SUCCESS_INT;
315 int foo_init_argv (int argc, char **argv)
317 return FOO_SUCCESS_INT;
320 int foo_init_argv_address (int *argc, char ***argv)
322 return FOO_SUCCESS_INT;
326 foo_enum_type_get_type (void)
328 static GType etype = 0;
329 if (G_UNLIKELY(etype == 0)) {
330 static const GEnumValue values[] = {
331 { FOO_ENUM_ALPHA, "FOO_ENUM_ALPHA", "alpha" },
332 { FOO_ENUM_BETA, "FOO_ENUM_BETA", "beta" },
333 { FOO_ENUM_DELTA, "FOO_ENUM_DELTA", "delta" },
336 etype = g_enum_register_static (g_intern_static_string ("FooEnumType"), values);
341 int foo_enum_method (FooEnumType foo_enum)
348 foo_flags_type_get_type (void)
350 static GType etype = 0;
351 if (G_UNLIKELY(etype == 0)) {
352 static const GFlagsValue values[] = {
353 { FOO_FLAGS_FIRST, "FOO_FLAGS_FIRST", "first" },
354 { FOO_FLAGS_SECOND, "FOO_FLAGS_SECOND", "second" },
355 { FOO_FLAGS_THIRD, "FOO_FLAGS_THIRD", "third" },
358 etype = g_flags_register_static (g_intern_static_string ("FooFlagsType"), values);
370 foo_boxed_copy (const FooBoxed *boxed)
372 return (FooBoxed *)g_memdup (boxed, sizeof (FooBoxed));
376 foo_boxed_free (FooBoxed *boxed)
378 g_slice_free (FooBoxed, boxed);
383 foo_boxed_get_type (void)
385 static GType our_type = 0;
388 our_type = g_boxed_type_register_static ("FooBoxed",
389 (GBoxedCopyFunc) foo_boxed_copy,
390 (GBoxedFreeFunc) foo_boxed_free);
397 return g_slice_new0 (FooBoxed);
401 foo_boxed_method (FooBoxed *boxed)