[Goodies-commits] r6512 - ristretto/branches/ristretto-gio/src

Stephan Arts stephan at xfce.org
Mon Jan 19 22:16:04 CET 2009


Author: stephan
Date: 2009-01-19 21:16:04 +0000 (Mon, 19 Jan 2009)
New Revision: 6512

Modified:
   ristretto/branches/ristretto-gio/src/image.c
   ristretto/branches/ristretto-gio/src/image.h
   ristretto/branches/ristretto-gio/src/image_cache.c
   ristretto/branches/ristretto-gio/src/image_transform_orientation.c
   ristretto/branches/ristretto-gio/src/image_transform_orientation.h
   ristretto/branches/ristretto-gio/src/main.c
   ristretto/branches/ristretto-gio/src/main_window.c
   ristretto/branches/ristretto-gio/src/main_window.h
   ristretto/branches/ristretto-gio/src/main_window_ui.xml
   ristretto/branches/ristretto-gio/src/navigator.c
   ristretto/branches/ristretto-gio/src/navigator.h
   ristretto/branches/ristretto-gio/src/picture_viewer.c
Log:
- Fix segfault
- Implement transform_orientation (for rotating)
- Improve UI-sensitivity
- Improve behaviour when closing images
- Fix fullscreen-toggling (TODO: hide menu, toolbar and statusbar)
- Implement move-last and move-first buttons
- << stuff I probably forgot >>


Modified: ristretto/branches/ristretto-gio/src/image.c
===================================================================
--- ristretto/branches/ristretto-gio/src/image.c	2009-01-19 21:14:25 UTC (rev 6511)
+++ ristretto/branches/ristretto-gio/src/image.c	2009-01-19 21:16:04 UTC (rev 6512)
@@ -287,6 +287,7 @@
 
     GFileInputStream *file_input_stream = g_file_read_finish (file, result, NULL);
 
+    g_object_ref (image);
     g_input_stream_read_async (G_INPUT_STREAM (file_input_stream),
                                image->priv->buffer,
                                RSTTO_IMAGE_BUFFER_SIZE,
@@ -312,6 +313,8 @@
         if(gdk_pixbuf_loader_write (image->priv->loader, (const guchar *)image->priv->buffer, read_bytes, &error) == FALSE)
         {
             g_input_stream_close (G_INPUT_STREAM (source_object), NULL, NULL);
+            image->priv->loader = NULL;
+            g_object_unref (image);
         }
         else
         {
@@ -331,6 +334,7 @@
         g_input_stream_close (G_INPUT_STREAM (source_object), NULL, NULL);
         gdk_pixbuf_loader_close (image->priv->loader, NULL);
         image->priv->loader = NULL;
+        g_object_unref (image);
     }
     else
     {
@@ -338,6 +342,7 @@
         g_input_stream_close (G_INPUT_STREAM (source_object), NULL, NULL);
         gdk_pixbuf_loader_close (image->priv->loader, NULL);
         image->priv->loader = NULL;
+        g_object_unref (image);
     }
 }
 
@@ -477,6 +482,21 @@
 }
 
 /**
+ * rstto_image_set_pixbuf:
+ * @image  : 
+ * @pixbuf :
+ *
+ */
+void
+rstto_image_set_pixbuf (RsttoImage *image, GdkPixbuf *pixbuf)
+{
+    if (image->priv->pixbuf)
+        g_object_unref (image->priv->pixbuf);
+
+    image->priv->pixbuf = pixbuf;
+}
+
+/**
  * rstto_image_push_transformation:
  * @image          : 
  * @transformation :

Modified: ristretto/branches/ristretto-gio/src/image.h
===================================================================
--- ristretto/branches/ristretto-gio/src/image.h	2009-01-19 21:14:25 UTC (rev 6511)
+++ ristretto/branches/ristretto-gio/src/image.h	2009-01-19 21:16:04 UTC (rev 6512)
@@ -70,6 +70,9 @@
 gboolean
 rstto_image_pop_transformation (RsttoImage *image, GError **error);
 
+/* Should only be used by image-transformation implementations */
+void rstto_image_set_pixbuf (RsttoImage *image, GdkPixbuf *pixbuf);
+
 G_END_DECLS
 
 #endif /* __RISTRETTO_IMAGE_H__ */

Modified: ristretto/branches/ristretto-gio/src/image_cache.c
===================================================================
--- ristretto/branches/ristretto-gio/src/image_cache.c	2009-01-19 21:14:25 UTC (rev 6511)
+++ ristretto/branches/ristretto-gio/src/image_cache.c	2009-01-19 21:16:04 UTC (rev 6512)
@@ -93,6 +93,7 @@
         cache->cache_list = g_list_remove_all (cache->cache_list, image);
     }
 
+    g_object_ref (image);
     cache->cache_list = g_list_prepend (cache->cache_list, image);
 
     /**
@@ -104,6 +105,7 @@
         RsttoImage *c_image = g_list_last (cache->cache_list)->data;
         rstto_image_unload (c_image);
         cache->cache_list = g_list_remove (cache->cache_list, c_image);
+        g_object_unref (image);
     }
 }
 

Modified: ristretto/branches/ristretto-gio/src/image_transform_orientation.c
===================================================================
--- ristretto/branches/ristretto-gio/src/image_transform_orientation.c	2009-01-19 21:14:25 UTC (rev 6511)
+++ ristretto/branches/ristretto-gio/src/image_transform_orientation.c	2009-01-19 21:16:04 UTC (rev 6512)
@@ -153,13 +153,73 @@
 static gboolean
 rstto_image_transform_orientation_transform (RsttoImageTransformation *transformation, RsttoImage *image)
 {
+    RsttoImageTransformOrientation *trans_orientation = RSTTO_IMAGE_TRANSFORM_ORIENTATION (transformation);
+    GdkPixbuf *tmp_pixbuf = NULL;
 
+    if (trans_orientation->flip_vertical)
+    {
+        tmp_pixbuf = rstto_image_get_pixbuf (image);       
+        g_object_ref (tmp_pixbuf);
+        if (tmp_pixbuf)
+        {
+            /* Flip vertically (pass FALSE to gdk_pixbuf_flip) */
+            rstto_image_set_pixbuf (image, gdk_pixbuf_flip (tmp_pixbuf, FALSE));
+            g_object_unref (tmp_pixbuf);
+        }
+    }   
+
+    if (trans_orientation->flip_horizontal)
+    {
+        tmp_pixbuf = rstto_image_get_pixbuf (image);       
+        g_object_ref (tmp_pixbuf);
+        if (tmp_pixbuf)
+        {
+            /* Flip horizontally (pass TRUE to gdk_pixbuf_flip) */
+            rstto_image_set_pixbuf (image, gdk_pixbuf_flip (tmp_pixbuf, TRUE));
+            g_object_unref (tmp_pixbuf);
+        }
+    }   
+
+    
+    tmp_pixbuf = rstto_image_get_pixbuf (image);       
+    g_object_ref (tmp_pixbuf);
+    rstto_image_set_pixbuf (image, gdk_pixbuf_rotate_simple (tmp_pixbuf, (360+(trans_orientation->rotation))%360));
+    g_object_unref (tmp_pixbuf);
 }
 
 static gboolean
 rstto_image_transform_orientation_revert (RsttoImageTransformation *transformation, RsttoImage *image)
 {
+    RsttoImageTransformOrientation *trans_orientation = RSTTO_IMAGE_TRANSFORM_ORIENTATION (transformation);
+    GdkPixbuf *tmp_pixbuf = NULL;
 
+    if (trans_orientation->flip_vertical)
+    {
+        tmp_pixbuf = rstto_image_get_pixbuf (image);       
+        if (tmp_pixbuf)
+        {
+            /* Flip vertically (pass FALSE to gdk_pixbuf_flip) */
+            rstto_image_set_pixbuf (image, gdk_pixbuf_flip (tmp_pixbuf, FALSE));
+            g_object_unref (tmp_pixbuf);
+        }
+    }   
+
+    if (trans_orientation->flip_horizontal)
+    {
+        tmp_pixbuf = rstto_image_get_pixbuf (image);       
+        if (tmp_pixbuf)
+        {
+            /* Flip horizontally (pass TRUE to gdk_pixbuf_flip) */
+            rstto_image_set_pixbuf (image, gdk_pixbuf_flip (tmp_pixbuf, TRUE));
+            g_object_unref (tmp_pixbuf);
+        }
+    }   
+
+    tmp_pixbuf = rstto_image_get_pixbuf (image);       
+    g_object_ref (tmp_pixbuf);
+    rstto_image_set_pixbuf (image, gdk_pixbuf_rotate_simple (tmp_pixbuf, 360-((360+(trans_orientation->rotation))%360)));
+    g_object_unref (tmp_pixbuf);
+
 }
 
 static void
