[gnumeric] GUI: Resurrect splash screen.



commit ad15f06515eb2da0007f18f6fc98940e7d6ea3bc
Author: Morten Welinder <terra gnome org>
Date:   Thu Feb 23 14:06:45 2012 -0500

    GUI: Resurrect splash screen.

 ChangeLog              |   10 +++++++++
 NEWS                   |    1 +
 src/io-context-gtk.c   |   52 ++++++++++++++++++++++++++++-------------------
 src/io-context-gtk.h   |    2 +
 src/main-application.c |    8 +++++-
 src/workbook-view.c    |    3 --
 6 files changed, 50 insertions(+), 26 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index b0431cb..c848730 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2012-02-23  Morten Welinder  <terra gnome org>
+
+	* src/main-application.c (main): Explicitly discharge the splash.
+	Nowadays the component holds a ref to the command context so we
+	cannot rely on finalization to do this.
+
+	* src/io-context-gtk.c (gnm_io_context_gtk_set_transient_for): fix
+	reversed arguments to go_gtk_window_set_transient.
+	(icg_show_gui): Resurrect showing text in the progress bar.
+
 2012-02-22  Morten Welinder  <terra gnome org>
 
 	* src/io-context-gtk.c (icg_show_gui): Don't pass the splash
diff --git a/NEWS b/NEWS
index a8cd95f..bdbd7a2 100644
--- a/NEWS
+++ b/NEWS
@@ -36,6 +36,7 @@ Morten:
 	* Fix abs/rel stickiness in expression entry.  [#668691]
 	* Minor quit-dialog improvements.
 	* Put DataShuffle back on the menus.
+	* Resurrect the splash screen from bit rot.
 
 --------------------------------------------------------------------------
 Gnumeric 1.11.1
diff --git a/src/io-context-gtk.c b/src/io-context-gtk.c
index ce77f06..bd66785 100644
--- a/src/io-context-gtk.c
+++ b/src/io-context-gtk.c
@@ -146,10 +146,13 @@ icg_show_gui (GnmIOContextGtk *icg)
 			FALSE, FALSE, 0);
 	}
 
-	icg->work_bar = GTK_PROGRESS_BAR (gtk_progress_bar_new ());
-	gtk_progress_bar_set_inverted (icg->work_bar, FALSE);
-	gtk_progress_bar_set_text (icg->work_bar, icg->progress_msg);
-	gtk_progress_bar_set_fraction (icg->work_bar, icg->progress);
+	icg->work_bar = GTK_PROGRESS_BAR
+		(g_object_new (GTK_TYPE_PROGRESS_BAR,
+			       "inverted", FALSE,
+			       "text", icg->progress_msg,
+			       "show-text", TRUE,
+			       "fraction", icg->progress,
+			       NULL));
 	gtk_box_pack_start (box, GTK_WIDGET (icg->work_bar),
 			    FALSE, FALSE, 0);
 
@@ -172,7 +175,7 @@ icg_show_gui (GnmIOContextGtk *icg)
 			  G_CALLBACK (cb_realize), NULL);
 
 	if (icg->parent_window)
-		go_gtk_window_set_transient (icg->window, icg->parent_window);
+		gnm_io_context_gtk_set_transient_for (icg, icg->parent_window);
 
 	gtk_widget_show_all (GTK_WIDGET (icg->window));
 }
@@ -330,22 +333,8 @@ icg_finalize (GObject *obj)
 {
 	GnmIOContextGtk *icg = GNM_IO_CONTEXT_GTK (obj);
 
-	if (icg->window) {
-		g_signal_handlers_disconnect_by_func (
-			G_OBJECT (icg->window),
-			G_CALLBACK (cb_icg_window_destroyed), icg);
-		gtk_window_set_focus (icg->window, NULL);
-		gtk_window_set_default (icg->window, NULL);
-		gtk_widget_destroy (GTK_WIDGET (icg->window));
-	}
+	gnm_io_context_gtk_discharge_splash (icg);
 	g_free (icg->progress_msg);
-	icg->window = NULL;
-	icg->work_bar = NULL;
-	icg->file_bar = NULL;
-	if (icg->timer)
-		g_timer_destroy (icg->timer);
-	icg->timer = NULL;
-
 	G_OBJECT_CLASS (g_type_class_peek (GO_TYPE_IO_CONTEXT))->finalize (obj);
 }
 
