diff options
-rw-r--r-- | addressbook/ChangeLog | 5 | ||||
-rw-r--r-- | addressbook/gui/widgets/e-addressbook-view.c | 4 | ||||
-rw-r--r-- | calendar/ChangeLog | 7 | ||||
-rw-r--r-- | calendar/gui/e-memos.c | 5 | ||||
-rw-r--r-- | calendar/gui/e-tasks.c | 4 | ||||
-rw-r--r-- | calendar/gui/gnome-cal.c | 4 | ||||
-rw-r--r-- | mail/ChangeLog | 5 | ||||
-rw-r--r-- | mail/em-folder-view.c | 4 | ||||
-rw-r--r-- | widgets/ChangeLog | 9 | ||||
-rw-r--r-- | widgets/table/e-table-specification.c | 6 | ||||
-rw-r--r-- | widgets/table/e-tree-scrolled.c | 66 | ||||
-rw-r--r-- | widgets/table/e-tree-scrolled.h | 4 | ||||
-rw-r--r-- | widgets/table/e-tree.c | 82 | ||||
-rw-r--r-- | widgets/table/e-tree.h | 4 |
14 files changed, 133 insertions, 76 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index 705156da72..cf13186b5b 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,3 +1,8 @@ +2006-08-31 Matthew Barnes <mbarnes@redhat.com> + + * gui/widgets/e-addressbook-view.c: (init_collection) + Abort if ETable specification file fails to load. + 2007-07-07 Gilles Dartiguelongue <gdartigu@svn.gnome.org> ** Fix for bug #448568 diff --git a/addressbook/gui/widgets/e-addressbook-view.c b/addressbook/gui/widgets/e-addressbook-view.c index 19d12ab455..50d3b697b8 100644 --- a/addressbook/gui/widgets/e-addressbook-view.c +++ b/addressbook/gui/widgets/e-addressbook-view.c @@ -579,7 +579,9 @@ init_collection (void) etspecfile = g_build_filename (EVOLUTION_ETSPECDIR, "e-addressbook-view.etspec", NULL); - e_table_specification_load_from_file (spec, etspecfile); + if (!e_table_specification_load_from_file (spec, etspecfile)) + g_error ("Unable to load ETable specification file " + "for address book"); g_free (etspecfile); factory = gal_view_factory_etable_new (spec); diff --git a/calendar/ChangeLog b/calendar/ChangeLog index d345d3c0a6..ed73814a53 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,10 @@ +2006-08-31 Matthew Barnes <mbarnes@redhat.com> + + * gui/e-memos.c: (e_memos_setup_view_menus) + * gui/e-tasks.c: (e_tasks_setup_view_menus) + * gui/gnome-cal.c: (gnome_calendar_setup_view_menus) + Abort if ETable specification file fails to load. + 2007-06-27 Milan Crha <mcrha@redhat.com> ** Fix for bug #234294 diff --git a/calendar/gui/e-memos.c b/calendar/gui/e-memos.c index e53a2644a0..44a4e92a03 100644 --- a/calendar/gui/e-memos.c +++ b/calendar/gui/e-memos.c @@ -1109,8 +1109,9 @@ e_memos_setup_view_menus (EMemos *memos, BonoboUIComponent *uic) filename = g_build_filename (EVOLUTION_ETSPECDIR, "e-memo-table.etspec", NULL); - e_table_specification_load_from_file (spec, - filename); + if (!e_table_specification_load_from_file (spec, filename)) + g_error ("Unable to load ETable specification file " + "for memos"); g_free (filename); factory = gal_view_factory_etable_new (spec); diff --git a/calendar/gui/e-tasks.c b/calendar/gui/e-tasks.c index 9e00738834..d610702c47 100644 --- a/calendar/gui/e-tasks.c +++ b/calendar/gui/e-tasks.c @@ -1373,7 +1373,9 @@ e_tasks_setup_view_menus (ETasks *tasks, BonoboUIComponent *uic) filename = g_build_filename (EVOLUTION_ETSPECDIR, "e-calendar-table.etspec", NULL); - e_table_specification_load_from_file (spec, filename); + if (!e_table_specification_load_from_file (spec, filename)) + g_error ("Unable to load ETable specification file " + "for tasks"); g_free (filename); factory = gal_view_factory_etable_new (spec); diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c index 864cc064fa..2d8cf85c5e 100644 --- a/calendar/gui/gnome-cal.c +++ b/calendar/gui/gnome-cal.c @@ -2386,7 +2386,9 @@ gnome_calendar_setup_view_menus (GnomeCalendar *gcal, BonoboUIComponent *uic) etspecfile = g_build_filename (EVOLUTION_ETSPECDIR, "e-cal-list-view.etspec", NULL); - e_table_specification_load_from_file (spec, etspecfile); + if (!e_table_specification_load_from_file (spec, etspecfile)) + g_error ("Unable to load ETable specification file " + "for calendar"); g_free (etspecfile); gal_factory = gal_view_factory_etable_new (spec); g_object_unref (spec); diff --git a/mail/ChangeLog b/mail/ChangeLog index 14ea420c04..84bd2414eb 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,8 @@ +2006-08-31 Matthew Barnes <mbarnes@redhat.com> + + * em-folder-view.c: (emfv_setup_view_instance) + Abort if ETable specification file fails to load. + 2007-06-22 Milan Crha <mcrha@redhat.com> ** Fix for bug #307410 diff --git a/mail/em-folder-view.c b/mail/em-folder-view.c index 56efc8c345..80bcd32245 100644 --- a/mail/em-folder-view.c +++ b/mail/em-folder-view.c @@ -541,7 +541,9 @@ emfv_setup_view_instance(EMFolderView *emfv) etspecfile = g_build_filename (EVOLUTION_ETSPECDIR, "message-list.etspec", NULL); - e_table_specification_load_from_file (spec, etspecfile); + if (!e_table_specification_load_from_file (spec, etspecfile)) + g_error ("Unable to load ETable specification file " + "for mail"); g_free (etspecfile); factory = gal_view_factory_etable_new (spec); diff --git a/widgets/ChangeLog b/widgets/ChangeLog index d8bd392bca..a6b6f50b25 100644 --- a/widgets/ChangeLog +++ b/widgets/ChangeLog @@ -1,3 +1,12 @@ +2006-08-31 Matthew Barnes <mbarnes@redhat.com> + + * table/e-table-specification.c: (e_table_specification_duplicate) + Return NULL if ETable specification string fails to load. + + * table/e-tree.c: + * table/e-tree-scrolled.c: + Improve error handling in the constructors. + 2007-06-18 Srinivasa Ragavan <sragavan@novell.com> * menus/gal-define-views-dialog.c diff --git a/widgets/table/e-table-specification.c b/widgets/table/e-table-specification.c index fb8f821335..47a146405e 100644 --- a/widgets/table/e-table-specification.c +++ b/widgets/table/e-table-specification.c @@ -425,7 +425,11 @@ e_table_specification_duplicate (ETableSpecification *spec) new_spec = e_table_specification_new (); spec_str = e_table_specification_save_to_string (spec); - e_table_specification_load_from_string (new_spec, spec_str); + if (!e_table_specification_load_from_string (new_spec, spec_str)) { + g_warning ("Unable to duplicate ETable specification"); + g_object_unref (new_spec); + new_spec = NULL; + } g_free (spec_str); return new_spec; diff --git a/widgets/table/e-tree-scrolled.c b/widgets/table/e-tree-scrolled.c index 1f1145065f..ce85ea8dbc 100644 --- a/widgets/table/e-tree-scrolled.c +++ b/widgets/table/e-tree-scrolled.c @@ -73,24 +73,26 @@ e_tree_scrolled_real_construct (ETreeScrolled *ets) gtk_widget_show(GTK_WIDGET(ets->tree)); } -ETreeScrolled *e_tree_scrolled_construct (ETreeScrolled *ets, - ETreeModel *etm, - ETableExtras *ete, - const char *spec, - const char *state) +gboolean +e_tree_scrolled_construct (ETreeScrolled *ets, + ETreeModel *etm, + ETableExtras *ete, + const char *spec, + const char *state) { - g_return_val_if_fail(ets != NULL, NULL); - g_return_val_if_fail(E_IS_TREE_SCROLLED(ets), NULL); - g_return_val_if_fail(etm != NULL, NULL); - g_return_val_if_fail(E_IS_TREE_MODEL(etm), NULL); - g_return_val_if_fail(ete == NULL || E_IS_TABLE_EXTRAS(ete), NULL); - g_return_val_if_fail(spec != NULL, NULL); + g_return_val_if_fail(ets != NULL, FALSE); + g_return_val_if_fail(E_IS_TREE_SCROLLED(ets), FALSE); + g_return_val_if_fail(etm != NULL, FALSE); + g_return_val_if_fail(E_IS_TREE_MODEL(etm), FALSE); + g_return_val_if_fail(ete == NULL || E_IS_TABLE_EXTRAS(ete), FALSE); + g_return_val_if_fail(spec != NULL, FALSE); - e_tree_construct(ets->tree, etm, ete, spec, state); + if (!e_tree_construct (ets->tree, etm, ete, spec, state)) + return FALSE; e_tree_scrolled_real_construct(ets); - return ets; + return TRUE; } GtkWidget *e_tree_scrolled_new (ETreeModel *etm, @@ -110,29 +112,34 @@ GtkWidget *e_tree_scrolled_new (ETreeModel *etm "vadjustment", NULL, NULL)); - ets = e_tree_scrolled_construct (ets, etm, ete, spec, state); + if (!e_tree_scrolled_construct (ets, etm, ete, spec, state)) { + g_object_unref (ets); + return NULL; + } return GTK_WIDGET (ets); } -ETreeScrolled *e_tree_scrolled_construct_from_spec_file (ETreeScrolled *ets, - ETreeModel *etm, - ETableExtras *ete, - const char *spec_fn, - const char *state_fn) +gboolean +e_tree_scrolled_construct_from_spec_file (ETreeScrolled *ets, + ETreeModel *etm, + ETableExtras *ete, + const char *spec_fn, + const char *state_fn) { - g_return_val_if_fail(ets != NULL, NULL); - g_return_val_if_fail(E_IS_TREE_SCROLLED(ets), NULL); - g_return_val_if_fail(etm != NULL, NULL); - g_return_val_if_fail(E_IS_TREE_MODEL(etm), NULL); - g_return_val_if_fail(ete == NULL || E_IS_TABLE_EXTRAS(ete), NULL); - g_return_val_if_fail(spec_fn != NULL, NULL); + g_return_val_if_fail(ets != NULL, FALSE); + g_return_val_if_fail(E_IS_TREE_SCROLLED(ets), FALSE); + g_return_val_if_fail(etm != NULL, FALSE); + g_return_val_if_fail(E_IS_TREE_MODEL(etm), FALSE); + g_return_val_if_fail(ete == NULL || E_IS_TABLE_EXTRAS(ete), FALSE); + g_return_val_if_fail(spec_fn != NULL, FALSE); - e_tree_construct_from_spec_file(ets->tree, etm, ete, spec_fn, state_fn); + if (!e_tree_construct_from_spec_file (ets->tree, etm, ete, spec_fn, state_fn)) + return FALSE; e_tree_scrolled_real_construct(ets); - return ets; + return TRUE; } GtkWidget *e_tree_scrolled_new_from_spec_file (ETreeModel *etm, @@ -151,7 +158,10 @@ GtkWidget *e_tree_scrolled_new_from_spec_file (ETreeModel *etm "hadjustment", NULL, "vadjustment", NULL, NULL)); - ets = e_tree_scrolled_construct_from_spec_file (ets, etm, ete, spec_fn, state_fn); + if (!e_tree_scrolled_construct_from_spec_file (ets, etm, ete, spec_fn, state_fn)) { + g_object_unref (ets); + return NULL; + } return GTK_WIDGET (ets); } diff --git a/widgets/table/e-tree-scrolled.h b/widgets/table/e-tree-scrolled.h index d7f617bffe..da85f5ac55 100644 --- a/widgets/table/e-tree-scrolled.h +++ b/widgets/table/e-tree-scrolled.h @@ -48,7 +48,7 @@ typedef struct { GType e_tree_scrolled_get_type (void); -ETreeScrolled *e_tree_scrolled_construct (ETreeScrolled *ets, +gboolean e_tree_scrolled_construct (ETreeScrolled *ets, ETreeModel *etm, ETableExtras *ete, const char *spec, @@ -58,7 +58,7 @@ GtkWidget *e_tree_scrolled_new (ETreeModel *etm, const char *spec, const char *state); -ETreeScrolled *e_tree_scrolled_construct_from_spec_file (ETreeScrolled *ets, +gboolean e_tree_scrolled_construct_from_spec_file (ETreeScrolled *ets, ETreeModel *etm, ETableExtras *ete, const char *spec_fn, diff --git a/widgets/table/e-tree.c b/widgets/table/e-tree.c index 8269b92e11..da60bc2a6a 100644 --- a/widgets/table/e-tree.c +++ b/widgets/table/e-tree.c @@ -1386,7 +1386,7 @@ et_connect_to_etta (ETree *et) } -static ETree * +static gboolean et_real_construct (ETree *e_tree, ETreeModel *etm, ETableExtras *ete, ETableSpecification *specification, ETableState *state) { @@ -1480,25 +1480,27 @@ et_real_construct (ETree *e_tree, ETreeModel *etm, ETableExtras *ete, * This is the internal implementation of e_tree_new() for use by * subclasses or language bindings. See e_tree_new() for details. * - * Return value: - * The passed in value @e_tree or %NULL if there's an error. + * Return value: %TRUE on success, %FALSE if an error occurred **/ -ETree * +gboolean e_tree_construct (ETree *e_tree, ETreeModel *etm, ETableExtras *ete, const char *spec_str, const char *state_str) { ETableSpecification *specification; ETableState *state; - g_return_val_if_fail(e_tree != NULL, NULL); - g_return_val_if_fail(E_IS_TREE(e_tree), NULL); - g_return_val_if_fail(etm != NULL, NULL); - g_return_val_if_fail(E_IS_TREE_MODEL(etm), NULL); - g_return_val_if_fail(ete == NULL || E_IS_TABLE_EXTRAS(ete), NULL); - g_return_val_if_fail(spec_str != NULL, NULL); + g_return_val_if_fail(e_tree != NULL, FALSE); + g_return_val_if_fail(E_IS_TREE(e_tree), FALSE); + g_return_val_if_fail(etm != NULL, FALSE); + g_return_val_if_fail(E_IS_TREE_MODEL(etm), FALSE); + g_return_val_if_fail(ete == NULL || E_IS_TABLE_EXTRAS(ete), FALSE); + g_return_val_if_fail(spec_str != NULL, FALSE); specification = e_table_specification_new(); - e_table_specification_load_from_string(specification, spec_str); + if (!e_table_specification_load_from_string(specification, spec_str)) { + g_object_unref (specification); + return FALSE; + } if (state_str) { state = e_table_state_new(); e_table_state_load_from_string(state, state_str); @@ -1512,12 +1514,17 @@ e_tree_construct (ETree *e_tree, ETreeModel *etm, ETableExtras *ete, g_object_ref(state); } - e_tree = et_real_construct (e_tree, etm, ete, specification, state); + if (!et_real_construct (e_tree, etm, ete, specification, state)) { + g_object_unref (specification); + g_object_unref (state); + return FALSE; + } e_tree->priv->spec = specification; - g_object_unref(state); - return e_tree; + g_object_unref (state); + + return TRUE; } /** @@ -1532,29 +1539,27 @@ e_tree_construct (ETree *e_tree, ETreeModel *etm, ETableExtras *ete, * for use by subclasses or language bindings. See * e_tree_new_from_spec_file() for details. * - * Return value: - * The passed in value @e_tree or %NULL if there's an error. + * Return value: %TRUE on success, %FALSE if an error occurred **/ -ETree * +gboolean e_tree_construct_from_spec_file (ETree *e_tree, ETreeModel *etm, ETableExtras *ete, const char *spec_fn, const char *state_fn) { ETableSpecification *specification; ETableState *state; - g_return_val_if_fail(e_tree != NULL, NULL); - g_return_val_if_fail(E_IS_TREE(e_tree), NULL); - g_return_val_if_fail(etm != NULL, NULL); - g_return_val_if_fail(E_IS_TREE_MODEL(etm), NULL); - g_return_val_if_fail(ete == NULL || E_IS_TABLE_EXTRAS(ete), NULL); - g_return_val_if_fail(spec_fn != NULL, NULL); + g_return_val_if_fail(e_tree != NULL, FALSE); + g_return_val_if_fail(E_IS_TREE(e_tree), FALSE); + g_return_val_if_fail(etm != NULL, FALSE); + g_return_val_if_fail(E_IS_TREE_MODEL(etm), FALSE); + g_return_val_if_fail(ete == NULL || E_IS_TABLE_EXTRAS(ete), FALSE); + g_return_val_if_fail(spec_fn != NULL, FALSE); specification = e_table_specification_new(); if (!e_table_specification_load_from_file(specification, spec_fn)) { g_object_unref(specification); - return NULL; + return FALSE; } - if (state_fn) { state = e_table_state_new(); if (!e_table_state_load_from_file(state, state_fn)) { @@ -1572,12 +1577,17 @@ e_tree_construct_from_spec_file (ETree *e_tree, ETreeModel *etm, ETableExtras *e g_object_ref(state); } - e_tree = et_real_construct (e_tree, etm, ete, specification, state); + if (!et_real_construct (e_tree, etm, ete, specification, state)) { + g_object_unref (specification); + g_object_unref (state); + return FALSE; + } e_tree->priv->spec = specification; + g_object_unref(state); - return e_tree; + return TRUE; } /** @@ -1604,7 +1614,7 @@ e_tree_construct_from_spec_file (ETree *e_tree, ETreeModel *etm, ETableExtras *e GtkWidget * e_tree_new (ETreeModel *etm, ETableExtras *ete, const char *spec, const char *state) { - ETree *e_tree, *ret_val; + ETree *e_tree; g_return_val_if_fail(etm != NULL, NULL); g_return_val_if_fail(E_IS_TREE_MODEL(etm), NULL); @@ -1613,13 +1623,12 @@ e_tree_new (ETreeModel *etm, ETableExtras *ete, const char *spec, const char *st e_tree = g_object_new (E_TREE_TYPE, NULL); - ret_val = e_tree_construct (e_tree, etm, ete, spec, state); - - if (ret_val == NULL) { + if (!e_tree_construct (e_tree, etm, ete, spec, state)) { g_object_unref (e_tree); + return NULL; } - return (GtkWidget *) ret_val; + return (GtkWidget *) e_tree; } /** @@ -1645,7 +1654,7 @@ e_tree_new (ETreeModel *etm, ETableExtras *ete, const char *spec, const char *st GtkWidget * e_tree_new_from_spec_file (ETreeModel *etm, ETableExtras *ete, const char *spec_fn, const char *state_fn) { - ETree *e_tree, *ret_val; + ETree *e_tree; g_return_val_if_fail(etm != NULL, NULL); g_return_val_if_fail(E_IS_TREE_MODEL(etm), NULL); @@ -1654,13 +1663,12 @@ e_tree_new_from_spec_file (ETreeModel *etm, ETableExtras *ete, const char *spec_ e_tree = g_object_new (E_TREE_TYPE, NULL); - ret_val = e_tree_construct_from_spec_file (e_tree, etm, ete, spec_fn, state_fn); - - if (ret_val == NULL) { + if (!e_tree_construct_from_spec_file (e_tree, etm, ete, spec_fn, state_fn)) { g_object_unref (e_tree); + return NULL; } - return (GtkWidget *) ret_val; + return (GtkWidget *) e_tree; } void diff --git a/widgets/table/e-tree.h b/widgets/table/e-tree.h index f244715c9a..76016ba230 100644 --- a/widgets/table/e-tree.h +++ b/widgets/table/e-tree.h @@ -138,7 +138,7 @@ typedef struct { } ETreeClass; GType e_tree_get_type (void); -ETree *e_tree_construct (ETree *e_tree, +gboolean e_tree_construct (ETree *e_tree, ETreeModel *etm, ETableExtras *ete, const char *spec, @@ -149,7 +149,7 @@ GtkWidget *e_tree_new (ETreeModel *etm, const char *state); /* Create an ETree using files. */ -ETree *e_tree_construct_from_spec_file (ETree *e_tree, +gboolean e_tree_construct_from_spec_file (ETree *e_tree, ETreeModel *etm, ETableExtras *ete, const char *spec_fn, |