Introduce macros to display debug messages.
[geeqie.git] / src / collect-io.c
index 9fb9d12..5128834 100644 (file)
@@ -92,7 +92,7 @@ static gint collection_load_private(CollectionData *cd, const gchar *path, Colle
 
        if (!path) path = cd->path;
 
-       if (debug) printf("collection load: append=%d flush=%d only_geometry=%d path=%s\n",
+       DEBUG_1("collection load: append=%d flush=%d only_geometry=%d path=%s\n",
                          append, flush, only_geometry, path);
 
        /* load it */
@@ -156,7 +156,7 @@ static gint collection_load_private(CollectionData *cd, const gchar *path, Colle
                                changed |= collect_manager_process_action(entry, &buf);
 
                        valid = (buf[0] == '/' && collection_add_check(cd, file_data_new_simple(buf), FALSE, TRUE));
-                       if (debug && !valid) printf("collection invalid file: %s\n", buf);
+                       if (!valid) DEBUG_1("collection invalid file: %s\n", buf);
                        g_free(buf);
 
                        total++;
@@ -175,7 +175,7 @@ static gint collection_load_private(CollectionData *cd, const gchar *path, Colle
                        }
                }
 
-       if (debug) printf("collection files: total = %d fail = %d official=%d gqview=%d geometry=%d\n",
+       DEBUG_1("collection files: total = %d fail = %d official=%d gqview=%d geometry=%d\n",
                          total, fail, has_official_header, has_gqview_header, has_geometry_header);
 
        fclose(f);
@@ -292,7 +292,7 @@ static void collection_load_thumb_step(CollectionData *cd)
        if (!thumb_loader_start(cd->thumb_loader, ci->fd->path))
                {
                /* error, handle it, do next */
-               if (debug) printf("error loading thumb for %s\n", ci->fd->path);
+               DEBUG_1("error loading thumb for %s\n", ci->fd->path);
                collection_load_thumb_do(cd);
                collection_load_thumb_step(cd);
                }
@@ -721,11 +721,8 @@ static void collect_manager_refresh(void)
 
 static void collect_manager_process_actions(gint max)
 {
-       if (debug && collection_manager_action_list)
-               {
-               printf("collection manager processing actions\n");
-               }
-
+       if (collection_manager_action_list) DEBUG_1("collection manager processing actions\n");
+       
        while (collection_manager_action_list != NULL && max > 0)
                {
                CollectManagerAction *action;
@@ -823,13 +820,13 @@ static gint collect_manager_process_cb(gpointer data)
 
        if (collect_manager_process_entry_list()) return TRUE;
 
-       if (debug) printf("collection manager is up to date\n");
+       DEBUG_1("collection manager is up to date\n");
        return FALSE;
 }
 
 static gint collect_manager_timer_cb(gpointer data)
 {
-       if (debug) printf("collection manager timer expired\n");
+       DEBUG_1("collection manager timer expired\n");
 
        g_idle_add_full(G_PRIORITY_LOW, collect_manager_process_cb, NULL, NULL);
 
@@ -851,7 +848,7 @@ static void collect_manager_timer_push(gint stop)
                {
                collection_manager_timer_id = g_timeout_add(COLLECT_MANAGER_FLUSH_DELAY,
                                                            collect_manager_timer_cb, NULL);
-               if (debug) printf("collection manager timer started\n");
+               DEBUG_1("collection manager timer started\n");
                }
 }
 
@@ -928,6 +925,6 @@ void collect_manager_flush(void)
 {
        collect_manager_timer_push(TRUE);
 
-       if (debug) printf("collection manager flushing\n");
+       DEBUG_1("collection manager flushing\n");
        while (collect_manager_process_cb(NULL));
 }