diff --git a/thunar/thunar-file.c b/thunar/thunar-file.c index 9e5393c..65d1eba 100644 --- a/thunar/thunar-file.c +++ b/thunar/thunar-file.c @@ -2609,14 +2609,33 @@ thunar_file_get_emblem_names (ThunarFile *file) /* check if we need to load the emblems_list from the metafile */ if (G_UNLIKELY ((file->flags & THUNAR_FILE_OWNS_EMBLEM_NAMES) == 0)) { - emblem_string = thunar_file_get_metadata (file, THUNAR_METAFILE_KEY_EMBLEMS, ""); - if (G_UNLIKELY (*emblem_string != '\0')) + /* read first the gio metadata */ + emblem_names = g_strdupv (g_file_info_get_attribute_stringv (file->info, + "metadata::emblems")); + if (G_UNLIKELY (emblem_names != NULL)) { - emblem_names = g_strsplit (emblem_string, ";", -1); g_object_set_qdata_full (G_OBJECT (file), thunar_file_emblem_names_quark, emblem_names, (GDestroyNotify) g_strfreev); } - file->flags |= THUNAR_FILE_OWNS_EMBLEM_NAMES; + else + { + /* if there's no gio emblem, try the deprecated tdb file */ + emblem_string = thunar_file_get_metadata (file, THUNAR_METAFILE_KEY_EMBLEMS, ""); + if (G_UNLIKELY (*emblem_string != '\0')) + { + emblem_names = g_strsplit (emblem_string, ";", -1); + g_object_set_qdata_full (G_OBJECT (file), thunar_file_emblem_names_quark, + emblem_names, (GDestroyNotify) g_strfreev); + /* and migrate the emblems to gio */ + g_file_set_attribute (file->gfile, "metadata::emblems", + G_FILE_ATTRIBUTE_TYPE_STRINGV, + &emblem_names[0], + G_FILE_QUERY_INFO_NONE, + NULL, NULL); + thunar_file_set_metadata (file, THUNAR_METAFILE_KEY_EMBLEMS, "", ""); + } + file->flags |= THUNAR_FILE_OWNS_EMBLEM_NAMES; + } } /* determine the custom emblems */ @@ -2674,7 +2693,6 @@ thunar_file_set_emblem_names (ThunarFile *file, { GList *lp; gchar **emblems; - gchar *emblems_string; gint n; _thunar_return_if_fail (THUNAR_IS_FILE (file)); @@ -2702,9 +2720,11 @@ thunar_file_set_emblem_names (ThunarFile *file, emblems, (GDestroyNotify) g_strfreev); /* store the emblem list in the file's metadata */ - emblems_string = g_strjoinv (";", emblems); - thunar_file_set_metadata (file, THUNAR_METAFILE_KEY_EMBLEMS, emblems_string, ""); - g_free (emblems_string); + g_file_set_attribute (file->gfile, "metadata::emblems", + G_FILE_ATTRIBUTE_TYPE_STRINGV, + &emblems[0], + G_FILE_QUERY_INFO_NONE, + NULL, NULL); /* tell everybody that we have changed */ thunar_file_changed (file); diff --git a/thunarx/thunarx-file-info.h b/thunarx/thunarx-file-info.h index 13a7001..551c443 100644 --- a/thunarx/thunarx-file-info.h +++ b/thunarx/thunarx-file-info.h @@ -39,6 +39,7 @@ G_BEGIN_DECLS; #define THUNARX_FILE_INFO_NAMESPACE \ "access::*," \ "id::*," \ + "metadata::*," \ "mountable::*," \ "preview::*," \ "standard::*," \