@@ -168,13 +228,18 @@
                                                 const GValue *value,
                                                 GParamSpec   *pspec)
 {
+    RsttoImageTransformOrientation *transformation = RSTTO_IMAGE_TRANSFORM_ORIENTATION (object);
+
     switch (property_id)
     {
         case PROP_TRANSFORM_FLIP_VERTICAL:
+            transformation->flip_vertical = g_value_get_boolean (value);
             break;
         case PROP_TRANSFORM_FLIP_HORIZONTAL:
+            transformation->flip_horizontal = g_value_get_boolean (value);
             break;
         case PROP_TRANSFORM_ROTATION:
+            transformation->rotation = g_value_get_uint (value);
             break;
         default:
             break;
@@ -188,13 +253,18 @@
                                                 GValue     *value,
                                                 GParamSpec *pspec)
 {
+    RsttoImageTransformOrientation *transformation = RSTTO_IMAGE_TRANSFORM_ORIENTATION (object);
+
     switch (property_id)
     {
         case PROP_TRANSFORM_FLIP_VERTICAL:
+            g_value_set_boolean (value, transformation->flip_vertical);
             break;
         case PROP_TRANSFORM_FLIP_HORIZONTAL:
+            g_value_set_boolean (value, transformation->flip_horizontal);
             break;
         case PROP_TRANSFORM_ROTATION:
+            g_value_set_uint (value, transformation->rotation);
             break;
         default:
             break;

Modified: ristretto/branches/ristretto-gio/src/image_transform_orientation.h
===================================================================
--- ristretto/branches/ristretto-gio/src/image_transform_orientation.h	2009-01-19 21:14:25 UTC (rev 6511)
+++ ristretto/branches/ristretto-gio/src/image_transform_orientation.h	2009-01-19 21:16:04 UTC (rev 6512)
@@ -44,6 +44,10 @@
 struct _RsttoImageTransformOrientation
 {
     RsttoImageTransformation parent;
+
+    gboolean          flip_horizontal;
+    gboolean          flip_vertical;
+    GdkPixbufRotation rotation;
 };
 
 typedef struct _RsttoImageTransformOrientationClass RsttoImageTransformOrientationClass;

Modified: ristretto/branches/ristretto-gio/src/main.c
===================================================================
--- ristretto/branches/ristretto-gio/src/main.c	2009-01-19 21:14:25 UTC (rev 6511)
+++ ristretto/branches/ristretto-gio/src/main.c	2009-01-19 21:16:04 UTC (rev 6512)
@@ -97,7 +97,7 @@
 
     RsttoNavigator *navigator = rstto_navigator_new ();
     
-    GtkWidget *window = rstto_main_window_new (navigator);
+    GtkWidget *window = rstto_main_window_new (navigator, FALSE);
 
     if (argc > 1)
     {
@@ -130,7 +130,7 @@
     if (rof->iter < rof->argc)
     {
         GFile *file = g_file_new_for_commandline_arg (rof->argv[rof->iter]);
-        rstto_navigator_add_file (rof->navigator, file);
+        rstto_navigator_add_file (rof->navigator, file, NULL);
 	rof->iter++;
         return TRUE;
     }

Modified: ristretto/branches/ristretto-gio/src/main_window.c
===================================================================
--- ristretto/branches/ristretto-gio/src/main_window.c	2009-01-19 21:14:25 UTC (rev 6511)
+++ ristretto/branches/ristretto-gio/src/main_window.c	2009-01-19 21:16:04 UTC (rev 6512)
@@ -47,13 +47,9 @@
 {
     struct {
         RsttoNavigator *navigator;
+        gboolean        toolbar_visible;
     } props;
 
-    struct {
-        GtkWidget *close;
-        GtkWidget *close_all;
-    } menu_items;
-
     RsttoNavigatorIter *iter;
 
     GtkActionGroup *action_group;
@@ -91,6 +87,11 @@
                                 GParamSpec *pspec);
 
 static void
+cb_rstto_main_window_navigator_new_image (RsttoNavigator *navigator, RsttoImage *image, RsttoMainWindow *window);
+static void
+cb_rstto_main_window_navigator_invalidate_iters (RsttoNavigator *navigator, RsttoMainWindow *window);
+
+static void
 cb_rstto_main_window_zoom_100 (GtkWidget *widget, RsttoMainWindow *window);
 static void
 cb_rstto_main_window_zoom_fit (GtkWidget *widget, RsttoMainWindow *window);
@@ -98,59 +99,102 @@
 cb_rstto_main_window_zoom_in (GtkWidget *widget, RsttoMainWindow *window);
 static void
 cb_rstto_main_window_zoom_out (GtkWidget *widget, RsttoMainWindow *window);
+
 static void
-cb_rstto_main_window_navigator_new_image (RsttoNavigator *navigator, RsttoImage *image, RsttoMainWindow *window);
-static void
 cb_rstto_main_window_next_image (GtkWidget *widget, RsttoMainWindow *window);
 static void
 cb_rstto_main_window_previous_image (GtkWidget *widget, RsttoMainWindow *window);
 static void
+cb_rstto_main_window_first_image (GtkWidget *widget, RsttoMainWindow *window);
+static void
+cb_rstto_main_window_last_image (GtkWidget *widget, RsttoMainWindow *window);
+
+static void
 cb_rstto_main_window_open_image (GtkWidget *widget, RsttoMainWindow *window);
 static void
+cb_rstto_main_window_open_folder (GtkWidget *widget, RsttoMainWindow *window);
+static void
+cb_rstto_main_window_close (GtkWidget *widget, RsttoMainWindow *window);
+static void
+cb_rstto_main_window_close_all (GtkWidget *widget, RsttoMainWindow *window);
+
+static void
+cb_rstto_main_window_play (GtkWidget *widget, RsttoMainWindow *window);
+
+static void
+cb_rstto_main_window_toggle_show_toolbar (GtkWidget *widget, RsttoMainWindow *window);
+static void
+cb_rstto_main_window_fullscreen (GtkWidget *widget, RsttoMainWindow *window);
+static void
+cb_rstto_main_window_preferences (GtkWidget *widget, RsttoMainWindow *window);
+static void
+cb_rstto_main_window_about (GtkWidget *widget, RsttoMainWindow *window);
+static void
+cb_rstto_main_window_contents (GtkWidget *widget, RsttoMainWindow *window);
+static void
 cb_rstto_main_window_quit (GtkWidget *widget, RsttoMainWindow *window);
 
+static void
+rstto_main_window_set_sensitive (RsttoMainWindow *window, gboolean sensitive);
+
 static GtkWidgetClass *parent_class = NULL;
 
 static GtkActionEntry action_entries[] =
 {
-    { "file-menu", NULL, N_ ("_File"), NULL, },
-        { "open", GTK_STOCK_OPEN, N_ ("_Open"), "<control>O", N_ ("Open an image"), G_CALLBACK (cb_rstto_main_window_open_image), },
-        { "open-folder", NULL, N_ ("Open _Folder"), NULL, N_ ("Open a folder"), NULL, },
-        { "open-recent-menu", NULL, N_ ("Open _Recent"), NULL, },
-        { "close", GTK_STOCK_CLOSE, N_ ("_Close"), "<control>W", N_ ("Close this image"), NULL, },
-        { "close-all", NULL, N_ ("_Close All"), NULL, N_ ("Close all images"), NULL, },
-        { "quit", GTK_STOCK_QUIT, N_ ("_Quit"), "<control>Q", N_ ("Quit "), G_CALLBACK (cb_rstto_main_window_quit), },
-    { "edit-menu", NULL, N_ ("_Edit"), NULL, },
-        { "preferences", GTK_STOCK_PREFERENCES, N_ ("_Preferences"), NULL, NULL, NULL, },
-    { "view-menu", NULL, N_ ("_View"), NULL, },
-        { "thumbnailbar-menu", NULL, N_ ("_Thumbnail Bar"), NULL, },
-            { "thumbnailbar-show-vertical", NULL, N_ ("Show _Vertically"), NULL, NULL, NULL, },
-            { "thumbnailbar-show-horizontal", NULL, N_ ("_Show Horizontally"), NULL, NULL, NULL, },
-            { "thumbnailbar-hide", NULL, N_ ("_Hide"), NULL, NULL, NULL, },
-        { "zoom-menu", NULL, N_ ("_Zooming"), NULL, },
-            { "zoom-in", GTK_STOCK_ZOOM_IN, N_ ("Zoom _In"), "<control>plus", NULL, G_CALLBACK (cb_rstto_main_window_zoom_in),},
-            { "zoom-out", GTK_STOCK_ZOOM_OUT, N_ ("Zoom _Out"), "<control>minus", NULL, G_CALLBACK (cb_rstto_main_window_zoom_out), },
-            { "zoom-fit", GTK_STOCK_ZOOM_FIT, N_ ("Zoom _Fit"), "<control>equal", NULL, G_CALLBACK (cb_rstto_main_window_zoom_fit), },
-            { "zoom-100", GTK_STOCK_ZOOM_100, N_ ("_Normal Size"), "<control>0", NULL, G_CALLBACK (cb_rstto_main_window_zoom_100), },
-        { "rotation-menu", NULL, N_ ("_Rotation"), NULL, },
-            { "rotate-cw", NULL, N_ ("Rotate _Right"), NULL, NULL, NULL, },
-            { "rotate-ccw", NULL, N_ ("Rotate _Left"), NULL, NULL, NULL, },
-        { "fullscreen", GTK_STOCK_FULLSCREEN, N_ ("_Fullscreen"), NULL, NULL, NULL, },
-        { "set-as-wallpaper", NULL, N_ ("_Set as Wallpaper"), NULL, NULL, NULL, },
-    { "go-menu", NULL, N_ ("_Go"), NULL, },
-        { "forward", GTK_STOCK_GO_FORWARD, N_ ("_Forward"), NULL, NULL, G_CALLBACK (cb_rstto_main_window_next_image), },
-        { "back", GTK_STOCK_GO_BACK, N_ ("_Back"), NULL, NULL, G_CALLBACK (cb_rstto_main_window_previous_image), },
-        { "first", GTK_STOCK_GOTO_FIRST, N_ ("_First"), NULL, NULL, NULL, },
-        { "last", GTK_STOCK_GOTO_LAST, N_ ("_Last"), NULL, NULL, NULL, },
-        { "play", GTK_STOCK_MEDIA_PLAY, N_ ("_Play"), NULL, NULL, NULL, },
-    { "help-menu", NULL, N_ ("_Help"), NULL, },
-        { "contents", GTK_STOCK_HELP, N_ ("_Contents"), "F1", N_ ("Display ristretto user manual"), NULL, },
-        { "about", GTK_STOCK_ABOUT, N_ ("_About"), NULL, N_ ("Display information about ristretto"), NULL, }
+/* File Menu */
+  { "file-menu", NULL, N_ ("_File"), NULL, },
+  { "open", GTK_STOCK_OPEN, N_ ("_Open"), "<control>O", N_ ("Open an image"), G_CALLBACK (cb_rstto_main_window_open_image), },
+  { "open-folder", NULL, N_ ("Open _Folder"), NULL, N_ ("Open a folder"), G_CALLBACK (cb_rstto_main_window_open_folder), },
+  { "open-recent-menu", NULL, N_ ("Open _Recent"), NULL, },
+  { "close", GTK_STOCK_CLOSE, N_ ("_Close"), "<control>W", N_ ("Close this image"), G_CALLBACK (cb_rstto_main_window_close), },
+  { "close-all", NULL, N_ ("_Close All"), NULL, N_ ("Close all images"), G_CALLBACK (cb_rstto_main_window_close_all), },
+  { "quit", GTK_STOCK_QUIT, N_ ("_Quit"), "<control>Q", N_ ("Quit Ristretto"), G_CALLBACK (cb_rstto_main_window_quit), },
+/* Edit Menu */
+  { "edit-menu", NULL, N_ ("_Edit"), NULL, },
+  { "preferences", GTK_STOCK_PREFERENCES, N_ ("_Preferences"), NULL, NULL, G_CALLBACK (cb_rstto_main_window_preferences), },
+/* View Menu */
+  { "view-menu", NULL, N_ ("_View"), NULL, },
+  { "fullscreen", GTK_STOCK_FULLSCREEN, N_ ("_Fullscreen"), "F11", NULL, G_CALLBACK (cb_rstto_main_window_fullscreen), },
+  { "set-as-wallpaper", NULL, N_ ("_Set as Wallpaper"), NULL, NULL, NULL, },
+/* Thumbnailbar submenu */
+  { "thumbnailbar-menu", NULL, N_ ("_Thumbnail Bar"), NULL, },
+  { "thumbnailbar-show-vertical", NULL, N_ ("Show _Vertically"), NULL, NULL, NULL, },
+  { "thumbnailbar-show-horizontal", NULL, N_ ("_Show Horizontally"), NULL, NULL, NULL, },
+  { "thumbnailbar-hide", NULL, N_ ("_Hide"), NULL, NULL, NULL, },
+/* Zoom submenu */
+  { "zoom-menu", NULL, N_ ("_Zooming"), NULL, },
+  { "zoom-in", GTK_STOCK_ZOOM_IN, N_ ("Zoom _In"), "<control>plus", NULL, G_CALLBACK (cb_rstto_main_window_zoom_in),},
+  { "zoom-out", GTK_STOCK_ZOOM_OUT, N_ ("Zoom _Out"), "<control>minus", NULL, G_CALLBACK (cb_rstto_main_window_zoom_out), },
+  { "zoom-fit", GTK_STOCK_ZOOM_FIT, N_ ("Zoom _Fit"), "<control>equal", NULL, G_CALLBACK (cb_rstto_main_window_zoom_fit), },
+  { "zoom-100", GTK_STOCK_ZOOM_100, N_ ("_Normal Size"), "<control>0", NULL, G_CALLBACK (cb_rstto_main_window_zoom_100), },
+/* Rotation submenu */
+  { "rotation-menu", NULL, N_ ("_Rotation"), NULL, },
+  { "rotate-cw", NULL, N_ ("Rotate _Right"), NULL, NULL, NULL, },
+  { "rotate-ccw", NULL, N_ ("Rotate _Left"), NULL, NULL, NULL, },
+/* Go Menu */
+  { "go-menu",  NULL, N_ ("_Go"), NULL, },
+  { "forward",  GTK_STOCK_GO_FORWARD, N_ ("_Forward"), "space", NULL, G_CALLBACK (cb_rstto_main_window_next_image), },
+  { "back",     GTK_STOCK_GO_BACK, N_ ("_Back"), "BackSpace", NULL, G_CALLBACK (cb_rstto_main_window_previous_image), },
+  { "first",    GTK_STOCK_GOTO_FIRST, N_ ("_First"), "Home", NULL, G_CALLBACK (cb_rstto_main_window_first_image), },
+  { "last",     GTK_STOCK_GOTO_LAST, N_ ("_Last"), "End", NULL, G_CALLBACK (cb_rstto_main_window_last_image), },
+  { "play",     GTK_STOCK_MEDIA_PLAY, N_ ("_Play"), "F5", NULL, G_CALLBACK (cb_rstto_main_window_play), },
+/* Help Menu */
+  { "help-menu", NULL, N_ ("_Help"), NULL, },
+  { "contents", GTK_STOCK_HELP,
+                N_ ("_Contents"),
+                "F1",
+                N_ ("Display ristretto user manual"),
+                G_CALLBACK (cb_rstto_main_window_contents), },
+  { "about",    GTK_STOCK_ABOUT, 
+                N_ ("_About"),
+                NULL,
+                N_ ("Display information about ristretto"),
+                G_CALLBACK (cb_rstto_main_window_about), }
 };
 
 static const GtkToggleActionEntry toggle_action_entries[] =
 {
-    { "show-toolbar", NULL, N_ ("Show _Toolbar"), NULL, NULL, NULL, FALSE, },
+    { "show-toolbar", NULL, N_ ("Show _Toolbar"), NULL, NULL, G_CALLBACK (cb_rstto_main_window_toggle_show_toolbar), TRUE, },
 };
 
 
@@ -183,8 +227,9 @@
 static void
 rstto_main_window_init(RsttoMainWindow *window)
 {
-    GtkAccelGroup  *accel_group;
-    GtkWidget   *main_vbox = gtk_vbox_new (FALSE, 0);
+    GtkAccelGroup *accel_group;
+    GtkWidget     *separator, *back, *forward;
+    GtkWidget     *main_vbox = gtk_vbox_new (FALSE, 0);
 
     gtk_window_set_title (GTK_WINDOW (window), RISTRETTO_APP_TITLE);
 
@@ -208,6 +253,16 @@
     window->priv->menubar = gtk_ui_manager_get_widget (window->priv->ui_manager, "/main-menu");
     window->priv->toolbar = gtk_ui_manager_get_widget (window->priv->ui_manager, "/main-toolbar");
 
+    separator = gtk_ui_manager_get_widget (window->priv->ui_manager, "/main-toolbar/placeholder-1");
+    gtk_tool_item_set_expand (GTK_TOOL_ITEM (separator), TRUE);
+    gtk_separator_tool_item_set_draw (GTK_SEPARATOR_TOOL_ITEM (separator), FALSE);
+
+    back = gtk_ui_manager_get_widget (window->priv->ui_manager, "/main-toolbar/back");
+    gtk_tool_item_set_is_important (GTK_TOOL_ITEM (back), TRUE);
+    forward = gtk_ui_manager_get_widget (window->priv->ui_manager, "/main-toolbar/forward");
+    gtk_tool_item_set_is_important (GTK_TOOL_ITEM (forward), TRUE);
+    
+
     window->priv->picture_viewer = rstto_picture_viewer_new ();
     window->priv->p_viewer_s_window = gtk_scrolled_window_new (NULL, NULL);
     gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (window->priv->p_viewer_s_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
@@ -221,6 +276,8 @@
     gtk_box_pack_start(GTK_BOX(main_vbox), window->priv->toolbar, FALSE, FALSE, 0);
     gtk_box_pack_start(GTK_BOX(main_vbox), window->priv->p_viewer_s_window, TRUE, TRUE, 0);
     gtk_box_pack_start(GTK_BOX(main_vbox), window->priv->statusbar, FALSE, FALSE, 0);
+
+    rstto_main_window_set_sensitive (window, FALSE);
 }
 
 static void
@@ -261,15 +318,25 @@
  * Return value:
  */
 GtkWidget *
-rstto_main_window_new (RsttoNavigator *navigator)
+rstto_main_window_new (RsttoNavigator *navigator, gboolean fullscreen)
 {
     GtkWidget *widget;
 
     widget = g_object_new (RSTTO_TYPE_MAIN_WINDOW, "navigator", navigator, NULL);
 
+    if (fullscreen == TRUE)
+    {
+        gtk_window_fullscreen (GTK_WINDOW (widget));
+    }
+
     return widget;
 }
 
+/**
+ * rstto_main_window_navigator_iter_changed:
+ * @window:
+ *
+ */
 static void
 rstto_main_window_navigator_iter_changed (RsttoMainWindow *window)
 {
@@ -284,23 +351,82 @@
         position = rstto_navigator_iter_get_position (window->priv->iter);
         count = rstto_navigator_get_n_images (navigator);
         cur_image = rstto_navigator_iter_get_image (window->priv->iter);
-        file = rstto_image_get_file (cur_image);
+        if (cur_image)
+        {
+            file = rstto_image_get_file (cur_image);
 
-        path = g_file_get_path (file);
-        basename = g_path_get_basename (path);
+            path = g_file_get_path (file);
+            basename = g_path_get_basename (path);
 
-        title = g_strdup_printf ("%s - %s [%d/%d]", RISTRETTO_APP_TITLE,  basename, position, count);
+            title = g_strdup_printf ("%s - %s [%d/%d]", RISTRETTO_APP_TITLE,  basename, position+1, count);
+            rstto_main_window_set_sensitive (window, TRUE);
 
+            g_free (basename);
+            g_free (path);
+        }
+        else
+        {
+            title = g_strdup (RISTRETTO_APP_TITLE);
+            rstto_main_window_set_sensitive (window, FALSE);
+        }
+
         gtk_window_set_title (GTK_WINDOW (window), title);
         rstto_picture_viewer_set_image (RSTTO_PICTURE_VIEWER (window->priv->picture_viewer), cur_image);
 
-        g_free (basename);
-        g_free (path);
+        g_free (title);
     }
 
 }
 
+
 /**
+ * rstto_main_window_set_sensitive:
+ * @window:
+ * @sensitive:
+ *
+ */
+static void
+rstto_main_window_set_sensitive (RsttoMainWindow *window, gboolean sensitive)
+{
+    /* Go Menu */
+    gtk_widget_set_sensitive (gtk_ui_manager_get_widget (window->priv->ui_manager, "/main-menu/go-menu/forward"), sensitive);
+    gtk_widget_set_sensitive (gtk_ui_manager_get_widget (window->priv->ui_manager, "/main-menu/go-menu/back"), sensitive);
+    gtk_widget_set_sensitive (gtk_ui_manager_get_widget (window->priv->ui_manager, "/main-menu/go-menu/first"), sensitive);
+    gtk_widget_set_sensitive (gtk_ui_manager_get_widget (window->priv->ui_manager, "/main-menu/go-menu/last"), sensitive); 
+    gtk_widget_set_sensitive (gtk_ui_manager_get_widget (window->priv->ui_manager, "/main-menu/go-menu/play"), sensitive);
+
+    /* View Menu */
+    gtk_widget_set_sensitive (gtk_ui_manager_get_widget (window->priv->ui_manager, 
+                                                         "/main-menu/view-menu/set-as-wallpaper"), sensitive);
+    gtk_widget_set_sensitive (gtk_ui_manager_get_widget (window->priv->ui_manager, 
+                                                         "/main-menu/view-menu/zoom-menu"), sensitive);
+    gtk_widget_set_sensitive (gtk_ui_manager_get_widget (window->priv->ui_manager, 
+                                                         "/main-menu/view-menu/rotation-menu"), sensitive);
+    /*
+    gtk_widget_set_sensitive (gtk_ui_manager_get_widget (window->priv->ui_manager, 
+                                                         "/main-menu/view-menu/zoom-menu/zoom-in"), sensitive);
+    gtk_widget_set_sensitive (gtk_ui_manager_get_widget (window->priv->ui_manager, 
+                                                         "/main-menu/view-menu/zoom-menu/zoom-out"), sensitive);
+    gtk_widget_set_sensitive (gtk_ui_manager_get_widget (window->priv->ui_manager, 
+                                                         "/main-menu/view-menu/zoom-menu/zoom-fit"), sensitive);
+    gtk_widget_set_sensitive (gtk_ui_manager_get_widget (window->priv->ui_manager, 
+                                                         "/main-menu/view-menu/zoom-menu/zoom-100"), sensitive);
+    gtk_widget_set_sensitive (gtk_ui_manager_get_widget (window->priv->ui_manager, 
+                                                         "/main-menu/view-menu/rotation-menu/rotate-cw"), sensitive);
+    gtk_widget_set_sensitive (gtk_ui_manager_get_widget (window->priv->ui_manager, 
+                                                         "/main-menu/view-menu/rotation-menu/rotate-ccw"), sensitive);
+    */
+
+    /* Toolbar */
+    gtk_widget_set_sensitive (gtk_ui_manager_get_widget (window->priv->ui_manager, "/main-toolbar/forward"), sensitive);
+    gtk_widget_set_sensitive (gtk_ui_manager_get_widget (window->priv->ui_manager, "/main-toolbar/back"), sensitive);
+    gtk_widget_set_sensitive (gtk_ui_manager_get_widget (window->priv->ui_manager, "/main-toolbar/zoom-in"), sensitive);
+    gtk_widget_set_sensitive (gtk_ui_manager_get_widget (window->priv->ui_manager, "/main-toolbar/zoom-out"), sensitive);
+    gtk_widget_set_sensitive (gtk_ui_manager_get_widget (window->priv->ui_manager, "/main-toolbar/zoom-fit"), sensitive);
+    gtk_widget_set_sensitive (gtk_ui_manager_get_widget (window->priv->ui_manager, "/main-toolbar/zoom-100"), sensitive);
+}
+
+/**
  * rstto_main_window_set_property:
  * @object:
  * @property_id:
@@ -331,6 +457,7 @@
             {
                 g_object_ref (window->priv->props.navigator);
                 g_signal_connect (G_OBJECT (window->priv->props.navigator), "new-image", G_CALLBACK (cb_rstto_main_window_navigator_new_image), window);
+                g_signal_connect (G_OBJECT (window->priv->props.navigator), "iter-changed", G_CALLBACK (cb_rstto_main_window_navigator_invalidate_iters), window);
                 window->priv->iter = rstto_navigator_get_iter (window->priv->props.navigator);
             }
             break;
@@ -420,10 +547,42 @@
 }
 
 /**
+ * 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_navigator_iter_set_position (window->priv->iter, 0);
+    rstto_main_window_navigator_iter_changed (window);
+}
+
+
+/**
+ * cb_rstto_main_window_last_image:
+ * @widget:
+ * @window:
+ *
+ * Move the iter to the last image;
+ *
+ */
+static void
+cb_rstto_main_window_last_image (GtkWidget *widget, RsttoMainWindow *window)
+{
+    rstto_navigator_iter_set_position (window->priv->iter, -1);
+    rstto_main_window_navigator_iter_changed (window);
+}
+
+/**
  * cb_rstto_main_window_next_image:
  * @widget:
  * @window:
  *
+ * Move the iter to the next image;
  *
  */
 static void
@@ -438,6 +597,7 @@
  * @widget:
  * @window:
  *
+ * Move the iter to the previous image;
  *
  */
 static void
@@ -457,10 +617,151 @@
 static void
 cb_rstto_main_window_open_image (GtkWidget *widget, RsttoMainWindow *window)
 {
+    GtkWidget *dialog, *err_dialog;
+    gint response;
+    GFile *file;
+
+    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);
+
+    response = gtk_dialog_run(GTK_DIALOG(dialog));
+    gtk_widget_hide (dialog);
+    if(response == GTK_RESPONSE_OK)
+    {
+        file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog));
+        if (rstto_navigator_add_file (window->priv->props.navigator, 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);
+        }
+    }
+
+    gtk_widget_destroy(dialog);
+}
+
+/**
+ * cb_rstto_main_window_open_folder:
+ * @widget:
+ * @window:
+ *
+ *
+ */
+static void
+cb_rstto_main_window_open_folder (GtkWidget *widget, RsttoMainWindow *window)
+{
     g_debug ("%s", __FUNCTION__);
 }
 
 /**
+ * cb_rstto_main_window_play:
+ * @widget:
+ * @window:
+ *
+ *
+ */
+static void
+cb_rstto_main_window_play (GtkWidget *widget, RsttoMainWindow *window)
+{
+    g_debug ("%s", __FUNCTION__);
+}
+
+/**
+ * cb_rstto_main_window_fullscreen:
+ * @widget:
+ * @window:
+ *
+ * Toggle the fullscreen mode of this window.
+ *
+ */
+static void
+cb_rstto_main_window_fullscreen (GtkWidget *widget, RsttoMainWindow *window)
+{
+    if(gdk_window_get_state(GTK_WIDGET(window)->window) & GDK_WINDOW_STATE_FULLSCREEN)
+    {
+        gtk_window_unfullscreen(GTK_WINDOW(window));
+    }
+    else
+    {
+        gtk_window_fullscreen(GTK_WINDOW(window));
+    }
+}
+
+/**
+ * cb_rstto_main_window_preferences:
+ * @widget:
+ * @window:
+ *
+ *
+ */
+static void
+cb_rstto_main_window_preferences (GtkWidget *widget, RsttoMainWindow *window)
+{
+    g_debug ("%s", __FUNCTION__);
+}
+
+/**
+ * cb_rstto_main_window_about:
+ * @widget:
+ * @window:
+ *
+ *
+ */
+static void
+cb_rstto_main_window_about (GtkWidget *widget, RsttoMainWindow *window)
+{
+    const gchar *authors[] = {
+      _("Developer:"),
+        "Stephan Arts <stephan at xfce.org>",
+        NULL};
+
+    GtkWidget *about_dialog = gtk_about_dialog_new();
+
+    gtk_about_dialog_set_name((GtkAboutDialog *)about_dialog, PACKAGE_NAME);
+    gtk_about_dialog_set_version((GtkAboutDialog *)about_dialog, PACKAGE_VERSION);
+
+    gtk_about_dialog_set_comments((GtkAboutDialog *)about_dialog,
+        _("Ristretto is an imageviewer for the Xfce desktop environment."));
+    gtk_about_dialog_set_website((GtkAboutDialog *)about_dialog,
+        "http://goodies.xfce.org/projects/applications/ristretto");
+    gtk_about_dialog_set_logo_icon_name((GtkAboutDialog *)about_dialog,
+        "ristretto");
+    gtk_about_dialog_set_authors((GtkAboutDialog *)about_dialog,
+        authors);
+    gtk_about_dialog_set_translator_credits((GtkAboutDialog *)about_dialog,
+        _("translator-credits"));
+    gtk_about_dialog_set_license((GtkAboutDialog *)about_dialog,
+        xfce_get_license_text(XFCE_LICENSE_TEXT_GPL));
+    gtk_about_dialog_set_copyright((GtkAboutDialog *)about_dialog,
+        "Copyright \302\251 2006-2009 Stephan Arts");
+
+    gtk_dialog_run(GTK_DIALOG(about_dialog));
+
+    gtk_widget_destroy(about_dialog);
+}
+
+/**
+ * cb_rstto_main_window_contents:
+ * @widget:
+ * @window:
+ *
+ *
+ */
+static void
+cb_rstto_main_window_contents (GtkWidget *widget, RsttoMainWindow *window)
+{
+    g_debug ("%s", __FUNCTION__);
+}
+
+/**
  * cb_rstto_main_window_quit:
  * @widget:
  * @window:
@@ -473,8 +774,55 @@
     gtk_widget_destroy (GTK_WIDGET (window));
 }
 
+/**
+ * cb_rstto_main_window_close:
+ * @widget:
+ * @window:
+ *
+ *
+ */
+static void
+cb_rstto_main_window_close (GtkWidget *widget, RsttoMainWindow *window)
+{
+    RsttoImage *image = rstto_navigator_iter_get_image (window->priv->iter);
+    rstto_picture_viewer_set_image (RSTTO_PICTURE_VIEWER (window->priv->picture_viewer), NULL);
+    rstto_navigator_remove_image (window->priv->props.navigator, image);
+}
 
 /**
+ * cb_rstto_main_window_close_all:
+ * @widget:
+ * @window:
+ *
+ *
+ */
+static void
+cb_rstto_main_window_close_all (GtkWidget *widget, RsttoMainWindow *window)
+{
+    g_debug ("%s", __FUNCTION__);
+}
+
+/**
+ * cb_rstto_main_window_toggle_show_toolbar:
+ * @widget:
+ * @window:
+ *
+ *
+ */
+static void
+cb_rstto_main_window_toggle_show_toolbar (GtkWidget *widget, RsttoMainWindow *window)
+{
+    if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (widget)))
+    {
+        gtk_widget_show (window->priv->toolbar);
+    }
+    else
+    {
+        gtk_widget_hide (window->priv->toolbar);
+    }
+}
+
+/**
  * cb_rstto_main_window_navigator_new_image:
  * @navigator:
  * @image:
@@ -484,11 +832,65 @@
 static void
 cb_rstto_main_window_navigator_new_image (RsttoNavigator *navigator, RsttoImage *image, RsttoMainWindow *window)
 {
+    if (window->priv->iter == NULL)
+        window->priv->iter = rstto_navigator_get_iter (navigator);
+
+    rstto_navigator_iter_find_image (window->priv->iter, image);
+    rstto_main_window_navigator_iter_changed (window);
+}
+
+/**
+ * cb_rstto_main_window_navigator_invalidate_iters:
+ * @navigator:
+ * @window:
+ *
+ * An image has been added to or removed from the image-list.
+ * This means the iterator is no longer valid.
+ *
+ */
+static void
+cb_rstto_main_window_navigator_invalidate_iters (RsttoNavigator *navigator, RsttoMainWindow *window)
+{ 
+    RsttoImage *image;
+    gint pos;
+
+    /* If we have an iterator, retrieve the image associated to it */
     if (window->priv->iter)
     {
+        image = rstto_navigator_iter_get_image (window->priv->iter);
+        pos = rstto_navigator_iter_get_position (window->priv->iter);
+    }
+
+    /* If we have an image, add a reference to it to make sure we don't lose it */
+    if (image)
+        g_object_ref (image);
+
+    /* Free the invalid iter and get a new one */
+    if (window->priv->iter)
         rstto_navigator_iter_free (window->priv->iter);
+    window->priv->iter = rstto_navigator_get_iter (navigator);
+
+
+    if (image)
+    {
+
+        /* 
+         * Check if we can find the image inside the image-list, move the iter there.
+         */
+        if (rstto_navigator_iter_find_image (window->priv->iter, image) == FALSE)
+        {
+            /* If we cannot find the image, move the iter to the image after the original image */
+            if (rstto_navigator_iter_set_position (window->priv->iter, pos) == FALSE)
+            {
+                /* If this image does not exist, move it to the last image available */
+                rstto_navigator_iter_set_position (window->priv->iter, -1);
+            }
+        }
+
+        /* we no longer need the image, release our reference */
+        g_object_unref (image);
+
     }
-    window->priv->iter = rstto_navigator_get_iter (window->priv->props.navigator);
+
     rstto_main_window_navigator_iter_changed (window);
 }
