gnome-commander r2076 - in trunk: . src



Author: epiotr
Date: Wed Sep 10 15:38:09 2008
New Revision: 2076
URL: http://svn.gnome.org/viewvc/gnome-commander?rev=2076&view=rev

Log:
file_is_wanted(GnomeVFSFileInfo *finfo) -> GnomeCmdFileList::file_is_wanted(GnomeCmdFile *f)

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

Modified: trunk/src/gnome-cmd-file-list.cc
==============================================================================
--- trunk/src/gnome-cmd-file-list.cc	(original)
+++ trunk/src/gnome-cmd-file-list.cc	Wed Sep 10 15:38:09 2008
@@ -2233,11 +2233,52 @@
 }
 
 
-void GnomeCmdFileList::invalidate_tree_size()
+gboolean GnomeCmdFileList::file_is_wanted(GnomeCmdFile *f)
 {
-    GList *all_files = get_visible_files();
+    g_return_val_if_fail (f != NULL, FALSE);
+
+    GnomeVFSFileInfo *info = f->info;
+
+    if (info->type == GNOME_VFS_FILE_TYPE_UNKNOWN
+        && gnome_cmd_data_get_type_filter (GNOME_VFS_FILE_TYPE_UNKNOWN))
+        return FALSE;
+    if (info->type == GNOME_VFS_FILE_TYPE_REGULAR
+        && gnome_cmd_data_get_type_filter (GNOME_VFS_FILE_TYPE_REGULAR))
+        return FALSE;
+    if (info->type == GNOME_VFS_FILE_TYPE_DIRECTORY
+        && gnome_cmd_data_get_type_filter (GNOME_VFS_FILE_TYPE_DIRECTORY))
+        return FALSE;
+    if (info->type == GNOME_VFS_FILE_TYPE_FIFO
+        && gnome_cmd_data_get_type_filter (GNOME_VFS_FILE_TYPE_FIFO))
+        return FALSE;
+    if (info->type == GNOME_VFS_FILE_TYPE_SOCKET
+        && gnome_cmd_data_get_type_filter (GNOME_VFS_FILE_TYPE_SOCKET))
+        return FALSE;
+    if (info->type == GNOME_VFS_FILE_TYPE_CHARACTER_DEVICE
+        && gnome_cmd_data_get_type_filter (GNOME_VFS_FILE_TYPE_CHARACTER_DEVICE))
+        return FALSE;
+    if (info->type == GNOME_VFS_FILE_TYPE_BLOCK_DEVICE
+        && gnome_cmd_data_get_type_filter (GNOME_VFS_FILE_TYPE_BLOCK_DEVICE))
+        return FALSE;
+    if ((info->flags == GNOME_VFS_FILE_FLAGS_SYMLINK || info->symlink_name != NULL)
+        && gnome_cmd_data_get_type_filter (GNOME_VFS_FILE_TYPE_SYMBOLIC_LINK))
+        return FALSE;
+    if (strcmp (info->name, ".") == 0)
+        return FALSE;
+    if (strcmp (info->name, "..") == 0)
+        return FALSE;
+    if (info->name[0] == '.' && gnome_cmd_data_get_hidden_filter ())
+        return FALSE;
+    if (gnome_cmd_data_get_backup_filter () && patlist_matches (gnome_cmd_data_get_backup_pattern_list (), info->name))
+        return FALSE;
+
+    return TRUE;
+}
+
 
