aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@ximian.com>2001-07-05 14:42:56 +0800
committerChris Lahey <clahey@src.gnome.org>2001-07-05 14:42:56 +0800
commite509ad72df82b4f8e0e516b019d1f0c06f9a8a88 (patch)
tree5d5badde9f4f5ee0cba2e51f6a91117f95da3ed7 /widgets
parent0f51f730ac4caa7259e3b6fd70374b63baa3ecc1 (diff)
downloadgsoc2013-evolution-e509ad72df82b4f8e0e516b019d1f0c06f9a8a88.tar
gsoc2013-evolution-e509ad72df82b4f8e0e516b019d1f0c06f9a8a88.tar.gz
gsoc2013-evolution-e509ad72df82b4f8e0e516b019d1f0c06f9a8a88.tar.bz2
gsoc2013-evolution-e509ad72df82b4f8e0e516b019d1f0c06f9a8a88.tar.lz
gsoc2013-evolution-e509ad72df82b4f8e0e516b019d1f0c06f9a8a88.tar.xz
gsoc2013-evolution-e509ad72df82b4f8e0e516b019d1f0c06f9a8a88.tar.zst
gsoc2013-evolution-e509ad72df82b4f8e0e516b019d1f0c06f9a8a88.zip
Handle an error in construction a little bit better here.
2001-07-05 Christopher James Lahey <clahey@ximian.com> * e-tree.c (e_tree_new, e_tree_new_from_spec_file): Handle an error in construction a little bit better here. (e_tree_get_cursor): Check for row == -1 here. svn path=/trunk/; revision=10787
Diffstat (limited to 'widgets')
-rw-r--r--widgets/table/e-tree.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/widgets/table/e-tree.c b/widgets/table/e-tree.c
index 154872e06e..e5b83b92e1 100644
--- a/widgets/table/e-tree.c
+++ b/widgets/table/e-tree.c
@@ -1097,7 +1097,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;
+ ETree *e_tree, *ret_val;
g_return_val_if_fail(etm != NULL, NULL);
g_return_val_if_fail(E_IS_TREE_MODEL(etm), NULL);
@@ -1106,15 +1106,19 @@ e_tree_new (ETreeModel *etm, ETableExtras *ete, const char *spec, const char *st
e_tree = gtk_type_new (e_tree_get_type ());
- e_tree = e_tree_construct (e_tree, etm, ete, spec, state);
+ ret_val = e_tree_construct (e_tree, etm, ete, spec, state);
+
+ if (ret_val == NULL) {
+ gtk_object_unref (GTK_OBJECT (e_tree));
+ }
- return GTK_WIDGET (e_tree);
+ return (GtkWidget *) ret_val;
}
GtkWidget *
e_tree_new_from_spec_file (ETreeModel *etm, ETableExtras *ete, const char *spec_fn, const char *state_fn)
{
- ETree *e_tree;
+ ETree *e_tree, *ret_val;
g_return_val_if_fail(etm != NULL, NULL);
g_return_val_if_fail(E_IS_TREE_MODEL(etm), NULL);
@@ -1123,9 +1127,13 @@ e_tree_new_from_spec_file (ETreeModel *etm, ETableExtras *ete, const char *spec_
e_tree = gtk_type_new (e_tree_get_type ());
- e_tree = e_tree_construct_from_spec_file (e_tree, etm, ete, spec_fn, state_fn);
+ ret_val = e_tree_construct_from_spec_file (e_tree, etm, ete, spec_fn, state_fn);
- return GTK_WIDGET (e_tree);
+ if (ret_val == NULL) {
+ gtk_object_unref (GTK_OBJECT (e_tree));
+ }
+
+ return (GtkWidget *) ret_val;
}
void
@@ -1166,6 +1174,8 @@ e_tree_get_cursor (ETree *e_tree)
gtk_object_get(GTK_OBJECT(e_tree->priv->selection),
"cursor_row", &row,
NULL);
+ if (row == -1)
+ return NULL;
path = e_tree_table_adapter_node_at_row(E_TREE_TABLE_ADAPTER(e_tree->priv->etta), row);
path = e_tree_sorted_view_to_model_path(e_tree->priv->sorted, path);
return path;