From c8624fda0429761936ec61afc12386cf2fe93855 Mon Sep 17 00:00:00 2001 From: Sergios - Anestis Kefalidis <sergioskefalidis@gmail.com> Date: Tue, 18 May 2021 18:53:55 +0300 Subject: [PATCH] Fix showing volume uuid in transfer dialog (Issue #579) MR !112 Issue #579 --- thunar/thunar-application.c | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/thunar/thunar-application.c b/thunar/thunar-application.c index 93d3c6cb3..5d25533d5 100644 --- a/thunar/thunar-application.c +++ b/thunar/thunar-application.c @@ -1982,17 +1982,32 @@ thunar_application_copy_into (ThunarApplication *application, GFile *target_file, GClosure *new_files_closure) { - gchar *display_name; - gchar *title; + GVolume *volume = NULL; + gchar *display_name = NULL; + gchar *title = NULL; + gchar *volume_name = NULL; + gchar *volume_uuid = NULL; + gboolean use_display_name; _thunar_return_if_fail (parent == NULL || GDK_IS_SCREEN (parent) || GTK_IS_WIDGET (parent)); _thunar_return_if_fail (THUNAR_IS_APPLICATION (application)); _thunar_return_if_fail (G_IS_FILE (target_file)); - /* generate a title for the progress dialog */ - display_name = thunar_file_cached_display_name (target_file); - title = g_strdup_printf (_("Copying files to \"%s\"..."), display_name); - g_free (display_name); + volume = thunar_file_get_volume (thunar_file_get_for_uri (g_file_get_uri (target_file), NULL)); + if (volume != NULL) + { + volume_name = g_volume_get_name (volume); + volume_uuid = g_volume_get_uuid (volume); + } + + /* generate a title for the progress dialog */ + display_name = thunar_file_cached_display_name (target_file); + + /* if the display_name is equal to the volume_uuid display the volume_name */ + use_display_name = g_strcmp0 (display_name, volume_uuid) != 0; + + title = g_strdup_printf (_("Copying files to \"%s\"..."), use_display_name ? display_name : volume_name); + g_free (display_name); /* collect the target files and launch the job */ thunar_application_collect_and_launch (application, parent, "edit-copy", @@ -2001,8 +2016,14 @@ thunar_application_copy_into (ThunarApplication *application, FALSE, TRUE, new_files_closure); - /* free the title */ + /* free */ g_free (title); + if (volume != NULL) + { + g_free (volume_name); + g_free (volume_uuid); + g_object_unref (G_OBJECT (volume)); + } } -- GitLab