Mercurial > geeqie
comparison src/collect-io.c @ 495:c7a2471e5c4e
Introduce macros to display debug messages.
if (debug) printf(...) is now replaced by variadic macros:
DEBUG_1()
And for higher debugging levels:
DEBUG_2()
DEBUG_3()
DEBUG_4()
author | zas_ |
---|---|
date | Wed, 23 Apr 2008 20:47:19 +0000 |
parents | dead6fb690c5 |
children | fc9c8a3e1a8b |
comparison
equal
deleted
inserted
replaced
494:3bb9a8df6ee9 | 495:c7a2471e5c4e |
---|---|
90 | 90 |
91 if (!path && !cd->path) return FALSE; | 91 if (!path && !cd->path) return FALSE; |
92 | 92 |
93 if (!path) path = cd->path; | 93 if (!path) path = cd->path; |
94 | 94 |
95 if (debug) printf("collection load: append=%d flush=%d only_geometry=%d path=%s\n", | 95 DEBUG_1("collection load: append=%d flush=%d only_geometry=%d path=%s\n", |
96 append, flush, only_geometry, path); | 96 append, flush, only_geometry, path); |
97 | 97 |
98 /* load it */ | 98 /* load it */ |
99 pathl = path_from_utf8(path); | 99 pathl = path_from_utf8(path); |
100 f = fopen(pathl, "r"); | 100 f = fopen(pathl, "r"); |
154 | 154 |
155 if (!flush) | 155 if (!flush) |
156 changed |= collect_manager_process_action(entry, &buf); | 156 changed |= collect_manager_process_action(entry, &buf); |
157 | 157 |
158 valid = (buf[0] == '/' && collection_add_check(cd, file_data_new_simple(buf), FALSE, TRUE)); | 158 valid = (buf[0] == '/' && collection_add_check(cd, file_data_new_simple(buf), FALSE, TRUE)); |
159 if (debug && !valid) printf("collection invalid file: %s\n", buf); | 159 if (!valid) DEBUG_1("collection invalid file: %s\n", buf); |
160 g_free(buf); | 160 g_free(buf); |
161 | 161 |
162 total++; | 162 total++; |
163 if (!valid) | 163 if (!valid) |
164 { | 164 { |
173 } | 173 } |
174 } | 174 } |
175 } | 175 } |
176 } | 176 } |
177 | 177 |
178 if (debug) printf("collection files: total = %d fail = %d official=%d gqview=%d geometry=%d\n", | 178 DEBUG_1("collection files: total = %d fail = %d official=%d gqview=%d geometry=%d\n", |
179 total, fail, has_official_header, has_gqview_header, has_geometry_header); | 179 total, fail, has_official_header, has_gqview_header, has_geometry_header); |
180 | 180 |
181 fclose(f); | 181 fclose(f); |
182 if (only_geometry) return has_geometry_header; | 182 if (only_geometry) return has_geometry_header; |
183 | 183 |
290 | 290 |
291 /* start it */ | 291 /* start it */ |
292 if (!thumb_loader_start(cd->thumb_loader, ci->fd->path)) | 292 if (!thumb_loader_start(cd->thumb_loader, ci->fd->path)) |
293 { | 293 { |
294 /* error, handle it, do next */ | 294 /* error, handle it, do next */ |
295 if (debug) printf("error loading thumb for %s\n", ci->fd->path); | 295 DEBUG_1("error loading thumb for %s\n", ci->fd->path); |
296 collection_load_thumb_do(cd); | 296 collection_load_thumb_do(cd); |
297 collection_load_thumb_step(cd); | 297 collection_load_thumb_step(cd); |
298 } | 298 } |
299 } | 299 } |
300 | 300 |
719 g_list_free(list); | 719 g_list_free(list); |
720 } | 720 } |
721 | 721 |
722 static void collect_manager_process_actions(gint max) | 722 static void collect_manager_process_actions(gint max) |
723 { | 723 { |
724 if (debug && collection_manager_action_list) | 724 if (collection_manager_action_list) DEBUG_1("collection manager processing actions\n"); |
725 { | 725 |
726 printf("collection manager processing actions\n"); | |
727 } | |
728 | |
729 while (collection_manager_action_list != NULL && max > 0) | 726 while (collection_manager_action_list != NULL && max > 0) |
730 { | 727 { |
731 CollectManagerAction *action; | 728 CollectManagerAction *action; |
732 GList *work; | 729 GList *work; |
733 | 730 |
821 collect_manager_process_actions(COLLECT_MANAGER_ACTIONS_PER_IDLE); | 818 collect_manager_process_actions(COLLECT_MANAGER_ACTIONS_PER_IDLE); |
822 if (collection_manager_action_list) return TRUE; | 819 if (collection_manager_action_list) return TRUE; |
823 | 820 |
824 if (collect_manager_process_entry_list()) return TRUE; | 821 if (collect_manager_process_entry_list()) return TRUE; |
825 | 822 |
826 if (debug) printf("collection manager is up to date\n"); | 823 DEBUG_1("collection manager is up to date\n"); |
827 return FALSE; | 824 return FALSE; |
828 } | 825 } |
829 | 826 |
830 static gint collect_manager_timer_cb(gpointer data) | 827 static gint collect_manager_timer_cb(gpointer data) |
831 { | 828 { |
832 if (debug) printf("collection manager timer expired\n"); | 829 DEBUG_1("collection manager timer expired\n"); |
833 | 830 |
834 g_idle_add_full(G_PRIORITY_LOW, collect_manager_process_cb, NULL, NULL); | 831 g_idle_add_full(G_PRIORITY_LOW, collect_manager_process_cb, NULL, NULL); |
835 | 832 |
836 collection_manager_timer_id = -1; | 833 collection_manager_timer_id = -1; |
837 return FALSE; | 834 return FALSE; |
849 | 846 |
850 if (!stop) | 847 if (!stop) |
851 { | 848 { |
852 collection_manager_timer_id = g_timeout_add(COLLECT_MANAGER_FLUSH_DELAY, | 849 collection_manager_timer_id = g_timeout_add(COLLECT_MANAGER_FLUSH_DELAY, |
853 collect_manager_timer_cb, NULL); | 850 collect_manager_timer_cb, NULL); |
854 if (debug) printf("collection manager timer started\n"); | 851 DEBUG_1("collection manager timer started\n"); |
855 } | 852 } |
856 } | 853 } |
857 | 854 |
858 static void collect_manager_add_action(CollectManagerAction *action) | 855 static void collect_manager_add_action(CollectManagerAction *action) |
859 { | 856 { |
926 | 923 |
927 void collect_manager_flush(void) | 924 void collect_manager_flush(void) |
928 { | 925 { |
929 collect_manager_timer_push(TRUE); | 926 collect_manager_timer_push(TRUE); |
930 | 927 |
931 if (debug) printf("collection manager flushing\n"); | 928 DEBUG_1("collection manager flushing\n"); |
932 while (collect_manager_process_cb(NULL)); | 929 while (collect_manager_process_cb(NULL)); |
933 } | 930 } |