gnome-commander r2043 - in trunk: . src



Author: epiotr
Date: Thu Sep  4 22:20:18 2008
New Revision: 2043
URL: http://svn.gnome.org/viewvc/gnome-commander?rev=2043&view=rev

Log:
GnomeCmdFileList: do not allocate dynamically shown_files

Modified:
   trunk/ChangeLog
   trunk/src/gnome-cmd-file-list.cc

Modified: trunk/src/gnome-cmd-file-list.cc
==============================================================================
--- trunk/src/gnome-cmd-file-list.cc	(original)
+++ trunk/src/gnome-cmd-file-list.cc	Thu Sep  4 22:20:18 2008
@@ -118,7 +118,7 @@
     GtkWidget *popup_menu;
 
     gint cur_file;
-    GnomeCmdFileCollection *shown_files;
+    GnomeCmdFileCollection shown_files;
     GList *selected_files;                         // contains GnomeCmdFile pointers
 
     GCompareDataFunc sort_func;
@@ -141,7 +141,6 @@
 
 GnomeCmdFileList::Private::Private(GnomeCmdFileList *fl)
 {
-    shown_files = new GnomeCmdFileCollection;
     selected_files = NULL;
 
     memset(column_pixmaps, NULL, sizeof(column_pixmaps));
@@ -175,7 +174,6 @@
 
 GnomeCmdFileList::Private::~Private()
 {
-    delete shown_files;
     gnome_cmd_file_list_free (selected_files);
 }
 
@@ -416,7 +414,7 @@
     if (row == -1)
         return;
 
-    if (row < fl->priv->shown_files->size())
+    if (row < fl->priv->shown_files.size())
         if (g_list_index (fl->priv->selected_files, finfo) == -1)
             select_file (fl, finfo);
         else
@@ -1445,7 +1443,7 @@
 ******************************************************************************/
 void GnomeCmdFileList::append_file (GnomeCmdFile *f)
 {
-    priv->shown_files->add(f);
+    priv->shown_files.add(f);
     add_file_to_clist (this, f, -1);
 }
 
@@ -1501,7 +1499,7 @@
         GnomeCmdFile *f2 = get_file_at_row (this, i);
         if (priv->sort_func (f2, f, this) == 1)
         {
-            priv->shown_files->add(f);
+            priv->shown_files.add(f);
             add_file_to_clist (this, f, i);
 
             if (i<=priv->cur_file)
@@ -1559,7 +1557,7 @@
         gtk_clist_remove (GTK_CLIST (this), row);
 
         priv->selected_files = g_list_remove (priv->selected_files, f);
-        priv->shown_files->remove(f);
+        priv->shown_files.remove(f);
 
         focus_file_at_row (this, MIN (row, GTK_CLIST (this)->focus_row));
     }
@@ -1570,7 +1568,7 @@
 {
     g_return_if_fail (uri_str != NULL);
 
-    GnomeCmdFile *f = priv->shown_files->find(uri_str);
+    GnomeCmdFile *f = priv->shown_files.find(uri_str);
     g_return_if_fail (GNOME_CMD_IS_FILE (f));
 
     remove_file (f);
@@ -1580,7 +1578,7 @@
 void GnomeCmdFileList::clear()
 {
     gtk_clist_clear (GTK_CLIST (this));
-    priv->shown_files->clear();
+    priv->shown_files.clear();
     gnome_cmd_file_list_free (priv->selected_files);
     priv->selected_files = NULL;
 }
@@ -1605,7 +1603,7 @@
 
 GList *GnomeCmdFileList::get_all_files()
 {
-    return priv->shown_files->get_list();
+    return priv->shown_files.get_list();
 }
 
 
@@ -1814,8 +1812,8 @@
     gtk_clist_freeze (GTK_CLIST (this));
     gtk_clist_clear (GTK_CLIST (this));
 
-    // Resort the files and readd them to the list
-    for (GList *list = priv->shown_files->sort(priv->sort_func, this); list; list = list->next)
+    // resort the files and readd them to the list
+    for (GList *list = priv->shown_files.sort(priv->sort_func, this); list; list = list->next)
         add_file_to_clist (this, GNOME_CMD_FILE (list->data), -1);
 
     // refocus the previously selected file if this file-list has the focus



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