summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDebarshi Ray <[email protected]>2015-09-08 18:18:00 +0200
committerraveit65 <[email protected]>2018-08-15 18:00:22 +0200
commit0e708c531d7957eac371a16bdac3577ea757e005 (patch)
tree6c5325745182cb794fd4719b3958a2e4de95cb22 /src
parentab96aad5815771d5ad53942f2a90b66bcae20af9 (diff)
downloadeom-0e708c531d7957eac371a16bdac3577ea757e005.tar.bz2
eom-0e708c531d7957eac371a16bdac3577ea757e005.tar.xz
EomMetadataSidebar: Use standard::display-name when showing the parent
https://bugzilla.gnome.org/show_bug.cgi?id=754731 origin commit: https://gitlab.gnome.org/GNOME/eog/commit/fff55c
Diffstat (limited to 'src')
-rw-r--r--src/eom-metadata-sidebar.c59
1 files changed, 45 insertions, 14 deletions
diff --git a/src/eom-metadata-sidebar.c b/src/eom-metadata-sidebar.c
index c0bb0dc..ae9ce89 100644
--- a/src/eom-metadata-sidebar.c
+++ b/src/eom-metadata-sidebar.c
@@ -94,13 +94,49 @@ struct _EomMetadataSidebarPrivate {
G_DEFINE_TYPE_WITH_PRIVATE(EomMetadataSidebar, eom_metadata_sidebar, GTK_TYPE_SCROLLED_WINDOW)
static void
+parent_file_display_name_query_info_cb (GObject *source_object,
+ GAsyncResult *res,
+ gpointer user_data)
+{
+ EomMetadataSidebar *sidebar = EOM_METADATA_SIDEBAR (user_data);
+ GFile *parent_file = G_FILE (source_object);
+ GFileInfo *file_info;
+ gchar *baseuri;
+ gchar *display_name;
+ gchar *str;
+
+ file_info = g_file_query_info_finish (parent_file, res, NULL);
+ if (file_info == NULL) {
+ display_name = g_file_get_basename (parent_file);
+ } else {
+ display_name = g_strdup (
+ g_file_info_get_display_name (file_info));
+ g_object_unref (file_info);
+ }
+ baseuri = g_file_get_uri (parent_file);
+ str = g_markup_printf_escaped ("<a href=\"%s\">%s</a>",
+ baseuri,
+ display_name);
+ gtk_label_set_markup (GTK_LABEL (sidebar->priv->folder_label), str);
+
+ g_free (str);
+ g_free (baseuri);
+ g_free (display_name);
+
+ str = g_file_get_path (parent_file);
+ gtk_widget_set_tooltip_text (GTK_WIDGET (sidebar->priv->folder_label), str);
+ g_free (str);
+
+ g_object_unref (sidebar);
+}
+
+static void
eom_metadata_sidebar_update_general_section (EomMetadataSidebar *sidebar)
{
EomMetadataSidebarPrivate *priv = sidebar->priv;
EomImage *img = priv->image;
GFile *file, *parent_file;
GFileInfo *file_info;
- gchar *basename, *baseuri;
gchar *str;
goffset bytes;
gint width, height;
@@ -146,19 +182,14 @@ eom_metadata_sidebar_update_general_section (EomMetadataSidebar *sidebar)
/* file is root directory itself */
parent_file = g_object_ref (file);
}
- basename = g_file_get_basename (parent_file);
- baseuri = g_file_get_uri (parent_file);
- str = g_markup_printf_escaped ("<a href=\"%s\">%s</a>",
- baseuri,
- basename);
- gtk_label_set_markup (GTK_LABEL (priv->folder_label), str);
- g_free (str);
- g_free (baseuri);
- g_free (basename);
-
- str = g_file_get_path (parent_file);
- gtk_widget_set_tooltip_text (GTK_WIDGET (priv->folder_label), str);
- g_free (str);
+ gtk_label_set_markup (GTK_LABEL (sidebar->priv->folder_label), NULL);
+ g_file_query_info_async (parent_file,
+ G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME,
+ G_FILE_QUERY_INFO_NONE,
+ G_PRIORITY_DEFAULT,
+ NULL,
+ parent_file_display_name_query_info_cb,
+ g_object_ref (sidebar));
g_object_unref (parent_file);
}