comparison src/collect-io.c @ 1420:3a9fb1b52559

Use gboolean where applicable, for the sake of consistency.
author zas_
date Thu, 12 Mar 2009 21:06:37 +0000
parents 79937bc55f3a
children cf4029d10d38
comparison
equal deleted inserted replaced
1419:c520cfd40aef 1420:3a9fb1b52559
36 static CollectManagerEntry *collect_manager_get_entry(const gchar *path); 36 static CollectManagerEntry *collect_manager_get_entry(const gchar *path);
37 static void collect_manager_entry_reset(CollectManagerEntry *entry); 37 static void collect_manager_entry_reset(CollectManagerEntry *entry);
38 static gint collect_manager_process_action(CollectManagerEntry *entry, gchar **path_ptr); 38 static gint collect_manager_process_action(CollectManagerEntry *entry, gchar **path_ptr);
39 39
40 40
41 static gint scan_geometry(gchar *buffer, gint *x, gint *y, gint *w, gint *h) 41 static gboolean scan_geometry(gchar *buffer, gint *x, gint *y, gint *w, gint *h)
42 { 42 {
43 gint nx, ny, nw, nh; 43 gint nx, ny, nw, nh;
44 44
45 if (sscanf(buffer, "%d %d %d %d", &nx, &ny, &nw, &nh) != 4) return FALSE; 45 if (sscanf(buffer, "%d %d %d %d", &nx, &ny, &nw, &nh) != 4) return FALSE;
46 46
50 *h = nh; 50 *h = nh;
51 51
52 return TRUE; 52 return TRUE;
53 } 53 }
54 54
55 static gint collection_load_private(CollectionData *cd, const gchar *path, CollectionLoadFlags flags) 55 static gboolean collection_load_private(CollectionData *cd, const gchar *path, CollectionLoadFlags flags)
56 { 56 {
57 gchar s_buf[GQ_COLLECTION_READ_BUFSIZE]; 57 gchar s_buf[GQ_COLLECTION_READ_BUFSIZE];
58 FILE *f; 58 FILE *f;
59 gchar *pathl; 59 gchar *pathl;
60 gint limit_failures = TRUE; 60 gboolean limit_failures = TRUE;
61 gint success = TRUE; 61 gboolean success = TRUE;
62 gint has_official_header = FALSE; 62 gboolean has_official_header = FALSE;
63 gint has_geometry_header = FALSE; 63 gboolean has_geometry_header = FALSE;
64 gint has_gqview_header = FALSE; 64 gboolean has_gqview_header = FALSE;
65 gint need_header = TRUE; 65 gboolean need_header = TRUE;
66 guint total = 0; 66 guint total = 0;
67 guint fail = 0; 67 guint fail = 0;
68 gboolean changed = FALSE; 68 gboolean changed = FALSE;
69 CollectManagerEntry *entry = NULL; 69 CollectManagerEntry *entry = NULL;
70 guint flush = !!(flags & COLLECTION_LOAD_FLUSH); 70 guint flush = !!(flags & COLLECTION_LOAD_FLUSH);
208 if (!append) cd->changed = FALSE; 208 if (!append) cd->changed = FALSE;
209 209
210 return success; 210 return success;
211 } 211 }
212 212
213 gint collection_load(CollectionData *cd, const gchar *path, CollectionLoadFlags flags) 213 gboolean collection_load(CollectionData *cd, const gchar *path, CollectionLoadFlags flags)
214 { 214 {
215 if (collection_load_private(cd, path, flags | COLLECTION_LOAD_FLUSH)) 215 if (collection_load_private(cd, path, flags | COLLECTION_LOAD_FLUSH))
216 { 216 {
217 layout_recent_add_path(cd->path); 217 layout_recent_add_path(cd->path);
218 return TRUE; 218 return TRUE;
305 void collection_load_thumb_idle(CollectionData *cd) 305 void collection_load_thumb_idle(CollectionData *cd)
306 { 306 {
307 if (!cd->thumb_loader) collection_load_thumb_step(cd); 307 if (!cd->thumb_loader) collection_load_thumb_step(cd);
308 } 308 }
309 309
310 gint collection_load_begin(CollectionData *cd, const gchar *path, CollectionLoadFlags flags) 310 gboolean collection_load_begin(CollectionData *cd, const gchar *path, CollectionLoadFlags flags)
311 { 311 {
312 if (!collection_load(cd, path, flags)) return FALSE; 312 if (!collection_load(cd, path, flags)) return FALSE;
313 313
314 collection_load_thumb_idle(cd); 314 collection_load_thumb_idle(cd);
315 315
322 322
323 thumb_loader_free(cd->thumb_loader); 323 thumb_loader_free(cd->thumb_loader);
324 cd->thumb_loader = NULL; 324 cd->thumb_loader = NULL;
325 } 325 }
326 326
327 static gint collection_save_private(CollectionData *cd, const gchar *path) 327 static gboolean collection_save_private(CollectionData *cd, const gchar *path)
328 { 328 {
329 SecureSaveInfo *ssi; 329 SecureSaveInfo *ssi;
330 GList *work; 330 GList *work;
331 gchar *pathl; 331 gchar *pathl;
332 332
389 cd->changed = FALSE; 389 cd->changed = FALSE;
390 390
391 return TRUE; 391 return TRUE;
392 } 392 }
393 393
394 gint collection_save(CollectionData *cd, const gchar *path) 394 gboolean collection_save(CollectionData *cd, const gchar *path)
395 { 395 {
396 if (collection_save_private(cd, path)) 396 if (collection_save_private(cd, path))
397 { 397 {
398 layout_recent_add_path(cd->path); 398 layout_recent_add_path(cd->path);
399 return TRUE; 399 return TRUE;
400 } 400 }
401 401
402 return FALSE; 402 return FALSE;
403 } 403 }
404 404
405 gint collection_load_only_geometry(CollectionData *cd, const gchar *path) 405 gboolean collection_load_only_geometry(CollectionData *cd, const gchar *path)
406 { 406 {
407 return collection_load(cd, path, COLLECTION_LOAD_GEOMETRY); 407 return collection_load(cd, path, COLLECTION_LOAD_GEOMETRY);
408 } 408 }
409 409
410 410
631 g_hash_table_insert(entry->newpath_hash, action->newpath, action); 631 g_hash_table_insert(entry->newpath_hash, action->newpath, action);
632 } 632 }
633 collect_manager_action_ref(action); 633 collect_manager_action_ref(action);
634 } 634 }
635 635
636 static gint collect_manager_process_action(CollectManagerEntry *entry, gchar **path_ptr) 636 static gboolean collect_manager_process_action(CollectManagerEntry *entry, gchar **path_ptr)
637 { 637 {
638 gchar *path = *path_ptr; 638 gchar *path = *path_ptr;
639 CollectManagerAction *action; 639 CollectManagerAction *action;
640 640
641 if (path == NULL) 641 if (path == NULL)
779 collection_manager_action_list = g_list_remove(collection_manager_action_list, action); 779 collection_manager_action_list = g_list_remove(collection_manager_action_list, action);
780 collect_manager_action_unref(action); 780 collect_manager_action_unref(action);
781 } 781 }
782 } 782 }
783 783
784 static gint collect_manager_process_entry(CollectManagerEntry *entry) 784 static gboolean collect_manager_process_entry(CollectManagerEntry *entry)
785 { 785 {
786 CollectionData *cd; 786 CollectionData *cd;
787 gint success; 787 gboolean success;
788 788
789 if (entry->empty) return FALSE; 789 if (entry->empty) return FALSE;
790 790
791 cd = collection_new(entry->path); 791 cd = collection_new(entry->path);
792 success = collection_load_private(cd, entry->path, COLLECTION_LOAD_NONE); 792 success = collection_load_private(cd, entry->path, COLLECTION_LOAD_NONE);
794 collection_unref(cd); 794 collection_unref(cd);
795 795
796 return TRUE; 796 return TRUE;
797 } 797 }
798 798
799 static gint collect_manager_process_entry_list(void) 799 static gboolean collect_manager_process_entry_list(void)
800 { 800 {
801 GList *work; 801 GList *work;
802 802
803 work = collection_manager_entry_list; 803 work = collection_manager_entry_list;
804 while (work) 804 while (work)
813 return FALSE; 813 return FALSE;
814 } 814 }
815 815
816 816
817 817
818 static gint collect_manager_process_cb(gpointer data) 818 static gboolean collect_manager_process_cb(gpointer data)
819 { 819 {
820 if (collection_manager_action_list) collect_manager_refresh(); 820 if (collection_manager_action_list) collect_manager_refresh();
821 collect_manager_process_actions(COLLECT_MANAGER_ACTIONS_PER_IDLE); 821 collect_manager_process_actions(COLLECT_MANAGER_ACTIONS_PER_IDLE);
822 if (collection_manager_action_list) return TRUE; 822 if (collection_manager_action_list) return TRUE;
823 823
825 825
826 DEBUG_1("collection manager is up to date"); 826 DEBUG_1("collection manager is up to date");
827 return FALSE; 827 return FALSE;
828 } 828 }
829 829
830 static gint collect_manager_timer_cb(gpointer data) 830 static gboolean collect_manager_timer_cb(gpointer data)
831 { 831 {
832 DEBUG_1("collection manager timer expired"); 832 DEBUG_1("collection manager timer expired");
833 833
834 g_idle_add_full(G_PRIORITY_LOW, collect_manager_process_cb, NULL, NULL); 834 g_idle_add_full(G_PRIORITY_LOW, collect_manager_process_cb, NULL, NULL);
835 835
932 while (collect_manager_process_cb(NULL)); 932 while (collect_manager_process_cb(NULL));
933 } 933 }
934 934
935 void collect_manager_notify_cb(FileData *fd, NotifyType type, gpointer data) 935 void collect_manager_notify_cb(FileData *fd, NotifyType type, gpointer data)
936 { 936 {
937
938 if (type != NOTIFY_TYPE_CHANGE || !fd->change) return; 937 if (type != NOTIFY_TYPE_CHANGE || !fd->change) return;
939 938
940 switch (fd->change->type) 939 switch (fd->change->type)
941 { 940 {
942 case FILEDATA_CHANGE_MOVE: 941 case FILEDATA_CHANGE_MOVE: