[gnome-commander] Preserve focused file after renamed with AdvRenDialog
- From: Uwe Scholz <uwescholz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-commander] Preserve focused file after renamed with AdvRenDialog
- Date: Sat, 27 Jun 2015 20:58:47 +0000 (UTC)
commit ed442bcecb707955191d70d5f2ad77ae10f81024
Author: Martin Mocko <vid512 gmail com>
Date: Sat Jun 27 22:49:05 2015 +0200
Preserve focused file after renamed with AdvRenDialog
Signed-off-by: Uwe Scholz <uwescholz src gnome org>
src/dialogs/gnome-cmd-advrename-dialog.cc | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/src/dialogs/gnome-cmd-advrename-dialog.cc b/src/dialogs/gnome-cmd-advrename-dialog.cc
index c64fdc6..57e76ad 100644
--- a/src/dialogs/gnome-cmd-advrename-dialog.cc
+++ b/src/dialogs/gnome-cmd-advrename-dialog.cc
@@ -440,11 +440,16 @@ void GnomeCmdAdvrenameDialog::Private::on_dialog_size_allocate (GtkWidget *widge
void GnomeCmdAdvrenameDialog::Private::on_dialog_response (GnomeCmdAdvrenameDialog *dialog, int response_id,
gpointer unused)
{
GtkTreeIter i;
+ gchar *old_focused_file_name, *new_focused_file_name;
switch (response_id)
{
case GTK_RESPONSE_OK:
case GTK_RESPONSE_APPLY:
+
+ old_focused_file_name = main_win->fs(ACTIVE)->file_list()->get_focused_file()->get_name();
+ new_focused_file_name = 0;
+
for (gboolean valid_iter=gtk_tree_model_get_iter_first (dialog->files, &i); valid_iter;
valid_iter=gtk_tree_model_iter_next (dialog->files, &i))
{
GnomeCmdFile *f;
@@ -455,6 +460,7 @@ void GnomeCmdAdvrenameDialog::Private::on_dialog_response (GnomeCmdAdvrenameDial
COL_NEW_NAME, &new_name,
-1);
+ gchar *old_name = g_strdup (f->info->name);
GnomeVFSResult result = GNOME_VFS_OK;
if (strcmp (f->info->name, new_name) != 0)
@@ -465,7 +471,16 @@ void GnomeCmdAdvrenameDialog::Private::on_dialog_response (GnomeCmdAdvrenameDial
COL_RENAME_FAILED, result!=GNOME_VFS_OK,
-1);
+ if (!new_focused_file_name && (result == GNOME_VFS_OK) && !strcmp(old_focused_file_name,
old_name))
+ new_focused_file_name = g_strdup(new_name);
+
g_free (new_name);
+ g_free (old_name);
+ }
+ if (new_focused_file_name)
+ {
+ main_win->fs(ACTIVE)->file_list()->focus_file(new_focused_file_name, TRUE);
+ g_free (new_focused_file_name);
}
dialog->update_new_filenames();
dialog->defaults.templates.add(dialog->priv->profile_component->get_template_entry());
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]