[gnome-commander] tab lock: open new tab when changing cwd 1/2



commit 91c1a5890eb241ae0d92f8280996daa87531cbdd
Author: Piotr Eljasiak <epiotr src gnome org>
Date:   Tue Jan 11 22:13:15 2011 +0100

    tab lock: open new tab when changing cwd 1/2

 src/gnome-cmd-dir-indicator.cc |    6 +++---
 src/gnome-cmd-file-selector.cc |   19 +++++++++++--------
 2 files changed, 14 insertions(+), 11 deletions(-)
---
diff --git a/src/gnome-cmd-dir-indicator.cc b/src/gnome-cmd-dir-indicator.cc
index 6fc928c..d0a0be3 100644
--- a/src/gnome-cmd-dir-indicator.cc
+++ b/src/gnome-cmd-dir-indicator.cc
@@ -103,7 +103,7 @@ static gboolean on_dir_indicator_clicked (GnomeCmdDirIndicator *indicator, GdkEv
             {
                 chTo[indicator->priv->slashCharPosition[i]] = 0;
                 main_win->switch_fs(fs);
-                if (event->button==2 || event->state&GDK_CONTROL_MASK)
+                if (event->button==2 || event->state&GDK_CONTROL_MASK || fs->file_list()->locked)
                 {
                     GnomeCmdCon *con = fs->get_connection();
                     GnomeCmdDir *dir = gnome_cmd_dir_new (con, gnome_cmd_con_create_path (con, chTo));
@@ -290,7 +290,7 @@ static void on_dir_history_item_selected (GtkMenuItem *item, const gchar *path)
 
     main_win->switch_fs(indicator->priv->fs);
 
-    if (mask&GDK_CONTROL_MASK)
+    if (mask&GDK_CONTROL_MASK || indicator->priv->fs->file_list()->locked)
     {
         GnomeCmdCon *con = indicator->priv->fs->get_connection();
         GnomeCmdDir *dir = gnome_cmd_dir_new (con, gnome_cmd_con_create_path (con, path));
@@ -314,7 +314,7 @@ static void on_bookmark_item_selected (GtkMenuItem *item, GnomeCmdBookmark *bm)
 
     main_win->switch_fs(indicator->priv->fs);
 
-    if (mask&GDK_CONTROL_MASK)
+    if (mask&GDK_CONTROL_MASK || indicator->priv->fs->file_list()->locked)
     {
         GnomeCmdCon *con = indicator->priv->fs->get_connection();
         GnomeCmdDir *dir = gnome_cmd_dir_new (con, gnome_cmd_con_create_path (con, bm->path));
diff --git a/src/gnome-cmd-file-selector.cc b/src/gnome-cmd-file-selector.cc
index 6866eb7..c303084 100644
--- a/src/gnome-cmd-file-selector.cc
+++ b/src/gnome-cmd-file-selector.cc
@@ -251,14 +251,17 @@ void GnomeCmdFileSelector::do_file_specific_action (GnomeCmdFileList *fl, GnomeC
     g_return_if_fail (f->info!=NULL);
 
     if (f->info->type == GNOME_VFS_FILE_TYPE_DIRECTORY)
-    {
-        fl->invalidate_tree_size();
+        if (!fl->locked)
+        {
+            fl->invalidate_tree_size();
 
-        if (f->is_dotdot)
-            fl->goto_directory("..");
+            if (f->is_dotdot)
+                fl->goto_directory("..");
+            else
+                fl->set_directory(GNOME_CMD_DIR (f));
+        }
         else
-            fl->set_directory(GNOME_CMD_DIR (f));
-    }
+            new_tab(f->is_dotdot ? gnome_cmd_dir_get_parent (fl->cwd) : GNOME_CMD_DIR (f));
 }
 
 
@@ -316,7 +319,7 @@ static void on_con_combo_item_selected (GnomeCmdCombo *con_combo, GnomeCmdCon *c
 
     gdk_window_get_pointer (NULL, NULL, NULL, &mask);
 
-    if (mask & GDK_CONTROL_MASK)
+    if (mask & GDK_CONTROL_MASK || fs->file_list()->locked)
         fs->new_tab(gnome_cmd_con_get_default_dir (con));
     else
         fs->set_connection(con);
@@ -345,7 +348,7 @@ static void on_con_btn_clicked (GtkWidget *widget, GdkEventButton *event, GnomeC
 
     main_win->switch_fs(fs);
 
-    if (event->button==2 || event->state&GDK_CONTROL_MASK)
+    if (event->button==2 || event->state&GDK_CONTROL_MASK || fs->file_list()->locked)
         fs->new_tab(gnome_cmd_con_get_default_dir (con));
 
     fs->set_connection(con);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]