-

Modified: ristretto/branches/ristretto-gio/src/main_window.h
===================================================================
--- ristretto/branches/ristretto-gio/src/main_window.h	2009-01-19 21:14:25 UTC (rev 6511)
+++ ristretto/branches/ristretto-gio/src/main_window.h	2009-01-19 21:16:04 UTC (rev 6512)
@@ -70,7 +70,7 @@
 
 GType      rstto_main_window_get_type();
 
-GtkWidget *rstto_main_window_new (RsttoNavigator *);
+GtkWidget *rstto_main_window_new (RsttoNavigator *, gboolean);
 
 G_END_DECLS
 

Modified: ristretto/branches/ristretto-gio/src/main_window_ui.xml
===================================================================
--- ristretto/branches/ristretto-gio/src/main_window_ui.xml	2009-01-19 21:14:25 UTC (rev 6511)
+++ ristretto/branches/ristretto-gio/src/main_window_ui.xml	2009-01-19 21:16:04 UTC (rev 6512)
@@ -64,7 +64,7 @@
         <separator />
         <toolitem action="back"/>
         <toolitem action="forward"/>
-        <separator />
+        <separator name="placeholder-1"/>
         <toolitem action="zoom-in"/>
         <toolitem action="zoom-out"/>
         <toolitem action="zoom-100"/>

