GHashTable *
parse_theme(gchar *file){
GHashTable *hash;
+ xmlDoc *doc;
+ xmlNode *root, *first_child, *node;
+ doc = xmlReadFile(file, NULL, 0);
+ root = xmlDocGetRootElement(doc);
+ first_child = root->children;
hash = g_hash_table_new(g_str_hash, g_str_equal);
- g_hash_table_insert(hash, g_strdup("name"), g_strdup("Xsnow"));
- g_hash_table_insert(hash, g_strdup("exec_path"), g_strdup("/usr/bin/xsnow"));
+ for (node = first_child; node; node = node->next){
+ if (node->type == XML_ELEMENT_NODE){
+ fprintf(stderr, "%s => %s\n", node->name, xmlNodeGetContent(node));
+ g_hash_table_insert(hash, node->name, xmlNodeGetContent(node));
+ }
+ }
+ xmlFreeDoc(doc);
+ xmlCleanupParser();
+ //g_hash_table_insert(hash, g_strdup("name"), g_strdup("Xsnow"));
+ //g_hash_table_insert(hash, g_strdup("exec_path"), g_strdup("/usr/bin/xsnow"));
return hash;
}
if(!strcmp(dp->d_name, ".") || !strcmp(dp->d_name, ".."))
continue;
if(dp->d_type == DT_REG || dp->d_type == DT_LNK){
- store = g_slist_append(store, parse_theme(dp->d_name));
+ store = g_slist_append(store, parse_theme(g_strdup_printf("%s%s", EXTHEME_PATH, dp->d_name)));
}
}
closedir(dir_fd);