[Xfce4-commits] <ristretto:ristretto-0.0> Cleanup, update ChangeLog and implement sorting

Stephan Arts noreply at xfce.org
Sun Oct 23 19:20:31 CEST 2011


Updating branch refs/heads/ristretto-0.0
         to 73ca8a7455f1c571a1ab14e7e7915350fc0c595b (commit)
       from 17c51cbd73d37e838a046941386cb688abeaeb5b (commit)

commit 73ca8a7455f1c571a1ab14e7e7915350fc0c595b
Author: Stephan Arts <stephan at xfce.org>
Date:   Thu Sep 3 23:48:22 2009 +0200

    Cleanup, update ChangeLog and implement sorting

 ChangeLog         |    7 +
 src/image_list.c  |   22 +-
 src/main_window.c | 2000 +++++++++++++++++++++++++++--------------------------
 3 files changed, 1058 insertions(+), 971 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index f733d75..4ed9f63 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2009-09-03  Stephan Arts <stephan at xfce.org>
 
+	* src/main_window.c: Start on a code cleanup
+	* src/image_list.c,
+	  src/main_window.c: Implement sort-by-date
+	* src/main_window.c: Stop slideshow when there is just one or no image opened
+
+2009-09-03  Stephan Arts <stephan at xfce.org>
+
 	* src/image_list.c,
 	  src/image_list.h: Add functions to set buildin and custom sorting 
 	  functions
diff --git a/src/image_list.c b/src/image_list.c
index d2128e8..cee785a 100644
--- a/src/image_list.c
+++ b/src/image_list.c
@@ -5,8 +5,7 @@
  *  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,
+ * *  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.
@@ -475,6 +474,7 @@ void
 rstto_image_list_set_compare_func (RsttoImageList *image_list, GCompareFunc func)
 {
     image_list->priv->cb_rstto_image_list_compare_func = func;
+    image_list->priv->images = g_list_sort (image_list->priv->images,  func);
 }
 
 /***********************/
@@ -484,13 +484,13 @@ rstto_image_list_set_compare_func (RsttoImageList *image_list, GCompareFunc func
 void
 rstto_image_list_set_sort_by_name (RsttoImageList *image_list)
 {
-    image_list->priv->cb_rstto_image_list_compare_func = (GCompareFunc)cb_rstto_image_list_image_name_compare_func;
+    rstto_image_list_set_compare_func (image_list, (GCompareFunc)cb_rstto_image_list_image_name_compare_func);
 }
 
 void
 rstto_image_list_set_sort_by_date (RsttoImageList *image_list)
 {
-    image_list->priv->cb_rstto_image_list_compare_func = (GCompareFunc)cb_rstto_image_list_exif_date_compare_func;
+    rstto_image_list_set_compare_func (image_list, (GCompareFunc)cb_rstto_image_list_exif_date_compare_func);
 }
 
 /**
@@ -520,6 +520,7 @@ cb_rstto_image_list_image_name_compare_func (RsttoImage *a, RsttoImage *b)
  * @a:
  * @b:
  *
+ * TODO: Use EXIF data if available, not the last-modification-time.
  *
  * Return value: (see strcmp)
  */
@@ -527,5 +528,18 @@ static gint
 cb_rstto_image_list_exif_date_compare_func (RsttoImage *a, RsttoImage *b)
 {
     gint result = 0;
+    
+    GFileInfo *file_info_a = g_file_query_info (rstto_image_get_file (a), "time::modified", 0, NULL, NULL);
+    GFileInfo *file_info_b = g_file_query_info (rstto_image_get_file (b), "time::modified", 0, NULL, NULL);
+
+    guint64 a_i = g_file_info_get_attribute_uint64(file_info_a, "time::modified");
+    guint64 b_i = g_file_info_get_attribute_uint64(file_info_b, "time::modified");
+    if (a_i > b_i)
+        result = 1;
+    else
+        result = 0;
+
+    g_object_unref (file_info_a);
+    g_object_unref (file_info_b);
     return result;
 }
diff --git a/src/main_window.c b/src/main_window.c
index fd1b77d..dfbd7bc 100644
--- a/src/main_window.c
+++ b/src/main_window.c
@@ -191,6 +191,8 @@ cb_rstto_main_window_delete (GtkWidget *widget, RsttoMainWindow *window);
 static void
 cb_rstto_main_window_set_as_wallpaper (GtkWidget *widget, RsttoMainWindow *window);
 static void
+cb_rstto_main_window_sorting_function_changed (GtkRadioAction *action, GtkRadioAction *current,  RsttoMainWindow *window);
+static void
 cb_rstto_main_window_navigationtoolbar_position_changed (GtkRadioAction *, GtkRadioAction *,  RsttoMainWindow *window);
 static void
 cb_rstto_main_window_navigationtoolbar_button_press_event (GtkWidget *widget, GdkEventButton *event, gpointer user_data);
@@ -304,26 +306,34 @@ static GtkActionEntry action_entries[] =
                 NULL,
                 N_ ("Display information about ristretto"),
                 G_CALLBACK (cb_rstto_main_window_about), },
-/* Positio Menu */
+/* Position Menu */
   { "position-menu", NULL, N_ ("_Position"), NULL, },
 /* Misc */
   { "leave-fullscreen", GTK_STOCK_LEAVE_FULLSCREEN, N_ ("Leave _Fullscreen"), NULL, NULL, G_CALLBACK (cb_rstto_main_window_fullscreen), },
   { "tb-menu", NULL, NULL, NULL, }
 };
 
+/** Toggle Action Entries */
 static const GtkToggleActionEntry toggle_action_entries[] =
 {
+    /* Toggle visibility of the main file toolbar */
     { "show-file-toolbar", NULL, N_ ("Show _File Toolbar"), NULL, NULL, G_CALLBACK (cb_rstto_main_window_toggle_show_file_toolbar), TRUE, },
+    /* Toggle visibility of the main navigation toolbar */
     { "show-nav-toolbar", NULL, N_ ("Show _Navigation Toolbar"), NULL, NULL, G_CALLBACK (cb_rstto_main_window_toggle_show_nav_toolbar), TRUE, },
+    /* Toggle visibility of the thumbnailbar*/
     { "show-thumbnailbar", NULL, N_ ("Show _Thumbnailbar"), NULL, NULL, G_CALLBACK (cb_rstto_main_window_toggle_show_thumbnailbar), TRUE, },
 };
 
