[Xfce4-commits] <ristretto:ristretto-0.0> Make thumbnailing work with non-jpeg mimetypes and vertical thumbnailbars...

Stephan Arts noreply at xfce.org
Sun Oct 23 19:22:33 CEST 2011


Updating branch refs/heads/ristretto-0.0
         to f7df9dbb483a663e5ff618012f91c9c8ac71c894 (commit)
       from 6b4af04bc51d590c35ddc710119d82811494be86 (commit)

commit f7df9dbb483a663e5ff618012f91c9c8ac71c894
Author: Stephan Arts <stephan at xfce.org>
Date:   Fri Jan 8 23:37:45 2010 +0100

    Make thumbnailing work with non-jpeg mimetypes and vertical thumbnailbars...

 src/thumbnail_bar.c |    9 +++++++++
 src/thumbnailer.c   |   12 +++++++++---
 2 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/src/thumbnail_bar.c b/src/thumbnail_bar.c
index 11163a5..a955a93 100644
--- a/src/thumbnail_bar.c
+++ b/src/thumbnail_bar.c
@@ -372,9 +372,18 @@ rstto_thumbnail_bar_size_allocate(GtkWidget *widget, GtkAllocation *allocation)
                 child_allocation.height = child_allocation.width;
 
                 if (child_allocation.y < (allocation->y + allocation->height))
+                {
                     gtk_widget_set_child_visible(GTK_WIDGET(iter->data), TRUE);
+                    gtk_widget_size_allocate(GTK_WIDGET(iter->data), &child_allocation);
+
+                    /* Do thumbnailing stuff */
+                    rstto_thumbnailer_queue_image (bar->priv->thumbnailer, iter->data);
+                }
                 else
+                {
                     gtk_widget_set_child_visible(GTK_WIDGET(iter->data), FALSE);
+                    rstto_thumbnailer_dequeue_image (bar->priv->thumbnailer, iter->data);
+                }
 
                 gtk_widget_size_allocate(GTK_WIDGET(iter->data), &child_allocation);
                 child_allocation.y += child_allocation.height + spacing;
diff --git a/src/thumbnailer.c b/src/thumbnailer.c
index aada7f3..779f7a9 100644
--- a/src/thumbnailer.c
+++ b/src/thumbnailer.c
@@ -253,6 +253,7 @@ rstto_thumbnailer_queue_request_timer (RsttoThumbnailer *thumbnailer)
     GFile *file;
     RsttoImage *image;
     GError *error = NULL;
+    GFileInfo *file_info;
 
     uris = g_new0 (gchar *, g_slist_length(thumbnailer->priv->queue)+1);
     mimetypes = g_new0 (gchar *, g_slist_length(thumbnailer->priv->queue)+1);
@@ -263,7 +264,12 @@ rstto_thumbnailer_queue_request_timer (RsttoThumbnailer *thumbnailer)
         image = rstto_thumbnail_get_image (RSTTO_THUMBNAIL(iter->data));
         file = rstto_image_get_file (image);
         uris[i] = g_file_get_uri (file);
-        mimetypes[i] = "image/jpeg";
+        /* FIXME: get teh right mimetype */
+        file_info = g_file_query_info (file, "standard::content-type", 0, NULL, NULL);
+        if (file_info)
+        {
+            mimetypes[i] = g_file_info_get_attribute_string (file_info, "standard::content-type");
+        }
         iter = g_slist_next(iter);
         i++;
     }
@@ -297,10 +303,10 @@ cb_rstto_thumbnailer_request_finished (DBusGProxy *proxy, gint handle, gpointer
     while (iter)
     {
         rstto_thumbnail_update (iter->data);
-        prev = iter;
         iter = g_slist_next(iter);
-        thumbnailer->priv->queue = g_slist_remove (thumbnailer->priv->queue, prev);
     } 
+    g_slist_free (thumbnailer->priv->queue);
+    thumbnailer->priv->queue = NULL;
 }
 
 static void


More information about the Xfce4-commits mailing list