comparison libpurple/prefs.c @ 19145:d201f6967183

disapproval of revision '2d13603b37141a4e8eb8ce3358198dec9c9f7852'
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Wed, 11 Jul 2007 18:39:21 +0000
parents 0e30dfac1f46
children 53ad073898d0
comparison
equal deleted inserted replaced
19144:0e30dfac1f46 19145:d201f6967183
33 #include <glib.h> 33 #include <glib.h>
34 #include "internal.h" 34 #include "internal.h"
35 #include "prefs.h" 35 #include "prefs.h"
36 #include "debug.h" 36 #include "debug.h"
37 #include "util.h" 37 #include "util.h"
38 #include "xmlnode.h"
39 38
40 #ifdef _WIN32 39 #ifdef _WIN32
41 #include "win32dep.h" 40 #include "win32dep.h"
42 #endif 41 #endif
43 42
125 /* Create a new node */ 124 /* Create a new node */
126 node = xmlnode_new_child(parent, "pref"); 125 node = xmlnode_new_child(parent, "pref");
127 xmlnode_set_attrib(node, "name", pref->name); 126 xmlnode_set_attrib(node, "name", pref->name);
128 127
129 /* Set the type of this node (if type == PURPLE_PREF_NONE then do nothing) */ 128 /* Set the type of this node (if type == PURPLE_PREF_NONE then do nothing) */
130 /* XXX: Why aren't we using a switch here? */
131 if (pref->type == PURPLE_PREF_INT) { 129 if (pref->type == PURPLE_PREF_INT) {
132 xmlnode_set_attrib(node, "type", "int"); 130 xmlnode_set_attrib(node, "type", "int");
133 snprintf(buf, sizeof(buf), "%d", pref->value.integer); 131 snprintf(buf, sizeof(buf), "%d", pref->value.integer);
134 xmlnode_set_attrib(node, "value", buf); 132 xmlnode_set_attrib(node, "value", buf);
135 } 133 }
1323 purple_prefs_disconnect_by_handle(void *handle) 1321 purple_prefs_disconnect_by_handle(void *handle)
1324 { 1322 {
1325 g_return_if_fail(handle != NULL); 1323 g_return_if_fail(handle != NULL);
1326 1324
1327 disco_callback_helper_handle(&prefs, handle); 1325 disco_callback_helper_handle(&prefs, handle);
1328 }
1329
1330 static xmlnode*
1331 single_pref_to_xmlnode(const struct purple_pref *pref)
1332 {
1333 xmlnode *node;
1334 struct purple_pref *child;
1335
1336 node = xmlnode_new("pref");
1337 xmlnode_set_attrib(node,"name",pref->name);
1338
1339 for(child = pref->first_child; child != NULL; child = child->sibling)
1340 pref_to_xmlnode(node, child);
1341
1342 return node;
1343 }
1344
1345 GList *
1346 purple_prefs_get_children_names(const char *name)
1347 {
1348 struct purple_pref *pref = find_pref(name);
1349 xmlnode * node = single_pref_to_xmlnode(pref);
1350 xmlnode * child = node->child;
1351 GList * list = NULL;
1352
1353 for(child = node->child;child;child = child->next){
1354 list = g_list_append(list,xmlnode_get_attrib(child,"name"));
1355 }
1356 return list;
1357
1358 } 1326 }
1359 1327
1360 void 1328 void
1361 purple_prefs_update_old() 1329 purple_prefs_update_old()
1362 { 1330 {