aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@ximian.com>2001-10-24 03:48:19 +0800
committerChris Lahey <clahey@src.gnome.org>2001-10-24 03:48:19 +0800
commit2def5aacb2ade53ff07a9d6b9f63438fe01e877b (patch)
tree7fff79b728b7fd7c1a149e6618999d79b8ae35d2
parent83c1664ef72b6c4a905db6f27f21c841d4328def (diff)
downloadgsoc2013-evolution-2def5aacb2ade53ff07a9d6b9f63438fe01e877b.tar.gz
gsoc2013-evolution-2def5aacb2ade53ff07a9d6b9f63438fe01e877b.tar.zst
gsoc2013-evolution-2def5aacb2ade53ff07a9d6b9f63438fe01e877b.zip
Got rid of the gc argument to e_table_header_draw_button.
2001-10-23 Christopher James Lahey <clahey@ximian.com> * e-table-field-chooser-item.c: Got rid of the gc argument to e_table_header_draw_button. (etfci_font_load): Just use the style font here. * e-table-group-container.c (e_table_group_container_construct): Changed this to just use the font from the style. Fixes Ximian bug #11882. * e-table-header-item.c: Got rid of the gc argument to e_table_header_draw_button. (ethi_font_load): Changed this to just fallback on the font from the style if the fontname is NULL or doesn't load to a font. Fixes Ximian bug #11882. * e-table-header-utils.c, e-table-header-utils.h (e_table_header_draw_button): Got rid of the gc parameter here and changed to use the gc from the style of a button created for this purpose, but not shown. Fixes Ximian bug #13251. svn path=/trunk/; revision=13949
-rw-r--r--widgets/table/e-table-field-chooser-item.c18
-rw-r--r--widgets/table/e-table-group-container.c11
-rw-r--r--widgets/table/e-table-header-item.c20
-rw-r--r--widgets/table/e-table-header-utils.c17
-rw-r--r--widgets/table/e-table-header-utils.h1
5 files changed, 40 insertions, 27 deletions
diff --git a/widgets/table/e-table-field-chooser-item.c b/widgets/table/e-table-field-chooser-item.c
index 20f3b4b0d8..e966c6be31 100644
--- a/widgets/table/e-table-field-chooser-item.c
+++ b/widgets/table/e-table-field-chooser-item.c
@@ -197,19 +197,13 @@ etfci_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flag
}
static void
-etfci_font_load (ETableFieldChooserItem *etfci, char *font)
+etfci_font_load (ETableFieldChooserItem *etfci)
{
if (etfci->font)
gdk_font_unref (etfci->font);
- etfci->font = NULL;
- if (font)
- etfci->font = gdk_fontset_load (font);
-
- if (etfci->font == NULL) {
- etfci->font = GTK_WIDGET(GNOME_CANVAS_ITEM(etfci)->canvas)->style->font;
- gdk_font_ref(etfci->font);
- }
+ etfci->font = GTK_WIDGET(GNOME_CANVAS_ITEM(etfci)->canvas)->style->font;
+ gdk_font_ref(etfci->font);
}
static void
@@ -411,7 +405,7 @@ etfci_realize (GnomeCanvasItem *item)
window = GTK_WIDGET (item->canvas)->window;
if (!etfci->font)
- etfci_font_load (etfci, NULL);
+ etfci_font_load (etfci);
etfci->drag_end_id = gtk_signal_connect (
GTK_OBJECT (item->canvas), "drag_end",
@@ -478,7 +472,7 @@ etfci_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int widt
e_table_header_draw_button (drawable, ecol,
style, etfci->font, state,
- GTK_WIDGET (canvas), style->fg_gc[GTK_STATE_NORMAL],
+ GTK_WIDGET (canvas),
-x, y1 - y,
width, height,
etfci->width, y2 - y1,
@@ -547,7 +541,7 @@ etfci_start_drag (ETableFieldChooserItem *etfci, GdkEvent *event, double x, doub
e_table_header_draw_button (pixmap, ecol,
widget->style, etfci->font, GTK_WIDGET_STATE (widget),
- widget, widget->style->fg_gc[GTK_STATE_NORMAL],
+ widget,
0, 0,
etfci->width, button_height,
etfci->width, button_height,
diff --git a/widgets/table/e-table-group-container.c b/widgets/table/e-table-group-container.c
index 0a73ae7648..d7c43da070 100644
--- a/widgets/table/e-table-group-container.c
+++ b/widgets/table/e-table-group-container.c
@@ -148,13 +148,10 @@ e_table_group_container_construct (GnomeCanvasGroup *parent, ETableGroupContaine
etgc->n = n;
etgc->ascending = column.ascending;
-
- etgc->font = gdk_font_load ("lucidasans-10");
- if (!etgc->font){
- etgc->font = GTK_WIDGET (GNOME_CANVAS_ITEM (etgc)->canvas)->style->font;
-
- gdk_font_ref (etgc->font);
- }
+ etgc->font = GTK_WIDGET (GNOME_CANVAS_ITEM (etgc)->canvas)->style->font;
+
+ gdk_font_ref (etgc->font);
+
etgc->open = TRUE;
}
diff --git a/widgets/table/e-table-header-item.c b/widgets/table/e-table-header-item.c
index cca78c3709..50bae53e37 100644
--- a/widgets/table/e-table-header-item.c
+++ b/widgets/table/e-table-header-item.c
@@ -195,6 +195,7 @@ ethi_font_set (ETableHeaderItem *ethi, GdkFont *font)
gdk_font_unref (ethi->font);
ethi->font = font;
+ gdk_font_ref (font);
ethi->height = e_table_header_item_get_height (ethi);
e_canvas_item_request_reflow(GNOME_CANVAS_ITEM(ethi));
@@ -203,13 +204,18 @@ ethi_font_set (ETableHeaderItem *ethi, GdkFont *font)
static void
ethi_font_load (ETableHeaderItem *ethi, char *fontname)
{
- GdkFont *font;
+ GdkFont *font = NULL;
- font = gdk_fontset_load (fontname);
- if (font == NULL)
- font = gdk_font_load ("-adobe-helvetica-medium-r-normal--*-120-*-*-*-*-iso8859-1");
+ if (fontname != NULL)
+ font = gdk_fontset_load (fontname);
+
+ if (font == NULL) {
+ font = GTK_WIDGET (GNOME_CANVAS_ITEM (ethi)->canvas)->style->font;
+ gdk_font_ref (font);
+ }
ethi_font_set (ethi, font);
+ gdk_font_unref (font);
}
static void
@@ -760,6 +766,8 @@ ethi_unrealize (GnomeCanvasItem *item)
{
ETableHeaderItem *ethi = E_TABLE_HEADER_ITEM (item);
+ gdk_font_unref (ethi->font);
+
gtk_signal_disconnect (GTK_OBJECT (item->canvas), ethi->drag_motion_id);
gtk_signal_disconnect (GTK_OBJECT (item->canvas), ethi->drag_leave_id);
gtk_signal_disconnect (GTK_OBJECT (item->canvas), ethi->drag_drop_id);
@@ -833,7 +841,7 @@ ethi_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int width
e_table_header_draw_button (drawable, ecol,
GTK_WIDGET (canvas)->style, ethi->font,
GTK_WIDGET_STATE (canvas),
- GTK_WIDGET (canvas), GTK_WIDGET (canvas)->style->fg_gc[GTK_STATE_NORMAL],
+ GTK_WIDGET (canvas),
x1 - x, -y,
width, height,
x2 - x1, ethi->height,
@@ -1025,7 +1033,7 @@ ethi_start_drag (ETableHeaderItem *ethi, GdkEvent *event)
pixmap, ecol,
widget->style, ethi->font,
GTK_WIDGET_STATE (widget),
- widget, widget->style->fg_gc[GTK_STATE_NORMAL],
+ widget,
0, 0,
col_width, ethi->height,
col_width, ethi->height,
diff --git a/widgets/table/e-table-header-utils.c b/widgets/table/e-table-header-utils.c
index 0933359206..3353c35d60 100644
--- a/widgets/table/e-table-header-utils.c
+++ b/widgets/table/e-table-header-utils.c
@@ -191,6 +191,8 @@ make_composite_pixmap (GdkDrawable *drawable, GdkGC *gc,
return pixmap;
}
+static GtkWidget *g_label;
+
/**
* e_table_header_draw_button:
* @drawable: Destination drawable.
@@ -213,7 +215,7 @@ make_composite_pixmap (GdkDrawable *drawable, GdkGC *gc,
void
e_table_header_draw_button (GdkDrawable *drawable, ETableCol *ecol,
GtkStyle *style, GdkFont *font, GtkStateType state,
- GtkWidget *widget, GdkGC *gc,
+ GtkWidget *widget,
int x, int y, int width, int height,
int button_width, int button_height,
ETableColArrow arrow)
@@ -221,6 +223,7 @@ e_table_header_draw_button (GdkDrawable *drawable, ETableCol *ecol,
int xthick, ythick;
int inner_x, inner_y;
int inner_width, inner_height;
+ GdkGC *gc;
g_return_if_fail (drawable != NULL);
g_return_if_fail (ecol != NULL);
@@ -231,6 +234,18 @@ e_table_header_draw_button (GdkDrawable *drawable, ETableCol *ecol,
g_return_if_fail (GTK_IS_WIDGET (widget));
g_return_if_fail (button_width > 0 && button_height > 0);
+ if (g_label == NULL) {
+ GtkWidget *button = gtk_button_new_with_label("Hi");
+ GtkWidget *window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+ g_label = GTK_BIN(button)->child;
+ gtk_container_add (GTK_CONTAINER (window), button);
+ gtk_widget_ensure_style (window);
+ gtk_widget_ensure_style (button);
+ gtk_widget_ensure_style (g_label);
+ }
+
+ gc = g_label->style->fg_gc[GTK_STATE_NORMAL];
+
xthick = style->klass->xthickness;
ythick = style->klass->ythickness;
diff --git a/widgets/table/e-table-header-utils.h b/widgets/table/e-table-header-utils.h
index 62f66e4bd3..ab135344ca 100644
--- a/widgets/table/e-table-header-utils.h
+++ b/widgets/table/e-table-header-utils.h
@@ -40,7 +40,6 @@ void e_table_header_draw_button (GdkDrawable *drawable,
GdkFont *font,
GtkStateType state,
GtkWidget *widget,
- GdkGC *gc,
int x,
int y,
int width,