[gnumeric] Fixed component related command context issues.



commit aaf8fb5fb39d7763ae8a3316935af25e827271fe
Author: Jean Brefort <jean brefort normalesup org>
Date:   Fri Jul 20 15:29:45 2012 +0200

    Fixed component related command context issues.

 ChangeLog                    |   11 +++++++++++
 component/gnumeric.c         |    8 ++++----
 configure.in                 |    2 +-
 src/main-application.c       |    7 +++----
 src/sheet-object-component.c |    4 ++++
 src/wbc-gtk-actions.c        |    3 ++-
 src/wbc-gtk.c                |    2 +-
 7 files changed, 26 insertions(+), 11 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 636af5e..1dab112 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2012-07-20  Jean Brefort  <jean brefort normalesup org>
+
+	* component/gnumeric.c (go_gnm_component_get_data),
+	(go_gnm_component_set_data), (go_gnm_component_edit),
+	(go_plugin_init): fixed command context issues.
+	* configure.in: need goffice-0.9.6.
+	* src/main-application.c (main): fixed command context issues.
+	* src/sheet-object-component.c (component_changed_cb),
+	(gnm_soc_user_config): ditto.
+	* src/wbc-gtk-actions.c: ditto.
+
 2012-07-15  Morten Welinder <terra gnome org>
 
 	* configure.in: Post-release bump.
