[gnome-commander] tabs: gnome_cmd_file_selector_set_directory_to_opposite() --> GnomeCmdMainWin::set_fs_directory_to_o



commit a9bea14419f9176497c104778ef22693c9a51039
Author: Piotr Eljasiak <epiotr src gnome org>
Date:   Sat Jun 5 12:47:41 2010 +0200

    tabs: gnome_cmd_file_selector_set_directory_to_opposite() --> GnomeCmdMainWin::set_fs_directory_to_opposite()

 src/gnome-cmd-file-selector.cc |   25 -------------------------
 src/gnome-cmd-file-selector.h  |    2 --
 src/gnome-cmd-main-win.cc      |   23 +++++++++++++++++++++++
 src/gnome-cmd-main-win.h       |    2 ++
 src/gnome-cmd-user-actions.cc  |    8 ++++----
 5 files changed, 29 insertions(+), 31 deletions(-)
---
diff --git a/src/gnome-cmd-file-selector.cc b/src/gnome-cmd-file-selector.cc
index 28dbb8c..7053733 100644
--- a/src/gnome-cmd-file-selector.cc
+++ b/src/gnome-cmd-file-selector.cc
@@ -1118,31 +1118,6 @@ void GnomeCmdFileSelector::set_active(gboolean value)
 }
 
 
-void gnome_cmd_file_selector_set_directory_to_opposite (GnomeCmdMainWin *mw, FileSelectorID fsID)
-{
-    g_return_if_fail (mw!=NULL);
-
-    GnomeCmdFileSelector *fs = mw->fs(fsID);
-    GnomeCmdFileSelector *other = mw->fs(!fsID);
-
-    GnomeCmdDir *dir = other->get_directory();
-    gboolean fs_is_active = fs->priv->active;
-
-    if (!fs_is_active)
-    {
-        GnomeCmdFile *f = other->file_list()->get_selected_file();
-
-        if (f && f->info->type==GNOME_VFS_FILE_TYPE_DIRECTORY)
-            dir = gnome_cmd_dir_new_from_info (f->info, dir);
-    }
-
-    set_connection (fs, other->get_connection(), dir);
-
-    other->set_active(!fs_is_active);
-    fs->set_active(fs_is_active);
-}
-
-
 void GnomeCmdFileSelector::update_connections()
 {
     if (!priv->realized)
diff --git a/src/gnome-cmd-file-selector.h b/src/gnome-cmd-file-selector.h
index 247ad14..95fcbb9 100644
--- a/src/gnome-cmd-file-selector.h
+++ b/src/gnome-cmd-file-selector.h
@@ -112,8 +112,6 @@ inline void GnomeCmdFileSelector::set_connection(GnomeCmdCon *con, GnomeCmdDir *
 GtkType gnome_cmd_file_selector_get_type ();
 GtkWidget *gnome_cmd_file_selector_new ();
 
-void gnome_cmd_file_selector_set_directory_to_opposite (GnomeCmdMainWin *mw, FileSelectorID fsID);
-
 gboolean gnome_cmd_file_selector_is_local (FileSelectorID fsID);
 
 void gnome_cmd_file_selector_show_new_textfile_dialog (GnomeCmdFileSelector *fs);
diff --git a/src/gnome-cmd-main-win.cc b/src/gnome-cmd-main-win.cc
index 44383e2..760bbbf 100644
--- a/src/gnome-cmd-main-win.cc
+++ b/src/gnome-cmd-main-win.cc
@@ -1113,6 +1113,29 @@ void GnomeCmdMainWin::switch_fs(GnomeCmdFileSelector *fs)
 }
 
 
+void GnomeCmdMainWin::set_fs_directory_to_opposite(FileSelectorID fsID)
+{
+    GnomeCmdFileSelector *fs =  this->fs(fsID);
+    GnomeCmdFileSelector *other = this->fs(!fsID);
+
+    GnomeCmdDir *dir = other->get_directory();
+    gboolean fs_is_active = fs->is_active();
+
+    if (!fs_is_active)
+    {
+        GnomeCmdFile *file = other->file_list()->get_selected_file();
+
+        if (file && file->info->type == GNOME_VFS_FILE_TYPE_DIRECTORY)
+            dir = gnome_cmd_dir_new_from_info (file->info, dir);
+    }
+
+    fs->file_list()->set_connection(other->get_connection(), dir);
+
+    other->set_active(!fs_is_active);
+    fs->set_active(fs_is_active);
+}
+
+
 static void gnome_cmd_main_win_real_switch_fs (GnomeCmdMainWin *mw, GnomeCmdFileSelector *fs)
 {
     g_return_if_fail (GNOME_CMD_IS_MAIN_WIN (mw));
diff --git a/src/gnome-cmd-main-win.h b/src/gnome-cmd-main-win.h
index 92e97ca..d640463 100644
--- a/src/gnome-cmd-main-win.h
+++ b/src/gnome-cmd-main-win.h
@@ -62,6 +62,8 @@ struct GnomeCmdMainWin
 
     void switch_fs(GnomeCmdFileSelector *fs);
 
+    void set_fs_directory_to_opposite(FileSelectorID fsID);
+
     void set_equal_panes();
     GnomeCmdState *get_state();
     void set_cap_state(gboolean state);
diff --git a/src/gnome-cmd-user-actions.cc b/src/gnome-cmd-user-actions.cc
index 7017d1c..c2db686 100644
--- a/src/gnome-cmd-user-actions.cc
+++ b/src/gnome-cmd-user-actions.cc
@@ -1388,25 +1388,25 @@ void view_equal_panes (GtkMenuItem *menuitem, gpointer not_used)
 
 void view_in_left_pane (GtkMenuItem *menuitem, gpointer not_used)
 {
-    gnome_cmd_file_selector_set_directory_to_opposite ((GnomeCmdMainWin *) GTK_WIDGET (main_win), LEFT);
+    main_win->set_fs_directory_to_opposite(LEFT);
 }
 
 
 void view_in_right_pane (GtkMenuItem *menuitem, gpointer not_used)
 {
-    gnome_cmd_file_selector_set_directory_to_opposite ((GnomeCmdMainWin *) GTK_WIDGET (main_win), RIGHT);
+    main_win->set_fs_directory_to_opposite(RIGHT);
 }
 
 
 void view_in_active_pane (GtkMenuItem *menuitem, gpointer not_used)
 {
-    gnome_cmd_file_selector_set_directory_to_opposite ((GnomeCmdMainWin *) GTK_WIDGET (main_win), ACTIVE);
+    main_win->set_fs_directory_to_opposite(ACTIVE);
 }
 
 
 void view_in_inactive_pane (GtkMenuItem *menuitem, gpointer not_used)
 {
-    gnome_cmd_file_selector_set_directory_to_opposite ((GnomeCmdMainWin *) GTK_WIDGET (main_win), INACTIVE);
+    main_win->set_fs_directory_to_opposite(INACTIVE);
 }
 
 



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