aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/table/e-table-header.c
diff options
context:
space:
mode:
authorMiguel de Icaza <miguel@gnu.org>1999-12-02 02:18:35 +0800
committerArturo Espinosa <unammx@src.gnome.org>1999-12-02 02:18:35 +0800
commit9c0f9f1264f8083d177a01bf01e75e8787d587ed (patch)
tree5a966e5e5a992eb4ab01c20ddf7b203db454c97d /widgets/table/e-table-header.c
parent5dd5e9ffe2ba0c27c22281ebe62f9a565d184c38 (diff)
downloadgsoc2013-evolution-9c0f9f1264f8083d177a01bf01e75e8787d587ed.tar
gsoc2013-evolution-9c0f9f1264f8083d177a01bf01e75e8787d587ed.tar.gz
gsoc2013-evolution-9c0f9f1264f8083d177a01bf01e75e8787d587ed.tar.bz2
gsoc2013-evolution-9c0f9f1264f8083d177a01bf01e75e8787d587ed.tar.lz
gsoc2013-evolution-9c0f9f1264f8083d177a01bf01e75e8787d587ed.tar.xz
gsoc2013-evolution-9c0f9f1264f8083d177a01bf01e75e8787d587ed.tar.zst
gsoc2013-evolution-9c0f9f1264f8083d177a01bf01e75e8787d587ed.zip
Removed change cursor from here.
1999-12-01 Miguel de Icaza <miguel@gnu.org> * e-table-header-item.c (ethi_unrealize): Removed change cursor from here. * e-cell-text.c (ect_draw): Memory leak fix. * table-test.c (main): Enhance the demo to load sample.table automatically, to get memprof working. * e-table-header.c (eth_do_remove): Take an argument: do -remove. * e-table-header.c (e_table_header_add_column): Sink ETableCol to own the object. * e-table-col.h: Made ETableCol a GtkObject to make reference counting the lifecycle method for these objects. * e-table-col.c (e_table_col_destroy): New API call. * e-table-subset.c (e_table_subset_get_toplevel): New API call. svn path=/trunk/; revision=1450
Diffstat (limited to 'widgets/table/e-table-header.c')
-rw-r--r--widgets/table/e-table-header.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/widgets/table/e-table-header.c b/widgets/table/e-table-header.c
index 5900c5ca4f..e91113bbb9 100644
--- a/widgets/table/e-table-header.c
+++ b/widgets/table/e-table-header.c
@@ -31,8 +31,9 @@ e_table_header_destroy (GtkObject *object)
/*
* Destroy columns
*/
- for (i = 0; i < cols; i++)
+ for (i = 0; i < cols; i++){
e_table_header_remove (eth, i);
+ }
if (e_table_header_parent_class->destroy)
e_table_header_parent_class->destroy (object);
@@ -124,11 +125,19 @@ e_table_header_add_column (ETableHeader *eth, ETableCol *tc, int pos)
g_return_if_fail (eth != NULL);
g_return_if_fail (E_IS_TABLE_HEADER (eth));
g_return_if_fail (tc != NULL);
+ g_return_if_fail (E_IS_TABLE_COL (tc));
g_return_if_fail (pos >= 0 && pos <= eth->col_count);
if (pos == -1)
pos = eth->col_count;
eth->columns = g_realloc (eth->columns, sizeof (ETableCol *) * (eth->col_count + 1));
+
+ /*
+ * We are the primary owners of the column
+ */
+ gtk_object_ref (GTK_OBJECT (tc));
+ gtk_object_sink (GTK_OBJECT (tc));
+
eth_do_insert (eth, pos, tc);
eth->col_count++;
eth_update_offsets (eth);
@@ -255,8 +264,11 @@ e_table_header_total_width (ETableHeader *eth)
}
static void
-eth_do_remove (ETableHeader *eth, int idx)
+eth_do_remove (ETableHeader *eth, int idx, gboolean do_unref)
{
+ if (do_unref)
+ gtk_object_unref (GTK_OBJECT (eth->columns [idx]));
+
memcpy (&eth->columns [idx], &eth->columns [idx+1],
sizeof (ETableCol *) * eth->col_count - idx);
eth->col_count--;
@@ -275,7 +287,7 @@ e_table_header_move (ETableHeader *eth, int source_index, int target_index)
g_return_if_fail (target_index < eth->col_count);
old = eth->columns [source_index];
- eth_do_remove (eth, source_index);
+ eth_do_remove (eth, source_index, FALSE);
eth_do_insert (eth, target_index, old);
eth_update_offsets (eth);
@@ -290,7 +302,7 @@ e_table_header_remove (ETableHeader *eth, int idx)
g_return_if_fail (idx >= 0);
g_return_if_fail (idx < eth->col_count);
- eth_do_remove (eth, idx);
+ eth_do_remove (eth, idx, TRUE);
gtk_signal_emit (GTK_OBJECT (eth), eth_signals [STRUCTURE_CHANGE]);
}