[eog] Clear status + titlebar when deleting last image in collection



commit 7a6ea9ee0e5e8a2d89fd16f241a693c5a56f3b78
Author: Felix Riemann <friemann gnome org>
Date:   Sat Oct 23 23:54:33 2010 +0200

    Clear status + titlebar when deleting last image in collection
    
    Fixes bug 632458.

 src/eog-statusbar.c |    4 ++++
 src/eog-window.c    |   20 ++++++++++++++------
 2 files changed, 18 insertions(+), 6 deletions(-)
---
diff --git a/src/eog-statusbar.c b/src/eog-statusbar.c
index 7ee15e3..06660cf 100644
--- a/src/eog-statusbar.c
+++ b/src/eog-statusbar.c
@@ -109,6 +109,10 @@ eog_statusbar_set_image_number (EogStatusbar *statusbar,
 
 	gtk_statusbar_pop (GTK_STATUSBAR (statusbar->priv->img_num_statusbar), 0);
 
+	/* Hide number display if values don't make sense */
+	if (G_UNLIKELY (num <= 0 || tot <= 0))
+		return;
+
 	/* Translators: This string is displayed in the statusbar.
 	 * The first token is the image number, the second is total image
 	 * count.
diff --git a/src/eog-window.c b/src/eog-window.c
index 4dce5b1..83fc39b 100644
--- a/src/eog-window.c
+++ b/src/eog-window.c
@@ -479,7 +479,7 @@ static void
 update_image_pos (EogWindow *window)
 {
 	EogWindowPrivate *priv;
-	gint pos, n_images;
+	gint pos = -1, n_images = 0;
 
 	priv = window->priv;
 
@@ -488,12 +488,12 @@ update_image_pos (EogWindow *window)
 	if (n_images > 0) {
 		pos = eog_list_store_get_pos_by_image (EOG_LIST_STORE (priv->store),
 						       priv->image);
-
-		/* Images: (image pos) / (n_total_images) */
-		eog_statusbar_set_image_number (EOG_STATUSBAR (priv->statusbar),
-						pos + 1,
-						n_images);
 	}
+	/* Images: (image pos) / (n_total_images) */
+	eog_statusbar_set_image_number (EOG_STATUSBAR (priv->statusbar),
+					pos + 1,
+					n_images);
+
 }
 
 static void
@@ -1464,6 +1464,14 @@ handle_image_selection_changed_cb (EogThumbView *thumbview, EogWindow *window)
 
 	priv = window->priv;
 
+	if (eog_list_store_length (EOG_LIST_STORE (priv->store)) == 0) {
+		gtk_window_set_title (GTK_WINDOW (window),
+				      g_get_application_name());
+		gtk_statusbar_remove_all (GTK_STATUSBAR (priv->statusbar),
+					  priv->image_info_message_cid);
+		eog_scroll_view_set_image (EOG_SCROLL_VIEW (priv->view),
+					   NULL);
+	}
 	if (eog_thumb_view_get_n_selected (EOG_THUMB_VIEW (priv->thumbview)) == 0)
 		return;
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]