+/** Image sorting options*/
 static const GtkRadioActionEntry radio_action_sort_entries[] = 
 {
+    /* Sort by Filename */
     {"sort-filename", NULL, N_("sort by filename"), NULL, NULL, 0},
+    /* Sort by Date*/
     {"sort-date", NULL, N_("sort by date"), NULL, NULL, 1},
 };
 
+/** Navigationbar+Thumbnailbar positioning options*/
 static const GtkRadioActionEntry radio_action_pos_entries[] = 
 {
     { "pos-left", NULL, N_("Left"), NULL, NULL, 0},
@@ -407,8 +417,11 @@ rstto_main_window_init (RsttoMainWindow *window)
     window->priv->toolbar_unfullscreen_merge_id = gtk_ui_manager_new_merge_id (window->priv->ui_manager);
 
 
+    /* Create Play/Pause Slideshow actions */
     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);
+
+    /* Create Recently used items Action */
     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);
@@ -442,7 +455,7 @@ rstto_main_window_init (RsttoMainWindow *window)
     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_action_group_add_radio_actions (window->priv->action_group, radio_action_sort_entries , G_N_ELEMENTS (radio_action_sort_entries), 0, G_CALLBACK (cb_rstto_main_window_sorting_function_changed), GTK_WIDGET (window));
     gtk_action_group_add_radio_actions (window->priv->action_group, radio_action_pos_entries, G_N_ELEMENTS (radio_action_pos_entries), navigationbar_position, G_CALLBACK (cb_rstto_main_window_navigationtoolbar_position_changed), GTK_WIDGET (window));
 
     gtk_ui_manager_add_ui_from_string (window->priv->ui_manager,main_window_ui, main_window_ui_length, NULL);
@@ -700,12 +713,6 @@ rstto_main_window_new (RsttoImageList *image_list, gboolean fullscreen)
     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:
@@ -779,6 +786,21 @@ rstto_main_window_update_buttons (RsttoMainWindow *window)
 
             gtk_action_set_sensitive (window->priv->play_action, FALSE);
             gtk_action_set_sensitive (window->priv->pause_action, FALSE);
+
+    
+            /* Stop the slideshow if no image is opened */
+            if (window->priv->playing == TRUE)
+            {
+                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;
+            }
             
 
             /* View Menu */
@@ -814,6 +836,20 @@ rstto_main_window_update_buttons (RsttoMainWindow *window)
 
             gtk_action_set_sensitive (window->priv->play_action, FALSE);
             gtk_action_set_sensitive (window->priv->pause_action, FALSE);
+
+            /* Stop the slideshow if only one image is opened */
+            if (window->priv->playing == TRUE)
+            {
+                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;
+            }
             
 
             /* View Menu */
@@ -947,687 +983,473 @@ rstto_main_window_get_property (GObject    *object,
     }
 }
 
-/**
- * cb_rstto_main_window_zoom_fit:
- * @widget:
- * @window:
- *
- *
- */
+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_zoom_fit (GtkWidget *widget, RsttoMainWindow *window)
+rstto_main_window_set_navigationbar_position (RsttoMainWindow *window, guint orientation)
 {
-    rstto_picture_viewer_zoom_fit (RSTTO_PICTURE_VIEWER (window->priv->picture_viewer));
+    rstto_settings_set_navbar_position (window->priv->settings_manager, orientation);
+
+    switch (orientation)
+    {
+        case 0: /* Left */
+            g_object_ref (window->priv->image_list_toolbar);
+            g_object_ref (window->priv->thumbnailbar);
+
+            gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (window->priv->thumbnailbar)), window->priv->thumbnailbar);
+            gtk_paned_pack1 (GTK_PANED (window->priv->hpaned_left), window->priv->thumbnailbar, FALSE, FALSE);
+
+            gtk_container_remove (GTK_CONTAINER (window->priv->table), window->priv->image_list_toolbar);
+            gtk_table_attach (GTK_TABLE (window->priv->table), window->priv->image_list_toolbar, 0, 1, 0, 3, GTK_FILL, GTK_EXPAND|GTK_FILL, 0, 0);
+            gtk_toolbar_set_orientation (GTK_TOOLBAR (window->priv->image_list_toolbar), GTK_ORIENTATION_VERTICAL);
+            rstto_thumbnail_bar_set_orientation (RSTTO_THUMBNAIL_BAR(window->priv->thumbnailbar), GTK_ORIENTATION_VERTICAL);
+            break;
+        case 1: /* Right */
+            g_object_ref (window->priv->image_list_toolbar);
+            g_object_ref (window->priv->thumbnailbar);
+
+            gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (window->priv->thumbnailbar)), window->priv->thumbnailbar);
+            gtk_paned_pack2 (GTK_PANED (window->priv->hpaned_right), window->priv->thumbnailbar, FALSE, FALSE);
+
+            gtk_container_remove (GTK_CONTAINER (window->priv->table), window->priv->image_list_toolbar);
+            gtk_table_attach (GTK_TABLE (window->priv->table), window->priv->image_list_toolbar, 2, 3, 0, 3, GTK_FILL,GTK_EXPAND|GTK_FILL, 0, 0);
+            gtk_toolbar_set_orientation (GTK_TOOLBAR (window->priv->image_list_toolbar), GTK_ORIENTATION_VERTICAL);
+            rstto_thumbnail_bar_set_orientation (RSTTO_THUMBNAIL_BAR(window->priv->thumbnailbar), GTK_ORIENTATION_VERTICAL);
+            break;
+        case 2: /* Top */
+            g_object_ref (window->priv->image_list_toolbar);
+            g_object_ref (window->priv->thumbnailbar);
+
+            gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (window->priv->thumbnailbar)), window->priv->thumbnailbar);
+            gtk_paned_pack1 (GTK_PANED (window->priv->vpaned_top), window->priv->thumbnailbar, FALSE, FALSE);
+
+            gtk_container_remove (GTK_CONTAINER (window->priv->table), window->priv->image_list_toolbar);
+            gtk_table_attach (GTK_TABLE (window->priv->table), window->priv->image_list_toolbar, 0, 3, 0, 1, GTK_EXPAND|GTK_FILL,GTK_FILL, 0, 0);
+            gtk_toolbar_set_orientation (GTK_TOOLBAR (window->priv->image_list_toolbar), GTK_ORIENTATION_HORIZONTAL);
+            rstto_thumbnail_bar_set_orientation (RSTTO_THUMBNAIL_BAR(window->priv->thumbnailbar), GTK_ORIENTATION_HORIZONTAL);
+            break;
+        case 3: /* Bottom */
+            g_object_ref (window->priv->image_list_toolbar);
+            g_object_ref (window->priv->thumbnailbar);
+
+            gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (window->priv->thumbnailbar)), window->priv->thumbnailbar);
+            gtk_paned_pack2 (GTK_PANED (window->priv->vpaned_bottom), window->priv->thumbnailbar, FALSE, FALSE);
+
+            gtk_container_remove (GTK_CONTAINER (window->priv->table), window->priv->image_list_toolbar);
+            gtk_table_attach (GTK_TABLE (window->priv->table), window->priv->image_list_toolbar, 0, 3, 2, 3, GTK_EXPAND|GTK_FILL,GTK_FILL, 0, 0);
+            gtk_toolbar_set_orientation (GTK_TOOLBAR (window->priv->image_list_toolbar), GTK_ORIENTATION_HORIZONTAL);
+            rstto_thumbnail_bar_set_orientation (RSTTO_THUMBNAIL_BAR(window->priv->thumbnailbar), GTK_ORIENTATION_HORIZONTAL);
+            break;
+        default:
+            break;
+    }
 }
 
