Commit aaf8fb5f authored by Jean Bréfort's avatar Jean Bréfort

Fixed component related command context issues.

parent 06cf6d53
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.
......
......@@ -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,
......
......@@ -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
"
......
......@@ -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
......
......@@ -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;
......
......@@ -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));
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment