[Goodies-commits] r3202 - ristretto/trunk/src

Stephan Arts stephan at xfce.org
Tue Sep 11 23:59:39 CEST 2007


Author: stephan
Date: 2007-09-11 21:59:38 +0000 (Tue, 11 Sep 2007)
New Revision: 3202

Modified:
   ristretto/trunk/src/main.c
   ristretto/trunk/src/navigator.c
   ristretto/trunk/src/picture_viewer.c
Log:
Fix closing of images
Add a confirmation-dialog to the recently-used clear button



Modified: ristretto/trunk/src/main.c
===================================================================
--- ristretto/trunk/src/main.c	2007-09-11 10:14:02 UTC (rev 3201)
+++ ristretto/trunk/src/main.c	2007-09-11 21:59:38 UTC (rev 3202)
@@ -1029,7 +1029,17 @@
 static void
 cb_rstto_clear_recent(GtkWidget *widget, GtkRecentManager *manager)
 {
-    g_timeout_add(150, (GSourceFunc)rstto_clear_recent, manager);
+    GtkWidget *dialog = gtk_message_dialog_new(NULL,
+                                    GTK_DIALOG_MODAL,
+                                    GTK_MESSAGE_ERROR,
+                                    GTK_BUTTONS_OK_CANCEL,
+                                    _("Are you sure you want to clear ristretto's recently opened documents?"));
+    gint result = gtk_dialog_run(GTK_DIALOG(dialog));
+    if (result == GTK_RESPONSE_OK)
+    {
+        g_timeout_add(150, (GSourceFunc)rstto_clear_recent, manager);
+    }
+    gtk_widget_destroy(dialog);
 }
 
 static gboolean

Modified: ristretto/trunk/src/navigator.c
===================================================================
--- ristretto/trunk/src/navigator.c	2007-09-11 10:14:02 UTC (rev 3201)
+++ ristretto/trunk/src/navigator.c	2007-09-11 21:59:38 UTC (rev 3202)
@@ -224,6 +224,16 @@
                       navigator->file_iter->data,
                       NULL);
     }
+    else
+    {
+        g_signal_emit(G_OBJECT(navigator),
+                      rstto_navigator_signals[RSTTO_NAVIGATOR_SIGNAL_ITER_CHANGED],
+                      0,
+                      -1,
+                      NULL,
+                      NULL);
+
+    }
 }
 
 void
@@ -349,6 +359,11 @@
         }
     }
     navigator->file_list = g_list_remove(navigator->file_list, entry);
+    if(g_list_length(navigator->file_list) == 0)
+    {
+        navigator->file_iter = NULL;
+        navigator->file_list = NULL;
+    }
     g_signal_emit(G_OBJECT(navigator), rstto_navigator_signals[RSTTO_NAVIGATOR_SIGNAL_REORDERED], 0, NULL);
 }
 

Modified: ristretto/trunk/src/picture_viewer.c
===================================================================
--- ristretto/trunk/src/picture_viewer.c	2007-09-11 10:14:02 UTC (rev 3201)
+++ ristretto/trunk/src/picture_viewer.c	2007-09-11 21:59:38 UTC (rev 3202)
@@ -1,4 +1,6 @@
 /*
+        g_object_unref(viewer->priv->src_pixbuf);
+        viewer->priv->src_pixbuf = NULL;
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 2 of the License, or
@@ -621,6 +623,14 @@
             gdk_cursor_unref(cursor);
         }
     }
+    else
+    {
+        if(viewer->priv->dst_pixbuf)
+        {
+            g_object_unref(viewer->priv->dst_pixbuf);
+            viewer->priv->dst_pixbuf = NULL;
+        }
+    }
     return changed;
 }
 
@@ -644,16 +654,29 @@
 cb_rstto_picture_viewer_nav_file_changed(RsttoNavigator *nav, gint nr, RsttoNavigatorEntry *entry, RsttoPictureViewer *viewer)
 {
     GtkWidget *widget = GTK_WIDGET(viewer);
-    if (GTK_WIDGET_REALIZED(widget))
+    if(entry)
     {
-        GdkCursor *cursor = gdk_cursor_new(GDK_WATCH);
-        gdk_window_set_cursor(widget->window, cursor);
-        gdk_cursor_unref(cursor);
+        if (GTK_WIDGET_REALIZED(widget))
+        {
+            GdkCursor *cursor = gdk_cursor_new(GDK_WATCH);
+            gdk_window_set_cursor(widget->window, cursor);
+            gdk_cursor_unref(cursor);
+        }
+        g_timer_start(viewer->priv->timer);
+        if (viewer->priv->timeout_id == 0)
+            viewer->priv->timeout_id = g_timeout_add(150, (GSourceFunc)cb_rstto_picture_viewer_update_image, viewer);
     }
-    g_timer_start(viewer->priv->timer);
-    if (viewer->priv->timeout_id == 0)
-        viewer->priv->timeout_id = g_timeout_add(150, (GSourceFunc)cb_rstto_picture_viewer_update_image, viewer);
-
+    else
+    {
+        g_object_unref(viewer->priv->src_pixbuf);
+        viewer->priv->src_pixbuf = NULL;
+        g_object_unref(viewer->priv->dst_pixbuf);
+        viewer->priv->dst_pixbuf = NULL;
+        if (GTK_WIDGET_REALIZED(widget))
+        {
+            rstto_picture_viewer_paint(GTK_WIDGET(viewer));
+        }
+    }
 }
 
 static void
@@ -669,22 +692,22 @@
     }
 
     if(viewer->priv->src_pixbuf)
+    {
         g_object_unref(viewer->priv->src_pixbuf);
+        viewer->priv->src_pixbuf = NULL;
+    }
 
-    viewer->priv->src_pixbuf = rstto_navigator_entry_get_pixbuf(entry);
-
-    if(viewer->priv->src_pixbuf)
+    if(entry)
     {
+        viewer->priv->src_pixbuf = rstto_navigator_entry_get_pixbuf(entry);
         g_object_ref(viewer->priv->src_pixbuf);
-        if (GTK_WIDGET_REALIZED(widget))
-        {
-            rstto_picture_viewer_refresh(viewer);
-            rstto_picture_viewer_paint(GTK_WIDGET(viewer));
-        }
     }
 
     if(GTK_WIDGET_REALIZED(widget))
     {
+        rstto_picture_viewer_refresh(viewer);
+        rstto_picture_viewer_paint(GTK_WIDGET(viewer));
+
         GdkCursor *cursor = gdk_cursor_new(GDK_LEFT_PTR);
         gdk_window_set_cursor(widget->window, cursor);
         gdk_cursor_unref(cursor);




More information about the Goodies-commits mailing list