changeset 358:384eed18df04

Use flags for collection_load*().
author zas_
date Mon, 14 Apr 2008 22:05:47 +0000
parents d3e509c0940e
children 96fb24f948b7
files src/collect-io.c src/collect-io.h src/collect.c src/img-view.c src/main.c
diffstat 5 files changed, 18 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/collect-io.c	Sun Apr 13 20:33:45 2008 +0000
+++ b/src/collect-io.c	Mon Apr 14 22:05:47 2008 +0000
@@ -51,7 +51,7 @@
 	return TRUE;
 }
 
-static gint collection_load_private(CollectionData *cd, const gchar *path, gint append, gint flush)
+static gint collection_load_private(CollectionData *cd, const gchar *path, CollectionLoadFlags flags)
 {
 	gchar s_buf[2048];
 	FILE *f;
@@ -62,6 +62,8 @@
 	guint fail = 0;
 	gboolean changed = FALSE;
 	CollectManagerEntry *entry = NULL;
+	guint flush = flags & COLLECTION_LOAD_FLUSH;
+	guint append = flags & COLLECTION_LOAD_APPEND;
 
 	collection_load_stop(cd);
 
@@ -165,9 +167,9 @@
 	return success;
 }
 
-gint collection_load(CollectionData *cd, const gchar *path, gint append)
+gint collection_load(CollectionData *cd, const gchar *path, CollectionLoadFlags flags)
 {
-	if (collection_load_private(cd, path, append, TRUE))
+	if (collection_load_private(cd, path, flags | COLLECTION_LOAD_FLUSH))
 		{
 		layout_recent_add_path(cd->path);
 		return TRUE;
@@ -262,9 +264,9 @@
 	if (!cd->thumb_loader) collection_load_thumb_step(cd);
 }
 
-gint collection_load_begin(CollectionData *cd, const gchar *path, gint append)
+gint collection_load_begin(CollectionData *cd, const gchar *path, CollectionLoadFlags flags)
 {
-	if (!collection_load(cd, path, append)) return FALSE;
+	if (!collection_load(cd, path, flags)) return FALSE;
 
 	collection_load_thumb_idle(cd);
 
@@ -782,7 +784,7 @@
 	if (entry->empty) return FALSE;
 
 	cd = collection_new(entry->path);
-	success = collection_load_private(cd, entry->path, FALSE, FALSE);
+	success = collection_load_private(cd, entry->path, COLLECTION_LOAD_NONE);
 
 	collection_unref(cd);
 
--- a/src/collect-io.h	Sun Apr 13 20:33:45 2008 +0000
+++ b/src/collect-io.h	Mon Apr 14 22:05:47 2008 +0000
@@ -13,10 +13,15 @@
 #ifndef COLLECT_IO_H
 #define COLLECT_IO_H
 
+typedef enum {
+	COLLECTION_LOAD_NONE	= 0,
+	COLLECTION_LOAD_APPEND	= 1 << 0,
+	COLLECTION_LOAD_FLUSH	= 1 << 1,
+} CollectionLoadFlags;
 
-gint collection_load(CollectionData *cd, const gchar *path, gint append);
+gint collection_load(CollectionData *cd, const gchar *path, CollectionLoadFlags flags);
 
-gint collection_load_begin(CollectionData *cd, const gchar *path, gint append);
+gint collection_load_begin(CollectionData *cd, const gchar *path, CollectionLoadFlags flags);
 void collection_load_stop(CollectionData *cd);
 
 void collection_load_thumb_idle(CollectionData *cd);
--- a/src/collect.c	Sun Apr 13 20:33:45 2008 +0000
+++ b/src/collect.c	Mon Apr 14 22:05:47 2008 +0000
@@ -1251,7 +1251,7 @@
 
 	collection_set_update_info_func(cw->cd, collection_window_update_info, cw);
 
-	if (path && *path == '/') collection_load_begin(cw->cd, NULL, FALSE);
+	if (path && *path == '/') collection_load_begin(cw->cd, NULL, COLLECTION_LOAD_NONE);
 
 	return cw;
 }
--- a/src/img-view.c	Sun Apr 13 20:33:45 2008 +0000
+++ b/src/img-view.c	Mon Apr 14 22:05:47 2008 +0000
@@ -950,7 +950,7 @@
 		CollectInfo *info;
 
 		cd = collection_new(fd->path);
-		if (collection_load(cd, fd->path, FALSE))
+		if (collection_load(cd, fd->path, COLLECTION_LOAD_NONE))
 			{
 			info = collection_get_first(cd);
 			}
--- a/src/main.c	Sun Apr 13 20:33:45 2008 +0000
+++ b/src/main.c	Mon Apr 14 22:05:47 2008 +0000
@@ -1447,7 +1447,7 @@
 		work = collection_list;
 		while (work)
 			{
-			collection_load(cd, (gchar *)work->data, TRUE);
+			collection_load(cd, (gchar *)work->data, COLLECTION_LOAD_APPEND);
 			work = work->next;
 			}