aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/text
diff options
context:
space:
mode:
authorIain Holmes <iain@src.gnome.org>2000-10-13 08:11:27 +0800
committerIain Holmes <iain@src.gnome.org>2000-10-13 08:11:27 +0800
commita053aa88b946563ceb08ab1e750c484de19f7c9b (patch)
tree53d477fcef07fd8c67de7237d07162ded68e3e8f /widgets/text
parent15349adfcccbe182940e5cb8cd69670a22fa784a (diff)
downloadgsoc2013-evolution-a053aa88b946563ceb08ab1e750c484de19f7c9b.tar.gz
gsoc2013-evolution-a053aa88b946563ceb08ab1e750c484de19f7c9b.tar.zst
gsoc2013-evolution-a053aa88b946563ceb08ab1e750c484de19f7c9b.zip
Fixed gdk-font refcounting
Added font_e argument to e-text Fixed the header-item drawing the pixmap incorrectly svn path=/trunk/; revision=5894
Diffstat (limited to 'widgets/text')
-rw-r--r--widgets/text/e-text.c47
1 files changed, 30 insertions, 17 deletions
diff --git a/widgets/text/e-text.c b/widgets/text/e-text.c
index 49108cb918..b487cf44db 100644
--- a/widgets/text/e-text.c
+++ b/widgets/text/e-text.c
@@ -61,6 +61,7 @@ enum {
ARG_FONT,
ARG_FONTSET,
ARG_FONT_GDK,
+ ARG_FONT_E,
ARG_ANCHOR,
ARG_JUSTIFICATION,
ARG_CLIP_WIDTH,
@@ -230,7 +231,9 @@ e_text_class_init (ETextClass *klass)
gtk_object_add_arg_type ("EText::fontset",
GTK_TYPE_STRING, GTK_ARG_WRITABLE, ARG_FONTSET);
gtk_object_add_arg_type ("EText::font_gdk",
- GTK_TYPE_GDK_FONT, GTK_ARG_READWRITE, ARG_FONT_GDK);
+ GTK_TYPE_GDK_FONT, GTK_ARG_WRITABLE, ARG_FONT_GDK);
+ gtk_object_add_arg_type ("EText::font_e",
+ GTK_TYPE_POINTER, GTK_ARG_READWRITE, ARG_FONT_E);
gtk_object_add_arg_type ("EText::anchor",
GTK_TYPE_ANCHOR_TYPE, GTK_ARG_READWRITE, ARG_ANCHOR);
gtk_object_add_arg_type ("EText::justification",
@@ -1021,7 +1024,7 @@ e_text_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
case ARG_FONT:
if (text->font)
- e_font_unref (text->font);
+ e_font_unref (text->font);
text->font = e_font_from_gdk_name (GTK_VALUE_STRING (*arg));
@@ -1044,7 +1047,7 @@ e_text_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
case ARG_FONTSET:
if (text->font)
- e_font_unref (text->font);
+ e_font_unref (text->font);
text->font = e_font_from_gdk_name (GTK_VALUE_STRING (*arg));
@@ -1066,11 +1069,13 @@ e_text_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
break;
case ARG_FONT_GDK:
+ /* Ref the font in case it was the font that is stored
+ in the e-font */
+ gdk_font_ref (GTK_VALUE_POINTER (*arg));
if (text->font)
- e_font_unref (text->font);
-
- text->font = e_font_from_gdk_font (GTK_VALUE_BOXED (*arg));
+ e_font_unref (text->font);
+ text->font = e_font_from_gdk_font (GTK_VALUE_POINTER (*arg));
#if 0
if (item->canvas->aa) {
if (text->suckfont)
@@ -1087,7 +1092,19 @@ e_text_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
text->needs_calc_line_widths = 1;
needs_reflow = 1;
break;
+ case ARG_FONT_E:
+ if (text->font)
+ e_font_unref (text->font);
+
+ text->font = GTK_VALUE_POINTER (*arg);
+ calc_ellipsis (text);
+ if (text->line_wrap)
+ text->needs_split_into_lines = 1;
+ else
+ text->needs_calc_line_widths = 1;
+ needs_reflow = 1;
+ break;
case ARG_ANCHOR:
text->anchor = GTK_VALUE_ENUM (*arg);
text->needs_recalc_bounds = 1;
@@ -1295,8 +1312,7 @@ e_text_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
GTK_VALUE_STRING (*arg) = g_strdup (text->text);
break;
- /* fixme: */
- case ARG_FONT_GDK:
+ case ARG_FONT_E:
GTK_VALUE_BOXED (*arg) = text->font;
break;
@@ -1529,7 +1545,8 @@ e_text_realize (GnomeCanvasItem *item)
text->i_cursor = gdk_cursor_new (GDK_XTERM);
text->default_cursor = gdk_cursor_new (GDK_LEFT_PTR);
if (text->font == NULL) {
- text->font = e_font_from_gdk_font (GTK_WIDGET(item->canvas)->style->font);
+ gdk_font_ref (GTK_WIDGET (item->canvas)->style->font);
+ text->font = e_font_from_gdk_font (GTK_WIDGET (item->canvas)->style->font);
}
}
@@ -2410,12 +2427,6 @@ _do_tooltip (gpointer data)
canvas = e_canvas_new ();
-
-
-
-
-
-
gtk_container_add (GTK_CONTAINER (text->tooltip_window), canvas);
/* Get the longest line length */
@@ -2436,11 +2447,13 @@ _do_tooltip (gpointer data)
"fill_color", "yellow",
NULL);
- /* fixme: */
+ /* Ref the font so that it is not destroyed
+ when the tooltip text is destroyed */
+ e_font_ref (text->font);
tooltip_text = gnome_canvas_item_new (gnome_canvas_root (GNOME_CANVAS (canvas)),
e_text_get_type (),
"anchor", GTK_ANCHOR_NW,
- "font_gdk", text->font,
+ "font_e", text->font,
"text", text->text,
"editable", FALSE,
"clip_width", text->max_lines != 1 ? text->clip_width : max_width,