Index: src/item-bar.c =================================================================== RCS file: /cvs/gnome/gnumeric/src/item-bar.c,v retrieving revision 1.139 retrieving revision 1.142 diff -u -r1.139 -r1.142 --- src/item-bar.c 2001/08/20 21:51:35 1.139 +++ src/item-bar.c 2001/08/24 07:37:25 1.142 @@ -37,7 +37,7 @@ GnomeCanvasItem canvas_item; GnumericCanvas *gcanvas; - GdkGC *gc, *lines, *shade; /* Draw gc */ + GdkGC *text_gc, *lines, *shade; GdkCursor *normal_cursor; GdkCursor *change_cursor; StyleFont *normal_font, *bold_font; @@ -156,7 +156,8 @@ { ItemBar *ib; GdkWindow *window; - GdkGC *gc; + GtkStyle *style; + GtkWidget *button; if (GNOME_CANVAS_ITEM_CLASS (item_bar_parent_class)->realize) (*GNOME_CANVAS_ITEM_CLASS (item_bar_parent_class)->realize)(item); @@ -164,23 +165,21 @@ ib = ITEM_BAR (item); window = GTK_WIDGET (item->canvas)->window; - /* Configure our gc */ - ib->gc = gc = gdk_gc_new (window); - { - GtkWidget *w = gtk_button_new (); - GtkStyle *style; - gtk_widget_ensure_style (w); + button = gtk_button_new (); - style = gtk_widget_get_style (w); - gdk_gc_set_foreground (ib->gc, &style->text[GTK_STATE_NORMAL]); + /* Configure our gc */ + gtk_widget_ensure_style (button); + style = gtk_widget_get_style (button); - ib->shade = gdk_gc_ref (style->dark_gc[GTK_STATE_NORMAL]); - gtk_widget_destroy (w); - } + ib->text_gc = gdk_gc_new (window); + gdk_gc_set_foreground (ib->text_gc, &style->text[GTK_STATE_NORMAL]); + ib->shade = gdk_gc_new (window); + gdk_gc_set_foreground (ib->shade, &style->dark[GTK_STATE_NORMAL]); ib->lines = gdk_gc_new (window); - gdk_gc_copy (ib->lines, gc); + gdk_gc_copy (ib->lines, ib->text_gc); gdk_gc_set_line_attributes (ib->lines, 2, GDK_LINE_SOLID, GDK_CAP_NOT_LAST, GDK_JOIN_MITER); + gtk_widget_destroy (button); ib->normal_cursor = gdk_cursor_new (GDK_ARROW); if (ib->is_col_header) @@ -195,7 +194,7 @@ { ItemBar *ib = ITEM_BAR (item); - gdk_gc_unref (ib->gc); + gdk_gc_unref (ib->text_gc); gdk_gc_unref (ib->lines); gdk_gc_unref (ib->shade); gdk_cursor_destroy (ib->change_cursor); @@ -243,8 +242,8 @@ rect->x + 1, rect->y + 1, rect->width-2, rect->height-2); gtk_draw_shadow (canvas->style, drawable, GTK_STATE_NORMAL, shadow, rect->x, rect->y, rect->width, rect->height); - gdk_gc_set_clip_rectangle (ib->gc, rect); - gdk_draw_string (drawable, font, ib->gc, + gdk_gc_set_clip_rectangle (ib->text_gc, rect); + gdk_draw_string (drawable, font, ib->text_gc, rect->x + (rect->width - len) / 2, rect->y + (rect->height - texth) / 2 + font->ascent + 1, str);