debug-manager: use g_spawn_sync() instead of fork() and waitpid()
[anjuta.git] / plugins / class-gen / goc_template_source
blob061d42e402e65d555dbd56c50407d3f2e6032887
1 #include "{{HEADER_FILE_NAME}}"
2  
3 static void {{FUNCTION_PREFIX}}_class_init({{BASE_CLASS}}Class *klass);
4 static void {{FUNCTION_PREFIX}}_init({{BASE_CLASS}} *sp);
5 static void {{FUNCTION_PREFIX}}_finalize(GObject *object);
7 struct _{{BASE_CLASS}}Private {
8         /* Place Private Members Here */
9 };
11 typedef struct _{{BASE_CLASS}}Signal {{BASE_CLASS}}Signal;
12 typedef enum _{{BASE_CLASS}}SignalType {{BASE_CLASS}}SignalType;
14 enum _{{BASE_CLASS}}SignalType {
15         /* Place Signal Types Here */
16         SIGNAL_TYPE_EXAMPLE,
17         LAST_SIGNAL
20 struct _{{BASE_CLASS}}Signal {
21         {{BASE_CLASS}} *object;
24 static guint {{FUNCTION_PREFIX}}_signals[LAST_SIGNAL] = { 0 };
25 static {{PARENT_CLASS}}Class *parent_class = NULL;
27 GType
28 {{FUNCTION_PREFIX}}_get_type()
30         static GType type = 0;
32         if(type == 0) {
33                 static const GTypeInfo our_info = {
34                         sizeof ({{BASE_CLASS}}Class),
35                         NULL,
36                         NULL,
37                         (GClassInitFunc){{FUNCTION_PREFIX}}_class_init,
38                         NULL,
39                         NULL,
40                         sizeof ({{BASE_CLASS}}),
41                         0,
42                         (GInstanceInitFunc){{FUNCTION_PREFIX}}_init,
43                 };
45                 type = g_type_register_static(G_TYPE_OBJECT, 
46                         "{{BASE_CLASS}}", &our_info, 0);
47         }
49         return type;
52 static void
53 {{FUNCTION_PREFIX}}_class_init({{BASE_CLASS}}Class *klass)
55         GObjectClass *object_class = G_OBJECT_CLASS(klass);
57         parent_class = g_type_class_peek_parent(klass);
58         object_class->finalize = {{FUNCTION_PREFIX}}_finalize;
59         
60         /* Create signals here:
61            {{FUNCTION_PREFIX}}_signals[SIGNAL_TYPE_EXAMPLE] = g_signal_new(...)
62         */
65 static void
66 {{FUNCTION_PREFIX}}_init({{BASE_CLASS}} *obj)
68         obj->priv = g_new0({{BASE_CLASS}}Private, 1);
69         /* Initialize private members, etc. */
72 static void
73 {{FUNCTION_PREFIX}}_finalize(GObject *object)
75         {{BASE_CLASS}} *cobj;
76         cobj = {{GTYPE_PREFIX}}_{{GTYPE_NAME}}(object);
77         
78         /* Free private members, etc. */
79                 
80         g_free(cobj->priv);
81         G_OBJECT_CLASS(parent_class)->finalize(object);
84 {{BASE_CLASS}} *
85 {{FUNCTION_PREFIX}}_new()
87         {{BASE_CLASS}} *obj;
88         
89         obj = {{GTYPE_PREFIX}}_{{GTYPE_NAME}}(g_object_new({{GTYPE_PREFIX}}_TYPE_{{GTYPE_NAME}}, NULL));
90         
91         return obj;