-/**
- * cb_rstto_main_window_zoom_100:
- * @widget:
- * @window:
- *
- *
- */
+
+/************************/
+/**                    **/
+/** Callback functions **/
+/**                    **/
+/************************/
+
 static void
-cb_rstto_main_window_zoom_100 (GtkWidget *widget, RsttoMainWindow *window)
+cb_rstto_main_window_navigationtoolbar_button_press_event (GtkWidget *widget, GdkEventButton *event, gpointer user_data)
 {
-    rstto_picture_viewer_zoom_100 (RSTTO_PICTURE_VIEWER (window->priv->picture_viewer));
+    int button, event_time;
+    RsttoMainWindow *window = RSTTO_MAIN_WINDOW (user_data);
+    GtkWidget *menu = NULL;
+    if (event->button == 3 && event->type == GDK_BUTTON_PRESS)
+    {
+        if (event)
+        {
+            button = event->button;
+            event_time = event->time;
+        }
+        else
+        {
+            button = 0;
+            event_time = gtk_get_current_event_time ();
+        }
+
+
+        menu = window->priv->position_menu;
+        gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL, 
+                  button, event_time);
+    }
 }
 
-/**
- * cb_rstto_main_window_zoom_in:
- * @widget:
- * @window:
- *
- *
- */
 static void
-cb_rstto_main_window_zoom_in (GtkWidget *widget, RsttoMainWindow *window)
+cb_rstto_main_window_image_list_iter_changed (RsttoImageListIter *iter, RsttoMainWindow *window)
 {
-    rstto_picture_viewer_zoom_in (RSTTO_PICTURE_VIEWER (window->priv->picture_viewer), ZOOM_FACTOR);
+    rstto_main_window_image_list_iter_changed (window);
 }
 
-/**
- * cb_rstto_main_window_zoom_out:
- * @widget:
- * @window:
- *
- *
- */
 static void
-cb_rstto_main_window_zoom_out (GtkWidget *widget, RsttoMainWindow *window)
+cb_rstto_main_window_sorting_function_changed (GtkRadioAction *action, GtkRadioAction *current,  RsttoMainWindow *window)
 {
-    rstto_picture_viewer_zoom_out (RSTTO_PICTURE_VIEWER (window->priv->picture_viewer), ZOOM_FACTOR);
+    switch (gtk_radio_action_get_current_value (current))
+    {
+        case 0:  /* Sort by filename */
+        default:
+            rstto_image_list_set_sort_by_name (window->priv->props.image_list);
+            break;
+        case 1: /* Sort by date */
+            rstto_image_list_set_sort_by_date (window->priv->props.image_list);
+            break;
+    }
 }
 
-/**********************/
-/* ROTATION CALLBACKS */
-/**********************/
+static void
+cb_rstto_main_window_navigationtoolbar_position_changed (GtkRadioAction *action, GtkRadioAction *current,  RsttoMainWindow *window)
+{
+    rstto_main_window_set_navigationbar_position (window, gtk_radio_action_get_current_value (current));
+}
 
 /**
- * cb_rstto_main_window_rotate_cw:
+ * cb_rstto_main_window_message_bar_open:
  * @widget:
  * @window:
  *
- *
  */
 static void
-cb_rstto_main_window_rotate_cw (GtkWidget *widget, RsttoMainWindow *window)
+cb_rstto_main_window_message_bar_open (GtkWidget *widget, RsttoMainWindow *window)
 {
-    RsttoImage *image = NULL;
+    GFile *child_file = NULL;
+    GFileEnumerator *file_enumarator = NULL;
+    GFileInfo *file_info = NULL;
+    const gchar *filename = NULL;
+    const gchar *content_type = NULL;
 
-    if (window->priv->iter)
-        image = rstto_image_list_iter_get_image (window->priv->iter);
+    gtk_widget_hide (window->priv->message_bar);
 
-    if (image)
+
+    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))
     {
-        switch (rstto_image_get_orientation (image))
+        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)
         {
-            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;
+            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;
     }
 }
 
