Top | Description | Object Hierarchy | Properties | Signals | ![]() |
![]() |
![]() |
![]() |
struct GtkdocObject; struct GtkdocObjectClass; GtkdocObject * gtkdoc_object_new (void
); void gtkdoc_object_set_otest (GObject *self
,const gchar *value
); void gtkdoc_object_frobnicate (GObject *self
,gint n
); gboolean gtkdoc_object_fooify (GObject *self
,...
); #define GTKDOC_OBJECT_MACRO_DUMMY (parameter_1, parameter_2) #define GTKDOC_OBJECT_MACRO_SUM (parameter_1, parameter_2)
"dep-otest" :No Hooks
"otest" :No Hooks
"strings-changed" :No Hooks
"variant-changed" :No Hooks
This file contains non-sense code for the sole purpose of testing the docs. We can link to the "otest" property and the "otest" signal.
When subclassing it is useful to override the GtkdocObjectClass.test()
method. The GtkdocObjectClass.foo_bar()
vmethod lets you refine your
frobnicator.
A new instance can be created using the gtkdoc_object_new()
function. The
whole lifecycle usualy looks like shown in this example:
1 2 3 4 5 |
GObject *myobj;
myobj = gtkdoc_object_new();
// do something
g_object_unref (myobj); |
You can also change parameters:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
/* example for gobject usage * checkout the article at http://en.wikipedia.org/wiki/GObject * * This example is part of the release, that can be downloaded * from ftp://ftp.gnome.org/pub/gnome/sources/gtk-doc/ or any mirror. */ #include <glib.h> #include <glib-object.h> gint main(gint argc, gchar **argv) { GObject *myobj; myobj = gtkdoc_object_new(); g_object_set (myobj, "parameter", 5, NULL); g_object_unref (myobj); return 0; } |
This example serves two main purposes:
testing conversion (long description follows here)
catching bugs
having an example
Nothing more to say.
struct GtkdocObjectClass { GObjectClass parent; /* class methods */ void (*test)(const GtkdocObject * const self, gconstpointer const user_data); gboolean (*ping)(const GtkdocObject * const self); gboolean (*foo_bar)(const GtkdocObject * const self); };
class data of gtk-doc unit test class
GObjectClass |
this is a bug :/ |
overideable method | |
can be used before calling the function |
|
lets you refine your frobnicator |
GtkdocObject * gtkdoc_object_new (void
);
Create a new instance
This will only work if you have called g_type_init()
before.
Returns : |
the instance or NULL in case of an error |
Since 0.1
void gtkdoc_object_set_otest (GObject *self
,const gchar *value
);
gtkdoc_object_set_otest
is deprecated and should not be used in newly-written code. Use g_object_set(obj,"otest",value,NULL); instead.
Set the "otest" property. This is a long paragraph.
Oh, btw. setting the property directly saves us one method.
|
the object |
|
the new otest value, whose description extends further than one line will allow |
Since 0.5
void gtkdoc_object_frobnicate (GObject *self
,gint n
);
Frobnicate the content of self
n
times. This implements a
complex algorithm (http://en.wikipedia.org/wiki/Algorithm).
[2]
|
the object |
|
number of iterations |
Since 0.5
gboolean gtkdoc_object_fooify (GObject *self
,...
);
Fooify the content of self
.
|
the object |
|
a NULL terminated list of arguments |
Returns : |
TRUE for success |
#define GTKDOC_OBJECT_MACRO_DUMMY(parameter_1,parameter_2) /* do nothing */
This macro does nothing.
|
first arg |
|
second arg |
Since 0.1
"dep-otest"
property"dep-otest" gchar* : Read / Write
GtkdocObject:dep-otest
is deprecated and should not be used in newly-written code. use "otest" property
dummy deprecated property for object.
Default value: "dummy"
"otest"
property"otest" gchar* : Read / Write
dummy property for object.
Default value: "dummy"
Since 0.1
"dep-otest"
signalvoid user_function (GtkdocObject *self,
gpointer user_data) : No Hooks
GtkdocObject::dep-otest
is deprecated and should not be used in newly-written code. Use the "otest" signal instead.
Here's an example signal handler.
1 2 3 4 5 6 7 8 9 10 |
static gchar* otest_callback (GObject *o, gpointer user_data) { gdouble value; value = abs (o->value); return value; } |
|
myself |
|
user data set when the signal handler was connected. |
"otest"
signalvoid user_function (GtkdocObject *self,
gpointer user_data) : No Hooks
The event has been triggered.
|
myself |
|
user data set when the signal handler was connected. |
"strings-changed"
signalvoid user_function (GtkdocObject *arg0,
GStrv arg1,
gpointer user_data) : No Hooks
Something has happened.
|
user data set when the signal handler was connected. |
"variant-changed"
signalvoid user_function (GtkdocObject *arg0,
GVariant *arg1,
gpointer user_data) : No Hooks
Something has happened.
|
user data set when the signal handler was connected. |