Mercurial > pidgin.yaz
annotate finch/libgnt/gntutils.c @ 16278:70a368273778
Fix that pesky ICQ "Unable to add buddy 1" error. Basically we were
trying to add something to our server-stored buddy list, but there
was no "master container" to add the item to. For normal buddies the
oscar code added the master container if needed, but that wasn't
happening for things like the buddy icon item, or the permit/deny item.
So if you had an empty buddylist and you attempted to set an icon
for your icq account, or you changed your privacy setting, or you
went invisible or not invisible then you'd see the error.
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Fri, 20 Apr 2007 06:51:33 +0000 |
parents | 5f204f55af09 |
children | 8410511f4dbb |
rev | line source |
---|---|
16125
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
1 #include "gntbutton.h" |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
2 #include "gntcheckbox.h" |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
3 #include "gntcombobox.h" |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
4 #include "gntentry.h" |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
5 #include "gntlabel.h" |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
6 #include "gntline.h" |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
7 #include "gnttextview.h" |
15979
2c81ebc7bf0b
Add a way to get a list of bindings for a widget. This can be used by, eg, a window-manager to show helpful messages to the user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15818
diff
changeset
|
8 #include "gnttree.h" |
16125
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
9 #include "gntutils.h" |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
10 #include "gntwindow.h" |
15818 | 11 |
16125
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
12 #include "config.h" |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
13 |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
14 #include <stdarg.h> |
15818 | 15 #include <stdlib.h> |
16 #include <string.h> | |
17 | |
16125
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
18 #ifndef NO_LIBXML |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
19 #include <libxml/parser.h> |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
20 #include <libxml/tree.h> |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
21 #endif |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
22 |
15818 | 23 #include "config.h" |
24 | |
25 void gnt_util_get_text_bound(const char *text, int *width, int *height) | |
26 { | |
27 const char *s = text, *last; | |
28 int count = 1, max = 0; | |
29 int len; | |
30 | |
31 /* XXX: ew ... everyone look away */ | |
32 last = s; | |
33 if (s) | |
34 { | |
35 while (*s) | |
36 { | |
37 if (*s == '\n' || *s == '\r') | |
38 { | |
39 count++; | |
40 len = gnt_util_onscreen_width(last, s); | |
41 if (max < len) | |
42 max = len; | |
43 last = s + 1; | |
44 } | |
45 s = g_utf8_next_char(s); | |
46 } | |
47 | |
48 len = gnt_util_onscreen_width(last, s); | |
49 if (max < len) | |
50 max = len; | |
51 } | |
52 | |
53 if (height) | |
54 *height = count; | |
55 if (width) | |
56 *width = max + (count > 1); | |
57 } | |
58 | |
59 int gnt_util_onscreen_width(const char *start, const char *end) | |
60 { | |
61 int width = 0; | |
62 | |
63 if (end == NULL) | |
64 end = start + strlen(start); | |
65 | |
66 while (start < end) { | |
67 width += g_unichar_iswide(g_utf8_get_char(start)) ? 2 : 1; | |
68 start = g_utf8_next_char(start); | |
69 } | |
70 return width; | |
71 } | |
72 | |
73 const char *gnt_util_onscreen_width_to_pointer(const char *string, int len, int *w) | |
74 { | |
75 int size; | |
76 int width = 0; | |
77 const char *str = string; | |
78 | |
79 if (len <= 0) { | |
80 len = gnt_util_onscreen_width(string, NULL); | |
81 } | |
82 | |
83 while (width < len && *str) { | |
84 size = g_unichar_iswide(g_utf8_get_char(str)) ? 2 : 1; | |
85 if (width + size > len) | |
86 break; | |
87 str = g_utf8_next_char(str); | |
88 width += size; | |
89 } | |
90 if (w) | |
91 *w = width; | |
92 return str; | |
93 } | |
94 | |
95 char *gnt_util_onscreen_fit_string(const char *string, int maxw) | |
96 { | |
97 const char *start, *end; | |
98 GString *str; | |
99 | |
100 if (maxw <= 0) | |
101 maxw = getmaxx(stdscr) - 4; | |
102 | |
103 start = string; | |
104 str = g_string_new(NULL); | |
105 | |
106 while (*start) { | |
107 if ((end = strchr(start, '\n')) != NULL || | |
108 (end = strchr(start, '\r')) != NULL) { | |
109 if (gnt_util_onscreen_width(start, end) > maxw) | |
110 end = NULL; | |
111 } | |
112 if (end == NULL) | |
113 end = gnt_util_onscreen_width_to_pointer(start, maxw, NULL); | |
114 str = g_string_append_len(str, start, end - start); | |
115 if (*end) { | |
116 str = g_string_append_c(str, '\n'); | |
117 if (*end == '\n' || *end == '\r') | |
118 end++; | |
119 } | |
120 start = end; | |
121 } | |
122 return g_string_free(str, FALSE); | |
123 } | |
124 | |
125 struct duplicate_fns | |
126 { | |
127 GDupFunc key_dup; | |
128 GDupFunc value_dup; | |
129 GHashTable *table; | |
130 }; | |
131 | |
132 static void | |
133 duplicate_values(gpointer key, gpointer value, gpointer data) | |
134 { | |
135 struct duplicate_fns *fns = data; | |
136 g_hash_table_insert(fns->table, fns->key_dup ? fns->key_dup(key) : key, | |
137 fns->value_dup ? fns->value_dup(value) : value); | |
138 } | |
139 | |
140 GHashTable *g_hash_table_duplicate(GHashTable *src, GHashFunc hash, | |
141 GEqualFunc equal, GDestroyNotify key_d, GDestroyNotify value_d, | |
142 GDupFunc key_dup, GDupFunc value_dup) | |
143 { | |
144 GHashTable *dest = g_hash_table_new_full(hash, equal, key_d, value_d); | |
145 struct duplicate_fns fns = {key_dup, value_dup, dest}; | |
146 g_hash_table_foreach(src, duplicate_values, &fns); | |
147 return dest; | |
148 } | |
149 | |
150 gboolean gnt_boolean_handled_accumulator(GSignalInvocationHint *ihint, | |
151 GValue *return_accu, | |
152 const GValue *handler_return, | |
153 gpointer dummy) | |
154 { | |
155 gboolean continue_emission; | |
156 gboolean signal_handled; | |
157 | |
158 signal_handled = g_value_get_boolean (handler_return); | |
159 g_value_set_boolean (return_accu, signal_handled); | |
160 continue_emission = !signal_handled; | |
161 | |
162 return continue_emission; | |
163 } | |
164 | |
15979
2c81ebc7bf0b
Add a way to get a list of bindings for a widget. This can be used by, eg, a window-manager to show helpful messages to the user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15818
diff
changeset
|
165 typedef struct { |
2c81ebc7bf0b
Add a way to get a list of bindings for a widget. This can be used by, eg, a window-manager to show helpful messages to the user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15818
diff
changeset
|
166 GHashTable *hash; |
2c81ebc7bf0b
Add a way to get a list of bindings for a widget. This can be used by, eg, a window-manager to show helpful messages to the user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15818
diff
changeset
|
167 GntTree *tree; |
2c81ebc7bf0b
Add a way to get a list of bindings for a widget. This can be used by, eg, a window-manager to show helpful messages to the user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15818
diff
changeset
|
168 } BindingView; |
2c81ebc7bf0b
Add a way to get a list of bindings for a widget. This can be used by, eg, a window-manager to show helpful messages to the user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15818
diff
changeset
|
169 |
2c81ebc7bf0b
Add a way to get a list of bindings for a widget. This can be used by, eg, a window-manager to show helpful messages to the user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15818
diff
changeset
|
170 static void |
2c81ebc7bf0b
Add a way to get a list of bindings for a widget. This can be used by, eg, a window-manager to show helpful messages to the user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15818
diff
changeset
|
171 add_binding(gpointer key, gpointer value, gpointer data) |
2c81ebc7bf0b
Add a way to get a list of bindings for a widget. This can be used by, eg, a window-manager to show helpful messages to the user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15818
diff
changeset
|
172 { |
2c81ebc7bf0b
Add a way to get a list of bindings for a widget. This can be used by, eg, a window-manager to show helpful messages to the user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15818
diff
changeset
|
173 BindingView *bv = data; |
2c81ebc7bf0b
Add a way to get a list of bindings for a widget. This can be used by, eg, a window-manager to show helpful messages to the user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15818
diff
changeset
|
174 GntBindableActionParam *act = value; |
2c81ebc7bf0b
Add a way to get a list of bindings for a widget. This can be used by, eg, a window-manager to show helpful messages to the user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15818
diff
changeset
|
175 const char *name = g_hash_table_lookup(bv->hash, act->action); |
2c81ebc7bf0b
Add a way to get a list of bindings for a widget. This can be used by, eg, a window-manager to show helpful messages to the user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15818
diff
changeset
|
176 if (name && *name) { |
2c81ebc7bf0b
Add a way to get a list of bindings for a widget. This can be used by, eg, a window-manager to show helpful messages to the user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15818
diff
changeset
|
177 const char *k = gnt_key_lookup(key); |
2c81ebc7bf0b
Add a way to get a list of bindings for a widget. This can be used by, eg, a window-manager to show helpful messages to the user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15818
diff
changeset
|
178 if (!k) |
2c81ebc7bf0b
Add a way to get a list of bindings for a widget. This can be used by, eg, a window-manager to show helpful messages to the user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15818
diff
changeset
|
179 k = key; |
2c81ebc7bf0b
Add a way to get a list of bindings for a widget. This can be used by, eg, a window-manager to show helpful messages to the user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15818
diff
changeset
|
180 gnt_tree_add_row_after(bv->tree, (gpointer)k, |
2c81ebc7bf0b
Add a way to get a list of bindings for a widget. This can be used by, eg, a window-manager to show helpful messages to the user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15818
diff
changeset
|
181 gnt_tree_create_row(bv->tree, k, name), NULL, NULL); |
2c81ebc7bf0b
Add a way to get a list of bindings for a widget. This can be used by, eg, a window-manager to show helpful messages to the user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15818
diff
changeset
|
182 } |
2c81ebc7bf0b
Add a way to get a list of bindings for a widget. This can be used by, eg, a window-manager to show helpful messages to the user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15818
diff
changeset
|
183 } |
2c81ebc7bf0b
Add a way to get a list of bindings for a widget. This can be used by, eg, a window-manager to show helpful messages to the user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15818
diff
changeset
|
184 |
2c81ebc7bf0b
Add a way to get a list of bindings for a widget. This can be used by, eg, a window-manager to show helpful messages to the user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15818
diff
changeset
|
185 static void |
2c81ebc7bf0b
Add a way to get a list of bindings for a widget. This can be used by, eg, a window-manager to show helpful messages to the user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15818
diff
changeset
|
186 add_action(gpointer key, gpointer value, gpointer data) |
2c81ebc7bf0b
Add a way to get a list of bindings for a widget. This can be used by, eg, a window-manager to show helpful messages to the user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15818
diff
changeset
|
187 { |
2c81ebc7bf0b
Add a way to get a list of bindings for a widget. This can be used by, eg, a window-manager to show helpful messages to the user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15818
diff
changeset
|
188 BindingView *bv = data; |
2c81ebc7bf0b
Add a way to get a list of bindings for a widget. This can be used by, eg, a window-manager to show helpful messages to the user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15818
diff
changeset
|
189 g_hash_table_insert(bv->hash, value, key); |
2c81ebc7bf0b
Add a way to get a list of bindings for a widget. This can be used by, eg, a window-manager to show helpful messages to the user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15818
diff
changeset
|
190 } |
2c81ebc7bf0b
Add a way to get a list of bindings for a widget. This can be used by, eg, a window-manager to show helpful messages to the user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15818
diff
changeset
|
191 |
2c81ebc7bf0b
Add a way to get a list of bindings for a widget. This can be used by, eg, a window-manager to show helpful messages to the user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15818
diff
changeset
|
192 GntWidget *gnt_widget_bindings_view(GntWidget *widget) |
2c81ebc7bf0b
Add a way to get a list of bindings for a widget. This can be used by, eg, a window-manager to show helpful messages to the user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15818
diff
changeset
|
193 { |
2c81ebc7bf0b
Add a way to get a list of bindings for a widget. This can be used by, eg, a window-manager to show helpful messages to the user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15818
diff
changeset
|
194 GntBindable *bind = GNT_BINDABLE(widget); |
2c81ebc7bf0b
Add a way to get a list of bindings for a widget. This can be used by, eg, a window-manager to show helpful messages to the user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15818
diff
changeset
|
195 GntWidget *tree = gnt_tree_new_with_columns(2); |
2c81ebc7bf0b
Add a way to get a list of bindings for a widget. This can be used by, eg, a window-manager to show helpful messages to the user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15818
diff
changeset
|
196 GntBindableClass *klass = GNT_BINDABLE_CLASS(GNT_BINDABLE_GET_CLASS(bind)); |
2c81ebc7bf0b
Add a way to get a list of bindings for a widget. This can be used by, eg, a window-manager to show helpful messages to the user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15818
diff
changeset
|
197 GHashTable *hash = g_hash_table_new(g_direct_hash, g_direct_equal); |
2c81ebc7bf0b
Add a way to get a list of bindings for a widget. This can be used by, eg, a window-manager to show helpful messages to the user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15818
diff
changeset
|
198 BindingView bv = {hash, GNT_TREE(tree)}; |
2c81ebc7bf0b
Add a way to get a list of bindings for a widget. This can be used by, eg, a window-manager to show helpful messages to the user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15818
diff
changeset
|
199 |
2c81ebc7bf0b
Add a way to get a list of bindings for a widget. This can be used by, eg, a window-manager to show helpful messages to the user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15818
diff
changeset
|
200 gnt_tree_set_compare_func(bv.tree, (GCompareFunc)g_utf8_collate); |
2c81ebc7bf0b
Add a way to get a list of bindings for a widget. This can be used by, eg, a window-manager to show helpful messages to the user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15818
diff
changeset
|
201 g_hash_table_foreach(klass->actions, add_action, &bv); |
2c81ebc7bf0b
Add a way to get a list of bindings for a widget. This can be used by, eg, a window-manager to show helpful messages to the user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15818
diff
changeset
|
202 g_hash_table_foreach(klass->bindings, add_binding, &bv); |
16125
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
203 if (GNT_TREE(tree)->list == NULL) { |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
204 gnt_widget_destroy(tree); |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
205 tree = NULL; |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
206 } else |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
207 gnt_tree_adjust_columns(bv.tree); |
15979
2c81ebc7bf0b
Add a way to get a list of bindings for a widget. This can be used by, eg, a window-manager to show helpful messages to the user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15818
diff
changeset
|
208 g_hash_table_destroy(hash); |
2c81ebc7bf0b
Add a way to get a list of bindings for a widget. This can be used by, eg, a window-manager to show helpful messages to the user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15818
diff
changeset
|
209 |
2c81ebc7bf0b
Add a way to get a list of bindings for a widget. This can be used by, eg, a window-manager to show helpful messages to the user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15818
diff
changeset
|
210 return tree; |
2c81ebc7bf0b
Add a way to get a list of bindings for a widget. This can be used by, eg, a window-manager to show helpful messages to the user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15818
diff
changeset
|
211 } |
2c81ebc7bf0b
Add a way to get a list of bindings for a widget. This can be used by, eg, a window-manager to show helpful messages to the user.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15818
diff
changeset
|
212 |
16125
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
213 #ifndef NO_LIBXML |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
214 static GntWidget * |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
215 gnt_widget_from_xmlnode(xmlNode *node, GntWidget **data[]) |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
216 { |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
217 GntWidget *widget = NULL; |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
218 char *name; |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
219 char *id, *prop, *content; |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
220 int val; |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
221 |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
222 if (node == NULL || node->name == NULL || node->type != XML_ELEMENT_NODE) |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
223 return NULL; |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
224 |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
225 name = (char*)node->name; |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
226 content = (char*)xmlNodeGetContent(node); |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
227 if (strcmp(name + 1, "window") == 0 || strcmp(name + 1, "box") == 0) { |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
228 xmlNode *ch; |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
229 char *title; |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
230 gboolean vert = (*name == 'v'); |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
231 |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
232 if (name[1] == 'w') |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
233 widget = gnt_window_box_new(FALSE, vert); |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
234 else |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
235 widget = gnt_box_new(FALSE, vert); |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
236 |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
237 title = (char*)xmlGetProp(node, (xmlChar*)"title"); |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
238 if (title) { |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
239 gnt_box_set_title(GNT_BOX(widget), title); |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
240 xmlFree(title); |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
241 } |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
242 |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
243 prop = (char*)xmlGetProp(node, (xmlChar*)"fill"); |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
244 if (prop) { |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
245 if (sscanf(prop, "%d", &val) == 1) |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
246 gnt_box_set_fill(GNT_BOX(widget), !!val); |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
247 xmlFree(prop); |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
248 } |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
249 |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
250 prop = (char*)xmlGetProp(node, (xmlChar*)"align"); |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
251 if (prop) { |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
252 if (sscanf(prop, "%d", &val) == 1) |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
253 gnt_box_set_alignment(GNT_BOX(widget), val); |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
254 xmlFree(prop); |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
255 } |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
256 |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
257 prop = (char*)xmlGetProp(node, (xmlChar*)"pad"); |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
258 if (prop) { |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
259 if (sscanf(prop, "%d", &val) == 1) |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
260 gnt_box_set_pad(GNT_BOX(widget), val); |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
261 xmlFree(prop); |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
262 } |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
263 |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
264 for (ch = node->children; ch; ch=ch->next) |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
265 gnt_box_add_widget(GNT_BOX(widget), gnt_widget_from_xmlnode(ch, data)); |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
266 } else if (strcmp(name, "button") == 0) { |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
267 widget = gnt_button_new(content); |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
268 } else if (strcmp(name, "label") == 0) { |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
269 widget = gnt_label_new(content); |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
270 } else if (strcmp(name, "entry") == 0) { |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
271 widget = gnt_entry_new(content); |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
272 } else if (strcmp(name, "combobox") == 0) { |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
273 widget = gnt_combo_box_new(); |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
274 } else if (strcmp(name, "checkbox") == 0) { |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
275 widget = gnt_check_box_new(content); |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
276 } else if (strcmp(name, "tree") == 0) { |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
277 widget = gnt_tree_new(); |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
278 } else if (strcmp(name, "textview") == 0) { |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
279 widget = gnt_text_view_new(); |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
280 } else if (strcmp(name + 1, "line") == 0) { |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
281 widget = gnt_line_new(*name == 'v'); |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
282 } |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
283 |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
284 xmlFree(content); |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
285 |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
286 if (widget == NULL) { |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
287 g_printerr("Invalid widget name %s\n", name); |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
288 return NULL; |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
289 } |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
290 |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
291 id = (char*)xmlGetProp(node, (xmlChar*)"id"); |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
292 if (id) { |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
293 int i; |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
294 sscanf(id, "%d", &i); |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
295 *data[i] = widget; |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
296 xmlFree(id); |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
297 } |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
298 |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
299 prop = (char*)xmlGetProp(node, (xmlChar*)"border"); |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
300 if (prop) { |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
301 int val; |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
302 if (sscanf(prop, "%d", &val) == 1) { |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
303 if (val) |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
304 GNT_WIDGET_UNSET_FLAGS(widget, GNT_WIDGET_NO_BORDER); |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
305 else |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
306 GNT_WIDGET_SET_FLAGS(widget, GNT_WIDGET_NO_BORDER); |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
307 } |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
308 xmlFree(prop); |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
309 } |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
310 |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
311 prop = (char*)xmlGetProp(node, (xmlChar*)"shadow"); |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
312 if (prop) { |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
313 int val; |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
314 if (sscanf(prop, "%d", &val) == 1) { |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
315 if (val) |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
316 GNT_WIDGET_UNSET_FLAGS(widget, GNT_WIDGET_NO_BORDER); |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
317 else |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
318 GNT_WIDGET_SET_FLAGS(widget, GNT_WIDGET_NO_BORDER); |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
319 } |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
320 xmlFree(prop); |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
321 } |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
322 |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
323 return widget; |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
324 } |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
325 #endif |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
326 |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
327 void gnt_util_parse_widgets(const char *string, int num, ...) |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
328 { |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
329 #ifndef NO_LIBXML |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
330 xmlParserCtxtPtr ctxt; |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
331 xmlDocPtr doc; |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
332 xmlNodePtr node; |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
333 va_list list; |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
334 GntWidget ***data; |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
335 int id; |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
336 |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
337 ctxt = xmlNewParserCtxt(); |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
338 doc = xmlCtxtReadDoc(ctxt, (xmlChar*)string, NULL, NULL, XML_PARSE_NOBLANKS); |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
339 |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
340 data = g_new0(GntWidget **, num); |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
341 |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
342 va_start(list, num); |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
343 for (id = 0; id < num; id++) |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
344 data[id] = va_arg(list, gpointer); |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
345 |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
346 node = xmlDocGetRootElement(doc); |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
347 gnt_widget_from_xmlnode(node, data); |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
348 |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
349 xmlFreeDoc(doc); |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
350 xmlCleanupParser(); |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
351 va_end(list); |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
352 g_free(data); |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
353 #endif |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
354 } |
5f204f55af09
Add a utility function to create widgets from an XML description.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15979
diff
changeset
|
355 |