-/**
- * cb_rstto_main_window_rotate_ccw:
- * @widget:
- * @window:
- *
- *
- */
 static void
-cb_rstto_main_window_rotate_ccw (GtkWidget *widget, RsttoMainWindow *window)
+cb_rstto_main_window_set_as_wallpaper (GtkWidget *widget, RsttoMainWindow *window)
 {
-    RsttoImage *image = NULL;
+    
+}
 
-    if (window->priv->iter)
-        image = rstto_image_list_iter_get_image (window->priv->iter);
+static void
+cb_rstto_main_window_state_event(GtkWidget *widget, GdkEventWindowState *event, gpointer user_data)
+{
+    RsttoMainWindow *window = RSTTO_MAIN_WINDOW(widget);
+    GValue           show_file_toolbar_val = {0,};
+    GValue           show_nav_toolbar_val = {0,};
 
-    if (image)
+    if(event->changed_mask & GDK_WINDOW_STATE_FULLSCREEN)
     {
-        switch (rstto_image_get_orientation (image))
+        if(event->new_window_state & GDK_WINDOW_STATE_FULLSCREEN)
         {
-            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;
+            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_file_toolbar_val, G_TYPE_BOOLEAN);
+            g_object_get_property (G_OBJECT(window->priv->settings_manager), "show-file-toolbar", &show_file_toolbar_val);
+
+            g_value_init (&show_nav_toolbar_val, G_TYPE_BOOLEAN);
+            g_object_get_property (G_OBJECT(window->priv->settings_manager), "show-nav-toolbar", &show_nav_toolbar_val);
+
+            gtk_widget_show (window->priv->menubar);
+            gtk_widget_show (window->priv->statusbar);
+
+            if (g_value_get_boolean (&show_file_toolbar_val))
+                gtk_widget_show (window->priv->toolbar);
+
+            if (g_value_get_boolean (&show_nav_toolbar_val))
+                gtk_widget_show (window->priv->image_list_toolbar);
+            else
+                gtk_widget_hide(window->priv->image_list_toolbar);
+            
+            g_value_reset (&show_file_toolbar_val);
         }
     }
+    if (event->changed_mask & GDK_WINDOW_STATE_MAXIMIZED)
+    {
+    }
 }
 
