summaryrefslogtreecommitdiff
path: root/libpurple/prefs.c
diff options
context:
space:
mode:
authorAnkit Vani <a@nevitus.org>2013-09-07 00:11:42 +0530
committerAnkit Vani <a@nevitus.org>2013-09-07 00:11:42 +0530
commitea992f3390de90c8c68adcba5ac6641e64a88a2a (patch)
tree3d429e2214ffd2fa9038872c7f10fc9dfcdd81fe /libpurple/prefs.c
parentd314e7b583581bca96bb6f28d7d9ef8994bebb1d (diff)
parente6732d355c44689cc6f85ff18fa6f8ae0e9a502b (diff)
downloadpidgin-ea992f3390de90c8c68adcba5ac6641e64a88a2a.tar.gz
Merged soc.2013.gobjectification branch
Diffstat (limited to 'libpurple/prefs.c')
-rw-r--r--libpurple/prefs.c54
1 files changed, 27 insertions, 27 deletions
diff --git a/libpurple/prefs.c b/libpurple/prefs.c
index f8f5f6ea70..78e6258645 100644
--- a/libpurple/prefs.c
+++ b/libpurple/prefs.c
@@ -109,59 +109,59 @@ purple_pref *find_pref(const char *name)
*********************************************************************/
/*
- * This function recursively creates the xmlnode tree from the prefs
+ * This function recursively creates the PurpleXmlNode tree from the prefs
* tree structure. Yay recursion!
*/
static void
-pref_to_xmlnode(xmlnode *parent, struct purple_pref *pref)
+pref_to_xmlnode(PurpleXmlNode *parent, struct purple_pref *pref)
{
- xmlnode *node, *childnode;
+ PurpleXmlNode *node, *childnode;
struct purple_pref *child;
char buf[21];
GList *cur;
/* Create a new node */
- node = xmlnode_new_child(parent, "pref");
- xmlnode_set_attrib(node, "name", pref->name);
+ node = purple_xmlnode_new_child(parent, "pref");
+ purple_xmlnode_set_attrib(node, "name", pref->name);
/* Set the type of this node (if type == PURPLE_PREF_NONE then do nothing) */
if (pref->type == PURPLE_PREF_INT) {
- xmlnode_set_attrib(node, "type", "int");
+ purple_xmlnode_set_attrib(node, "type", "int");
g_snprintf(buf, sizeof(buf), "%d", pref->value.integer);
- xmlnode_set_attrib(node, "value", buf);
+ purple_xmlnode_set_attrib(node, "value", buf);
}
else if (pref->type == PURPLE_PREF_STRING) {
- xmlnode_set_attrib(node, "type", "string");
- xmlnode_set_attrib(node, "value", pref->value.string ? pref->value.string : "");
+ purple_xmlnode_set_attrib(node, "type", "string");
+ purple_xmlnode_set_attrib(node, "value", pref->value.string ? pref->value.string : "");
}
else if (pref->type == PURPLE_PREF_STRING_LIST) {
- xmlnode_set_attrib(node, "type", "stringlist");
+ purple_xmlnode_set_attrib(node, "type", "stringlist");
for (cur = pref->value.stringlist; cur != NULL; cur = cur->next)
{
- childnode = xmlnode_new_child(node, "item");
- xmlnode_set_attrib(childnode, "value", cur->data ? cur->data : "");
+ childnode = purple_xmlnode_new_child(node, "item");
+ purple_xmlnode_set_attrib(childnode, "value", cur->data ? cur->data : "");
}
}
else if (pref->type == PURPLE_PREF_PATH) {
char *encoded = g_filename_to_utf8(pref->value.string ? pref->value.string : "", -1, NULL, NULL, NULL);
- xmlnode_set_attrib(node, "type", "path");
- xmlnode_set_attrib(node, "value", encoded);
+ purple_xmlnode_set_attrib(node, "type", "path");
+ purple_xmlnode_set_attrib(node, "value", encoded);
g_free(encoded);
}
else if (pref->type == PURPLE_PREF_PATH_LIST) {
- xmlnode_set_attrib(node, "type", "pathlist");
+ purple_xmlnode_set_attrib(node, "type", "pathlist");
for (cur = pref->value.stringlist; cur != NULL; cur = cur->next)
{
char *encoded = g_filename_to_utf8(cur->data ? cur->data : "", -1, NULL, NULL, NULL);
- childnode = xmlnode_new_child(node, "item");
- xmlnode_set_attrib(childnode, "value", encoded);
+ childnode = purple_xmlnode_new_child(node, "item");
+ purple_xmlnode_set_attrib(childnode, "value", encoded);
g_free(encoded);
}
}
else if (pref->type == PURPLE_PREF_BOOLEAN) {
- xmlnode_set_attrib(node, "type", "bool");
+ purple_xmlnode_set_attrib(node, "type", "bool");
g_snprintf(buf, sizeof(buf), "%d", pref->value.boolean);
- xmlnode_set_attrib(node, "value", buf);
+ purple_xmlnode_set_attrib(node, "value", buf);
}
/* All My Children */
@@ -169,18 +169,18 @@ pref_to_xmlnode(xmlnode *parent, struct purple_pref *pref)
pref_to_xmlnode(node, child);
}
-static xmlnode *
+static PurpleXmlNode *
prefs_to_xmlnode(void)
{
- xmlnode *node;
+ PurpleXmlNode *node;
struct purple_pref *pref, *child;
pref = &prefs;
/* Create the root preference node */
- node = xmlnode_new("pref");
- xmlnode_set_attrib(node, "version", "1");
- xmlnode_set_attrib(node, "name", "/");
+ node = purple_xmlnode_new("pref");
+ purple_xmlnode_set_attrib(node, "version", "1");
+ purple_xmlnode_set_attrib(node, "name", "/");
/* All My Children */
for (child = pref->first_child; child != NULL; child = child->sibling)
@@ -192,7 +192,7 @@ prefs_to_xmlnode(void)
static void
sync_prefs(void)
{
- xmlnode *node;
+ PurpleXmlNode *node;
char *data;
if (!prefs_loaded)
@@ -207,10 +207,10 @@ sync_prefs(void)
}
node = prefs_to_xmlnode();
- data = xmlnode_to_formatted_str(node, NULL);
+ data = purple_xmlnode_to_formatted_str(node, NULL);
purple_util_write_data_to_file("prefs.xml", data, -1);
g_free(data);
- xmlnode_free(node);
+ purple_xmlnode_free(node);
}
static gboolean