From: Laurent Monin Date: Mon, 14 Apr 2008 22:05:47 +0000 (+0000) Subject: Use flags for collection_load*(). X-Git-Tag: v1.0.0~1445 X-Git-Url: http://geeqie.org/cgi-bin/gitweb.cgi?p=geeqie.git;a=commitdiff_plain;h=3ababb59e475a61f1f0bd085d0e33e0312c0baf2 Use flags for collection_load*(). --- diff --git a/src/collect-io.c b/src/collect-io.c index 7e8104fc..0417969b 100644 --- a/src/collect-io.c +++ b/src/collect-io.c @@ -51,7 +51,7 @@ static gint scan_geometry(gchar *buffer, gint *x, gint *y, gint *w, gint *h) 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 @@ static gint collection_load_private(CollectionData *cd, const gchar *path, gint 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 @@ static gint collection_load_private(CollectionData *cd, const gchar *path, gint 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 @@ void collection_load_thumb_idle(CollectionData *cd) 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 @@ static gint collect_manager_process_entry(CollectManagerEntry *entry) 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); diff --git a/src/collect-io.h b/src/collect-io.h index bf6c7414..7bf66b18 100644 --- a/src/collect-io.h +++ b/src/collect-io.h @@ -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); diff --git a/src/collect.c b/src/collect.c index de2588e1..cc3fe0d3 100644 --- a/src/collect.c +++ b/src/collect.c @@ -1251,7 +1251,7 @@ CollectWindow *collection_window_new(const gchar *path) 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; } diff --git a/src/img-view.c b/src/img-view.c index afc7b45d..c93dfb02 100644 --- a/src/img-view.c +++ b/src/img-view.c @@ -950,7 +950,7 @@ void view_window_new(FileData *fd) 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); } diff --git a/src/main.c b/src/main.c index 21d3e303..e8b4601e 100644 --- a/src/main.c +++ b/src/main.c @@ -1447,7 +1447,7 @@ int main (int argc, char *argv[]) work = collection_list; while (work) { - collection_load(cd, (gchar *)work->data, TRUE); + collection_load(cd, (gchar *)work->data, COLLECTION_LOAD_APPEND); work = work->next; }