+static gboolean 
+cb_rstto_main_window_motion_notify_event (RsttoMainWindow *window,
+                                         GdkEventMotion *event,
+                                         gpointer user_data)
+{
+    gint width, height;
+    if(gdk_window_get_state(GTK_WIDGET(window)->window) & GDK_WINDOW_STATE_FULLSCREEN)
+    {
+	gdk_drawable_get_size (GDK_DRAWABLE(GTK_WIDGET(window)->window), &width, &height);
+        //if ((event->state == 0) && (event->window == event->subwindow))
+	if ((event->x_root == 0) || (event->y_root == 0) || (((gint)event->x_root) == (width-1)) || (((gint)event->y_root) == (height-1)))
+        {
+            gtk_widget_show (window->priv->image_list_toolbar);
+            window->priv->fs_toolbar_sticky = TRUE;
 
-/************************/
-/* NAVIGATION CALLBACKS */
-/************************/
+            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;
+            }
+        }
+    }
+    return TRUE;
+}
+
+static gboolean
+cb_rstto_main_window_picture_viewer_enter_notify_event (GtkWidget *widget,
+                                                        GdkEventCrossing *event,
+                                                        gpointer user_data)
+{
+    RsttoMainWindow *window = RSTTO_MAIN_WINDOW (user_data);
+    if(gdk_window_get_state(GTK_WIDGET(window)->window) & GDK_WINDOW_STATE_FULLSCREEN)
+    {
+        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 (2000, (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_first_image:
+ * cb_rstto_main_window_message_bar_cancel:
  * @widget:
  * @window:
  *
- * Move the iter to the first image;
- *
  */
 static void
-cb_rstto_main_window_first_image (GtkWidget *widget, RsttoMainWindow *window)
+cb_rstto_main_window_message_bar_cancel (GtkWidget *widget, RsttoMainWindow *window)
 {
-    rstto_image_list_iter_set_position (window->priv->iter, 0);
+    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_last_image:
+ * cb_rstto_main_window_play:
  * @widget:
  * @window:
  *
- * Move the iter to the last image;
+ * Remove the play button from the menu, and add the pause button.
  *
  */
 static void
-cb_rstto_main_window_last_image (GtkWidget *widget, RsttoMainWindow *window)
+cb_rstto_main_window_play (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);
+    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_next_image:
+ * cb_rstto_main_window_pause:
  * @widget:
  * @window:
  *
- * Move the iter to the next image;
+ * Remove the pause button from the menu, and add the play button.
  *
  */
 static void
-cb_rstto_main_window_next_image (GtkWidget *widget, RsttoMainWindow *window)
+cb_rstto_main_window_pause (GtkWidget *widget, RsttoMainWindow *window)
 {
-    rstto_image_list_iter_next (window->priv->iter);
+    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_previous_image:
- * @widget:
+ * cb_rstto_main_window_play_slideshow:
  * @window:
  *
- * Move the iter to the previous image;
- *
  */
-static void
-cb_rstto_main_window_previous_image (GtkWidget *widget, RsttoMainWindow *window)
+static gboolean
+cb_rstto_main_window_play_slideshow (RsttoMainWindow *window)
 {
-    rstto_image_list_iter_previous (window->priv->iter);
+    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_open_image:
+ * cb_rstto_main_window_fullscreen:
  * @widget:
  * @window:
  *
+ * Toggle the fullscreen mode of this 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
-            {
-
-                uri = g_file_get_uri (files->data);
-                gtk_recent_manager_add_item (window->priv->recent_manager, uri);
-                g_free (uri);
-                uri = NULL;
-
-                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_ACCEPT,
-                                                    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)
+cb_rstto_main_window_fullscreen (GtkWidget *widget, RsttoMainWindow *window)
 {
     if(gdk_window_get_state(GTK_WIDGET(window)->window) & GDK_WINDOW_STATE_FULLSCREEN)
     {
@@ -1739,545 +1561,789 @@ cb_rstto_main_window_quit (GtkWidget *widget, RsttoMainWindow *window)
 }
 
 /**
- * cb_rstto_main_window_close:
+ * 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;
+}
+
+/******************/
+/* ZOOM CALLBACKS */
+/******************/
+
+/**
+ * cb_rstto_main_window_zoom_fit:
  * @widget:
  * @window:
  *
  *
  */
 static void
-cb_rstto_main_window_close (GtkWidget *widget, RsttoMainWindow *window)
+cb_rstto_main_window_zoom_fit (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);
+    rstto_picture_viewer_zoom_fit (RSTTO_PICTURE_VIEWER (window->priv->picture_viewer));
 }
 
 /**
- * cb_rstto_main_window_close_all:
+ * cb_rstto_main_window_zoom_100:
  * @widget:
  * @window:
  *
  *
  */
 static void
-cb_rstto_main_window_close_all (GtkWidget *widget, RsttoMainWindow *window)
+cb_rstto_main_window_zoom_100 (GtkWidget *widget, RsttoMainWindow *window)
 {
-    rstto_image_list_remove_all (window->priv->props.image_list);
-    rstto_main_window_image_list_iter_changed (window);
+    rstto_picture_viewer_zoom_100 (RSTTO_PICTURE_VIEWER (window->priv->picture_viewer));
 }
 
 /**
- * cb_rstto_main_window_delete:
+ * cb_rstto_main_window_zoom_in:
  * @widget:
  * @window:
  *
  *
  */
 static void
-cb_rstto_main_window_delete (GtkWidget *widget, RsttoMainWindow *window)
+cb_rstto_main_window_zoom_in (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)
+    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)
     {
-        if (g_file_trash (file, NULL, NULL) == TRUE)
+        switch (rstto_image_get_orientation (image))
         {
-            rstto_image_list_remove_image (window->priv->props.image_list, 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;
         }
-        else
+    }
+}
+
+/**
+ * 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;
         }
     }
-    gtk_widget_destroy (dialog);
-    g_free (basename);
-    g_free (path);
-    g_object_unref (image);
 }
 
+
+/************************/
+/* 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_toggle_show_file_toolbar:
+ * cb_rstto_main_window_last_image:
  * @widget:
  * @window:
  *
+ * Move the iter to the last image;
  *
  */
 static void
-cb_rstto_main_window_toggle_show_file_toolbar (GtkWidget *widget, RsttoMainWindow *window)
+cb_rstto_main_window_last_image (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-file-toolbar", &val);
+    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_toggle_show_nav_toolbar:
+ * cb_rstto_main_window_next_image:
  * @widget:
  * @window:
  *
+ * Move the iter to the next image;
  *
  */
 static void
-cb_rstto_main_window_toggle_show_nav_toolbar (GtkWidget *widget, RsttoMainWindow *window)
+cb_rstto_main_window_next_image (GtkWidget *widget, RsttoMainWindow *window)
 {
-    GValue val = {0,};
-    g_value_init (&val, G_TYPE_BOOLEAN);
+    rstto_image_list_iter_next (window->priv->iter);
+}
 
-    if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (widget)))
-    {
-        gtk_widget_show (window->priv->image_list_toolbar);
-        g_value_set_boolean (&val, TRUE);
-    }
-    else
-    {
-        gtk_widget_hide (window->priv->image_list_toolbar);
-        g_value_set_boolean (&val, FALSE);
-    }
-    g_object_set_property (G_OBJECT (window->priv->settings_manager), "show-nav-toolbar", &val);
+/**
+ * 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);
 }
 
+/**********************/
+/* FILE I/O CALLBACKS */
+/**********************/
+
 /**
- * cb_rstto_main_window_toggle_show_thumbnailbar:
+ * cb_rstto_main_window_open_image:
  * @widget:
  * @window:
  *
  *
  */
 static void
-cb_rstto_main_window_toggle_show_thumbnailbar (GtkWidget *widget, RsttoMainWindow *window)
+cb_rstto_main_window_open_image (GtkWidget *widget, RsttoMainWindow *window)
 {
-    GValue val = {0,};
-    g_value_init (&val, G_TYPE_BOOLEAN);
+    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;
 
-    if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (widget)))
+    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)
     {
-        gtk_widget_show (window->priv->thumbnailbar);
-        g_value_set_boolean (&val, TRUE);
+        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
+            {
+
+                uri = g_file_get_uri (files->data);
+                gtk_recent_manager_add_item (window->priv->recent_manager, uri);
+                g_free (uri);
+                uri = NULL;
+
+                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);
+
     }
-    else
+
+    gtk_widget_destroy(dialog);
+
+    if (files)
     {
-        gtk_widget_hide (window->priv->thumbnailbar);
-        g_value_set_boolean (&val, FALSE);
+        g_slist_foreach (files, (GFunc)g_object_unref, NULL);
+        g_slist_free (files);
     }
-    g_object_set_property (G_OBJECT (window->priv->settings_manager), "show-thumbnailbar", &val);
 }
 
 /**
- * cb_rstto_main_window_image_list_new_image:
- * @image_list:
- * @image:
+ * cb_rstto_main_window_open_folder:
+ * @widget:
  * @window:
  *
+ *
  */
 static void
-cb_rstto_main_window_image_list_new_image (RsttoImageList *image_list, RsttoImage *image, RsttoMainWindow *window)
+cb_rstto_main_window_open_folder (GtkWidget *widget, 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);
-}
+    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;
 
-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)
+    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_ACCEPT,
+                                                    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)
     {
-        /* drop any previous timer source */
-        if (window->priv->window_save_geometry_timer_id > 0)
+        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))
         {
-            g_source_remove (window->priv->window_save_geometry_timer_id);
+            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);
         }
