summaryrefslogtreecommitdiffstats
path: root/deskutils/gnotime/files/patch-lib::qof::qofgobj.c
blob: 89b9f5c891a1cc174ce3fdc2f65fe032b51f0696 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
--- lib/qof/qofgobj.c.orig  Mon May 24 19:55:16 2004
+++ lib/qof/qofgobj.c   Mon May 24 20:01:38 2004
@@ -57,10 +57,11 @@
 void 
 qof_gobject_shutdown (void)
 {
+  GSList *n;
+
   if (!initialized) return;
   initialized = FALSE;
                                                                                 
-  GSList *n;
   for (n=paramList; n; n=n->next) g_free(n->data);
   g_slist_free (paramList);
 
@@ -83,11 +84,14 @@
 void 
 qof_gobject_register_instance (QofBook *book, QofType type, GObject *gob)
 {
+  QofCollection *coll;
+  GSList * instance_list;
+
   if (!book || !type) return;
 
-  QofCollection *coll = qof_book_get_collection (book, type);
+  coll = qof_book_get_collection (book, type);
 
-  GSList * instance_list = qof_collection_get_data (coll);
+  instance_list = qof_collection_get_data (coll);
   instance_list = g_slist_prepend (instance_list, gob);
   qof_collection_set_data (coll, instance_list);
 }
@@ -101,6 +105,8 @@
 
   GParamSpec *gps = getter->param_userdata;
 
+  const char * str;
+
   /* Note that the return type must actually be of type
    * getter->param_type but we just follow the hard-coded 
    * mapping below ... */
@@ -110,37 +116,40 @@
     g_value_init (&gval, G_TYPE_STRING);
     g_object_get_property (gob, getter->param_name, &gval);
 
-    const char * str = g_value_get_string (&gval);
+    str = g_value_get_string (&gval);
     return (gpointer) str;
   }
   else
   if (G_IS_PARAM_SPEC_INT(gps))
   {
+    int ival;
     GValue gval = {G_TYPE_INVALID};
     g_value_init (&gval, G_TYPE_INT);
     g_object_get_property (gob, getter->param_name, &gval);
 
-    int ival = g_value_get_int (&gval);
+    ival = g_value_get_int (&gval);
     return (gpointer) ival;
   }
   else
   if (G_IS_PARAM_SPEC_UINT(gps))
   {
+    int ival;
     GValue gval = {G_TYPE_INVALID};
     g_value_init (&gval, G_TYPE_UINT);
     g_object_get_property (gob, getter->param_name, &gval);
 
-    int ival = g_value_get_uint (&gval);
+    ival = g_value_get_uint (&gval);
     return (gpointer) ival;
   }
   else
   if (G_IS_PARAM_SPEC_BOOLEAN(gps))
   {
+    int ival;
     GValue gval = {G_TYPE_INVALID};
     g_value_init (&gval, G_TYPE_BOOLEAN);
     g_object_get_property (gob, getter->param_name, &gval);
 
-    int ival = g_value_get_boolean (&gval);
+    ival = g_value_get_boolean (&gval);
     return (gpointer) ival;
   }
 
@@ -161,21 +170,23 @@
    * mapping below ... */
   if (G_IS_PARAM_SPEC_FLOAT(gps))
   {
+    double fval;
     GValue gval = {G_TYPE_INVALID};
     g_value_init (&gval, G_TYPE_FLOAT);
     g_object_get_property (gob, getter->param_name, &gval);
 
-    double fval = g_value_get_float (&gval);
+    fval = g_value_get_float (&gval);
     return fval;
   }
   else
   if (G_IS_PARAM_SPEC_DOUBLE(gps))
   {
+    double fval;
     GValue gval = {G_TYPE_INVALID};
     g_value_init (&gval, G_TYPE_DOUBLE);
     g_object_get_property (gob, getter->param_name, &gval);
 
-    double fval = g_value_get_double (&gval);
+    fval = g_value_get_double (&gval);
     return fval;
   } 
 
@@ -208,13 +219,16 @@
   /* Get the GObject properties, convert to QOF properties */
   GParamSpec **prop_list;
   int n_props;
+  int i, j=0;
+  QofParam * qof_param_list;
+  QofObject *class_def;
+
   prop_list = g_object_class_list_properties (obclass, &n_props);
 
-  QofParam * qof_param_list = g_new0 (QofParam, n_props);
+  qof_param_list = g_new0 (QofParam, n_props);
   paramList = g_slist_prepend (paramList, qof_param_list);
 
   PINFO ("object %s has %d props", e_type, n_props);
-  int i, j=0;
   for (i=0; i<n_props; i++)
   {
     GParamSpec *gparam = prop_list[i];
@@ -288,7 +302,7 @@
 
   /* ------------------------------------------------------ */
    /* Now do the class itself */
-  QofObject *class_def = g_new0 (QofObject, 1);
+  class_def = g_new0 (QofObject, 1);
   classList = g_slist_prepend (classList, class_def);
 
   class_def->interface_version = QOF_OBJECT_VERSION;