gnumeric r16944 - in trunk: . src



Author: mortenw
Date: Sun Nov  2 21:39:46 2008
New Revision: 16944
URL: http://svn.gnome.org/viewvc/gnumeric?rev=16944&view=rev

Log:
2008-11-02  Morten Welinder  <terra gnome org>

	* src/main-application.c (main): Add a signal handler on the
	application object to terminate the mainloop when the last
	workbook is removed.  Also, only warn about ancient non-stable
	Gnumeric binaries.

	* src/workbook.c (workbook_finalize): Don't try to terminate the
	mainloop here.



Modified:
   trunk/ChangeLog
   trunk/src/main-application.c
   trunk/src/workbook.c

Modified: trunk/src/main-application.c
==============================================================================
--- trunk/src/main-application.c	(original)
+++ trunk/src/main-application.c	Sun Nov  2 21:39:46 2008
@@ -35,6 +35,7 @@
 #include "sheet.h"
 #include "gutils.h"
 #include "gnm-plugin.h"
+#include "application.h"
 
 #include <gtk/gtkmain.h>
 #include <glib/gstdio.h>
@@ -335,6 +336,18 @@
 			     "with your distribution if a fixed Pango library is available."));
 }
 
+static void
+cb_workbook_removed (void)
+{
+	if (gnm_app_workbook_list () == NULL) {
+#ifdef GNM_WITH_GNOME
+		bonobo_main_quit ();
+#else
+		gtk_main_quit ();
+#endif
+	}
+}
+
 int
 main (int argc, char const **argv)
 {
@@ -475,8 +488,6 @@
 			wbc_gtk_new (NULL,
 				workbook_new_with_sheets (n_of_sheets),
 				NULL, NULL);
-			/* cheesy attempt to keep the ui from freezing during load */
-			handle_paint_events ();
 		}
 
 		if (immediate_exit_flag) {
@@ -484,10 +495,17 @@
 			for (l = wbcgs_to_kill; l; l = l->next)
 				g_idle_add ((GSourceFunc)cb_kill_wbcg, l->data);
 		} else {
-			warn_about_ancient_gnumerics (g_get_prgname(), ioc);
+			if (GNM_VERSION_MAJOR & 1)
+				warn_about_ancient_gnumerics (g_get_prgname(),
+							      ioc);
 		}
 		g_object_unref (ioc);
 
+		g_signal_connect (gnm_app_get_app (),
+				  "workbook_removed",
+				  G_CALLBACK (cb_workbook_removed),
+				  NULL);
+
 		g_idle_add ((GSourceFunc)pathetic_qt_workaround, NULL);
 #ifdef GNM_WITH_GNOME
 		bonobo_main ();

Modified: trunk/src/workbook.c
==============================================================================
--- trunk/src/workbook.c	(original)
+++ trunk/src/workbook.c	Sun Nov  2 21:39:46 2008
@@ -40,14 +40,6 @@
 #include <goffice/utils/go-file.h>
 #include <goffice/utils/go-glib-extras.h>
 
-#ifdef GNM_WITH_GTK
-#ifdef GNM_WITH_GNOME
-#include <bonobo/bonobo-main.h>
-#else
-#include <gtk/gtkmain.h> /* for gtk_main_quit */
-#endif
-#endif /* GNM_WITH_GTK */
-
 #include <gsf/gsf-doc-meta-data.h>
 #include <gsf/gsf-impl-utils.h>
 #include <glib/gi18n-lib.h>
@@ -160,15 +152,6 @@
 	g_ptr_array_free (wb->sheets, TRUE);
 	wb->sheets = NULL;
 
-	/* this has no business being here */
-#ifdef GNM_WITH_GTK
-	if (initial_workbook_open_complete && gnm_app_workbook_list () == NULL)
-#ifdef GNM_WITH_GNOME
-		bonobo_main_quit ();
-#else
-		gtk_main_quit ();
-#endif
-#endif
 	workbook_parent_class->finalize (obj);
 }
 



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