@@ -429,7 +418,7 @@ gnm_io_context_gtk_set_transient_for (GnmIOContextGtk *icg, GtkWindow *parent_wi
 {
 	icg->parent_window = parent_window;
 	if (icg->window)
-		go_gtk_window_set_transient (icg->window, parent_window);
+		go_gtk_window_set_transient (parent_window, icg->window);
 }
 
 gboolean
@@ -437,3 +426,24 @@ gnm_io_context_gtk_get_interrupted (GnmIOContextGtk *icg)
 {
 	return icg->interrupted;
 }
+
+void
+gnm_io_context_gtk_discharge_splash (GnmIOContextGtk *icg)
+{
+	if (icg->window) {
+		g_signal_handlers_disconnect_by_func (
+			G_OBJECT (icg->window),
+			G_CALLBACK (cb_icg_window_destroyed), icg);
+		gtk_window_set_focus (icg->window, NULL);
+		gtk_window_set_default (icg->window, NULL);
+		gtk_widget_destroy (GTK_WIDGET (icg->window));
+		icg->window = NULL;
+		icg->work_bar = NULL;
+		icg->file_bar = NULL;
+	}
+
+	if (icg->timer) {
+		g_timer_destroy (icg->timer);
+		icg->timer = NULL;
+	}
+}
diff --git a/src/io-context-gtk.h b/src/io-context-gtk.h
index ae92098..053cb3f 100644
--- a/src/io-context-gtk.h
+++ b/src/io-context-gtk.h
@@ -21,6 +21,8 @@ GType gnm_io_context_gtk_get_type (void);
 void  gnm_io_context_gtk_set_transient_for (GnmIOContextGtk *icg, GtkWindow *parent_window);
 gboolean gnm_io_context_gtk_get_interrupted (GnmIOContextGtk *icg);
 
+void gnm_io_context_gtk_discharge_splash (GnmIOContextGtk *icg);
+
 G_END_DECLS
 
 #endif /* _GNM_IO_CONTEXT_GTK_H_ */
diff --git a/src/main-application.c b/src/main-application.c
index 2d99228..cbf91db 100644
--- a/src/main-application.c
+++ b/src/main-application.c
@@ -347,6 +347,10 @@ main (int argc, char const **argv)
 				break; /* Don't load any more workbooks */
 		}
 	}
+
+	g_object_unref (cc);
+	cc = NULL;
+
 	/* FIXME: Maybe we should quit here if we were asked to open
 	   files and failed to do so. */
 
@@ -372,6 +376,8 @@ main (int argc, char const **argv)
 				  G_CALLBACK (cb_workbook_removed),
 				  NULL);
 
+		gnm_io_context_gtk_discharge_splash (GNM_IO_CONTEXT_GTK (ioc));
+
 		g_idle_add ((GSourceFunc)pathetic_qt_workaround, NULL);
 		gtk_main ();
 	} else {
@@ -385,8 +391,6 @@ main (int argc, char const **argv)
 	gnm_shutdown ();
 
 	go_component_set_command_context (NULL);
-	g_object_unref (cc);
-	cc = NULL;
 
 #if defined(G_OS_WIN32)
 	if (has_console) {
diff --git a/src/workbook-view.c b/src/workbook-view.c
index 0899dac..410eaad 100644
--- a/src/workbook-view.c
+++ b/src/workbook-view.c
@@ -1011,9 +1011,6 @@ workbook_view_new (Workbook *wb)
 	for (i = 0 ; i < workbook_sheet_count (wb); i++)
 		wb_view_sheet_add (wbv, workbook_sheet_by_index (wb, i));
 
-	WORKBOOK_VIEW_FOREACH_CONTROL (wbv, wbc,
-		wb_view_init_control (wbc););
-
 	return wbv;
 }
 



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