Modified: ristretto/branches/ristretto-gio/src/navigator.c
===================================================================
--- ristretto/branches/ristretto-gio/src/navigator.c	2009-01-19 21:14:25 UTC (rev 6511)
+++ ristretto/branches/ristretto-gio/src/navigator.c	2009-01-19 21:16:04 UTC (rev 6512)
@@ -40,13 +40,14 @@
 enum
 {
     RSTTO_NAVIGATOR_SIGNAL_NEW_IMAGE = 0,
+    RSTTO_NAVIGATOR_SIGNAL_INVALIDATE_ITERS,
     RSTTO_NAVIGATOR_SIGNAL_COUNT
 };
 
 struct _RsttoNavigatorIter
 {
-    GList *data;
-    RsttoNavigator *navigator;
+    GList *list;
+    GList *iter;
 };
 
 struct _RsttoNavigatorPriv
@@ -109,6 +110,17 @@
             1,
             G_TYPE_OBJECT,
             NULL);
+
+    rstto_navigator_signals[RSTTO_NAVIGATOR_SIGNAL_INVALIDATE_ITERS] = g_signal_new("iter-changed",
+            G_TYPE_FROM_CLASS(nav_class),
+            G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+            0,
+            NULL,
+            NULL,
+            g_cclosure_marshal_VOID__VOID,
+            G_TYPE_NONE,
+            0,
+            NULL);
 }
 
 static void
