changeset 89:b3149a34d0dd

Sat Oct 28 14:41:10 2006 John Ellis <johne@verizon.net> * img-view.c: Use correct method to close the window using Escape key, fixes bug #1231845. Also added more robust method to update window list when a window is closed so this doesn't happen again. * slideshow.c: Add sanity checks to exported functions to check for NULL SlideShow pointers, to match rest of coding style.
author gqview
date Sat, 28 Oct 2006 18:49:38 +0000
parents 2099ee3f9a8d
children dc3c77d027e6
files ChangeLog TODO src/img-view.c src/slideshow.c
diffstat 4 files changed, 38 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sat Oct 28 00:03:15 2006 +0000
+++ b/ChangeLog	Sat Oct 28 18:49:38 2006 +0000
@@ -1,3 +1,11 @@
+Sat Oct 28 14:41:10 2006  John Ellis  <johne@verizon.net>
+
+	* img-view.c: Use correct method to close the window using Escape key,
+	fixes bug #1231845. Also added more robust method to update window
+	list when a window is closed so this doesn't happen again.
+	* slideshow.c: Add sanity checks to exported functions to check for
+	NULL SlideShow pointers, to match rest of coding style.
+
 Fri Oct 27 19:45:32 2006  John Ellis  <johne@verizon.net>
 
 	* layout.c, ui_menu.c, ui_misc.c: Use g_object_ref_sink when
--- a/TODO	Sat Oct 28 00:03:15 2006 +0000
+++ b/TODO	Sat Oct 28 18:49:38 2006 +0000
@@ -4,6 +4,10 @@
 Major:
 ----------------------------------------------
 
+ > figure out if crash when expanding a folder in the folder tree view then pessing "*" is a bug
+   GTK+ 2.10.4 (gdb shows it deep inside gtk, near gtk_tree_view_set_hover_selection()). This does not
+   happen on GTK+ 2.6.
+
  > pixbuf-renderer.c:
    > tile dispose order is slightly incorrect, furthest ones from current position should be dropped first
 
@@ -125,6 +129,9 @@
 Wishlist?:
 ----------------------------------------------
 
+ > Explore tabbed view option to main window, where 'view in new window' option results
+   in a new tab instead of window.
+
  > Initiating full screen from the command line should not
    show main window until full screen is exited.
 
--- a/src/img-view.c	Sat Oct 28 00:03:15 2006 +0000
+++ b/src/img-view.c	Sat Oct 28 18:49:38 2006 +0000
@@ -558,7 +558,7 @@
 					}
 				else
 					{
-					gtk_widget_destroy(vw->window);
+					view_window_close(vw);
 					}
 				break;
 			case GDK_Menu:
@@ -767,15 +767,24 @@
 	if (vw->ss) slideshow_free(vw->ss);
 }
 
-static void view_window_close(ViewWindow *vw)
+static void view_window_destroy_cb(GtkWidget *widget, gpointer data)
 {
+	ViewWindow *vw = data;
+
 	view_window_list = g_list_remove(view_window_list, vw);
 
 	view_slideshow_stop(vw);
+	fullscreen_stop(vw->fs);
+
+	path_list_free(vw->list);
+	g_free(vw);
+}
+
+static void view_window_close(ViewWindow *vw)
+{
+	view_slideshow_stop(vw);
 	view_fullscreen_toggle(vw, TRUE);
 	gtk_widget_destroy(vw->window);
-	path_list_free(vw->list);
-	g_free(vw);
 }
 
 static gint view_window_delete_cb(GtkWidget *w, GdkEventAny *event, gpointer data)
@@ -832,6 +841,8 @@
 
 	view_image_set_buttons(vw, vw->imd);
 
+	g_signal_connect(G_OBJECT(vw->window), "destroy",
+			 G_CALLBACK(view_window_destroy_cb), vw);
 	g_signal_connect(G_OBJECT(vw->window), "delete_event",
 			 G_CALLBACK(view_window_delete_cb), vw);
 	g_signal_connect(G_OBJECT(vw->window), "key_press_event",
--- a/src/slideshow.c	Sat Oct 28 00:03:15 2006 +0000
+++ b/src/slideshow.c	Sat Oct 28 18:49:38 2006 +0000
@@ -25,6 +25,8 @@
 
 void slideshow_free(SlideShowData *ss)
 {
+	if (!ss) return;
+
 	slideshow_timer_reset(ss, FALSE);
 
 	if (ss->stop_func) ss->stop_func(ss, ss->stop_data);
@@ -118,6 +120,8 @@
 	const gchar *imd_path;
 	const gchar *path;
 
+	if (!ss) return FALSE;
+
 	imd_path = image_get_path(ss->imd);
 
 	if ( ((imd_path == NULL) != (ss->slide_path == NULL)) ||
@@ -284,6 +288,8 @@
 
 void slideshow_next(SlideShowData *ss)
 {
+	if (!ss) return;
+
 	if (!slideshow_step(ss, TRUE))
 		{
 		slideshow_free(ss);
@@ -295,6 +301,8 @@
 
 void slideshow_prev(SlideShowData *ss)
 {
+	if (!ss) return;
+
 	if (!slideshow_step(ss, FALSE))
 		{
 		slideshow_free(ss);