summaryrefslogtreecommitdiff
path: root/libcaja-private
diff options
context:
space:
mode:
authorrbuj <[email protected]>2021-02-03 11:06:02 +0100
committerraveit65 <[email protected]>2022-07-21 19:33:50 +0200
commit45c68efee99e19a6db1f61fd703f90e78f7c7333 (patch)
treede014e16f7d2d5ea734114ceb6131db01a52cde6 /libcaja-private
parent01f33f981f436b85d86e408bb64899abb6e6ca91 (diff)
downloadcaja-45c68efee99e19a6db1f61fd703f90e78f7c7333.tar.bz2
caja-45c68efee99e19a6db1f61fd703f90e78f7c7333.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 1b9e6608..bfc477a4 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);
}
}