@@ -127,15 +139,20 @@
     return navigator;
 }
 
-void
-rstto_navigator_add_file (RsttoNavigator *navigator, GFile *file)
+gboolean
+rstto_navigator_add_file (RsttoNavigator *navigator, GFile *file, GError **error)
 {
     RsttoImage *image = rstto_image_new (file);
+    if (image)
+    {
+        navigator->priv->images = g_list_prepend (navigator->priv->images, image);
+        navigator->priv->n_images++;
 
-    navigator->priv->images = g_list_prepend (navigator->priv->images, image);
-    navigator->priv->n_images++;
-
-    g_signal_emit (G_OBJECT (navigator), rstto_navigator_signals[RSTTO_NAVIGATOR_SIGNAL_NEW_IMAGE], 0, image, NULL);
+        g_signal_emit (G_OBJECT (navigator), rstto_navigator_signals[RSTTO_NAVIGATOR_SIGNAL_INVALIDATE_ITERS], 0, NULL);
+        g_signal_emit (G_OBJECT (navigator), rstto_navigator_signals[RSTTO_NAVIGATOR_SIGNAL_NEW_IMAGE], 0, image, NULL);
+        return TRUE;
+    }
+    return FALSE;
 }
 
 gint
@@ -149,54 +166,107 @@
 {
     RsttoNavigatorIter *iter = g_new0 (RsttoNavigatorIter, 1);
 
-    iter->data = navigator->priv->images;
-    iter->navigator = navigator;
+    iter->list = g_list_copy (navigator->priv->images);
 
+    iter->iter = iter->list;
+
+    g_list_foreach (iter->list, (GFunc)g_object_ref, NULL);
+
     return iter;
 }
 
 gint
 rstto_navigator_iter_get_position (RsttoNavigatorIter *iter)
 {
-    return g_list_position (iter->navigator->priv->images, iter->data)+1;
+    return g_list_position (iter->list, iter->iter);
 }
 
 gboolean