-        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);
-        }
+        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);
     }
 
-    /* let Gtk+ handle the configure event */
-    return FALSE;
-}
+    gtk_widget_destroy(dialog);
 
-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))
+    if (file)
     {
-        /* 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);
-        }
+        g_object_unref (file);
     }
-    return FALSE;
 }
 
+/**
+ * cb_rstto_main_window_open_recent:
+ * @chooser:
+ * @window:
+ *
+ */
 static void
-cb_rstto_main_window_state_event(GtkWidget *widget, GdkEventWindowState *event, gpointer user_data)
+cb_rstto_main_window_open_recent(GtkRecentChooser *chooser, RsttoMainWindow *window)
 {
-    RsttoMainWindow *window = RSTTO_MAIN_WINDOW(widget);
-    GValue           show_file_toolbar_val = {0,};
-    GValue           show_nav_toolbar_val = {0,};
+    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(event->changed_mask & GDK_WINDOW_STATE_FULLSCREEN)
+    if (error == NULL)
     {
-        if(event->new_window_state & GDK_WINDOW_STATE_FULLSCREEN)
+        if (g_file_info_get_file_type (file_info) == G_FILE_TYPE_DIRECTORY)
         {
-            gtk_widget_hide (window->priv->menubar);
-            gtk_widget_hide (window->priv->toolbar);
-            gtk_widget_hide (window->priv->statusbar);
-            if (window->priv->fs_toolbar_sticky)
+            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))
             {
-                if (window->priv->show_fs_toolbar_timeout_id > 0)
+                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)
                 {
-                    g_source_remove (window->priv->show_fs_toolbar_timeout_id);
-                    window->priv->show_fs_toolbar_timeout_id = 0;
+                    rstto_image_list_add_file (window->priv->props.image_list, child_file, NULL);
                 }
-                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));
+                g_object_unref (child_file);
+                g_object_unref (child_file_info);
+            }
 
-            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)
+            if (rstto_image_list_add_file (window->priv->props.image_list, file, NULL) == FALSE)
             {
-                g_source_remove (window->priv->show_fs_toolbar_timeout_id);
-                window->priv->show_fs_toolbar_timeout_id = 0;
+                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);
             }
-            gtk_widget_show (window->priv->image_list_toolbar);
-
-            g_value_init (&show_file_toolbar_val, G_TYPE_BOOLEAN);
-            g_object_get_property (G_OBJECT(window->priv->settings_manager), "show-file-toolbar", &show_file_toolbar_val);
-
-            g_value_init (&show_nav_toolbar_val, G_TYPE_BOOLEAN);
-            g_object_get_property (G_OBJECT(window->priv->settings_manager), "show-nav-toolbar", &show_nav_toolbar_val);
-
-            gtk_widget_show (window->priv->menubar);
-            gtk_widget_show (window->priv->statusbar);
-
-            if (g_value_get_boolean (&show_file_toolbar_val))
-                gtk_widget_show (window->priv->toolbar);
-
-            if (g_value_get_boolean (&show_nav_toolbar_val))
-                gtk_widget_show (window->priv->image_list_toolbar);
             else
-                gtk_widget_hide(window->priv->image_list_toolbar);
-            
-            g_value_reset (&show_file_toolbar_val);
+            {
+                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);
+            }
         }
     }
-    if (event->changed_mask & GDK_WINDOW_STATE_MAXIMIZED)
+    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 gboolean 
-cb_rstto_main_window_motion_notify_event (RsttoMainWindow *window,
-                                         GdkEventMotion *event,
-                                         gpointer user_data)
+/**
+ * cb_rstto_main_window_save_copy:
+ * @widget:
+ * @window:
+ *
+ *
+ */
+static void
+cb_rstto_main_window_save_copy (GtkWidget *widget, RsttoMainWindow *window)
 {
-    gint width, height;
-    if(gdk_window_get_state(GTK_WIDGET(window)->window) & GDK_WINDOW_STATE_FULLSCREEN)
-    {
-	gdk_drawable_get_size (GDK_DRAWABLE(GTK_WIDGET(window)->window), &width, &height);
-        //if ((event->state == 0) && (event->window == event->subwindow))
-	if ((event->x_root == 0) || (event->y_root == 0) || (((gint)event->x_root) == (width-1)) || (((gint)event->y_root) == (height-1)))
-        {
-            gtk_widget_show (window->priv->image_list_toolbar);
-            window->priv->fs_toolbar_sticky = TRUE;
+    GtkWidget *dialog;
+    gint response;
+    GFile *file, *s_file;
 
-            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;
-            }
-        }
-    }
-    return TRUE;
-}
+    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);
 
-static gboolean
-cb_rstto_main_window_picture_viewer_enter_notify_event (GtkWidget *widget,
-                                                        GdkEventCrossing *event,
-                                                        gpointer user_data)
-{
-    RsttoMainWindow *window = RSTTO_MAIN_WINDOW (user_data);
-    if(gdk_window_get_state(GTK_WIDGET(window)->window) & GDK_WINDOW_STATE_FULLSCREEN)
+    response = gtk_dialog_run(GTK_DIALOG(dialog));
+    if(response == GTK_RESPONSE_OK)
     {
-        window->priv->fs_toolbar_sticky = FALSE;
-        if (window->priv->show_fs_toolbar_timeout_id > 0)
+        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))
         {
-            g_source_remove (window->priv->show_fs_toolbar_timeout_id);
-            window->priv->show_fs_toolbar_timeout_id = 0;
+            rstto_image_list_add_file (window->priv->props.image_list, file, NULL);
         }
-        window->priv->show_fs_toolbar_timeout_id = g_timeout_add (2000, (GSourceFunc)cb_rstto_main_window_show_fs_toolbar_timeout, window);
     }
 
-    return TRUE;
-}
+    gtk_widget_destroy(dialog);
 