diff --git a/component/gnumeric.c b/component/gnumeric.c
index 215aa60..96164fc 100644
--- a/component/gnumeric.c
+++ b/component/gnumeric.c
@@ -89,7 +89,7 @@ go_gnm_component_get_data (GOComponent *component, gpointer *data, int *length,
 {
 	GOGnmComponent *gognm = GO_GNM_COMPONENT (component);
 	if (gognm->wv) {
-		GOCmdContext *cc = go_component_get_command_context ();
+		GOCmdContext *cc = go_component_get_command_context (component);
 		GOIOContext *io_context = go_io_context_new (cc);
 		GsfOutput *output = gsf_output_memory_new ();
 		GOFileSaver *gfs = workbook_get_file_saver (gognm->wb);
@@ -130,7 +130,7 @@ static void
 go_gnm_component_set_data (GOComponent *component)
 {
 	GOGnmComponent *gognm = GO_GNM_COMPONENT (component);
-	GOCmdContext *cc = go_component_get_command_context ();
+	GOCmdContext *cc = go_component_get_command_context (component);
 	GOIOContext *io_context = go_io_context_new (cc);
 	GsfInput *input = gsf_input_memory_new (component->data, component->length, FALSE);
 
@@ -219,7 +219,7 @@ go_gnm_component_edit (GOComponent *component)
 		component->width = 0.;
 		wv = workbook_view_new (workbook_new_with_sheets (1));
 	} else {
-		GOCmdContext *cc = go_component_get_command_context ();
+		GOCmdContext *cc = go_component_get_command_context (component);
 		GOIOContext *io_context = GO_IS_IO_CONTEXT (cc)? GO_IO_CONTEXT (g_object_ref (cc)): go_io_context_new (cc);
 		GsfInput *input = gsf_input_memory_new (component->data, component->length, FALSE);
 
@@ -318,7 +318,7 @@ go_plugin_init (GOPlugin *plugin, G_GNUC_UNUSED GOCmdContext *cc)
 
 	go_components_set_mime_suffix ("application/x-gnumeric", "*.gnumeric");
 
-	go_plugins_init (go_component_get_command_context (),
+	go_plugins_init (go_component_get_command_context (NULL),
 			gnm_conf_get_plugins_file_states (),
 			gnm_conf_get_plugins_active (),
 			dir_list,
diff --git a/configure.in b/configure.in
index 2363620..0b87e1b 100644
--- a/configure.in
+++ b/configure.in
@@ -145,7 +145,7 @@ PKG_PROG_PKG_CONFIG(0.18)
 
 dnl *****************************
 libspreadsheet_reqs="
-	libgoffice-${GOFFICE_API_VER}	>= 0.9.4
+	libgoffice-${GOFFICE_API_VER}	>= 0.9.6
 	libgsf-1		>= 1.14.18
 	libxml-2.0		>= 2.4.12
 "
diff --git a/src/main-application.c b/src/main-application.c
index cbf91db..642131c 100644
--- a/src/main-application.c
+++ b/src/main-application.c
@@ -293,7 +293,7 @@ main (int argc, char const **argv)
 		cc = cmd_context_stderr_new ();
 		ioc = go_io_context_new (cc);
 	}
-	go_component_set_command_context (cc);
+	go_component_set_default_command_context (cmd_context_stderr_new ());
 
 	/* Keep in sync with .desktop file */
 	g_set_application_name (_("Gnumeric Spreadsheet"));
@@ -369,7 +369,6 @@ main (int argc, char const **argv)
 			for (l = wbcgs_to_kill; l; l = l->next)
 				g_idle_add ((GSourceFunc)cb_kill_wbcg, l->data);
 		}
-		g_object_unref (ioc);
 
 		g_signal_connect (gnm_app_get_app (),
 				  "workbook_removed",
@@ -377,6 +376,7 @@ main (int argc, char const **argv)
 				  NULL);
 
 		gnm_io_context_gtk_discharge_splash (GNM_IO_CONTEXT_GTK (ioc));
+		g_object_unref (ioc);
 
 		g_idle_add ((GSourceFunc)pathetic_qt_workaround, NULL);
 		gtk_main ();
@@ -390,8 +390,6 @@ main (int argc, char const **argv)
 	store_plugin_state ();
 	gnm_shutdown ();
 
-	go_component_set_command_context (NULL);
-
 #if defined(G_OS_WIN32)
 	if (has_console) {
 		close(1);
@@ -401,6 +399,7 @@ main (int argc, char const **argv)
 #endif
 
 	gnm_pre_parse_shutdown ();
+	go_component_set_default_command_context (NULL);
 
 	/*
 	 * This helps finding leaks.  We might want it in developent
diff --git a/src/sheet-object-component.c b/src/sheet-object-component.c
index f9e450f..6577540 100644
--- a/src/sheet-object-component.c
+++ b/src/sheet-object-component.c
@@ -352,6 +352,7 @@ component_changed_cb (GOComponent *component, gnm_soc_user_config_t *data)
 {
 	SheetObjectComponent *soc = SHEET_OBJECT_COMPONENT (data->so);
 	cmd_so_component_config (data->wbc, data->so, G_OBJECT (component), G_OBJECT (soc->component));
+	go_component_set_command_context (component, NULL);
 }
 
 static void
@@ -371,8 +372,11 @@ gnm_soc_user_config (SheetObject *so, SheetControl *sc)
 
 	g_return_if_fail (soc && soc->component);
 
+	go_component_set_command_context (soc->component, GO_CMD_CONTEXT (scg_wbcg (SHEET_CONTROL_GUI (sc))));
 	new_comp = go_component_duplicate (soc->component);
+	go_component_set_command_context (new_comp, GO_CMD_CONTEXT (scg_wbcg (SHEET_CONTROL_GUI (sc))));
 	w = (GtkWidget *) go_component_edit (new_comp);
+	go_component_set_command_context (soc->component, NULL);
 	if (w) {
 		gnm_soc_user_config_t *data = g_new0 (gnm_soc_user_config_t, 1);
 		data->so = so;
diff --git a/src/wbc-gtk-actions.c b/src/wbc-gtk-actions.c
index ab2e93e..36216fd 100644
--- a/src/wbc-gtk-actions.c
+++ b/src/wbc-gtk-actions.c
@@ -1430,7 +1430,8 @@ static GNM_ACTION_DEF (cb_launch_go_component_from_file)
 	go_components_add_filter (GTK_FILE_CHOOSER (dlg));
 	if (gtk_dialog_run (GTK_DIALOG (dlg)) == GTK_RESPONSE_ACCEPT) {
 		char *uri = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (dlg));
-		GOComponent *component = go_component_new_from_uri (uri);
+		GOComponent *component;
+		component = go_component_new_from_uri (uri);
 		g_free (uri);
 		if (component)
 			wbcg_insert_object (WBC_GTK (wbcg), sheet_object_component_new (component));
diff --git a/src/wbc-gtk.c b/src/wbc-gtk.c
index 723581f..da8de99 100644
--- a/src/wbc-gtk.c
+++ b/src/wbc-gtk.c
@@ -5854,7 +5854,7 @@ wbcg_get_nth_scg (WBCGtk *wbcg, int i)
 Sheet *
 wbcg_focus_cur_scg (WBCGtk *wbcg)
 {
-	SheetControlGUI *scg;
+	SheetControlGUI *scg;	
 
 	g_return_val_if_fail (IS_WBC_GTK (wbcg), NULL);
 



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