+rstto_navigator_iter_set_position (RsttoNavigatorIter *iter, gint pos)
+{
+    if (pos == -1)
+    {
+        iter->iter = g_list_last (iter->list);
+        return TRUE;
+    }
+    else
+    {
+        if (pos < g_list_length (iter->list))
+        {
+            iter->iter = g_list_nth (iter->list, pos);
+            return TRUE;
+        }
+    }
+    return FALSE;
+}
+
+gboolean
 rstto_navigator_iter_next (RsttoNavigatorIter *iter)
 {
-    if (g_list_next (iter->data))
+    if (g_list_next (iter->iter))
     {
-        iter->data = g_list_next (iter->data);
+        iter->iter = g_list_next (iter->iter);
     }
     else
     {
-        iter->data = g_list_first (iter->data);
+        iter->iter = g_list_first (iter->list);
     }
 }
 
 gboolean
 rstto_navigator_iter_previous (RsttoNavigatorIter *iter)
 {
-    if (g_list_previous (iter->data))
+    if (g_list_previous (iter->iter))
     {
-        iter->data = g_list_previous (iter->data);
+        iter->iter = g_list_previous (iter->iter);
     }
     else
     {
-        iter->data = g_list_last (iter->data);
+        iter->iter = g_list_last (iter->list);
     }
 }
 
 RsttoImage *
 rstto_navigator_iter_get_image (RsttoNavigatorIter *iter)
 {
-    if (iter->data)
-        return RSTTO_IMAGE (iter->data->data);
+    if (iter->iter)
+        return RSTTO_IMAGE (iter->iter->data);
     return NULL;
 }
 
 void
 rstto_navigator_iter_free (RsttoNavigatorIter *iter)
 {
+    g_list_foreach (iter->list, (GFunc)g_object_unref, NULL);
     g_free (iter);
 }
