diff options
author | Felix Riemann <[email protected]> | 2015-09-11 21:00:19 +0200 |
---|---|---|
committer | raveit65 <[email protected]> | 2018-08-15 18:00:22 +0200 |
commit | 4185e8c138a31824e5465b67324847b7321cb036 (patch) | |
tree | 7efc7a2616ac3d1b8e9632ca16c103a5580ada53 | |
parent | 0e708c531d7957eac371a16bdac3577ea757e005 (diff) | |
download | eom-4185e8c138a31824e5465b67324847b7321cb036.tar.bz2 eom-4185e8c138a31824e5465b67324847b7321cb036.tar.xz |
EomPropertiesDialog: 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.
origin commit:
https://gitlab.gnome.org/GNOME/eog/commit/68a5a0
-rw-r--r-- | src/eom-properties-dialog.c | 45 |
1 files changed, 40 insertions, 5 deletions
diff --git a/src/eom-properties-dialog.c b/src/eom-properties-dialog.c index d5f6fd7..2747e92 100644 --- a/src/eom-properties-dialog.c +++ b/src/eom-properties-dialog.c @@ -111,10 +111,37 @@ struct _EomPropertiesDialogPrivate { G_DEFINE_TYPE_WITH_PRIVATE (EomPropertiesDialog, eom_properties_dialog, GTK_TYPE_DIALOG); static void +parent_file_display_name_query_info_cb (GObject *source_object, + GAsyncResult *res, + gpointer user_data) +{ + EomPropertiesDialog *prop_dlg = EOM_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 (EomPropertiesDialog *prop_dlg, EomImage *image) { - gchar *bytes_str, *dir_str, *dir_str_long; + gchar *bytes_str, *dir_str_long; gchar *width_str, *height_str; GFile *file, *parent_file; GFileInfo *file_info; @@ -169,9 +196,9 @@ pd_update_general_tab (EomPropertiesDialog *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); dir_str_long = g_file_get_path (parent_file); gtk_widget_set_tooltip_text (GTK_WIDGET (prop_dlg->priv->folder_button), @@ -179,11 +206,19 @@ pd_update_general_tab (EomPropertiesDialog *prop_dlg, g_free (prop_dlg->priv->folder_button_uri); prop_dlg->priv->folder_button_uri = g_file_get_uri (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); g_free (dir_str_long); } |