-static gboolean
-cb_rstto_main_window_show_fs_toolbar_timeout (RsttoMainWindow *window)
-{
-    gtk_widget_hide (window->priv->image_list_toolbar);
-    return FALSE;
 }
 
+/**
+ * cb_rstto_main_window_close:
+ * @widget:
+ * @window:
+ *
+ *
+ */
 static void
-cb_rstto_main_window_settings_notify (GObject *settings, GParamSpec *spec, RsttoMainWindow *window)
+cb_rstto_main_window_close (GtkWidget *widget, 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);
-
+    RsttoImage *image = rstto_image_list_iter_get_image (window->priv->iter);
+    rstto_image_list_remove_image (window->priv->props.image_list, image);
+}
 
-    g_value_unset (&val);
+/**
+ * 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_message_bar_cancel:
+ * cb_rstto_main_window_delete:
  * @widget:
  * @window:
  *
+ *
  */
 static void
-cb_rstto_main_window_message_bar_cancel (GtkWidget *widget, RsttoMainWindow *window)
+cb_rstto_main_window_delete (GtkWidget *widget, RsttoMainWindow *window)
 {
-    gtk_widget_hide (window->priv->message_bar);
-    if (window->priv->message_bar_file)
+    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)
     {
-        g_object_unref (window->priv->message_bar_file);
-        window->priv->message_bar_file = NULL;
+        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);
 }
 
+/**********************/
+/* PRINTING CALLBACKS */
+/**********************/
+
 /**
- * cb_rstto_main_window_message_bar_open:
+ * cb_rstto_main_window_print:
  * @widget:
  * @window:
  *
+ *
  */
 static void
-cb_rstto_main_window_message_bar_open (GtkWidget *widget, RsttoMainWindow *window)
+cb_rstto_main_window_print (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);
 
+    GtkPrintSettings *print_settings = gtk_print_settings_new ();
+    GtkPrintOperation *print_operation = gtk_print_operation_new (); 
+    GtkPageSetup *page_setup = gtk_page_setup_new ();
 
-    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);
+    gtk_print_settings_set_resolution (print_settings, 300);
 
-        if (strncmp (content_type, "image/", 6) == 0)
-        {
-            rstto_image_list_add_file (window->priv->props.image_list, child_file, NULL);
-        }
+    gtk_page_setup_set_orientation (page_setup, GTK_PAGE_ORIENTATION_LANDSCAPE);
 
-        g_object_unref (child_file);
-        g_object_unref (file_info);
-    }
+    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);
     
-    if (window->priv->message_bar_file)
-    {
-        g_object_unref (window->priv->message_bar_file);
-        window->priv->message_bar_file = NULL;
-    }
-}
+    g_signal_connect (print_operation, "draw-page", G_CALLBACK (rstto_main_window_print_draw_page), window);
 
-static void
-cb_rstto_main_window_set_as_wallpaper (GtkWidget *widget, RsttoMainWindow *window)
-{
+    gtk_print_operation_run (print_operation, GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG, GTK_WINDOW(window), NULL);
     
 }
 
 static void
-cb_rstto_main_window_navigationtoolbar_position_changed (GtkRadioAction *action, GtkRadioAction *current,  RsttoMainWindow *window)
+rstto_main_window_print_draw_page (GtkPrintOperation *operation,
+           GtkPrintContext   *print_context,
+           gint               page_nr,
+           RsttoMainWindow *window)
 {
-    rstto_main_window_set_navigationbar_position (window, gtk_radio_action_get_current_value (current));
-}
+    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);
 
-static void
-rstto_main_window_set_navigationbar_position (RsttoMainWindow *window, guint orientation)
-{
-    rstto_settings_set_navbar_position (window->priv->settings_manager, orientation);
+    cairo_t *context = gtk_print_context_get_cairo_context (print_context);
 
-    switch (orientation)
+    cairo_translate (context, 0, 0);
+    /* Scale to page-width */
+    if ((w1/w) < (h1/h))
     {
-        case 0: /* Left */
-            g_object_ref (window->priv->image_list_toolbar);
-            g_object_ref (window->priv->thumbnailbar);
-
-            gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (window->priv->thumbnailbar)), window->priv->thumbnailbar);
-            gtk_paned_pack1 (GTK_PANED (window->priv->hpaned_left), window->priv->thumbnailbar, FALSE, FALSE);
-
-            gtk_container_remove (GTK_CONTAINER (window->priv->table), window->priv->image_list_toolbar);
-            gtk_table_attach (GTK_TABLE (window->priv->table), window->priv->image_list_toolbar, 0, 1, 0, 3, GTK_FILL, GTK_EXPAND|GTK_FILL, 0, 0);
-            gtk_toolbar_set_orientation (GTK_TOOLBAR (window->priv->image_list_toolbar), GTK_ORIENTATION_VERTICAL);
-            rstto_thumbnail_bar_set_orientation (RSTTO_THUMBNAIL_BAR(window->priv->thumbnailbar), GTK_ORIENTATION_VERTICAL);
-            break;
-        case 1: /* Right */
-            g_object_ref (window->priv->image_list_toolbar);
-            g_object_ref (window->priv->thumbnailbar);
-
-            gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (window->priv->thumbnailbar)), window->priv->thumbnailbar);
-            gtk_paned_pack2 (GTK_PANED (window->priv->hpaned_right), window->priv->thumbnailbar, FALSE, FALSE);
+        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);
 
-            gtk_container_remove (GTK_CONTAINER (window->priv->table), window->priv->image_list_toolbar);
-            gtk_table_attach (GTK_TABLE (window->priv->table), window->priv->image_list_toolbar, 2, 3, 0, 3, GTK_FILL,GTK_EXPAND|GTK_FILL, 0, 0);
-            gtk_toolbar_set_orientation (GTK_TOOLBAR (window->priv->image_list_toolbar), GTK_ORIENTATION_VERTICAL);
-            rstto_thumbnail_bar_set_orientation (RSTTO_THUMBNAIL_BAR(window->priv->thumbnailbar), GTK_ORIENTATION_VERTICAL);
-            break;
-        case 2: /* Top */
-            g_object_ref (window->priv->image_list_toolbar);
-            g_object_ref (window->priv->thumbnailbar);
+    //cairo_rectangle (context, 0, 0, 200, 200);
 
