diff options
author | Stefano Karapetsas <[email protected]> | 2012-09-06 14:14:59 +0200 |
---|---|---|
committer | Stefano Karapetsas <[email protected]> | 2012-09-06 14:14:59 +0200 |
commit | f426641aacea9d5f7683be776536bc6301c7baef (patch) | |
tree | d19911212091bfcadf2a976d219aca093ef0606f /src/caja-convert-metadata.c | |
parent | 465e6ae56a2a81cd346d573532dc4a39c16df225 (diff) | |
download | caja-f426641aacea9d5f7683be776536bc6301c7baef.tar.bz2 caja-f426641aacea9d5f7683be776536bc6301c7baef.tar.xz |
remove latest mateconf usage
metadata saved in files instead of migrate to gsettings
(caja-desktop-metadata.c is from nautilus)
Diffstat (limited to 'src/caja-convert-metadata.c')
-rw-r--r-- | src/caja-convert-metadata.c | 121 |
1 files changed, 7 insertions, 114 deletions
diff --git a/src/caja-convert-metadata.c b/src/caja-convert-metadata.c index 57c2d234..faf44e87 100644 --- a/src/caja-convert-metadata.c +++ b/src/caja-convert-metadata.c @@ -31,99 +31,10 @@ #include <glib/gi18n.h> #include <string.h> #include <libxml/tree.h> -#include <mateconf/mateconf-client.h> #include <libcaja-private/caja-metadata.h> -#define CAJA_DESKTOP_METADATA_MATECONF_PATH "/apps/caja/desktop-metadata" - static gboolean quiet = FALSE; -static char * -get_metadata_mateconf_path (const char *name, - const char *key) -{ - char *res, *escaped_name; - - escaped_name = mateconf_escape_key (name, -1); - res = g_build_filename (CAJA_DESKTOP_METADATA_MATECONF_PATH, escaped_name, key + strlen ("metadata::"), NULL); - g_free (escaped_name); - - return res; -} - -static void -desktop_set_metadata_string (GFile *file, - const char *key, - const char *string) -{ - MateConfClient *client; - char *mateconf_key; - GFile *parent; - char *name; - - parent = g_file_get_parent (file); - if (parent == NULL) - { - name = g_strdup ("directory"); - } - else - { - g_object_unref (parent); - name = g_file_get_basename (file); - } - - client = mateconf_client_get_default (); - mateconf_key = get_metadata_mateconf_path (name, key); - - mateconf_client_set_string (client, mateconf_key, string, NULL); - - g_free (mateconf_key); - g_free (name); - g_object_unref (client); -} - -static void -desktop_set_metadata_stringv (GFile *file, - const char *key, - char **stringv) -{ - MateConfClient *client; - char *mateconf_key; - GSList *list; - int i; - GFile *parent; - char *name; - - parent = g_file_get_parent (file); - if (parent == NULL) - { - name = g_strdup ("directory"); - } - else - { - g_object_unref (parent); - name = g_file_get_basename (file); - } - - client = mateconf_client_get_default (); - mateconf_key = get_metadata_mateconf_path (name, key); - - list = NULL; - for (i = 0; stringv[i] != NULL; i++) - { - list = g_slist_prepend (list, stringv[i]); - } - list = g_slist_reverse (list); - - mateconf_client_set_list (client, mateconf_key, - MATECONF_VALUE_STRING, - list, NULL); - - g_slist_free (list); - g_free (mateconf_key); - g_free (name); - g_object_unref (client); -} static xmlNodePtr xml_get_children (xmlNodePtr parent) @@ -251,11 +162,7 @@ parse_xml_node (GFile *file, char **strv; GError *error; - info = NULL; - if (!g_file_has_uri_scheme (file, "x-caja-desktop")) - { - info = g_file_info_new (); - } + info = g_file_info_new (); for (attr = filenode->properties; attr != NULL; attr = attr->next) { @@ -271,16 +178,9 @@ parse_xml_node (GFile *file, property = xmlGetProp (filenode, attr->name); if (property) { - if (info) - { - g_file_info_set_attribute_string (info, - new_key, - property); - } - else - { - desktop_set_metadata_string (file, new_key, property); - } + g_file_info_set_attribute_string (info, + new_key, + property); xmlFree (property); } } @@ -314,16 +214,9 @@ parse_xml_node (GFile *file, { strv[i] = l->data; } - if (info) - { - g_file_info_set_attribute_stringv (info, - new_key, - strv); - } - else - { - desktop_set_metadata_stringv (file, new_key, strv); - } + g_file_info_set_attribute_stringv (info, + new_key, + strv); g_free (strv); g_list_foreach (keys, (GFunc)xmlFree, NULL); g_list_free (keys); |