[gnome-commander] New GnomeCmdMainWin::open_tabs(FileSelectorID id) method



commit 0d31900b1d23f090bb296927d5f82bb1554b4f5b
Author: Piotr Eljasiak <epiotr src gnome org>
Date:   Tue Aug 23 20:58:12 2011 +0200

    New GnomeCmdMainWin::open_tabs(FileSelectorID id) method

 src/gnome-cmd-main-win.cc |   37 ++++++++++++++++++-------------------
 src/gnome-cmd-main-win.h  |    2 ++
 2 files changed, 20 insertions(+), 19 deletions(-)
---
diff --git a/src/gnome-cmd-main-win.cc b/src/gnome-cmd-main-win.cc
index 9f31390..37eaabd 100644
--- a/src/gnome-cmd-main-win.cc
+++ b/src/gnome-cmd-main-win.cc
@@ -806,25 +806,8 @@ static void init (GnomeCmdMainWin *mw)
     mw->fs(LEFT)->update_connections();
     mw->fs(RIGHT)->update_connections();
 
-    GnomeCmdCon *home = get_home_con ();
-
-    if (gnome_cmd_data.tabs[LEFT].empty())
-        gnome_cmd_data.tabs[LEFT].push_back(make_pair(string(g_get_home_dir ()), make_triple(GnomeCmdFileList::COLUMN_NAME, GTK_SORT_ASCENDING, FALSE)));
-
-    for (vector<GnomeCmdData::Tab>::const_iterator i=gnome_cmd_data.tabs[LEFT].begin(); i!=gnome_cmd_data.tabs[LEFT].end(); ++i)
-    {
-        GnomeCmdDir *dir = gnome_cmd_dir_new (home, gnome_cmd_con_create_path (home, i->first.c_str()));
-        mw->fs(LEFT)->new_tab(dir, i->second.first, i->second.second, i->second.third, TRUE);
-    }
-
-    if (gnome_cmd_data.tabs[RIGHT].empty())
-        gnome_cmd_data.tabs[RIGHT].push_back(make_pair(string(g_get_home_dir ()), make_triple(GnomeCmdFileList::COLUMN_NAME, GTK_SORT_ASCENDING,FALSE)));
-
-    for (vector<GnomeCmdData::Tab>::const_iterator i=gnome_cmd_data.tabs[RIGHT].begin(); i!=gnome_cmd_data.tabs[RIGHT].end(); ++i)
-    {
-        GnomeCmdDir *dir = gnome_cmd_dir_new (home, gnome_cmd_con_create_path (home, i->first.c_str()));
-        mw->fs(RIGHT)->new_tab(dir, i->second.first, i->second.second, i->second.third, TRUE);
-    }
+    mw->open_tabs(LEFT);
+    mw->open_tabs(RIGHT);
 
     gnome_cmd_data.tabs.clear();        //  free unused memory
 
@@ -1083,6 +1066,22 @@ gboolean GnomeCmdMainWin::key_pressed(GdkEventKey *event)
 }
 
 
+inline void GnomeCmdMainWin::open_tabs(FileSelectorID id)
+{
+    GnomeCmdCon *home = get_home_con ();
+
+    if (gnome_cmd_data.tabs[id].empty())
+        gnome_cmd_data.tabs[id].push_back(make_pair(string(g_get_home_dir ()), make_triple(GnomeCmdFileList::COLUMN_NAME, GTK_SORT_ASCENDING, FALSE)));
+
+    for (vector<GnomeCmdData::Tab>::const_iterator i=gnome_cmd_data.tabs[id].begin(); i!=gnome_cmd_data.tabs[id].end(); ++i)
+    {
+        GnomeCmdDir *dir = gnome_cmd_dir_new (home, gnome_cmd_con_create_path (home, i->first.c_str()));
+        fs(id)->new_tab(dir, i->second.first, i->second.second, i->second.third, TRUE);
+    }
+
+}
+
+
 void GnomeCmdMainWin::switch_fs(GnomeCmdFileSelector *fs)
 {
     g_return_if_fail (GNOME_CMD_IS_FILE_SELECTOR (fs));
diff --git a/src/gnome-cmd-main-win.h b/src/gnome-cmd-main-win.h
index f20c24d..59fd5fa 100644
--- a/src/gnome-cmd-main-win.h
+++ b/src/gnome-cmd-main-win.h
@@ -71,6 +71,8 @@ struct GnomeCmdMainWin
 
     gboolean key_pressed (GdkEventKey *event);
 
+    void open_tabs(FileSelectorID id);
+
     void switch_fs(GnomeCmdFileSelector *fs);
     void change_connection(FileSelectorID id);
 



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