[gnome-commander] GnomeCmdFileList: added GnomeCmdFileList(sort_col, sort_order) constructor for setting sort params a



commit 19fa38b2a960ac2ac23afca7bc11f42f90c63fc3
Author: Piotr Eljasiak <epiotr src gnome org>
Date:   Sun Jul 18 22:51:43 2010 +0200

    GnomeCmdFileList: added GnomeCmdFileList(sort_col, sort_order) constructor for setting sort params at creation time

 src/gnome-cmd-file-list.cc     |   26 ++++++++++++++++++--------
 src/gnome-cmd-file-list.h      |   16 +---------------
 src/gnome-cmd-file-selector.cc |    5 +++--
 src/gnome-cmd-search-dialog.cc |    2 +-
 4 files changed, 23 insertions(+), 26 deletions(-)
---
diff --git a/src/gnome-cmd-file-list.cc b/src/gnome-cmd-file-list.cc
index de6f194..8fa4a88 100644
--- a/src/gnome-cmd-file-list.cc
+++ b/src/gnome-cmd-file-list.cc
@@ -204,14 +204,6 @@ GnomeCmdFileList::Private::Private(GnomeCmdFileList *fl)
 
     memset(sort_raising, GTK_SORT_ASCENDING, sizeof(sort_raising));
 
-    gint col = COLUMN_NAME;             // defaults,
-    gboolean b = GTK_SORT_ASCENDING;    // used when not set by gnome_cmd_data_get_sort_params()
-
-    gnome_cmd_data_get_sort_params (fl, col, b);
-    current_col = col;
-    sort_raising[col] = b;
-    sort_func = file_list_column[col].sort_func;
-
     for (gint i=0; i<NUM_COLUMNS; i++)
         gtk_clist_set_column_resizeable (*fl, i, TRUE);
 }
@@ -223,6 +215,24 @@ GnomeCmdFileList::Private::~Private()
 }
 
 
+GnomeCmdFileList::GnomeCmdFileList(ColumnID sort_col, GtkSortType sort_order)
+{
+    realized = FALSE;
+    modifier_click = FALSE;
+    con = NULL;
+    cwd = NULL;
+    lwd = NULL;
+    connected_dir = NULL;
+
+    priv->current_col = sort_col;
+    priv->sort_raising[sort_col] = sort_order;
+    priv->sort_func = file_list_column[sort_col].sort_func;
+
+    create_column_titles();
+
+    init_dnd();
+}
+
 inline gchar *strip_extension (const gchar *fname)
 {
     gchar *s = g_strdup (fname);
diff --git a/src/gnome-cmd-file-list.h b/src/gnome-cmd-file-list.h
index 99aa184..23a3f5e 100644
--- a/src/gnome-cmd-file-list.h
+++ b/src/gnome-cmd-file-list.h
@@ -95,7 +95,7 @@ struct GnomeCmdFileList
     GnomeCmdDir *cwd, *lwd;         // current & last working dir
     GnomeCmdDir *connected_dir;
 
-    GnomeCmdFileList();
+    GnomeCmdFileList(ColumnID sort_col, GtkSortType sort_order);
     ~GnomeCmdFileList();
 
     int size()                          {  return g_list_length (get_visible_files());  }
@@ -180,20 +180,6 @@ inline void *GnomeCmdFileList::operator new (size_t size)
     return g_object_new (GNOME_CMD_TYPE_FILE_LIST, "n-columns", GnomeCmdFileList::NUM_COLUMNS, NULL);
 }
 
-inline GnomeCmdFileList::GnomeCmdFileList()
-{
-    realized = FALSE;
-    modifier_click = FALSE;
-    con = NULL;
-    cwd = NULL;
-    lwd = NULL;
-    connected_dir = NULL;
-
-    create_column_titles();
-
-    init_dnd();
-}
-
 inline GnomeCmdFileList::~GnomeCmdFileList()
 {
     gnome_cmd_dir_unref (cwd);
diff --git a/src/gnome-cmd-file-selector.cc b/src/gnome-cmd-file-selector.cc
index a091738..c7572ab 100644
--- a/src/gnome-cmd-file-selector.cc
+++ b/src/gnome-cmd-file-selector.cc
@@ -713,8 +713,9 @@ static void init (GnomeCmdFileSelector *fs)
     fs->con_hbox = create_hbox (*fs, FALSE, 2);
 
     // create the notebook and the first tab
+    FileSelectorID id = main_win->fs(fs);
     fs->notebook = new GnomeCmdNotebook;
-    fs->new_tab();
+    fs->new_tab(NULL, gnome_cmd_data.get_sort_col(id), gnome_cmd_data.get_sort_direction(id));
 
     // create the connection combo
     fs->con_combo = new GnomeCmdCombo(2, 1);
@@ -1306,7 +1307,7 @@ gboolean GnomeCmdFileSelector::is_active()
 GtkWidget *GnomeCmdFileSelector::new_tab(GnomeCmdDir *dir, GnomeCmdFileList::ColumnID sort_col, GtkSortType sort_order, gboolean activate)
 {
     // create the list
-    GnomeCmdFileList *list = new GnomeCmdFileList;
+    GnomeCmdFileList *list = new GnomeCmdFileList(sort_col,sort_order);
 
     if (activate)
         this->list = list;               //  ... update GnomeCmdFileSelector::list to point at newly created tab
diff --git a/src/gnome-cmd-search-dialog.cc b/src/gnome-cmd-search-dialog.cc
index 4c5b9b6..c1b6373 100644
--- a/src/gnome-cmd-search-dialog.cc
+++ b/src/gnome-cmd-search-dialog.cc
@@ -903,7 +903,7 @@ static void init (GnomeCmdSearchDialog *dialog)
     gtk_box_pack_start (GTK_BOX (vbox), sw, TRUE, TRUE, 0);
     gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
 
-    dialog->priv->result_list = new GnomeCmdFileList;
+    dialog->priv->result_list = new GnomeCmdFileList(GnomeCmdFileList::COLUMN_NAME,GTK_SORT_ASCENDING);
     gtk_widget_ref (GTK_WIDGET (dialog->priv->result_list));
     g_object_set_data_full (G_OBJECT (window), "result_list", GTK_WIDGET (dialog->priv->result_list), g_object_unref);
     gtk_widget_set_size_request (GTK_WIDGET (dialog->priv->result_list), -1, 200);



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