From 323b824b844a937593833c1704b6f2cd5335d6a5 Mon Sep 17 00:00:00 2001 From: Christopher James Lahey Date: Fri, 25 Feb 2000 05:53:54 +0000 Subject: Made the E table item redraw properly. 2000-02-25 Christopher James Lahey * e-table-item.c: Made the E table item redraw properly. * e-table-group-container.c: Added handling to distinguish between n items and 1 item. Got rid of a crash due to an abandoned timeout callback. svn path=/trunk/; revision=1933 --- widgets/e-table/ChangeLog | 8 ++++++++ widgets/e-table/e-table-group-container.c | 19 +++++++++++++------ widgets/e-table/e-table-item.c | 2 ++ widgets/table/e-table-group-container.c | 19 +++++++++++++------ widgets/table/e-table-item.c | 2 ++ 5 files changed, 38 insertions(+), 12 deletions(-) (limited to 'widgets') diff --git a/widgets/e-table/ChangeLog b/widgets/e-table/ChangeLog index 19a60a1299..0c9ee610db 100644 --- a/widgets/e-table/ChangeLog +++ b/widgets/e-table/ChangeLog @@ -1,3 +1,11 @@ +2000-02-25 Christopher James Lahey + + * e-table-item.c: Made the E table item redraw properly. + + * e-table-group-container.c: Added handling to distinguish between + n items and 1 item. Got rid of a crash due to an abandoned timeout + callback. + 2000-02-24 Christopher James Lahey * e-cell-text.c: Made carriage return stop editting instead of diff --git a/widgets/e-table/e-table-group-container.c b/widgets/e-table/e-table-group-container.c index 4b30f6af29..1ae73b6c3b 100644 --- a/widgets/e-table/e-table-group-container.c +++ b/widgets/e-table/e-table-group-container.c @@ -75,6 +75,8 @@ e_table_group_container_list_free(ETableGroupContainer *etgc) { ETableGroupContainerChildNode *child_node; GList *list; + if ( etgc->idle ) + g_source_remove( etgc->idle ); for ( list = etgc->children; list; list = g_list_next(list) ) { child_node = (ETableGroupContainerChildNode *) list->data; e_table_group_container_child_node_free(etgc, child_node); @@ -87,9 +89,16 @@ etgc_destroy (GtkObject *object) { ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER (object); - gdk_font_unref(etgc->font); - gtk_object_unref(GTK_OBJECT(etgc->ecol)); - gtk_object_destroy(GTK_OBJECT(etgc->rect)); + if ( etgc->font ) { + gdk_font_unref(etgc->font); + etgc->font = NULL; + } + if ( etgc->ecol ) { + gtk_object_unref(GTK_OBJECT(etgc->ecol)); + } + if ( etgc->rect ) { + gtk_object_destroy(GTK_OBJECT(etgc->rect)); + } e_table_group_container_list_free(etgc); GTK_OBJECT_CLASS (etgc_parent_class)->destroy (object); @@ -502,8 +511,6 @@ etgc_unrealize (GnomeCanvasItem *item) etgc = E_TABLE_GROUP_CONTAINER (item); - etgc->font = NULL; - if (GNOME_CANVAS_ITEM_CLASS(etgc_parent_class)->unrealize) (* GNOME_CANVAS_ITEM_CLASS(etgc_parent_class)->unrealize) (item); } @@ -512,7 +519,7 @@ static void compute_text (ETableGroupContainer *etgc, ETableGroupContainerChildNode *child_node) { /* FIXME : What a hack, eh? */ - gchar *text = g_strdup_printf("%s : %s (%d items)", etgc->ecol->text, (gchar *)child_node->key, (gint) child_node->count); + gchar *text = g_strdup_printf("%s : %s (%d item%s)", etgc->ecol->text, (gchar *)child_node->key, (gint) child_node->count, child_node->count == 1 ? "" : "s" ); gnome_canvas_item_set(child_node->text, "text", text, NULL); diff --git a/widgets/e-table/e-table-item.c b/widgets/e-table/e-table-item.c index a7d5573fad..222d4592cf 100644 --- a/widgets/e-table/e-table-item.c +++ b/widgets/e-table/e-table-item.c @@ -316,6 +316,8 @@ eti_table_model_changed (ETableModel *table_model, ETableItem *eti) eti_compute_height (eti); eti_update (GNOME_CANVAS_ITEM (eti), NULL, NULL, 0); + + eti_item_region_redraw (eti, 0, 0, eti->width, eti->height); } static void diff --git a/widgets/table/e-table-group-container.c b/widgets/table/e-table-group-container.c index 4b30f6af29..1ae73b6c3b 100644 --- a/widgets/table/e-table-group-container.c +++ b/widgets/table/e-table-group-container.c @@ -75,6 +75,8 @@ e_table_group_container_list_free(ETableGroupContainer *etgc) { ETableGroupContainerChildNode *child_node; GList *list; + if ( etgc->idle ) + g_source_remove( etgc->idle ); for ( list = etgc->children; list; list = g_list_next(list) ) { child_node = (ETableGroupContainerChildNode *) list->data; e_table_group_container_child_node_free(etgc, child_node); @@ -87,9 +89,16 @@ etgc_destroy (GtkObject *object) { ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER (object); - gdk_font_unref(etgc->font); - gtk_object_unref(GTK_OBJECT(etgc->ecol)); - gtk_object_destroy(GTK_OBJECT(etgc->rect)); + if ( etgc->font ) { + gdk_font_unref(etgc->font); + etgc->font = NULL; + } + if ( etgc->ecol ) { + gtk_object_unref(GTK_OBJECT(etgc->ecol)); + } + if ( etgc->rect ) { + gtk_object_destroy(GTK_OBJECT(etgc->rect)); + } e_table_group_container_list_free(etgc); GTK_OBJECT_CLASS (etgc_parent_class)->destroy (object); @@ -502,8 +511,6 @@ etgc_unrealize (GnomeCanvasItem *item) etgc = E_TABLE_GROUP_CONTAINER (item); - etgc->font = NULL; - if (GNOME_CANVAS_ITEM_CLASS(etgc_parent_class)->unrealize) (* GNOME_CANVAS_ITEM_CLASS(etgc_parent_class)->unrealize) (item); } @@ -512,7 +519,7 @@ static void compute_text (ETableGroupContainer *etgc, ETableGroupContainerChildNode *child_node) { /* FIXME : What a hack, eh? */ - gchar *text = g_strdup_printf("%s : %s (%d items)", etgc->ecol->text, (gchar *)child_node->key, (gint) child_node->count); + gchar *text = g_strdup_printf("%s : %s (%d item%s)", etgc->ecol->text, (gchar *)child_node->key, (gint) child_node->count, child_node->count == 1 ? "" : "s" ); gnome_canvas_item_set(child_node->text, "text", text, NULL); diff --git a/widgets/table/e-table-item.c b/widgets/table/e-table-item.c index a7d5573fad..222d4592cf 100644 --- a/widgets/table/e-table-item.c +++ b/widgets/table/e-table-item.c @@ -316,6 +316,8 @@ eti_table_model_changed (ETableModel *table_model, ETableItem *eti) eti_compute_height (eti); eti_update (GNOME_CANVAS_ITEM (eti), NULL, NULL, 0); + + eti_item_region_redraw (eti, 0, 0, eti->width, eti->height); } static void -- cgit v1.2.3