[gnome-commander] GnomeCmdMainWin: discard duplicate tabs at startup



commit b798528e7c0278b3b3400f9ed21df7def1ccc653
Author: Piotr Eljasiak <epiotr src gnome org>
Date:   Tue Aug 23 21:13:10 2011 +0200

    GnomeCmdMainWin: discard duplicate tabs at startup

 src/gnome-cmd-main-win.cc |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/src/gnome-cmd-main-win.cc b/src/gnome-cmd-main-win.cc
index 37eaabd..be1233e 100644
--- a/src/gnome-cmd-main-win.cc
+++ b/src/gnome-cmd-main-win.cc
@@ -24,6 +24,8 @@
 #include <unistd.h>
 #include <libgnomeui/gnome-stock-icons.h>
 
+#include <algorithm>
+
 #include "gnome-cmd-includes.h"
 #include "gnome-cmd-file-selector.h"
 #include "gnome-cmd-user-actions.h"
@@ -1073,12 +1075,13 @@ inline void GnomeCmdMainWin::open_tabs(FileSelectorID id)
     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)
+    vector<GnomeCmdData::Tab>::const_iterator last_tab = unique(gnome_cmd_data.tabs[id].begin(),gnome_cmd_data.tabs[id].end());
+
+    for (vector<GnomeCmdData::Tab>::const_iterator i=gnome_cmd_data.tabs[id].begin(); i!=last_tab; ++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);
     }
-
 }
 
 



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