[gnome-commander] GnomeCmdDir: simplify gnome_cmd_dir_get_files() usage
- From: Piotr Eljasiak <epiotr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-commander] GnomeCmdDir: simplify gnome_cmd_dir_get_files() usage
- Date: Sun, 6 Mar 2011 19:54:02 +0000 (UTC)
commit a53c9c8c68a1ab341d73cc72264dbbb627e4a169
Author: Piotr Eljasiak <epiotr src gnome org>
Date: Sun Mar 6 20:53:12 2011 +0100
GnomeCmdDir: simplify gnome_cmd_dir_get_files() usage
src/gnome-cmd-chmod-dialog.cc | 6 ++----
src/gnome-cmd-chown-dialog.cc | 6 ++----
src/gnome-cmd-dir.cc | 9 +++------
src/gnome-cmd-dir.h | 2 +-
src/gnome-cmd-file-list.cc | 5 ++---
src/gnome-cmd-search-dialog.cc | 8 ++------
6 files changed, 12 insertions(+), 24 deletions(-)
---
diff --git a/src/gnome-cmd-chmod-dialog.cc b/src/gnome-cmd-chmod-dialog.cc
index fa8ce3e..139b4ea 100644
--- a/src/gnome-cmd-chmod-dialog.cc
+++ b/src/gnome-cmd-chmod-dialog.cc
@@ -80,15 +80,13 @@ static void do_chmod (GnomeCmdFile *in, GnomeVFSFilePermissions perm, gboolean r
if (in->info->type == GNOME_VFS_FILE_TYPE_DIRECTORY)
{
GnomeCmdDir *dir = GNOME_CMD_DIR (in);
- GList *files;
gnome_cmd_dir_ref (dir);
gnome_cmd_dir_list_files (dir, FALSE);
- gnome_cmd_dir_get_files (dir, &files);
- for (GList *tmp = files; tmp; tmp = tmp->next)
+ for (GList *i = gnome_cmd_dir_get_files (dir); i; i = i->next)
{
- GnomeCmdFile *f = (GnomeCmdFile *) tmp->data;
+ GnomeCmdFile *f = (GnomeCmdFile *) i->data;
if (!f->is_dotdot && strcmp (f->info->name, ".") != 0
&& !GNOME_VFS_FILE_INFO_SYMLINK(f->info))
{
diff --git a/src/gnome-cmd-chown-dialog.cc b/src/gnome-cmd-chown-dialog.cc
index 6646e95..bf65455 100644
--- a/src/gnome-cmd-chown-dialog.cc
+++ b/src/gnome-cmd-chown-dialog.cc
@@ -65,15 +65,13 @@ static void do_chown (GnomeCmdFile *in, uid_t uid, gid_t gid, gboolean recurse)
if (in->info->type == GNOME_VFS_FILE_TYPE_DIRECTORY)
{
GnomeCmdDir *dir = GNOME_CMD_DIR (in);
- GList *files, *tmp;
gnome_cmd_dir_ref (dir);
gnome_cmd_dir_list_files (dir, FALSE);
- gnome_cmd_dir_get_files (dir, &files);
- for (tmp = files; tmp; tmp = tmp->next)
+ for (GList *i = gnome_cmd_dir_get_files (dir); i; i = i->next)
{
- GnomeCmdFile *f = (GnomeCmdFile *) tmp->data;
+ GnomeCmdFile *f = (GnomeCmdFile *) i->data;
if (!f->is_dotdot && strcmp (f->info->name, ".") != 0
&& !GNOME_VFS_FILE_INFO_SYMLINK(f->info))
{
diff --git a/src/gnome-cmd-dir.cc b/src/gnome-cmd-dir.cc
index ecd86fe..f931353 100644
--- a/src/gnome-cmd-dir.cc
+++ b/src/gnome-cmd-dir.cc
@@ -381,14 +381,11 @@ Handle *gnome_cmd_dir_get_handle (GnomeCmdDir *dir)
}
-GnomeVFSResult gnome_cmd_dir_get_files (GnomeCmdDir *dir, GList **files)
+GList *gnome_cmd_dir_get_files (GnomeCmdDir *dir)
{
- g_return_val_if_fail (GNOME_CMD_IS_DIR (dir), GNOME_VFS_ERROR_BAD_PARAMETERS);
-
- if (files)
- *files = dir->priv->files;
+ g_return_val_if_fail (GNOME_CMD_IS_DIR (dir), NULL);
- return dir->priv->last_result;
+ return dir->priv->files;
}
diff --git a/src/gnome-cmd-dir.h b/src/gnome-cmd-dir.h
index 0f8100e..3f379f3 100644
--- a/src/gnome-cmd-dir.h
+++ b/src/gnome-cmd-dir.h
@@ -122,7 +122,7 @@ inline void gnome_cmd_dir_unref (GnomeCmdDir *dir)
GNOME_CMD_FILE (dir)->unref();
}
-GnomeVFSResult gnome_cmd_dir_get_files (GnomeCmdDir *dir, GList **files);
+GList *gnome_cmd_dir_get_files (GnomeCmdDir *dir);
void gnome_cmd_dir_relist_files (GnomeCmdDir *dir, gboolean visprog);
void gnome_cmd_dir_list_files (GnomeCmdDir *dir, gboolean visprog);
diff --git a/src/gnome-cmd-file-list.cc b/src/gnome-cmd-file-list.cc
index 9843ab8..eed5551 100644
--- a/src/gnome-cmd-file-list.cc
+++ b/src/gnome-cmd-file-list.cc
@@ -1729,13 +1729,12 @@ 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)
+ for (GList *i = gnome_cmd_dir_get_files (dir); i; i = i->next)
{
- GnomeCmdFile *f = GNOME_CMD_FILE (list->data);
+ GnomeCmdFile *f = GNOME_CMD_FILE (i->data);
if (file_is_wanted (f))
files = g_list_append (files, f);
diff --git a/src/gnome-cmd-search-dialog.cc b/src/gnome-cmd-search-dialog.cc
index d19aa7c..bb32583 100644
--- a/src/gnome-cmd-search-dialog.cc
+++ b/src/gnome-cmd-search-dialog.cc
@@ -280,20 +280,16 @@ static void search_dir_r (GnomeCmdDir *dir, SearchData *data)
if (data->stopped)
return;
- GList *files;
-
gnome_cmd_dir_list_files (dir, FALSE);
- gnome_cmd_dir_get_files (dir, &files);
-
// Let's iterate through all files
- for (GList *tmp=files; tmp; tmp=tmp->next)
+ for (GList *i=gnome_cmd_dir_get_files (dir); i; i=i->next)
{
// If the stop button was pressed let's abort here
if (data->stopped)
return;
- GnomeCmdFile *f = (GnomeCmdFile *) tmp->data;
+ GnomeCmdFile *f = (GnomeCmdFile *) i->data;
// If the current file is a directory lets continue our recursion
if (GNOME_CMD_IS_DIR (f) && data->recurse)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]