+
+void
+rstto_navigator_remove_image (RsttoNavigator *navigator, RsttoImage *image)
+{
+    if (g_list_find (navigator->priv->images, image))
+    {
+        g_object_unref (image);
+        navigator->priv->images = g_list_remove (navigator->priv->images, image);
+        g_signal_emit (G_OBJECT (navigator), rstto_navigator_signals[RSTTO_NAVIGATOR_SIGNAL_INVALIDATE_ITERS], 0, NULL);
+    }
+}
+
+void
+rstto_navigator_remove_all (RsttoNavigator *navigator)
+{
+    g_list_foreach (navigator->priv->images, (GFunc)g_object_unref, NULL);
+    g_list_free (navigator->priv->images);
+    g_signal_emit (G_OBJECT (navigator), rstto_navigator_signals[RSTTO_NAVIGATOR_SIGNAL_INVALIDATE_ITERS], 0, NULL);
+}
+
+gboolean
+rstto_navigator_iter_find_image (RsttoNavigatorIter *iter, RsttoImage *image)
+{
+    GList *list = g_list_find (iter->list, image);
+
+    if (list)
+        return TRUE;
+    
+    return FALSE;
+}

Modified: ristretto/branches/ristretto-gio/src/navigator.h
===================================================================
--- ristretto/branches/ristretto-gio/src/navigator.h	2009-01-19 21:14:25 UTC (rev 6511)
+++ ristretto/branches/ristretto-gio/src/navigator.h	2009-01-19 21:16:04 UTC (rev 6512)
@@ -62,8 +62,8 @@
 GType           rstto_navigator_get_type ();
 RsttoNavigator *rstto_navigator_new ();
 
