aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/e-table/e-table-header-item.c
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@helixcode.com>2000-03-08 16:31:12 +0800
committerChris Lahey <clahey@src.gnome.org>2000-03-08 16:31:12 +0800
commitc11cf5e774f9f1a2694a839a99c7ca4bc07f0b63 (patch)
treeb68c5f729edfec130032caf5140144f2b20fa7f2 /widgets/e-table/e-table-header-item.c
parent6dd08625faec99336f9a368e8277a55711d90fa2 (diff)
downloadgsoc2013-evolution-c11cf5e774f9f1a2694a839a99c7ca4bc07f0b63.tar.gz
gsoc2013-evolution-c11cf5e774f9f1a2694a839a99c7ca4bc07f0b63.tar.zst
gsoc2013-evolution-c11cf5e774f9f1a2694a839a99c7ca4bc07f0b63.zip
Changed the destroy function to disconnect from signals before unrefing
2000-03-08 Christopher James Lahey <clahey@helixcode.com> * e-table.c: Changed the destroy function to disconnect from signals before unrefing the objects the sinnals are on. Changed the destroy function to match the objects and signal ids properly in its disconnect section. * e-table-item.c, e-table-item.h: Changed this to do follow the canvas rules better. * e-table-header-item.c, e-table-header-item.h: Made ETableHeaderItem connect to the "sort_info_changed" on its ETableSortInfo instead of just manually redrawing itself. Fixed the update function a bit to follow the canvas rules a bit better. svn path=/trunk/; revision=2087
Diffstat (limited to 'widgets/e-table/e-table-header-item.c')
-rw-r--r--widgets/e-table/e-table-header-item.c42
1 files changed, 34 insertions, 8 deletions
diff --git a/widgets/e-table/e-table-header-item.c b/widgets/e-table/e-table-header-item.c
index b8fe005753..e6001d24de 100644
--- a/widgets/e-table/e-table-header-item.c
+++ b/widgets/e-table/e-table-header-item.c
@@ -75,8 +75,12 @@ ethi_destroy (GtkObject *object){
ETableHeaderItem *ethi = E_TABLE_HEADER_ITEM (object);
ethi_drop_table_header (ethi);
- if ( ethi->sort_info )
+
+ if ( ethi->sort_info ) {
+ if ( ethi->sort_info_changed_id )
+ gtk_signal_disconnect(GTK_OBJECT(ethi->sort_info), ethi->sort_info_changed_id);
gtk_object_unref(GTK_OBJECT(ethi->sort_info));
+ }
if (GTK_OBJECT_CLASS (ethi_parent_class)->destroy)
(*GTK_OBJECT_CLASS (ethi_parent_class)->destroy) (object);
@@ -90,12 +94,20 @@ ethi_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags
if (GNOME_CANVAS_ITEM_CLASS (ethi_parent_class)->update)
(*GNOME_CANVAS_ITEM_CLASS (ethi_parent_class)->update)(item, affine, clip_path, flags);
- item->x1 = ethi->x1;
- item->y1 = ethi->y1;
- item->x2 = ethi->x1 + ethi->width;
- item->y2 = ethi->y1 + ethi->height;
-
- gnome_canvas_group_child_bounds (GNOME_CANVAS_GROUP (item->parent), item);
+ if ( item->x1 != ethi->x1 ||
+ item->y1 != ethi->y1 ||
+ item->x2 != ethi->x1 + ethi->width ||
+ item->y2 != ethi->y1 + ethi->height )
+ {
+ gnome_canvas_request_redraw(item->canvas, item->x1, item->y1, item->x2, item->y2);
+ item->x1 = ethi->x1;
+ item->y1 = ethi->y1;
+ item->x2 = ethi->x1 + ethi->width;
+ item->y2 = ethi->y1 + ethi->height;
+
+ gnome_canvas_group_child_bounds (GNOME_CANVAS_GROUP (item->parent), item);
+ }
+ gnome_canvas_request_redraw(item->canvas, item->x1, item->y1, item->x2, item->y2);
}
static void
@@ -162,6 +174,12 @@ ethi_add_table_header (ETableHeaderItem *ethi, ETableHeader *header)
}
static void
+ethi_sort_info_changed (ETableSortInfo *sort_info, ETableHeaderItem *ethi)
+{
+ gnome_canvas_item_request_update (GNOME_CANVAS_ITEM(ethi));
+}
+
+static void
ethi_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
{
GnomeCanvasItem *item;
@@ -189,8 +207,15 @@ ethi_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
break;
case ARG_SORT_INFO:
+ if ( ethi->sort_info ) {
+ if ( ethi->sort_info_changed_id )
+ gtk_signal_disconnect(GTK_OBJECT(ethi->sort_info), ethi->sort_info_changed_id);
+ gtk_object_unref(GTK_OBJECT(ethi->sort_info));
+ }
ethi->sort_info = GTK_VALUE_POINTER (*arg);
gtk_object_ref(GTK_OBJECT(ethi->sort_info));
+ ethi->sort_info_changed_id = gtk_signal_connect(GTK_OBJECT(ethi->sort_info), "sort_info_changed",
+ GTK_SIGNAL_FUNC(ethi_sort_info_changed), ethi);
break;
}
@@ -934,7 +959,6 @@ ethi_event (GnomeCanvasItem *item, GdkEvent *e)
}
}
e_table_sort_info_changed(ethi->sort_info);
- ethi_request_redraw (ethi);
}
if (needs_ungrab)
gnome_canvas_item_ungrab (item, e->button.time);
@@ -1007,6 +1031,8 @@ ethi_init (GnomeCanvasItem *item)
ethi->sort_info = NULL;
+ ethi->sort_info_changed_id = 0;
+
ethi->group_indent_width = 0;
}