[Xfce4-commits] <ristretto:devel> Squashed commit of the following:

Stephan Arts stephan at xfce.org
Sun Aug 16 09:42:01 CEST 2009


Updating branch refs/heads/devel
         to 9c672b55fd8fa1b918efd55427f0f96b51857472 (commit)
       from 73c621338fce0b7a508d2ec81e8d8ec5acae3fd9 (commit)

commit 9c672b55fd8fa1b918efd55427f0f96b51857472
Author: Stephan Arts <stephan at xfce.org>
Date:   Thu Aug 13 11:17:19 2009 +0200

    Squashed commit of the following:
    
    commit fac4787133a1e6ba347361e26c348b816f9c792d
    Author: Stephan Arts <stephan at xfce.org>
    Date:   Thu Aug 13 11:16:20 2009 +0200
    
        Modify class-layout

 src/Makefile.am                        |   24 +-
 src/{main.h => abstract_renderer.c}    |    0
 src/{main.h => abstract_renderer.h}    |    0
 src/{main.h => abstract_thumbnailer.c} |    0
 src/{main.h => abstract_thumbnailer.h} |    0
 src/{main.h => dbus_thumbnailer.c}     |    0
 src/{main.h => dbus_thumbnailer.h}     |    0
 src/image.c                            |   43 +-
 src/image_list.c                       |  385 +-------
 src/image_list.h                       |   54 -
 src/image_list_iter.c                  |  145 +++
 src/image_list_iter.h                  |   62 ++
 src/{main.h => image_renderer.c}       |    0
 src/{main.h => image_renderer.h}       |    0
 src/image_viewer.c                     |  213 ++++
 src/image_viewer.h                     |   72 ++
 src/{main.h => internal_thumbnailer.c} |    0
 src/{main.h => internal_thumbnailer.h} |    0
 src/main.c                             |   58 +-
 src/main_window.c                      | 1830 +-------------------------------
 src/main_window.h                      |    2 +-
 src/main_window_ui.xml                 |  101 --
 src/navigator.c                        | 1759 ------------------------------
 src/navigator.h                        |  176 ---
 src/picture_viewer.c                   | 1600 ----------------------------
 src/picture_viewer.h                   |   95 --
 src/preferences_dialog.c               |  523 ---------
 src/preferences_dialog.h               |   68 --
 src/ristretto-abstract_thumbnailer.o   |  Bin 0 -> 864 bytes
 src/ristretto-dbus_thumbnailer.o       |  Bin 0 -> 860 bytes
 src/ristretto-internal_thumbnailer.o   |  Bin 0 -> 864 bytes
 src/save_dialog.c                      |  195 ----
 src/save_dialog.h                      |   65 --
 src/settings.c                         |  253 -----
 src/thumbnail.c                        |  292 +-----
 src/thumbnail.h                        |   26 +-
 src/thumbnail_bar.c                    |  826 --------------
 src/thumbnail_bar.h                    |   71 --
 src/{main.h => transition_renderer.c}  |    0
 src/{main.h => transition_renderer.h}  |    0
 40 files changed, 558 insertions(+), 8380 deletions(-)

diff --git a/src/Makefile.am b/src/Makefile.am
index c201e0f..4b8a672 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,16 +1,20 @@
 bin_PROGRAMS = ristretto
 
 ristretto_SOURCES = \
+	abstract_thumbnailer.c abstract_thumbnailer.h \
+	internal_thumbnailer.c internal_thumbnailer.h \
+	dbus_thumbnailer.c dbus_thumbnailer.h \
+	thumbnail.c thumbnail.h \
+	image_viewer.c image_viewer.h \
+	image_list_iter.c image_list_iter.h \
 	image_list.c image_list.h \
-	image.c image.h \
 	image_cache.c image_cache.h \
-	picture_viewer.c picture_viewer.h \
+	abstract_renderer.c abstract_renderer.h \
+	image_renderer.c image_renderer.h \
+	transition_renderer.c transition_renderer.h \
 	settings.c settings.h \
-	preferences_dialog.h preferences_dialog.c \
-	main_window_ui.h \
+	image.c image.h \
 	main_window.c main_window.h \
-	thumbnail_bar.c thumbnail_bar.h \
-	thumbnail.c thumbnail.h \
 	main.c
 
 ristretto_CFLAGS = \
@@ -43,13 +47,5 @@ INCLUDES = \
 
 if MAINTAINER_MODE
 
-BUILT_SOURCES = \
-	main_window_ui.h
-
-main_window_ui.h: main_window_ui.xml
-	exo-csource --strip-comments --strip-content --static --name=main_window_ui $< > $@
-
 endif
 
-EXTRA_DIST = \
-	main_window_ui.xml
diff --git a/src/main.h b/src/abstract_renderer.c
similarity index 100%
copy from src/main.h
copy to src/abstract_renderer.c
diff --git a/src/main.h b/src/abstract_renderer.h
similarity index 100%
copy from src/main.h
copy to src/abstract_renderer.h
diff --git a/src/main.h b/src/abstract_thumbnailer.c
similarity index 100%
copy from src/main.h
copy to src/abstract_thumbnailer.c
diff --git a/src/main.h b/src/abstract_thumbnailer.h
similarity index 100%
copy from src/main.h
copy to src/abstract_thumbnailer.h
diff --git a/src/main.h b/src/dbus_thumbnailer.c
similarity index 100%
copy from src/main.h
copy to src/dbus_thumbnailer.c
diff --git a/src/main.h b/src/dbus_thumbnailer.h
similarity index 100%
copy from src/main.h
copy to src/dbus_thumbnailer.h
diff --git a/src/image.c b/src/image.c
index a6a9bb5..3f95943 100644
--- a/src/image.c
+++ b/src/image.c
@@ -31,7 +31,7 @@
 
 #ifndef RSTTO_IMAGE_BUFFER_SIZE
 /* #define RSTTO_IMAGE_BUFFER_SIZE 1024 */
-#define RSTTO_IMAGE_BUFFER_SIZE 131072
+#define RSTTO_IMAGE_BUFFER_SIZE 131072 /* 128k */
 #endif
 
 enum
@@ -515,47 +515,6 @@ rstto_image_get_height (RsttoImage *image)
 
 
 /**
- * rstto_image_get_thumbnail:
- * @image       : 
- *
- * return value: a gdkpixbuf * referencing a pixbuf pointing to the thumbnail.
- */
-GdkPixbuf *
-rstto_image_get_thumbnail (RsttoImage *image)
-{
-    gchar *file_uri;
-    gchar *file_uri_checksum;
-    gchar *thumbnail_filename;
-    gchar *thumbnail_path;
-
-    g_return_val_if_fail (image != NULL, NULL);
-    g_return_val_if_fail (image->priv != NULL, NULL);
-
-    file_uri = g_file_get_uri (image->priv->file);
-    file_uri_checksum = g_compute_checksum_for_string (G_CHECKSUM_MD5, file_uri, strlen (file_uri));
-    thumbnail_filename = g_strconcat (file_uri_checksum, ".png", NULL);
-    thumbnail_path = g_build_path ("/", g_get_home_dir(), ".thumbnails", "normal", thumbnail_filename, NULL);
-
-    if (image->priv->thumbnail == NULL)
-    {
-        image->priv->thumbnail = gdk_pixbuf_new_from_file_at_scale (thumbnail_path, 128, 128, TRUE, NULL);
-    }
-    else
-    {
-
-    }
-
-    g_free (file_uri);
-    g_free (file_uri_checksum);
-    g_free (thumbnail_filename);
-    g_free (thumbnail_path);
-
-
-    return image->priv->thumbnail;
-}
-
-
-/**
  * rstto_image_get_pixbuf:
  * @image       : 
  *
diff --git a/src/image_list.c b/src/image_list.c
index f1c1110..7d6ae4b 100644
--- a/src/image_list.c
+++ b/src/image_list.c
@@ -27,6 +27,7 @@
 
 #include "image.h"
 #include "image_list.h"
+#include "image_list_iter.h"
 
 static void 
 rstto_image_list_init(RsttoImageList *);
@@ -35,40 +36,11 @@ rstto_image_list_class_init(RsttoImageListClass *);
 static void
 rstto_image_list_dispose(GObject *object);
 
-static void 
-rstto_image_list_iter_init(RsttoImageListIter *);
-static void
-rstto_image_list_iter_class_init(RsttoImageListIterClass *);
-static void
-rstto_image_list_iter_dispose(GObject *object);
 
-static RsttoImageListIter * rstto_image_list_iter_new ();
-
-static gint
-cb_rstto_image_list_image_name_compare_func (RsttoImage *a, RsttoImage *b);
+static RsttoImageListIter *rstto_image_list_iter_new ();
 
 static GObjectClass *parent_class = NULL;
-static GObjectClass *iter_parent_class = NULL;
 
-enum
-{
-    RSTTO_IMAGE_LIST_SIGNAL_NEW_IMAGE = 0,
-    RSTTO_IMAGE_LIST_SIGNAL_REMOVE_IMAGE,
-    RSTTO_IMAGE_LIST_SIGNAL_REMOVE_ALL,
-    RSTTO_IMAGE_LIST_SIGNAL_COUNT
-};
-
-enum
-{
-    RSTTO_IMAGE_LIST_ITER_SIGNAL_CHANGED = 0,
-    RSTTO_IMAGE_LIST_ITER_SIGNAL_COUNT
-};
-
-struct _RsttoImageListIterPriv
-{
-    RsttoImageList *image_list;
-    RsttoImage *image;
-};
 
 struct _RsttoImageListPriv
 {
@@ -78,8 +50,11 @@ struct _RsttoImageListPriv
     GSList *iterators;
 };
 
+enum {
+	RSTTO_IMAGE_LIST_SIGNAL_COUNT
+};
+
 static gint rstto_image_list_signals[RSTTO_IMAGE_LIST_SIGNAL_COUNT];
-static gint rstto_image_list_iter_signals[RSTTO_IMAGE_LIST_ITER_SIGNAL_COUNT];
 
 GType
 rstto_image_list_get_type (void)
@@ -122,40 +97,6 @@ rstto_image_list_class_init(RsttoImageListClass *nav_class)
 
     object_class->dispose = rstto_image_list_dispose;
 
-    rstto_image_list_signals[RSTTO_IMAGE_LIST_SIGNAL_NEW_IMAGE] = g_signal_new("new-image",
-            G_TYPE_FROM_CLASS(nav_class),
-            G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
-            0,
-            NULL,
-            NULL,
-            g_cclosure_marshal_VOID__OBJECT,
-            G_TYPE_NONE,
-            1,
-            G_TYPE_OBJECT,
-            NULL);
-
-    rstto_image_list_signals[RSTTO_IMAGE_LIST_SIGNAL_REMOVE_IMAGE] = g_signal_new("remove-image",
-            G_TYPE_FROM_CLASS(nav_class),
-            G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
-            0,
-            NULL,
-            NULL,
-            g_cclosure_marshal_VOID__OBJECT,
-            G_TYPE_NONE,
-            1,
-            G_TYPE_OBJECT,
-            NULL);
-
-    rstto_image_list_signals[RSTTO_IMAGE_LIST_SIGNAL_REMOVE_ALL] = g_signal_new("remove-all",
-            G_TYPE_FROM_CLASS(nav_class),
-            G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
-            0,
-            NULL,
-            NULL,
-            g_cclosure_marshal_VOID__VOID,
-            G_TYPE_NONE,
-            0,
-            NULL);
 }
 
 static void
@@ -173,317 +114,3 @@ rstto_image_list_new (void)
 
     return image_list;
 }
-
-gboolean
-rstto_image_list_add_file (RsttoImageList *image_list, GFile *file, GError **error)
-{
-    RsttoImage *image = rstto_image_new (file);
-    if (image)
-    {
-        image_list->priv->images = g_list_insert_sorted (image_list->priv->images, image, (GCompareFunc)cb_rstto_image_list_image_name_compare_func);
-        image_list->priv->n_images++;
-
-        g_signal_emit (G_OBJECT (image_list), rstto_image_list_signals[RSTTO_IMAGE_LIST_SIGNAL_NEW_IMAGE], 0, image, NULL);
-        if (image_list->priv->n_images == 1)
-        {
-            /** TODO: update all iterators */
-            GSList *iter = image_list->priv->iterators;
-            while (iter)
-            {
-                g_signal_emit (G_OBJECT (iter->data), rstto_image_list_iter_signals[RSTTO_IMAGE_LIST_ITER_SIGNAL_CHANGED], 0, NULL);
-                iter = g_slist_next (iter);
-            }
-        }
-        return TRUE;
-    }
-    return FALSE;
-}
-
-gint
-rstto_image_list_get_n_images (RsttoImageList *image_list)
-{
-    return g_list_length (image_list->priv->images);
-}
-
-/**
- * rstto_image_list_get_iter:
- * @image_list:
- *
- * TODO: track iterators
- *
- * return iter;
- */
-RsttoImageListIter *
-rstto_image_list_get_iter (RsttoImageList *image_list)
-{
-    RsttoImage *image = NULL;
-    RsttoImageListIter *iter = NULL;
-    if (image_list->priv->images)
-        image = image_list->priv->images->data;
-
-    iter = rstto_image_list_iter_new (image_list, image);
-
-    image_list->priv->iterators = g_slist_prepend (image_list->priv->iterators, iter);
-
-    return iter;
-}
-
-
-void
-rstto_image_list_remove_image (RsttoImageList *image_list, RsttoImage *image)
-{
-    GSList *iter = NULL;
-
-    if (g_list_find (image_list->priv->images, image))
-    {
-        image_list->priv->images = g_list_remove (image_list->priv->images, image);
-
-        iter = image_list->priv->iterators;
-        while (iter)
-        {
-            if (rstto_image_list_iter_get_image (iter->data) == image)
-            {
-                rstto_image_list_iter_previous (iter->data);
-            }
-            iter = g_slist_next (iter);
-        }
-        g_signal_emit (G_OBJECT (image_list), rstto_image_list_signals[RSTTO_IMAGE_LIST_SIGNAL_REMOVE_IMAGE], 0, image, NULL);
-        g_object_unref (image);
-    }
-}
-
-void
-rstto_image_list_remove_all (RsttoImageList *image_list)
-{
-    GSList *iter = NULL;
-    g_list_foreach (image_list->priv->images, (GFunc)g_object_unref, NULL);
-    g_list_free (image_list->priv->images);
-    image_list->priv->images = NULL;
-
-    iter = image_list->priv->iterators;
-    while (iter)
-    {
-        rstto_image_list_iter_set_position (iter->data, 0);
-        iter = g_slist_next (iter);
-    }
-    g_signal_emit (G_OBJECT (image_list), rstto_image_list_signals[RSTTO_IMAGE_LIST_SIGNAL_REMOVE_ALL], 0, NULL);
-}
-
-
-/**
- * cb_rstto_image_list_image_name_compare_func:
- * @a:
- * @b:
- *
- *
- * Return value: (see strcmp)
- */
-static gint
-cb_rstto_image_list_image_name_compare_func (RsttoImage *a, RsttoImage *b)
-{
-    gchar *a_base = g_file_get_basename (rstto_image_get_file (a));  
-    gchar *b_base = g_file_get_basename (rstto_image_get_file (b));  
-    gint result = 0;
-
-    result = g_strcasecmp (a_base, b_base);
-
-    g_free (a_base);
-    g_free (b_base);
-    return result;
-}
-
-GType
-rstto_image_list_iter_get_type (void)
-{
-    static GType rstto_image_list_iter_type = 0;
-
-    if (!rstto_image_list_iter_type)
-    {
-        static const GTypeInfo rstto_image_list_iter_info = 
-        {
-            sizeof (RsttoImageListIterClass),
-            (GBaseInitFunc) NULL,
-            (GBaseFinalizeFunc) NULL,
-            (GClassInitFunc) rstto_image_list_iter_class_init,
-            (GClassFinalizeFunc) NULL,
-            NULL,
-            sizeof (RsttoImageListIter),
-            0,
-            (GInstanceInitFunc) rstto_image_list_iter_init,
-            NULL
-        };
-
-        rstto_image_list_iter_type = g_type_register_static (G_TYPE_OBJECT, "RsttoImageListIter", &rstto_image_list_iter_info, 0);
-    }
-    return rstto_image_list_iter_type;
-}
-
-static void
-rstto_image_list_iter_init (RsttoImageListIter *iter)
-{
-    iter->priv = g_new0 (RsttoImageListIterPriv, 1);
-}
-
-static void
-rstto_image_list_iter_class_init(RsttoImageListIterClass *iter_class)
-{
-    GObjectClass *object_class = G_OBJECT_CLASS(iter_class);
-
-    iter_parent_class = g_type_class_peek_parent(iter_class);
-
-    object_class->dispose = rstto_image_list_iter_dispose;
-
-    rstto_image_list_iter_signals[RSTTO_IMAGE_LIST_ITER_SIGNAL_CHANGED] = g_signal_new("changed",
-            G_TYPE_FROM_CLASS(iter_class),
-            G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
-            0,
-            NULL,
-            NULL,
-            g_cclosure_marshal_VOID__VOID,
-            G_TYPE_NONE,
-            0,
-            NULL);
-
-}
-
-static void
-rstto_image_list_iter_dispose (GObject *object)
-{
-    RsttoImageListIter *iter = RSTTO_IMAGE_LIST_ITER(object);
-    if (iter->priv->image)
-    {
-        g_object_unref (iter->priv->image);
-        iter->priv->image = NULL;
-    }
-
-    if (iter->priv->image_list)
-    {
-        iter->priv->image_list->priv->iterators = g_slist_remove (iter->priv->image_list->priv->iterators, iter);
-        iter->priv->image_list= NULL;
-    }
-}
-
-static RsttoImageListIter *
-rstto_image_list_iter_new (RsttoImageList *nav, RsttoImage *image)
-{
-    RsttoImageListIter *iter;
-
-    iter = g_object_new(RSTTO_TYPE_IMAGE_LIST_ITER, NULL);
-    iter->priv->image = image;
-    iter->priv->image_list = nav;
-
-    return iter;
-}
-
-gboolean
-rstto_image_list_iter_find_image (RsttoImageListIter *iter, RsttoImage *image)
-{
-    gint pos = g_list_index (iter->priv->image_list->priv->images, image);
-    if (pos > -1)
-    {
-        if (iter->priv->image)
-        {
-            iter->priv->image = NULL;
-        }
-        iter->priv->image = image;
-
-        g_signal_emit (G_OBJECT (iter), rstto_image_list_iter_signals[RSTTO_IMAGE_LIST_ITER_SIGNAL_CHANGED], 0, NULL);
-
-        return TRUE;
-    }
-    return FALSE;
-}
-
-gint
-rstto_image_list_iter_get_position (RsttoImageListIter *iter)
-{
-    if (iter->priv->image == NULL)
-    {
-        return -1;
-    }
-    return g_list_index (iter->priv->image_list->priv->images, iter->priv->image);
-}
-
-RsttoImage *
-rstto_image_list_iter_get_image (RsttoImageListIter *iter)
-{
-    return RSTTO_IMAGE (iter->priv->image);
-}
-
-
-void
-rstto_image_list_iter_set_position (RsttoImageListIter *iter, gint pos)
-{
-    if (iter->priv->image)
-    {
-        iter->priv->image = NULL;
-    }
-
-    iter->priv->image = g_list_nth_data (iter->priv->image_list->priv->images, pos); 
-
-    g_signal_emit (G_OBJECT (iter), rstto_image_list_iter_signals[RSTTO_IMAGE_LIST_ITER_SIGNAL_CHANGED], 0, NULL);
-}
-
-void
-rstto_image_list_iter_next (RsttoImageListIter *iter)
-{
-    GList *position = NULL;
-    if (iter->priv->image)
-    {
-        position = g_list_find (iter->priv->image_list->priv->images, iter->priv->image);
-        iter->priv->image = NULL;
-    }
-
-    position = g_list_next (position);
-    if (position)
-        iter->priv->image = position->data; 
-    else
-    {
-        position = g_list_first (iter->priv->image_list->priv->images);
-        if (position)
-            iter->priv->image = position->data; 
-        else
-            iter->priv->image = NULL;
-    }
-
-    g_signal_emit (G_OBJECT (iter), rstto_image_list_iter_signals[RSTTO_IMAGE_LIST_ITER_SIGNAL_CHANGED], 0, NULL);
-}
-
-void
-rstto_image_list_iter_previous (RsttoImageListIter *iter)
-{
-    GList *position = NULL;
-    if (iter->priv->image)
-    {
-        position = g_list_find (iter->priv->image_list->priv->images, iter->priv->image);
-        iter->priv->image = NULL;
-    }
-
-    position = g_list_previous (position);
-    if (position)
-        iter->priv->image = position->data; 
-    else
-    {
-        position = g_list_last (iter->priv->image_list->priv->images);
-        if (position)
-            iter->priv->image = position->data; 
-        else
-            iter->priv->image = NULL;
-    }
-
-    g_signal_emit (G_OBJECT (iter), rstto_image_list_iter_signals[RSTTO_IMAGE_LIST_ITER_SIGNAL_CHANGED], 0, NULL);
-}
-
-RsttoImageListIter *
-rstto_image_list_iter_clone (RsttoImageListIter *iter)
-{
-    RsttoImageListIter *new_iter = rstto_image_list_iter_new (iter->priv->image_list, iter->priv->image);
-
-    return new_iter;
-}
-
-GCompareFunc
-rstto_image_list_get_compare_func (RsttoImageList *image_list)
-{
-    return (GCompareFunc)cb_rstto_image_list_image_name_compare_func;
-}
diff --git a/src/image_list.h b/src/image_list.h
index 49ec8a2..70614a9 100644
--- a/src/image_list.h
+++ b/src/image_list.h
@@ -57,65 +57,11 @@ struct _RsttoImageListClass
 };
 
 
-#define RSTTO_TYPE_IMAGE_LIST_ITER rstto_image_list_iter_get_type()
-
-#define RSTTO_IMAGE_LIST_ITER(obj)( \
-        G_TYPE_CHECK_INSTANCE_CAST ((obj), \
-                RSTTO_TYPE_IMAGE_LIST_ITER, \
-                RsttoImageListIter))
-
-#define RSTTO_IS_IMAGE_LIST_ITER(obj)( \
-        G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
-                RSTTO_TYPE_IMAGE_LIST_ITER))
-
-#define RSTTO_IMAGE_LIST_ITER_CLASS(klass)( \
-        G_TYPE_CHECK_CLASS_CAST ((klass), \
-                RSTTO_TYPE_IMAGE_LIST_ITER, \
-                RsttoImageListIterClass))
-
-#define RSTTO_IS_IMAGE_LIST_ITER_CLASS(klass)( \
-        G_TYPE_CHECK_CLASS_TYPE ((klass), \
-                RSTTO_TYPE_IMAGE_LIST_ITER()))
-
-typedef struct _RsttoImageListIter RsttoImageListIter;
-typedef struct _RsttoImageListIterPriv RsttoImageListIterPriv;
-struct _RsttoImageListIter
-{
-    GObject parent;
-    RsttoImageListIterPriv *priv;
-};
-
-typedef struct _RsttoImageListIterClass RsttoImageListIterClass;
-struct _RsttoImageListIterClass
-{
-    GObjectClass      parent_class;
-};
 
 
 GType           rstto_image_list_get_type ();
 RsttoImageList *rstto_image_list_new ();
 
-gint     rstto_image_list_get_n_images (RsttoImageList *image_list);
-gboolean rstto_image_list_add_file (RsttoImageList *image_list, GFile *file, GError **);
-
-RsttoImageListIter *rstto_image_list_get_iter (RsttoImageList *image_list);
-
-/** Iter functions */
-GType       rstto_image_list_iter_get_type ();
-RsttoImage *rstto_image_list_iter_get_image (RsttoImageListIter *iter);
-void        rstto_image_list_iter_previous (RsttoImageListIter *iter);
-void        rstto_image_list_iter_next (RsttoImageListIter *iter);
-gint        rstto_image_list_iter_get_position (RsttoImageListIter *iter);
-void        rstto_image_list_iter_set_position (RsttoImageListIter *iter, gint pos);
-
-void        rstto_image_list_remove_all (RsttoImageList *image_list);
-void        rstto_image_list_remove_image (RsttoImageList *image_list, RsttoImage *image);
-gboolean    rstto_image_list_iter_find_image (RsttoImageListIter *iter, RsttoImage *image);
-RsttoImageListIter *rstto_image_list_iter_clone (RsttoImageListIter *iter);
-
-GCompareFunc rstto_image_list_get_compare_func (RsttoImageList *image_list);
-
-
 G_END_DECLS
 
 #endif /* __RISTRETTO_IMAGE_LIST_H__ */
diff --git a/src/image_list_iter.c b/src/image_list_iter.c
new file mode 100644
index 0000000..3cd96c4
--- /dev/null
+++ b/src/image_list_iter.c
@@ -0,0 +1,145 @@
+/*
+ *  Copyright (c) 2009 Stephan Arts <stephan at xfce.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+
+#include <config.h>
+
+#include <gtk/gtk.h>
+#include <gtk/gtkmarshal.h>
+
+#include <string.h>
+
+#include <libexif/exif-data.h>
+
+#include "image.h"
+#include "image_list.h"
+#include "image_list_iter.h"
+
+static void 
+rstto_image_list_iter_init (GObject *);
+static void
+rstto_image_list_iter_class_init(RsttoImageListIterClass *);
+static void
+rstto_image_list_iter_dispose(GObject *object);
+
+static GObjectClass *parent_class = NULL;
+
+enum
+{
+    RSTTO_IMAGE_LIST_ITER_SIGNAL_CHANGED = 0,
+    RSTTO_IMAGE_LIST_ITER_SIGNAL_COUNT
+};
+
+struct _RsttoImageListIterPriv
+{
+    RsttoImageList *image_list;
+    RsttoImage *image;
+};
+
+static gint rstto_image_list_iter_signals[RSTTO_IMAGE_LIST_ITER_SIGNAL_COUNT];
+
+GType
+rstto_image_list_iter_get_type (void)
+{
+    static GType rstto_image_list_iter_type = 0;
+
+    if (!rstto_image_list_iter_type)
+    {
+        static const GTypeInfo rstto_image_list_iter_info = 
+        {
+            sizeof (RsttoImageListIterClass),
+            (GBaseInitFunc) NULL,
+            (GBaseFinalizeFunc) NULL,
+            (GClassInitFunc) rstto_image_list_iter_class_init,
+            (GClassFinalizeFunc) NULL,
+            NULL,
+            sizeof (RsttoImageListIter),
+            0,
+            (GInstanceInitFunc) rstto_image_list_iter_init,
+            NULL
+        };
+
+        rstto_image_list_iter_type = g_type_register_static (G_TYPE_OBJECT, "RsttoImageListIter", &rstto_image_list_iter_info, 0);
+    }
+    return rstto_image_list_iter_type;
+}
+
+static void 
+rstto_image_list_iter_init (GObject *object)
+{
+
+}
+
+static void
+rstto_image_list_iter_class_init(RsttoImageListIterClass *iter_class)
+{
+    GObjectClass *object_class = G_OBJECT_CLASS(iter_class);
+
+    parent_class = g_type_class_peek_parent(iter_class);
+
+    object_class->dispose = rstto_image_list_iter_dispose;
+
+    rstto_image_list_iter_signals[RSTTO_IMAGE_LIST_ITER_SIGNAL_CHANGED] = g_signal_new("changed",
+            G_TYPE_FROM_CLASS(iter_class),
+            G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+            0,
+            NULL,
+            NULL,
+            g_cclosure_marshal_VOID__VOID,
+            G_TYPE_NONE,
+            0,
+            NULL);
+
+}
+
+static void
+rstto_image_list_iter_dispose (GObject *object)
+{
+    RsttoImageListIter *iter = RSTTO_IMAGE_LIST_ITER(object);
+    if (iter->priv->image)
+    {
+        g_object_unref (iter->priv->image);
+        iter->priv->image = NULL;
+    }
+
+    if (iter->priv->image_list)
+    {
+        g_object_unref (iter->priv->image_list);
+        iter->priv->image_list = NULL;
+    }
+}
+
+static RsttoImageListIter *
+rstto_image_list_iter_new (RsttoImageList *list, RsttoImage *image)
+{
+    RsttoImageListIter *iter;
+
+    iter = g_object_new(RSTTO_TYPE_IMAGE_LIST_ITER, NULL);
+    iter->priv->image = image;
+    iter->priv->image_list = list;
+
+    return iter;
+}
+
+RsttoImageListIter *
+rstto_image_list_iter_clone (RsttoImageListIter *iter)
+{
+    RsttoImageListIter *new_iter = rstto_image_list_iter_new (iter->priv->image_list, iter->priv->image);
+
+    return new_iter;
+}
diff --git a/src/image_list_iter.h b/src/image_list_iter.h
new file mode 100644
index 0000000..57f8727
--- /dev/null
+++ b/src/image_list_iter.h
@@ -0,0 +1,62 @@
+/*
+ *  Copyright (c) 2009 Stephan Arts <stephan at xfce.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+
+#ifndef __RISTRETTO_IMAGE_LIST_ITER_H__
+#define __RISTRETTO_IMAGE_LIST_ITER_H__
+
+#define RSTTO_TYPE_IMAGE_LIST_ITER rstto_image_list_iter_get_type()
+
+#define RSTTO_IMAGE_LIST_ITER(obj)( \
+        G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+                RSTTO_TYPE_IMAGE_LIST_ITER, \
+                RsttoImageListIter))
+
+#define RSTTO_IS_IMAGE_LIST_ITER(obj)( \
+        G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+                RSTTO_TYPE_IMAGE_LIST_ITER))
+
+#define RSTTO_IMAGE_LIST_ITER_CLASS(klass)( \
+        G_TYPE_CHECK_CLASS_CAST ((klass), \
+                RSTTO_TYPE_IMAGE_LIST_ITER, \
+                RsttoImageListIterClass))
+
+#define RSTTO_IS_IMAGE_LIST_ITER_CLASS(klass)( \
+        G_TYPE_CHECK_CLASS_TYPE ((klass), \
+                RSTTO_TYPE_IMAGE_LIST_ITER()))
+
+typedef struct _RsttoImageListIter RsttoImageListIter;
+typedef struct _RsttoImageListIterPriv RsttoImageListIterPriv;
+
+struct _RsttoImageListIter
+{
+    GObject parent;
+    RsttoImageListIterPriv *priv;
+};
+
+typedef struct _RsttoImageListIterClass RsttoImageListIterClass;
+struct _RsttoImageListIterClass
+{
+    GObjectClass      parent_class;
+};
+
+GType           rstto_image_list_iter_get_type ();
+
+
+#endif /* __RISTRETTO_IMAGE_LIST_ITER_H__ */
+
diff --git a/src/main.h b/src/image_renderer.c
similarity index 100%
copy from src/main.h
copy to src/image_renderer.c
diff --git a/src/main.h b/src/image_renderer.h
similarity index 100%
copy from src/main.h
copy to src/image_renderer.h
diff --git a/src/image_viewer.c b/src/image_viewer.c
new file mode 100644
index 0000000..d16d1d3
--- /dev/null
+++ b/src/image_viewer.c
@@ -0,0 +1,213 @@
+/*
+ *  Copyright (C) Stephan Arts 2009 <stephan at xfce.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include <config.h>
+#include <gtk/gtk.h>
+#include <gtk/gtkmarshal.h>
+
+#include "image_viewer.h"
+
+static void
+rstto_marshal_VOID__OBJECT_OBJECT (GClosure     *closure,
+                                   GValue       *return_value,
+                                   guint         n_param_values,
+                                   const GValue *param_values,
+                                   gpointer      invocation_hint,
+                                   gpointer      marshal_data);
+
+
+static void
+rstto_image_viewer_init (GObject *);
+static void
+rstto_image_viewer_class_init (GObjectClass *);
+static gboolean
+rstto_image_viewer_set_scroll_adjustments (RsttoImageViewer *, 
+                                           GtkAdjustment *,
+                                           GtkAdjustment *);
+
+struct _RsttoImageViewerPriv
+{
+    void (*cb_value_changed) (GtkAdjustment *,
+                              RsttoImageViewer *);
+};
+
+static GtkWidgetClass *parent_class = NULL;
+
+GType
+rstto_image_viewer_get_type (void)
+{
+    static GType rstto_image_viewer_type = 0;
+
+    if (!rstto_image_viewer_type)
+    {
+        static const GTypeInfo rstto_image_viewer_info = 
+        {
+            sizeof (RsttoImageViewerClass),
+            (GBaseInitFunc) NULL,
+            (GBaseFinalizeFunc) NULL,
+            (GClassInitFunc) rstto_image_viewer_class_init,
+            (GClassFinalizeFunc) NULL,
+            NULL,
+            sizeof (RsttoImageViewer),
+            0,
+            (GInstanceInitFunc) rstto_image_viewer_init,
+            NULL
+        };
+
+        rstto_image_viewer_type = g_type_register_static (GTK_TYPE_WIDGET, "RsttoImageViewer", &rstto_image_viewer_info, 0);
+    }
+    return rstto_image_viewer_type;
+}
+
+/**
+ * rstto_marshal_VOID__OBJECT_OBJECT:
+ * @closure:
+ * @return_value:
+ * @n_param_values:
+ * @param_values:
+ * @invocation_hint:
+ * @marshal_data:
+ *
+ * A marshaller for the set_scroll_adjustments signal.
+ */
+static void
+rstto_marshal_VOID__OBJECT_OBJECT (GClosure     *closure,
+                                   GValue       *return_value,
+                                   guint         n_param_values,
+                                   const GValue *param_values,
+                                   gpointer      invocation_hint,
+                                   gpointer      marshal_data)
+{
+    typedef void (*GMarshalFunc_VOID__OBJECT_OBJECT) (gpointer data1,
+                                                      gpointer arg_1,
+                                                      gpointer arg_2,
+                                                      gpointer data2);
+    register GMarshalFunc_VOID__OBJECT_OBJECT callback;
+    register GCClosure *cc = (GCClosure*) closure;
+    register gpointer data1, data2;
+
+    g_return_if_fail (n_param_values == 3);
+
+    if (G_CCLOSURE_SWAP_DATA (closure))
+    {
+        data1 = closure->data;
+        data2 = g_value_get_object (param_values + 0);
+    }
+    else
+    {
+        data1 = g_value_get_object (param_values + 0);
+        data2 = closure->data;
+    }
+    callback = (GMarshalFunc_VOID__OBJECT_OBJECT) (marshal_data ?
+    marshal_data : cc->callback);
+
+    callback (data1,
+              g_value_get_object (param_values + 1),
+              g_value_get_object (param_values + 2),
+              data2);
+}
+
+/**
+ * rstto_image_viewer_init:
+ * @object:
+ *
+ */
+static void
+rstto_image_viewer_init (GObject *object)
+{
+}
+
+/**
+ * rstto_image_viewer_class_init:
+ * @object_class:
+ *
+ * Initialize imageviewer class
+ */
+static void
+rstto_image_viewer_class_init (GObjectClass *object_class)
+{
+    GtkWidgetClass        *widget_class;
+    RsttoImageViewerClass *viewer_class;
+
+    widget_class = (GtkWidgetClass*)object_class;
+    viewer_class = (RsttoImageViewerClass*)object_class;
+
+    parent_class = g_type_class_peek_parent (viewer_class);
+
+    viewer_class->set_scroll_adjustments = rstto_image_viewer_set_scroll_adjustments;
+
+    /*
+    widget_class->realize = rstto_picture_viewer_realize;
+    widget_class->expose_event = rstto_picture_viewer_expose;
+    widget_class->size_request = rstto_picture_viewer_size_request;
+    widget_class->size_allocate = rstto_picture_viewer_size_allocate;
+    */
+
+    widget_class->set_scroll_adjustments_signal =
+                  g_signal_new ("set_scroll_adjustments",
+                                G_TYPE_FROM_CLASS (object_class),
+                                G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+                                G_STRUCT_OFFSET (RsttoImageViewerClass, set_scroll_adjustments),
+                                NULL, NULL,
+                                rstto_marshal_VOID__OBJECT_OBJECT,
+                                G_TYPE_NONE, 2,
+                                GTK_TYPE_ADJUSTMENT,
+                                GTK_TYPE_ADJUSTMENT);
+}
+
+static gboolean  
+rstto_image_viewer_set_scroll_adjustments (RsttoImageViewer *viewer,
+                                           GtkAdjustment *hadjustment,
+                                           GtkAdjustment *vadjustment)
+{
+    if(viewer->hadjustment)
+    {
+        g_signal_handlers_disconnect_by_func (viewer->hadjustment,
+                                              viewer->priv->cb_value_changed,
+                                              viewer);
+        g_object_unref(viewer->hadjustment);
+    }
+    if(viewer->vadjustment)
+    {
+        g_signal_handlers_disconnect_by_func (viewer->vadjustment, 
+                                              viewer->priv->cb_value_changed,
+                                              viewer);
+        g_object_unref(viewer->vadjustment);
+    }
+
+    viewer->hadjustment = hadjustment;
+    viewer->vadjustment = vadjustment;
+
+    if(viewer->hadjustment)
+    {
+        g_signal_connect (G_OBJECT (viewer->hadjustment),
+                          "value-changed", 
+                          (GCallback)viewer->priv->cb_value_changed,
+                          viewer);
+        g_object_ref(viewer->hadjustment);
+    }
+    if(viewer->vadjustment)
+    {
+        g_signal_connect (G_OBJECT(viewer->vadjustment),
+                          "value-changed",
+                          (GCallback)viewer->priv->cb_value_changed,
+                          viewer);
+        g_object_ref(viewer->vadjustment);
+    }
+    return TRUE;
+}
diff --git a/src/image_viewer.h b/src/image_viewer.h
new file mode 100644
index 0000000..85e31fe
--- /dev/null
+++ b/src/image_viewer.h
@@ -0,0 +1,72 @@
+/*
+ *  Copyright (C) Stephan Arts 2009 <stephan at xfce.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __RISTRETTO_IMAGE_VIEWER_H__
+#define __RISTRETTO_IMAGE_VIEWER_H__
+
+G_BEGIN_DECLS
+
+#define RSTTO_TYPE_IMAGE_VIEWER rstto_image_viewer_get_type()
+
+#define RSTTO_IMAGE_VIEWER(obj)( \
+        G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+                RSTTO_TYPE_IMAGE_VIEWER, \
+                RsttoImageViewer))
+
+#define RSTTO_IS_IMAGE_VIEWER(obj)( \
+        G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+                RSTTO_TYPE_IMAGE_VIEWER))
+
+#define RSTTO_IMAGE_VIEWER_CLASS(klass)( \
+        G_TYPE_CHECK_CLASS_CAST ((klass), \
+                RSTTO_TYPE_IMAGE_VIEWER, \
+                RsttoImageViewerClass))
+
+#define RSTTO_IS_IMAGE_VIEWER_CLASS(klass)( \
+        G_TYPE_CHECK_CLASS_TYPE ((klass), \
+                RSTTO_TYPE_IMAGE_VIEWER()))
+
+typedef struct _RsttoImageViewerPriv RsttoImageViewerPriv;
+
+typedef struct _RsttoImageViewer RsttoImageViewer;
+
+struct _RsttoImageViewer
+{
+    GtkWidget             parent;
+    RsttoImageViewerPriv *priv;
+
+    GtkAdjustment        *vadjustment;
+    GtkAdjustment        *hadjustment;
+};
+
+typedef struct _RsttoImageViewerClass RsttoImageViewerClass;
+
+struct _RsttoImageViewerClass
+{
+    GtkWidgetClass  parent_class;
+
+    gboolean (* set_scroll_adjustments) (RsttoImageViewer *viewer,
+          GtkAdjustment     *hadjustment,
+          GtkAdjustment     *vadjustment);
+};
+
+GType      rstto_image_viewer_get_type();
+
+GtkWidget *rstto_image_viewer_new ();
+
+#endif
diff --git a/src/main.h b/src/internal_thumbnailer.c
similarity index 100%
copy from src/main.h
copy to src/internal_thumbnailer.c
diff --git a/src/main.h b/src/internal_thumbnailer.h
similarity index 100%
copy from src/main.h
copy to src/internal_thumbnailer.h
diff --git a/src/main.c b/src/main.c
index fa411ff..fb9cf2e 100644
--- a/src/main.c
+++ b/src/main.c
@@ -33,7 +33,6 @@
 #include "image.h"
 #include "image_list.h"
 #include "settings.h"
-#include "picture_viewer.h"
 #include "main_window.h"
 
 
@@ -41,16 +40,6 @@ gboolean version = FALSE;
 gboolean start_fullscreen = FALSE;
 gboolean start_slideshow = FALSE;
 
-typedef struct {
-    RsttoImageList *image_list;
-    gint argc;
-    gchar **argv;
-    gint iter;
-} RsttoOpenFiles;
-
-static gboolean
-cb_rstto_open_files (RsttoOpenFiles *rof);
-
 static GOptionEntry entries[] =
 {
     {    "version", 'V', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, &version,
@@ -101,60 +90,15 @@ main(int argc, char **argv)
     xfconf_init(NULL);
 
     gtk_window_set_default_icon_name("ristretto");
-    settings = rstto_settings_new();
 
     image_list = rstto_image_list_new ();
-    window = rstto_main_window_new (image_list, FALSE);
-
-    if (argc > 1)
-    {
-        RsttoOpenFiles rof;
-
-        rof.image_list = image_list;
-        rof.argc = argc;
-        rof.argv = argv;
-	rof.iter = 1;
-
-        g_idle_add ((GSourceFunc )cb_rstto_open_files, &rof);
-
-    }
+    window = rstto_main_window_new (image_list);
 
-    g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(gtk_main_quit), NULL);
     gtk_widget_show_all (window);
 
     gtk_main();
 
-    g_object_unref (settings);
-
     xfconf_shutdown();
 
     return 0;
 }
-
-static gboolean
-cb_rstto_open_files (RsttoOpenFiles *rof)
-{
-    GFile *file;
-    GFileInfo *file_info;
-    const gchar *content_type;
-    if (rof->iter < rof->argc)
-    {
-        file = g_file_new_for_commandline_arg (rof->argv[rof->iter]);
-        if (file)
-        {
-            file_info = g_file_query_info (file, "standard::content-type", 0, NULL, NULL);
-            if (file_info)
-            {
-                content_type = g_file_info_get_attribute_string (file_info, "standard::content-type");
-
-                if (strncmp (content_type, "image/", 6) == 0)
-                {
-                    rstto_image_list_add_file (rof->image_list, file, NULL);
-                }
-            }
-        }
-        rof->iter++;
-        return TRUE;
-    }
-    return FALSE;
-}
diff --git a/src/main_window.c b/src/main_window.c
index 8cadffd..7ed0b4d 100644
--- a/src/main_window.c
+++ b/src/main_window.c
@@ -29,17 +29,8 @@
 
 #include <cairo/cairo.h>
 
-#include "image.h"
-
-#include "settings.h"
 #include "image_list.h"
-#include "image_cache.h"
-#include "picture_viewer.h"
 #include "main_window.h"
-#include "main_window_ui.h"
-#include "thumbnail_bar.h"
-
-#include "preferences_dialog.h"
 
 #define XFDESKTOP_SELECTION_FMT "XFDESKTOP_SELECTION_%d"
 
@@ -54,61 +45,6 @@
 
 struct _RsttoMainWindowPriv
 {
-    struct {
-        RsttoImageList *image_list;
-        gboolean        toolbar_visible;
-    } props;
-
-    guint show_fs_toolbar_timeout_id;
-    gint window_save_geometry_timer_id;
-    
-    gboolean fs_toolbar_sticky;
-
-    RsttoImageListIter *iter;
-
-    GtkActionGroup   *action_group;
-    GtkUIManager     *ui_manager;
-    GtkRecentManager *recent_manager;
-    RsttoSettings    *settings_manager;
-
-    GtkWidget *menubar;
-    GtkWidget *toolbar;
-    GtkWidget *image_list_toolbar;
-    GtkWidget *image_list_toolbar_menu;
-    GtkWidget *picture_viewer;
-    GtkWidget *p_viewer_s_window;
-    GtkWidget *hpaned;
-    GtkWidget *thumbnail_bar;
-    GtkWidget *statusbar;
-
-    GtkWidget *message_bar;
-    GtkWidget *message_bar_label;
-    GtkWidget *message_bar_button_cancel;
-    GtkWidget *message_bar_button_open;
-    GFile *message_bar_file;
-
-    guint      t_open_merge_id;
-    guint      t_open_folder_merge_id;
-    guint      recent_merge_id;
-    guint      play_merge_id;
-    guint      pause_merge_id;
-    guint      toolbar_play_merge_id;
-    guint      toolbar_pause_merge_id;
-    guint      toolbar_fullscreen_merge_id;
-    guint      toolbar_unfullscreen_merge_id;
-
-    GtkAction *play_action;
-    GtkAction *pause_action;
-    GtkAction *recent_action;
-
-    gboolean playing;
-    gint play_timeout_id;
-};
-
-enum
-{
-    PROP_0,
-    PROP_IMAGE_LIST,
 };
 
 static void
@@ -129,177 +65,8 @@ rstto_main_window_get_property (GObject    *object,
                                 GValue     *value,
                                 GParamSpec *pspec);
 
-static gboolean
-rstto_window_save_geometry_timer (gpointer user_data);
-static gboolean
-cb_rstto_main_window_configure_event (GtkWidget *widget, GdkEventConfigure *event);
-static void
-cb_rstto_main_window_state_event(GtkWidget *widget, GdkEventWindowState *event, gpointer user_data);
-static gboolean
-cb_rstto_main_window_show_fs_toolbar_timeout (RsttoMainWindow *window);
-static void
-cb_rstto_main_window_image_list_iter_changed (RsttoImageListIter *iter, RsttoMainWindow *window);
-static void
-rstto_main_window_image_list_iter_changed (RsttoMainWindow *window);
-
-static void
-cb_rstto_main_window_image_list_new_image (RsttoImageList *image_list, RsttoImage *image, RsttoMainWindow *window);
-
-static void
-cb_rstto_main_window_zoom_100 (GtkWidget *widget, RsttoMainWindow *window);
-static void
-cb_rstto_main_window_zoom_fit (GtkWidget *widget, RsttoMainWindow *window);
-static void
-cb_rstto_main_window_zoom_in (GtkWidget *widget, RsttoMainWindow *window);
-static void
-cb_rstto_main_window_zoom_out (GtkWidget *widget, RsttoMainWindow *window);
-
-static void
-cb_rstto_main_window_rotate_cw (GtkWidget *widget, RsttoMainWindow *window);
-static void
-cb_rstto_main_window_rotate_ccw (GtkWidget *widget, RsttoMainWindow *window);
-
-static void
-cb_rstto_main_window_next_image (GtkWidget *widget, RsttoMainWindow *window);
-static void
-cb_rstto_main_window_previous_image (GtkWidget *widget, RsttoMainWindow *window);
-static void
-cb_rstto_main_window_first_image (GtkWidget *widget, RsttoMainWindow *window);
-static void
-cb_rstto_main_window_last_image (GtkWidget *widget, RsttoMainWindow *window);
-
-static void
-cb_rstto_main_window_open_image (GtkWidget *widget, RsttoMainWindow *window);
-static void
-cb_rstto_main_window_open_folder (GtkWidget *widget, RsttoMainWindow *window);
-static void
-cb_rstto_main_window_open_recent(GtkRecentChooser *chooser, RsttoMainWindow *window);
-static void
-cb_rstto_main_window_close (GtkWidget *widget, RsttoMainWindow *window);
-static void
-cb_rstto_main_window_close_all (GtkWidget *widget, RsttoMainWindow *window);
-static void
-cb_rstto_main_window_save_copy (GtkWidget *widget, RsttoMainWindow *window);
-static void
-cb_rstto_main_window_delete (GtkWidget *widget, RsttoMainWindow *window);
-
-static void
-cb_rstto_main_window_print (GtkWidget *widget, RsttoMainWindow *window);
-static void
-rstto_main_window_print_draw_page (GtkPrintOperation *operation,
-           GtkPrintContext   *print_context,
-           gint               page_nr,
-          RsttoMainWindow *window);
-
-static void
-cb_rstto_main_window_play (GtkWidget *widget, RsttoMainWindow *window);
-static void
-cb_rstto_main_window_pause(GtkWidget *widget, RsttoMainWindow *window);
-static gboolean
-cb_rstto_main_window_play_slideshow (RsttoMainWindow *window);
-
-static void
-cb_rstto_main_window_message_bar_open (GtkWidget *widget, RsttoMainWindow *window);
-static void
-cb_rstto_main_window_message_bar_cancel (GtkWidget *widget, RsttoMainWindow *window);
-
-
-static void
-cb_rstto_main_window_toggle_show_toolbar (GtkWidget *widget, RsttoMainWindow *window);
-static void
-cb_rstto_main_window_fullscreen (GtkWidget *widget, RsttoMainWindow *window);
-static void
-cb_rstto_main_window_preferences (GtkWidget *widget, RsttoMainWindow *window);
-static void
-cb_rstto_main_window_about (GtkWidget *widget, RsttoMainWindow *window);
-static void
-cb_rstto_main_window_contents (GtkWidget *widget, RsttoMainWindow *window);
-static void
-cb_rstto_main_window_quit (GtkWidget *widget, RsttoMainWindow *window);
-
-static void
-cb_rstto_main_window_settings_notify (GObject *settings, GParamSpec *spec, RsttoMainWindow *window);
-
-static gboolean 
-cb_rstto_main_window_picture_viewer_motion_notify_event (RsttoPictureViewer *viewer,
-                                             GdkEventMotion *event,
-                                             gpointer user_data);
-
-static void
-rstto_main_window_set_sensitive (RsttoMainWindow *window, gboolean sensitive);
-
 static GtkWidgetClass *parent_class = NULL;
 
-static GtkActionEntry action_entries[] =
-{
-/* File Menu */
-  { "file-menu", NULL, N_ ("_File"), NULL, },
-  { "open", "document-open", N_ ("_Open"), "<control>O", N_ ("Open an image"), G_CALLBACK (cb_rstto_main_window_open_image), },
-  { "open-folder", "folder-open", N_ ("Open _Folder"), NULL, N_ ("Open a folder"), G_CALLBACK (cb_rstto_main_window_open_folder), },
-  { "save-copy", GTK_STOCK_SAVE_AS, N_ ("_Save copy"), "<control>s", N_ ("Save a copy of the image"), G_CALLBACK (cb_rstto_main_window_save_copy), },
-  { "print", GTK_STOCK_PRINT, N_ ("_Print"), "<control>p", N_ ("Print the image"), G_CALLBACK (cb_rstto_main_window_print), },
-  { "close", GTK_STOCK_CLOSE, N_ ("_Close"), "<control>W", N_ ("Close this image"), G_CALLBACK (cb_rstto_main_window_close), },
-  { "close-all", NULL, N_ ("_Close All"), NULL, N_ ("Close all images"), G_CALLBACK (cb_rstto_main_window_close_all), },
-  { "quit", GTK_STOCK_QUIT, N_ ("_Quit"), "<control>Q", N_ ("Quit Ristretto"), G_CALLBACK (cb_rstto_main_window_quit), },
-/* Edit Menu */
-  { "edit-menu", NULL, N_ ("_Edit"), NULL, },
-  { "open-with-menu", NULL, N_ ("_Open with..."), NULL, },
-  { "sorting-menu", NULL, N_ ("_Sorting"), NULL, },
-  { "delete", GTK_STOCK_DELETE, N_ ("_Delete"), "Delete", NULL, G_CALLBACK (cb_rstto_main_window_delete), },
-  { "preferences", GTK_STOCK_PREFERENCES, N_ ("_Preferences"), NULL, NULL, G_CALLBACK (cb_rstto_main_window_preferences), },
-/* View Menu */
-  { "view-menu", NULL, N_ ("_View"), NULL, },
-  { "fullscreen", GTK_STOCK_FULLSCREEN, N_ ("_Fullscreen"), "F11", NULL, G_CALLBACK (cb_rstto_main_window_fullscreen), },
-  { "unfullscreen", GTK_STOCK_LEAVE_FULLSCREEN, N_ ("_Leave Fullscreen"), NULL, NULL, G_CALLBACK (cb_rstto_main_window_fullscreen), },
-  { "set-as-wallpaper", NULL, N_ ("_Set as Wallpaper"), NULL, NULL, NULL, },
-/* Thumbnailbar submenu */
-  { "thumbnailbar-menu", NULL, N_ ("_Thumbnail Bar"), NULL, },
-/* Zoom submenu */
-  { "zoom-menu", NULL, N_ ("_Zooming"), NULL, },
-  { "zoom-in", GTK_STOCK_ZOOM_IN, N_ ("Zoom _In"), "<control>plus", NULL, G_CALLBACK (cb_rstto_main_window_zoom_in),},
-  { "zoom-out", GTK_STOCK_ZOOM_OUT, N_ ("Zoom _Out"), "<control>minus", NULL, G_CALLBACK (cb_rstto_main_window_zoom_out), },
-  { "zoom-fit", GTK_STOCK_ZOOM_FIT, N_ ("Zoom _Fit"), "<control>equal", NULL, G_CALLBACK (cb_rstto_main_window_zoom_fit), },
-  { "zoom-100", GTK_STOCK_ZOOM_100, N_ ("_Normal Size"), "<control>0", NULL, G_CALLBACK (cb_rstto_main_window_zoom_100), },
-/* Rotation submenu */
-  { "rotation-menu", NULL, N_ ("_Rotation"), NULL, },
-  { "rotate-cw", "object-rotate-right", N_ ("Rotate _Right"), "<control>bracketright", NULL, G_CALLBACK (cb_rstto_main_window_rotate_cw), },
-  { "rotate-ccw", "object-rotate-left", N_ ("Rotate _Left"), "<contron>bracketleft", NULL, G_CALLBACK (cb_rstto_main_window_rotate_ccw), },
-/* Go Menu */
-  { "go-menu",  NULL, N_ ("_Go"), NULL, },
-  { "forward",  GTK_STOCK_GO_FORWARD, N_ ("_Forward"), "space", NULL, G_CALLBACK (cb_rstto_main_window_next_image), },
-  { "back",     GTK_STOCK_GO_BACK, N_ ("_Back"), "BackSpace", NULL, G_CALLBACK (cb_rstto_main_window_previous_image), },
-  { "first",    GTK_STOCK_GOTO_FIRST, N_ ("_First"), "Home", NULL, G_CALLBACK (cb_rstto_main_window_first_image), },
-  { "last",     GTK_STOCK_GOTO_LAST, N_ ("_Last"), "End", NULL, G_CALLBACK (cb_rstto_main_window_last_image), },
-/* Help Menu */
-  { "help-menu", NULL, N_ ("_Help"), NULL, },
-  { "contents", GTK_STOCK_HELP,
-                N_ ("_Contents"),
-                "F1",
-                N_ ("Display ristretto user manual"),
-                G_CALLBACK (cb_rstto_main_window_contents), },
-  { "about",    GTK_STOCK_ABOUT, 
-                N_ ("_About"),
-                NULL,
-                N_ ("Display information about ristretto"),
-                G_CALLBACK (cb_rstto_main_window_about), },
-/* Misc */
-  { "leave-fullscreen", GTK_STOCK_LEAVE_FULLSCREEN, N_ ("Leave _Fullscreen"), NULL, NULL, G_CALLBACK (cb_rstto_main_window_fullscreen), },
-  { "tb-menu", NULL, NULL, NULL, }
-};
-
-static const GtkToggleActionEntry toggle_action_entries[] =
-{
-    { "show-toolbar", NULL, N_ ("Show _Toolbar"), NULL, NULL, G_CALLBACK (cb_rstto_main_window_toggle_show_toolbar), TRUE, },
-    { "show-thumbnailbar", NULL, N_ ("Show Thumb_nailbar"), NULL, NULL, NULL, FALSE},
-};
-
-static const GtkRadioActionEntry radio_action_sort_entries[] = 
-{
-    {"sort-filename", NULL, N_("sort by filename"), NULL, NULL, 0},
-    {"sort-date", NULL, N_("sort by date"), NULL, NULL, 1},
-};
-
-
 GType
 rstto_main_window_get_type (void)
 {
@@ -329,217 +96,10 @@ rstto_main_window_get_type (void)
 static void
 rstto_main_window_init (RsttoMainWindow *window)
 {
-    GtkAccelGroup   *accel_group;
-    GValue          show_toolbar_val = {0,}, window_width = {0, }, window_height = {0, };
-    GtkWidget       *separator, *back, *forward;
-    GtkWidget       *main_vbox = gtk_vbox_new (FALSE, 0);
-    GtkRecentFilter *recent_filter;
-
-    GClosure        *leave_fullscreen_closure = g_cclosure_new_swap ((GCallback)gtk_window_unfullscreen, window, NULL);
-    GClosure        *next_image_closure = g_cclosure_new ((GCallback)cb_rstto_main_window_next_image, window, NULL);
-    GClosure        *previous_image_closure = g_cclosure_new ((GCallback)cb_rstto_main_window_previous_image, window, NULL);
-
-    gtk_window_set_title (GTK_WINDOW (window), RISTRETTO_APP_TITLE);
-
-    window->priv = g_new0(RsttoMainWindowPriv, 1);
-
-    window->priv->iter = NULL;
-
-    window->priv->ui_manager = gtk_ui_manager_new ();
-    window->priv->recent_manager = gtk_recent_manager_get_default();
-    window->priv->settings_manager = rstto_settings_new();
-
-    accel_group = gtk_ui_manager_get_accel_group (window->priv->ui_manager);
-    gtk_window_add_accel_group (GTK_WINDOW (window), accel_group);
-
-    gtk_accel_group_connect_by_path (accel_group, "<Window>/unfullscreen", leave_fullscreen_closure);
-    gtk_accel_group_connect_by_path (accel_group, "<Window>/next-image", next_image_closure);
-    gtk_accel_group_connect_by_path (accel_group, "<Window>/previous-image", previous_image_closure);
-    /* Set default accelerators */
-    gtk_accel_map_change_entry ("<Window>/unfullscreen", GDK_Escape, 0, FALSE);
-    gtk_accel_map_change_entry ("<Window>/next-image", GDK_Page_Down, 0, FALSE);
-    gtk_accel_map_change_entry ("<Window>/previous-image", GDK_Page_Up, 0, FALSE);
-
-    /* Create mergeid's for adding ui-components */
-    window->priv->recent_merge_id = gtk_ui_manager_new_merge_id (window->priv->ui_manager);
-    window->priv->play_merge_id = gtk_ui_manager_new_merge_id (window->priv->ui_manager);
-    window->priv->pause_merge_id = gtk_ui_manager_new_merge_id (window->priv->ui_manager);
-    window->priv->toolbar_play_merge_id = gtk_ui_manager_new_merge_id (window->priv->ui_manager);
-    window->priv->toolbar_pause_merge_id = gtk_ui_manager_new_merge_id (window->priv->ui_manager);
-    window->priv->toolbar_fullscreen_merge_id = gtk_ui_manager_new_merge_id (window->priv->ui_manager);
-    window->priv->toolbar_unfullscreen_merge_id = gtk_ui_manager_new_merge_id (window->priv->ui_manager);
-
-
-    window->priv->play_action = gtk_action_new ("play", "_Play", "Play slideshow", GTK_STOCK_MEDIA_PLAY);
-    window->priv->pause_action = gtk_action_new ("pause", "_Pause", "Pause slideshow", GTK_STOCK_MEDIA_PAUSE);
-    window->priv->recent_action = gtk_recent_action_new_for_manager ("document-open-recent", "_Recently used", "Recently used", 0, GTK_RECENT_MANAGER(window->priv->recent_manager));
-
-    gtk_recent_chooser_set_sort_type (GTK_RECENT_CHOOSER (window->priv->recent_action), GTK_RECENT_SORT_MRU);
-
-    /**
-     * Add a filter to the recent-chooser
-     */
-    recent_filter = gtk_recent_filter_new();
-    gtk_recent_filter_add_application (recent_filter, "ristretto");
-    gtk_recent_chooser_add_filter(GTK_RECENT_CHOOSER(window->priv->recent_action), recent_filter);
-
-    /* Add the same accelerator path to play and pause, so the same kb-shortcut will be used for starting and stopping the slideshow */
-    gtk_action_set_accel_path (window->priv->pause_action, "<Actions>/RsttoWindow/play");
-    gtk_action_set_accel_path (window->priv->play_action, "<Actions>/RsttoWindow/play");
-
-    /* Add the play and pause actions to the actiongroup */
-    window->priv->action_group = gtk_action_group_new ("RsttoWindow");
-    gtk_action_group_add_action (window->priv->action_group,
-                                 window->priv->play_action);
-    gtk_action_group_add_action (window->priv->action_group,
-                                 window->priv->pause_action);
-    gtk_action_group_add_action (window->priv->action_group,
-                                 window->priv->recent_action);
-    /* Connect signal-handlers */
-    g_signal_connect(G_OBJECT(window->priv->play_action), "activate", G_CALLBACK(cb_rstto_main_window_play), window);
-    g_signal_connect(G_OBJECT(window->priv->pause_action), "activate", G_CALLBACK(cb_rstto_main_window_pause), window);
-    g_signal_connect(G_OBJECT(window->priv->recent_action), "item-activated", G_CALLBACK(cb_rstto_main_window_open_recent), window);
-
-    gtk_ui_manager_insert_action_group (window->priv->ui_manager, window->priv->action_group, 0);
-
-    gtk_action_group_set_translation_domain (window->priv->action_group, GETTEXT_PACKAGE);
-    gtk_action_group_add_actions (window->priv->action_group, action_entries, G_N_ELEMENTS (action_entries), GTK_WIDGET (window));
-    gtk_action_group_add_toggle_actions (window->priv->action_group, toggle_action_entries, G_N_ELEMENTS (toggle_action_entries), GTK_WIDGET (window));
-    gtk_action_group_add_radio_actions (window->priv->action_group, radio_action_sort_entries , G_N_ELEMENTS (radio_action_sort_entries), 0, NULL, GTK_WIDGET (window));
-
-    gtk_ui_manager_add_ui_from_string (window->priv->ui_manager,main_window_ui, main_window_ui_length, NULL);
-    window->priv->menubar = gtk_ui_manager_get_widget (window->priv->ui_manager, "/main-menu");
-    window->priv->toolbar = gtk_ui_manager_get_widget (window->priv->ui_manager, "/main-toolbar");
-    window->priv->image_list_toolbar = gtk_ui_manager_get_widget (window->priv->ui_manager, "/navigation-toolbar");
-    window->priv->image_list_toolbar_menu = gtk_ui_manager_get_widget (window->priv->ui_manager, "/tb-menu");
-
-    
-    
-    /**
-     * Get the separator toolitem and tell it to expand
-     */
-    separator = gtk_ui_manager_get_widget (window->priv->ui_manager, "/navigation-toolbar/separator-1");
-    gtk_tool_item_set_expand (GTK_TOOL_ITEM (separator), TRUE);
-    gtk_separator_tool_item_set_draw (GTK_SEPARATOR_TOOL_ITEM (separator), FALSE);
-
-    /**
-     * Make the back and forward toolitems important,
-     * when they are, the labels are shown when the toolbar style is 'both-horizontal'
-     */
-    back = gtk_ui_manager_get_widget (window->priv->ui_manager, "/navigation-toolbar/back");
-    gtk_tool_item_set_is_important (GTK_TOOL_ITEM (back), TRUE);
-    forward = gtk_ui_manager_get_widget (window->priv->ui_manager, "/navigation-toolbar/forward");
-    gtk_tool_item_set_is_important (GTK_TOOL_ITEM (forward), TRUE);
-    
-    window->priv->picture_viewer = rstto_picture_viewer_new ();
-    window->priv->p_viewer_s_window = gtk_scrolled_window_new (NULL, NULL);
-    gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (window->priv->p_viewer_s_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
-    gtk_container_add (GTK_CONTAINER (window->priv->p_viewer_s_window), window->priv->picture_viewer);
-    window->priv->thumbnail_bar = rstto_thumbnail_bar_new (NULL);
-    window->priv->hpaned = gtk_hpaned_new();
-    gtk_paned_pack1 (GTK_PANED (window->priv->hpaned), window->priv->p_viewer_s_window, TRUE, FALSE);
-    gtk_paned_pack2 (GTK_PANED (window->priv->hpaned), window->priv->thumbnail_bar, FALSE, FALSE);
-
-    window->priv->statusbar = gtk_statusbar_new();
-
-    window->priv->message_bar = gtk_hbox_new (FALSE,0);
-    window->priv->message_bar_label = gtk_label_new (N_("Do you want to open all the images in the folder?"));
-    window->priv->message_bar_button_cancel = gtk_button_new_from_stock (GTK_STOCK_CANCEL);
-    window->priv->message_bar_button_open = gtk_button_new_from_stock (GTK_STOCK_OPEN);
-
-    g_signal_connect(G_OBJECT(window->priv->message_bar_button_cancel), "clicked", G_CALLBACK(cb_rstto_main_window_message_bar_cancel), window);
-    g_signal_connect(G_OBJECT(window->priv->message_bar_button_open), "clicked", G_CALLBACK(cb_rstto_main_window_message_bar_open), window);
-
-    gtk_container_set_border_width (GTK_CONTAINER (window->priv->message_bar), 2);
-    gtk_box_pack_start (GTK_BOX (window->priv->message_bar), window->priv->message_bar_label, FALSE,FALSE, 5);
-    gtk_box_pack_end (GTK_BOX (window->priv->message_bar), window->priv->message_bar_button_cancel, FALSE,FALSE, 5);
-    gtk_box_pack_end (GTK_BOX (window->priv->message_bar), window->priv->message_bar_button_open, FALSE,FALSE, 5);
-
-    gtk_container_add (GTK_CONTAINER (window), main_vbox);
-    gtk_box_pack_start(GTK_BOX(main_vbox), window->priv->menubar, FALSE, FALSE, 0);
-    gtk_box_pack_start(GTK_BOX(main_vbox), window->priv->toolbar, FALSE, FALSE, 0);
-    gtk_box_pack_start(GTK_BOX(main_vbox), window->priv->message_bar, FALSE,FALSE, 0);
-    gtk_box_pack_start(GTK_BOX(main_vbox), window->priv->hpaned, TRUE, TRUE, 0);
-    gtk_box_pack_start(GTK_BOX(main_vbox), window->priv->image_list_toolbar, FALSE, FALSE, 0);
-    gtk_box_pack_start(GTK_BOX(main_vbox), window->priv->statusbar, FALSE, FALSE, 0);
-
-    rstto_main_window_set_sensitive (window, FALSE);
-    gtk_widget_set_no_show_all (window->priv->toolbar, TRUE);
-    gtk_widget_set_no_show_all (window->priv->message_bar, TRUE);
-
-    /**
-     * Add missing pieces to the UI
-     */
-    gtk_ui_manager_add_ui (window->priv->ui_manager,
-                           window->priv->play_merge_id,
-                           "/main-menu/go-menu/placeholder-slideshow",
-                           "play",
-                           "play",
-                           GTK_UI_MANAGER_MENUITEM,
-                           FALSE);
-    gtk_ui_manager_add_ui (window->priv->ui_manager,
-                           window->priv->recent_merge_id,
-                           "/main-menu/file-menu/placeholder-open-recent",
-                           "document-open-recent",
-                           "document-open-recent",
-                           GTK_UI_MANAGER_MENUITEM,
-                           FALSE);
-    gtk_ui_manager_add_ui (window->priv->ui_manager,
-                           window->priv->toolbar_play_merge_id,
-                           "/navigation-toolbar/placeholder-slideshow",
-                           "play",
-                           "play",
-                           GTK_UI_MANAGER_TOOLITEM,
-                           FALSE);
-    gtk_ui_manager_add_ui (window->priv->ui_manager,
-                           window->priv->toolbar_fullscreen_merge_id,
-                           "/navigation-toolbar/placeholder-fullscreen",
-                           "fullscreen",
-                           "fullscreen",
-                           GTK_UI_MANAGER_TOOLITEM,
-                           FALSE);
-
-    /**
-     * Retrieve the last window-size from the settings-manager
-     * and make it the default for this window
-     */
-    g_value_init (&window_width, G_TYPE_UINT);
-    g_value_init (&window_height, G_TYPE_UINT);
-    g_object_get_property (G_OBJECT(window->priv->settings_manager), "window-width", &window_width);
-    g_object_get_property (G_OBJECT(window->priv->settings_manager), "window-height", &window_height);
-    gtk_window_set_default_size(GTK_WINDOW(window), g_value_get_uint (&window_width), g_value_get_uint (&window_height));
-
-    /**
-     * Retrieve the toolbar state from the settings-manager
-     */
-    g_value_init (&show_toolbar_val, G_TYPE_BOOLEAN);
-    g_object_get_property (G_OBJECT(window->priv->settings_manager), "show-toolbar", &show_toolbar_val);
-    if (g_value_get_boolean (&show_toolbar_val))
-    {
-        gtk_check_menu_item_set_active (
-                GTK_CHECK_MENU_ITEM (
-                        gtk_ui_manager_get_widget (window->priv->ui_manager, "/main-menu/view-menu/show-toolbar")),
-                TRUE);
-        gtk_widget_show (window->priv->toolbar);
-    }
-    else
-    {
-        gtk_check_menu_item_set_active (
-                GTK_CHECK_MENU_ITEM (
-                        gtk_ui_manager_get_widget (window->priv->ui_manager, "/main-menu/view-menu/show-toolbar")),
-                FALSE);
-        gtk_widget_hide (window->priv->toolbar);
-    }
-
-    g_signal_connect(G_OBJECT(window->priv->picture_viewer), "motion-notify-event", G_CALLBACK(cb_rstto_main_window_picture_viewer_motion_notify_event), window);
-    g_signal_connect(G_OBJECT(window), "configure-event", G_CALLBACK(cb_rstto_main_window_configure_event), NULL);
-    g_signal_connect(G_OBJECT(window), "window-state-event", G_CALLBACK(cb_rstto_main_window_state_event), NULL);
-
-    g_signal_connect(G_OBJECT(window->priv->settings_manager), "notify", G_CALLBACK(cb_rstto_main_window_settings_notify), window);
 }
 
 static void
-rstto_main_window_class_init(RsttoMainWindowClass *window_class)
+rstto_main_window_class_init (RsttoMainWindowClass *window_class)
 {
     GParamSpec *pspec;
 
@@ -548,37 +108,11 @@ rstto_main_window_class_init(RsttoMainWindowClass *window_class)
 
     object_class->dispose = rstto_main_window_dispose;
 
-    object_class->set_property = rstto_main_window_set_property;
-    object_class->get_property = rstto_main_window_get_property;
-
-    pspec = g_param_spec_object ("image_list",
-                                 "",
-                                 "",
-                                 RSTTO_TYPE_IMAGE_LIST,
-                                 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE);
-
-    g_object_class_install_property (object_class,
-                                     PROP_IMAGE_LIST,
-                                     pspec);
 }
 
 static void
 rstto_main_window_dispose(GObject *object)
 {
-    RsttoMainWindow *window = RSTTO_MAIN_WINDOW(object);
-    G_OBJECT_CLASS (parent_class)->dispose(object); 
-
-    if (window->priv->ui_manager)
-    {
-        g_object_unref (window->priv->ui_manager);
-        window->priv->ui_manager = NULL;
-    } 
-
-    if (window->priv->settings_manager)
-    {
-        g_object_unref (window->priv->settings_manager);
-        window->priv->settings_manager = NULL;
-    }
 }
 
 /**
@@ -588,1369 +122,11 @@ rstto_main_window_dispose(GObject *object)
  * Return value:
  */
 GtkWidget *
-rstto_main_window_new (RsttoImageList *image_list, gboolean fullscreen)
+rstto_main_window_new (RsttoImageList *image_list)
 {
     GtkWidget *widget;
 
-    widget = g_object_new (RSTTO_TYPE_MAIN_WINDOW, "image_list", image_list, NULL);
-
-    if (fullscreen == TRUE)
-    {
-        gtk_window_fullscreen (GTK_WINDOW (widget));
-    }
+    widget = g_object_new (RSTTO_TYPE_MAIN_WINDOW, NULL);
 
     return widget;
 }
-
-static void
-cb_rstto_main_window_image_list_iter_changed (RsttoImageListIter *iter, RsttoMainWindow *window)
-{
-    rstto_main_window_image_list_iter_changed (window);
-}
-
-/**
- * rstto_main_window_image_list_iter_changed:
- * @window:
- *
- */
-static void
-rstto_main_window_image_list_iter_changed (RsttoMainWindow *window)
-{
-    gchar *path, *basename, *title;
-    GFile *file = NULL;
-    RsttoImage *cur_image;
-    gint position, count;
-    RsttoImageList *image_list = window->priv->props.image_list;
-
-    if (window->priv->props.image_list)
-    {
-        position = rstto_image_list_iter_get_position (window->priv->iter);
-        count = rstto_image_list_get_n_images (image_list);
-        cur_image = rstto_image_list_iter_get_image (window->priv->iter);
-        if (cur_image)
-        {
-            file = rstto_image_get_file (cur_image);
-
-            path = g_file_get_path (file);
-            basename = g_path_get_basename (path);
-
-            title = g_strdup_printf ("%s - %s [%d/%d]", RISTRETTO_APP_TITLE,  basename, position+1, count);
-            rstto_main_window_set_sensitive (window, TRUE);
-
-            g_free (basename);
-            g_free (path);
-        }
-        else
-        {
-            title = g_strdup (RISTRETTO_APP_TITLE);
-            rstto_main_window_set_sensitive (window, FALSE);
-        }
-
-        gtk_window_set_title (GTK_WINDOW (window), title);
-
-        g_free (title);
-    }
-
-}
-
-
-/**
- * rstto_main_window_set_sensitive:
- * @window:
- * @sensitive:
- *
- */
-static void
-rstto_main_window_set_sensitive (RsttoMainWindow *window, gboolean sensitive)
-{
-
-    gtk_widget_set_sensitive (
-            gtk_ui_manager_get_widget (
-                    window->priv->ui_manager,
-                    "/main-menu/file-menu/save-copy"),
-            sensitive);
-    gtk_widget_set_sensitive (
-            gtk_ui_manager_get_widget (
-                    window->priv->ui_manager,
-                    "/main-menu/file-menu/print"),
-            sensitive);
-    gtk_widget_set_sensitive (
-            gtk_ui_manager_get_widget (
-                    window->priv->ui_manager,
-                    "/main-menu/file-menu/close"),
-            sensitive);
-    gtk_widget_set_sensitive (
-            gtk_ui_manager_get_widget (
-                    window->priv->ui_manager,
-                    "/main-menu/file-menu/close-all"),
-            sensitive);
-
-    gtk_widget_set_sensitive (gtk_ui_manager_get_widget (window->priv->ui_manager, "/main-menu/edit-menu/delete"), sensitive);
-
-    /* Go Menu */
-    gtk_widget_set_sensitive (gtk_ui_manager_get_widget (window->priv->ui_manager, "/main-menu/go-menu/forward"), sensitive);
-    gtk_widget_set_sensitive (gtk_ui_manager_get_widget (window->priv->ui_manager, "/main-menu/go-menu/back"), sensitive);
-    gtk_widget_set_sensitive (gtk_ui_manager_get_widget (window->priv->ui_manager, "/main-menu/go-menu/first"), sensitive);
-    gtk_widget_set_sensitive (gtk_ui_manager_get_widget (window->priv->ui_manager, "/main-menu/go-menu/last"), sensitive); 
-
-    gtk_action_set_sensitive (window->priv->play_action, sensitive);
-    gtk_action_set_sensitive (window->priv->pause_action, sensitive);
-    
-
-    /* View Menu */
-    gtk_widget_set_sensitive (gtk_ui_manager_get_widget (window->priv->ui_manager, 
-                                                         "/main-menu/view-menu/set-as-wallpaper"), sensitive);
-    gtk_widget_set_sensitive (gtk_ui_manager_get_widget (window->priv->ui_manager, 
-                                                         "/main-menu/view-menu/zoom-menu"), sensitive);
-    gtk_widget_set_sensitive (gtk_ui_manager_get_widget (window->priv->ui_manager, 
-                                                         "/main-menu/view-menu/rotation-menu"), sensitive);
-    /*
-    gtk_widget_set_sensitive (gtk_ui_manager_get_widget (window->priv->ui_manager, 
-                                                         "/main-menu/view-menu/zoom-menu/zoom-in"), sensitive);
-    gtk_widget_set_sensitive (gtk_ui_manager_get_widget (window->priv->ui_manager, 
-                                                         "/main-menu/view-menu/zoom-menu/zoom-out"), sensitive);
-    gtk_widget_set_sensitive (gtk_ui_manager_get_widget (window->priv->ui_manager, 
-                                                         "/main-menu/view-menu/zoom-menu/zoom-fit"), sensitive);
-    gtk_widget_set_sensitive (gtk_ui_manager_get_widget (window->priv->ui_manager, 
-                                                         "/main-menu/view-menu/zoom-menu/zoom-100"), sensitive);
-    gtk_widget_set_sensitive (gtk_ui_manager_get_widget (window->priv->ui_manager, 
-                                                         "/main-menu/view-menu/rotation-menu/rotate-cw"), sensitive);
-    gtk_widget_set_sensitive (gtk_ui_manager_get_widget (window->priv->ui_manager, 
-                                                         "/main-menu/view-menu/rotation-menu/rotate-ccw"), sensitive);
-    */
-
-    /* Toolbar */
-    gtk_widget_set_sensitive (gtk_ui_manager_get_widget (window->priv->ui_manager, "/main-toolbar/save-copy"), sensitive);
-    gtk_widget_set_sensitive (gtk_ui_manager_get_widget (window->priv->ui_manager, "/main-toolbar/close"), sensitive);
-    gtk_widget_set_sensitive (gtk_ui_manager_get_widget (window->priv->ui_manager, "/main-toolbar/delete"), sensitive);
-    gtk_widget_set_sensitive (gtk_ui_manager_get_widget (window->priv->ui_manager, "/navigation-toolbar/forward"), sensitive);
-    gtk_widget_set_sensitive (gtk_ui_manager_get_widget (window->priv->ui_manager, "/navigation-toolbar/back"), sensitive);
-    gtk_widget_set_sensitive (gtk_ui_manager_get_widget (window->priv->ui_manager, "/navigation-toolbar/zoom-in"), sensitive);
-    gtk_widget_set_sensitive (gtk_ui_manager_get_widget (window->priv->ui_manager, "/navigation-toolbar/zoom-out"), sensitive);
-    gtk_widget_set_sensitive (gtk_ui_manager_get_widget (window->priv->ui_manager, "/navigation-toolbar/zoom-fit"), sensitive);
-    gtk_widget_set_sensitive (gtk_ui_manager_get_widget (window->priv->ui_manager, "/navigation-toolbar/zoom-100"), sensitive);
-
-}
-
-/**
- * rstto_main_window_set_property:
- * @object:
- * @property_id:
- * @value:
- * @pspec:
- *
- */
-static void
-rstto_main_window_set_property (GObject      *object,
-                                guint         property_id,
-                                const GValue *value,
-                                GParamSpec   *pspec)
-{
-    RsttoMainWindow *window = RSTTO_MAIN_WINDOW (object);
-
-    switch (property_id)
-    {
-        case PROP_IMAGE_LIST:
-            if (window->priv->props.image_list)
-            {
-                g_signal_handlers_disconnect_by_func (window->priv->props.image_list, cb_rstto_main_window_image_list_new_image, window);
-                g_object_unref (window->priv->props.image_list);
-
-                g_signal_handlers_disconnect_by_func (window->priv->iter, cb_rstto_main_window_image_list_iter_changed, window);
-                g_object_unref (window->priv->iter);
-                window->priv->iter = NULL;
-            }
-
-            window->priv->props.image_list = g_value_get_object (value);
-
-            if (window->priv->props.image_list)
-            {
-                g_object_ref (window->priv->props.image_list);
-                g_signal_connect (G_OBJECT (window->priv->props.image_list), "new-image", G_CALLBACK (cb_rstto_main_window_image_list_new_image), window);
-
-                window->priv->iter = rstto_image_list_get_iter (window->priv->props.image_list);
-                g_signal_connect (G_OBJECT (window->priv->iter), "changed", G_CALLBACK (cb_rstto_main_window_image_list_iter_changed), window);
-                rstto_thumbnail_bar_set_image_list (RSTTO_THUMBNAIL_BAR (window->priv->thumbnail_bar), window->priv->props.image_list);
-                rstto_thumbnail_bar_set_iter (RSTTO_THUMBNAIL_BAR (window->priv->thumbnail_bar), window->priv->iter);
-                rstto_picture_viewer_set_iter (RSTTO_PICTURE_VIEWER (window->priv->picture_viewer), window->priv->iter);
-            }
-            break;
-        default:
-            break;
-    }
-}
-
-/**
- * rstto_main_window_get_property:
- * @object:
- * @property_id:
- * @value:
- * @pspec:
- *
- */
-static void
-rstto_main_window_get_property (GObject    *object,
-                                guint       property_id,
-                                GValue     *value,
-                                GParamSpec *pspec)
-{
-    RsttoMainWindow *window = RSTTO_MAIN_WINDOW (object);
-
-    switch (property_id)
-    {
-        case PROP_IMAGE_LIST:
-            g_value_set_object (value, window->priv->props.image_list);
-            break;
-        default:
-            break;
-    }
-}
-
-/**
- * cb_rstto_main_window_zoom_fit:
- * @widget:
- * @window:
- *
- *
- */
-static void
-cb_rstto_main_window_zoom_fit (GtkWidget *widget, RsttoMainWindow *window)
-{
-    rstto_picture_viewer_zoom_fit (RSTTO_PICTURE_VIEWER (window->priv->picture_viewer));
-}
-
-/**
- * cb_rstto_main_window_zoom_100:
- * @widget:
- * @window:
- *
- *
- */
-static void
-cb_rstto_main_window_zoom_100 (GtkWidget *widget, RsttoMainWindow *window)
-{
-    rstto_picture_viewer_zoom_100 (RSTTO_PICTURE_VIEWER (window->priv->picture_viewer));
-}
-
-/**
- * cb_rstto_main_window_zoom_in:
- * @widget:
- * @window:
- *
- *
- */
-static void
-cb_rstto_main_window_zoom_in (GtkWidget *widget, RsttoMainWindow *window)
-{
-    rstto_picture_viewer_zoom_in (RSTTO_PICTURE_VIEWER (window->priv->picture_viewer), ZOOM_FACTOR);
-}
-
-/**
- * cb_rstto_main_window_zoom_out:
- * @widget:
- * @window:
- *
- *
- */
-static void
-cb_rstto_main_window_zoom_out (GtkWidget *widget, RsttoMainWindow *window)
-{
-    rstto_picture_viewer_zoom_out (RSTTO_PICTURE_VIEWER (window->priv->picture_viewer), ZOOM_FACTOR);
-}
-
-/**********************/
-/* ROTATION CALLBACKS */
-/**********************/
-
-/**
- * cb_rstto_main_window_rotate_cw:
- * @widget:
- * @window:
- *
- *
- */
-static void
-cb_rstto_main_window_rotate_cw (GtkWidget *widget, RsttoMainWindow *window)
-{
-    RsttoImage *image = NULL;
-
-    if (window->priv->iter)
-        image = rstto_image_list_iter_get_image (window->priv->iter);
-
-    if (image)
-    {
-        switch (rstto_image_get_orientation (image))
-        {
-            default:
-            case RSTTO_IMAGE_ORIENT_NONE:
-                rstto_image_set_orientation (image, RSTTO_IMAGE_ORIENT_90);
-                break;
-            case RSTTO_IMAGE_ORIENT_90:
-                rstto_image_set_orientation (image, RSTTO_IMAGE_ORIENT_180);
-                break;
-            case RSTTO_IMAGE_ORIENT_180:
-                rstto_image_set_orientation (image, RSTTO_IMAGE_ORIENT_270);
-                break;
-            case RSTTO_IMAGE_ORIENT_270:
-                rstto_image_set_orientation (image, RSTTO_IMAGE_ORIENT_NONE);
-                break;
-        }
-    }
-}
-
-/**
- * cb_rstto_main_window_rotate_ccw:
- * @widget:
- * @window:
- *
- *
- */
-static void
-cb_rstto_main_window_rotate_ccw (GtkWidget *widget, RsttoMainWindow *window)
-{
-    RsttoImage *image = NULL;
-
-    if (window->priv->iter)
-        image = rstto_image_list_iter_get_image (window->priv->iter);
-
-    if (image)
-    {
-        switch (rstto_image_get_orientation (image))
-        {
-            default:
-            case RSTTO_IMAGE_ORIENT_NONE:
-                rstto_image_set_orientation (image, RSTTO_IMAGE_ORIENT_270);
-                break;
-            case RSTTO_IMAGE_ORIENT_90:
-                rstto_image_set_orientation (image, RSTTO_IMAGE_ORIENT_NONE);
-                break;
-            case RSTTO_IMAGE_ORIENT_180:
-                rstto_image_set_orientation (image, RSTTO_IMAGE_ORIENT_90);
-                break;
-            case RSTTO_IMAGE_ORIENT_270:
-                rstto_image_set_orientation (image, RSTTO_IMAGE_ORIENT_180);
-                break;
-        }
-    }
-}
-
-
-/************************/
-/* NAVIGATION CALLBACKS */
-/************************/
-
-/**
- * cb_rstto_main_window_first_image:
- * @widget:
- * @window:
- *
- * Move the iter to the first image;
- *
- */
-static void
-cb_rstto_main_window_first_image (GtkWidget *widget, RsttoMainWindow *window)
-{
-    rstto_image_list_iter_set_position (window->priv->iter, 0);
-}
-
-
-/**
- * cb_rstto_main_window_last_image:
- * @widget:
- * @window:
- *
- * Move the iter to the last image;
- *
- */
-static void
-cb_rstto_main_window_last_image (GtkWidget *widget, RsttoMainWindow *window)
-{
-    guint n_images = rstto_image_list_get_n_images (window->priv->props.image_list);
-    rstto_image_list_iter_set_position (window->priv->iter, n_images-1);
-}
-
-/**
- * cb_rstto_main_window_next_image:
- * @widget:
- * @window:
- *
- * Move the iter to the next image;
- *
- */
-static void
-cb_rstto_main_window_next_image (GtkWidget *widget, RsttoMainWindow *window)
-{
-    rstto_image_list_iter_next (window->priv->iter);
-}
-
-/**
- * cb_rstto_main_window_previous_image:
- * @widget:
- * @window:
- *
- * Move the iter to the previous image;
- *
- */
-static void
-cb_rstto_main_window_previous_image (GtkWidget *widget, RsttoMainWindow *window)
-{
-    rstto_image_list_iter_previous (window->priv->iter);
-}
-
-/**
- * cb_rstto_main_window_open_image:
- * @widget:
- * @window:
- *
- *
- */
-static void
-cb_rstto_main_window_open_image (GtkWidget *widget, RsttoMainWindow *window)
-{
-    GtkWidget *dialog, *err_dialog;
-    gint response;
-    GFile *file;
-    GSList *files = NULL, *_files_iter;
-    GValue current_uri_val = {0, };
-    gchar *uri = NULL;
-    gint pos = 0;
-    GtkFileFilter *filter;
-
-    g_value_init (&current_uri_val, G_TYPE_STRING);
-    g_object_get_property (G_OBJECT(window->priv->settings_manager), "current-uri", &current_uri_val);
-
-    filter = gtk_file_filter_new();
-
-    dialog = gtk_file_chooser_dialog_new(_("Open image"),
-                                         GTK_WINDOW(window),
-                                         GTK_FILE_CHOOSER_ACTION_OPEN,
-                                         GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
-                                         GTK_STOCK_OPEN, GTK_RESPONSE_OK,
-                                         NULL);
-
-    gtk_file_chooser_set_select_multiple (GTK_FILE_CHOOSER (dialog), TRUE);
-    if (g_value_get_string (&current_uri_val))
-        gtk_file_chooser_set_current_folder_uri (GTK_FILE_CHOOSER (dialog), g_value_get_string (&current_uri_val));
-
-    gtk_file_filter_add_pixbuf_formats (filter);
-    gtk_file_filter_set_name (filter, _("Images"));
-    gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
-
-    filter = gtk_file_filter_new();
-    gtk_file_filter_add_mime_type (filter, "image/jpeg");
-    gtk_file_filter_set_name (filter, _(".jp(e)g"));
-    gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
-
-
-    response = gtk_dialog_run(GTK_DIALOG(dialog));
-    gtk_widget_hide (dialog);
-    if(response == GTK_RESPONSE_OK)
-    {
-        files = gtk_file_chooser_get_files (GTK_FILE_CHOOSER (dialog));
-        _files_iter = files;
-        pos = rstto_image_list_iter_get_position (window->priv->iter);
-        if (g_slist_length (files) > 1)
-        {
-            while (_files_iter)
-            {
-                file = _files_iter->data;
-                if (rstto_image_list_add_file (window->priv->props.image_list, file, NULL) == FALSE)
-                {
-                    err_dialog = gtk_message_dialog_new(GTK_WINDOW(window),
-                                                    GTK_DIALOG_MODAL,
-                                                    GTK_MESSAGE_ERROR,
-                                                    GTK_BUTTONS_OK,
-                                                    _("Could not open file"));
-                    gtk_dialog_run(GTK_DIALOG(dialog));
-                    gtk_widget_destroy(dialog);
-                }
-                else
-                {
-                    uri = g_file_get_uri (_files_iter->data);
-                    gtk_recent_manager_add_item (window->priv->recent_manager, uri);
-                    g_free (uri);
-                    uri = NULL;
-                }
-                _files_iter = g_slist_next (_files_iter);
-            }
-        }
-        else
-        {
-
-            if (rstto_image_list_add_file (window->priv->props.image_list, files->data, NULL) == FALSE)
-            {
-                err_dialog = gtk_message_dialog_new(GTK_WINDOW(window),
-                                                GTK_DIALOG_MODAL,
-                                                GTK_MESSAGE_ERROR,
-                                                GTK_BUTTONS_OK,
-                                                _("Could not open file"));
-                gtk_dialog_run(GTK_DIALOG(dialog));
-                gtk_widget_destroy(dialog);
-            }
-            else
-            {
-                gtk_widget_show (window->priv->message_bar);
-                gtk_widget_show (window->priv->message_bar_label);
-                gtk_widget_show (window->priv->message_bar_button_cancel);
-                gtk_widget_show (window->priv->message_bar_button_open);
-
-                if (window->priv->message_bar_file)
-                {
-                    g_object_unref (window->priv->message_bar_file);
-                    window->priv->message_bar_file = NULL;
-                }
-                window->priv->message_bar_file = g_file_get_parent (files->data);
-            }
-        }
-
-        if (pos == -1)
-            rstto_image_list_iter_set_position (window->priv->iter, 0);
-        g_value_set_string (&current_uri_val, gtk_file_chooser_get_current_folder_uri (GTK_FILE_CHOOSER (dialog)));
-        g_object_set_property (G_OBJECT(window->priv->settings_manager), "current-uri", &current_uri_val);
-
-    }
-
-    gtk_widget_destroy(dialog);
-
-    if (files)
-    {
-        g_slist_foreach (files, (GFunc)g_object_unref, NULL);
-        g_slist_free (files);
-    }
-}
-
-/**
- * cb_rstto_main_window_open_folder:
- * @widget:
- * @window:
- *
- *
- */
-static void
-cb_rstto_main_window_open_folder (GtkWidget *widget, RsttoMainWindow *window)
-{
-    gint response;
-    GFile *file = NULL, *child_file = NULL;
-    GFileEnumerator *file_enumarator = NULL;
-    GFileInfo *file_info = NULL;
-    const gchar *filename = NULL;
-    const gchar *content_type = NULL;
-    gchar *uri = NULL;
-    GValue current_uri_val = {0, };
-    gint pos = 0;
-    GtkWidget *dialog;
-
-    g_value_init (&current_uri_val, G_TYPE_STRING);
-    g_object_get_property (G_OBJECT(window->priv->settings_manager), "current-uri", &current_uri_val);
-
-    dialog = gtk_file_chooser_dialog_new(_("Open folder"),
-                                                    GTK_WINDOW(window),
-                                                    GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
-                                                    GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
-                                                    GTK_STOCK_OPEN, GTK_RESPONSE_OK,
-                                                    NULL);
-
-    if (g_value_get_string (&current_uri_val))
-        gtk_file_chooser_set_current_folder_uri (GTK_FILE_CHOOSER (dialog), g_value_get_string (&current_uri_val));
-
-    response = gtk_dialog_run(GTK_DIALOG(dialog));
-    if(response == GTK_RESPONSE_OK)
-    {
-        gtk_widget_hide(dialog);
-        file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog));
-
-        file_enumarator = g_file_enumerate_children (file, "standard::*", 0, NULL, NULL);
-        pos = rstto_image_list_iter_get_position (window->priv->iter);
-        for(file_info = g_file_enumerator_next_file (file_enumarator, NULL, NULL); file_info != NULL; file_info = g_file_enumerator_next_file (file_enumarator, NULL, NULL))
-        {
-            filename = g_file_info_get_name (file_info);
-            content_type  = g_file_info_get_content_type (file_info);
-            child_file = g_file_get_child (file, filename);
-
-            if (strncmp (content_type, "image/", 6) == 0)
-            {
-                rstto_image_list_add_file (window->priv->props.image_list, child_file, NULL);
-            }
-
-            g_object_unref (child_file);
-            g_object_unref (file_info);
-        }
-
-        if (pos == -1)
-            rstto_image_list_iter_set_position (window->priv->iter, 0);
-
-        uri = g_file_get_uri (file);
-        gtk_recent_manager_add_item (window->priv->recent_manager, uri);
-        g_free (uri);
-        uri = NULL;
-
-        g_value_set_string (&current_uri_val, gtk_file_chooser_get_current_folder_uri (GTK_FILE_CHOOSER (dialog)));
-        g_object_set_property (G_OBJECT(window->priv->settings_manager), "current-uri", &current_uri_val);
-    }
-
-    gtk_widget_destroy(dialog);
-
-    if (file)
-    {
-        g_object_unref (file);
-    }
-}
-
-/**
- * cb_rstto_main_window_open_recent:
- * @chooser:
- * @window:
- *
- */
-static void
-cb_rstto_main_window_open_recent(GtkRecentChooser *chooser, RsttoMainWindow *window)
-{
-    GtkWidget *err_dialog;
-    gchar *uri = gtk_recent_chooser_get_current_uri (chooser);
-    const gchar *filename;
-    const gchar *content_type = NULL;
-    GError *error = NULL;
-    GFile *file = g_file_new_for_uri (uri);
-    GFile *child_file;
-    GFileEnumerator *file_enumarator = NULL;
-    GFileInfo *child_file_info = NULL;
-    GFileInfo *file_info = g_file_query_info (file, "standard::type", 0, NULL, &error);
-
-    if (error == NULL)
-    {
-        if (g_file_info_get_file_type (file_info) == G_FILE_TYPE_DIRECTORY)
-        {
-            file_enumarator = g_file_enumerate_children (file, "standard::*", 0, NULL, NULL);
-            for(child_file_info = g_file_enumerator_next_file (file_enumarator, NULL, NULL); child_file_info != NULL; child_file_info = g_file_enumerator_next_file (file_enumarator, NULL, NULL))
-            {
-                filename = g_file_info_get_name (child_file_info);
-                content_type  = g_file_info_get_content_type (child_file_info);
-                child_file = g_file_get_child (file, filename);
-
-                if (strncmp (content_type, "image/", 6) == 0)
-                {
-                    rstto_image_list_add_file (window->priv->props.image_list, child_file, NULL);
-                }
-
-                g_object_unref (child_file);
-                g_object_unref (child_file_info);
-            }
-
-        }
-        else
-        {
-            if (rstto_image_list_add_file (window->priv->props.image_list, file, NULL) == FALSE)
-            {
-                err_dialog = gtk_message_dialog_new(GTK_WINDOW(window),
-                                                GTK_DIALOG_MODAL,
-                                                GTK_MESSAGE_ERROR,
-                                                GTK_BUTTONS_OK,
-                                                _("Could not open file"));
-                gtk_dialog_run( GTK_DIALOG(err_dialog));
-                gtk_widget_destroy(err_dialog);
-            }
-            else
-            {
-                gtk_widget_show (window->priv->message_bar);
-                gtk_widget_show (window->priv->message_bar_label);
-                gtk_widget_show (window->priv->message_bar_button_cancel);
-                gtk_widget_show (window->priv->message_bar_button_open);
-
-                if (window->priv->message_bar_file)
-                {
-                    g_object_unref (window->priv->message_bar_file);
-                    window->priv->message_bar_file = NULL;
-                }
-                window->priv->message_bar_file = g_file_get_parent (file);
-            }
-        }
-    }
-    else
-    {
-        err_dialog = gtk_message_dialog_new(GTK_WINDOW(window),
-                                        GTK_DIALOG_MODAL,
-                                        GTK_MESSAGE_ERROR,
-                                        GTK_BUTTONS_OK,
-                                        _("Could not open file"));
-        gtk_dialog_run (GTK_DIALOG (err_dialog));
-        gtk_widget_destroy (err_dialog);
-    }
-
-    g_object_unref (file);
-    g_free (uri);
-}
-
-static void
-cb_rstto_main_window_save_copy (GtkWidget *widget, RsttoMainWindow *window)
-{
-    GtkWidget *dialog;
-    gint response;
-    GFile *file, *s_file;
-
-    dialog = gtk_file_chooser_dialog_new(_("Save copy"),
-                                         GTK_WINDOW(window),
-                                         GTK_FILE_CHOOSER_ACTION_SAVE,
-                                         GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
-                                         GTK_STOCK_SAVE, GTK_RESPONSE_OK,
-                                         NULL);
-    gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dialog), TRUE);
-
-    response = gtk_dialog_run(GTK_DIALOG(dialog));
-    if(response == GTK_RESPONSE_OK)
-    {
-        file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog));
-        s_file = rstto_image_get_file (rstto_image_list_iter_get_image (window->priv->iter));
-        if (g_file_copy (s_file, file, G_FILE_COPY_OVERWRITE, NULL, NULL, NULL, NULL))
-        {
-            rstto_image_list_add_file (window->priv->props.image_list, file, NULL);
-        }
-    }
-
-    gtk_widget_destroy(dialog);
-
-}
-
-/**
- * cb_rstto_main_window_print:
- * @widget:
- * @window:
- *
- *
- */
-static void
-cb_rstto_main_window_print (GtkWidget *widget, RsttoMainWindow *window)
-{
-
-    GtkPrintSettings *print_settings = gtk_print_settings_new ();
-    GtkPrintOperation *print_operation = gtk_print_operation_new (); 
-    GtkPageSetup *page_setup = gtk_page_setup_new ();
-
-    gtk_print_settings_set_resolution (print_settings, 300);
-
-    gtk_page_setup_set_orientation (page_setup, GTK_PAGE_ORIENTATION_LANDSCAPE);
-
-    gtk_print_operation_set_default_page_setup (print_operation, page_setup);
-    gtk_print_operation_set_print_settings (print_operation, print_settings);
-
-    g_object_set (print_operation,
-                  "n-pages", 1,
-                  NULL);
-    
-    g_signal_connect (print_operation, "draw-page", G_CALLBACK (rstto_main_window_print_draw_page), window);
-
-    gtk_print_operation_run (print_operation, GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG, GTK_WINDOW(window), NULL);
-    
-}
-
-static void
-rstto_main_window_print_draw_page (GtkPrintOperation *operation,
-           GtkPrintContext   *print_context,
-           gint               page_nr,
-           RsttoMainWindow *window)
-{
-    RsttoImage *image = rstto_image_list_iter_get_image (window->priv->iter);
-    GdkPixbuf *pixbuf = rstto_image_get_pixbuf (image);
-    gdouble w = gdk_pixbuf_get_width (pixbuf);
-    gdouble w1 = gtk_print_context_get_width (print_context);
-    gdouble h = gdk_pixbuf_get_height (pixbuf);
-    gdouble h1 = gtk_print_context_get_height (print_context);
-
-    cairo_t *context = gtk_print_context_get_cairo_context (print_context);
-
-    cairo_translate (context, 0, 0);
-    /* Scale to page-width */
-    if ((w1/w) < (h1/h))
-    {
-        cairo_scale (context, w1/w, w1/w);
-    }
-    else
-    {
-        cairo_scale (context, h1/h, h1/h);
-    }
-    //cairo_rotate (context, 90 * 3.141592/180);
-    gdk_cairo_set_source_pixbuf (context, pixbuf, 0, 0);
-
-    //cairo_rectangle (context, 0, 0, 200, 200);
-
-    cairo_paint (context);
-}
-
-
-/**
- * cb_rstto_main_window_play:
- * @widget:
- * @window:
- *
- * Remove the play button from the menu, and add the pause button.
- *
- */
-static void
-cb_rstto_main_window_play (GtkWidget *widget, RsttoMainWindow *window)
-{
-    GValue timeout = {0, };
-
-    gtk_ui_manager_add_ui (window->priv->ui_manager,
-                           window->priv->pause_merge_id,
-                           "/main-menu/go-menu/placeholder-slideshow",
-                           "pause",
-                           "pause",
-                           GTK_UI_MANAGER_MENUITEM,
-                           FALSE);
-    gtk_ui_manager_remove_ui (window->priv->ui_manager,
-                              window->priv->play_merge_id);
-
-    gtk_ui_manager_add_ui (window->priv->ui_manager,
-                           window->priv->toolbar_pause_merge_id,
-                           "/navigation-toolbar/placeholder-slideshow",
-                           "pause",
-                           "pause",
-                           GTK_UI_MANAGER_TOOLITEM,
-                           FALSE);
-    gtk_ui_manager_remove_ui (window->priv->ui_manager,
-                              window->priv->toolbar_play_merge_id);
-
-
-    g_value_init (&timeout, G_TYPE_UINT);
-    g_object_get_property (G_OBJECT(window->priv->settings_manager), "slideshow-timeout", &timeout);
-
-    window->priv->playing = TRUE;
-    window->priv->play_timeout_id = g_timeout_add (g_value_get_uint (&timeout), (GSourceFunc)cb_rstto_main_window_play_slideshow, window);
-}
-
-/**
- * cb_rstto_main_window_pause:
- * @widget:
- * @window:
- *
- * Remove the pause button from the menu, and add the play button.
- *
- */
-static void
-cb_rstto_main_window_pause (GtkWidget *widget, RsttoMainWindow *window)
-{
-    gtk_ui_manager_add_ui (window->priv->ui_manager,
-                           window->priv->play_merge_id,
-                           "/main-menu/go-menu/placeholder-slideshow",
-                           "play",
-                           "play",
-                           GTK_UI_MANAGER_MENUITEM,
-                           FALSE);
-    gtk_ui_manager_remove_ui (window->priv->ui_manager,
-                              window->priv->pause_merge_id);
-
-    gtk_ui_manager_add_ui (window->priv->ui_manager,
-                           window->priv->toolbar_play_merge_id,
-                           "/navigation-toolbar/placeholder-slideshow",
-                           "play",
-                           "play",
-                           GTK_UI_MANAGER_TOOLITEM,
-                           FALSE);
-    gtk_ui_manager_remove_ui (window->priv->ui_manager,
-                              window->priv->toolbar_pause_merge_id);
-
-    window->priv->playing = FALSE;
-}
-
-/**
- * cb_rstto_main_window_play_slideshow:
- * @window:
- *
- */
-static gboolean
-cb_rstto_main_window_play_slideshow (RsttoMainWindow *window)
-{
-    if (window->priv->playing)
-    {
-        rstto_image_list_iter_next (window->priv->iter);
-        rstto_main_window_image_list_iter_changed (window);
-    }
-    else
-    {
-        window->priv->play_timeout_id  = 0;
-    }
-    return window->priv->playing;
-}
-
-/**
- * cb_rstto_main_window_fullscreen:
- * @widget:
- * @window:
- *
- * Toggle the fullscreen mode of this window.
- *
- */
-static void
-cb_rstto_main_window_fullscreen (GtkWidget *widget, RsttoMainWindow *window)
-{
-    if(gdk_window_get_state(GTK_WIDGET(window)->window) & GDK_WINDOW_STATE_FULLSCREEN)
-    {
-        gtk_window_unfullscreen(GTK_WINDOW(window));
-    }
-    else
-    {
-        gtk_window_fullscreen(GTK_WINDOW(window));
-    }
-}
-
-/**
- * cb_rstto_main_window_preferences:
- * @widget:
- * @window:
- *
- *
- */
-static void
-cb_rstto_main_window_preferences (GtkWidget *widget, RsttoMainWindow *window)
-{
-    GValue val1 = {0,};
-    GValue val2 = {0,};
-    GtkWidget *dialog = rstto_preferences_dialog_new (GTK_WINDOW (window));
-
-    g_value_init (&val1, G_TYPE_UINT);
-    g_value_init (&val2, G_TYPE_UINT);
-
-
-    g_object_get_property (G_OBJECT (window->priv->settings_manager), "image-quality", &val1);
-
-    gtk_dialog_run (GTK_DIALOG (dialog));
-
-    g_object_get_property (G_OBJECT (window->priv->settings_manager), "image-quality", &val2);
-
-    if (g_value_get_uint (&val1) != g_value_get_uint (&val2))
-    {
-        rstto_image_cache_clear (rstto_image_cache_new());
-    }
-
-    gtk_widget_destroy (dialog);
-}
-
-/**
- * cb_rstto_main_window_about:
- * @widget:
- * @window:
- *
- *
- */
-static void
-cb_rstto_main_window_about (GtkWidget *widget, RsttoMainWindow *window)
-{
-    const gchar *authors[] = {
-      _("Developer:"),
-        "Stephan Arts <stephan at xfce.org>",
-        NULL};
-
-    GtkWidget *about_dialog = gtk_about_dialog_new();
-
-    gtk_about_dialog_set_name((GtkAboutDialog *)about_dialog, PACKAGE_NAME);
-    gtk_about_dialog_set_version((GtkAboutDialog *)about_dialog, PACKAGE_VERSION);
-
-    gtk_about_dialog_set_comments((GtkAboutDialog *)about_dialog,
-        _("Ristretto is an imageviewer for the Xfce desktop environment."));
-    gtk_about_dialog_set_website((GtkAboutDialog *)about_dialog,
-        "http://goodies.xfce.org/projects/applications/ristretto");
-    gtk_about_dialog_set_logo_icon_name((GtkAboutDialog *)about_dialog,
-        "ristretto");
-    gtk_about_dialog_set_authors((GtkAboutDialog *)about_dialog,
-        authors);
-    gtk_about_dialog_set_translator_credits((GtkAboutDialog *)about_dialog,
-        _("translator-credits"));
-    gtk_about_dialog_set_license((GtkAboutDialog *)about_dialog,
-        xfce_get_license_text(XFCE_LICENSE_TEXT_GPL));
-    gtk_about_dialog_set_copyright((GtkAboutDialog *)about_dialog,
-        "Copyright \302\251 2006-2009 Stephan Arts");
-
-    gtk_dialog_run(GTK_DIALOG(about_dialog));
-
-    gtk_widget_destroy(about_dialog);
-}
-
-/**
- * cb_rstto_main_window_contents:
- * @widget:
- * @window:
- *
- *
- */
-static void
-cb_rstto_main_window_contents (GtkWidget *widget, RsttoMainWindow *window)
-{
-    g_debug ("%s", __FUNCTION__);
-}
-
-
-/**
- * cb_rstto_main_window_quit:
- * @widget:
- * @window:
- *
- *
- */
-static void
-cb_rstto_main_window_quit (GtkWidget *widget, RsttoMainWindow *window)
-{
-    gtk_widget_destroy (GTK_WIDGET (window));
-}
-
-/**
- * cb_rstto_main_window_close:
- * @widget:
- * @window:
- *
- *
- */
-static void
-cb_rstto_main_window_close (GtkWidget *widget, RsttoMainWindow *window)
-{
-    RsttoImage *image = rstto_image_list_iter_get_image (window->priv->iter);
-    rstto_image_list_remove_image (window->priv->props.image_list, image);
-}
-
-/**
- * cb_rstto_main_window_close_all:
- * @widget:
- * @window:
- *
- *
- */
-static void
-cb_rstto_main_window_close_all (GtkWidget *widget, RsttoMainWindow *window)
-{
-    rstto_image_list_remove_all (window->priv->props.image_list);
-    rstto_main_window_image_list_iter_changed (window);
-}
-
-/**
- * cb_rstto_main_window_delete:
- * @widget:
- * @window:
- *
- *
- */
-static void
-cb_rstto_main_window_delete (GtkWidget *widget, RsttoMainWindow *window)
-{
-    RsttoImage *image = rstto_image_list_iter_get_image (window->priv->iter);
-    GFile *file = rstto_image_get_file (image);
-    gchar *path = g_file_get_path (file);
-    gchar *basename = g_path_get_basename (path);
-    GtkWidget *dialog = gtk_message_dialog_new (GTK_WINDOW (window),
-                                                GTK_DIALOG_DESTROY_WITH_PARENT,
-                                                GTK_MESSAGE_WARNING,
-                                                GTK_BUTTONS_OK_CANCEL,
-                                                N_("Are you sure you want to delete image '%s' from disk?"),
-                                                basename);
-    g_object_ref (image);
-    if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK)
-    {
-        if (g_file_trash (file, NULL, NULL) == TRUE)
-        {
-            rstto_image_list_remove_image (window->priv->props.image_list, image);
-        }
-        else
-        {
-            
-        }
-    }
-    gtk_widget_destroy (dialog);
-    g_free (basename);
-    g_free (path);
-    g_object_unref (image);
-}
-
-/**
- * cb_rstto_main_window_toggle_show_toolbar:
- * @widget:
- * @window:
- *
- *
- */
-static void
-cb_rstto_main_window_toggle_show_toolbar (GtkWidget *widget, RsttoMainWindow *window)
-{
-    GValue val = {0,};
-    g_value_init (&val, G_TYPE_BOOLEAN);
-
-    if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (widget)))
-    {
-        gtk_widget_show (window->priv->toolbar);
-        g_value_set_boolean (&val, TRUE);
-    }
-    else
-    {
-        gtk_widget_hide (window->priv->toolbar);
-        g_value_set_boolean (&val, FALSE);
-    }
-    g_object_set_property (G_OBJECT (window->priv->settings_manager), "show-toolbar", &val);
-}
-
-/**
- * cb_rstto_main_window_image_list_new_image:
- * @image_list:
- * @image:
- * @window:
- *
- */
-static void
-cb_rstto_main_window_image_list_new_image (RsttoImageList *image_list, RsttoImage *image, RsttoMainWindow *window)
-{
-    if (rstto_image_list_iter_get_position (window->priv->iter) == -1)
-        rstto_image_list_iter_set_position (window->priv->iter, 0);
-    rstto_main_window_image_list_iter_changed (window);
-}
-
-static gboolean
-cb_rstto_main_window_configure_event (GtkWidget *widget, GdkEventConfigure *event)
-{
-    RsttoMainWindow *window = RSTTO_MAIN_WINDOW(widget);
-    /* shamelessly copied from thunar, written by benny */
-    /* check if we have a new dimension here */
-    if (widget->allocation.width != event->width || widget->allocation.height != event->height)
-    {
-        /* drop any previous timer source */
-        if (window->priv->window_save_geometry_timer_id > 0)
-        {
-            g_source_remove (window->priv->window_save_geometry_timer_id);
-        }
-        window->priv->window_save_geometry_timer_id = 0;
-
-        /* check if we should schedule another save timer */
-        if (GTK_WIDGET_VISIBLE (widget))
-        {
-            /* save the geometry one second after the last configure event */
-            window->priv->window_save_geometry_timer_id = g_timeout_add (
-                    1000, rstto_window_save_geometry_timer,
-                    widget);
-        }
-    }
-
-    /* let Gtk+ handle the configure event */
-    return FALSE;
-}
-
-static gboolean
-rstto_window_save_geometry_timer (gpointer user_data)
-{
-    GtkWindow *window = GTK_WINDOW(user_data);
-    gint width = 0;
-    gint height = 0;
-    /* check if the window is still visible */
-    if (GTK_WIDGET_VISIBLE (window))
-    {
-        /* determine the current state of the window */
-        gint state = gdk_window_get_state (GTK_WIDGET (window)->window);
-
-        /* don't save geometry for maximized or fullscreen windows */
-        if ((state & (GDK_WINDOW_STATE_MAXIMIZED | GDK_WINDOW_STATE_FULLSCREEN)) == 0)
-        {
-            /* determine the current width/height of the window... */
-            gtk_window_get_size (GTK_WINDOW (window), &width, &height);
-
-            /* ...and remember them as default for new windows */
-            g_object_set (G_OBJECT (RSTTO_MAIN_WINDOW(window)->priv->settings_manager), 
-                          "window-width", width,
-                          "window-height", height,
-                          NULL);
-        }
-    }
-    return FALSE;
-}
-
-static void
-cb_rstto_main_window_state_event(GtkWidget *widget, GdkEventWindowState *event, gpointer user_data)
-{
-    RsttoMainWindow *window = RSTTO_MAIN_WINDOW(widget);
-    GValue           show_toolbar_val = {0,};
-
-    if(event->changed_mask & GDK_WINDOW_STATE_FULLSCREEN)
-    {
-        if(event->new_window_state & GDK_WINDOW_STATE_FULLSCREEN)
-        {
-            gtk_widget_hide (window->priv->menubar);
-            gtk_widget_hide (window->priv->toolbar);
-            gtk_widget_hide (window->priv->statusbar);
-            if (window->priv->fs_toolbar_sticky)
-            {
-                if (window->priv->show_fs_toolbar_timeout_id > 0)
-                {
-                    g_source_remove (window->priv->show_fs_toolbar_timeout_id);
-                    window->priv->show_fs_toolbar_timeout_id = 0;
-                }
-                window->priv->show_fs_toolbar_timeout_id = g_timeout_add (3000, (GSourceFunc)cb_rstto_main_window_show_fs_toolbar_timeout, window);
-            }
-            else
-            {
-                gtk_widget_hide (window->priv->image_list_toolbar);
-            }
-
-            rstto_picture_viewer_zoom_fit (RSTTO_PICTURE_VIEWER (window->priv->picture_viewer));
-
-            gtk_ui_manager_add_ui (window->priv->ui_manager,
-                                   window->priv->toolbar_unfullscreen_merge_id,
-                                   "/navigation-toolbar/placeholder-fullscreen",
-                                   "unfullscreen",
-                                   "unfullscreen",
-                                   GTK_UI_MANAGER_TOOLITEM,
-                                   FALSE);
-            gtk_ui_manager_remove_ui (window->priv->ui_manager,
-                                   window->priv->toolbar_fullscreen_merge_id);
-        }
-        else
-        {
-            gtk_ui_manager_add_ui (window->priv->ui_manager,
-                                   window->priv->toolbar_fullscreen_merge_id,
-                                   "/navigation-toolbar/placeholder-fullscreen",
-                                   "fullscreen",
-                                   "fullscreen",
-                                   GTK_UI_MANAGER_TOOLITEM,
-                                   FALSE);
-            gtk_ui_manager_remove_ui (window->priv->ui_manager,
-                                   window->priv->toolbar_unfullscreen_merge_id);
-            if (window->priv->show_fs_toolbar_timeout_id > 0)
-            {
-                g_source_remove (window->priv->show_fs_toolbar_timeout_id);
-                window->priv->show_fs_toolbar_timeout_id = 0;
-            }
-            gtk_widget_show (window->priv->image_list_toolbar);
-
-            g_value_init (&show_toolbar_val, G_TYPE_BOOLEAN);
-            g_object_get_property (G_OBJECT(window->priv->settings_manager), "show-toolbar", &show_toolbar_val);
-
-            gtk_widget_show (window->priv->menubar);
-            gtk_widget_show (window->priv->statusbar);
-
-            if (g_value_get_boolean (&show_toolbar_val))
-                gtk_widget_show (window->priv->toolbar);
-            
-            g_value_reset (&show_toolbar_val);
-        }
-    }
-    if (event->changed_mask & GDK_WINDOW_STATE_MAXIMIZED)
-    {
-    }
-}
-
-static gboolean 
-cb_rstto_main_window_picture_viewer_motion_notify_event (RsttoPictureViewer *viewer,
-                                             GdkEventMotion *event,
-                                             gpointer user_data)
-{
-    RsttoMainWindow *window = RSTTO_MAIN_WINDOW (user_data);
-    if(gdk_window_get_state(GTK_WIDGET(window)->window) & GDK_WINDOW_STATE_FULLSCREEN)
-    {
-        if (event->state == 0)
-        {
-            gtk_widget_show (window->priv->image_list_toolbar);
-
-            if (window->priv->fs_toolbar_sticky == FALSE)
-            {
-                if (window->priv->show_fs_toolbar_timeout_id > 0)
-                {
-                    g_source_remove (window->priv->show_fs_toolbar_timeout_id);
-                    window->priv->show_fs_toolbar_timeout_id = 0;
-                }
-                window->priv->show_fs_toolbar_timeout_id = g_timeout_add (3000, (GSourceFunc)cb_rstto_main_window_show_fs_toolbar_timeout, window);
-            }
-        }
-    }
-    return TRUE;
-}
-
-static gboolean
-cb_rstto_main_window_show_fs_toolbar_timeout (RsttoMainWindow *window)
-{
-    gtk_widget_hide (window->priv->image_list_toolbar);
-    return FALSE;
-}
-
-static void
-cb_rstto_main_window_settings_notify (GObject *settings, GParamSpec *spec, RsttoMainWindow *window)
-{
-    GValue val = {0,};
-    g_return_if_fail (RSTTO_IS_SETTINGS (settings));
-    g_return_if_fail (RSTTO_IS_MAIN_WINDOW (window));
-
-    g_value_init (&val, spec->value_type);
-    g_object_get_property (settings, spec->name, &val);
-
-
-    g_value_unset (&val);
-}
-
-/**
- * cb_rstto_main_window_message_bar_cancel:
- * @widget:
- * @window:
- *
- */
-static void
-cb_rstto_main_window_message_bar_cancel (GtkWidget *widget, RsttoMainWindow *window)
-{
-    gtk_widget_hide (window->priv->message_bar);
-    if (window->priv->message_bar_file)
-    {
-        g_object_unref (window->priv->message_bar_file);
-        window->priv->message_bar_file = NULL;
-    }
-}
-
-/**
- * cb_rstto_main_window_message_bar_open:
- * @widget:
- * @window:
- *
- */
-static void
-cb_rstto_main_window_message_bar_open (GtkWidget *widget, RsttoMainWindow *window)
-{
-    GFile *child_file = NULL;
-    GFileEnumerator *file_enumarator = NULL;
-    GFileInfo *file_info = NULL;
-    const gchar *filename = NULL;
-    const gchar *content_type = NULL;
-
-    gtk_widget_hide (window->priv->message_bar);
-
-
-    file_enumarator = g_file_enumerate_children (window->priv->message_bar_file, "standard::*", 0, NULL, NULL);
-    for(file_info = g_file_enumerator_next_file (file_enumarator, NULL, NULL); file_info != NULL; file_info = g_file_enumerator_next_file (file_enumarator, NULL, NULL))
-    {
-        filename = g_file_info_get_name (file_info);
-        content_type  = g_file_info_get_content_type (file_info);
-        child_file = g_file_get_child (window->priv->message_bar_file, filename);
-
-        if (strncmp (content_type, "image/", 6) == 0)
-        {
-            rstto_image_list_add_file (window->priv->props.image_list, child_file, NULL);
-        }
-
-        g_object_unref (child_file);
-        g_object_unref (file_info);
-    }
-
-    
-    if (window->priv->message_bar_file)
-    {
-        g_object_unref (window->priv->message_bar_file);
-        window->priv->message_bar_file = NULL;
-    }
-}
-
-/*
-static gboolean
-cb_rstto_main_window_image_list_toolbar_popup_context_menu (GtkToolbar *toolbar,
-                                                        gint        x,
-                                                        gint        y,
-                                                        gint        button,
-                                                        gpointer    user_data)
-{
-    RsttoMainWindow *window = RSTTO_MAIN_WINDOW (user_data);
-
-    gtk_menu_popup (window->priv->image_list_toolbar_menu,
-                    NULL,
-                    NULL,
-                    NULL,
-                    NULL,
-                    3,
-                    gtk_get_current_event_time ());
-}
-*/
diff --git a/src/main_window.h b/src/main_window.h
index e70768f..4eab475 100644
--- a/src/main_window.h
+++ b/src/main_window.h
@@ -67,7 +67,7 @@ typedef enum {
 
 GType      rstto_main_window_get_type();
 
-GtkWidget *rstto_main_window_new (RsttoImageList *, gboolean);
+GtkWidget *rstto_main_window_new (RsttoImageList *);
 
 G_END_DECLS
 
diff --git a/src/main_window_ui.xml b/src/main_window_ui.xml
deleted file mode 100644
index 6b5760b..0000000
--- a/src/main_window_ui.xml
+++ /dev/null
@@ -1,101 +0,0 @@
-<ui>
-    <!--
-
-
-    -->
-    <menubar name="main-menu">
-        <menu action="file-menu">
-            <menuitem action="open"/>
-            <menuitem action="open-folder"/>
-            <placeholder name="placeholder-open-recent"/>
-            <separator/>
-            <menuitem action="save-copy"/>
-            <separator/>
-            <menuitem action="print"/>
-            <separator/>
-            <menuitem action="close"/>
-            <menuitem action="close-all"/>
-            <menuitem action="quit"/>
-        </menu>
-        <menu action="edit-menu">
-            <menu action="open-with-menu">
-                <placeholder name="open-with-apps" />
-            </menu>
-            <separator/>
-            <menu action="sorting-menu">
-                <menuitem action="sort-filename"/>
-                <menuitem action="sort-date"/>
-            </menu>
-            <menuitem action="delete"/>
-            <separator/>
-            <menuitem action="preferences"/>
-        </menu>
-        <menu action="view-menu">
-            <menuitem action="show-toolbar"/>
-            <menuitem action="show-thumbnailbar"/>
-            <separator/>
-            <menu action="zoom-menu">
-                <menuitem action="zoom-in"/>
-                <menuitem action="zoom-out"/>
-                <menuitem action="zoom-fit"/>
-                <menuitem action="zoom-100"/>
-            </menu>
-            <menu action="rotation-menu">
-                <menuitem action="rotate-cw"/>
-                <menuitem action="rotate-ccw"/>
-            </menu>
-            <separator/>
-            <menuitem action="fullscreen"/>
-            <menuitem action="set-as-wallpaper"/>
-        </menu>
-        <menu action="go-menu">
-            <menuitem action="back"/>
-            <menuitem action="forward"/>
-            <menuitem action="first"/>
-            <menuitem action="last"/>
-            <separator/>
-            <placeholder name="placeholder-slideshow" />
-        </menu>
-        <menu action="help-menu">
-            <menuitem action="contents"/>
-            <menuitem action="about"/>
-        </menu>
-    </menubar>
-
-    <popup name="tb-menu">
-        <menuitem action="open"/>
-    </popup>
-
-    <!--
-
-    -->
-    <toolbar name="main-toolbar">
-        <toolitem action="open"/>
-        <toolitem action="open-folder"/>
-        <separator />
-        <toolitem action="save-copy"/>
-        <toolitem action="close"/>
-        <toolitem action="delete"/>
-        <separator />
-    </toolbar>
-
-    <!--
-
-    -->
-    <toolbar name="navigation-toolbar">
-        <toolitem action="back"/>
-        <placeholder name="placeholder-slideshow" />
-        <toolitem action="forward"/>
-        <separator name="separator-1"/>
-        <toolitem action="rotate-ccw"/>
-        <toolitem action="rotate-cw"/>
-        <separator />
-        <toolitem action="zoom-in"/>
-        <toolitem action="zoom-out"/>
-        <toolitem action="zoom-100"/>
-        <toolitem action="zoom-fit"/>
-        <separator />
-        <placeholder name="placeholder-fullscreen" />
-    </toolbar>
-
-</ui>
diff --git a/src/navigator.c b/src/navigator.c
deleted file mode 100644
index 42f07f7..0000000
--- a/src/navigator.c
+++ /dev/null
@@ -1,1759 +0,0 @@
-/*
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU Library General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#include <config.h>
-#include <gtk/gtk.h>
-#include <gtk/gtkmarshal.h>
-#include <string.h>
-
-#include <thunar-vfs/thunar-vfs.h>
-#include <libexif/exif-data.h>
-
-#include "navigator.h"
-
-static void 
-rstto_navigator_init(RsttoNavigator *);
-static void
-rstto_navigator_class_init(RsttoNavigatorClass *);
-static void
-rstto_navigator_dispose(GObject *object);
-
-static void
-rstto_navigator_entry_clear (RsttoNavigatorEntry *nav_entry);
-
-static gboolean
-cb_rstto_navigator_running(RsttoNavigator *navigator);
-
-static GObjectClass *parent_class = NULL;
-
-static gint
-rstto_navigator_entry_name_compare_func(RsttoNavigatorEntry *a, RsttoNavigatorEntry *b);
-
-static void
-cb_rstto_navigator_entry_area_prepared (GdkPixbufLoader *loader, RsttoNavigatorEntry *entry);
-static void
-cb_rstto_navigator_entry_closed (GdkPixbufLoader *loader, RsttoNavigatorEntry *entry);
-static gboolean
-cb_rstto_navigator_entry_read_file(GIOChannel *io_channel, GIOCondition cond, RsttoNavigatorEntry *entry);
-
-static gboolean
-cb_rstto_navigator_entry_update_image (RsttoNavigatorEntry *entry);
-
-static void
-cb_rstto_navigator_entry_fs_event (ThunarVfsMonitor *,
-                                   ThunarVfsMonitorHandle *,
-                                   ThunarVfsMonitorEvent,
-                                   ThunarVfsPath *,
-                                   ThunarVfsPath *,
-                                   RsttoNavigatorEntry *);
-static void
-cb_rstto_navigator_fs_event (ThunarVfsMonitor *monitor,
-                             ThunarVfsMonitorHandle *handl,
-                             ThunarVfsMonitorEvent event,
-                             ThunarVfsPath *handle_path,
-                             ThunarVfsPath *event_path,
-                             RsttoNavigator *nav);
-
-static void
-rstto_navigator_set_busy (RsttoNavigator *navigator, gboolean busy);
-
-static gint
-cb_rstto_navigator_entry_path_compare_func(RsttoNavigatorEntry *entry, ThunarVfsPath *path);
-
-enum
-{
-    RSTTO_NAVIGATOR_SIGNAL_ENTRY_MODIFIED = 0,
-    RSTTO_NAVIGATOR_SIGNAL_ENTRY_REMOVED,
-    RSTTO_NAVIGATOR_SIGNAL_NEW_ENTRY,
-    RSTTO_NAVIGATOR_SIGNAL_ITER_CHANGED,
-    RSTTO_NAVIGATOR_SIGNAL_REORDERED,
-    RSTTO_NAVIGATOR_SIGNAL_COUNT    
-};
-
-struct _RsttoNavigatorEntry
-{
-    ThunarVfsInfo       *info;
-    GdkPixbufLoader     *loader;
-    ExifData            *exif_data;
-    ThunarVfsMonitorHandle *monitor_handle;
-
-    GdkPixbuf           *thumb;
-
-    GdkPixbufAnimation  *animation;
-    GdkPixbufAnimationIter *iter;
-    GdkPixbuf           *src_pixbuf;
-
-    GIOChannel          *io_channel;
-    gint                 io_source_id;
-    gint                 timeout_id;
-
-    RsttoNavigator      *navigator;
-
-    gdouble              scale;
-    gboolean             fit_to_screen;
-    GdkPixbufRotation    rotation;
-    gboolean             h_flipped;
-    gboolean             v_flipped;
-    gint                 x_offset;
-    gint                 y_offset;
-
-    gboolean             orientation_changed;
-};
-
-
-static gint rstto_navigator_signals[RSTTO_NAVIGATOR_SIGNAL_COUNT];
-
-GType
-rstto_navigator_get_type ()
-{
-    static GType rstto_navigator_type = 0;
-
-    if (!rstto_navigator_type)
-    {
-        static const GTypeInfo rstto_navigator_info = 
-        {
-            sizeof (RsttoNavigatorClass),
-            (GBaseInitFunc) NULL,
-            (GBaseFinalizeFunc) NULL,
-            (GClassInitFunc) rstto_navigator_class_init,
-            (GClassFinalizeFunc) NULL,
-            NULL,
-            sizeof (RsttoNavigator),
-            0,
-            (GInstanceInitFunc) rstto_navigator_init,
-            NULL
-        };
-
-        rstto_navigator_type = g_type_register_static (G_TYPE_OBJECT, "RsttoNavigator", &rstto_navigator_info, 0);
-    }
-    return rstto_navigator_type;
-}
-
-static void
-rstto_navigator_init(RsttoNavigator *navigator)
-{
-    navigator->file_iter = NULL;
-    navigator->compare_func = (GCompareFunc)rstto_navigator_entry_name_compare_func;
-    navigator->old_position = -1;
-    navigator->timeout = 5000;
-    navigator->monitor = thunar_vfs_monitor_get_default();
-    navigator->preload = FALSE;
-
-    /* Max history size (in bytes) */
-    navigator->max_history = 128000000;
-
-    navigator->factory = thunar_vfs_thumb_factory_new(THUNAR_VFS_THUMB_SIZE_NORMAL);
-}
-
-static void
-rstto_navigator_class_init(RsttoNavigatorClass *nav_class)
-{
-    GObjectClass *object_class = G_OBJECT_CLASS(nav_class);
-
-    parent_class = g_type_class_peek_parent(nav_class);
-
-    object_class->dispose = rstto_navigator_dispose;
-
-    rstto_navigator_signals[RSTTO_NAVIGATOR_SIGNAL_REORDERED] = g_signal_new("reordered",
-            G_TYPE_FROM_CLASS(nav_class),
-            G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
-            0,
-            NULL,
-            NULL,
-            g_cclosure_marshal_VOID__VOID,
-            G_TYPE_NONE,
-            0,
-            NULL);
-    rstto_navigator_signals[RSTTO_NAVIGATOR_SIGNAL_ENTRY_MODIFIED] = g_signal_new("entry-modified",
-            G_TYPE_FROM_CLASS(nav_class),
-            G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
-            0,
-            NULL,
-            NULL,
-            g_cclosure_marshal_VOID__POINTER,
-            G_TYPE_NONE,
-            1,
-            G_TYPE_POINTER,
-            NULL);
-    rstto_navigator_signals[RSTTO_NAVIGATOR_SIGNAL_ENTRY_REMOVED] = g_signal_new("entry-removed",
-            G_TYPE_FROM_CLASS(nav_class),
-            G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
-            0,
-            NULL,
-            NULL,
-            g_cclosure_marshal_VOID__POINTER,
-            G_TYPE_NONE,
-            1,
-            G_TYPE_POINTER,
-            NULL);
-    rstto_navigator_signals[RSTTO_NAVIGATOR_SIGNAL_ITER_CHANGED] = g_signal_new("iter-changed",
-            G_TYPE_FROM_CLASS(nav_class),
-            G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
-            0,
-            NULL,
-            NULL,
-            g_cclosure_marshal_VOID__UINT_POINTER,
-            G_TYPE_NONE,
-            2,
-            G_TYPE_UINT,
-            G_TYPE_POINTER,
-            NULL);
-    rstto_navigator_signals[RSTTO_NAVIGATOR_SIGNAL_NEW_ENTRY] = g_signal_new("new-entry",
-            G_TYPE_FROM_CLASS(nav_class),
-            G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
-            0,
-            NULL,
-            NULL,
-            g_cclosure_marshal_VOID__UINT_POINTER,
-            G_TYPE_NONE,
-            2,
-            G_TYPE_UINT,
-            G_TYPE_POINTER,
-            NULL);
-}
-
-static void
-rstto_navigator_dispose(GObject *object)
-{
-    RsttoNavigator *navigator = RSTTO_NAVIGATOR(object);
-
-    if(navigator->file_list)
-    {
-        g_list_foreach(navigator->file_list, (GFunc)rstto_navigator_entry_free, NULL);
-        navigator->file_list = NULL;
-        navigator->file_iter = NULL;
-    }
-}
-
-RsttoNavigator *
-rstto_navigator_new(GtkRecentManager *manager)
-{
-    RsttoNavigator *navigator;
-
-    navigator = g_object_new(RSTTO_TYPE_NAVIGATOR, NULL);
-    navigator->manager = manager;
-
-    return navigator;
-}
-
-/*
- * static gint
- * rstto_navigator_entry_name_compare_func:
- *
- * @a: RsttoNavigatorEntry 
- * @b: RsttoNavigatorEntry
- *
- * Return value: see g_strcasecmp
- */
-static gint
-rstto_navigator_entry_name_compare_func(RsttoNavigatorEntry *a, RsttoNavigatorEntry *b)
-{
-    return g_strcasecmp(a->info->display_name, b->info->display_name);
-}
-
-
-static void
-rstto_navigator_add_entry_to_history(RsttoNavigator *navigator, RsttoNavigatorEntry *entry)
-{
-
-    /* rstto_debug_print_src_pixbufs(navigator); */
-
-    /* Check if the image is already available in the image-cache */
-    if (g_list_index(navigator->history, entry) != -1)
-    {
-        /* Remove the image from the history, we are going to re-add it at the front of the list later */
-        navigator->history = g_list_remove(navigator->history, entry);
-    }
-    navigator->history = g_list_prepend(navigator->history, entry);
-
-    /* manage history by kicking excess elements out */
-    GList *iter = NULL;
-    guint64 size = 0;
-
-    for (iter = navigator->history; iter != NULL; iter = g_list_next(iter))
-    {
-        RsttoNavigatorEntry *nav_entry = iter->data;
-
-        if (nav_entry)
-        {
-            size += rstto_navigator_entry_get_size(nav_entry);
-            size += sizeof (*nav_entry);
-            size += sizeof (*nav_entry->info);
-
-            if (nav_entry->exif_data);
-                size += sizeof (*nav_entry->exif_data);
-            if (nav_entry->loader)
-                size += sizeof (nav_entry->loader);
-
-            if (size > navigator->max_history)
-            {
-                if (iter != navigator->file_iter)
-                {
-                    rstto_navigator_entry_clear (nav_entry);
-                    iter = g_list_previous(iter);
-                }
-                else
-                {
-                    iter = g_list_previous(iter);
-                    nav_entry = iter->data;
-                    if (nav_entry)
-                    {
-                        rstto_navigator_entry_clear (nav_entry);
-                    }
-                    iter = g_list_next(iter);
-                }
-                navigator->history = g_list_remove(navigator->history, nav_entry);
-            }
-        }
-    }
-}
-
-
-void
-rstto_navigator_guard_history(RsttoNavigator *navigator, RsttoNavigatorEntry *entry)
-{
-    /* check if the image is still loading, if so... don't cache the image */
-    if(entry->io_channel)
-    {
-        g_source_remove(entry->io_source_id);
-        g_io_channel_unref(entry->io_channel);
-        entry->io_channel = NULL;
-        entry->io_source_id = 0;
-        if(entry->loader)
-        {
-            g_signal_handlers_disconnect_by_func(entry->loader , cb_rstto_navigator_entry_area_prepared, entry);
-            gdk_pixbuf_loader_close(entry->loader, NULL);
-        }
-
-        if (entry->timeout_id)
-        {
-            g_source_remove(entry->timeout_id);
-            entry->timeout_id = 0;
-        }
-
-        if(entry->animation)
-        {
-            g_object_unref(entry->animation);
-            entry->animation = NULL;
-        }
-
-        if(entry->src_pixbuf)
-        {
-            g_object_unref(entry->src_pixbuf);
-            entry->src_pixbuf = NULL;
-        }
-
-        if(entry->iter)
-        {
-            g_object_unref(entry->iter);
-            entry->iter = NULL;
-        }
-    }
-
-    rstto_navigator_add_entry_to_history(navigator, entry);
-}
-
-/* for debugging:
- * iterate through navigator->file_list and print out all
- * pixbuf entries to see whether they've been loaded or not
- */
-void
-rstto_debug_print_src_pixbufs (RsttoNavigator *navigator)
-{
-    GList *e = navigator->file_list;
-    int i = 1;
-    printf("src_pixbufs loaded for these image indices: ");
-    while (e != NULL)
-    {
-        RsttoNavigatorEntry *re = e->data;
-        if (re->src_pixbuf != NULL)
-        {
-            printf("%d ", i);
-        }
-        e = g_list_next(e);
-        i++;
-    }
-    printf("\n");
-}
-
-
-/* preloading for improved responsiveness
- * (at the expense of increased memory usage) 
- */
-static gboolean
-rstto_navigator_preload_next_img (RsttoNavigator *navigator)
-{
-    GList *next = g_list_next(navigator->file_iter);
-    /* wraparound case */
-    if (next == NULL)
-    {
-        next = navigator->file_list;
-    }
-    if (next != NULL)
-    {
-        RsttoNavigatorEntry *next_entry = next->data;
-        rstto_navigator_entry_load_image(next_entry, FALSE);
-
-        /* add image to the cache-history */
-        rstto_navigator_add_entry_to_history(navigator, next_entry);
-    }
-
-    /* for use with g_timeout_add() */
-    return FALSE;
-}
-
-static gboolean
-rstto_navigator_preload_prev_img (RsttoNavigator *navigator)
-{
-    GList *prev = g_list_previous(navigator->file_iter);
-    /* wraparound case */
-    if (prev == NULL)
-    {
-        prev = g_list_last(navigator->file_list);
-    }
-    if (prev != NULL)
-    {
-        RsttoNavigatorEntry *prev_entry = prev->data;
-        rstto_navigator_entry_load_image(prev_entry, FALSE);
-
-        /* add image to the cache-history */
-        rstto_navigator_add_entry_to_history(navigator, prev_entry);
-    }
-    
-    /* for use with g_timeout_add() */
-    return FALSE;
-}
-
-
-void
-rstto_navigator_jump_first (RsttoNavigator *navigator)
-{
-    if(navigator->file_iter)
-    {
-        rstto_navigator_guard_history(navigator, navigator->file_iter->data);
-        navigator->old_position = rstto_navigator_get_position(navigator);
-    }
-    navigator->file_iter = g_list_first(navigator->file_list);
-    if(navigator->file_iter)
-    {
-        g_signal_emit(G_OBJECT(navigator), rstto_navigator_signals[RSTTO_NAVIGATOR_SIGNAL_ITER_CHANGED], 0, 0, navigator->file_iter->data, NULL);
-
-        if (navigator->preload)
-        {
-            /* preload in both directions */
-            g_timeout_add(500, (GSourceFunc)rstto_navigator_preload_next_img, navigator);
-            g_timeout_add(500, (GSourceFunc)rstto_navigator_preload_prev_img, navigator);
-        }
-    }
-}
-
-void
-rstto_navigator_jump_forward (RsttoNavigator *navigator)
-{
-    if(navigator->file_iter)
-    {
-        rstto_navigator_guard_history(navigator, navigator->file_iter->data);
-        navigator->old_position = rstto_navigator_get_position(navigator);
-        navigator->file_iter = g_list_next(navigator->file_iter);
-    }
-    if(!navigator->file_iter)
-        navigator->file_iter = g_list_first(navigator->file_list);
-
-    if(navigator->file_iter)
-    {
-        g_signal_emit(G_OBJECT(navigator),
-                      rstto_navigator_signals[RSTTO_NAVIGATOR_SIGNAL_ITER_CHANGED],
-                      0,
-                      g_list_position(navigator->file_list, navigator->file_iter),
-                      navigator->file_iter->data,
-                      NULL);
-
-        if (navigator->preload)
-        {
-            /* preload forwards */
-            g_timeout_add(500, (GSourceFunc)rstto_navigator_preload_next_img, navigator);
-        }
-    }
-    else
-    {
-        g_signal_emit(G_OBJECT(navigator),
-                      rstto_navigator_signals[RSTTO_NAVIGATOR_SIGNAL_ITER_CHANGED],
-                      0,
-                      -1,
-                      NULL,
-                      NULL);
-
-    }
-}
-
-void
-rstto_navigator_jump_back (RsttoNavigator *navigator)
-{
-    if(navigator->file_iter)
-    {
-        rstto_navigator_guard_history(navigator, navigator->file_iter->data);
-        navigator->old_position = rstto_navigator_get_position(navigator);
-        navigator->file_iter = g_list_previous(navigator->file_iter);
-    }
-    if(!navigator->file_iter)
-        navigator->file_iter = g_list_last(navigator->file_list);
-
-    if(navigator->file_iter)
-    {
-        g_signal_emit(G_OBJECT(navigator),
-                      rstto_navigator_signals[RSTTO_NAVIGATOR_SIGNAL_ITER_CHANGED],
-                      0,
-                      g_list_position(navigator->file_list, navigator->file_iter),
-                      navigator->file_iter->data,
-                      NULL);
-
-        if (navigator->preload)
-        {
-            /* preload backwards */
-            g_timeout_add(500, (GSourceFunc)rstto_navigator_preload_prev_img, navigator);
-        }
-    }
-}
-
-void
-rstto_navigator_jump_last (RsttoNavigator *navigator)
-{
-    if(navigator->file_iter)
-    {
-        rstto_navigator_guard_history(navigator, navigator->file_iter->data);
-        navigator->old_position = rstto_navigator_get_position(navigator);
-    }
-    navigator->file_iter = g_list_last(navigator->file_list);
-
-    if(navigator->file_iter)
-    {
-        g_signal_emit(G_OBJECT(navigator),
-                      rstto_navigator_signals[RSTTO_NAVIGATOR_SIGNAL_ITER_CHANGED],
-                      0,
-                      g_list_position(navigator->file_list, navigator->file_iter),
-                      navigator->file_iter->data,
-                      NULL);
-
-        if (navigator->preload)
-        {
-            /* preload in both directions */
-            g_timeout_add(500, (GSourceFunc)rstto_navigator_preload_next_img, navigator);
-            g_timeout_add(500, (GSourceFunc)rstto_navigator_preload_prev_img, navigator);
-        }
-    }
-}
-
-void
-rstto_navigator_set_running (RsttoNavigator *navigator, gboolean running)
-{
-    if(!navigator->running)
-    {
-        navigator->running = running;
-        if(!navigator->id)
-        {
-            navigator->id = g_timeout_add(navigator->timeout, (GSourceFunc)cb_rstto_navigator_running, navigator);
-            if (navigator->preload)
-            {
-                /* preload forwards */
-                rstto_navigator_preload_next_img(navigator);
-            }
-        }
-    }
-    else
-    {
-        navigator->running = running;
-    }
-}
-
-gboolean
-rstto_navigator_is_running (RsttoNavigator *navigator)
-{
-    return navigator->running;
-}
-
-RsttoNavigatorEntry *
-rstto_navigator_get_file (RsttoNavigator *navigator)
-{
-    if(navigator->file_iter)
-    {
-        return (RsttoNavigatorEntry *)(navigator->file_iter->data);
-    }
-    else
-    {
-        return NULL;
-    }
-}
-
-gint
-rstto_navigator_get_position(RsttoNavigator *navigator)
-{
-    return g_list_position(navigator->file_list, navigator->file_iter);
-}
-
-gint
-rstto_navigator_get_n_files (RsttoNavigator *navigator)
-{
-    return g_list_length(navigator->file_list);
-}
-
-RsttoNavigatorEntry *
-rstto_navigator_get_nth_file (RsttoNavigator *navigator, gint n)
-{
-    return g_list_nth_data(navigator->file_list, n);
-}
-
-gint
-rstto_navigator_add (RsttoNavigator *navigator, RsttoNavigatorEntry *entry, gboolean with_monitor)
-{
-    g_return_val_if_fail(navigator == entry->navigator, -1);
-
-    if (g_list_index(navigator->file_list, entry) ==  -1)
-    {
-        navigator->file_list = g_list_insert_sorted(navigator->file_list, entry, navigator->compare_func);
-        if (!navigator->file_iter)
-        {
-            navigator->file_iter = navigator->file_list;
-            if (navigator->busy == FALSE)
-            {
-                g_signal_emit(G_OBJECT(navigator),
-                          rstto_navigator_signals[RSTTO_NAVIGATOR_SIGNAL_ITER_CHANGED],
-                          0,
-                          g_list_index(navigator->file_list, entry),
-                          entry,
-                          NULL);
-            }
-        }
-
-        if (with_monitor == TRUE)
-            entry->monitor_handle = thunar_vfs_monitor_add_file(navigator->monitor, entry->info->path, (ThunarVfsMonitorCallback)cb_rstto_navigator_entry_fs_event, entry);
-
-        if (navigator->busy == FALSE)
-        {
-            g_signal_emit(G_OBJECT(navigator), rstto_navigator_signals[RSTTO_NAVIGATOR_SIGNAL_NEW_ENTRY], 0, g_list_index(navigator->file_list, entry), entry, NULL);
-        }
-    }
-    return g_list_index(navigator->file_list, entry);
-}
-
-void
-rstto_navigator_remove (RsttoNavigator *navigator, RsttoNavigatorEntry *entry)
-{
-    if(navigator->file_iter)
-    {
-        if(navigator->file_iter->data == entry)
-        {
-            navigator->old_position = rstto_navigator_get_position(navigator);
-            navigator->file_iter = g_list_next(navigator->file_iter);
-
-            navigator->file_list = g_list_remove(navigator->file_list, entry);
-
-            if(!navigator->file_iter)
-                navigator->file_iter = g_list_first(navigator->file_list);
-
-            /* An item should not be able to exist several times inside the
-             * history, g_list_remove should suffice here
-             */
-            if (navigator->history)
-            {
-                navigator->history = g_list_remove (navigator->history, entry);
-            }
-
-            if (navigator->busy == FALSE)
-            {
-                g_signal_emit(G_OBJECT(navigator), rstto_navigator_signals[RSTTO_NAVIGATOR_SIGNAL_ENTRY_REMOVED], 0, entry, NULL);
-            }
-            if(g_list_length(navigator->file_list) == 0)
-            {
-                navigator->file_iter = NULL;
-                navigator->file_list = NULL;
-            }
-            if(navigator->file_iter)
-            {
-                if (navigator->busy == FALSE)
-                {
-                    g_signal_emit(G_OBJECT(navigator),
-                              rstto_navigator_signals[RSTTO_NAVIGATOR_SIGNAL_ITER_CHANGED],
-                              0,
-                              g_list_position(navigator->file_list, navigator->file_iter),
-                              navigator->file_iter->data,
-                              NULL);
-                }
-            }
-            else
-            {
-                g_signal_emit(G_OBJECT(navigator),
-                              rstto_navigator_signals[RSTTO_NAVIGATOR_SIGNAL_ITER_CHANGED],
-                              0,
-                              -1,
-                              NULL,
-                              NULL);
-
-            }
-            return;
-        }
-        if (g_list_find(navigator->history, entry))
-        {
-            navigator->history = g_list_remove(navigator->history, entry);
-        }
-    }
-    navigator->file_list = g_list_remove(navigator->file_list, entry);
-    if (entry->monitor_handle)
-    {
-        thunar_vfs_monitor_remove(navigator->monitor, entry->monitor_handle);
-    }
-    if(g_list_length(navigator->file_list) == 0)
-    {
-        navigator->file_iter = NULL;
-        navigator->file_list = NULL;
-    }
-}
-
-void
-rstto_navigator_clear (RsttoNavigator *navigator)
-{
-    if(navigator->file_list)
-    {
-        g_list_free(navigator->history);
-        g_list_foreach(navigator->file_list, (GFunc)rstto_navigator_entry_free, NULL);
-        navigator->file_list = NULL;
-        navigator->file_iter = NULL;
-        navigator->old_position = -1;
-        navigator->history = NULL;
-    }
-    g_signal_emit(G_OBJECT(navigator), rstto_navigator_signals[RSTTO_NAVIGATOR_SIGNAL_ITER_CHANGED], 0, -1, NULL, NULL);
-    g_signal_emit(G_OBJECT(navigator), rstto_navigator_signals[RSTTO_NAVIGATOR_SIGNAL_REORDERED], 0, NULL);
-}
-
-void
-rstto_navigator_set_file_nr (RsttoNavigator *navigator, gint n)
-{
-    if(navigator->file_iter)
-    {
-        rstto_navigator_guard_history(navigator, navigator->file_iter->data);
-        navigator->old_position = rstto_navigator_get_position(navigator);
-    }
-    navigator->file_iter = g_list_nth(navigator->file_list, n);
-    if(navigator->file_iter)
-    {
-        g_signal_emit(G_OBJECT(navigator),
-                      rstto_navigator_signals[RSTTO_NAVIGATOR_SIGNAL_ITER_CHANGED],
-                      0,
-                      g_list_position(navigator->file_list, navigator->file_iter),
-                      navigator->file_iter->data,
-                      NULL);
-    }
-}
-
-/* Callbacks */
-
-static gboolean
-cb_rstto_navigator_running(RsttoNavigator *navigator)
-{
-    if(navigator->running)
-    {
-        rstto_navigator_jump_forward(navigator);
-
-        if (navigator->preload)
-        {
-            /* preload forwards */
-            rstto_navigator_preload_next_img(navigator);
-        }
-    }
-    else
-    {
-        navigator->id = 0;
-    }
-    return navigator->running;
-}
-
-void
-rstto_navigator_set_timeout (RsttoNavigator *navigator, gint timeout)
-{
-    navigator->timeout = timeout;
-}
-
-void
-rstto_navigator_flip_entry(RsttoNavigator *navigator, RsttoNavigatorEntry *entry, gboolean horizontal)
-{
-    if (horizontal)
-    {
-        entry->h_flipped = !entry->h_flipped;
-    }
-    else
-    {
-        entry->v_flipped = !entry->v_flipped;
-    }
-}
-
-
-RsttoNavigatorEntry *
-rstto_navigator_entry_new (RsttoNavigator *navigator, ThunarVfsInfo *info)
-{
-    RsttoNavigatorEntry *entry = NULL;
-    ExifEntry *exifentry = NULL;
-    gchar *filename = thunar_vfs_path_dup_string(info->path);
-    if(filename)
-    {
-        GList *iter = g_list_find_custom(navigator->file_list, info->path, (GCompareFunc)cb_rstto_navigator_entry_path_compare_func);
-        if (iter)
-            entry = iter->data;
-
-        if (entry == NULL)
-        {
-            entry = g_new0(RsttoNavigatorEntry, 1);
-
-            entry->info = info;
-            entry->exif_data = exif_data_new_from_file(filename);
-            entry->navigator = navigator;
-            entry->animation = NULL;
-            
-            if (entry->exif_data) {
-                exifentry = exif_data_get_entry(entry->exif_data, EXIF_TAG_ORIENTATION);
-            }
-            if (exifentry)
-            {
-                gchar *val = g_new0(gchar, 20);
-                exif_entry_get_value(exifentry, val, 20);
-                if (!strcmp(val, "top - left"))
-                {
-                    entry->v_flipped = FALSE;
-                    entry->h_flipped = FALSE;
-                    entry->rotation = GDK_PIXBUF_ROTATE_NONE;
-                }
-                if (!strcmp(val, "top - right"))
-                {
-                    entry->v_flipped = FALSE;
-                    entry->h_flipped = TRUE;
-                    entry->rotation = GDK_PIXBUF_ROTATE_NONE;
-                }
-                if (!strcmp(val, "bottom - left"))
-                {
-                    entry->v_flipped = TRUE;
-                    entry->h_flipped = FALSE;
-                    entry->rotation = GDK_PIXBUF_ROTATE_NONE;
-                }
-                if (!strcmp(val, "bottom - right"))
-                {
-                    entry->v_flipped = FALSE;
-                    entry->h_flipped = FALSE;
-                    entry->rotation = GDK_PIXBUF_ROTATE_UPSIDEDOWN;
-                }
-                if (!strcmp(val, "right - top"))
-                {
-                    entry->v_flipped = FALSE;
-                    entry->h_flipped = FALSE;
-                    entry->rotation = GDK_PIXBUF_ROTATE_CLOCKWISE;
-                }
-                if (!strcmp(val, "right - bottom"))
-                {
-                    entry->v_flipped = FALSE;
-                    entry->h_flipped = TRUE;
-                    entry->rotation = GDK_PIXBUF_ROTATE_COUNTERCLOCKWISE;
-                }
-                if (!strcmp(val, "left - top"))
-                {
-                    entry->v_flipped = FALSE;
-                    entry->h_flipped = TRUE;
-                    entry->rotation = GDK_PIXBUF_ROTATE_CLOCKWISE;
-                }
-                if (!strcmp(val, "left - bottom"))
-                {
-                    entry->v_flipped = FALSE;
-                    entry->h_flipped = FALSE;
-                    entry->rotation = GDK_PIXBUF_ROTATE_COUNTERCLOCKWISE;
-                }
-                g_free(val);
-            }
-        }
-
-        g_free(filename);
-    }
-    return entry;
-}
-
-ThunarVfsInfo *
-rstto_navigator_entry_get_info (RsttoNavigatorEntry *entry)
-{
-    return entry->info;
-}
-
-GdkPixbufRotation
-rstto_navigator_entry_get_rotation (RsttoNavigatorEntry *entry)
-{
-    return entry->rotation;
-}
-
-gboolean
-rstto_navigator_entry_get_flip (RsttoNavigatorEntry *entry, gboolean horizontal)
-{
-    if (horizontal)
-    {
-        return entry->h_flipped;
-    }
-    else
-    {
-        return entry->v_flipped;
-    }
-}
-
-static void
-rstto_navigator_entry_clear (RsttoNavigatorEntry *nav_entry)
-{
-    if(nav_entry->thumb)
-    {
-        gdk_pixbuf_unref(nav_entry->thumb);
-        nav_entry->thumb = NULL;
-    }
-
-    if(nav_entry->io_channel)
-    {
-        g_source_remove(nav_entry->io_source_id);
-        g_io_channel_unref(nav_entry->io_channel);
-        nav_entry->io_channel = NULL;
-        nav_entry->io_source_id = 0;
-    }
-
-    if (nav_entry->timeout_id)
-    {
-        g_source_remove(nav_entry->timeout_id);
-        nav_entry->timeout_id = 0;
-    }
-
-    if(nav_entry->loader)
-    {
-        g_signal_handlers_disconnect_by_func(nav_entry->loader , cb_rstto_navigator_entry_area_prepared, nav_entry);
-        gdk_pixbuf_loader_close(nav_entry->loader, NULL);
-    }
-
-    if(nav_entry->animation)
-    {
-        g_object_unref(nav_entry->animation);
-        nav_entry->animation = NULL;
-    }
-    if(nav_entry->src_pixbuf)
-    {
-        g_object_unref(nav_entry->src_pixbuf);
-        nav_entry->src_pixbuf = NULL;
-    }
-
-    if(nav_entry->iter)
-    {
-        g_object_unref (nav_entry->iter);
-        nav_entry->iter = NULL;
-    }
-
-}
-
-void
-rstto_navigator_entry_free(RsttoNavigatorEntry *nav_entry)
-{
-    rstto_navigator_entry_clear (nav_entry);
-    thunar_vfs_info_unref(nav_entry->info);
-    g_free(nav_entry);
-}
-
-GdkPixbuf *
-rstto_navigator_entry_get_thumb(RsttoNavigatorEntry *entry, gint size)
-{
-    ThunarVfsPath *home_path = thunar_vfs_path_get_for_home();
-    ThunarVfsPath *thumbnail_path = thunar_vfs_path_relative (home_path, ".thumbnails");
-    if(entry->thumb)    
-    {
-        if(!(gdk_pixbuf_get_width(entry->thumb) == size || gdk_pixbuf_get_height(entry->thumb) == size))
-        {
-            /* TODO: rebuild thumbnail */
-        }
-    }
-    else
-    {
-        ThunarVfsInfo *info = rstto_navigator_entry_get_info(entry);
-        gchar *thumbnail = thunar_vfs_thumb_factory_lookup_thumbnail(entry->navigator->factory, info);
-        if (thumbnail == NULL)
-        {
-            if (!thunar_vfs_path_is_ancestor (info->path, thumbnail_path))
-            {
-                GdkPixbuf *pixbuf = thunar_vfs_thumb_factory_generate_thumbnail(entry->navigator->factory, info);
-                if (pixbuf != NULL)
-                {
-                    if (!thunar_vfs_thumb_factory_store_thumbnail(entry->navigator->factory, pixbuf, info, NULL))
-                    {
-                        g_critical("Storing thumbnail failed");
-                    }
-
-                    gint width = gdk_pixbuf_get_width(pixbuf);
-                    gint height = gdk_pixbuf_get_height(pixbuf);
-
-                    if (width > height)
-                    {
-                        entry->thumb = gdk_pixbuf_new(GDK_COLORSPACE_RGB,
-                                                      gdk_pixbuf_get_has_alpha(pixbuf),
-                                                      gdk_pixbuf_get_bits_per_sample(pixbuf),
-                                                      size,
-                                                      height*size/width);
-                    }
-                    else
-                    {
-                        entry->thumb = gdk_pixbuf_new(GDK_COLORSPACE_RGB,
-                                                      gdk_pixbuf_get_has_alpha(pixbuf),
-                                                      gdk_pixbuf_get_bits_per_sample(pixbuf),
-                                                      width*size/height,
-                                                      size);
-                    }
-                    gdk_pixbuf_scale(pixbuf, entry->thumb,
-                                     0, 0, 
-                                     gdk_pixbuf_get_width(entry->thumb),
-                                     gdk_pixbuf_get_height(entry->thumb),
-                                     0, 0,
-                                     ((gdouble)gdk_pixbuf_get_width(entry->thumb)) / (gdouble)width,
-                                     ((gdouble)gdk_pixbuf_get_height(entry->thumb)) / (gdouble)height,
-                                     GDK_INTERP_BILINEAR);
-                }
-                else
-                {
-                    thumbnail = thunar_vfs_path_dup_string(info->path);
-                    entry->thumb = gdk_pixbuf_new_from_file_at_scale(thumbnail, size, size, TRUE, NULL);
-                    g_free(thumbnail);
-                }
-            }
-            else
-            {
-                GtkIconTheme *theme = gtk_icon_theme_get_default();
-                entry->thumb = gtk_icon_theme_load_icon (theme, thunar_vfs_mime_info_lookup_icon_name (info->mime_info, theme), size, 0, NULL);
-            }
-        }
-        else
-        {
-            entry->thumb = gdk_pixbuf_new_from_file_at_scale(thumbnail, size, size, TRUE, NULL);
-            g_free(thumbnail);
-        }
-    }
-    return entry->thumb;
-}
-
-gint
-rstto_navigator_get_old_position (RsttoNavigator *navigator)
-{
-    return navigator->old_position;
-}
-
-gdouble
-rstto_navigator_entry_get_scale (RsttoNavigatorEntry *entry)
-{
-    return entry->scale;
-}
-
-void
-rstto_navigator_entry_set_scale (RsttoNavigatorEntry *entry, gdouble scale)
-{
-    if (scale == 0.0)
-    {
-        entry->scale = scale;
-        return;
-    }
-    /* Max scale 1600% */
-    if (scale > 16)
-    {
-        scale = 16;
-    }
-    /* Min scale 5% */
-    if (scale < 0.05)
-    {
-        scale = 0.05;
-    }
-    entry->scale = scale;
-}
-
-gboolean
-rstto_navigator_entry_get_fit_to_screen (RsttoNavigatorEntry *entry)
-{
-    return entry->fit_to_screen;
-}
-
-void
-rstto_navigator_entry_set_fit_to_screen (RsttoNavigatorEntry *entry, gboolean fts)
-{
-    entry->fit_to_screen = fts;
-}
-
-void
-rstto_navigator_entry_set_rotation (RsttoNavigatorEntry *entry, GdkPixbufRotation rotation)
-{
-    GdkPixbuf *pixbuf = entry->src_pixbuf;
-    if (pixbuf)
-    {
-        entry->src_pixbuf = gdk_pixbuf_rotate_simple(pixbuf, (360+(rotation-entry->rotation))%360);
-    }
-    entry->rotation = rotation;
-    entry->orientation_changed = TRUE;
-    g_signal_emit(G_OBJECT(entry->navigator), rstto_navigator_signals[RSTTO_NAVIGATOR_SIGNAL_ENTRY_MODIFIED], 0, entry, NULL);
-}
-
-
-ExifData *
-rstto_navigator_entry_get_exif_data (RsttoNavigatorEntry *entry)
-{
-    return entry->exif_data;
-}
-
-
-GdkPixbufLoader *
-rstto_navigator_entry_get_pixbuf_loader (RsttoNavigatorEntry *entry)
-{
-    if (!entry->loader)
-    {
-        entry->loader = gdk_pixbuf_loader_new();
-    }
-    return entry->loader;
-}
-
-GdkPixbuf *
-rstto_navigator_entry_get_pixbuf (RsttoNavigatorEntry *entry)
-{
-    return entry->src_pixbuf;
-}
-
-guint64
-rstto_navigator_entry_get_size (RsttoNavigatorEntry *entry)
-{
-    guint64 size = 0;
-    
-    gint width, height, n_channels;
-
-    if (entry->src_pixbuf)
-    {
-        width = gdk_pixbuf_get_rowstride(entry->src_pixbuf);
-        height = gdk_pixbuf_get_height(entry->src_pixbuf);
-
-        n_channels = gdk_pixbuf_get_n_channels(entry->src_pixbuf);
-
-        //size += (guint64) width * height * n_channels;
-        size += (guint64) width * height;
-    }
-    if (entry->thumb)
-    {
-        width = gdk_pixbuf_get_rowstride(entry->thumb);
-        height = gdk_pixbuf_get_height(entry->thumb);
-
-        n_channels = gdk_pixbuf_get_n_channels(entry->thumb);
-        //size += (guint64) width * height * n_channels;
-        size += (guint64) width * height;
-    }
-    
-    size += (guint64)sizeof (RsttoNavigatorEntry);
-
-    return size;
-}
-
-gboolean
-rstto_navigator_entry_get_orientation_changed (RsttoNavigatorEntry *entry)
-{
-    return entry->orientation_changed;
-}
-
-gboolean
-rstto_navigator_entry_load_image (RsttoNavigatorEntry *entry, gboolean empty_cache)
-{
-    g_return_val_if_fail(entry != NULL, FALSE);
-    gchar *path = NULL;
-
-    if (entry->io_channel)
-    {
-        return FALSE;
-    }
-    if ((entry->loader == NULL) && ((empty_cache == TRUE ) || entry->src_pixbuf == NULL))
-    {
-        if (entry->src_pixbuf)
-        {
-            gdk_pixbuf_unref(entry->src_pixbuf);
-            entry->src_pixbuf = NULL;
-        }
-        entry->loader = gdk_pixbuf_loader_new();
-
-        g_signal_connect(entry->loader, "area-prepared", G_CALLBACK(cb_rstto_navigator_entry_area_prepared), entry);
-        /*g_signal_connect(entry->loader, "area-updated", G_CALLBACK(cb_rstto_navigator_entry_area_updated), viewer);*/
-        g_signal_connect(entry->loader, "closed", G_CALLBACK(cb_rstto_navigator_entry_closed), entry);
-
-        path = thunar_vfs_path_dup_string(entry->info->path);
-
-        entry->io_channel = g_io_channel_new_file(path, "r", NULL);
-
-        g_io_channel_set_encoding(entry->io_channel, NULL, NULL);
-        entry->io_source_id = g_io_add_watch(entry->io_channel, G_IO_IN | G_IO_PRI, (GIOFunc)cb_rstto_navigator_entry_read_file, entry);
-        g_free(path);
-    }
-    else
-    {
-        if (entry->src_pixbuf)
-        {
-            g_signal_emit(G_OBJECT(entry->navigator), rstto_navigator_signals[RSTTO_NAVIGATOR_SIGNAL_ENTRY_MODIFIED], 0, entry, NULL);
-        }
-    }
-
-    return TRUE;
-}
-
-
-static gboolean
-cb_rstto_navigator_entry_read_file(GIOChannel *io_channel, GIOCondition cond, RsttoNavigatorEntry *entry)
-{
-    gchar buffer[1024];
-    gsize bytes_read = 0;
-    GError *error = NULL;
-    GIOStatus status;
-
-    g_return_val_if_fail(io_channel == entry->io_channel, FALSE);
-
-    if (entry->loader)
-    {
-
-        status = g_io_channel_read_chars(io_channel, buffer, 1024, &bytes_read,  &error);
-
-        switch (status)
-        {
-            case G_IO_STATUS_NORMAL:
-                if(gdk_pixbuf_loader_write(entry->loader, (const guchar *)buffer, bytes_read, NULL) == FALSE)
-                {
-                    g_io_channel_unref(io_channel);
-                    entry->io_channel = NULL;
-                    entry->io_source_id = 0;
-                    return FALSE;
-                }
-                return TRUE;
-                break;
-            case G_IO_STATUS_EOF:
-                gdk_pixbuf_loader_write(entry->loader, (const guchar *)buffer, bytes_read, NULL);
-                gdk_pixbuf_loader_close(entry->loader, NULL);
-                g_io_channel_unref(io_channel);
-                entry->io_channel = NULL;
-                entry->io_source_id = 0;
-                return FALSE;
-                break;
-            case G_IO_STATUS_ERROR:
-                if (entry->loader)
-                {
-                    gdk_pixbuf_loader_close(entry->loader, NULL);
-                }
-                g_io_channel_unref(io_channel);
-                entry->io_channel = NULL;
-                entry->io_source_id = 0;
-                return FALSE;
-                break;
-            case G_IO_STATUS_AGAIN:
-                return TRUE;
-                break;
-        }
-    }
-    g_io_channel_unref(io_channel);
-    entry->io_channel = NULL;
-    entry->io_source_id = 0;
-    return FALSE;
-}
-
-static void
-cb_rstto_navigator_entry_area_prepared (GdkPixbufLoader *loader, RsttoNavigatorEntry *entry)
-{
-    entry->animation = gdk_pixbuf_loader_get_animation(loader);
-    entry->iter = gdk_pixbuf_animation_get_iter(entry->animation, NULL);
-    if (entry->src_pixbuf)
-    {
-        gdk_pixbuf_unref(entry->src_pixbuf);
-        entry->src_pixbuf = NULL;
-    }
-
-    g_object_ref (entry->animation);
-
-    gint time = gdk_pixbuf_animation_iter_get_delay_time(entry->iter);
-
-    if (time != -1)
-    {
-        /* fix borked stuff */
-        if (time == 0)
-        {
-            g_warning("timeout == 0: defaulting to 40ms");
-            time = 40;
-        }
-
-        entry->timeout_id = g_timeout_add(time, (GSourceFunc)cb_rstto_navigator_entry_update_image, entry);
-    }   
-    else
-    {
-        entry->iter = NULL;
-    }
-    g_signal_emit(G_OBJECT(entry->navigator), rstto_navigator_signals[RSTTO_NAVIGATOR_SIGNAL_ENTRY_MODIFIED], 0, entry, NULL);
-}
-
-static void
-cb_rstto_navigator_entry_closed (GdkPixbufLoader *loader, RsttoNavigatorEntry *entry)
-{
-    GdkPixbuf *pixbuf = NULL;
-
-    if (entry->src_pixbuf)
-    {
-        gdk_pixbuf_unref(entry->src_pixbuf);
-        entry->src_pixbuf = NULL;
-    }
-
-    if (entry->iter)
-    {
-        pixbuf = gdk_pixbuf_animation_iter_get_pixbuf(entry->iter);
-    }
-    else
-    {
-        if (entry->loader)
-        {
-            pixbuf = gdk_pixbuf_loader_get_pixbuf(entry->loader);
-        }
-    }
-
-    if (entry->loader == loader)
-    {
-        g_object_unref(entry->loader);
-        entry->loader = NULL;
-    }
-
-   
-    if (pixbuf != NULL)
-    {
-        entry->src_pixbuf = gdk_pixbuf_rotate_simple(pixbuf, rstto_navigator_entry_get_rotation(entry));
-        gdk_pixbuf_unref(pixbuf);
-        pixbuf = NULL;
-        if (rstto_navigator_entry_get_flip(entry, FALSE))
-        {
-            pixbuf = entry->src_pixbuf;
-            entry->src_pixbuf = gdk_pixbuf_flip(pixbuf, FALSE);
-            gdk_pixbuf_unref(pixbuf);
-            pixbuf = NULL;
-        }
-
-        if (rstto_navigator_entry_get_flip(entry, TRUE))
-        {
-            pixbuf = entry->src_pixbuf;
-            entry->src_pixbuf = gdk_pixbuf_flip(pixbuf, TRUE);
-            gdk_pixbuf_unref(pixbuf);
-            pixbuf = NULL;
-        }
-        g_signal_emit(G_OBJECT(entry->navigator), rstto_navigator_signals[RSTTO_NAVIGATOR_SIGNAL_ENTRY_MODIFIED], 0, entry, NULL);
-    }
-}
-
-static gboolean
-cb_rstto_navigator_entry_update_image (RsttoNavigatorEntry *entry)
-{
-    GdkPixbuf *src_pixbuf = NULL;
-
-    if (entry->iter)
-    {
-        if(gdk_pixbuf_animation_iter_advance(entry->iter, NULL))
-        {
-            /* Cleanup old image */
-            if (entry->src_pixbuf)
-            {
-                gdk_pixbuf_unref(entry->src_pixbuf);
-                entry->src_pixbuf = NULL;
-            }
-            entry->src_pixbuf = gdk_pixbuf_animation_iter_get_pixbuf(entry->iter);
-            src_pixbuf = entry->src_pixbuf;
-
-            if (src_pixbuf)
-            {
-                entry->src_pixbuf = gdk_pixbuf_rotate_simple(src_pixbuf, rstto_navigator_entry_get_rotation(entry));
-                if (rstto_navigator_entry_get_flip(entry, FALSE))
-                {
-                    src_pixbuf = entry->src_pixbuf;
-                    entry->src_pixbuf = gdk_pixbuf_flip(src_pixbuf, FALSE);
-                    gdk_pixbuf_unref(src_pixbuf);
-                }
-
-                if (rstto_navigator_entry_get_flip(entry, TRUE))
-                {
-                    src_pixbuf = entry->src_pixbuf;
-                    entry->src_pixbuf = gdk_pixbuf_flip(src_pixbuf, TRUE);
-                    gdk_pixbuf_unref(src_pixbuf);
-                }
-            }
-        }
-
-        gint time = gdk_pixbuf_animation_iter_get_delay_time(entry->iter);
-        if (time != -1)
-        {
-            if (time == 0)
-            {
-                g_warning("timeout == 0: defaulting to 40ms");
-                time = 40;
-            }
-            entry->timeout_id = g_timeout_add(time, (GSourceFunc)cb_rstto_navigator_entry_update_image, entry);
-        }
-        g_signal_emit(G_OBJECT(entry->navigator), rstto_navigator_signals[RSTTO_NAVIGATOR_SIGNAL_ENTRY_MODIFIED], 0, entry, NULL);
-
-        return FALSE;
-    }
-    return TRUE;
-}
-
-static void
-cb_rstto_navigator_entry_fs_event (ThunarVfsMonitor *monitor,
-                                   ThunarVfsMonitorHandle *handl,
-                                   ThunarVfsMonitorEvent event,
-                                   ThunarVfsPath *handle_path,
-                                   ThunarVfsPath *event_path,
-                                   RsttoNavigatorEntry *entry)
-{
-    switch (event)
-    {
-        case THUNAR_VFS_MONITOR_EVENT_CHANGED:
-            rstto_navigator_entry_load_image (entry, TRUE);
-            break;
-        case THUNAR_VFS_MONITOR_EVENT_CREATED:
-            break;
-        case THUNAR_VFS_MONITOR_EVENT_DELETED:
-            rstto_navigator_remove(entry->navigator, entry);
-            rstto_navigator_entry_free(entry);
-            break;
-        default:
-            break;
-    }
-}
-
-static void
-cb_rstto_navigator_fs_event (ThunarVfsMonitor *monitor,
-                             ThunarVfsMonitorHandle *handl,
-                             ThunarVfsMonitorEvent event,
-                             ThunarVfsPath *handle_path,
-                             ThunarVfsPath *event_path,
-                             RsttoNavigator *nav)
-{
-    RsttoNavigatorEntry *entry = NULL;
-    GList *iter = g_list_find_custom(nav->file_list, event_path, (GCompareFunc)cb_rstto_navigator_entry_path_compare_func);
-    if (iter != NULL)
-        entry = iter->data;
-
-    switch (event)
-    {
-        case THUNAR_VFS_MONITOR_EVENT_CHANGED:
-            if(entry)
-            {
-                rstto_navigator_entry_load_image (entry, TRUE);
-            }
-            break;
-        case THUNAR_VFS_MONITOR_EVENT_CREATED:
-            if (entry)
-            {
-                g_critical("File created... yet it is already here");
-                rstto_navigator_remove(entry->navigator, entry);
-                rstto_navigator_entry_free(entry);
-            }
-
-            ThunarVfsInfo *info = thunar_vfs_info_new_for_path(event_path, NULL);
-            if (info)
-            {
-                gchar *file_media = thunar_vfs_mime_info_get_media(info->mime_info);
-                if(!strcmp(file_media, "image"))
-                {
-                    entry = rstto_navigator_entry_new(nav, info);
-                    rstto_navigator_add (nav, entry, FALSE);
-                }
-                g_free(file_media);
-            }
-            break;
-        case THUNAR_VFS_MONITOR_EVENT_DELETED:
-            if(entry)
-            {
-                rstto_navigator_remove(entry->navigator, entry);
-                rstto_navigator_entry_free(entry);
-            }
-            break;
-        default:
-            break;
-    }
-}
-
-void
-rstto_navigator_entry_select (RsttoNavigatorEntry *entry)
-{
-    RsttoNavigator *navigator = entry->navigator;
-    GList *iter = g_list_find (navigator->file_list, entry);
-    if (iter)
-    {
-        if(navigator->file_iter)
-        {
-            rstto_navigator_guard_history(navigator, navigator->file_iter->data);
-            navigator->old_position = rstto_navigator_get_position(navigator);
-        }
-
-        navigator->file_iter = iter;
-
-        if (navigator->busy  == FALSE)
-        {
-            g_signal_emit(G_OBJECT(navigator),
-                      rstto_navigator_signals[RSTTO_NAVIGATOR_SIGNAL_ITER_CHANGED],
-                      0,
-                      g_list_position(navigator->file_list, navigator->file_iter),
-                      navigator->file_iter->data,
-                      NULL);
-        }
-
-        if (navigator->preload)
-        {
-            /* preload in both directions */
-            g_timeout_add(500, (GSourceFunc)rstto_navigator_preload_next_img, navigator);
-            g_timeout_add(500, (GSourceFunc)rstto_navigator_preload_prev_img, navigator);
-
-        }
-    }
-
-}
-
-guint64
-rstto_navigator_get_max_history_size (RsttoNavigator *navigator)
-{
-    return navigator->max_history;
-}
-
-
-
-gint
-rstto_navigator_entry_get_position(RsttoNavigatorEntry *entry)
-{
-    RsttoNavigator *navigator = entry->navigator;
-    GList *iter = g_list_find (navigator->file_list, entry);
-    if (iter)
-    {
-        return g_list_position(navigator->file_list, iter);
-    }
-    return -1;
-}
-
-void
-rstto_navigator_set_max_history_size(RsttoNavigator *nav, guint64 size)
-{
-    nav->max_history = size;
-}
-
-void
-rstto_navigator_set_monitor_handle_for_dir(RsttoNavigator *nav, ThunarVfsPath *dir_path)
-{
-    if (nav->monitor_handle)
-    {
-        thunar_vfs_monitor_remove(nav->monitor, nav->monitor_handle);
-        nav->monitor_handle = NULL;
-    }
-    
-    if (dir_path)
-    {
-        nav->monitor_handle = thunar_vfs_monitor_add_directory(nav->monitor, dir_path, (ThunarVfsMonitorCallback)cb_rstto_navigator_fs_event, nav);
-    }
-}
-
-static gint
-cb_rstto_navigator_entry_path_compare_func(RsttoNavigatorEntry *entry, ThunarVfsPath *path)
-{
-    if (thunar_vfs_path_equal(entry->info->path, path) == TRUE)
-    {
-        return 0;
-    }
-    return 1;
-}
-
-gboolean
-rstto_navigator_entry_is_selected(RsttoNavigatorEntry *entry)
-{
-    g_return_val_if_fail(RSTTO_IS_NAVIGATOR(entry->navigator), FALSE);
-    g_return_val_if_fail((entry->navigator->file_iter != NULL), FALSE);
-
-    if (entry == entry->navigator->file_iter->data)
-        return TRUE;
-    else
-        return FALSE;
-}
-
-gboolean
-rstto_navigator_open_file(RsttoNavigator *navigator, const gchar *path, gboolean open_folder, GError **error)
-{
-    ThunarVfsInfo *vfs_info = NULL;
-    ThunarVfsPath *vfs_path = thunar_vfs_path_new(path, error);
-
-    gchar *file_media = NULL;
-    gchar *file_uri = NULL;
-
-
-    if (vfs_path == NULL)
-    {
-        return FALSE;
-    }
-
-    vfs_info = thunar_vfs_info_new_for_path(vfs_path, error);
-    if (vfs_info == NULL)
-    {
-        thunar_vfs_path_unref(vfs_path);
-        return FALSE;
-    }
-
-    if(!strcmp(thunar_vfs_mime_info_get_name(vfs_info->mime_info), 
-                "inode/directory"))
-    {
-        g_set_error(error,
-                    g_quark_from_static_string(
-                            "Path refers to folder"),
-                    G_FILE_ERROR_ISDIR,
-                    "Path refers to directory\n"
-                    "Use rstto_navigator_open_folder instead.");
-        return FALSE;
-    }
-
-    file_media = thunar_vfs_mime_info_get_media(vfs_info->mime_info);
-    if(!strcmp(file_media, "image"))
-    {
-        RsttoNavigatorEntry *entry = rstto_navigator_entry_new(navigator, vfs_info);
-        rstto_navigator_add (navigator, entry, TRUE);
-
-        if (open_folder == TRUE)
-        {
-            ThunarVfsPath *parent_vfs_path = thunar_vfs_path_get_parent(vfs_path);
-            thunar_vfs_path_ref(parent_vfs_path);
-
-            gchar *parent_path = thunar_vfs_path_dup_string(parent_vfs_path);
-
-            if(rstto_navigator_open_folder(navigator, parent_path, FALSE, error) == FALSE)
-            {
-                g_free(parent_path);
-                thunar_vfs_path_unref(parent_vfs_path);
-                return FALSE;
-            }
-
-            g_free(parent_path);
-            thunar_vfs_path_unref(parent_vfs_path);
-
-            rstto_navigator_entry_select(entry);
-        }
-    }
-
-    file_uri = thunar_vfs_path_dup_uri(vfs_path);
-    gtk_recent_manager_add_item(navigator->manager, file_uri);
-    g_free(file_uri);
-
-    g_free(file_media);
-    return TRUE;
-}
-
-gboolean
-rstto_navigator_open_folder(RsttoNavigator *navigator, const gchar *path, gboolean clear, GError **error)
-{
-    ThunarVfsInfo *vfs_info = NULL;
-    ThunarVfsPath *vfs_path = thunar_vfs_path_new(path, error);
-    GDir *dir = NULL;
-    gchar *dir_path = NULL;
-    gchar *dir_uri = NULL;
-
-    rstto_navigator_set_busy(navigator, TRUE);
-
-
-    if (vfs_path == NULL)
-    {
-        return FALSE;
-    }
-
-    vfs_info = thunar_vfs_info_new_for_path(vfs_path, error);
-    if (vfs_info == NULL)
-    {
-        thunar_vfs_path_unref(vfs_path);
-        return FALSE;
-    }
-    
-    if(strcmp(thunar_vfs_mime_info_get_name(vfs_info->mime_info),
-                "inode/directory"))
-    {
-        g_set_error(error,
-                    g_quark_from_static_string(
-                            "Path does not refer to folder"),
-                    G_FILE_ERROR_ISDIR,
-                    "Path does not refer to directory\n"
-                    "Use rstto_navigator_open_file instead.");
-        return FALSE;
-    }
-
-    dir_path = thunar_vfs_path_dup_string(vfs_path);
-
-    g_object_add_weak_pointer(G_OBJECT(navigator), (gpointer)navigator);
-
-    dir = g_dir_open(dir_path, 0, NULL);
-
-    dir_uri = thunar_vfs_path_dup_uri(vfs_path);
-
-    gtk_recent_manager_add_item(navigator->manager, dir_uri);
-
-
-    {
-        if (clear == TRUE)
-        {
-            rstto_navigator_clear(navigator);
-        }
-        const gchar *filename = g_dir_read_name(dir);
-        ThunarVfsPath *file_vfs_path = NULL;
-        ThunarVfsInfo *file_vfs_info = NULL;
-        gchar *file_media;
-        gchar *path_name;
-
-        while (filename)
-        {
-            path_name = g_strconcat(dir_path,  "/", filename, NULL);
-            file_vfs_path = thunar_vfs_path_new(path_name, NULL);
-
-            if (file_vfs_path)
-            {
-                file_vfs_info = thunar_vfs_info_new_for_path(file_vfs_path, NULL);
-                file_media = thunar_vfs_mime_info_get_media(file_vfs_info->mime_info);
-
-                if (navigator == NULL)
-                {
-                    g_free(file_media);
-                    thunar_vfs_path_unref(file_vfs_path);
-                    return FALSE;
-                }
-
-                if(!strcmp(file_media, "image"))
-                {
-                    RsttoNavigatorEntry *entry = rstto_navigator_entry_new(navigator, file_vfs_info);
-                    rstto_navigator_add (navigator, entry, FALSE);
-                }
-
-                g_free(file_media);
-                thunar_vfs_path_unref(file_vfs_path);
-                while (gtk_events_pending())
-                {
-                    gtk_main_iteration();
-                }
-            }
-            g_free(path_name);
-            filename = g_dir_read_name(dir);
-        }
-    }
-
-    g_free(dir_uri);
-    g_free(dir_path);
-    g_object_remove_weak_pointer(G_OBJECT(navigator), (gpointer)navigator);
-    rstto_navigator_set_busy(navigator, FALSE);
-    return TRUE;
-}
-
-static void
-rstto_navigator_set_busy (RsttoNavigator *navigator, gboolean busy)
-{
-    navigator->busy = busy;
-    if (busy == FALSE)
-    {
-        g_signal_emit(G_OBJECT(navigator), rstto_navigator_signals[RSTTO_NAVIGATOR_SIGNAL_REORDERED], 0, NULL);
-    }
-}
diff --git a/src/navigator.h b/src/navigator.h
deleted file mode 100644
index 0b6dab1..0000000
--- a/src/navigator.h
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU Library General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#ifndef __RISTRETTO_NAVIGATOR_H__
-#define __RISTRETTO_NAVIGATOR_H__
-
-G_BEGIN_DECLS
-
-#define RSTTO_TYPE_NAVIGATOR rstto_navigator_get_type()
-
-#define RSTTO_NAVIGATOR(obj)( \
-        G_TYPE_CHECK_INSTANCE_CAST ((obj), \
-                RSTTO_TYPE_NAVIGATOR, \
-                RsttoNavigator))
-
-#define RSTTO_IS_NAVIGATOR(obj)( \
-        G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
-                RSTTO_TYPE_NAVIGATOR))
-
-#define RSTTO_NAVIGATOR_CLASS(klass)( \
-        G_TYPE_CHECK_CLASS_CAST ((klass), \
-                RSTTO_TYPE_NAVIGATOR, \
-                RsttoNavigatorClass))
-
-#define RSTTO_IS_NAVIGATOR_CLASS(klass)( \
-        G_TYPE_CHECK_CLASS_TYPE ((klass), \
-                RSTTO_TYPE_NAVIGATOR()))
-
-typedef struct _RsttoNavigatorEntry RsttoNavigatorEntry;
-
-typedef struct _RsttoNavigator RsttoNavigator;
-
-struct _RsttoNavigator
-{
-    GObject                parent;
-    GtkRecentManager      *manager;
-    ThunarVfsMonitor      *monitor;
-    ThunarVfsMonitorHandle *monitor_handle;
-
-    ThunarVfsThumbFactory *factory;
-
-    ThunarVfsPath         *path;
-    GCompareFunc           compare_func;
-    GList                 *file_list;
-    GList                 *file_iter;
-    GList                 *history;
-    guint64                max_history;
-
-    gboolean               preload;
-
-    gint                   old_position;
-    gboolean               running;
-    gint                   timeout;
-    gint                   id;
-
-    gboolean               busy;
-};
-
-typedef struct _RsttoNavigatorClass RsttoNavigatorClass;
-struct _RsttoNavigatorClass
-{
-    GObjectClass      parent_class;
-};
-
-GType      rstto_navigator_get_type ();
-
-RsttoNavigator *
-rstto_navigator_new (GtkRecentManager *recent_manager);
-
-void       rstto_navigator_jump_first (RsttoNavigator *navigator);
-void       rstto_navigator_jump_forward (RsttoNavigator *navigator);
-void       rstto_navigator_jump_back (RsttoNavigator *navigator);
-void       rstto_navigator_jump_last (RsttoNavigator *navigator);
-
-void       rstto_navigator_set_running (RsttoNavigator *navigator,
-                                        gboolean running);
-gboolean   rstto_navigator_is_running (RsttoNavigator *navigator);
-void
-rstto_navigator_set_timeout (RsttoNavigator *nav, gint);
-
-
-RsttoNavigatorEntry *
-rstto_navigator_get_file (RsttoNavigator *navigator);
-gint
-rstto_navigator_get_position(RsttoNavigator *navigator);
-gint
-rstto_navigator_get_old_position(RsttoNavigator *navigator);
-
-gint
-rstto_navigator_add (RsttoNavigator *navigator, RsttoNavigatorEntry *entry, gboolean with_monitor);
-void
-rstto_navigator_remove (RsttoNavigator *navigator, RsttoNavigatorEntry *entry);
-gint
-rstto_navigator_get_n_files (RsttoNavigator *navigator);
-RsttoNavigatorEntry *
-rstto_navigator_get_nth_file (RsttoNavigator *navigator, gint n);
-void
-rstto_navigator_set_file_nr (RsttoNavigator *navigator, gint n);
-void
-rstto_navigator_clear (RsttoNavigator *navigator);
-
-RsttoNavigatorEntry *
-rstto_navigator_entry_new (RsttoNavigator *, ThunarVfsInfo *info);
-void
-rstto_navigator_entry_free(RsttoNavigatorEntry *nav_entry);
-ThunarVfsInfo *
-rstto_navigator_entry_get_info (RsttoNavigatorEntry *entry);
-gboolean
-rstto_navigator_entry_get_fit_to_screen (RsttoNavigatorEntry *entry);
-gdouble
-rstto_navigator_entry_get_scale (RsttoNavigatorEntry *entry);
-void
-rstto_navigator_entry_set_fit_to_screen (RsttoNavigatorEntry *entry, gboolean);
-void
-rstto_navigator_entry_set_scale (RsttoNavigatorEntry *entry, gdouble);
-void
-rstto_navigator_entry_set_rotation (RsttoNavigatorEntry *entry, GdkPixbufRotation rotation);
-gint
-rstto_navigator_entry_get_position(RsttoNavigatorEntry *entry);
-
-GdkPixbufRotation
-rstto_navigator_entry_get_rotation (RsttoNavigatorEntry *entry);
-gboolean
-rstto_navigator_entry_get_flip (RsttoNavigatorEntry *entry, gboolean horizontal);
-void
-rstto_navigator_flip_entry(RsttoNavigator *navigator, RsttoNavigatorEntry *entry, gboolean horizontal);
-GdkPixbuf *
-rstto_navigator_entry_get_thumb(RsttoNavigatorEntry *entry, gint size);
-ExifData *
-rstto_navigator_entry_get_exif_data (RsttoNavigatorEntry *entry);
-
-GdkPixbufLoader *
-rstto_navigator_entry_get_pixbuf_loader (RsttoNavigatorEntry *entry);
-GdkPixbuf *
-rstto_navigator_entry_get_pixbuf (RsttoNavigatorEntry *entry);
-gboolean
-rstto_navigator_entry_load_image (RsttoNavigatorEntry *entry, gboolean empty_cache);
-void
-rstto_navigator_entry_select (RsttoNavigatorEntry *entry);
-
-guint64
-rstto_navigator_entry_get_size (RsttoNavigatorEntry *entry);
-guint64
-rstto_navigator_get_max_history_size(RsttoNavigator *navigator);
-void
-rstto_navigator_set_max_history_size(RsttoNavigator *nav, guint64 size);
-void
-rstto_navigator_set_monitor_handle_for_dir(RsttoNavigator *nav, ThunarVfsPath *dir_path);
-
-gboolean
-rstto_navigator_entry_is_selected(RsttoNavigatorEntry *entry);
-
-gboolean
-rstto_navigator_open_file(RsttoNavigator *navigator, const gchar *path, gboolean open_folder, GError **error);
-gboolean
-rstto_navigator_open_folder(RsttoNavigator *navigator, const gchar *path, gboolean clear, GError **error);
-
-gboolean
-rstto_navigator_entry_get_orientation_changed (RsttoNavigatorEntry *entry);
-
-G_END_DECLS
-
-#endif /* __RISTRETTO_NAVIGATOR_H__ */
diff --git a/src/picture_viewer.c b/src/picture_viewer.c
deleted file mode 100644
index 9fc6201..0000000
--- a/src/picture_viewer.c
+++ /dev/null
@@ -1,1600 +0,0 @@
-/*
-<<<<<<< HEAD:src/picture_viewer.c
-=======
- *  Copyright (C) Stephan Arts 2006-2009 <stephan at xfce.org>
- *
->>>>>>> 9b75414e8bb4500c58635dd45ecb8f2f45266902:src/picture_viewer.c
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU Library General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- *  Drag-n-Drop support taken from Thunar, written by Benedict Meurer
- */
-
-#include <config.h>
-#include <gtk/gtk.h>
-#include <gtk/gtkmarshal.h>
-#include <string.h>
-#include <gio/gio.h>
-#include <libexif/exif-data.h>
-
-#include "image.h"
-#include "image_list.h"
-#include "picture_viewer.h"
-#include "settings.h"
-
-typedef enum
-{
-    RSTTO_PICTURE_VIEWER_STATE_NORMAL = 0,
-    RSTTO_PICTURE_VIEWER_STATE_PREVIEW
-} RsttoPictureViewerState;
-
-typedef enum
-{
-    RSTTO_PICTURE_VIEWER_MOTION_STATE_NORMAL = 0,
-    RSTTO_PICTURE_VIEWER_MOTION_STATE_BOX_ZOOM,
-    RSTTO_PICTURE_VIEWER_MOTION_STATE_MOVE
-} RsttoPictureViewerMotionState;
-
-typedef enum
-{
-    RSTTO_ZOOM_MODE_CUSTOM,
-    RSTTO_ZOOM_MODE_100,
-    RSTTO_ZOOM_MODE_FIT
-} RsttoZoomMode;
-
-enum
-{
-    TARGET_TEXT_URI_LIST,
-};
-
-static const GtkTargetEntry drop_targets[] = {
-    {"text/uri-list", 0, TARGET_TEXT_URI_LIST},
-};
-
-
-struct _RsttoPictureViewerPriv
-{
-    RsttoImage              *image;
-    RsttoImageListIter      *iter;
-    GtkMenu                 *menu;
-    RsttoPictureViewerState  state;
-    RsttoZoomMode            zoom_mode;
-
-
-    GdkPixbuf        *dst_pixbuf; /* The pixbuf which ends up on screen */
-    void             (*cb_value_changed)(GtkAdjustment *, RsttoPictureViewer *);
-    GdkColor         *bg_color;
-
-    struct
-    {
-        gdouble x;
-        gdouble y;
-        gdouble current_x;
-        gdouble current_y;
-        gint h_val;
-        gint v_val;
-        RsttoPictureViewerMotionState state;
-    } motion;
-
-    struct
-    {
-        gint idle_id;
-        gboolean refresh;
-    } repaint;
-};
-
-static void
-rstto_picture_viewer_init(RsttoPictureViewer *);
-static void
-rstto_picture_viewer_class_init(RsttoPictureViewerClass *);
-static void
-rstto_picture_viewer_destroy(GtkObject *object);
-
-static void
-rstto_picture_viewer_set_state (RsttoPictureViewer *viewer, RsttoPictureViewerState state);
-static RsttoPictureViewerState
-rstto_picture_viewer_get_state (RsttoPictureViewer *viewer);
-static void
-rstto_picture_viewer_set_motion_state (RsttoPictureViewer *viewer, RsttoPictureViewerMotionState state);
-static RsttoPictureViewerMotionState
-rstto_picture_viewer_get_motion_state (RsttoPictureViewer *viewer);
-
-static void
-rstto_picture_viewer_set_zoom_mode (RsttoPictureViewer *viewer, RsttoZoomMode mode);
-
-static void
-rstto_picture_viewer_size_request(GtkWidget *, GtkRequisition *);
-static void
-rstto_picture_viewer_size_allocate(GtkWidget *, GtkAllocation *);
-static void
-rstto_picture_viewer_realize(GtkWidget *);
-static gboolean 
-rstto_picture_viewer_expose(GtkWidget *, GdkEventExpose *);
-static void
-rstto_picture_viewer_paint (GtkWidget *widget);
-static void 
-rstto_picture_viewer_queued_repaint (RsttoPictureViewer *viewer, gboolean refresh);
-
-static gboolean
-rstto_picture_viewer_set_scroll_adjustments(RsttoPictureViewer *, GtkAdjustment *, GtkAdjustment *);
-
-static void
-rstto_marshal_VOID__OBJECT_OBJECT (GClosure     *closure,
-                                   GValue       *return_value,
-                                   guint         n_param_values,
-                                   const GValue *param_values,
-                                   gpointer      invocation_hint,
-                                   gpointer      marshal_data);
-
-static void
-cb_rstto_picture_viewer_value_changed(GtkAdjustment *, RsttoPictureViewer *);
-static void
-cb_rstto_picture_viewer_nav_iter_changed (RsttoImageListIter *iter, gpointer user_data);
-
-static void
-cb_rstto_picture_viewer_image_updated (RsttoImage *image, RsttoPictureViewer *viewer);
-static void
-cb_rstto_picture_viewer_image_prepared (RsttoImage *image, RsttoPictureViewer *viewer);
-
-static gboolean 
-cb_rstto_picture_viewer_queued_repaint (RsttoPictureViewer *viewer);
-
-static void
-cb_rstto_picture_viewer_scroll_event (RsttoPictureViewer *viewer, GdkEventScroll *event);
-static void
-cb_rstto_picture_viewer_button_press_event (RsttoPictureViewer *viewer, GdkEventButton *event);
-static void
-cb_rstto_picture_viewer_button_release_event (RsttoPictureViewer *viewer, GdkEventButton *event);
-static gboolean 
-cb_rstto_picture_viewer_motion_notify_event (RsttoPictureViewer *viewer,
-                                             GdkEventMotion *event,
-                                             gpointer user_data);
-static void
-cb_rstto_picture_viewer_popup_menu (RsttoPictureViewer *viewer, gboolean user_data);
-
-static GtkWidgetClass *parent_class = NULL;
-
-GType
-rstto_picture_viewer_get_type (void)
-{
-    static GType rstto_picture_viewer_type = 0;
-
-    if (!rstto_picture_viewer_type)
-    {
-        static const GTypeInfo rstto_picture_viewer_info = 
-        {
-            sizeof (RsttoPictureViewerClass),
-            (GBaseInitFunc) NULL,
-            (GBaseFinalizeFunc) NULL,
-            (GClassInitFunc) rstto_picture_viewer_class_init,
-            (GClassFinalizeFunc) NULL,
-            NULL,
-            sizeof (RsttoPictureViewer),
-            0,
-            (GInstanceInitFunc) rstto_picture_viewer_init,
-            NULL
-        };
-
-        rstto_picture_viewer_type = g_type_register_static (GTK_TYPE_WIDGET, "RsttoPictureViewer", &rstto_picture_viewer_info, 0);
-    }
-    return rstto_picture_viewer_type;
-}
-
-static void
-rstto_picture_viewer_init(RsttoPictureViewer *viewer)
-{
-    viewer->priv = g_new0(RsttoPictureViewerPriv, 1);
-    viewer->priv->cb_value_changed = cb_rstto_picture_viewer_value_changed;
-
-    viewer->priv->dst_pixbuf = NULL;
-    viewer->priv->zoom_mode = RSTTO_ZOOM_MODE_CUSTOM;
-    gtk_widget_set_redraw_on_allocate(GTK_WIDGET(viewer), TRUE);
-    gtk_widget_set_events (GTK_WIDGET(viewer),
-                           GDK_BUTTON_PRESS_MASK |
-                           GDK_BUTTON_RELEASE_MASK |
-                           GDK_BUTTON1_MOTION_MASK |
-                           GDK_POINTER_MOTION_MASK);
-
-    g_signal_connect(G_OBJECT(viewer), "scroll_event", G_CALLBACK(cb_rstto_picture_viewer_scroll_event), NULL);
-    g_signal_connect(G_OBJECT(viewer), "button_press_event", G_CALLBACK(cb_rstto_picture_viewer_button_press_event), NULL);
-    g_signal_connect(G_OBJECT(viewer), "button_release_event", G_CALLBACK(cb_rstto_picture_viewer_button_release_event), NULL);
-    g_signal_connect(G_OBJECT(viewer), "motion_notify_event", G_CALLBACK(cb_rstto_picture_viewer_motion_notify_event), NULL);
-    g_signal_connect(G_OBJECT(viewer), "popup-menu", G_CALLBACK(cb_rstto_picture_viewer_popup_menu), NULL);
-
-    gtk_drag_dest_set(GTK_WIDGET(viewer), 0, drop_targets, G_N_ELEMENTS(drop_targets),
-                      GDK_ACTION_COPY | GDK_ACTION_LINK | GDK_ACTION_MOVE | GDK_ACTION_PRIVATE);
-}
-
-/**
- * rstto_marshal_VOID__OBJECT_OBJECT:
- * @closure:
- * @return_value:
- * @n_param_values:
- * @param_values:
- * @invocation_hint:
- * @marshal_data:
- *
- * A marshaller for the set_scroll_adjustments signal.
- */
-static void
-rstto_marshal_VOID__OBJECT_OBJECT (GClosure     *closure,
-                                   GValue       *return_value,
-                                   guint         n_param_values,
-                                   const GValue *param_values,
-                                   gpointer      invocation_hint,
-                                   gpointer      marshal_data)
-{
-    typedef void (*GMarshalFunc_VOID__OBJECT_OBJECT) (gpointer data1,
-                                                      gpointer arg_1,
-                                                      gpointer arg_2,
-                                                      gpointer data2);
-    register GMarshalFunc_VOID__OBJECT_OBJECT callback;
-    register GCClosure *cc = (GCClosure*) closure;
-    register gpointer data1, data2;
-
-    g_return_if_fail (n_param_values == 3);
-
-    if (G_CCLOSURE_SWAP_DATA (closure))
-    {
-        data1 = closure->data;
-        data2 = g_value_get_object (param_values + 0);
-    }
-    else
-    {
-        data1 = g_value_get_object (param_values + 0);
-        data2 = closure->data;
-    }
-    callback = (GMarshalFunc_VOID__OBJECT_OBJECT) (marshal_data ?
-    marshal_data : cc->callback);
-
-    callback (data1,
-              g_value_get_object (param_values + 1),
-              g_value_get_object (param_values + 2),
-              data2);
-}
-
-/**
- * rstto_picture_viewer_class_init:
- * @viewer_class:
- *
- * Initialize pictureviewer class
- */
-static void
-rstto_picture_viewer_class_init(RsttoPictureViewerClass *viewer_class)
-{
-    GtkWidgetClass *widget_class;
-    GtkObjectClass *object_class;
-
-    widget_class = (GtkWidgetClass*)viewer_class;
-    object_class = (GtkObjectClass*)viewer_class;
-
-    parent_class = g_type_class_peek_parent(viewer_class);
-
-    viewer_class->set_scroll_adjustments = rstto_picture_viewer_set_scroll_adjustments;
-
-    widget_class->realize = rstto_picture_viewer_realize;
-    widget_class->expose_event = rstto_picture_viewer_expose;
-    widget_class->size_request = rstto_picture_viewer_size_request;
-    widget_class->size_allocate = rstto_picture_viewer_size_allocate;
-
-    object_class->destroy = rstto_picture_viewer_destroy;
-
-    widget_class->set_scroll_adjustments_signal =
-                  g_signal_new ("set_scroll_adjustments",
-                                G_TYPE_FROM_CLASS (object_class),
-                                G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
-                                G_STRUCT_OFFSET (RsttoPictureViewerClass, set_scroll_adjustments),
-                                NULL, NULL,
-                                rstto_marshal_VOID__OBJECT_OBJECT,
-                                G_TYPE_NONE, 2,
-                                GTK_TYPE_ADJUSTMENT,
-                                GTK_TYPE_ADJUSTMENT);
-}
-
-/**
- * rstto_picture_viewer_realize:
- * @widget:
- *
- */
-static void
-rstto_picture_viewer_realize(GtkWidget *widget)
-{
-    GdkWindowAttr attributes;
-    gint attributes_mask;
-
-    g_return_if_fail (widget != NULL);
-    g_return_if_fail (RSTTO_IS_PICTURE_VIEWER(widget));
-
-    GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
-
-    attributes.x = widget->allocation.x;
-    attributes.y = widget->allocation.y;
-    attributes.width = widget->allocation.width;
-    attributes.height = widget->allocation.height;
-    attributes.wclass = GDK_INPUT_OUTPUT;
-    attributes.window_type = GDK_WINDOW_CHILD;
-    attributes.event_mask = gtk_widget_get_events (widget) | 
-    GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK;
-    attributes.visual = gtk_widget_get_visual (widget);
-    attributes.colormap = gtk_widget_get_colormap (widget);
-
-    attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
-    widget->window = gdk_window_new (gtk_widget_get_parent_window(widget), &attributes, attributes_mask);
-
-    widget->style = gtk_style_attach (widget->style, widget->window);
-    gdk_window_set_user_data (widget->window, widget);
-
-    gtk_style_set_background (widget->style, widget->window, GTK_STATE_ACTIVE);
-}
-
-/**
- * rstto_picture_viewer_size_request:
- * @widget:
- * @requisition:
- *
- * Request a default size of 300 by 400 pixels
- */
-static void
-rstto_picture_viewer_size_request(GtkWidget *widget, GtkRequisition *requisition)
-{
-    requisition->width = 400;
-    requisition->height= 300;
-}
-
-
-/**
- * rstto_picture_viewer_size_allocate:
- * @widget:
- * @allocation:
- *
- *
- */
-static void
-rstto_picture_viewer_size_allocate(GtkWidget *widget, GtkAllocation *allocation)
-{
-    RsttoPictureViewer *viewer = RSTTO_PICTURE_VIEWER(widget);
-    gint border_width =  0;
-    widget->allocation = *allocation;
-
-    if (GTK_WIDGET_REALIZED (widget))
-    {
-         gdk_window_move_resize (widget->window,
-            allocation->x + border_width,
-            allocation->y + border_width,
-            allocation->width - border_width * 2,
-            allocation->height - border_width * 2);
-    }
-
-    /** 
-     * TODO: Check if we really nead a refresh
-     */
-    rstto_picture_viewer_queued_repaint (viewer, TRUE);
-}
-
-/**
- * rstto_picture_viewer_expose:
- * @widget:
- * @event:
- *
- */
-static gboolean
-rstto_picture_viewer_expose(GtkWidget *widget, GdkEventExpose *event)
-{
-    RsttoPictureViewer *viewer = RSTTO_PICTURE_VIEWER (widget);
-
-    /** 
-     * TODO: Check if we really nead a refresh
-     */
-    rstto_picture_viewer_queued_repaint (viewer, TRUE);
-    return FALSE;
-}
-
-/**
- * rstto_picture_viewer_paint:
- * @widget:
- *
- * Paint the picture_viewer widget contents
- */
-static void
-rstto_picture_viewer_paint (GtkWidget *widget)
-{
-    RsttoSettings *settings_manager = rstto_settings_new();
-    RsttoPictureViewer *viewer = RSTTO_PICTURE_VIEWER(widget);
-    GdkPixbuf *pixbuf = viewer->priv->dst_pixbuf;
-    GdkColor color;
-    GdkColor line_color;
-    gint i, a, height, width;
-    GdkColor *bg_color = NULL;
-    gdouble m_x1, m_x2, m_y1, m_y2;
-    gint x1, x2, y1, y2;
-    GValue val_bg_color = {0, }, val_bg_color_override = {0, }, val_bg_color_fs = {0, };
-    g_value_init (&val_bg_color, GDK_TYPE_COLOR);
-    g_value_init (&val_bg_color_fs, GDK_TYPE_COLOR);
-    g_value_init (&val_bg_color_override, G_TYPE_BOOLEAN);
-
-    g_object_get_property (G_OBJECT(settings_manager), "bgcolor", &val_bg_color);
-    g_object_get_property (G_OBJECT(settings_manager), "bgcolor-override", &val_bg_color_override);
-
-    g_object_get_property (G_OBJECT(settings_manager), "bgcolor-fullscreen", &val_bg_color_fs);
-
-
-    color.pixel = 0x0;
-    line_color.pixel = 0x0;
-
-    /* required for transparent pixbufs... add double buffering to fix flickering*/
-    if(GTK_WIDGET_REALIZED(widget))
-    {          
-        GdkPixmap *buffer = gdk_pixmap_new(NULL, widget->allocation.width, widget->allocation.height, gdk_drawable_get_depth(widget->window));
-        GdkGC *gc = gdk_gc_new(GDK_DRAWABLE(buffer));
-
-        if(gdk_window_get_state(gdk_window_get_toplevel(GTK_WIDGET(viewer)->window)) & GDK_WINDOW_STATE_FULLSCREEN)
-        {
-           bg_color = g_value_get_boxed (&val_bg_color_fs);
-        }
-        else
-        {
-            if (g_value_get_boxed (&val_bg_color) && g_value_get_boolean (&val_bg_color_override))
-            {
-                bg_color = g_value_get_boxed (&val_bg_color);
-            }
-            else
-            {
-                bg_color = &(widget->style->bg[GTK_STATE_NORMAL]);
-            }
-        }
-        gdk_colormap_alloc_color (gdk_gc_get_colormap (gc), bg_color, FALSE, TRUE);
-        gdk_gc_set_rgb_fg_color (gc, bg_color);
-
-        gdk_draw_rectangle(GDK_DRAWABLE(buffer), gc, TRUE, 0, 0, widget->allocation.width, widget->allocation.height);
-
-        /* Check if there is a destination pixbuf */
-        if(pixbuf)
-        {
-            x1 = (widget->allocation.width-gdk_pixbuf_get_width(pixbuf))<0?0:(widget->allocation.width-gdk_pixbuf_get_width(pixbuf))/2;
-            y1 = (widget->allocation.height-gdk_pixbuf_get_height(pixbuf))<0?0:(widget->allocation.height-gdk_pixbuf_get_height(pixbuf))/2;
-            x2 = gdk_pixbuf_get_width(pixbuf);
-            y2 = gdk_pixbuf_get_height(pixbuf);
-            
-            /* We only need to paint a checkered background if the image is transparent */
-            if(gdk_pixbuf_get_has_alpha(pixbuf))
-            {
-                for(i = 0; i <= x2/10; i++)
-                {
-                    if(i == x2/10)
-                    {
-                        width = x2-10*i;
-                    }
-                    else
-                    {   
-                        width = 10;
-                    }
-                    for(a = 0; a <= y2/10; a++)
-                    {
-                        if(a%2?i%2:!(i%2))
-                            color.pixel = 0xcccccccc;
-                        else
-                            color.pixel = 0xdddddddd;
-                        gdk_gc_set_foreground(gc, &color);
-                        if(a == y2/10)
-                        {
-                            height = y2-10*a;
-                        }
-                        else
-                        {   
-                            height = 10;
-                        }
-
-                        gdk_draw_rectangle(GDK_DRAWABLE(buffer),
-                                        gc,
-                                        TRUE,
-                                        x1+10*i,
-                                        y1+10*a,
-                                        width,
-                                        height);
-                    }
-                }
-            }
-            gdk_draw_pixbuf(GDK_DRAWABLE(buffer), 
-                            NULL, 
-                            pixbuf,
-                            0,
-                            0,
-                            x1,
-                            y1,
-                            x2, 
-                            y2,
-                            GDK_RGB_DITHER_NONE,
-                            0,0);
-            if(viewer->priv->motion.state == RSTTO_PICTURE_VIEWER_MOTION_STATE_BOX_ZOOM)
-            {
-                gdk_gc_set_foreground(gc,
-                        &(widget->style->fg[GTK_STATE_SELECTED]));
-
-                if (viewer->priv->motion.x < viewer->priv->motion.current_x)
-                {
-                    m_x1 = viewer->priv->motion.x;
-                    m_x2 = viewer->priv->motion.current_x;
-                }
-                else
-                {
-                    m_x1 = viewer->priv->motion.current_x;
-                    m_x2 = viewer->priv->motion.x;
-                }
-                if (viewer->priv->motion.y < viewer->priv->motion.current_y)
-                {
-                    m_y1 = viewer->priv->motion.y;
-                    m_y2 = viewer->priv->motion.current_y;
-                }
-                else
-                {
-                    m_y1 = viewer->priv->motion.current_y;
-                    m_y2 = viewer->priv->motion.y;
-                }
-                if (m_y1 < y1)
-                    m_y1 = y1;
-                if (m_x1 < x1)
-                    m_x1 = x1;
-
-                if (m_x2 > x2 + x1)
-                    m_x2 = x2 + x1;
-                if (m_y2 > y2 + y1)
-                    m_y2 = y2 + y1;
-
-                if ((m_x2 - m_x1 >= 2) && (m_y2 - m_y1 >= 2))
-                {
-                    GdkPixbuf *sub = gdk_pixbuf_new_subpixbuf(pixbuf,
-                                                              m_x1-x1,
-                                                              m_y1-y1,
-                                                              m_x2-m_x1,
-                                                              m_y2-m_y1);
-                    if(sub)
-                    {
-                        sub = gdk_pixbuf_composite_color_simple(sub,
-                                                          m_x2-m_x1,
-                                                          m_y2-m_y1,
-                                                          GDK_INTERP_BILINEAR,
-                                                          200,
-                                                          200,
-                                                          widget->style->bg[GTK_STATE_SELECTED].pixel,
-                                                          widget->style->bg[GTK_STATE_SELECTED].pixel);
-
-                        gdk_draw_pixbuf(GDK_DRAWABLE(buffer),
-                                        gc,
-                                        sub,
-                                        0,0,
-                                        m_x1,
-                                        m_y1,
-                                        -1, -1,
-                                        GDK_RGB_DITHER_NONE,
-                                        0, 0);
-
-                        gdk_pixbuf_unref(sub);
-                        sub = NULL;
-                    }
-                }
-
-                gdk_draw_rectangle(GDK_DRAWABLE(buffer),
-                                gc,
-                                FALSE,
-                                m_x1,
-                                m_y1,
-                                m_x2 - m_x1,
-                                m_y2 - m_y1);
-            }
-
-        }
-        else
-        {
-
-            /* HACK HACK HACK HACK */
-            guint size = 0;
-            if ((GTK_WIDGET (viewer)->allocation.width) < (GTK_WIDGET (viewer)->allocation.height))
-            {
-                size = GTK_WIDGET (viewer)->allocation.width;
-            }
-            else
-            {
-                size = GTK_WIDGET (viewer)->allocation.height;
-            }
-            pixbuf = gtk_icon_theme_load_icon (gtk_icon_theme_get_default(), 
-                                               "ristretto", 
-                                               (size*0.8),
-                                               GTK_ICON_LOOKUP_FORCE_SIZE, NULL);
-            gdk_pixbuf_saturate_and_pixelate (pixbuf, pixbuf, 0, TRUE);
-            pixbuf = gdk_pixbuf_composite_color_simple (pixbuf, (size*0.8), (size*0.8), GDK_INTERP_BILINEAR, 40, 40, bg_color->pixel, bg_color->pixel);
-
-            x1 = (widget->allocation.width-gdk_pixbuf_get_width(pixbuf))<0?0:(widget->allocation.width-gdk_pixbuf_get_width(pixbuf))/2;
-            y1 = (widget->allocation.height-gdk_pixbuf_get_height(pixbuf))<0?0:(widget->allocation.height-gdk_pixbuf_get_height(pixbuf))/2;
-            x2 = gdk_pixbuf_get_width(pixbuf);
-            y2 = gdk_pixbuf_get_height(pixbuf);
-
-            gdk_draw_pixbuf(GDK_DRAWABLE(buffer), 
-                            NULL, 
-                            pixbuf,
-                            0,
-                            0,
-                            x1,
-                            y1,
-                            x2, 
-                            y2,
-                            GDK_RGB_DITHER_NONE,
-                            0,0);
-        }
-        gdk_draw_drawable(GDK_DRAWABLE(widget->window), 
-                        gdk_gc_new(widget->window), 
-                        buffer,
-                        0,
-                        0,
-                        0,
-                        0,
-                        widget->allocation.width,
-                        widget->allocation.height);
-        g_object_unref(buffer);
-   }
-   g_object_unref (settings_manager);
-}
-
-static void
-rstto_picture_viewer_destroy(GtkObject *object)
-{
-
-}
-
-static gboolean  
-rstto_picture_viewer_set_scroll_adjustments(RsttoPictureViewer *viewer, GtkAdjustment *hadjustment, GtkAdjustment *vadjustment)
-{
-    if(viewer->hadjustment)
-    {
-        g_signal_handlers_disconnect_by_func(viewer->hadjustment, viewer->priv->cb_value_changed, viewer);
-        g_object_unref(viewer->hadjustment);
-    }
-    if(viewer->vadjustment)
-    {
-        g_signal_handlers_disconnect_by_func(viewer->vadjustment, viewer->priv->cb_value_changed, viewer);
-        g_object_unref(viewer->vadjustment);
-    }
-
-    viewer->hadjustment = hadjustment;
-    viewer->vadjustment = vadjustment;
-
-    if(viewer->hadjustment)
-    {
-        g_signal_connect(G_OBJECT(viewer->hadjustment), "value-changed", (GCallback)viewer->priv->cb_value_changed, viewer);
-        g_object_ref(viewer->hadjustment);
-    }
-    if(viewer->vadjustment)
-    {
-        g_signal_connect(G_OBJECT(viewer->vadjustment), "value-changed", (GCallback)viewer->priv->cb_value_changed, viewer);
-        g_object_ref(viewer->vadjustment);
-    }
-    return TRUE;
-}
-
-static void
-cb_rstto_picture_viewer_value_changed(GtkAdjustment *adjustment, RsttoPictureViewer *viewer)
-{
-    /** 
-     * A new subpixbuf needs to be blown up
-     */
-    rstto_picture_viewer_queued_repaint (viewer, TRUE);
-}
-
-GtkWidget *
-rstto_picture_viewer_new (void)
-{
-    GtkWidget *widget;
-
-    widget = g_object_new(RSTTO_TYPE_PICTURE_VIEWER, NULL);
-
-    return widget;
-}
-
-void
-rstto_picture_viewer_set_scale (RsttoPictureViewer *viewer, gdouble scale)
-{
-    gdouble *img_scale;
-    GdkPixbuf *src_pixbuf = NULL;
-
-    if (viewer->priv->image)
-    {
-        src_pixbuf = rstto_image_get_pixbuf (viewer->priv->image);
-        img_scale = g_object_get_data (G_OBJECT (viewer->priv->image), "viewer-scale");
-
-        if (src_pixbuf)
-        {
-            gdouble image_width = (gdouble)rstto_image_get_width (viewer->priv->image);
-            gdouble image_height = (gdouble)rstto_image_get_height (viewer->priv->image);
-
-            viewer->hadjustment->upper = image_width *scale;
-            gtk_adjustment_changed(viewer->hadjustment);
-
-            viewer->vadjustment->upper = image_height * scale;
-            gtk_adjustment_changed(viewer->vadjustment);
-
-            viewer->hadjustment->value = (((viewer->hadjustment->value +
-                                          (viewer->hadjustment->page_size / 2)) *
-                                           (scale)) / (*img_scale)) - (viewer->hadjustment->page_size / 2);
-            viewer->vadjustment->value = (((viewer->vadjustment->value +
-                                          (viewer->vadjustment->page_size / 2)) *
-                                           (scale)) / (*img_scale)) - (viewer->vadjustment->page_size / 2);
-
-            if((viewer->hadjustment->value + viewer->hadjustment->page_size) > viewer->hadjustment->upper)
-            {
-                viewer->hadjustment->value = viewer->hadjustment->upper - viewer->hadjustment->page_size;
-            }
-            if(viewer->hadjustment->value < viewer->hadjustment->lower)
-            {
-                viewer->hadjustment->value = viewer->hadjustment->lower;
-            }
-            if((viewer->vadjustment->value + viewer->vadjustment->page_size) > viewer->vadjustment->upper)
-            {
-                viewer->vadjustment->value = viewer->vadjustment->upper - viewer->vadjustment->page_size;
-            }
-            if(viewer->vadjustment->value < viewer->vadjustment->lower)
-            {
-                viewer->vadjustment->value = viewer->vadjustment->lower;
-            }
-
-            gtk_adjustment_value_changed(viewer->hadjustment);
-            gtk_adjustment_value_changed(viewer->vadjustment);
-
-            /** 
-             * Set these settings at the end of the function, 
-             * since the old and new values are required in the above code
-             */
-            *img_scale = scale;
-
-            rstto_picture_viewer_queued_repaint (viewer, TRUE);
-        }
-    }
-}
-
-gdouble
-rstto_picture_viewer_get_scale(RsttoPictureViewer *viewer)
-{
-    gdouble *scale;
-    if (viewer->priv->image)
-    {
-        scale = g_object_get_data (G_OBJECT (viewer->priv->image), "viewer-scale");
-        return *scale;
-    }
-    return 0;
-}
-
-/**
- * rstto_picture_viewer_calculate_scale:
- * @viewer:
- *
- */
-static gdouble
-rstto_picture_viewer_calculate_scale (RsttoPictureViewer *viewer)
-{
-    gint width = 0, height = 0;
-
-    if (viewer->priv->image != NULL)
-    {   
-        switch(rstto_image_get_orientation (viewer->priv->image))
-        {
-            default:
-                width = rstto_image_get_width (viewer->priv->image);
-                height = rstto_image_get_height (viewer->priv->image);
-                break;
-            case RSTTO_IMAGE_ORIENT_270:
-            case RSTTO_IMAGE_ORIENT_90:
-                height = rstto_image_get_width (viewer->priv->image);
-                width = rstto_image_get_height (viewer->priv->image);
-                break;
-        }
-    }
-
-    if (width > 0 && height > 0)
-    {
-        if ((gdouble)(GTK_WIDGET (viewer)->allocation.width / (gdouble)width) <
-            ((gdouble)GTK_WIDGET (viewer)->allocation.height / (gdouble)height))
-        {
-            return (gdouble)GTK_WIDGET (viewer)->allocation.width / (gdouble)width;
-        }
-        else
-        {
-            return (gdouble)GTK_WIDGET (viewer)->allocation.height / (gdouble)height;
-        }
-    }
-    return -1;
-}
-
-static void
-cb_rstto_picture_viewer_scroll_event (RsttoPictureViewer *viewer, GdkEventScroll *event)
-{
-    /*
-    RsttoImageListEntry *entry = rstto_image_list_get_file(viewer->priv->image_list);
-
-    if (entry == NULL)
-    {
-        return;
-    }
-
-    gdouble scale = rstto_image_list_entry_get_scale(entry);
-    viewer->priv->zoom_mode = RSTTO_ZOOM_MODE_CUSTOM;
-    switch(event->direction)
-    {
-        case GDK_SCROLL_UP:
-        case GDK_SCROLL_LEFT:
-            if (scale= 0.05)
-                return;
-            if (viewer->priv->refresh.idle_id > 0)
-            {
-                g_source_remove(viewer->priv->refresh.idle_id);
-            }
-            rstto_image_list_entry_set_scale(entry, scale / 1.1);
-            rstto_image_list_entry_set_fit_to_screen (entry, FALSE);
-
-            viewer->vadjustment->value = ((viewer->vadjustment->value + event->y) / 1.1) - event->y;
-            viewer->hadjustment->value = ((viewer->hadjustment->value + event->x) / 1.1) - event->x;
-
-            viewer->priv->refresh.idle_id = g_idle_add((GSourceFunc)cb_rstto_picture_viewer_queued_repaint, viewer);
-            break;
-        case GDK_SCROLL_DOWN:
-        case GDK_SCROLL_RIGHT:
-            if (scale >= 16)
-                return;
-            if (viewer->priv->refresh.idle_id > 0)
-            {
-                g_source_remove(viewer->priv->refresh.idle_id);
-            }
-            rstto_image_list_entry_set_scale(entry, scale * 1.1);
-            rstto_image_list_entry_set_fit_to_screen (entry, FALSE);
->>>>>>> 9b75414e8bb4500c58635dd45ecb8f2f45266902:src/picture_viewer.c
-
-
-            viewer->vadjustment->value = ((viewer->vadjustment->value + event->y) * 1.1) - event->y;
-            viewer->hadjustment->value = ((viewer->hadjustment->value + event->x) * 1.1) - event->x;
-
-            gtk_adjustment_value_changed(viewer->hadjustment);
-            gtk_adjustment_value_changed(viewer->vadjustment);
-
-            viewer->priv->refresh.idle_id = g_idle_add((GSourceFunc)cb_rstto_picture_viewer_queued_repaint, viewer);
-            break;
-    }
-<<<<<<< HEAD:src/picture_viewer.c
-=======
-    */
-}
-
-static gboolean 
-cb_rstto_picture_viewer_motion_notify_event (RsttoPictureViewer *viewer,
-                                             GdkEventMotion *event,
-                                             gpointer user_data)
-{
-    if (event->state & GDK_BUTTON1_MASK)
-    {
-        viewer->priv->motion.current_x = event->x;
-        viewer->priv->motion.current_y = event->y;
-
-        switch (viewer->priv->motion.state)
-        {
-            case RSTTO_PICTURE_VIEWER_MOTION_STATE_MOVE:
-                if (viewer->priv->motion.x != viewer->priv->motion.current_x)
-                {
-                    gint val = viewer->hadjustment->value;
-                    viewer->hadjustment->value = viewer->priv->motion.h_val + (viewer->priv->motion.x - viewer->priv->motion.current_x);
-                    if((viewer->hadjustment->value + viewer->hadjustment->page_size) > viewer->hadjustment->upper)
-                    {
-                        viewer->hadjustment->value = viewer->hadjustment->upper - viewer->hadjustment->page_size;
-                    }
-                    if((viewer->hadjustment->value) < viewer->hadjustment->lower)
-                    {
-                        viewer->hadjustment->value = viewer->hadjustment->lower;
-                    }
-                    if (val != viewer->hadjustment->value)
-                        gtk_adjustment_value_changed(viewer->hadjustment);
-                }
-
-                if (viewer->priv->motion.y != viewer->priv->motion.current_y)
-                {
-                    gint val = viewer->vadjustment->value;
-                    viewer->vadjustment->value = viewer->priv->motion.v_val + (viewer->priv->motion.y - viewer->priv->motion.current_y);
-                    if((viewer->vadjustment->value + viewer->vadjustment->page_size) > viewer->vadjustment->upper)
-                    {
-                        viewer->vadjustment->value = viewer->vadjustment->upper - viewer->vadjustment->page_size;
-                    }
-                    if((viewer->vadjustment->value) < viewer->vadjustment->lower)
-                    {
-                        viewer->vadjustment->value = viewer->vadjustment->lower;
-                    }
-                    if (val != viewer->vadjustment->value)
-                        gtk_adjustment_value_changed(viewer->vadjustment);
-                }
-                break;
-            case RSTTO_PICTURE_VIEWER_MOTION_STATE_BOX_ZOOM:
-                rstto_picture_viewer_queued_repaint (viewer, FALSE);
-                break;
-            default:
-                break;
-        }
-    }
-    return FALSE;
-}
-
-static void
-rstto_picture_viewer_calculate_adjustments (RsttoPictureViewer *viewer, gdouble scale)
-{
-    GdkPixbuf *p_src_pixbuf;
-    GtkWidget *widget = GTK_WIDGET (viewer);
-    gdouble image_width, image_height;
-    gdouble pixbuf_width, pixbuf_height;
-    gdouble image_scale;
-    gboolean vadjustment_changed = FALSE;
-    gboolean hadjustment_changed = FALSE;
-
-    if (viewer->priv->image != NULL)
-    {   
-        p_src_pixbuf = rstto_image_get_pixbuf (viewer->priv->image);
-        if (p_src_pixbuf != NULL)
-        {
-            image_width = (gdouble)rstto_image_get_width (viewer->priv->image);
-            image_height = (gdouble)rstto_image_get_height (viewer->priv->image);
-
-            pixbuf_width = (gdouble)gdk_pixbuf_get_width (p_src_pixbuf);
-            pixbuf_height = (gdouble)gdk_pixbuf_get_height (p_src_pixbuf);
-
-            image_scale = pixbuf_width / image_width;
-
-            switch (rstto_image_get_orientation (viewer->priv->image))
-            {
-                default:
-                    if(viewer->hadjustment)
-                    {
-                        viewer->hadjustment->page_size = widget->allocation.width / image_scale;
-                        viewer->hadjustment->upper = image_width * (scale / image_scale);
-                        viewer->hadjustment->lower = 0;
-                        viewer->hadjustment->step_increment = 1;
-                        viewer->hadjustment->page_increment = 100;
-                        if((viewer->hadjustment->value + viewer->hadjustment->page_size) > viewer->hadjustment->upper)
-                        {
-                            viewer->hadjustment->value = viewer->hadjustment->upper - viewer->hadjustment->page_size;
-                            hadjustment_changed = TRUE;
-                        }
-                        if(viewer->hadjustment->value < viewer->hadjustment->lower)
-                        {
-                            viewer->hadjustment->value = viewer->hadjustment->lower;
-                            hadjustment_changed = TRUE;
-                        }
-                    }
-                    if(viewer->vadjustment)
-                    {
-                        viewer->vadjustment->page_size = widget->allocation.height / image_scale;
-                        viewer->vadjustment->upper = image_height * (scale / image_scale);
-                        viewer->vadjustment->lower = 0;
-                        viewer->vadjustment->step_increment = 1;
-                        viewer->vadjustment->page_increment = 100;
-                        if((viewer->vadjustment->value + viewer->vadjustment->page_size) > viewer->vadjustment->upper)
-                        {
-                            viewer->vadjustment->value = viewer->vadjustment->upper - viewer->vadjustment->page_size;
-                            vadjustment_changed = TRUE;
-                        }
-                        if(viewer->vadjustment->value < viewer->vadjustment->lower)
-                        {
-                            viewer->vadjustment->value = viewer->vadjustment->lower;
-                            vadjustment_changed = TRUE;
-                        }
-                    }
-                    break;
-                case RSTTO_IMAGE_ORIENT_270:
-                case RSTTO_IMAGE_ORIENT_90:
-                    if(viewer->hadjustment)
-                    {
-                        viewer->hadjustment->page_size = widget->allocation.width / image_scale;
-                        viewer->hadjustment->upper = image_height * (scale / image_scale);
-                        viewer->hadjustment->lower = 0;
-                        viewer->hadjustment->step_increment = 1;
-                        viewer->hadjustment->page_increment = 100;
-                        if((viewer->hadjustment->value + viewer->hadjustment->page_size) > viewer->hadjustment->upper)
-                        {
-                            viewer->hadjustment->value = viewer->hadjustment->upper - viewer->hadjustment->page_size;
-                            hadjustment_changed = TRUE;
-                        }
-                        if(viewer->hadjustment->value < viewer->hadjustment->lower)
-                        {
-                            viewer->hadjustment->value = viewer->hadjustment->lower;
-                            hadjustment_changed = TRUE;
-                        }
-                    }
-                    if(viewer->vadjustment)
-                    {
-                        viewer->vadjustment->page_size = widget->allocation.height / image_scale;
-                        viewer->vadjustment->upper = image_width * (scale / image_scale);
-                        viewer->vadjustment->lower = 0;
-                        viewer->vadjustment->step_increment = 1;
-                        viewer->vadjustment->page_increment = 100;
-                        if((viewer->vadjustment->value + viewer->vadjustment->page_size) > viewer->vadjustment->upper)
-                        {
-                            viewer->vadjustment->value = viewer->vadjustment->upper - viewer->vadjustment->page_size;
-                            vadjustment_changed = TRUE;
-                        }
-                        if(viewer->vadjustment->value < viewer->vadjustment->lower)
-                        {
-                            viewer->vadjustment->value = viewer->vadjustment->lower;
-                            vadjustment_changed = TRUE;
-                        }
-                    }
-                    break;
-            }
-
-            if (viewer->vadjustment && viewer->hadjustment)
-            {
-                gtk_adjustment_changed(viewer->hadjustment);
-                gtk_adjustment_changed(viewer->vadjustment);
-            }
-            if (hadjustment_changed == TRUE)
-                gtk_adjustment_value_changed(viewer->hadjustment);
-            if (vadjustment_changed == TRUE)
-                gtk_adjustment_value_changed(viewer->vadjustment);
-        }
-    }
-
-}
-
-static void
-rstto_picture_viewer_queued_repaint (RsttoPictureViewer *viewer, gboolean refresh)
-{
-    if (viewer->priv->repaint.idle_id > 0)
-    {
-        g_source_remove(viewer->priv->repaint.idle_id);
-    }
-    if (refresh)
-    {
-        viewer->priv->repaint.refresh = TRUE;
-    }
-    viewer->priv->repaint.idle_id = g_idle_add((GSourceFunc)cb_rstto_picture_viewer_queued_repaint, viewer);
-}
-
-static gboolean 
-cb_rstto_picture_viewer_queued_repaint (RsttoPictureViewer *viewer)
-{
-    GdkPixbuf *p_src_pixbuf = NULL;
-    GdkPixbuf *p_tmp_pixbuf = NULL;
-    GdkPixbuf *p_tmp_pixbuf2 = NULL;
-    gdouble *p_scale = NULL;
-    gboolean *p_fit_to_screen= NULL;
-    gdouble scale = 1;
-    gdouble image_scale = 1;
-    gdouble thumb_scale = 1;
-    gdouble thumb_width = 0;
-    gboolean fit_to_screen = FALSE;
-    gdouble image_width = 0, image_height = 0;
-    gdouble pixbuf_width, pixbuf_height;
-    GtkWidget *widget = GTK_WIDGET (viewer);
-
-    if (viewer->priv->image != NULL)
-    {   
-        image_width = (gdouble)rstto_image_get_width (viewer->priv->image);
-        image_height = (gdouble)rstto_image_get_height (viewer->priv->image);
-
-        switch (viewer->priv->state)
-        {
-            case RSTTO_PICTURE_VIEWER_STATE_NORMAL:
-                p_src_pixbuf = rstto_image_get_pixbuf (viewer->priv->image);
-                if (p_src_pixbuf)
-                {
-                    pixbuf_width = (gdouble)gdk_pixbuf_get_width (p_src_pixbuf);
-                    pixbuf_height = (gdouble)gdk_pixbuf_get_height (p_src_pixbuf);
-
-                    image_scale = pixbuf_width / image_width;
-                }
-                break;
-            case RSTTO_PICTURE_VIEWER_STATE_PREVIEW:
-                p_src_pixbuf = rstto_image_get_thumbnail (viewer->priv->image);
-                if (p_src_pixbuf)
-                {
-                    thumb_width = (gdouble)gdk_pixbuf_get_width (p_src_pixbuf);
-                    thumb_scale = (thumb_width / image_width);
-                }
-                else
-                    return FALSE;
-                break;
-            default:
-                break;
-        }
-
-        p_scale = g_object_get_data (G_OBJECT (viewer->priv->image), "viewer-scale");
-        p_fit_to_screen = g_object_get_data (G_OBJECT (viewer->priv->image), "viewer-fit-to-screen");
-        scale = *p_scale;
-        fit_to_screen = *p_fit_to_screen;
-
-        if ((scale <= 0) || (fit_to_screen == TRUE))
-        {
-            scale = rstto_picture_viewer_calculate_scale (viewer);
-            *p_fit_to_screen = TRUE;
-            *p_scale = scale;
-        }
-    }
-
-
-    rstto_picture_viewer_calculate_adjustments (viewer, scale);
-
-
-    if (viewer->priv->repaint.refresh)
-    {
-        if(viewer->priv->dst_pixbuf)
-        {
-            g_object_unref(viewer->priv->dst_pixbuf);
-            viewer->priv->dst_pixbuf = NULL;
-        }
-        if (p_src_pixbuf)
-        {
-            gdouble x, y;
-
-            switch (rstto_image_get_orientation (viewer->priv->image))
-            {
-                default:
-                case RSTTO_IMAGE_ORIENT_NONE:
-                    x = viewer->hadjustment->value * image_scale;
-                    y = viewer->vadjustment->value * image_scale;
-                    p_tmp_pixbuf = gdk_pixbuf_new_subpixbuf (p_src_pixbuf,
-                                               (gint)(x/scale * thumb_scale * image_scale), 
-                                               (gint)(y/scale * thumb_scale * image_scale),
-                                               (gint)((widget->allocation.width / scale) < image_width?
-                                                      (widget->allocation.width / scale)*thumb_scale*image_scale:image_width*thumb_scale*image_scale),
-                                               (gint)((widget->allocation.height / scale) < image_height?
-                                                      (widget->allocation.height / scale)*image_scale*thumb_scale:image_height*thumb_scale*image_scale));
-                    break;
-                case RSTTO_IMAGE_ORIENT_90:
-                    x = viewer->vadjustment->value * image_scale;
-                    y = (viewer->hadjustment->upper - (viewer->hadjustment->value + viewer->hadjustment->page_size)) * image_scale;
-                    if (y < 0) y = 0;
-                    //y = viewer->hadjustment->value * image_scale;
-                    p_tmp_pixbuf = gdk_pixbuf_new_subpixbuf (p_src_pixbuf,
-                                               (gint)(x/scale * thumb_scale * image_scale), 
-                                               (gint)(y/scale * thumb_scale * image_scale),
-                                               (gint)((widget->allocation.height/ scale) < image_width?
-                                                      (widget->allocation.height/ scale)*thumb_scale*image_scale:image_width*thumb_scale*image_scale),
-                                               (gint)((widget->allocation.width/ scale) < image_height?
-                                                      (widget->allocation.width/ scale)*image_scale*thumb_scale:image_height*thumb_scale*image_scale));
-                    if (p_tmp_pixbuf)
-                    {
-                        p_tmp_pixbuf2 = gdk_pixbuf_rotate_simple (p_tmp_pixbuf, GDK_PIXBUF_ROTATE_CLOCKWISE);
-                        g_object_unref (p_tmp_pixbuf);
-                        p_tmp_pixbuf = p_tmp_pixbuf2;
-                    }
-                    break;
-                case RSTTO_IMAGE_ORIENT_180:
-                    x = (viewer->hadjustment->upper - (viewer->hadjustment->value + viewer->hadjustment->page_size)) * image_scale;
-                    if (x < 0) x = 0;
-                    y = (viewer->vadjustment->upper - (viewer->vadjustment->value + viewer->vadjustment->page_size)) * image_scale;
-                    if (y < 0) y = 0;
-                    //y = viewer->hadjustment->value * image_scale;
-                    p_tmp_pixbuf = gdk_pixbuf_new_subpixbuf (p_src_pixbuf,
-                                               (gint)(x/scale * thumb_scale * image_scale), 
-                                               (gint)(y/scale * thumb_scale * image_scale),
-                                               (gint)((widget->allocation.width / scale) < image_width?
-                                                      (widget->allocation.width / scale)*thumb_scale*image_scale:image_width*thumb_scale*image_scale),
-                                               (gint)((widget->allocation.height/ scale) < image_width?
-                                                      (widget->allocation.height/ scale)*image_scale*thumb_scale:image_height*thumb_scale*image_scale));
-                    if (p_tmp_pixbuf)
-                    {
-                        p_tmp_pixbuf2 = gdk_pixbuf_rotate_simple (p_tmp_pixbuf, GDK_PIXBUF_ROTATE_UPSIDEDOWN);
-                        g_object_unref (p_tmp_pixbuf);
-                        p_tmp_pixbuf = p_tmp_pixbuf2;
-                    }
-                    break;
-                case RSTTO_IMAGE_ORIENT_270:
-                    x = (viewer->vadjustment->upper - (viewer->vadjustment->value + viewer->vadjustment->page_size)) * image_scale;
-                    if (x < 0) x = 0;
-                    y = viewer->hadjustment->value * image_scale;
-                    p_tmp_pixbuf = gdk_pixbuf_new_subpixbuf (p_src_pixbuf,
-                                               (gint)(x/scale * thumb_scale * image_scale), 
-                                               (gint)(y/scale * thumb_scale * image_scale),
-                                               (gint)((widget->allocation.height/ scale) < image_width?
-                                                      (widget->allocation.height/ scale)*thumb_scale*image_scale:image_width*thumb_scale*image_scale),
-                                               (gint)((widget->allocation.width/ scale) < image_height?
-                                                      (widget->allocation.width/ scale)*image_scale*thumb_scale:image_height*thumb_scale*image_scale));
-                    if (p_tmp_pixbuf)
-                    {
-                        p_tmp_pixbuf2 = gdk_pixbuf_rotate_simple (p_tmp_pixbuf, GDK_PIXBUF_ROTATE_COUNTERCLOCKWISE);
-                        g_object_unref (p_tmp_pixbuf);
-                        p_tmp_pixbuf = p_tmp_pixbuf2;
-                    }
-                    break;
-            }
-            /**
-             *  tmp_scale is the factor between the original image and the thumbnail,
-             *  when looking at the actual image, tmp_scale == 1.0
-             */
-            /*
-            gdouble x = viewer->hadjustment->value * image_scale;
-            gdouble y = viewer->vadjustment->value * image_scale;
-
-            p_tmp_pixbuf = gdk_pixbuf_new_subpixbuf (p_src_pixbuf,
-                                               (gint)(x/scale * thumb_scale * image_scale), 
-                                               (gint)(y/scale * thumb_scale * image_scale),
-                                               (gint)((widget->allocation.width / scale) < image_width?
-                                                      (widget->allocation.width / scale)*thumb_scale*image_scale:image_width*thumb_scale*image_scale),
-                                               (gint)((widget->allocation.height / scale) < image_height?
-                                                      (widget->allocation.height / scale)*image_scale*thumb_scale:image_height*thumb_scale*image_scale));
-            */
-
-            if(p_tmp_pixbuf)
-            {
-                gint dst_width = gdk_pixbuf_get_width (p_tmp_pixbuf)*(scale/thumb_scale/image_scale);
-                gint dst_height = gdk_pixbuf_get_height (p_tmp_pixbuf)*(scale/thumb_scale/image_scale);
-                viewer->priv->dst_pixbuf = gdk_pixbuf_scale_simple (p_tmp_pixbuf,
-                                        dst_width>0?dst_width:1,
-                                        dst_height>0?dst_height:1,
-                                        GDK_INTERP_BILINEAR);
-                g_object_unref (p_tmp_pixbuf);
-                p_tmp_pixbuf = NULL;
-            }
-        }
-    }
-
-
-    rstto_picture_viewer_paint (GTK_WIDGET (viewer));
-
-    g_source_remove (viewer->priv->repaint.idle_id);
-    viewer->priv->repaint.idle_id = -1;
-    viewer->priv->repaint.refresh = FALSE;
-    return FALSE;
-}
-
-static RsttoPictureViewerState
-rstto_picture_viewer_get_state (RsttoPictureViewer *viewer)
-{
-    return viewer->priv->state;
-}
-
-
-static void
-rstto_picture_viewer_set_state (RsttoPictureViewer *viewer, RsttoPictureViewerState state)
-{
-    viewer->priv->state = state;
-}
-
-static void
-rstto_picture_viewer_set_motion_state (RsttoPictureViewer *viewer, RsttoPictureViewerMotionState state)
-{
-    viewer->priv->motion.state = state;
-}
-
-static RsttoPictureViewerMotionState
-rstto_picture_viewer_get_motion_state (RsttoPictureViewer *viewer)
-{
-    return viewer->priv->motion.state;
-}
-
-static void
-cb_rstto_picture_viewer_button_press_event (RsttoPictureViewer *viewer, GdkEventButton *event)
-{
-    if(event->button == 1)
-    {
-        viewer->priv->motion.x = event->x;
-        viewer->priv->motion.y = event->y;
-        viewer->priv->motion.current_x = event->x;
-        viewer->priv->motion.current_y = event->y;
-        viewer->priv->motion.h_val = viewer->hadjustment->value;
-        viewer->priv->motion.v_val = viewer->vadjustment->value;
-
-        if (viewer->priv->image != NULL && rstto_picture_viewer_get_state (viewer) == RSTTO_PICTURE_VIEWER_STATE_NORMAL)
-        {
-
-            if (!(event->state & (GDK_CONTROL_MASK)))
-            {
-                GtkWidget *widget = GTK_WIDGET(viewer);
-                GdkCursor *cursor = gdk_cursor_new(GDK_FLEUR);
-                gdk_window_set_cursor(widget->window, cursor);
-                gdk_cursor_unref(cursor);
-
-                rstto_picture_viewer_set_motion_state (viewer, RSTTO_PICTURE_VIEWER_MOTION_STATE_MOVE);
-            }
-
-            if (event->state & GDK_CONTROL_MASK)
-            {
-                GtkWidget *widget = GTK_WIDGET(viewer);
-                GdkCursor *cursor = gdk_cursor_new(GDK_UL_ANGLE);
-                gdk_window_set_cursor(widget->window, cursor);
-                gdk_cursor_unref(cursor);
-
-                rstto_picture_viewer_set_motion_state (viewer, RSTTO_PICTURE_VIEWER_MOTION_STATE_BOX_ZOOM);
-            }
-        }
-
-        
-    }
-    if(event->button == 3)
-    {
-        if (viewer->priv->menu)
-        {
-            gtk_widget_show_all(GTK_WIDGET(viewer->priv->menu));
-            gtk_menu_popup(viewer->priv->menu,
-                           NULL,
-                           NULL,
-                           NULL,
-                           NULL,
-                           3,
-                           event->time);
-        }
-    }
-}
-
-static void
-cb_rstto_picture_viewer_button_release_event (RsttoPictureViewer *viewer, GdkEventButton *event)
-{
-    GtkWidget *widget = GTK_WIDGET(viewer);
-    switch (event->button)
-    {
-        case 1:
-            gdk_window_set_cursor(widget->window, NULL);
-            switch (rstto_picture_viewer_get_motion_state (viewer))
-            {
-                case RSTTO_PICTURE_VIEWER_MOTION_STATE_BOX_ZOOM:
-                    rstto_picture_viewer_set_zoom_mode (viewer, RSTTO_ZOOM_MODE_CUSTOM);
-                    if(GTK_WIDGET_REALIZED(widget))
-                    {
-
-                    }
-                    break;
-                default:
-                    break;
-            }
-            rstto_picture_viewer_set_motion_state (viewer, RSTTO_PICTURE_VIEWER_MOTION_STATE_NORMAL);
-            rstto_picture_viewer_queued_repaint (viewer, FALSE);
-            break;
-    }
-
-}
-
-static void
-cb_rstto_picture_viewer_popup_menu (RsttoPictureViewer *viewer, gboolean user_data)
-{
-    if (viewer->priv->menu)
-    {
-        gtk_widget_show_all(GTK_WIDGET(viewer->priv->menu));
-        gtk_menu_popup(viewer->priv->menu,
-                       NULL,
-                       NULL,
-                       NULL,
-                       NULL,
-                       0,
-                       gtk_get_current_event_time());
-    }
-}
-
-void
-rstto_picture_viewer_set_menu (RsttoPictureViewer *viewer, GtkMenu *menu)
-{
-    if (viewer->priv->menu)
-    {
-        gtk_menu_detach (viewer->priv->menu);
-        gtk_widget_destroy (GTK_WIDGET(viewer->priv->menu));
-    }
-
-    viewer->priv->menu = menu;
-
-    if (viewer->priv->menu)
-    {
-        gtk_menu_attach_to_widget (viewer->priv->menu, GTK_WIDGET(viewer), NULL);
-    }
-}
-
-static void
-rstto_picture_viewer_set_zoom_mode(RsttoPictureViewer *viewer, RsttoZoomMode mode)
-{
-    gdouble scale;
-    gboolean *p_fit_to_screen;
-    viewer->priv->zoom_mode = mode;
-
-    switch (viewer->priv->zoom_mode)
-    {
-        case RSTTO_ZOOM_MODE_CUSTOM:
-            if (viewer->priv->image)
-            {
-                p_fit_to_screen = g_object_get_data (G_OBJECT (viewer->priv->image), "viewer-fit-to-screen");
-                *p_fit_to_screen = FALSE;
-                g_object_set_data (G_OBJECT (viewer->priv->image), "viewer-fit-to-screen", p_fit_to_screen);
-            }
-            break;
-        case RSTTO_ZOOM_MODE_FIT:
-            if (viewer->priv->image)
-            {
-                p_fit_to_screen = g_object_get_data (G_OBJECT (viewer->priv->image), "viewer-fit-to-screen");
-                *p_fit_to_screen = TRUE;
-                g_object_set_data (G_OBJECT (viewer->priv->image), "viewer-fit-to-screen", p_fit_to_screen);
-            }
-            scale = rstto_picture_viewer_calculate_scale (viewer);
-            if (scale != -1.0)
-                rstto_picture_viewer_set_scale (viewer, scale);
-            break;
-        case RSTTO_ZOOM_MODE_100:
-            if (viewer->priv->image)
-            {
-                p_fit_to_screen = g_object_get_data (G_OBJECT (viewer->priv->image), "viewer-fit-to-screen");
-                *p_fit_to_screen = FALSE;
-                g_object_set_data (G_OBJECT (viewer->priv->image), "viewer-fit-to-screen", p_fit_to_screen);
-            }
-            rstto_picture_viewer_set_scale (viewer, 1);
-            break;
-    }
-}
-
-/**
- *  rstto_picture_viewer_set_image:
- *  @viewer :
- *  @image  :
- *
- *
- */
-static void
-rstto_picture_viewer_set_image (RsttoPictureViewer *viewer, RsttoImage *image)
-{
-    gdouble *scale = NULL;
-    gboolean *fit_to_screen = NULL;
-
-    RsttoSettings *settings_manager = rstto_settings_new();
-    GValue max_size = {0,};
-
-    g_value_init (&max_size, G_TYPE_UINT);
-    g_object_get_property (G_OBJECT(settings_manager), "image-quality", &max_size);
-
-    if (viewer->priv->image)
-    {
-        g_signal_handlers_disconnect_by_func (viewer->priv->image, cb_rstto_picture_viewer_image_updated, viewer);
-        g_signal_handlers_disconnect_by_func (viewer->priv->image, cb_rstto_picture_viewer_image_prepared, viewer);
-        g_object_remove_weak_pointer (G_OBJECT (viewer->priv->image), (gpointer *)&viewer->priv->image);
-    }
-
-    viewer->priv->image = image;
-
-    if (viewer->priv->image)
-    {
-        g_object_add_weak_pointer (G_OBJECT (viewer->priv->image), (gpointer *)&viewer->priv->image);
-
-        g_signal_connect (G_OBJECT (viewer->priv->image), "updated", G_CALLBACK (cb_rstto_picture_viewer_image_updated), viewer);
-        g_signal_connect (G_OBJECT (viewer->priv->image), "prepared", G_CALLBACK (cb_rstto_picture_viewer_image_prepared), viewer);
-
-        scale = g_object_get_data (G_OBJECT (viewer->priv->image), "viewer-scale");
-        fit_to_screen = g_object_get_data (G_OBJECT (viewer->priv->image), "viewer-fit-to-screen");
-
-        if (scale == NULL)
-        {
-            scale = g_new0 (gdouble, 1);
-            *scale = -1.0;
-            g_object_set_data (G_OBJECT (viewer->priv->image), "viewer-scale", scale);
-        }
-        if (fit_to_screen == NULL)
-        {
-            fit_to_screen = g_new0 (gboolean, 1);
-            g_object_set_data (G_OBJECT (viewer->priv->image), "viewer-fit-to-screen", fit_to_screen);
-        }
-
-        rstto_image_load (viewer->priv->image, FALSE, g_value_get_uint (&max_size), FALSE, NULL);
-    }
-    else
-    {
-        rstto_picture_viewer_queued_repaint (viewer, TRUE);
-    }
-    g_object_unref (settings_manager);
-}
-
-/**
- * cb_rstto_picture_viewer_image_updated:
- * @image:
- * @viewer:
- *
- */
-static void
-cb_rstto_picture_viewer_image_updated (RsttoImage *image, RsttoPictureViewer *viewer)
-{
-    rstto_picture_viewer_set_state (viewer, RSTTO_PICTURE_VIEWER_STATE_NORMAL);
-
-    rstto_picture_viewer_queued_repaint (viewer, TRUE);
-}
-
-/**
- * cb_rstto_picture_viewer_image_prepared:
- * @image:
- * @viewer:
- *
- */
-static void
-cb_rstto_picture_viewer_image_prepared (RsttoImage *image, RsttoPictureViewer *viewer)
-{
-    rstto_picture_viewer_set_state (viewer, RSTTO_PICTURE_VIEWER_STATE_PREVIEW);
-
-    rstto_picture_viewer_queued_repaint (viewer, TRUE);
-}
-
-/**
- * rstto_picture_viewer_zoom_fit:
- * @window:
- *
- * Adjust the scale to make the image fit the window
- */
-void
-rstto_picture_viewer_zoom_fit (RsttoPictureViewer *viewer)
-{
-    rstto_picture_viewer_set_zoom_mode (viewer, RSTTO_ZOOM_MODE_FIT);
-}
-
-/**
- * rstto_picture_viewer_zoom_100:
- * @viewer:
- *
- * Set the scale to 1, meaning a zoom-factor of 100%
- */
-void
-rstto_picture_viewer_zoom_100 (RsttoPictureViewer *viewer)
-{
-    rstto_picture_viewer_set_zoom_mode (viewer, RSTTO_ZOOM_MODE_100);
-}
-
-/**
- * rstto_picture_viewer_zoom_in:
- * @viewer:
- * @factor:
- *
- * Zoom in the scale with a certain factor
- */
-void
-rstto_picture_viewer_zoom_in (RsttoPictureViewer *viewer, gdouble factor)
-{
-    gdouble scale;
-
-    rstto_picture_viewer_set_zoom_mode (viewer, RSTTO_ZOOM_MODE_CUSTOM);
-    scale = rstto_picture_viewer_get_scale (viewer);
-    rstto_picture_viewer_set_scale (viewer, scale * factor);
-}
-
-/**
- * rstto_picture_viewer_zoom_out:
- * @viewer:
- * @factor:
- *
- * Zoom out the scale with a certain factor
- */
-void
-rstto_picture_viewer_zoom_out (RsttoPictureViewer *viewer, gdouble factor)
-{
-    gdouble scale;
-
-    rstto_picture_viewer_set_zoom_mode (viewer, RSTTO_ZOOM_MODE_CUSTOM);
-    scale = rstto_picture_viewer_get_scale (viewer);
-    rstto_picture_viewer_set_scale (viewer, scale / factor);
-}
-
-
-/******************************************************************************************/
-
-
-void
-rstto_picture_viewer_set_iter (RsttoPictureViewer *viewer, RsttoImageListIter *iter)
-{
-    if (viewer->priv->iter)
-    {
-        g_signal_handlers_disconnect_by_func (viewer->priv->iter, cb_rstto_picture_viewer_nav_iter_changed, viewer);
-        g_object_unref (viewer->priv->iter);
-        viewer->priv->iter = NULL;
-    }
-    if (iter)
-    {
-        viewer->priv->iter = iter;
-        g_object_ref (viewer->priv->iter);
-        g_signal_connect (G_OBJECT (viewer->priv->iter), "changed", G_CALLBACK (cb_rstto_picture_viewer_nav_iter_changed), viewer);
-    }
-}
-
-static void
-cb_rstto_picture_viewer_nav_iter_changed (RsttoImageListIter *iter, gpointer user_data)
-{
-    RsttoPictureViewer *viewer = RSTTO_PICTURE_VIEWER (user_data);
-    rstto_picture_viewer_set_image (viewer, rstto_image_list_iter_get_image (iter));
-}
diff --git a/src/picture_viewer.h b/src/picture_viewer.h
deleted file mode 100644
index 655a012..0000000
--- a/src/picture_viewer.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- *  Copyright (C) Stephan Arts 2006-2009 <stephan at xfce.org>
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU Library General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#ifndef __RISTRETTO_PICTURE_VIEWER_H__
-#define __RISTRETTO_PICTURE_VIEWER_H__
-
-G_BEGIN_DECLS
-
-#define RSTTO_TYPE_PICTURE_VIEWER rstto_picture_viewer_get_type()
-
-#define RSTTO_PICTURE_VIEWER(obj)( \
-        G_TYPE_CHECK_INSTANCE_CAST ((obj), \
-                RSTTO_TYPE_PICTURE_VIEWER, \
-                RsttoPictureViewer))
-
-#define RSTTO_IS_PICTURE_VIEWER(obj)( \
-        G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
-                RSTTO_TYPE_PICTURE_VIEWER))
-
-#define RSTTO_PICTURE_VIEWER_CLASS(klass)( \
-        G_TYPE_CHECK_CLASS_CAST ((klass), \
-                RSTTO_TYPE_PICTURE_VIEWER, \
-                RsttoPictureViewerClass))
-
-#define RSTTO_IS_PICTURE_VIEWER_CLASS(klass)( \
-        G_TYPE_CHECK_CLASS_TYPE ((klass), \
-                RSTTO_TYPE_PICTURE_VIEWER()))
-
-typedef struct _RsttoPictureViewerPriv RsttoPictureViewerPriv;
-
-typedef struct _RsttoPictureViewer RsttoPictureViewer;
-
-struct _RsttoPictureViewer
-{
-    GtkWidget         parent;
-    RsttoPictureViewerPriv *priv;
-
-    GtkAdjustment    *vadjustment;
-    GtkAdjustment    *hadjustment;
-};
-
-typedef struct _RsttoPictureViewerClass RsttoPictureViewerClass;
-
-struct _RsttoPictureViewerClass
-{
-    GtkWidgetClass  parent_class;
-
-    gboolean (* set_scroll_adjustments) (RsttoPictureViewer *viewer,
-          GtkAdjustment     *hadjustment,
-          GtkAdjustment     *vadjustment);
-};
-
-GType      rstto_picture_viewer_get_type();
-
-GtkWidget *rstto_picture_viewer_new ();
-void       rstto_picture_viewer_set_iter (RsttoPictureViewer *, RsttoImageListIter *);
-gdouble    rstto_picture_viewer_get_scale(RsttoPictureViewer *viewer);
-void       rstto_picture_viewer_set_scale (RsttoPictureViewer *,gdouble);
-
-void       rstto_picture_viewer_zoom_fit (RsttoPictureViewer *viewer);
-void       rstto_picture_viewer_zoom_100 (RsttoPictureViewer *viewer);
-void       rstto_picture_viewer_zoom_in  (RsttoPictureViewer *viewer, gdouble factor);
-void       rstto_picture_viewer_zoom_out (RsttoPictureViewer *viewer, gdouble factor);
-
-void       rstto_picture_viewer_set_menu (RsttoPictureViewer *viewer, GtkMenu *menu);
-
-/**
-gdouble    rstto_picture_viewer_fit_scale(RsttoPictureViewer *viewer);
-
-void       rstto_picture_viewer_set_menu (RsttoPictureViewer *viewer, GtkMenu *menu);
-void       rstto_picture_viewer_set_bg_color (RsttoPictureViewer *viewer, const GdkColor *color);
-const GdkColor *
-rstto_picture_viewer_get_bg_color (RsttoPictureViewer *viewer);
-
-void       rstto_picture_viewer_redraw (RsttoPictureViewer *viewer);
-*/
-
-G_END_DECLS
-
-#endif /* __RISTRETTO_PICTURE_VIEWER_H__ */
diff --git a/src/preferences_dialog.c b/src/preferences_dialog.c
deleted file mode 100644
index 4b34610..0000000
--- a/src/preferences_dialog.c
+++ /dev/null
@@ -1,523 +0,0 @@
-/*
- *  Copyright (C) Stephan Arts 2009 <stephan at xfce.org>
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU Library General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#include <config.h>
-#include <gtk/gtk.h>
-#include <libxfcegui4/libxfcegui4.h>
-#include <libxfce4util/libxfce4util.h>
-
-#include "settings.h"
-#include "preferences_dialog.h"
-
-#ifndef RSTTO_MIN_CACHE_SIZE
-#define RSTTO_MIN_CACHE_SIZE 16
-#endif
-
-#ifndef RSTTO_DEFAULT_CACHE_SIZE
-#define RSTTO_DEFAULT_CACHE_SIZE 256
-#endif
-
-static void
-rstto_preferences_dialog_init(RsttoPreferencesDialog *);
-static void
-rstto_preferences_dialog_class_init(RsttoPreferencesDialogClass *);
-
-
-static void
-cb_rstto_preferences_dialog_bgcolor_override_toggled (GtkToggleButton *, gpointer);
-static void
-cb_rstto_preferences_dialog_bgcolor_color_set (GtkColorButton *, gpointer);
-static void
-cb_rstto_preferences_dialog_cache_check_button_toggled (GtkToggleButton *, gpointer);
-static void
-cb_rstto_preferences_dialog_cache_preload_hscale_value_changed (GtkRange *range, 
-                                                                gpointer user_data);
-static void
-cb_rstto_preferences_dialog_cache_spin_button_value_changed (GtkSpinButton *, gpointer);
-static void
-cb_rstto_preferences_dialog_image_quality_combo_box_changed (GtkComboBox *, gpointer);
-
-static GtkWidgetClass *parent_class = NULL;
-
-struct _RsttoPreferencesDialogPriv
-{
-    RsttoSettings *settings;
-
-    struct
-    {
-        GtkWidget *bgcolor_frame;
-        GtkWidget *bgcolor_vbox;
-        GtkWidget *bgcolor_hbox;
-        GtkWidget *bgcolor_color_button;
-        GtkWidget *bgcolor_override_check_button;
-
-
-        GtkWidget *image_quality_frame;
-        GtkWidget *image_quality_vbox;
-        GtkWidget *image_quality_hbox;
-        GtkWidget *image_quality_label;
-        GtkWidget *image_quality_combo;
-    } display_tab;
-
-    struct
-    {
-    } control_tab;
-
-    struct
-    {
-        GtkWidget *cache_frame;
-        GtkWidget *cache_vbox;
-        GtkWidget *cache_sub_vbox;
-        GtkWidget *cache_hbox;
-        GtkWidget *cache_size_label;
-        GtkWidget *cache_size_unit;
-        GtkWidget *cache_check_button;
-        GtkWidget *cache_alignment;
-        GtkWidget *cache_spin_button;
-        GtkWidget *cache_preload_label;
-        GtkWidget *cache_preload_hscale;
-    } behaviour_tab;
-};
-
-GType
-rstto_preferences_dialog_get_type (void)
-{
-    static GType rstto_preferences_dialog_type = 0;
-
-    if (!rstto_preferences_dialog_type)
-    {
-        static const GTypeInfo rstto_preferences_dialog_info = 
-        {
-            sizeof (RsttoPreferencesDialogClass),
-            (GBaseInitFunc) NULL,
-            (GBaseFinalizeFunc) NULL,
-            (GClassInitFunc) rstto_preferences_dialog_class_init,
-            (GClassFinalizeFunc) NULL,
-            NULL,
-            sizeof (RsttoPreferencesDialog),
-            0,
-            (GInstanceInitFunc) rstto_preferences_dialog_init,
-            NULL
-        };
-
-        rstto_preferences_dialog_type = g_type_register_static (XFCE_TYPE_TITLED_DIALOG, "RsttoPreferencesDialog", &rstto_preferences_dialog_info, 0);
-    }
-    return rstto_preferences_dialog_type;
-}
-
-static void
-rstto_preferences_dialog_init(RsttoPreferencesDialog *dialog)
-{
-    guint uint_image_quality;
-    guint uint_cache_size;
-    guint uint_preload_images;
-    gboolean bool_enable_cache;
-    gboolean bool_bgcolor_override;
-    GdkColor *bgcolor;
-    GtkWidget *scroll_frame, *scroll_vbox;
-    GtkWidget *timeout_frame, *timeout_vbox, *timeout_lbl, *timeout_hscale;
-    GtkWidget *scaling_frame, *scaling_vbox;
-    GtkWidget *widget;
-    GtkObject *cache_adjustment;
-    GtkWidget *display_main_vbox;
-    GtkWidget *display_main_lbl;
-    GtkWidget *slideshow_main_vbox;
-    GtkWidget *slideshow_main_lbl;
-    GtkWidget *control_main_vbox;
-    GtkWidget *control_main_lbl;
-    GtkWidget *behaviour_main_vbox;
-    GtkWidget *behaviour_main_lbl;
-    GtkWidget *notebook = gtk_notebook_new ();
-
-
-    dialog->priv = g_new0 (RsttoPreferencesDialogPriv, 1);
-
-    dialog->priv->settings = rstto_settings_new ();
-    g_object_get (G_OBJECT (dialog->priv->settings),
-                  "image-quality", &uint_image_quality,
-                  "cache-size", &uint_cache_size,
-                  "preload-images", &uint_preload_images,
-                  "enable-cache", &bool_enable_cache,
-                  "bgcolor-override", &bool_bgcolor_override,
-                  "bgcolor", &bgcolor,
-                  NULL);
-
-/*****************/
-/** DISPLAY TAB **/
-/*****************/
-    display_main_vbox = gtk_vbox_new(FALSE, 0);
-    display_main_lbl = gtk_label_new(_("Display"));
-    gtk_notebook_append_page(GTK_NOTEBOOK(notebook), display_main_vbox, display_main_lbl);
-
-/** Bg-color frame */
-    dialog->priv->display_tab.bgcolor_vbox = gtk_vbox_new (FALSE, 0);
-    dialog->priv->display_tab.bgcolor_frame = xfce_create_framebox_with_content (_("Background color"),
-                                                                                 dialog->priv->display_tab.bgcolor_vbox);
-    gtk_box_pack_start (GTK_BOX (display_main_vbox), dialog->priv->display_tab.bgcolor_frame, FALSE, FALSE, 0);
-
-    dialog->priv->display_tab.bgcolor_override_check_button = gtk_check_button_new_with_label (_("Override background color:"));
-    dialog->priv->display_tab.bgcolor_hbox = gtk_hbox_new (FALSE, 4);
-    dialog->priv->display_tab.bgcolor_color_button = gtk_color_button_new();
-
-    gtk_box_pack_start (GTK_BOX (dialog->priv->display_tab.bgcolor_hbox), 
-                        dialog->priv->display_tab.bgcolor_override_check_button, FALSE, FALSE, 0);
-    gtk_box_pack_start (GTK_BOX (dialog->priv->display_tab.bgcolor_hbox),
-                        dialog->priv->display_tab.bgcolor_color_button, FALSE, FALSE, 0);
-    gtk_box_pack_start (GTK_BOX (dialog->priv->display_tab.bgcolor_vbox), 
-                        dialog->priv->display_tab.bgcolor_hbox, FALSE, FALSE, 0);
-
-    /* set current value */
-    gtk_color_button_set_color (GTK_COLOR_BUTTON (dialog->priv->display_tab.bgcolor_color_button),
-                                bgcolor);
-
-    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->priv->display_tab.bgcolor_override_check_button),
-                                  bool_bgcolor_override);
-    gtk_widget_set_sensitive (GTK_WIDGET (dialog->priv->display_tab.bgcolor_color_button),
-                              bool_bgcolor_override);
-    
-    /* connect signals */
-    g_signal_connect (G_OBJECT (dialog->priv->display_tab.bgcolor_override_check_button), 
-                      "toggled", (GCallback)cb_rstto_preferences_dialog_bgcolor_override_toggled, dialog);
-    g_signal_connect (G_OBJECT (dialog->priv->display_tab.bgcolor_color_button), 
-                      "color-set", G_CALLBACK (cb_rstto_preferences_dialog_bgcolor_color_set), dialog);
-
-/** Image-quality frame */
-    dialog->priv->display_tab.image_quality_vbox = gtk_vbox_new(FALSE, 0);
-    dialog->priv->display_tab.image_quality_frame = xfce_create_framebox_with_content (_("Quality"),
-                                                                                 dialog->priv->display_tab.image_quality_vbox);
-    gtk_box_pack_start (GTK_BOX (display_main_vbox), dialog->priv->display_tab.image_quality_frame, FALSE, FALSE, 0);
-
-    dialog->priv->display_tab.image_quality_label = gtk_label_new (_("Maximum render quality:"));
-    dialog->priv->display_tab.image_quality_hbox= gtk_hbox_new (FALSE, 4);
-    dialog->priv->display_tab.image_quality_combo= gtk_combo_box_new_text ();
-
-    gtk_combo_box_append_text (GTK_COMBO_BOX (dialog->priv->display_tab.image_quality_combo), _("Really High"));
-    gtk_combo_box_append_text (GTK_COMBO_BOX (dialog->priv->display_tab.image_quality_combo), _("High"));
-    gtk_combo_box_append_text (GTK_COMBO_BOX (dialog->priv->display_tab.image_quality_combo), _("Medium"));
-    gtk_combo_box_append_text (GTK_COMBO_BOX (dialog->priv->display_tab.image_quality_combo), _("Low"));
-
-    gtk_box_pack_start (GTK_BOX (dialog->priv->display_tab.image_quality_vbox), 
-                                 dialog->priv->display_tab.image_quality_hbox, FALSE, FALSE, 0);
-    gtk_box_pack_start (GTK_BOX (dialog->priv->display_tab.image_quality_hbox), 
-                                 dialog->priv->display_tab.image_quality_label, FALSE, FALSE, 0);
-    gtk_box_pack_start (GTK_BOX (dialog->priv->display_tab.image_quality_hbox), 
-                                 dialog->priv->display_tab.image_quality_combo, FALSE, FALSE, 0);
-    /* set current value */
-    switch (uint_image_quality-(uint_image_quality%1000000))
-    {
-        case 0:
-            gtk_combo_box_set_active (GTK_COMBO_BOX (dialog->priv->display_tab.image_quality_combo), 0);
-            break;
-        case 8000000:
-            gtk_combo_box_set_active (GTK_COMBO_BOX (dialog->priv->display_tab.image_quality_combo), 1);
-            break;
-        case 4000000:
-            gtk_combo_box_set_active (GTK_COMBO_BOX (dialog->priv->display_tab.image_quality_combo), 2);
-            break;
-        case 2000000:
-            gtk_combo_box_set_active (GTK_COMBO_BOX (dialog->priv->display_tab.image_quality_combo), 3);
-            break;
-        default:
-            gtk_combo_box_set_active (GTK_COMBO_BOX (dialog->priv->display_tab.image_quality_combo), 2);
-            break;
-    }
-
-    /* connect signals */
-    g_signal_connect (G_OBJECT (dialog->priv->display_tab.image_quality_combo), 
-                      "changed", (GCallback)cb_rstto_preferences_dialog_image_quality_combo_box_changed, dialog);
-    
-
-/*******************/
-/** Slideshow tab **/
-/*******************/
-    slideshow_main_vbox = gtk_vbox_new(FALSE, 0);
-    slideshow_main_lbl = gtk_label_new(_("Slideshow"));
-    gtk_notebook_append_page(GTK_NOTEBOOK(notebook), slideshow_main_vbox, slideshow_main_lbl);
-    /* not used */
-    gtk_widget_set_sensitive (slideshow_main_vbox, FALSE);
-
-    timeout_vbox = gtk_vbox_new(FALSE, 0);
-    timeout_frame = xfce_create_framebox_with_content (_("Timeout"), timeout_vbox);
-    gtk_box_pack_start (GTK_BOX (slideshow_main_vbox), timeout_frame, FALSE, FALSE, 0);
-
-    
-    timeout_lbl = gtk_label_new(_("The time period an individual image is displayed during a slideshow\n(in seconds)"));
-    timeout_hscale = gtk_hscale_new_with_range(1, 60, 1);
-    gtk_misc_set_alignment(GTK_MISC(timeout_lbl), 0, 0.5);
-    gtk_misc_set_padding(GTK_MISC(timeout_lbl), 2, 2);
-
-    gtk_box_pack_start(GTK_BOX(timeout_vbox), timeout_lbl, TRUE, TRUE, 0);
-    gtk_box_pack_start(GTK_BOX(timeout_vbox), timeout_hscale, FALSE, TRUE, 0);
-
-
-/********************************************/
-    control_main_vbox = gtk_vbox_new(FALSE, 0);
-    control_main_lbl = gtk_label_new(_("Control"));
-    gtk_notebook_append_page(GTK_NOTEBOOK(notebook), control_main_vbox, control_main_lbl);
-
-    scroll_vbox = gtk_vbox_new(FALSE, 0);
-    scroll_frame = xfce_create_framebox_with_content (_("Scrollwheel"), scroll_vbox);
-    gtk_box_pack_start (GTK_BOX (control_main_vbox), scroll_frame, FALSE, FALSE, 0);
-    gtk_widget_set_sensitive (scroll_vbox, FALSE);
-
-    widget = gtk_radio_button_new_with_label (NULL, _("No action"));
-    gtk_container_add (GTK_CONTAINER (scroll_vbox), widget);
-    widget = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (widget), _("Zoom in and out"));
-    gtk_container_add (GTK_CONTAINER (scroll_vbox), widget);
-    widget = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (widget), _("Switch images"));
-    gtk_container_add (GTK_CONTAINER (scroll_vbox), widget);
-
-/*******************/
-/** Behaviour tab **/
-/*******************/
-    behaviour_main_vbox = gtk_vbox_new(FALSE, 0);
-    behaviour_main_lbl = gtk_label_new(_("Behaviour"));
-    gtk_notebook_append_page(GTK_NOTEBOOK(notebook), behaviour_main_vbox, behaviour_main_lbl);
-
-
-/** Image-cache frame */
-    dialog->priv->behaviour_tab.cache_vbox = gtk_vbox_new(FALSE, 0);
-    dialog->priv->behaviour_tab.cache_frame = xfce_create_framebox_with_content (_("Image cache"),
-                                                                                 dialog->priv->behaviour_tab.cache_vbox);
-    gtk_box_pack_start (GTK_BOX (behaviour_main_vbox), dialog->priv->behaviour_tab.cache_frame, FALSE, FALSE, 0);
-
-    cache_adjustment = gtk_adjustment_new (RSTTO_DEFAULT_CACHE_SIZE, RSTTO_MIN_CACHE_SIZE, 4096, 1, 0, 0);
-
-    dialog->priv->behaviour_tab.cache_size_label = gtk_label_new (_("Cache size"));
-    dialog->priv->behaviour_tab.cache_size_unit = gtk_label_new (_("MB"));
-    dialog->priv->behaviour_tab.cache_hbox = gtk_hbox_new (FALSE, 4);
-    dialog->priv->behaviour_tab.cache_sub_vbox = gtk_vbox_new (FALSE, 4);
-    dialog->priv->behaviour_tab.cache_check_button = gtk_check_button_new_with_label (_("Enable cache"));
-    dialog->priv->behaviour_tab.cache_alignment = gtk_alignment_new (0, 0, 1, 1);
-    gtk_alignment_set_padding (GTK_ALIGNMENT (dialog->priv->behaviour_tab.cache_alignment), 0, 0, 20, 0);
-    dialog->priv->behaviour_tab.cache_spin_button = gtk_spin_button_new(GTK_ADJUSTMENT(cache_adjustment), 1.0, 0);
-
-    dialog->priv->behaviour_tab.cache_preload_label = gtk_label_new (_("Preload images"));
-    gtk_misc_set_alignment(GTK_MISC(dialog->priv->behaviour_tab.cache_preload_label), 0, 0.5);
-    gtk_misc_set_padding(GTK_MISC(dialog->priv->behaviour_tab.cache_preload_label), 2, 2);
-    dialog->priv->behaviour_tab.cache_preload_hscale = gtk_hscale_new_with_range(0, 50, 1);
-    gtk_scale_set_value_pos (GTK_SCALE (dialog->priv->behaviour_tab.cache_preload_hscale), GTK_POS_LEFT);
-
-    gtk_box_pack_start (GTK_BOX (dialog->priv->behaviour_tab.cache_hbox), 
-                                 dialog->priv->behaviour_tab.cache_size_label, FALSE, FALSE, 0);
-    gtk_box_pack_start (GTK_BOX (dialog->priv->behaviour_tab.cache_hbox), 
-                                 dialog->priv->behaviour_tab.cache_spin_button, FALSE, FALSE, 0);
-    gtk_box_pack_start (GTK_BOX (dialog->priv->behaviour_tab.cache_hbox), 
-                                 dialog->priv->behaviour_tab.cache_size_unit, FALSE, FALSE, 0);
-
-    gtk_box_pack_start (GTK_BOX (dialog->priv->behaviour_tab.cache_vbox), 
-                                 dialog->priv->behaviour_tab.cache_check_button, FALSE, FALSE, 0);
-    gtk_box_pack_start (GTK_BOX (dialog->priv->behaviour_tab.cache_vbox), 
-                                 dialog->priv->behaviour_tab.cache_alignment, FALSE, FALSE, 0);
-    gtk_container_add (GTK_CONTAINER (dialog->priv->behaviour_tab.cache_alignment),
-                                      dialog->priv->behaviour_tab.cache_sub_vbox);
-
-    gtk_box_pack_start (GTK_BOX (dialog->priv->behaviour_tab.cache_sub_vbox), 
-                                 dialog->priv->behaviour_tab.cache_hbox, FALSE, FALSE, 0);
-    gtk_box_pack_start (GTK_BOX (dialog->priv->behaviour_tab.cache_sub_vbox), 
-                                 dialog->priv->behaviour_tab.cache_preload_label, FALSE, FALSE, 0);
-    gtk_box_pack_start (GTK_BOX (dialog->priv->behaviour_tab.cache_sub_vbox), 
-                                 dialog->priv->behaviour_tab.cache_preload_hscale, FALSE, FALSE, 0);
-    
-    /* set current value */
-    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->priv->behaviour_tab.cache_check_button),
-                                  bool_enable_cache);
-    gtk_widget_set_sensitive (GTK_WIDGET (dialog->priv->behaviour_tab.cache_sub_vbox),
-                              bool_enable_cache);
-
-    gtk_range_set_value ( GTK_RANGE(dialog->priv->behaviour_tab.cache_preload_hscale),
-                                  uint_preload_images);
-
-    if (uint_cache_size < RSTTO_MIN_CACHE_SIZE)
-    {
-        gtk_adjustment_set_value (GTK_ADJUSTMENT (cache_adjustment), RSTTO_DEFAULT_CACHE_SIZE);
-    }
-    else
-    {
-        gtk_adjustment_set_value (GTK_ADJUSTMENT (cache_adjustment), uint_cache_size);
-    }
-
-    /* connect signals */
-    g_signal_connect (G_OBJECT (dialog->priv->behaviour_tab.cache_check_button), 
-                      "toggled", (GCallback)cb_rstto_preferences_dialog_cache_check_button_toggled, dialog);
-    g_signal_connect (G_OBJECT (dialog->priv->behaviour_tab.cache_preload_hscale), 
-                      "value-changed", (GCallback)cb_rstto_preferences_dialog_cache_preload_hscale_value_changed, dialog);
-    g_signal_connect (G_OBJECT (dialog->priv->behaviour_tab.cache_spin_button), 
-                      "value-changed", (GCallback)cb_rstto_preferences_dialog_cache_spin_button_value_changed, dialog);
-
-    /********************************************/
-    scaling_vbox = gtk_vbox_new(FALSE, 0);
-    scaling_frame = xfce_create_framebox_with_content (_("Scaling"), scaling_vbox);
-    gtk_box_pack_start (GTK_BOX (behaviour_main_vbox), scaling_frame, FALSE, FALSE, 0);
-    /* not used */
-    gtk_widget_set_sensitive (scaling_vbox, FALSE);
-
-    widget = gtk_check_button_new_with_label (_("Don't scale over 100% when maximizing the window."));
-    gtk_container_add (GTK_CONTAINER (scaling_vbox), widget);
-
-
-/********************************************/
-    gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), notebook);
-    gtk_widget_show_all (notebook);
-
-    gtk_dialog_add_button (GTK_DIALOG (dialog), GTK_STOCK_CLOSE, GTK_RESPONSE_OK);
-}
-
-static void
-rstto_preferences_dialog_class_init(RsttoPreferencesDialogClass *dialog_class)
-{
-    parent_class = g_type_class_peek_parent (dialog_class);
-}
-
-GtkWidget *
-rstto_preferences_dialog_new (GtkWindow *parent)
-{
-    GtkWidget *dialog = g_object_new (RSTTO_TYPE_PREFERENCES_DIALOG,
-                                      "title", _("Preferences"),
-                                      "icon-name", GTK_STOCK_PREFERENCES,
-                                      NULL);
-    gtk_window_set_transient_for (GTK_WINDOW (dialog), parent);
-
-    return dialog;
-}
-
-
-static void
-cb_rstto_preferences_dialog_bgcolor_override_toggled (GtkToggleButton *button, 
-                                                      gpointer user_data)
-{
-    RsttoPreferencesDialog *dialog = RSTTO_PREFERENCES_DIALOG (user_data);
-    
-    GValue bgcolor_override_val = {0, };
-    g_value_init (&bgcolor_override_val, G_TYPE_BOOLEAN);
-
-    if (gtk_toggle_button_get_active (button))
-    {
-        g_value_set_boolean (&bgcolor_override_val, TRUE);
-        gtk_widget_set_sensitive (dialog->priv->display_tab.bgcolor_color_button, TRUE);
-    }
-    else
-    {
-        g_value_set_boolean (&bgcolor_override_val, FALSE);
-        gtk_widget_set_sensitive (dialog->priv->display_tab.bgcolor_color_button, FALSE);
-    }
-
-    g_object_set_property (G_OBJECT (dialog->priv->settings), "bgcolor-override", &bgcolor_override_val);
-    
-}
-
-static void
-cb_rstto_preferences_dialog_bgcolor_color_set (GtkColorButton *button, gpointer user_data)
-{
-    RsttoPreferencesDialog *dialog = RSTTO_PREFERENCES_DIALOG (user_data);
-    GValue bgcolor_val = {0, };
-    g_value_init (&bgcolor_val, GDK_TYPE_COLOR);
-
-    g_object_get_property (G_OBJECT(button), "color", &bgcolor_val);
-    g_object_set_property (G_OBJECT(dialog->priv->settings), "bgcolor", &bgcolor_val);
-    
-}
-
-static void
-cb_rstto_preferences_dialog_cache_check_button_toggled (GtkToggleButton *button, 
-                                                        gpointer user_data)
-{
-    RsttoPreferencesDialog *dialog = RSTTO_PREFERENCES_DIALOG (user_data);
-
-    GValue value = {0, };
-    g_value_init (&value, G_TYPE_BOOLEAN);
-
-    if (gtk_toggle_button_get_active (button))
-    {
-        g_value_set_boolean (&value, TRUE);
-    	gtk_widget_set_sensitive (GTK_WIDGET (dialog->priv->behaviour_tab.cache_sub_vbox), TRUE);
-    }
-    else
-    {
-        g_value_set_boolean (&value, FALSE);
-    	gtk_widget_set_sensitive (GTK_WIDGET (dialog->priv->behaviour_tab.cache_sub_vbox), FALSE);
-    }
-    
-    g_object_set_property (G_OBJECT (dialog->priv->settings), "enable-cache", &value);
-
-    g_value_unset (&value);
-
-}
-
-static void
-cb_rstto_preferences_dialog_cache_preload_hscale_value_changed (GtkRange *range, 
-                                                                gpointer user_data)
-{
-    RsttoPreferencesDialog *dialog = RSTTO_PREFERENCES_DIALOG (user_data);
-
-    GValue value = {0, };
-    g_value_init (&value, G_TYPE_UINT);
-
-    g_value_set_uint (&value, gtk_range_get_value (range));
-
-    g_object_set_property (G_OBJECT (dialog->priv->settings), "preload-images", &value);
-    g_value_unset (&value);
-}
-
-static void
-cb_rstto_preferences_dialog_cache_spin_button_value_changed (GtkSpinButton *button, 
-                                                                gpointer user_data)
-{
-    RsttoPreferencesDialog *dialog = RSTTO_PREFERENCES_DIALOG (user_data);
-
-    GValue value = {0, };
-    g_value_init (&value, G_TYPE_UINT);
-
-    g_value_set_uint (&value, (guint)gtk_spin_button_get_value (button));
-
-    g_object_set_property (G_OBJECT (dialog->priv->settings), "cache-size", &value);
-
-    g_value_unset (&value);
-}
-
-static void
-cb_rstto_preferences_dialog_image_quality_combo_box_changed (GtkComboBox *combo_box,
-                                                             gpointer user_data)
-
-{
-    /* FIXME */
-    RsttoPreferencesDialog *dialog = RSTTO_PREFERENCES_DIALOG (user_data);
-    switch (gtk_combo_box_get_active (combo_box))
-    {
-        case 0: /* unlimited */
-            g_object_set (G_OBJECT (dialog->priv->settings),
-                          "image-quality", 0,
-                          NULL);
-            break;
-        case 1: /* 1 MegaPixel */
-            g_object_set (G_OBJECT (dialog->priv->settings),
-                          "image-quality", 8000000,
-                          NULL);
-            break;
-        case 2: /* 2 MegaPixel */
-            g_object_set (G_OBJECT (dialog->priv->settings),
-                          "image-quality", 4000000,
-                          NULL);
-            break;
-        case 3: /* 4 MegaPixel */
-            g_object_set (G_OBJECT (dialog->priv->settings),
-                          "image-quality", 2000000,
-                          NULL);
-            break;
-    }
-}
diff --git a/src/preferences_dialog.h b/src/preferences_dialog.h
deleted file mode 100644
index 1ba2506..0000000
--- a/src/preferences_dialog.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- *  Copyright (C) Stephan Arts 2009 <stephan at xfce.org>
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU Library General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#ifndef __RISTRETTO_PREFERENCES_DIALOG_H__
-#define __RISTRETTO_PREFERENCES_DIALOG_H__
-
-G_BEGIN_DECLS
-
-#define RSTTO_TYPE_PREFERENCES_DIALOG rstto_preferences_dialog_get_type()
-
-#define RSTTO_PREFERENCES_DIALOG(obj)( \
-        G_TYPE_CHECK_INSTANCE_CAST ((obj), \
-                RSTTO_TYPE_PREFERENCES_DIALOG, \
-                RsttoPreferencesDialog))
-
-#define RSTTO_IS_PREFERENCES_DIALOG(obj)( \
-        G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
-                RSTTO_TYPE_PREFERENCES_DIALOG))
-
-#define RSTTO_PREFERENCES_DIALOG_CLASS(klass)( \
-        G_TYPE_CHECK_CLASS_CAST ((klass), \
-                RSTTO_TYPE_PREFERENCES_DIALOG, \
-                RsttoPreferencesDialogClass))
-
-#define RSTTO_IS_PREFERENCES_DIALOG_CLASS(klass)( \
-        G_TYPE_CHECK_CLASS_TYPE ((klass), \
-                RSTTO_TYPE_PREFERENCES_DIALOG()))
-
-typedef struct _RsttoPreferencesDialog RsttoPreferencesDialog;
-
-typedef struct _RsttoPreferencesDialogPriv RsttoPreferencesDialogPriv;
-
-struct _RsttoPreferencesDialog
-{
-    XfceTitledDialog parent;
-    RsttoPreferencesDialogPriv *priv;
-};
-
-typedef struct _RsttoPreferencesDialogClass RsttoPreferencesDialogClass;
-
-struct _RsttoPreferencesDialogClass
-{
-    XfceTitledDialogClass  parent_class;
-};
-
-GType      rstto_preferences_dialog_get_type();
-
-GtkWidget *
-rstto_preferences_dialog_new (GtkWindow *parent);
-
-G_END_DECLS
-
-#endif /* __RISTRETTO_PREFERENCES_DIALOG_H__ */
diff --git a/src/ristretto-abstract_thumbnailer.o b/src/ristretto-abstract_thumbnailer.o
new file mode 100644
index 0000000..42402bb
Binary files /dev/null and b/src/ristretto-abstract_thumbnailer.o differ
diff --git a/src/ristretto-dbus_thumbnailer.o b/src/ristretto-dbus_thumbnailer.o
new file mode 100644
index 0000000..c4b87dc
Binary files /dev/null and b/src/ristretto-dbus_thumbnailer.o differ
diff --git a/src/ristretto-internal_thumbnailer.o b/src/ristretto-internal_thumbnailer.o
new file mode 100644
index 0000000..ad19f39
Binary files /dev/null and b/src/ristretto-internal_thumbnailer.o differ
diff --git a/src/save_dialog.c b/src/save_dialog.c
deleted file mode 100644
index a74910f..0000000
--- a/src/save_dialog.c
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- *  Copyright (C) Stephan Arts 2008 <stephan at xfce.org>
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU Library General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#include <config.h>
-#include <gtk/gtk.h>
-
-#include <thunar-vfs/thunar-vfs.h>
-
-#include <libexif/exif-data.h>
-
-#include "navigator.h"
-#include "save_dialog.h"
-
-static void
-cb_rstto_save_row_toggled (GtkCellRendererToggle *cell, gchar *path, gpointer user_data);
-
-static void
-rstto_save_dialog_init(RsttoSaveDialog *);
-static void
-rstto_save_dialog_class_init(RsttoSaveDialogClass *);
-
-static GtkWidgetClass *parent_class = NULL;
-
-GType
-rstto_save_dialog_get_type ()
-{
-    static GType rstto_save_dialog_type = 0;
-
-    if (!rstto_save_dialog_type)
-    {
-        static const GTypeInfo rstto_save_dialog_info = 
-        {
-            sizeof (RsttoSaveDialogClass),
-            (GBaseInitFunc) NULL,
-            (GBaseFinalizeFunc) NULL,
-            (GClassInitFunc) rstto_save_dialog_class_init,
-            (GClassFinalizeFunc) NULL,
-            NULL,
-            sizeof (RsttoSaveDialog),
-            0,
-            (GInstanceInitFunc) rstto_save_dialog_init,
-            NULL
-        };
-
-        rstto_save_dialog_type = g_type_register_static (GTK_TYPE_DIALOG, "RsttoSaveDialog", &rstto_save_dialog_info, 0);
-    }
-    return rstto_save_dialog_type;
-}
-
-static void
-rstto_save_dialog_init(RsttoSaveDialog *dialog)
-{
-    GtkTreeViewColumn *column = NULL;
-    GtkCellRenderer *renderer;
-    GtkListStore *store;
-    GtkWidget *treeview, *s_window;
-
-    store = gtk_list_store_new (4, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN);
-    treeview = gtk_tree_view_new_with_model (GTK_TREE_MODEL(store));
-
-    renderer = gtk_cell_renderer_pixbuf_new();
-    column = gtk_tree_view_column_new_with_attributes ( "", renderer, "pixbuf", 0, NULL);
-    gtk_tree_view_insert_column (GTK_TREE_VIEW(treeview), column, -1);
-
-    renderer = gtk_cell_renderer_text_new();
-    g_object_set (renderer, "ellipsize", PANGO_ELLIPSIZE_MIDDLE, NULL);
-    column = gtk_tree_view_column_new_with_attributes ( _("Filename"), renderer, "text", 1, NULL);
-    gtk_tree_view_column_set_expand (column, TRUE);
-    gtk_tree_view_insert_column (GTK_TREE_VIEW(treeview), column, -1);
-
-    renderer = gtk_cell_renderer_toggle_new();
-    g_object_set (renderer, "mode", GTK_CELL_RENDERER_MODE_ACTIVATABLE, NULL);
-    g_signal_connect (renderer, "toggled", (GCallback)cb_rstto_save_row_toggled, store);
-
-    column = gtk_tree_view_column_new_with_attributes ( _("Save"), renderer, "active", 2, NULL);
-    gtk_tree_view_insert_column (GTK_TREE_VIEW(treeview), column, -1);
-
-    s_window = gtk_scrolled_window_new (NULL, NULL);
-    gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (s_window), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
-    gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (s_window), treeview);
-
-    gtk_container_add (GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), s_window);
-    gtk_widget_show_all (s_window);
-
-
-    gtk_dialog_add_buttons (GTK_DIALOG (dialog),
-        GTK_STOCK_CANCEL,
-        GTK_RESPONSE_CANCEL,
-        GTK_STOCK_SAVE,
-        GTK_RESPONSE_OK,
-        NULL);
-}
-
-static void
-rstto_save_dialog_class_init(RsttoSaveDialogClass *dialog_class)
-{
-    GObjectClass *object_class = (GObjectClass*)dialog_class;
-    parent_class = g_type_class_peek_parent(dialog_class);
-}
-
-GtkWidget *
-rstto_save_dialog_new (GtkWindow *parent, GList *entries)
-{
-    GtkWidget *dialog = g_object_new (RSTTO_TYPE_SAVE_DIALOG, NULL);
-    gtk_window_set_transient_for (GTK_WINDOW (dialog), parent);
-
-    return dialog;
-}
-
-
-/*
-GtkWidget *
-rstto_save_dialog_new (GtkWindow *parent, GList *entries)
-{
-    GtkTreeIter iter;
-    GtkTreeViewColumn *column = NULL;
-    GList *list_iter = entries;
-    GtkCellRenderer *renderer;
-    GtkListStore *store;
-    GtkWidget *treeview, *s_window;
-    GtkWidget *dialog = gtk_dialog_new_with_buttons (
-                                _("Save images"),
-                                parent,
-                                GTK_DIALOG_DESTROY_WITH_PARENT,
-                                GTK_STOCK_CANCEL,
-                                GTK_RESPONSE_CANCEL,
-                                GTK_STOCK_SAVE,
-                                GTK_RESPONSE_OK,
-                                NULL);
-
-    store = gtk_list_store_new (4, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN);
-    treeview = gtk_tree_view_new_with_model (GTK_TREE_MODEL(store));
-
-    renderer = gtk_cell_renderer_pixbuf_new();
-    column = gtk_tree_view_column_new_with_attributes ( "", renderer, "pixbuf", 0, NULL);
-    gtk_tree_view_insert_column (GTK_TREE_VIEW(treeview), column, -1);
-
-    renderer = gtk_cell_renderer_text_new();
-    g_object_set (renderer, "ellipsize", PANGO_ELLIPSIZE_MIDDLE, NULL);
-    column = gtk_tree_view_column_new_with_attributes ( _("Filename"), renderer, "text", 1, NULL);
-    gtk_tree_view_column_set_expand (column, TRUE);
-    gtk_tree_view_insert_column (GTK_TREE_VIEW(treeview), column, -1);
-
-    renderer = gtk_cell_renderer_toggle_new();
-    g_object_set (renderer, "mode", GTK_CELL_RENDERER_MODE_ACTIVATABLE, NULL);
-    g_signal_connect (renderer, "toggled", (GCallback)cb_rstto_save_row_toggled, store);
-
-    column = gtk_tree_view_column_new_with_attributes ( _("Save"), renderer, "active", 2, NULL);
-    gtk_tree_view_insert_column (GTK_TREE_VIEW(treeview), column, -1);
-
-    while (list_iter)
-    {
-        gtk_list_store_append (store, &iter);
-        gchar *path = thunar_vfs_path_dup_string (rstto_navigator_entry_get_info(((RsttoNavigatorEntry *)list_iter->data))->path);
-        gtk_list_store_set (store, &iter, 0,rstto_navigator_entry_get_thumb (entries->data, 48),1, path, 2, FALSE, -1);
-        g_free (path);
-
-        list_iter = g_list_next(list_iter);
-    }
-
-
-    s_window = gtk_scrolled_window_new (NULL, NULL);
-    gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (s_window), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
-    gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (s_window), treeview);
-
-    gtk_container_add (GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), s_window);
-    gtk_widget_show_all (s_window);
-    return dialog;
-}
-*/
-
-static void
-cb_rstto_save_row_toggled (GtkCellRendererToggle *cell, gchar *path, gpointer user_data)
-{
-    GtkTreeModel *model = GTK_TREE_MODEL(user_data);
-    GtkTreeIter iter;
-
-    gtk_tree_model_get_iter_from_string (model, &iter, path);
-    gtk_list_store_set (GTK_LIST_STORE(model), &iter, 2, !gtk_cell_renderer_toggle_get_active (cell), -1);
-};
diff --git a/src/save_dialog.h b/src/save_dialog.h
deleted file mode 100644
index 44d4a5f..0000000
--- a/src/save_dialog.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- *  Copyright (C) Stephan Arts 2008 <stephan at xfce.org>
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU Library General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#ifndef __RISTRETTO_SAVE_DIALOG_H__
-#define __RISTRETTO_SAVE_DIALOG_H__
-
-G_BEGIN_DECLS
-
-#define RSTTO_TYPE_SAVE_DIALOG rstto_save_dialog_get_type()
-
-#define RSTTO_SAVE_DIALOG(obj)( \
-        G_TYPE_CHECK_INSTANCE_CAST ((obj), \
-                RSTTO_TYPE_SAVE_DIALOG, \
-                RsttoSaveDialog))
-
-#define RSTTO_IS_SAVE_DIALOG(obj)( \
-        G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
-                RSTTO_TYPE_SAVE_DIALOG))
-
-#define RSTTO_SAVE_DIALOG_CLASS(klass)( \
-        G_TYPE_CHECK_CLASS_CAST ((klass), \
-                RSTTO_TYPE_SAVE_DIALOG, \
-                RsttoSaveDialogClass))
-
-#define RSTTO_IS_SAVE_DIALOG_CLASS(klass)( \
-        G_TYPE_CHECK_CLASS_TYPE ((klass), \
-                RSTTO_TYPE_SAVE_DIALOG()))
-
-typedef struct _RsttoSaveDialog RsttoSaveDialog;
-
-struct _RsttoSaveDialog
-{
-    GtkDialog         parent;
-};
-
-typedef struct _RsttoSaveDialogClass RsttoSaveDialogClass;
-
-struct _RsttoSaveDialogClass
-{
-    GtkDialogClass  parent_class;
-};
-
-GType      rstto_save_dialog_get_type();
-
-GtkWidget *
-rstto_save_dialog_new (GtkWindow *parent, GList *entries);
-
-G_END_DECLS
-
-#endif /* __RISTRETTO_SAVE_DIALOG_H__ */
diff --git a/src/settings.c b/src/settings.c
index 1bf543d..1dac89d 100644
--- a/src/settings.c
+++ b/src/settings.c
@@ -99,19 +99,6 @@ struct _RsttoSettingsPriv
 {
     XfconfChannel *channel;
 
-    gboolean  show_toolbar;
-    guint     preload_images;
-    gboolean  enable_cache;
-    guint     cache_size;
-    guint     image_quality;
-    guint     window_width;
-    guint     window_height;
-    gchar    *last_file_path;
-    guint     slideshow_timeout;
-    GdkColor *bgcolor;
-    gboolean  bgcolor_override;
-    GdkColor *bgcolor_fullscreen;
-    gchar    *scrollwheel_action;
 };
 
 
@@ -133,29 +120,6 @@ rstto_settings_init (GObject *object)
         accelmap_path = NULL;
     }
     
-    settings->priv->slideshow_timeout = 5000;
-    settings->priv->bgcolor = g_new0 (GdkColor, 1);
-    settings->priv->bgcolor_fullscreen = g_new0 (GdkColor, 1);
-    settings->priv->image_quality = 2000000;
-
-    xfconf_g_property_bind (settings->priv->channel, "/window/width", G_TYPE_UINT, settings, "window-width");
-    xfconf_g_property_bind (settings->priv->channel, "/window/height", G_TYPE_UINT, settings, "window-height");
-
-    xfconf_g_property_bind (settings->priv->channel, "/file/current-uri", G_TYPE_STRING, settings, "current-uri");
-
-    xfconf_g_property_bind (settings->priv->channel, "/window/show-toolbar", G_TYPE_BOOLEAN, settings, "show-toolbar");
-    xfconf_g_property_bind (settings->priv->channel, "/window/scrollwheel-action", G_TYPE_STRING, settings, "scrollwheel-action");
-
-    xfconf_g_property_bind (settings->priv->channel, "/slideshow/timeout", G_TYPE_UINT, settings, "slideshow-timeout");
-
-    xfconf_g_property_bind_gdkcolor (settings->priv->channel, "/window/bgcolor", settings, "bgcolor");
-    xfconf_g_property_bind (settings->priv->channel, "/window/bgcolor-override", G_TYPE_BOOLEAN, settings, "bgcolor-override");
-
-    xfconf_g_property_bind_gdkcolor (settings->priv->channel, "/window/bgcolor-fullscreen", settings, "bgcolor-fullscreen");
-    xfconf_g_property_bind (settings->priv->channel, "/image/preload", G_TYPE_UINT, settings, "preload-images");
-    xfconf_g_property_bind (settings->priv->channel, "/image/cache", G_TYPE_BOOLEAN, settings, "enable-cache");
-    xfconf_g_property_bind (settings->priv->channel, "/image/cache-size", G_TYPE_UINT, settings, "cache-size");
-    xfconf_g_property_bind (settings->priv->channel, "/image/quality", G_TYPE_UINT, settings, "image-quality");
 }
 
 
@@ -173,135 +137,6 @@ rstto_settings_class_init (GObjectClass *object_class)
 
     object_class->set_property = rstto_settings_set_property;
     object_class->get_property = rstto_settings_get_property;
-
-    pspec = g_param_spec_uint    ("window-width",
-                                  "",
-                                  "",
-                                  0,
-                                  G_MAXUINT,
-                                  600,
-                                  G_PARAM_READWRITE);
-    g_object_class_install_property (object_class,
-                                     PROP_WINDOW_WIDTH,
-                                     pspec);
-
-    pspec = g_param_spec_uint    ("window-height",
-                                  "",
-                                  "",
-                                  0,
-                                  G_MAXUINT,
-                                  400,
-                                  G_PARAM_READWRITE);
-    g_object_class_install_property (object_class,
-                                     PROP_WINDOW_HEIGHT,
-                                     pspec);
-
-    pspec = g_param_spec_boolean ("show-toolbar",
-                                  "",
-                                  "",
-                                  TRUE,
-                                  G_PARAM_READWRITE);
-    g_object_class_install_property (object_class,
-                                     PROP_SHOW_TOOLBAR,
-                                     pspec);
-
-    pspec = g_param_spec_uint ("preload-images",
-                               "",
-                               "",
-                               0,
-                               50,
-                               0,
-                               G_PARAM_READWRITE);
-    g_object_class_install_property (object_class,
-                                     PROP_PRELOAD_IMAGES,
-                                     pspec);
-
-    pspec = g_param_spec_boolean ("enable-cache",
-                                  "",
-                                  "",
-                                  TRUE,
-                                  G_PARAM_READWRITE);
-    g_object_class_install_property (object_class,
-                                     PROP_ENABLE_CACHE,
-                                     pspec);
-
-    pspec = g_param_spec_uint    ("cache-size",
-                                  "",
-                                  "",
-                                  0,
-                                  G_MAXUINT,
-                                  256,
-                                  G_PARAM_READWRITE);
-    g_object_class_install_property (object_class,
-                                     PROP_CACHE_SIZE,
-                                     pspec);
-
-    pspec = g_param_spec_uint    ("image-quality",
-                                  "",
-                                  "",
-                                  0,
-                                  50000000,
-                                  2000000,
-                                  G_PARAM_READWRITE);
-    g_object_class_install_property (object_class,
-                                     PROP_IMAGE_QUALITY,
-                                     pspec);
-
-    pspec = g_param_spec_string  ("current-uri",
-                                  "",
-                                  "",
-                                  "file://~/",
-                                  G_PARAM_READWRITE);
-    g_object_class_install_property (object_class,
-                                     PROP_CURRENT_URI,
-                                     pspec);
-
-    pspec = g_param_spec_string  ("scrollwheel-action",
-                                  "",
-                                  "",
-                                  "zoom",
-                                  G_PARAM_READWRITE);
-    g_object_class_install_property (object_class,
-                                     PROP_CURRENT_URI,
-                                     pspec);
-
-    pspec = g_param_spec_uint    ("slideshow-timeout",
-                                  "",
-                                  "",
-                                  1000,
-                                  G_MAXUINT,
-                                  5000,
-                                  G_PARAM_READWRITE);
-    g_object_class_install_property (object_class,
-                                     PROP_SLIDESHOW_TIMEOUT,
-                                     pspec);
-
-    pspec = g_param_spec_boxed   ("bgcolor",
-                                  "",
-                                  "",
-                                  GDK_TYPE_COLOR,
-                                  G_PARAM_READWRITE);
-    g_object_class_install_property (object_class,
-                                     PROP_BGCOLOR,
-                                     pspec);
-
-    pspec = g_param_spec_boolean ("bgcolor-override",
-                                  "",
-                                  "",
-                                  TRUE,
-                                  G_PARAM_READWRITE);
-    g_object_class_install_property (object_class,
-                                     PROP_BGCOLOR_OVERRIDE,
-                                     pspec);
-
-    pspec = g_param_spec_boxed   ("bgcolor-fullscreen",
-                                  "",
-                                  "",
-                                  GDK_TYPE_COLOR,
-                                  G_PARAM_READWRITE);
-    g_object_class_install_property (object_class,
-                                     PROP_BGCOLOR_FULLSCREEN,
-                                     pspec);
 }
 
 /**
@@ -377,55 +212,6 @@ rstto_settings_set_property    (GObject      *object,
 
     switch (property_id)
     {
-        case PROP_SHOW_TOOLBAR:
-            settings->priv->show_toolbar = g_value_get_boolean (value);
-            break;
-        case PROP_PRELOAD_IMAGES:
-            settings->priv->preload_images = g_value_get_uint (value);
-            break;
-        case PROP_ENABLE_CACHE:
-            settings->priv->enable_cache = g_value_get_boolean (value);
-            break;
-        case PROP_IMAGE_QUALITY:
-            settings->priv->image_quality = g_value_get_uint (value);
-            break;
-        case PROP_CACHE_SIZE:
-            settings->priv->cache_size = g_value_get_uint (value);
-            break;
-        case PROP_WINDOW_WIDTH:
-            settings->priv->window_width = g_value_get_uint (value);
-            break;
-        case PROP_WINDOW_HEIGHT:
-            settings->priv->window_height = g_value_get_uint (value);
-            break;
-        case PROP_BGCOLOR:
-            color = g_value_get_boxed (value);
-            settings->priv->bgcolor->red = color->red;
-            settings->priv->bgcolor->green = color->green;
-            settings->priv->bgcolor->blue = color->blue;
-            break;
-        case PROP_BGCOLOR_OVERRIDE:
-            settings->priv->bgcolor_override = g_value_get_boolean (value);
-            break;
-        case PROP_CURRENT_URI:
-            if (settings->priv->last_file_path)
-                g_free (settings->priv->last_file_path);
-            settings->priv->last_file_path = g_value_dup_string (value);
-            break;
-        case PROP_SLIDESHOW_TIMEOUT:
-            settings->priv->slideshow_timeout = g_value_get_uint (value);
-            break;
-        case PROP_BGCOLOR_FULLSCREEN:
-            color = g_value_get_boxed (value);
-            settings->priv->bgcolor_fullscreen->red = color->red;
-            settings->priv->bgcolor_fullscreen->green = color->green;
-            settings->priv->bgcolor_fullscreen->blue = color->blue;
-            break;
-        case PROP_SCROLLWHEEL_ACTION:
-            if (settings->priv->scrollwheel_action)
-                g_free (settings->priv->scrollwheel_action);
-            settings->priv->scrollwheel_action = g_value_dup_string (value);
-            break;
         default:
             break;
     }
@@ -442,45 +228,6 @@ rstto_settings_get_property    (GObject    *object,
 
     switch (property_id)
     {
-        case PROP_SHOW_TOOLBAR:
-            g_value_set_boolean (value, settings->priv->show_toolbar);
-            break;
-        case PROP_PRELOAD_IMAGES:
-            g_value_set_uint (value, settings->priv->preload_images);
-            break;
-        case PROP_ENABLE_CACHE:
-            g_value_set_boolean (value, settings->priv->enable_cache);
-            break;
-        case PROP_IMAGE_QUALITY:
-            g_value_set_uint (value, settings->priv->image_quality);
-            break;
-        case PROP_CACHE_SIZE:
-            g_value_set_uint (value, settings->priv->cache_size);
-            break;
-        case PROP_WINDOW_WIDTH:
-            g_value_set_uint (value, settings->priv->window_width);
-            break;
-        case PROP_WINDOW_HEIGHT:
-            g_value_set_uint (value, settings->priv->window_height);
-            break;
-        case PROP_CURRENT_URI:
-            g_value_set_string (value, settings->priv->last_file_path);
-            break;
-        case PROP_SLIDESHOW_TIMEOUT:
-            g_value_set_uint (value, settings->priv->slideshow_timeout);
-            break;
-        case PROP_BGCOLOR_FULLSCREEN:
-            g_value_set_boxed (value, settings->priv->bgcolor_fullscreen);
-            break;
-        case PROP_BGCOLOR:
-            g_value_set_boxed (value, settings->priv->bgcolor);
-            break;
-        case PROP_BGCOLOR_OVERRIDE:
-            g_value_set_boolean (value, settings->priv->bgcolor_override);
-            break;
-        case PROP_SCROLLWHEEL_ACTION:
-            g_value_set_string (value, settings->priv->scrollwheel_action);
-            break;
         default:
             break;
 
diff --git a/src/thumbnail.c b/src/thumbnail.c
index 94f7abc..e19580f 100644
--- a/src/thumbnail.c
+++ b/src/thumbnail.c
@@ -1,4 +1,6 @@
 /*
+ *  Copyright (c) 2009 Stephan Arts <stephan at xfce.org>
+ *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 2 of the License, or
@@ -15,48 +17,34 @@
  */
 
 #include <config.h>
-#include <gtk/gtk.h>
-#include <gtk/gtkmarshal.h>
-#include <string.h>
+
+#include <glib.h>
+#include <gio/gio.h>
+#include <gdk/gdk.h>
 
 #include <libexif/exif-data.h>
 
-#include "image.h"
-#include "image_list.h"
+#include <string.h>
+
 #include "thumbnail.h"
 
-struct _RsttoThumbnailPriv
+enum
 {
-    RsttoImage          *image;
-    GdkPixbuf           *pixbuf;
+    RSTTO_THUMBNAIL_SIGNAL_CHANGED = 0,
+    RSTTO_THUMBNAIL_SIGNAL_COUNT
 };
 
-static GtkWidgetClass *parent_class = NULL;
-static GdkPixbuf *thumbnail_missing_icon = NULL;
-
 static void
-rstto_thumbnail_init(RsttoThumbnail *);
+rstto_thumbnail_init (GObject *);
 static void
-rstto_thumbnail_class_init(RsttoThumbnailClass *);
-static void
-rstto_thumbnail_finalize(GObject *object);
+rstto_thumbnail_class_init (GObjectClass *);
 
 static void
-rstto_thumbnail_size_request(GtkWidget *, GtkRequisition *);
-static void
-rstto_thumbnail_size_allocate(GtkWidget *, GtkAllocation *);
-static gboolean 
-rstto_thumbnail_expose(GtkWidget *, GdkEventExpose *);
+rstto_thumbnail_dispose (GObject *object);
 
-static void
-rstto_thumbnail_paint(RsttoThumbnail *thumb);
+static GObjectClass *parent_class = NULL;
 
-static void
-rstto_thumbnail_clicked (GtkButton *);
-static void
-rstto_thumbnail_enter (GtkButton *);
-static void
-rstto_thumbnail_leave (GtkButton *);
+static gint rstto_thumbnail_signals[RSTTO_THUMBNAIL_SIGNAL_COUNT];
 
 GType
 rstto_thumbnail_get_type (void)
@@ -79,261 +67,33 @@ rstto_thumbnail_get_type (void)
             NULL
         };
 
-        rstto_thumbnail_type = g_type_register_static (GTK_TYPE_BUTTON, "RsttoThumbnail", &rstto_thumbnail_info, 0);
+        rstto_thumbnail_type = g_type_register_static (G_TYPE_OBJECT, "RsttoThumbnail", &rstto_thumbnail_info, 0);
     }
+
     return rstto_thumbnail_type;
 }
 
-static void
-rstto_thumbnail_init(RsttoThumbnail *thumb)
+struct _RsttoThumbnailPriv
 {
-    thumb->priv = g_new0(RsttoThumbnailPriv, 1);
-
-    if (thumbnail_missing_icon == NULL)
-    {
-        thumbnail_missing_icon = gtk_icon_theme_load_icon (gtk_icon_theme_get_default(),
-                                                     "image-missing",
-                                                     128,
-                                                     0,
-                                                     NULL);
-    }
-
-
-    gtk_widget_set_redraw_on_allocate(GTK_WIDGET(thumb), TRUE);
-    gtk_widget_set_events (GTK_WIDGET(thumb),
-                           GDK_POINTER_MOTION_MASK);
-}
+};
 
 static void
-rstto_thumbnail_class_init(RsttoThumbnailClass *thumb_class)
+rstto_thumbnail_init (GObject *object)
 {
-    GtkWidgetClass *widget_class;
-    GObjectClass *object_class;
-    GtkButtonClass *button_class;
-
-    widget_class = (GtkWidgetClass*)thumb_class;
-    object_class = (GObjectClass*)thumb_class;
-    button_class = (GtkButtonClass*)thumb_class;
-
-    parent_class = g_type_class_peek_parent(thumb_class);
-
-    widget_class->expose_event = rstto_thumbnail_expose;
-
-    widget_class->size_request = rstto_thumbnail_size_request;
-    widget_class->size_allocate = rstto_thumbnail_size_allocate;
-
-    button_class->clicked = rstto_thumbnail_clicked;
-    button_class->enter = rstto_thumbnail_enter;
-    button_class->leave = rstto_thumbnail_leave;
-
-    object_class->finalize = rstto_thumbnail_finalize;
 }
 
 static void
-rstto_thumbnail_finalize(GObject *object)
+rstto_thumbnail_class_init (GObjectClass *object_class)
 {
-    RsttoThumbnail *thumb = RSTTO_THUMBNAIL(object);
-    if (thumb->priv->image)
-    {
-        g_object_unref (thumb->priv->image);
-        thumb->priv->image = NULL;
-    }
+    RsttoThumbnailClass *thumbnail_class = RSTTO_THUMBNAIL_CLASS (object_class);
 
-}
+    parent_class = g_type_class_peek_parent (thumbnail_class);
 
-
-static void
-rstto_thumbnail_size_request(GtkWidget *widget, GtkRequisition *requisition)
-{
-    requisition->height = 70;
-    requisition->width = 70;
+    object_class->dispose = rstto_thumbnail_dispose;
 }
 
 static void
-rstto_thumbnail_size_allocate(GtkWidget *widget, GtkAllocation *allocation)
+rstto_thumbnail_dispose (GObject *object)
 {
-    RsttoThumbnail *thumb = RSTTO_THUMBNAIL(widget);
-    widget->allocation = *allocation;
-    parent_class->size_allocate(widget, allocation);
-
-    if (thumb->priv->pixbuf)
-    {
-        g_object_unref (thumb->priv->pixbuf);
-        thumb->priv->pixbuf = NULL;
-    }
-
-    thumb->priv->pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
-                                          TRUE,
-                                          8,
-                                          allocation->width,
-                                          allocation->height);
-}
-
-static gboolean
-rstto_thumbnail_expose(GtkWidget *widget, GdkEventExpose *event)
-{
-    RsttoThumbnail *thumb = RSTTO_THUMBNAIL(widget);
-    GdkPixbuf *thumb_pixbuf = NULL;
-
-    if (GTK_WIDGET_REALIZED (widget))
-    {
-        if (thumb->priv->image)
-        {
-            thumb_pixbuf = rstto_image_get_thumbnail (thumb->priv->image);
-        }
-
-        if (thumb_pixbuf == NULL)
-        {
-            thumb_pixbuf = thumbnail_missing_icon;
-        }
-
-        g_object_ref (thumb_pixbuf);
-
-        if (thumb_pixbuf)
-        {
-            gint height = gdk_pixbuf_get_height (thumb->priv->pixbuf) - 10;
-            gint width = gdk_pixbuf_get_width (thumb->priv->pixbuf) - 10;
-            gdouble scale = 1.0;
-            GdkPixbuf *dst_thumb_pixbuf = NULL;
 
-            if (gdk_pixbuf_get_width (thumb_pixbuf) > gdk_pixbuf_get_height (thumb_pixbuf))
-            {
-                height = (gint)(((gdouble)gdk_pixbuf_get_height (thumb_pixbuf) / (gdouble)gdk_pixbuf_get_width (thumb_pixbuf)) * width);
-                scale = ((gdouble)width / (gdouble)gdk_pixbuf_get_width (thumb_pixbuf));
-            }
-            else
-            {
-                width = (gint)(((gdouble)gdk_pixbuf_get_width (thumb_pixbuf) / (gdouble)gdk_pixbuf_get_height (thumb_pixbuf)) * height);
-                scale = ((gdouble)height / (gdouble)gdk_pixbuf_get_height (thumb_pixbuf));
-            }
-
-            gdk_pixbuf_fill (thumb->priv->pixbuf, 0x00000000);
-
-            dst_thumb_pixbuf = gdk_pixbuf_scale_simple (thumb_pixbuf, width, height, GDK_INTERP_BILINEAR);
-
-            gdk_pixbuf_copy_area (dst_thumb_pixbuf,
-                                  0, 0,
-                                  width, height,
-                                  thumb->priv->pixbuf,
-                                  (gint)((gdouble)(gdk_pixbuf_get_width (thumb->priv->pixbuf) - width))/2,
-                                  (gint)((gdouble)(gdk_pixbuf_get_height (thumb->priv->pixbuf) - height))/2
-                                  );
-
-            g_object_unref (dst_thumb_pixbuf);
-            g_object_unref (thumb_pixbuf);
-        }
-
-
-        gdk_window_begin_paint_region(widget->window, event->region);
-        rstto_thumbnail_paint(thumb);
-        gdk_window_end_paint(widget->window);
-    }
-
-    return FALSE;
-}
-
-static void
-rstto_thumbnail_paint(RsttoThumbnail *thumb)
-{
-    GtkWidget *widget = GTK_WIDGET(thumb);
-
-    GtkStateType state = GTK_WIDGET_STATE(widget);
-
-    if(thumb->priv->image)
-    {
-
-        if (GTK_WIDGET_STATE(widget) != GTK_STATE_PRELIGHT)
-        {
-        }
-
-        gtk_paint_box(widget->style,
-                      widget->window,
-                      state,
-                      GTK_SHADOW_ETCHED_IN,
-                      NULL,
-                      widget,
-                      NULL,
-                      widget->allocation.x, widget->allocation.y,
-                      widget->allocation.width, widget->allocation.height);
-
-        if (thumb->priv->pixbuf)
-        {
-            gdk_draw_pixbuf(GDK_DRAWABLE(widget->window),
-                            NULL,
-                            thumb->priv->pixbuf,
-                            0, 0,
-                            (0.5 * (widget->allocation.width - gdk_pixbuf_get_width(thumb->priv->pixbuf))) + widget->allocation.x,
-                            (0.5 * (widget->allocation.height - gdk_pixbuf_get_height(thumb->priv->pixbuf))) + widget->allocation.y,
-                            -1, -1,
-                            GDK_RGB_DITHER_NORMAL,
-                            0, 0);
-        }
-
-        /*
-        gtk_paint_focus (widget->style,
-                      widget->window,
-                      state,
-                      NULL,
-                      widget,
-                      NULL,
-                      widget->allocation.x+3, widget->allocation.y+3,
-                      widget->allocation.width-6, widget->allocation.height-6);
-        */
-
-    }
-}
-
-GtkWidget *
-rstto_thumbnail_new (RsttoImage *image)
-{
-    gchar *path, *basename;
-    GFile *file = NULL;
-    RsttoThumbnail *thumb;
-
-    g_return_val_if_fail (image != NULL, NULL);
-
-    thumb = g_object_new(RSTTO_TYPE_THUMBNAIL, NULL);
-
-    thumb->priv->image = image;
-    g_object_ref (image);
-
-    file = rstto_image_get_file (image);
-
-    path = g_file_get_path (file);
-    basename = g_path_get_basename (path);
-
-    gtk_widget_set_tooltip_text(GTK_WIDGET(thumb), basename);
-
-    g_free (basename);
-    g_free (path);
-    return GTK_WIDGET(thumb);
-}
-
-RsttoImage *
-rstto_thumbnail_get_image (RsttoThumbnail *thumb)
-{
-    return thumb->priv->image;
-}
-
-/* CALLBACKS */
-/*************/
-
-static void
-rstto_thumbnail_clicked (GtkButton *button)
-{
-    gtk_widget_queue_draw (GTK_WIDGET (button));
-}
-
-static void
-rstto_thumbnail_enter (GtkButton *button)
-{
-    gtk_widget_set_state (GTK_WIDGET (button), GTK_STATE_PRELIGHT);
-    gtk_widget_queue_draw (GTK_WIDGET (button));
-}
-
-static void
-rstto_thumbnail_leave (GtkButton *button)
-{
-    gtk_widget_set_state (GTK_WIDGET (button), GTK_STATE_NORMAL);
-    gtk_widget_queue_draw (GTK_WIDGET (button));
 }
diff --git a/src/thumbnail.h b/src/thumbnail.h
index 1ca3014..736cf67 100644
--- a/src/thumbnail.h
+++ b/src/thumbnail.h
@@ -19,6 +19,18 @@
 
 G_BEGIN_DECLS
 
+typedef enum
+{
+  RSTTO_THUMBNAIL_ORIENT_NONE = 1,
+  RSTTO_THUMBNAIL_ORIENT_FLIP_HORIZONTAL,
+  RSTTO_THUMBNAIL_ORIENT_180,
+  RSTTO_THUMBNAIL_ORIENT_FLIP_VERTICAL,
+  RSTTO_THUMBNAIL_ORIENT_TRANSPOSE,
+  RSTTO_THUMBNAIL_ORIENT_90,
+  RSTTO_THUMBNAIL_ORIENT_TRANSVERSE,
+  RSTTO_THUMBNAIL_ORIENT_270,
+} RsttoThumbnailOrientation;
+
 #define RSTTO_TYPE_THUMBNAIL rstto_thumbnail_get_type()
 
 #define RSTTO_THUMBNAIL(obj)( \
@@ -39,28 +51,26 @@ G_BEGIN_DECLS
         G_TYPE_CHECK_CLASS_TYPE ((klass), \
                 RSTTO_TYPE_THUMBNAIL()))
 
-typedef struct _RsttoThumbnailPriv RsttoThumbnailPriv;
 
 typedef struct _RsttoThumbnail RsttoThumbnail;
+typedef struct _RsttoThumbnailPriv RsttoThumbnailPriv;
 
 struct _RsttoThumbnail
 {
-    GtkButton     parent;
+    GObject parent;
+
     RsttoThumbnailPriv *priv;
-    gboolean            selected;
 };
 
 typedef struct _RsttoThumbnailClass RsttoThumbnailClass;
 
 struct _RsttoThumbnailClass
 {
-    GtkButtonClass  parent_class;
+    GObjectClass parent_class;
 };
 
-GType      rstto_thumbnail_get_type();
-
-GtkWidget  *rstto_thumbnail_new (RsttoImage *image);
-RsttoImage *rstto_thumbnail_get_image (RsttoThumbnail *thumb);
+RsttoThumbnail *rstto_thumbnail_new (GFile *file);
+GType       rstto_thumbnail_get_type ();
 
 G_END_DECLS
 
diff --git a/src/thumbnail_bar.c b/src/thumbnail_bar.c
deleted file mode 100644
index 4901919..0000000
--- a/src/thumbnail_bar.c
+++ /dev/null
@@ -1,826 +0,0 @@
-/*
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU Library General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#include <config.h>
-#include <gtk/gtk.h>
-#include <gtk/gtkmarshal.h>
-#include <string.h>
-
-#include <gio/gio.h>
-
-#include <libxfcegui4/libxfcegui4.h>
-#include <libexif/exif-data.h>
-
-#include "image.h"
-#include "image_list.h"
-#include "thumbnail.h"
-#include "thumbnail_bar.h"
-
-struct _RsttoThumbnailBarPriv
-{
-    GtkOrientation  orientation;
-    gint dimension;
-    gint offset;
-    gboolean auto_center;
-    gint begin;
-    gint end;
-    RsttoImageList     *image_list;
-    RsttoImageListIter *iter;
-    RsttoImageListIter *internal_iter;
-    GList *thumbs;
-    gint scroll_speed;
-    struct
-    {
-        gdouble current_x;
-        gdouble current_y;
-        gint offset;
-        gboolean motion;
-    } motion;
-};
-
-static void
-rstto_thumbnail_bar_init(RsttoThumbnailBar *);
-static void
-rstto_thumbnail_bar_class_init(RsttoThumbnailBarClass *);
-
-static void
-rstto_thumbnail_bar_size_request(GtkWidget *, GtkRequisition *);
-static void
-rstto_thumbnail_bar_size_allocate(GtkWidget *, GtkAllocation *);
-static gboolean 
-rstto_thumbnail_bar_expose(GtkWidget *, GdkEventExpose *);
-static void
-rstto_thumbnail_bar_realize(GtkWidget *widget);
-static void
-rstto_thumbnail_bar_unrealize(GtkWidget *widget);
-
-static void
-cb_rstto_thumbnail_bar_image_list_new_image (RsttoImageList *image_list, RsttoImage *image, gpointer user_data);
-static void
-cb_rstto_thumbnail_bar_image_list_remove_image (RsttoImageList *image_list, RsttoImage *image, gpointer user_data);
-static void
-cb_rstto_thumbnail_bar_image_list_remove_all (RsttoImageList *image_list, gpointer user_data);
-void
-cb_rstto_thumbnail_bar_image_list_iter_changed (RsttoImageListIter *iter, gpointer user_data);
-
-static gboolean
-cb_rstto_thumbnail_bar_thumbnail_button_press_event (GtkWidget *thumb, GdkEventButton *event);
-static gboolean
-cb_rstto_thumbnail_bar_thumbnail_button_release_event (GtkWidget *thumb, GdkEventButton *event);
-static gboolean 
-cb_rstto_thumbnail_bar_thumbnail_motion_notify_event (GtkWidget *thumb,
-                                             GdkEventMotion *event,
-                                             gpointer user_data);
-
-static gboolean
-cb_rstto_thumbnail_bar_scroll_event (RsttoThumbnailBar *bar,
-                                     GdkEventScroll *event,
-                                     gpointer *user_data);
-
-static void
-rstto_thumbnail_bar_add(GtkContainer *container, GtkWidget *child);
-static void
-rstto_thumbnail_bar_remove(GtkContainer *container, GtkWidget *child);
-static void
-rstto_thumbnail_bar_forall(GtkContainer *container, gboolean include_internals, GtkCallback callback, gpointer callback_data);
-static GType
-rstto_thumbnail_bar_child_type(GtkContainer *container);
-
-static GtkWidgetClass *parent_class = NULL;
-
-static void
-cb_rstto_thumbnail_bar_thumbnail_clicked (GtkWidget *thumb, RsttoThumbnailBar *bar);
-
-static gint
-cb_rstto_thumbnail_bar_compare (GtkWidget *a, GtkWidget *b, gpointer);
-
-GType
-rstto_thumbnail_bar_get_type (void)
-{
-    static GType rstto_thumbnail_bar_type = 0;
-
-    if (!rstto_thumbnail_bar_type)
-    {
-        static const GTypeInfo rstto_thumbnail_bar_info = 
-        {
-            sizeof (RsttoThumbnailBarClass),
-            (GBaseInitFunc) NULL,
-            (GBaseFinalizeFunc) NULL,
-            (GClassInitFunc) rstto_thumbnail_bar_class_init,
-            (GClassFinalizeFunc) NULL,
-            NULL,
-            sizeof (RsttoThumbnailBar),
-            0,
-            (GInstanceInitFunc) rstto_thumbnail_bar_init,
-            NULL
-        };
-
-        rstto_thumbnail_bar_type = g_type_register_static (GTK_TYPE_CONTAINER, "RsttoThumbnailBar", &rstto_thumbnail_bar_info, 0);
-    }
-    return rstto_thumbnail_bar_type;
-}
-
-
-static void
-rstto_thumbnail_bar_init(RsttoThumbnailBar *bar)
-{
-    bar->priv = g_new0(RsttoThumbnailBarPriv, 1);
-
-    bar->priv->auto_center = TRUE;
-
-	GTK_WIDGET_UNSET_FLAGS(bar, GTK_NO_WINDOW);
-	gtk_widget_set_redraw_on_allocate(GTK_WIDGET(bar), TRUE);
-    gtk_widget_set_events (GTK_WIDGET(bar),
-                           GDK_SCROLL_MASK);
-
-    bar->priv->orientation = GTK_ORIENTATION_VERTICAL;
-    bar->priv->offset = 0;
-    bar->priv->scroll_speed = 20;
-
-    g_signal_connect(G_OBJECT(bar), "scroll_event", G_CALLBACK(cb_rstto_thumbnail_bar_scroll_event), NULL);
-
-}
-
-static void
-rstto_thumbnail_bar_class_init(RsttoThumbnailBarClass *bar_class)
-{
-    GtkWidgetClass *widget_class;
-    GtkContainerClass *container_class;
-
-    widget_class = (GtkWidgetClass*)bar_class;
-    container_class = (GtkContainerClass*)bar_class;
-
-    parent_class = g_type_class_peek_parent(bar_class);
-
-    widget_class->size_request = rstto_thumbnail_bar_size_request;
-    widget_class->size_allocate = rstto_thumbnail_bar_size_allocate;
-    widget_class->expose_event = rstto_thumbnail_bar_expose;
-    widget_class->realize = rstto_thumbnail_bar_realize;
-    widget_class->unrealize = rstto_thumbnail_bar_unrealize;
-
-	container_class->add = rstto_thumbnail_bar_add;
-	container_class->remove = rstto_thumbnail_bar_remove;
-	container_class->forall = rstto_thumbnail_bar_forall;
-	container_class->child_type = rstto_thumbnail_bar_child_type;
-
-	gtk_widget_class_install_style_property (widget_class,
-		g_param_spec_int ("spacing",
-		_("Spacing"),
-		_("The amount of space between the thumbnails"),
-		0, G_MAXINT, 3,
-		G_PARAM_READABLE));
-
-	gtk_widget_class_install_style_property (widget_class,
-		g_param_spec_int ("border_width",
-		_("Border Width"),
-		_("The border width of the thumbnail-bar"),
-		0, G_MAXINT, 3,
-		G_PARAM_READABLE));
-}
-
-static void
-rstto_thumbnail_bar_size_request(GtkWidget *widget, GtkRequisition *requisition)
-{
-    RsttoThumbnailBar *bar = RSTTO_THUMBNAIL_BAR(widget);
-    gint border_width = GTK_CONTAINER(bar)->border_width;
-    GList *iter;
-	GtkRequisition child_requisition;
-
-    gtk_widget_style_get(widget, "border-width", &border_width, NULL);
-
-    requisition->height = 70;
-    requisition->width = 70;
-
-    for(iter = bar->priv->thumbs; iter; iter = g_list_next(iter))
-    {
-		gtk_widget_size_request(GTK_WIDGET(iter->data), &child_requisition);
-		requisition->width = MAX(child_requisition.width, requisition->width);
-		requisition->height = MAX(child_requisition.height, requisition->height);
-    }
-
-    requisition->height += (border_width * 2);
-    requisition->width += (border_width * 2);
-
-	widget->requisition = *requisition;
-    GTK_CONTAINER(bar)->border_width = border_width;
-}
-
-static void
-rstto_thumbnail_bar_size_allocate(GtkWidget *widget, GtkAllocation *allocation)
-{
-    RsttoThumbnailBar *bar = RSTTO_THUMBNAIL_BAR(widget);
-    gint border_width = GTK_CONTAINER(bar)->border_width;
-    gint spacing = 0;
-    GtkAllocation child_allocation;
-    GtkRequisition child_requisition;
-    GList *iter = bar->priv->thumbs;
-
-	gtk_widget_style_get(widget, "spacing", &spacing, NULL);
-    widget->allocation = *allocation;
-
-    child_allocation.x = border_width;
-    child_allocation.y = border_width;
-    child_allocation.height = border_width * 2;
-    child_allocation.width = border_width * 2;
-
-
-    if (GTK_WIDGET_REALIZED(widget))
-    {
-        gdk_window_move_resize (widget->window,
-                                allocation->x,
-                                allocation->y,
-                                allocation->width,
-                                allocation->height);
-    }
-
-
-    switch(bar->priv->orientation)
-    {
-        case GTK_ORIENTATION_HORIZONTAL:
-            if (bar->priv->auto_center == TRUE)
-            {
-                bar->priv->offset = 0 - (allocation->width / 2);
-            }
-            while(iter)
-            {
-                gtk_widget_get_child_requisition(GTK_WIDGET(iter->data), &child_requisition);
-                allocation->height = MAX(child_requisition.height + (border_width * 2), allocation->height);
-
-                if (bar->priv->auto_center == TRUE)
-                {
-                }
-
-                iter = g_list_next(iter);
-            }
-
-            child_allocation.x -= bar->priv->offset;
-            
-            iter = bar->priv->thumbs;
-
-            while(iter)
-            {
-                gtk_widget_get_child_requisition(GTK_WIDGET(iter->data), &child_requisition);
-                child_allocation.height = allocation->height - (border_width * 2);
-                child_allocation.width = child_allocation.height;
-
-                if ((child_allocation.x < (allocation->x + allocation->width)) &&
-                    ((child_allocation.x + child_allocation.width) > allocation->x + border_width))
-                {
-                    gtk_widget_set_child_visible(GTK_WIDGET(iter->data), TRUE);
-                    gtk_widget_size_allocate(GTK_WIDGET(iter->data), &child_allocation);
-                }
-                else
-                    gtk_widget_set_child_visible(GTK_WIDGET(iter->data), FALSE);
-
-                child_allocation.x += child_allocation.width + spacing;
-                iter = g_list_next(iter);
-            }
-            break;
-        case GTK_ORIENTATION_VERTICAL:
-            if (bar->priv->auto_center == TRUE)
-            {
-                bar->priv->offset = 0 - (allocation->height / 2);
-            }
-            while(iter)
-            {
-                gtk_widget_get_child_requisition(GTK_WIDGET(iter->data), &child_requisition);
-                allocation->width = MAX(child_requisition.width + (border_width * 2), allocation->width);
-
-                if (bar->priv->auto_center == TRUE)
-                {
-                }
-
-                iter = g_list_next(iter);
-            }
-
-            child_allocation.y -= bar->priv->offset;
-            
-            iter = bar->priv->thumbs;
-
-            while(iter)
-            {
-
-                gtk_widget_get_child_requisition(GTK_WIDGET(iter->data), &child_requisition);
-                child_allocation.width = allocation->width - (border_width * 2);
-                child_allocation.height = child_allocation.width;
-
-                if (child_allocation.y < (allocation->y + allocation->height))
-                    gtk_widget_set_child_visible(GTK_WIDGET(iter->data), TRUE);
-                else
-                    gtk_widget_set_child_visible(GTK_WIDGET(iter->data), FALSE);
-
-                gtk_widget_size_allocate(GTK_WIDGET(iter->data), &child_allocation);
-                child_allocation.y += child_allocation.height + spacing;
-                iter = g_list_next(iter);
-            }
-            break;
-    }
-}
-
-static gboolean 
-rstto_thumbnail_bar_expose(GtkWidget *widget, GdkEventExpose *ex)
-{
-    RsttoThumbnailBar *bar = RSTTO_THUMBNAIL_BAR(widget);
-
-    GList *iter = bar->priv->thumbs;
-
-    GdkEventExpose *n_ex = g_new0(GdkEventExpose, 1);
-
-    gint border_width = GTK_CONTAINER(bar)->border_width;
-
-    n_ex->type = ex->type;
-    n_ex->window = ex->window;
-    n_ex->send_event = ex->send_event;
-    n_ex->area.x = border_width;
-    n_ex->area.y = border_width;
-    n_ex->area.width = ex->area.width;
-    n_ex->area.height = ex->area.height;
-    n_ex->count = ex->count;
-
-    while(iter)
-    {
-
-        if (GTK_WIDGET_VISIBLE(iter->data) == TRUE)
-        {
-            switch (bar->priv->orientation)
-            {
-                case GTK_ORIENTATION_HORIZONTAL:
-                    /* why are these widgets not filtered out with the GTK_WIDGET_VISIBLE macro?*/
-                    if (GTK_WIDGET(iter->data)->allocation.x > GTK_WIDGET(bar)->allocation.width)
-                        break;
-                    if ((GTK_WIDGET(iter->data)->allocation.x + GTK_WIDGET(iter->data)->allocation.width) < 0)
-                        break;
-
-                    /* first (partially) visible thumbnail */
-                    if (GTK_WIDGET(iter->data)->allocation.x < 0)
-                    {
-                        n_ex->area.x = 0;
-                        n_ex->area.width = GTK_WIDGET(iter->data)->allocation.width;
-                    }
-                    else
-                    {
-                        /* last (partially) visible thumbnail */
-                        if ((GTK_WIDGET(bar)->allocation.x + (GTK_WIDGET(bar)->allocation.width)) <
-                            (GTK_WIDGET(iter->data)->allocation.x + GTK_WIDGET(iter->data)->allocation.width))
-                        {
-                            n_ex->area.x = GTK_WIDGET(iter->data)->allocation.x;
-                            n_ex->area.width = GTK_WIDGET(bar)->allocation.x + GTK_WIDGET(bar)->allocation.width - n_ex->area.x;
-                        }
-                        else
-                        {
-                            /* everything in between */
-                            n_ex->area.x = GTK_WIDGET(iter->data)->allocation.x;
-                            n_ex->area.width = GTK_WIDGET(bar)->allocation.width - n_ex->area.x;
-                        }
-
-                    }
-                    if (n_ex->region)
-                        gdk_region_destroy(n_ex->region);
-                    n_ex->region = gdk_region_rectangle(&(n_ex->area));
-                    gtk_container_propagate_expose(GTK_CONTAINER(widget), GTK_WIDGET(iter->data), n_ex);
-                    break;
-                case GTK_ORIENTATION_VERTICAL:
-                    /* why are these widgets not filtered out with the GTK_WIDGET_VISIBLE macro?*/
-                    if (GTK_WIDGET(iter->data)->allocation.y > GTK_WIDGET(bar)->allocation.height)
-                        break;
-                    if ((GTK_WIDGET(iter->data)->allocation.y + GTK_WIDGET(iter->data)->allocation.height) < 0 )
-                        break;
-
-                    /* first (partially) visible thumbnail */
-                    if (GTK_WIDGET(iter->data)->allocation.y < 0)
-                    {
-                        n_ex->area.y = 0;
-                        n_ex->area.height = GTK_WIDGET(iter->data)->allocation.height;
-                    }
-                    else
-                    {
-                        /* last (partially) visible thumbnail */
-                        if ((GTK_WIDGET(bar)->allocation.y + (GTK_WIDGET(bar)->allocation.height)) <
-                            (GTK_WIDGET(iter->data)->allocation.y + GTK_WIDGET(iter->data)->allocation.height))
-                        {
-                            n_ex->area.y = GTK_WIDGET(iter->data)->allocation.y;
-                            n_ex->area.height = GTK_WIDGET(bar)->allocation.y + GTK_WIDGET(bar)->allocation.height - n_ex->area.y;
-                        }
-                        else
-                        {
-                            /* everything in between */
-                            n_ex->area.y = GTK_WIDGET(iter->data)->allocation.y;
-                            n_ex->area.height = GTK_WIDGET(bar)->allocation.height - n_ex->area.y;
-                        }
-
-                    }
-                    if (n_ex->region)
-                        gdk_region_destroy(n_ex->region);
-                    n_ex->region = gdk_region_rectangle(&(n_ex->area));
-                    gtk_container_propagate_expose(GTK_CONTAINER(widget), GTK_WIDGET(iter->data), n_ex);
-                    break;
-            }
-        }
-        iter = g_list_next(iter);
-    }
-
-    return FALSE;
-}
-
-static void
-rstto_thumbnail_bar_realize(GtkWidget *widget)
-{
-    RsttoThumbnailBar *bar = RSTTO_THUMBNAIL_BAR(widget);
-
-    GdkWindowAttr attributes;
-    gint attributes_mask;
-    gint border_width = 0;
-
-    GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
-
-    attributes.x = widget->allocation.x + border_width;
-    attributes.y = widget->allocation.y + border_width;
-    attributes.width = widget->allocation.width - border_width * 2;
-    attributes.height = widget->allocation.height - border_width * 2;
-    attributes.window_type = GDK_WINDOW_CHILD;
-    attributes.wclass = GDK_INPUT_OUTPUT;
-    attributes.visual = gtk_widget_get_visual (widget);
-    attributes.colormap = gtk_widget_get_colormap (widget);
-    attributes.event_mask = gtk_widget_get_events (widget) | GDK_EXPOSURE_MASK;
-
-    attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
-
-    widget->window = gdk_window_new (gtk_widget_get_parent_window (widget),
-                   &attributes, attributes_mask);
-    gdk_window_set_user_data (widget->window, bar);
-
-    attributes.x = 0;
-    attributes.y = 0;
-    widget->style = gtk_style_attach (widget->style, widget->window);
-    gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
-
-}
-
-static void
-rstto_thumbnail_bar_unrealize(GtkWidget *widget)
-{
-
-    if (GTK_WIDGET_CLASS (parent_class)->unrealize)
-        (* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget);
-
-}
-
-GtkWidget *
-rstto_thumbnail_bar_new (RsttoImageList *nav)
-{
-    RsttoThumbnailBar *bar;
-
-    bar = g_object_new(RSTTO_TYPE_THUMBNAIL_BAR, NULL);
-
-    rstto_thumbnail_bar_set_image_list (bar, nav);
-
-    return (GtkWidget *)bar;
-}
-
-void
-rstto_thumbnail_bar_set_image_list (RsttoThumbnailBar *bar, RsttoImageList *nav)
-{
-    if (bar->priv->image_list)
-    {
-        g_object_unref (bar->priv->image_list);
-        bar->priv->image_list = NULL;
-    }
-
-    bar->priv->image_list = nav;
-
-    if (bar->priv->image_list)
-    {
-        g_signal_connect (G_OBJECT (bar->priv->image_list), "new-image", G_CALLBACK (cb_rstto_thumbnail_bar_image_list_new_image), bar);
-        g_signal_connect (G_OBJECT (bar->priv->image_list), "remove-image", G_CALLBACK (cb_rstto_thumbnail_bar_image_list_remove_image), bar);
-        g_signal_connect (G_OBJECT (bar->priv->image_list), "remove-all", G_CALLBACK (cb_rstto_thumbnail_bar_image_list_remove_all), bar);
-        g_object_ref (nav);
-    }
-}
-/*
- * rstto_thumbnail_bar_set_orientation:
- *
- * @bar      : ThumbnailBar
- * @orientation :
- *
- */
-void
-rstto_thumbnail_bar_set_orientation (RsttoThumbnailBar *bar, GtkOrientation orientation)
-{
-    bar->priv->orientation = orientation;
-}
-
-/*
- * rstto_thumbnail_bar_get_orientation:
- *
- * @bar      : ThumbnailBar
- *
- * Return value : GtkOrientation
- *
- */
-GtkOrientation
-rstto_thumbnail_bar_get_orientation (RsttoThumbnailBar *bar)
-{
-    return bar->priv->orientation;
-}
-
-static void
-rstto_thumbnail_bar_add(GtkContainer *container, GtkWidget *child)
-{
-    RsttoThumbnailBar *bar = RSTTO_THUMBNAIL_BAR(container);
-	g_return_if_fail(GTK_IS_WIDGET(child));
-
-	gtk_widget_set_parent(child, GTK_WIDGET(container));
-
-    bar->priv->thumbs = g_list_insert_sorted_with_data (bar->priv->thumbs, child, (GCompareDataFunc)cb_rstto_thumbnail_bar_compare, bar);
-}
-
-static void
-rstto_thumbnail_bar_remove(GtkContainer *container, GtkWidget *child)
-{
-    RsttoThumbnailBar *bar = RSTTO_THUMBNAIL_BAR(container);
-	gboolean widget_was_visible;
-
-	g_return_if_fail(GTK_IS_WIDGET(child));
-
-
-	widget_was_visible = GTK_WIDGET_VISIBLE(child);
-
-    bar->priv->thumbs = g_list_remove(bar->priv->thumbs, child);
-
-	gtk_widget_unparent(child);
-
-	/* remove from list is somewhere else */
-	if(widget_was_visible)
-		gtk_widget_queue_resize(GTK_WIDGET(container));
-}
-
-static void
-rstto_thumbnail_bar_forall(GtkContainer *container, gboolean include_internals, GtkCallback callback, gpointer callback_data)
-{
-    RsttoThumbnailBar *bar = RSTTO_THUMBNAIL_BAR(container);
-
-    g_return_if_fail(callback != NULL);
-
-    g_list_foreach(bar->priv->thumbs, (GFunc)callback, callback_data);
-
-}
-
-static GType
-rstto_thumbnail_bar_child_type(GtkContainer *container)
-{
-    return GTK_TYPE_WIDGET;
-}
-
-static gint
-cb_rstto_thumbnail_bar_compare (GtkWidget *a, GtkWidget *b, gpointer user_data)
-{
-    RsttoThumbnailBar *bar = RSTTO_THUMBNAIL_BAR (user_data);
-    RsttoImage *a_i = rstto_thumbnail_get_image (RSTTO_THUMBNAIL (a));
-    RsttoImage *b_i = rstto_thumbnail_get_image (RSTTO_THUMBNAIL (b));
-
-    return rstto_image_list_get_compare_func (bar->priv->image_list) (a_i, b_i);
-}
-
-static gboolean
-cb_rstto_thumbnail_bar_thumbnail_button_press_event (GtkWidget *thumb, GdkEventButton *event)
-{
-    if(event->button == 1)
-    {
-        RsttoThumbnailBar *bar = RSTTO_THUMBNAIL_BAR(gtk_widget_get_parent(GTK_WIDGET(thumb)));
-
-        bar->priv->motion.offset = bar->priv->offset;
-        if (bar->priv->orientation == GTK_ORIENTATION_HORIZONTAL)
-        {
-            gdouble x = event->x + GTK_WIDGET(thumb)->allocation.x;
-            bar->priv->motion.current_x = x;
-        }
-        else
-        {
-            gdouble y = event->y + GTK_WIDGET(thumb)->allocation.y;
-            bar->priv->motion.current_y = y;
-        }
-    }
-
-    return FALSE;
-}
-
-static gboolean
-cb_rstto_thumbnail_bar_thumbnail_button_release_event (GtkWidget *thumb, GdkEventButton *event)
-{
-    RsttoThumbnailBar *bar = RSTTO_THUMBNAIL_BAR(gtk_widget_get_parent(GTK_WIDGET(thumb)));
-    if(event->button == 1)
-    {
-        GtkWidget *widget = GTK_WIDGET(thumb);
-        gdk_window_set_cursor(widget->window, NULL);
-        if (bar->priv->motion.motion == TRUE)
-        {
-            bar->priv->motion.motion = FALSE;
-            return TRUE;
-        }
-    }
-    return FALSE;
-}
-
-static gboolean 
-cb_rstto_thumbnail_bar_thumbnail_motion_notify_event (GtkWidget *thumb,
-                                                      GdkEventMotion *event,
-                                                      gpointer user_data)
-{
-    RsttoThumbnailBar *bar = RSTTO_THUMBNAIL_BAR(gtk_widget_get_parent(GTK_WIDGET(thumb)));
-    gdouble x = event->x + GTK_WIDGET(thumb)->allocation.x;
-    gdouble y = event->y + GTK_WIDGET(thumb)->allocation.y;
-
-    if (event->state & GDK_BUTTON1_MASK)
-    {
-        GtkWidget *widget = GTK_WIDGET(thumb);
-        GdkCursor *cursor = gdk_cursor_new(GDK_FLEUR);
-        gdk_window_set_cursor(widget->window, cursor);
-        gdk_cursor_unref(cursor);
-
-        bar->priv->motion.motion = TRUE;
-        bar->priv->auto_center = FALSE;
-        if (bar->priv->orientation == GTK_ORIENTATION_HORIZONTAL)
-        {
-            bar->priv->offset = bar->priv->motion.offset + (bar->priv->motion.current_x - x);
-        }
-        else
-        {
-            bar->priv->offset = bar->priv->motion.offset + (bar->priv->motion.current_y - y);
-        }
-        gtk_widget_queue_resize(GTK_WIDGET(bar));
-    }
-    return FALSE;
-}
-
-static gboolean
-cb_rstto_thumbnail_bar_scroll_event (RsttoThumbnailBar *bar,
-                                     GdkEventScroll *event,
-                                     gpointer *user_data)
-{
-    gint thumb_size;
-    GList *thumb;
-    gint border_width = GTK_CONTAINER(bar)->border_width;
-
-    switch(event->direction)
-    {
-        case GDK_SCROLL_UP:
-        case GDK_SCROLL_LEFT:
-            if (bar->priv->thumbs)
-            {   
-                bar->priv->auto_center = FALSE;
-                bar->priv->offset -= bar->priv->scroll_speed;
-                switch(bar->priv->orientation)
-                {
-                    case GTK_ORIENTATION_HORIZONTAL:
-                        thumb_size = GTK_WIDGET(bar->priv->thumbs->data)->allocation.width;
-                        if ((thumb_size - GTK_WIDGET(bar)->allocation.width) >= bar->priv->offset)
-                            bar->priv->offset = thumb_size - GTK_WIDGET(bar)->allocation.width + border_width;
-                        break;
-                    case GTK_ORIENTATION_VERTICAL:
-                        thumb_size = GTK_WIDGET(bar->priv->thumbs->data)->allocation.height;
-                        if ((thumb_size - GTK_WIDGET(bar)->allocation.height) >= bar->priv->offset)
-                            bar->priv->offset = thumb_size - GTK_WIDGET(bar)->allocation.height + border_width;
-                        break;
-                }
-            }
-            break;
-        case GDK_SCROLL_DOWN:
-        case GDK_SCROLL_RIGHT:
-            if (bar->priv->thumbs)
-            {   
-                gint size = 0;
-                bar->priv->auto_center = FALSE;
-                bar->priv->offset +=  bar->priv->scroll_speed;
-                switch(bar->priv->orientation)
-                {
-                    case GTK_ORIENTATION_HORIZONTAL:
-                        thumb_size = GTK_WIDGET(bar->priv->thumbs->data)->allocation.width;
-                        for (thumb = bar->priv->thumbs; thumb != NULL; thumb = g_list_next(thumb))
-                        {
-                            size += GTK_WIDGET(thumb->data)->allocation.width;
-                            if (g_list_next(thumb))
-                                size += border_width;
-                        }
-                        if ((size - thumb_size) <= bar->priv->offset)
-                            bar->priv->offset = size - thumb_size;
-                        break;
-                    case GTK_ORIENTATION_VERTICAL:
-                        thumb_size = GTK_WIDGET(bar->priv->thumbs->data)->allocation.height;
-                        for (thumb = bar->priv->thumbs; thumb != NULL; thumb = g_list_next(thumb))
-                        {
-                            size += GTK_WIDGET(thumb->data)->allocation.height;
-                            if (g_list_next(thumb))
-                                size += border_width;
-                        }
-                        if ((size - thumb_size) <= bar->priv->offset)
-                            bar->priv->offset = size - thumb_size;
-                        break;
-                }
-            }
-            break;
-    }
-    gtk_widget_queue_resize(GTK_WIDGET(bar));
-    return FALSE;
-
-}
-
-void
-rstto_thumbnail_bar_set_iter (RsttoThumbnailBar *bar, RsttoImageListIter *iter)
-{
-    if (bar->priv->iter)
-    {
-        g_signal_handlers_disconnect_by_func (bar->priv->iter, cb_rstto_thumbnail_bar_image_list_iter_changed, bar);
-
-        g_object_unref (bar->priv->iter);
-        g_object_unref (bar->priv->internal_iter);
-        bar->priv->internal_iter = NULL;
-    }
-
-    bar->priv->iter = iter;
-
-    if (bar->priv->iter)
-    {
-        g_object_ref (bar->priv->iter);
-        bar->priv->internal_iter = rstto_image_list_iter_clone (bar->priv->iter);
-        g_signal_connect (bar->priv->iter, "changed", G_CALLBACK (cb_rstto_thumbnail_bar_image_list_iter_changed), bar);
-    }
-}
-
-void
-cb_rstto_thumbnail_bar_image_list_iter_changed (RsttoImageListIter *iter, gpointer user_data)
-{
-    RsttoThumbnailBar *bar = RSTTO_THUMBNAIL_BAR (user_data);
-    /* useless, but keepsthe compiler silent */
-    bar->priv->begin=0;
-}
-
-static void
-cb_rstto_thumbnail_bar_image_list_new_image (RsttoImageList *image_list, RsttoImage *image, gpointer user_data)
-{
-    RsttoThumbnailBar *bar = RSTTO_THUMBNAIL_BAR (user_data);
-    GtkWidget *thumb;
-
-    g_return_if_fail (rstto_image_list_iter_find_image (bar->priv->internal_iter, image));
-
-    thumb = rstto_thumbnail_new (image);
-
-    gtk_container_add (GTK_CONTAINER (bar), thumb);
-    gtk_widget_show_all (thumb);
-
-    g_signal_connect (thumb, "clicked", G_CALLBACK (cb_rstto_thumbnail_bar_thumbnail_clicked), bar);
-    g_signal_connect (thumb, "button_press_event", G_CALLBACK (cb_rstto_thumbnail_bar_thumbnail_button_press_event), bar);
-    g_signal_connect (thumb, "button_release_event", G_CALLBACK (cb_rstto_thumbnail_bar_thumbnail_button_release_event), bar);
-    g_signal_connect (thumb, "motion_notify_event", G_CALLBACK (cb_rstto_thumbnail_bar_thumbnail_motion_notify_event), bar);
-}
-
-static void
-cb_rstto_thumbnail_bar_image_list_remove_image (RsttoImageList *image_list, RsttoImage *image, gpointer user_data)
-{
-    RsttoThumbnailBar *bar = RSTTO_THUMBNAIL_BAR (user_data);
-    GList *iter = bar->priv->thumbs;
-
-    while (iter)
-    {
-        if (rstto_thumbnail_get_image (iter->data) == image)
-        {
-            GtkWidget *widget = iter->data;
-            gtk_container_remove (GTK_CONTAINER (bar), widget);
-            break;
-        }
-        iter = g_list_next (iter);
-    }
-}
-
-static void
-cb_rstto_thumbnail_bar_image_list_remove_all (RsttoImageList *image_list, gpointer user_data)
-{
-    RsttoThumbnailBar *bar = RSTTO_THUMBNAIL_BAR (user_data);
-    if (bar->priv->thumbs)
-    {
-        g_list_foreach (bar->priv->thumbs, (GFunc)(gtk_widget_destroy), NULL);
-        g_list_free (bar->priv->thumbs);
-        bar->priv->thumbs = NULL;
-    }
-}
-
-
-
-static void
-cb_rstto_thumbnail_bar_thumbnail_clicked (GtkWidget *thumb, RsttoThumbnailBar *bar)
-{
-    g_return_if_fail (bar->priv->iter);
-    rstto_image_list_iter_set_position (bar->priv->iter, g_list_index(bar->priv->thumbs, thumb));
-}
diff --git a/src/thumbnail_bar.h b/src/thumbnail_bar.h
deleted file mode 100644
index e5cb3cb..0000000
--- a/src/thumbnail_bar.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU Library General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#ifndef __RISTRETTO_THUMBNAIL_BAR_H__
-#define __RISTRETTO_THUMBNAIL_BAR_H__
-
-G_BEGIN_DECLS
-
-#define RSTTO_TYPE_THUMBNAIL_BAR rstto_thumbnail_bar_get_type()
-
-#define RSTTO_THUMBNAIL_BAR(obj)( \
-        G_TYPE_CHECK_INSTANCE_CAST ((obj), \
-                RSTTO_TYPE_THUMBNAIL_BAR, \
-                RsttoThumbnailBar))
-
-#define RSTTO_IS_THUMBNAIL_BAR(obj)( \
-        G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
-                RSTTO_TYPE_THUMBNAIL_BAR))
-
-#define RSTTO_THUMBNAIL_BAR_CLASS(klass)( \
-        G_TYPE_CHECK_CLASS_CAST ((klass), \
-                RSTTO_TYPE_THUMBNAIL_BAR, \
-                RsttoThumbnailBarClass))
-
-#define RSTTO_IS_THUMBNAIL_BAR_CLASS(klass)( \
-        G_TYPE_CHECK_CLASS_TYPE ((klass), \
-                RSTTO_TYPE_THUMBNAIL_BAR()))
-
-typedef struct _RsttoThumbnailBarPriv RsttoThumbnailBarPriv;
-
-typedef struct _RsttoThumbnailBar RsttoThumbnailBar;
-
-struct _RsttoThumbnailBar
-{
-    GtkContainer           parent;
-    RsttoThumbnailBarPriv *priv;
-};
-
-typedef struct _RsttoThumbnailBarClass RsttoThumbnailBarClass;
-
-struct _RsttoThumbnailBarClass
-{
-    GtkContainerClass  parent_class;
-};
-
-GType      rstto_thumbnail_bar_get_type();
-
-GtkWidget *rstto_thumbnail_bar_new();
-
-void       rstto_thumbnail_bar_set_orientation (RsttoThumbnailBar *, GtkOrientation);
-GtkOrientation  rstto_thumbnail_bar_get_orientation (RsttoThumbnailBar *);
-
-void rstto_thumbnail_bar_set_image_list (RsttoThumbnailBar *bar, RsttoImageList *nav);
-void rstto_thumbnail_bar_set_iter (RsttoThumbnailBar *bar, RsttoImageListIter *iter);
-
-G_END_DECLS
-
-#endif /* __RISTRETTO_THUMBNAIL_BAR_H__ */
diff --git a/src/main.h b/src/transition_renderer.c
similarity index 100%
copy from src/main.h
copy to src/transition_renderer.c
diff --git a/src/main.h b/src/transition_renderer.h
similarity index 100%
copy from src/main.h
copy to src/transition_renderer.h



More information about the Xfce4-commits mailing list