-            gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (window->priv->thumbnailbar)), window->priv->thumbnailbar);
-            gtk_paned_pack1 (GTK_PANED (window->priv->vpaned_top), window->priv->thumbnailbar, FALSE, FALSE);
+    cairo_paint (context);
+}
 
-            gtk_container_remove (GTK_CONTAINER (window->priv->table), window->priv->image_list_toolbar);
-            gtk_table_attach (GTK_TABLE (window->priv->table), window->priv->image_list_toolbar, 0, 3, 0, 1, GTK_EXPAND|GTK_FILL,GTK_FILL, 0, 0);
-            gtk_toolbar_set_orientation (GTK_TOOLBAR (window->priv->image_list_toolbar), GTK_ORIENTATION_HORIZONTAL);
-            rstto_thumbnail_bar_set_orientation (RSTTO_THUMBNAIL_BAR(window->priv->thumbnailbar), GTK_ORIENTATION_HORIZONTAL);
-            break;
-        case 3: /* Bottom */
-            g_object_ref (window->priv->image_list_toolbar);
-            g_object_ref (window->priv->thumbnailbar);
+/*************************/
+/* GUI-RELATED CALLBACKS */
+/*************************/
 
-            gtk_container_remove (GTK_CONTAINER (gtk_widget_get_parent (window->priv->thumbnailbar)), window->priv->thumbnailbar);
-            gtk_paned_pack2 (GTK_PANED (window->priv->vpaned_bottom), window->priv->thumbnailbar, FALSE, FALSE);
+/**
+ * cb_rstto_main_window_toggle_show_file_toolbar:
+ * @widget:
+ * @window:
+ *
+ *
+ */
+static void
+cb_rstto_main_window_toggle_show_file_toolbar (GtkWidget *widget, RsttoMainWindow *window)
+{
+    GValue val = {0,};
+    g_value_init (&val, G_TYPE_BOOLEAN);
 
-            gtk_container_remove (GTK_CONTAINER (window->priv->table), window->priv->image_list_toolbar);
-            gtk_table_attach (GTK_TABLE (window->priv->table), window->priv->image_list_toolbar, 0, 3, 2, 3, GTK_EXPAND|GTK_FILL,GTK_FILL, 0, 0);
-            gtk_toolbar_set_orientation (GTK_TOOLBAR (window->priv->image_list_toolbar), GTK_ORIENTATION_HORIZONTAL);
-            rstto_thumbnail_bar_set_orientation (RSTTO_THUMBNAIL_BAR(window->priv->thumbnailbar), GTK_ORIENTATION_HORIZONTAL);
-            break;
-        default:
-            break;
+    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-file-toolbar", &val);
 }
 
-
+/**
+ * cb_rstto_main_window_toggle_show_nav_toolbar:
+ * @widget:
+ * @window:
+ *
+ *
+ */
 static void
-cb_rstto_main_window_navigationtoolbar_button_press_event (GtkWidget *widget, GdkEventButton *event, gpointer user_data)
+cb_rstto_main_window_toggle_show_nav_toolbar (GtkWidget *widget, RsttoMainWindow *window)
 {
-    int button, event_time;
-    RsttoMainWindow *window = RSTTO_MAIN_WINDOW (user_data);
-    GtkWidget *menu = NULL;
-    if (event->button == 3 && event->type == GDK_BUTTON_PRESS)
-    {
-        if (event)
-        {
-            button = event->button;
-            event_time = event->time;
-        }
-        else
-        {
-            button = 0;
-            event_time = gtk_get_current_event_time ();
-        }
-
+    GValue val = {0,};
+    g_value_init (&val, G_TYPE_BOOLEAN);
 
-        menu = window->priv->position_menu;
-        gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL, 
-                  button, event_time);
+    if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (widget)))
+    {
+        gtk_widget_show (window->priv->image_list_toolbar);
+        g_value_set_boolean (&val, TRUE);
+    }
+    else
+    {
+        gtk_widget_hide (window->priv->image_list_toolbar);
+        g_value_set_boolean (&val, FALSE);
     }
+    g_object_set_property (G_OBJECT (window->priv->settings_manager), "show-nav-toolbar", &val);
 }
 
-
-/*
-static gboolean
-cb_rstto_main_window_image_list_toolbar_popup_context_menu (GtkToolbar *toolbar,
-                                                        gint        x,
-                                                        gint        y,
-                                                        gint        button,
-                                                        gpointer    user_data)
+/**
+ * cb_rstto_main_window_toggle_show_thumbnailbar:
+ * @widget:
+ * @window:
+ *
+ *
+ */
+static void
+cb_rstto_main_window_toggle_show_thumbnailbar (GtkWidget *widget, RsttoMainWindow *window)
 {
-    RsttoMainWindow *window = RSTTO_MAIN_WINDOW (user_data);
+    GValue val = {0,};
+    g_value_init (&val, G_TYPE_BOOLEAN);
 
-    gtk_menu_popup (window->priv->image_list_toolbar_menu,
-                    NULL,
-                    NULL,
-                    NULL,
-                    NULL,
-                    3,
-                    gtk_get_current_event_time ());
+    if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (widget)))
+    {
+        gtk_widget_show (window->priv->thumbnailbar);
+        g_value_set_boolean (&val, TRUE);
+    }
+    else
+    {
+        gtk_widget_hide (window->priv->thumbnailbar);
+        g_value_set_boolean (&val, FALSE);
+    }
+    g_object_set_property (G_OBJECT (window->priv->settings_manager), "show-thumbnailbar", &val);
 }
-*/
+


More information about the Xfce4-commits mailing list