-gint rstto_navigator_get_n_images (RsttoNavigator *navigator);
-void rstto_navigator_add_file (RsttoNavigator *navigator, GFile *file);
+gint     rstto_navigator_get_n_images (RsttoNavigator *navigator);
+gboolean rstto_navigator_add_file (RsttoNavigator *navigator, GFile *file, GError **);
 
 RsttoNavigatorIter *rstto_navigator_get_iter (RsttoNavigator *navigator);
 
@@ -73,9 +73,14 @@
 gboolean    rstto_navigator_iter_previous (RsttoNavigatorIter *iter);
 gboolean    rstto_navigator_iter_next (RsttoNavigatorIter *iter);
 gint        rstto_navigator_iter_get_position (RsttoNavigatorIter *iter);
+gboolean    rstto_navigator_iter_set_position (RsttoNavigatorIter *iter, gint pos);
 void        rstto_navigator_iter_free (RsttoNavigatorIter *iter);
 
 
+void        rstto_navigator_remove_all (RsttoNavigator *navigator);
+void        rstto_navigator_remove_image (RsttoNavigator *navigator, RsttoImage *image);
+gboolean    rstto_navigator_iter_find_image (RsttoNavigatorIter *iter, RsttoImage *image);
+
 G_END_DECLS
 
 #endif /* __RISTRETTO_NAVIGATOR_H__ */

Modified: ristretto/branches/ristretto-gio/src/picture_viewer.c
===================================================================
--- ristretto/branches/ristretto-gio/src/picture_viewer.c	2009-01-19 21:14:25 UTC (rev 6511)
+++ ristretto/branches/ristretto-gio/src/picture_viewer.c	2009-01-19 21:16:04 UTC (rev 6512)
@@ -1249,12 +1249,9 @@
 void
 rstto_picture_viewer_set_image (RsttoPictureViewer *viewer, RsttoImage *image)
 {
-    g_return_if_fail (image != NULL);
-    g_return_if_fail (RSTTO_IS_IMAGE (image));
-
     if (viewer->priv->image)
     {
-        g_signal_handlers_disconnect_by_func(viewer->priv->image, cb_rstto_picture_viewer_image_updated, viewer);
+        g_signal_handlers_disconnect_by_func (viewer->priv->image, cb_rstto_picture_viewer_image_updated, viewer);
         g_object_unref (viewer->priv->image);
     }
 
@@ -1265,10 +1262,9 @@
         rstto_image_load (viewer->priv->image, TRUE, NULL);
         g_object_ref (viewer->priv->image);
         g_signal_connect (G_OBJECT (viewer->priv->image), "updated", G_CALLBACK (cb_rstto_picture_viewer_image_updated), viewer);
-
-        rstto_picture_viewer_refresh (viewer);   
-        rstto_picture_viewer_paint (GTK_WIDGET (viewer));
     }
+    rstto_picture_viewer_refresh (viewer);   
+    rstto_picture_viewer_paint (GTK_WIDGET (viewer));
 }
 
 static void




More information about the Goodies-commits mailing list