converted image loader to a GObject and use signals for notification
[geeqie.git] / src / thumb.c
index e72e876..1beb9cf 100644 (file)
@@ -168,8 +168,10 @@ static void thumb_loader_done_cb(ImageLoader *il, gpointer data)
                tl->cache_hit = FALSE;
 
                thumb_loader_setup(tl, tl->fd->path);
+       
+               g_signal_connect (G_OBJECT(tl->il), "done", (GCallback)thumb_loader_done_cb, tl);
 
-               if (!image_loader_start(tl->il, thumb_loader_done_cb, tl))
+               if (!image_loader_start(tl->il))
                        {
                        image_loader_free(tl->il);
                        tl->il = NULL;
@@ -278,8 +280,8 @@ static void thumb_loader_setup(ThumbLoader *tl, const gchar *path)
                image_loader_set_requested_size(tl->il, tl->max_w, tl->max_h);
                }
 
-       image_loader_set_error_func(tl->il, thumb_loader_error_cb, tl);
-       if (tl->func_progress) image_loader_set_percent_func(tl->il, thumb_loader_percent_cb, tl);
+       g_signal_connect (G_OBJECT(tl->il), "error", (GCallback)thumb_loader_error_cb, tl);
+       if (tl->func_progress) g_signal_connect (G_OBJECT(tl->il), "percent", (GCallback)thumb_loader_percent_cb, tl);
 }
 
 void thumb_loader_set_callbacks(ThumbLoader *tl,
@@ -391,7 +393,8 @@ gint thumb_loader_start(ThumbLoader *tl, FileData *fd)
                thumb_loader_setup(tl, tl->fd->path);
                }
 
-       if (!image_loader_start(tl->il, thumb_loader_done_cb, tl))
+       g_signal_connect (G_OBJECT(tl->il), "done", (GCallback)thumb_loader_done_cb, tl);
+       if (!image_loader_start(tl->il))
                {
                /* try from original if cache attempt */
                if (tl->cache_hit)
@@ -400,7 +403,8 @@ gint thumb_loader_start(ThumbLoader *tl, FileData *fd)
                        log_printf("%s", _("Thumbnail image in cache failed to load, trying to recreate.\n"));
 
                        thumb_loader_setup(tl, tl->fd->path);
-                       if (image_loader_start(tl->il, thumb_loader_done_cb, tl)) return TRUE;
+                       g_signal_connect (G_OBJECT(tl->il), "done", (GCallback)thumb_loader_done_cb, tl);
+                       if (image_loader_start(tl->il)) return TRUE;
                        }
                /* mark failed thumbnail in cache with 0 byte file */
                if (tl->cache_enable)