[gnome-commander] An enhancement to the confirmation msg offered when overwriting an existing file
- From: Piotr Eljasiak <epiotr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-commander] An enhancement to the confirmation msg offered when overwriting an existing file
- Date: Tue, 28 Jun 2011 19:14:31 +0000 (UTC)
commit eb09faa4a8250b39a8700b6a2e13a4d684065d84
Author: Alasdair Craig <ac acraig za net>
Date: Tue Jun 28 21:13:05 2011 +0200
An enhancement to the confirmation msg offered when overwriting an
existing file
src/gnome-cmd-xfer.cc | 37 +++++++++++++++++++++++++++++++------
1 files changed, 31 insertions(+), 6 deletions(-)
---
diff --git a/src/gnome-cmd-xfer.cc b/src/gnome-cmd-xfer.cc
index 1547dba..2bee0fb 100644
--- a/src/gnome-cmd-xfer.cc
+++ b/src/gnome-cmd-xfer.cc
@@ -127,6 +127,19 @@ create_xfer_data (GnomeVFSXferOptions xferOptions, GList *src_uri_list, GList *d
}
+inline gchar *file_details(const gchar *text_uri)
+{
+ GnomeVFSFileInfo *info = gnome_vfs_file_info_new ();
+ GnomeVFSResult result = gnome_vfs_get_file_info (text_uri, info, GNOME_VFS_FILE_INFO_FOLLOW_LINKS);
+ gchar *size = create_nice_size_str (info->size);
+ gchar *details = result==GNOME_VFS_OK ? g_strdup_printf ("%s, %s", size, time2string (info->mtime, gnome_cmd_data_get_date_format ())) : g_strdup ("");
+ gnome_vfs_file_info_unref (info);
+ g_free (size);
+
+ return details;
+}
+
+
static gint async_xfer_callback (GnomeVFSAsyncHandle *handle, GnomeVFSXferProgressInfo *info, XferData *data)
{
data->cur_phase = info->phase;
@@ -154,17 +167,29 @@ static gint async_xfer_callback (GnomeVFSAsyncHandle *handle, GnomeVFSXferProgre
if (info->status == GNOME_VFS_XFER_PROGRESS_STATUS_OVERWRITE)
{
- gchar *t = gnome_cmd_dir_is_local (data->to_dir) ? gnome_vfs_get_local_path_from_uri (info->target_name) :
- str_uri_basename (info->target_name);
- gchar *fn = get_utf8 (t);
- gchar *msg = g_strdup_printf (_("The file \"%s\" already exists.\n\nDo you want to overwrite it?\n"), fn);
+ gchar *s = gnome_cmd_dir_is_local (data->src_fl->cwd) ? gnome_vfs_get_local_path_from_uri (info->source_name) : str_uri_basename (info->source_name);
+ gchar *t = gnome_cmd_dir_is_local (data->to_dir) ? gnome_vfs_get_local_path_from_uri (info->target_name) : str_uri_basename (info->target_name);
+
+ gchar *source_filename = get_utf8 (s);
+ gchar *target_filename = get_utf8 (t);
+
+ g_free (s);
+ g_free (t);
+
+ gchar *source_details = file_details (info->source_name);
+ gchar *target_details = file_details (info->target_name);
+
+ gchar *msg = g_strdup_printf (_("Overwrite file:\n\n<b>%s</b>\n<span color='dimgray' size='smaller'>%s</span>\n\nWith:\n\n<b>%s</b>\n<span color='dimgray' size='smaller'>%s</span>"),
+ target_filename, target_details, source_filename, source_details);
+ g_free (source_filename);
+ g_free (target_filename);
+ g_free (source_details);
+ g_free (target_details);
gdk_threads_enter ();
gint ret = run_simple_dialog (*main_win, FALSE, GTK_MESSAGE_QUESTION, msg, " ",
1, _("Abort"), _("Replace"), _("Replace All"), _("Skip"), _("Skip All"), NULL);
g_free (msg);
- g_free (fn);
- g_free (t);
data->prev_status = GNOME_VFS_XFER_PROGRESS_STATUS_OVERWRITE;
gdk_threads_leave ();
return ret==-1 ? 0 : ret;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]