diff --git a/thunar/thunar-application.c b/thunar/thunar-application.c index a4bf91408384ae66ca534e8a388110cef1bb8e0d..9e6b7ddfa2de25244e15a9ffc1bce7e26fa2612a 100644 --- a/thunar/thunar-application.c +++ b/thunar/thunar-application.c @@ -1294,14 +1294,26 @@ thunar_application_copy_into (ThunarApplication *application, GFile *target_file, GClosure *new_files_closure) { + gchar *display_name; + gchar *title; + _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); + /* collect the target files and launch the job */ thunar_application_collect_and_launch (application, parent, "stock_folder-copy", - _("Copying files..."), thunar_io_jobs_copy_files, - source_file_list, target_file, new_files_closure); + title, thunar_io_jobs_copy_files, + source_file_list, target_file, + new_files_closure); + + /* free the title */ + g_free (title); } @@ -1325,18 +1337,29 @@ void thunar_application_link_into (ThunarApplication *application, gpointer parent, GList *source_file_list, - GFile *target_file, + GFile *target_file, GClosure *new_files_closure) { + gchar *display_name; + gchar *title; + _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 (_("Creating symbolic links in \"%s\"..."), display_name); + g_free (display_name); + /* collect the target files and launch the job */ thunar_application_collect_and_launch (application, parent, "stock_link", - _("Creating symbolic links..."), - thunar_io_jobs_link_files, source_file_list, - target_file, new_files_closure); + title, thunar_io_jobs_link_files, + source_file_list, target_file, + new_files_closure); + + /* free the title */ + g_free (title); } @@ -1363,6 +1386,9 @@ thunar_application_move_into (ThunarApplication *application, GFile *target_file, GClosure *new_files_closure) { + gchar *display_name; + gchar *title; + _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 (target_file != NULL); @@ -1374,11 +1400,20 @@ thunar_application_move_into (ThunarApplication *application, } else { + /* generate a title for the progress dialog */ + display_name = thunar_file_cached_display_name (target_file); + title = g_strdup_printf (_("Moving files into \"%s\"..."), display_name); + g_free (display_name); + + /* collect the target files and launch the job */ thunar_application_collect_and_launch (application, parent, - "stock_folder-move", _("Moving files..."), + "stock_folder-move", title, thunar_io_jobs_move_files, source_file_list, target_file, new_files_closure); + + /* free the title */ + g_free (title); } } @@ -1417,7 +1452,7 @@ thunar_application_unlink_files (ThunarApplication *application, gboolean permanently; GList *path_list = NULL; GList *lp; - gchar *message; + gchar *message; guint n_path_list = 0; gint response; diff --git a/thunar/thunar-file.c b/thunar/thunar-file.c index e4c39656f9a60316ae5eb3408f3298fcf23f82c4..1e4297f45def3206a1c179a60c3cee67b02c4daa 100644 --- a/thunar/thunar-file.c +++ b/thunar/thunar-file.c @@ -3220,6 +3220,33 @@ thunar_file_cache_lookup (const GFile *file) +gchar * +thunar_file_cached_display_name (const GFile *file) +{ + ThunarFile *cached_file; + gchar *base_name; + gchar *display_name; + + /* check if we have a ThunarFile for it in the cache (usually is the case) */ + cached_file = thunar_file_cache_lookup (file); + if (cached_file != NULL) + { + /* determine the display name of the file */ + display_name = g_strdup (thunar_file_get_display_name (cached_file)); + } + else + { + /* determine something a hopefully good approximation of the display name */ + base_name = g_file_get_basename (G_FILE (file)); + display_name = g_filename_display_name (base_name); + g_free (base_name); + } + + return display_name; +} + + + /** * thunar_file_list_get_applications: * @file_list : a #GList of #ThunarFile<!---->s. diff --git a/thunar/thunar-file.h b/thunar/thunar-file.h index a7772983e5375531da04e39d9741f9233692bd3a..4b9ed807b5f51110aff33ac3ba7099a02a7a69ec 100644 --- a/thunar/thunar-file.h +++ b/thunar/thunar-file.h @@ -252,6 +252,7 @@ gboolean thunar_file_same_filesystem (const ThunarFile *file const ThunarFile *file_b); ThunarFile *thunar_file_cache_lookup (const GFile *file); +gchar *thunar_file_cached_display_name (const GFile *file); GList *thunar_file_list_get_applications (GList *file_list);