Updating branch refs/heads/master to 9a2645864ff9ba5dfef133586b243bb5effecb05 (commit) from e1f266d3cb89e7110c44eae9ad8c64ea9ad9a057 (commit)
commit 9a2645864ff9ba5dfef133586b243bb5effecb05 Author: Jannis Pohlmann <jan...@xfce.org> Date: Sat Sep 12 19:22:46 2009 +0200 Add the target directory display name to the titles of some operations. All operations that have only one target directory now have its display name in the title of the corresponding ThunarProgressView, e.g. 'Copying files to "Test"...'. This is accompanied by a new function called thunar_file_cached_display_name() which takes a GFile and tries to determine the display name of its cached ThunarFile, and otherwise falls back to g_filename_display_name(). thunar/thunar-application.c | 51 ++++++++++++++++++++++++++++++++++++------ thunar/thunar-file.c | 27 ++++++++++++++++++++++ thunar/thunar-file.h | 1 + 3 files changed, 71 insertions(+), 8 deletions(-) diff --git a/thunar/thunar-application.c b/thunar/thunar-application.c index a4bf914..9e6b7dd 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 e4c3965..1e4297f 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 a777298..4b9ed80 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); _______________________________________________ Xfce4-commits mailing list Xfce4-commits@xfce.org http://foo-projects.org/mailman/listinfo/xfce4-commits