From bdef37bda345359b788d5940c58b2252bf13baa8 Mon Sep 17 00:00:00 2001 From: Christopher James Lahey Date: Fri, 16 Jun 2000 05:39:06 +0000 Subject: Moved the reflow signal handling into an idle handler to fix a bug when 2000-06-16 Christopher James Lahey * e-table.c, e-table.h: Moved the reflow signal handling into an idle handler to fix a bug when resizing twice in succession. svn path=/trunk/; revision=3588 --- widgets/e-table/ChangeLog | 5 +++++ widgets/e-table/e-table.c | 20 +++++++++++++++++--- widgets/e-table/e-table.h | 2 ++ widgets/table/e-table.c | 20 +++++++++++++++++--- widgets/table/e-table.h | 2 ++ 5 files changed, 43 insertions(+), 6 deletions(-) diff --git a/widgets/e-table/ChangeLog b/widgets/e-table/ChangeLog index eb06ac3203..d699ce3fa9 100644 --- a/widgets/e-table/ChangeLog +++ b/widgets/e-table/ChangeLog @@ -1,3 +1,8 @@ +2000-06-16 Christopher James Lahey + + * e-table.c, e-table.h: Moved the reflow signal handling into an + idle handler to fix a bug when resizing twice in succession. + 2000-06-15 Chris Toshok * e-cell-tree.c (ect_print): print the icon for the tree control. diff --git a/widgets/e-table/e-table.c b/widgets/e-table/e-table.c index f278ad11a5..d368b92716 100644 --- a/widgets/e-table/e-table.c +++ b/widgets/e-table/e-table.c @@ -83,6 +83,10 @@ et_destroy (GtkObject *object) gtk_signal_disconnect (GTK_OBJECT (et->sort_info), et->group_info_change_id); + if (et->reflow_idle_id) + g_source_remove(et->reflow_idle_id); + et->reflow_idle_id = 0; + gtk_object_unref (GTK_OBJECT (et->model)); gtk_object_unref (GTK_OBJECT (et->full_header)); gtk_object_unref (GTK_OBJECT (et->header)); @@ -108,6 +112,7 @@ e_table_init (GtkObject *object) e_table->sort_info = NULL; e_table->group_info_change_id = 0; + e_table->reflow_idle_id = 0; e_table->draw_grid = 1; e_table->draw_focus = 1; @@ -172,11 +177,11 @@ table_canvas_size_allocate (GtkWidget *widget, GtkAllocation *alloc, } -static void -table_canvas_reflow (GnomeCanvas *canvas, ETable *e_table) +static gboolean +table_canvas_reflow_idle (ETable *e_table) { gdouble height, width; - GtkAllocation *alloc = &(GTK_WIDGET (canvas)->allocation); + GtkAllocation *alloc = &(GTK_WIDGET (e_table->table_canvas)->allocation); gtk_object_get (GTK_OBJECT (e_table->group), "height", &height, @@ -186,6 +191,15 @@ table_canvas_reflow (GnomeCanvas *canvas, ETable *e_table) gnome_canvas_set_scroll_region ( GNOME_CANVAS (e_table->table_canvas), 0, 0, MAX((int)width, alloc->width) - 1, MAX ((int)height, alloc->height) - 1); + e_table->reflow_idle_id = 0; + return FALSE; +} + +static void +table_canvas_reflow (GnomeCanvas *canvas, ETable *e_table) +{ + if (!e_table->reflow_idle_id) + e_table->reflow_idle_id = g_idle_add_full (400, (GSourceFunc) table_canvas_reflow_idle, e_table, NULL); } static void diff --git a/widgets/e-table/e-table.h b/widgets/e-table/e-table.h index 4679af538b..a733d5951e 100644 --- a/widgets/e-table/e-table.h +++ b/widgets/e-table/e-table.h @@ -39,6 +39,8 @@ typedef struct { int group_info_change_id; + int reflow_idle_id; + GnomeCanvas *header_canvas, *table_canvas; GnomeCanvasItem *header_item, *root; diff --git a/widgets/table/e-table.c b/widgets/table/e-table.c index f278ad11a5..d368b92716 100644 --- a/widgets/table/e-table.c +++ b/widgets/table/e-table.c @@ -83,6 +83,10 @@ et_destroy (GtkObject *object) gtk_signal_disconnect (GTK_OBJECT (et->sort_info), et->group_info_change_id); + if (et->reflow_idle_id) + g_source_remove(et->reflow_idle_id); + et->reflow_idle_id = 0; + gtk_object_unref (GTK_OBJECT (et->model)); gtk_object_unref (GTK_OBJECT (et->full_header)); gtk_object_unref (GTK_OBJECT (et->header)); @@ -108,6 +112,7 @@ e_table_init (GtkObject *object) e_table->sort_info = NULL; e_table->group_info_change_id = 0; + e_table->reflow_idle_id = 0; e_table->draw_grid = 1; e_table->draw_focus = 1; @@ -172,11 +177,11 @@ table_canvas_size_allocate (GtkWidget *widget, GtkAllocation *alloc, } -static void -table_canvas_reflow (GnomeCanvas *canvas, ETable *e_table) +static gboolean +table_canvas_reflow_idle (ETable *e_table) { gdouble height, width; - GtkAllocation *alloc = &(GTK_WIDGET (canvas)->allocation); + GtkAllocation *alloc = &(GTK_WIDGET (e_table->table_canvas)->allocation); gtk_object_get (GTK_OBJECT (e_table->group), "height", &height, @@ -186,6 +191,15 @@ table_canvas_reflow (GnomeCanvas *canvas, ETable *e_table) gnome_canvas_set_scroll_region ( GNOME_CANVAS (e_table->table_canvas), 0, 0, MAX((int)width, alloc->width) - 1, MAX ((int)height, alloc->height) - 1); + e_table->reflow_idle_id = 0; + return FALSE; +} + +static void +table_canvas_reflow (GnomeCanvas *canvas, ETable *e_table) +{ + if (!e_table->reflow_idle_id) + e_table->reflow_idle_id = g_idle_add_full (400, (GSourceFunc) table_canvas_reflow_idle, e_table, NULL); } static void diff --git a/widgets/table/e-table.h b/widgets/table/e-table.h index 4679af538b..a733d5951e 100644 --- a/widgets/table/e-table.h +++ b/widgets/table/e-table.h @@ -39,6 +39,8 @@ typedef struct { int group_info_change_id; + int reflow_idle_id; + GnomeCanvas *header_canvas, *table_canvas; GnomeCanvasItem *header_item, *root; -- cgit v1.2.3