-    for (GList *tmp = all_files; tmp; tmp = tmp->next)
+void GnomeCmdFileList::invalidate_tree_size()
+{
+    for (GList *tmp = get_visible_files(); tmp; tmp = tmp->next)
     {
         GnomeCmdFile *f = (GnomeCmdFile *) tmp->data;
         if (f->info->type == GNOME_VFS_FILE_TYPE_DIRECTORY)

Modified: trunk/src/gnome-cmd-file-list.h
==============================================================================
--- trunk/src/gnome-cmd-file-list.h	(original)
+++ trunk/src/gnome-cmd-file-list.h	Wed Sep 10 15:38:09 2008
@@ -105,6 +105,8 @@
     GnomeCmdFile *get_selected_file();          // Returns the currently focused file if any. The returned file is not reffed. The ".." file is NOT returned if focused
     GnomeCmdFile *get_first_selected_file();    // Returns the first selected file if any or the focused one otherwise. The returned file is not reffed. The ".." file is NOT returned if focused
 
+    gboolean file_is_wanted(GnomeCmdFile *f);
+
     void show_column(ColumnID col, gboolean value)     {  gtk_clist_set_column_visibility (GTK_CLIST (this), col, value); }
 
     ColumnID get_sort_column();

Modified: trunk/src/gnome-cmd-file-selector.cc
==============================================================================
--- trunk/src/gnome-cmd-file-selector.cc	(original)
+++ trunk/src/gnome-cmd-file-selector.cc	Wed Sep 10 15:38:09 2008
@@ -296,48 +296,6 @@
 }
 
 
-static gboolean file_is_wanted (GnomeVFSFileInfo *info)
-{
-    if (info->type == GNOME_VFS_FILE_TYPE_UNKNOWN
-        && gnome_cmd_data_get_type_filter (GNOME_VFS_FILE_TYPE_UNKNOWN))
-        return FALSE;
-    if (info->type == GNOME_VFS_FILE_TYPE_REGULAR
-        && gnome_cmd_data_get_type_filter (GNOME_VFS_FILE_TYPE_REGULAR))
-        return FALSE;
-    if (info->type == GNOME_VFS_FILE_TYPE_DIRECTORY
-        && gnome_cmd_data_get_type_filter (GNOME_VFS_FILE_TYPE_DIRECTORY))
-        return FALSE;
-    if (info->type == GNOME_VFS_FILE_TYPE_FIFO
-        && gnome_cmd_data_get_type_filter (GNOME_VFS_FILE_TYPE_FIFO))
-        return FALSE;
-    if (info->type == GNOME_VFS_FILE_TYPE_SOCKET
-        && gnome_cmd_data_get_type_filter (GNOME_VFS_FILE_TYPE_SOCKET))
-        return FALSE;
-    if (info->type == GNOME_VFS_FILE_TYPE_CHARACTER_DEVICE
-        && gnome_cmd_data_get_type_filter (GNOME_VFS_FILE_TYPE_CHARACTER_DEVICE))
-        return FALSE;
-    if (info->type == GNOME_VFS_FILE_TYPE_BLOCK_DEVICE
-        && gnome_cmd_data_get_type_filter (GNOME_VFS_FILE_TYPE_BLOCK_DEVICE))
-        return FALSE;
-    if ((info->flags == GNOME_VFS_FILE_FLAGS_SYMLINK
-         || info->symlink_name != NULL)
-        && gnome_cmd_data_get_type_filter (GNOME_VFS_FILE_TYPE_SYMBOLIC_LINK))
-        return FALSE;
-    if (strcmp (info->name, ".") == 0)
-        return FALSE;
-    if (strcmp (info->name, "..") == 0)
-        return FALSE;
-    if (info->name[0] == '.'
-        && gnome_cmd_data_get_hidden_filter ())
-        return FALSE;
-    if (gnome_cmd_data_get_backup_filter () &&
-        patlist_matches (gnome_cmd_data_get_backup_pattern_list (), info->name))
-        return FALSE;
-
-    return TRUE;
-}
-
-
 inline GnomeCmdFile *create_parent_dir_file (GnomeCmdDir *dir)
 {
     GnomeVFSFileInfo *info = gnome_vfs_file_info_new ();
@@ -371,7 +329,7 @@
     {
         GnomeCmdFile *f = GNOME_CMD_FILE (list->data);
 
-        if (file_is_wanted (f->info))
+        if (fs->file_list()->file_is_wanted(f))
             list2 = g_list_append (list2, f);
     }
 
@@ -876,7 +834,7 @@
     g_return_if_fail (GNOME_CMD_IS_FILE (f));
     g_return_if_fail (GNOME_CMD_IS_FILE_SELECTOR (fs));
 
-    if (!file_is_wanted (f->info))
+    if (!fs->file_list()->file_is_wanted(f))
         return;
 
     fs->file_list()->insert_file(f);



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