summaryrefslogtreecommitdiff
path: root/libcaja-private
diff options
context:
space:
mode:
authorrbuj <[email protected]>2021-02-03 11:06:02 +0100
committerraveit65 <[email protected]>2021-02-24 20:38:18 +0100
commit66142203d95f11ec06147d8f0208b8f2e94e104d (patch)
tree6353e71f708c08c28766aaba7ba3414b15d474a1 /libcaja-private
parentdcfa054ffb8350173d6003ee427df010903e77c9 (diff)
downloadcaja-66142203d95f11ec06147d8f0208b8f2e94e104d.tar.bz2
caja-66142203d95f11ec06147d8f0208b8f2e94e104d.tar.xz
caja-customization-data: Do not build the path to the browser.xml file
Diffstat (limited to 'libcaja-private')
-rw-r--r--libcaja-private/caja-customization-data.c45
1 files changed, 18 insertions, 27 deletions
diff --git a/libcaja-private/caja-customization-data.c b/libcaja-private/caja-customization-data.c
index dded5f65..86e17382 100644
--- a/libcaja-private/caja-customization-data.c
+++ b/libcaja-private/caja-customization-data.c
@@ -459,45 +459,36 @@ format_name_for_display (CajaCustomizationData *data, const char* name)
static void
load_name_map_hash_table (CajaCustomizationData *data)
{
- char *xml_path;
-
xmlDocPtr browser_data;
xmlNodePtr category_node, current_node;
/* allocate the hash table */
data->name_map_hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
- /* build the path name to the browser.xml file and load it */
- xml_path = g_build_filename (CAJA_DATADIR, "browser.xml", NULL);
- if (xml_path)
+ /* load the browser.xml file */
+ if ((browser_data = xmlParseFile (CAJA_DATADIR "/browser.xml")) != NULL)
{
- browser_data = xmlParseFile (xml_path);
- g_free (xml_path);
+ /* get the category node */
+ category_node = eel_xml_get_root_child_by_name_and_property (browser_data, "category", "name", data->customization_name);
+ current_node = category_node->children;
- if (browser_data)
+ /* loop through the entries, adding a mapping to the hash table */
+ while (current_node != NULL)
{
- /* get the category node */
- category_node = eel_xml_get_root_child_by_name_and_property (browser_data, "category", "name", data->customization_name);
- current_node = category_node->children;
+ char *filename, *display_name;
- /* loop through the entries, adding a mapping to the hash table */
- while (current_node != NULL)
+ display_name = xmlGetProp (current_node, "display_name");
+ filename = xmlGetProp (current_node, "filename");
+ if (display_name && filename)
{
- char *filename, *display_name;
-
- display_name = xmlGetProp (current_node, "display_name");
- filename = xmlGetProp (current_node, "filename");
- if (display_name && filename)
- {
- g_hash_table_replace (data->name_map_hash, g_strdup (filename), g_strdup (_(display_name)));
- }
- xmlFree (filename);
- xmlFree (display_name);
- current_node = current_node->next;
+ g_hash_table_replace (data->name_map_hash, g_strdup (filename), g_strdup (_(display_name)));
}
-
- /* close the xml file */
- xmlFreeDoc (browser_data);
+ xmlFree (filename);
+ xmlFree (display_name);
+ current_node = current_node->next;
}
+
+ /* close the xml file */
+ xmlFreeDoc (browser_data);
}
}