[gnumeric] More work on #680190.
- From: Jean BrÃfort <jbrefort src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] More work on #680190.
- Date: Sat, 21 Jul 2012 16:22:26 +0000 (UTC)
commit d9d2080f2ef91ea55dc36fbd96139012c25e80a4
Author: Jean Brefort <jean brefort normalesup org>
Date: Sat Jul 21 18:20:07 2012 +0200
More work on #680190.
ChangeLog | 12 ++++++++++++
component/gnumeric.c | 6 +++++-
src/commands.c | 6 ++----
src/main-application.c | 4 +++-
src/sheet-object-component.c | 1 -
src/ssconvert.c | 2 ++
src/wbc-gtk-actions.c | 5 ++++-
src/workbook-view.c | 40 ++++++++++++++++++++--------------------
8 files changed, 48 insertions(+), 28 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index d48b934..14fea6d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2012-07-21 Jean Brefort <jean brefort normalesup org>
+
+ * component/gnumeric.c (go_gnm_component_set_data),
+ (cb_gognm_save), (cb_editor_destroyed): fixed component life issues.
+ * src/commands.c (cmd_so_component_config): cosmetic.
+ * src/main-application.c (main):
+ * src/sheet-object-component.c (component_changed_cb): fixed component
+ life issues.
+ * src/ssconvert.c (main): set the default command context for components.
+ * src/wbc-gtk-actions.c: fixed component life issues.
+ * src/workbook-view.c: introspection warnings.
+
2012-07-20 Morten Welinder <terra gnome org>
* src/dependent.c (link_cellrange_dep, unlink_cellrange_dep):
diff --git a/component/gnumeric.c b/component/gnumeric.c
index 96164fc..cc4d1ae 100644
--- a/component/gnumeric.c
+++ b/component/gnumeric.c
@@ -24,6 +24,7 @@
*/
#include <gnumeric-config.h>
+#include <application.h>
#include <gnumeric.h>
#include <gnm-plugin.h>
#include <gnumeric-conf.h>
@@ -141,6 +142,7 @@ go_gnm_component_set_data (GOComponent *component)
}
gognm->wv = wb_view_new_from_input (input, NULL, NULL, io_context, NULL);
gognm->wb = wb_view_get_workbook (gognm->wv);
+ gnm_app_workbook_list_remove (gognm->wb);
g_object_unref (io_context);
go_gnm_component_update_data (gognm);
}
@@ -182,7 +184,8 @@ cb_gognm_save (G_GNUC_UNUSED GtkAction *a, WBCGtk *wbcg)
g_object_unref (gognm->wb);
}
gognm->wv = g_object_ref (wv);
- gognm->wb = g_object_ref (wb_view_get_workbook (wv));
+ gognm->wb = wb_view_get_workbook (wv);
+ gnm_app_workbook_list_remove (gognm->wb); /* no need to have this one in the list */
}
go_doc_set_dirty (GO_DOC (gognm->wb), FALSE);
go_gnm_component_update_data (gognm);
@@ -201,6 +204,7 @@ static GtkActionEntry const actions[] = {
static void
cb_editor_destroyed (GOGnmComponent *gognm)
{
+ g_object_unref (gognm->edited);
gognm->edited = NULL;
}
diff --git a/src/commands.c b/src/commands.c
index 27182f3..9e8a6d6 100644
--- a/src/commands.c
+++ b/src/commands.c
@@ -6993,10 +6993,8 @@ cmd_so_component_config (WorkbookControl *wbc, SheetObject *so,
me->so = so;
g_object_ref (G_OBJECT (so));
- me->new_obj = GO_COMPONENT (n_obj);
- g_object_ref (G_OBJECT (me->new_obj));
- me->old_obj = GO_COMPONENT (o_obj);
- g_object_ref (G_OBJECT (me->old_obj));
+ me->new_obj = GO_COMPONENT (g_object_ref (n_obj));
+ me->old_obj = GO_COMPONENT (g_object_ref (o_obj));
me->cmd.sheet = sheet_object_get_sheet (so);;
me->cmd.size = 10;
diff --git a/src/main-application.c b/src/main-application.c
index 642131c..bdfc44c 100644
--- a/src/main-application.c
+++ b/src/main-application.c
@@ -281,6 +281,8 @@ main (int argc, char const **argv)
return gnm_dump_func_defs (ext_refs_file, 4);
if (with_gui) {
+ go_component_set_default_command_context (cc = cmd_context_stderr_new ());
+ g_object_unref (cc);
cc = g_object_new (GNM_TYPE_IO_CONTEXT_GTK,
"show-splash", !gnumeric_no_splash,
"show-warnings", !gnumeric_no_warnings,
@@ -292,8 +294,8 @@ main (int argc, char const **argv)
/* TODO: Make this inconsistency go away */
cc = cmd_context_stderr_new ();
ioc = go_io_context_new (cc);
+ go_component_set_default_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"));
diff --git a/src/sheet-object-component.c b/src/sheet-object-component.c
index 6577540..36dda44 100644
--- a/src/sheet-object-component.c
+++ b/src/sheet-object-component.c
@@ -352,7 +352,6 @@ 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
diff --git a/src/ssconvert.c b/src/ssconvert.c
index 9113cf0..c026777 100644
--- a/src/ssconvert.c
+++ b/src/ssconvert.c
@@ -730,6 +730,7 @@ main (int argc, char const **argv)
/* FIXME: What do we want to do here? */
go_error_info_free (plugin_errs);
}
+ go_component_set_default_command_context (cc);
if (ssconvert_list_exporters)
list_them (&go_get_file_savers,
@@ -750,6 +751,7 @@ main (int argc, char const **argv)
res = 1;
}
+ go_component_set_default_command_context (NULL);
g_object_unref (cc);
gnm_shutdown ();
gnm_pre_parse_shutdown ();
diff --git a/src/wbc-gtk-actions.c b/src/wbc-gtk-actions.c
index 36216fd..9d93d43 100644
--- a/src/wbc-gtk-actions.c
+++ b/src/wbc-gtk-actions.c
@@ -1413,6 +1413,7 @@ static GNM_ACTION_DEF (cb_launch_go_component_new)
g_signal_connect (G_OBJECT (component), "changed", G_CALLBACK (component_changed_cb), wbcg);
win = go_component_edit (component);
gtk_window_set_transient_for (win, GTK_WINDOW (wbcg_toplevel (wbcg)));
+ g_object_set_data_full (G_OBJECT (win), "component", component, g_object_unref);
}
}
}
@@ -1433,8 +1434,10 @@ static GNM_ACTION_DEF (cb_launch_go_component_from_file)
GOComponent *component;
component = go_component_new_from_uri (uri);
g_free (uri);
- if (component)
+ if (component) {
wbcg_insert_object (WBC_GTK (wbcg), sheet_object_component_new (component));
+ g_object_unref (component);
+ }
}
gtk_widget_destroy (dlg);
}
diff --git a/src/workbook-view.c b/src/workbook-view.c
index bf65db2..1d46dd7 100644
--- a/src/workbook-view.c
+++ b/src/workbook-view.c
@@ -93,10 +93,10 @@ enum {
};
/**
- * wb_view_get_workbook :
+ * wb_view_get_workbook:
* @wbv : #WorkbookView
*
- * Return the #Workbook associated with @wbv
+ * Returns: (transfer none): the #Workbook associated with @wbv
**/
Workbook *
wb_view_get_workbook (WorkbookView const *wbv)
@@ -106,10 +106,10 @@ wb_view_get_workbook (WorkbookView const *wbv)
}
/**
- * wb_view_get_doc :
+ * wb_view_get_doc:
* @wbv : #WorkbookView
*
- * Return the #Workbook associated with @wbv cast to a #GODoc
+ * Returns: (transfer none): the #Workbook associated with @wbv cast to a #GODoc
**/
GODoc *
wb_view_get_doc (WorkbookView const *wbv)
@@ -1015,11 +1015,11 @@ workbook_view_new (Workbook *wb)
}
/**
- * wbv_save_to_output :
- * @wbv : #WorkbookView
- * @fs : #GOFileSaver
- * @output : #GsfOutput
- * @io_context : #GOIOContext
+ * wbv_save_to_output:
+ * @wbv: #WorkbookView
+ * @fs: #GOFileSaver
+ * @output: #GsfOutput
+ * @io_context: #GOIOContext
*
* NOTE : Temporary api until we get the new output framework.
**/
@@ -1078,10 +1078,10 @@ wb_view_save_to_uri (WorkbookView *wbv, GOFileSaver const *fs,
/**
* wb_view_save_as:
- * @wbv : Workbook View
- * @fs : GOFileSaver object
- * @uri : URI to save as.
- * @context :
+ * @wbv: Workbook View
+ * @fs: GOFileSaver object
+ * @uri: URI to save as.
+ * @context:
*
* Saves @wbv and workbook it's attached to into @uri file using
* @fs file saver. If the format sufficiently advanced make it the saver
@@ -1131,8 +1131,8 @@ wb_view_save_as (WorkbookView *wbv, GOFileSaver *fs, char const *uri,
/**
* wb_view_save:
- * @wbv : The view to save.
- * @context : The context that invoked the operation
+ * @wbv: The view to save.
+ * @context: The context that invoked the operation
*
* Saves @wbv and workbook it's attached to into file assigned to the
* workbook using workbook's file saver. If the workbook has no file
@@ -1266,11 +1266,11 @@ wb_view_new_from_input (GsfInput *input,
}
/**
- * wb_view_new_from_uri :
- * @uri : URI for file
- * @optional_fmt : Optional GOFileOpener
- * @io_context : Optional context to display errors.
- * @optional_enc : Optional encoding for GOFileOpener that understand it
+ * wb_view_new_from_uri:
+ * @uri: URI for file
+ * @optional_fmt: Optional GOFileOpener
+ * @io_context: Optional context to display errors.
+ * @optional_enc: Optional encoding for GOFileOpener that understand it
*
* Reads @uri file using given file opener @optional_fmt, or probes for a valid
* possibility if @optional_fmt is NULL. Reports problems to @io_context.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]