gnome-commander r2096 - in trunk: . src
- From: epiotr svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-commander r2096 - in trunk: . src
- Date: Mon, 22 Sep 2008 18:34:27 +0000 (UTC)
Author: epiotr
Date: Mon Sep 22 18:34:27 2008
New Revision: 2096
URL: http://svn.gnome.org/viewvc/gnome-commander?rev=2096&view=rev
Log:
Move code from update_files(GnomeCmdFileSelector *fs) to GnomeCmdFileList::show_files(GnomeCmdDir *dir)
Modified:
trunk/ChangeLog
trunk/src/gnome-cmd-dir.h
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-dir.h
==============================================================================
--- trunk/src/gnome-cmd-dir.h (original)
+++ trunk/src/gnome-cmd-dir.h Mon Sep 22 18:34:27 2008
@@ -94,6 +94,22 @@
GnomeCmdCon *gnome_cmd_dir_get_connection (GnomeCmdDir *dir);
Handle *gnome_cmd_dir_get_handle (GnomeCmdDir *dir);
+inline GnomeCmdFile *gnome_cmd_dir_new_parent_dir_file (GnomeCmdDir *dir)
+{
+ GnomeVFSFileInfo *info = gnome_vfs_file_info_new ();
+
+ memset (info, '\0', sizeof (GnomeVFSFileInfo));
+ info->name = g_strdup ("..");
+ info->type = GNOME_VFS_FILE_TYPE_DIRECTORY;
+ info->mime_type = g_strdup ("x-directory/normal");
+ info->size = 0;
+ info->refcount = 1;
+ info->valid_fields = (GnomeVFSFileInfoFields) (GNOME_VFS_FILE_INFO_FIELDS_TYPE |
+ GNOME_VFS_FILE_INFO_FIELDS_SIZE |
+ GNOME_VFS_FILE_INFO_FIELDS_MIME_TYPE);
+
+ return gnome_cmd_file_new (info, dir);
+}
void gnome_cmd_dir_ref (GnomeCmdDir *dir);
void gnome_cmd_dir_unref (GnomeCmdDir *dir);
Modified: trunk/src/gnome-cmd-file-list.cc
==============================================================================
--- trunk/src/gnome-cmd-file-list.cc (original)
+++ trunk/src/gnome-cmd-file-list.cc Mon Sep 22 18:34:27 2008
@@ -1434,48 +1434,6 @@
}
-/******************************************************************************
-*
-* Function: gnome_cmd_file_list_show_files
-*
-* Purpose: Show a list of files
-*
-* Params: @fl: The FileList to show the files in
-* @list: A list of files to show
-* @sort: Whether to sort the files or not
-*
-* Returns:
-*
-* Statuses:
-*
-******************************************************************************/
-void gnome_cmd_file_list_show_files (GnomeCmdFileList *fl, GList *files, gboolean sort)
-{
- g_return_if_fail (GNOME_CMD_IS_FILE_LIST (fl));
-
- fl->remove_all_files();
-
- if (!files) return;
-
- GList *list, *tmp;
-
- list = g_list_copy (files);
-
- if (sort)
- tmp = list = g_list_sort_with_data (list, (GCompareDataFunc) fl->priv->sort_func, fl);
- else
- tmp = list;
-
- gtk_clist_freeze (*fl);
- for (; tmp; tmp = tmp->next)
- fl->append_file(GNOME_CMD_FILE (tmp->data));
- gtk_clist_thaw (*fl);
-
- if (list)
- g_list_free (list);
-}
-
-
void GnomeCmdFileList::insert_file (GnomeCmdFile *f)
{
gint num_files = size();
@@ -1500,6 +1458,43 @@
}
+void GnomeCmdFileList::show_files(GnomeCmdDir *dir)
+{
+ remove_all_files();
+
+ GList *list;
+ GList *files = NULL;
+
+ // select the files to show
+ for (gnome_cmd_dir_get_files (dir, &list); list; list = list->next)
+ {
+ GnomeCmdFile *f = GNOME_CMD_FILE (list->data);
+
+ if (file_is_wanted (f))
+ files = g_list_append (files, f);
+ }
+
+ // Create a parent dir file (..) if appropriate
+ gchar *path = gnome_cmd_file_get_path (GNOME_CMD_FILE (dir));
+ if (path && strcmp (path, G_DIR_SEPARATOR_S) != 0)
+ files = g_list_append (files, gnome_cmd_dir_new_parent_dir_file (dir));
+ g_free (path);
+
+ if (!files)
+ return;
+
+ files = g_list_sort_with_data (files, (GCompareDataFunc) priv->sort_func, this);
+
+ gtk_clist_freeze (*this);
+ for (GList *i = files; i; i = i->next)
+ append_file(GNOME_CMD_FILE (i->data));
+ gtk_clist_thaw (*this);
+
+ if (files)
+ g_list_free (files);
+}
+
+
void gnome_cmd_file_list_update_file (GnomeCmdFileList *fl, GnomeCmdFile *finfo)
{
if (!gnome_cmd_file_needs_update (finfo))
Modified: trunk/src/gnome-cmd-file-list.h
==============================================================================
--- trunk/src/gnome-cmd-file-list.h (original)
+++ trunk/src/gnome-cmd-file-list.h Mon Sep 22 18:34:27 2008
@@ -114,6 +114,8 @@
gboolean file_is_wanted(GnomeCmdFile *f);
+ void show_files(GnomeCmdDir *dir);
+
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 Mon Sep 22 18:34:27 2008
@@ -296,24 +296,6 @@
}
-inline GnomeCmdFile *create_parent_dir_file (GnomeCmdDir *dir)
-{
- GnomeVFSFileInfo *info = gnome_vfs_file_info_new ();
-
- memset (info, '\0', sizeof (GnomeVFSFileInfo));
- info->name = g_strdup ("..");
- info->type = GNOME_VFS_FILE_TYPE_DIRECTORY;
- info->mime_type = g_strdup ("x-directory/normal");
- info->size = 0;
- info->refcount = 1;
- info->valid_fields = (GnomeVFSFileInfoFields) (GNOME_VFS_FILE_INFO_FIELDS_TYPE |
- GNOME_VFS_FILE_INFO_FIELDS_SIZE |
- GNOME_VFS_FILE_INFO_FIELDS_MIME_TYPE);
-
- return gnome_cmd_file_new (info, dir);
-}
-
-
static void update_files (GnomeCmdFileSelector *fs)
{
g_return_if_fail (GNOME_CMD_IS_FILE_SELECTOR (fs));
@@ -321,34 +303,13 @@
GnomeCmdDir *dir = fs->get_directory();
g_return_if_fail (GNOME_CMD_IS_DIR (dir));
- GList *list;
- GList *list2 = NULL;
-
- // sort out the files to show
- for (gnome_cmd_dir_get_files (dir, &list); list; list = list->next)
- {
- GnomeCmdFile *f = GNOME_CMD_FILE (list->data);
-
- if (fs->file_list()->file_is_wanted(f))
- list2 = g_list_append (list2, f);
- }
-
- // Create a parent dir file (..) if appropriate
- gchar *path = gnome_cmd_file_get_path (GNOME_CMD_FILE (dir));
- if (path && strcmp (path, G_DIR_SEPARATOR_S) != 0)
- list2 = g_list_append (list2, create_parent_dir_file (dir));
- g_free (path);
-
- gnome_cmd_file_list_show_files (fs->file_list(), list2, TRUE);
+ fs->file_list()->show_files(dir);
gnome_cmd_clist_set_voffset (GNOME_CMD_CLIST (fs->file_list()), fs->priv->cwd->voffset);
if (fs->priv->realized)
update_selected_files_label (fs);
if (fs->priv->active)
fs->file_list()->select_row(0);
-
- if (list2)
- g_list_free (list2);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]