diff options
author | Felix Riemann <friemann@gnome.org> | 2015-09-11 21:00:19 +0200 |
---|---|---|
committer | Felix Riemann <friemann@gnome.org> | 2015-09-11 21:00:19 +0200 |
commit | 68a5a0d842d993da6957dee74535ee15c8742394 (patch) | |
tree | 7b63d8991620fb377c6cc46710c62be765763a58 | |
parent | fff55c6afdd1c159c1ec554316fa6170f561cbe1 (diff) | |
download | eog-68a5a0d842d993da6957dee74535ee15c8742394.tar.gz |
EogPropertiesDialog: Use standard::display-name when showing the parent
This simply adapts the changes from commit fff55c6a to the
properties dialog, which shares some code with the EogMetadataSidebar.
https://bugzilla.gnome.org/show_bug.cgi?id=754731
-rw-r--r-- | src/eog-properties-dialog.c | 46 |
1 files changed, 40 insertions, 6 deletions
diff --git a/src/eog-properties-dialog.c b/src/eog-properties-dialog.c index 2e1c176d..8aef73c9 100644 --- a/src/eog-properties-dialog.c +++ b/src/eog-properties-dialog.c @@ -114,10 +114,37 @@ struct _EogPropertiesDialogPrivate { G_DEFINE_TYPE_WITH_PRIVATE (EogPropertiesDialog, eog_properties_dialog, GTK_TYPE_DIALOG); static void +parent_file_display_name_query_info_cb (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + EogPropertiesDialog *prop_dlg = EOG_PROPERTIES_DIALOG (user_data); + GFile *parent_file = G_FILE (source_object); + GFileInfo *file_info; + gchar *display_name; + + + 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); + } + gtk_button_set_label (GTK_BUTTON (prop_dlg->priv->folder_button), + display_name); + gtk_widget_set_sensitive (prop_dlg->priv->folder_button, TRUE); + + g_free (display_name); + g_object_unref (prop_dlg); +} + +static void pd_update_general_tab (EogPropertiesDialog *prop_dlg, EogImage *image) { - gchar *bytes_str, *dir_str; + gchar *bytes_str; gchar *width_str, *height_str; GFile *file, *parent_file; GFileInfo *file_info; @@ -172,16 +199,23 @@ pd_update_general_tab (EogPropertiesDialog *prop_dlg, /* file is root directory itself */ parent_file = g_object_ref (file); } - dir_str = g_file_get_basename (parent_file); - gtk_button_set_label (GTK_BUTTON (prop_dlg->priv->folder_button), - dir_str); + + gtk_widget_set_sensitive (prop_dlg->priv->folder_button, FALSE); + gtk_button_set_label (GTK_BUTTON (prop_dlg->priv->folder_button), NULL); g_free (prop_dlg->priv->folder_button_uri); prop_dlg->priv->folder_button_uri = g_file_get_uri (parent_file); - g_object_unref (parent_file); + 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 (prop_dlg)); + + g_object_unref (parent_file); g_free (type_str); g_free (bytes_str); - g_free (dir_str); } #if HAVE_EXEMPI |