diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2007-02-09 03:34:11 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@src.gnome.org> | 2007-02-09 03:34:11 +0800 |
commit | d328ab72d554fe60c892ddc8c278340c027b51dc (patch) | |
tree | f8513f9a30b036d3ff3c3c65be8d9f842ab1f81b /widgets | |
parent | 9be6776a1c431142621c5838182fd967febd880e (diff) | |
download | gsoc2013-evolution-d328ab72d554fe60c892ddc8c278340c027b51dc.tar gsoc2013-evolution-d328ab72d554fe60c892ddc8c278340c027b51dc.tar.gz gsoc2013-evolution-d328ab72d554fe60c892ddc8c278340c027b51dc.tar.bz2 gsoc2013-evolution-d328ab72d554fe60c892ddc8c278340c027b51dc.tar.lz gsoc2013-evolution-d328ab72d554fe60c892ddc8c278340c027b51dc.tar.xz gsoc2013-evolution-d328ab72d554fe60c892ddc8c278340c027b51dc.tar.zst gsoc2013-evolution-d328ab72d554fe60c892ddc8c278340c027b51dc.zip |
** Fixes bug #357216
2006-02-08 Matthew Barnes <mbarnes@redhat.com>
** Fixes bug #357216
* widgets/text/e-entry.c: Remove "font", "fontset", and "gdk_font"
properties, since they forward gets and sets to non-existant
properties in entry->item.
* widgets/table/e-table-field-chooser-item.c:
* widgets/table/e-table-field-chooser-item.h:
* widgets/table/e-table-group-container.c:
* widgets/table/e-table-group-container.h:
Replace deprecated GdkFont with PangoFontDescription.
* widgets/table/e-table-header-item.c:
* widgets/table/e-table-header-item.h:
Replace deprecated GdkFont with PangoFontDescription.
Rename "fontset" property to "font-desc", and change the property
type to a boxed PangoFontDescription.
svn path=/trunk/; revision=33185
Diffstat (limited to 'widgets')
-rw-r--r-- | widgets/ChangeLog | 8 | ||||
-rw-r--r-- | widgets/table/ChangeLog | 16 | ||||
-rw-r--r-- | widgets/table/e-table-field-chooser-item.c | 26 | ||||
-rw-r--r-- | widgets/table/e-table-field-chooser-item.h | 2 | ||||
-rw-r--r-- | widgets/table/e-table-group-container.c | 26 | ||||
-rw-r--r-- | widgets/table/e-table-group-container.h | 2 | ||||
-rw-r--r-- | widgets/table/e-table-header-item.c | 52 | ||||
-rw-r--r-- | widgets/table/e-table-header-item.h | 2 | ||||
-rw-r--r-- | widgets/text/e-entry.c | 47 |
9 files changed, 76 insertions, 105 deletions
diff --git a/widgets/ChangeLog b/widgets/ChangeLog index 0e4aad7803..5ba68eb977 100644 --- a/widgets/ChangeLog +++ b/widgets/ChangeLog @@ -1,3 +1,11 @@ +2006-02-08 Matthew Barnes <mbarnes@redhat.com> + + ** Fixes bug #357216 + + * text/e-entry.c: Remove "font", "fontset", and "gdk_font" + properties, since they forward gets and sets to non-existant + properties in entry->item. + 2006-09-27 Matthew Barnes <mbarnes@redhat.com> Fixes bug #357970 diff --git a/widgets/table/ChangeLog b/widgets/table/ChangeLog index 3a9d49da40..ed89bd823e 100644 --- a/widgets/table/ChangeLog +++ b/widgets/table/ChangeLog @@ -1,3 +1,19 @@ +2007-02-08 Matthew Barnes <mbarnes@redhat.com> + + ** Fixes bug #357216 + + * e-table-field-chooser-item.c: + * e-table-field-chooser-item.h: + * e-table-group-container.c: + * e-table-group-container.h: + Replace deprecated GdkFont with PangoFontDescription. + + * e-table-header-item.c: + * e-table-header-item.h: + Replace deprecated GdkFont with PangoFontDescription. + Rename "fontset" property to "font-desc", and change the property + type to a boxed PangoFontDescription. + 2007-01-22 Srinivasa Ragavan <sragavan@novell.com> ** GtkPrint api migration from Ebby Wiselyn. diff --git a/widgets/table/e-table-field-chooser-item.c b/widgets/table/e-table-field-chooser-item.c index 0d72dc7ad8..6742483fd6 100644 --- a/widgets/table/e-table-field-chooser-item.c +++ b/widgets/table/e-table-field-chooser-item.c @@ -84,9 +84,9 @@ etfci_dispose (GObject *object) g_object_unref (etfci->combined_header); etfci->combined_header = NULL; - if (etfci->font) - gdk_font_unref(etfci->font); - etfci->font = NULL; + if (etfci->font_desc) + pango_font_description_free (etfci->font_desc); + etfci->font_desc = NULL; if (G_OBJECT_CLASS (etfci_parent_class)->dispose) (*G_OBJECT_CLASS (etfci_parent_class)->dispose) (object); @@ -219,11 +219,13 @@ etfci_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flag static void etfci_font_load (ETableFieldChooserItem *etfci) { - if (etfci->font) - gdk_font_unref (etfci->font); + GtkStyle *style; + + if (etfci->font_desc) + pango_font_description_free (etfci->font_desc); - etfci->font = gtk_style_get_font (GTK_WIDGET(GNOME_CANVAS_ITEM(etfci)->canvas)->style); - gdk_font_ref(etfci->font); + style = GTK_WIDGET (GNOME_CANVAS_ITEM (etfci)->canvas)->style; + etfci->font_desc = pango_font_description_copy (style->font_desc); } static void @@ -419,7 +421,7 @@ etfci_realize (GnomeCanvasItem *item) if (GNOME_CANVAS_ITEM_CLASS (etfci_parent_class)-> realize) (*GNOME_CANVAS_ITEM_CLASS (etfci_parent_class)->realize)(item); - if (!etfci->font) + if (!etfci->font_desc) etfci_font_load (etfci); etfci->drag_end_id = g_signal_connect ( @@ -436,9 +438,9 @@ etfci_unrealize (GnomeCanvasItem *item) { ETableFieldChooserItem *etfci = E_TABLE_FIELD_CHOOSER_ITEM (item); - if (etfci->font) - gdk_font_unref (etfci->font); - etfci->font = NULL; + if (etfci->font_desc) + pango_font_description_free (etfci->font_desc); + etfci->font_desc = NULL; g_signal_handler_disconnect (item->canvas, etfci->drag_end_id); etfci->drag_end_id = 0; @@ -677,7 +679,7 @@ etfci_init (GnomeCanvasItem *item) etfci->height = etfci->width = 0; - etfci->font = NULL; + etfci->font_desc = NULL; etfci->full_header_structure_change_id = 0; etfci->full_header_dimension_change_id = 0; diff --git a/widgets/table/e-table-field-chooser-item.h b/widgets/table/e-table-field-chooser-item.h index e0dbbd373c..72a3219178 100644 --- a/widgets/table/e-table-field-chooser-item.h +++ b/widgets/table/e-table-field-chooser-item.h @@ -44,7 +44,7 @@ typedef struct { double height, width; - GdkFont *font; + PangoFontDescription *font_desc; /* * Ids diff --git a/widgets/table/e-table-group-container.c b/widgets/table/e-table-group-container.c index f2060db1ad..b67b76e217 100644 --- a/widgets/table/e-table-group-container.c +++ b/widgets/table/e-table-group-container.c @@ -105,9 +105,9 @@ etgc_dispose (GObject *object) if (etgc->children) e_table_group_container_list_free (etgc); - if (etgc->font) - gdk_font_unref (etgc->font); - etgc->font = NULL; + if (etgc->font_desc) + pango_font_description_free (etgc->font_desc); + etgc->font_desc = NULL; if (etgc->ecol) g_object_unref (etgc->ecol); @@ -148,6 +148,7 @@ e_table_group_container_construct (GnomeCanvasGroup *parent, ETableGroupContaine { ETableCol *col; ETableSortColumn column = e_table_sort_info_grouping_get_nth(sort_info, n); + GtkStyle *style; col = e_table_header_get_column_by_col_idx(full_header, column.column); if (col == NULL) @@ -161,9 +162,8 @@ e_table_group_container_construct (GnomeCanvasGroup *parent, ETableGroupContaine etgc->n = n; etgc->ascending = column.ascending; - etgc->font = gtk_style_get_font (GTK_WIDGET (GNOME_CANVAS_ITEM (etgc)->canvas)->style); - - gdk_font_ref (etgc->font); + style = GTK_WIDGET (GNOME_CANVAS_ITEM (etgc)->canvas)->style; + etgc->font_desc = pango_font_description_copy (style->font_desc); etgc->open = TRUE; } @@ -1006,8 +1006,18 @@ etgc_reflow (GnomeCanvasItem *item, gint flags) gdouble item_height = 0; gdouble item_width = 0; - if (etgc->font) - extra_height += etgc->font->ascent + etgc->font->descent + BUTTON_PADDING * 2; + if (etgc->font_desc) { + PangoContext *context; + PangoFontMetrics *metrics; + + context = gtk_widget_get_pango_context (GTK_WIDGET (etgc)); + metrics = pango_context_get_metrics (context, etgc->font_desc, NULL); + extra_height += + pango_font_metrics_get_ascent (metrics) + + pango_font_metrics_get_descent (metrics) + + BUTTON_PADDING * 2; + pango_font_metrics_unref (metrics); + } extra_height = MAX(extra_height, BUTTON_HEIGHT + BUTTON_PADDING * 2); diff --git a/widgets/table/e-table-group-container.h b/widgets/table/e-table-group-container.h index 6adbeab005..717a669077 100644 --- a/widgets/table/e-table-group-container.h +++ b/widgets/table/e-table-group-container.h @@ -57,7 +57,7 @@ typedef struct { */ GnomeCanvasItem *rect; - GdkFont *font; + PangoFontDescription *font_desc; gdouble width, height, minimum_width; diff --git a/widgets/table/e-table-header-item.c b/widgets/table/e-table-header-item.c index a355fba09a..a11338d6c7 100644 --- a/widgets/table/e-table-header-item.c +++ b/widgets/table/e-table-header-item.c @@ -101,7 +101,7 @@ enum { PROP_TABLE_HEADER, PROP_FULL_HEADER, PROP_DND_CODE, - PROP_TABLE_FONTSET, + PROP_TABLE_FONT_DESC, PROP_SORT_INFO, PROP_TABLE, PROP_TREE @@ -232,36 +232,18 @@ ethi_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags } static void -ethi_font_set (ETableHeaderItem *ethi, GdkFont *font) +ethi_font_set (ETableHeaderItem *ethi, PangoFontDescription *font_desc) { - if (ethi->font) - gdk_font_unref (ethi->font); + if (ethi->font_desc) + pango_font_description_free (ethi->font_desc); + + ethi->font_desc = pango_font_description_copy (font_desc); - 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)); } static void -ethi_font_load (ETableHeaderItem *ethi, const char *fontname) -{ - GdkFont *font = NULL; - - if (fontname != NULL) - font = gdk_fontset_load (fontname); - - if (font == NULL) { - font = gtk_style_get_font (GTK_WIDGET (GNOME_CANVAS_ITEM (ethi)->canvas)->style); - gdk_font_ref (font); - } - - ethi_font_set (ethi, font); - gdk_font_unref (font); -} - -static void ethi_drop_table_header (ETableHeaderItem *ethi) { GObject *header; @@ -345,8 +327,8 @@ ethi_set_property (GObject *object, ethi->dnd_code = g_strdup (g_value_get_string (value)); break; - case PROP_TABLE_FONTSET: - ethi_font_load (ethi, g_value_get_string (value)); + case PROP_TABLE_FONT_DESC: + ethi_font_set (ethi, g_value_get_boxed (value)); break; case PROP_SORT_INFO: @@ -902,8 +884,8 @@ ethi_realize (GnomeCanvasItem *item) if (GNOME_CANVAS_ITEM_CLASS (ethi_parent_class)-> realize) (*GNOME_CANVAS_ITEM_CLASS (ethi_parent_class)->realize)(item); - if (!ethi->font) - ethi_font_set (ethi, gtk_style_get_font (GTK_WIDGET (item->canvas)->style)); + if (!ethi->font_desc) + ethi_font_set (ethi, GTK_WIDGET (item->canvas)->style->font_desc); /* * Now, configure DnD @@ -937,7 +919,7 @@ ethi_unrealize (GnomeCanvasItem *item) { ETableHeaderItem *ethi = E_TABLE_HEADER_ITEM (item); - gdk_font_unref (ethi->font); + pango_font_description_free (ethi->font_desc); g_signal_handler_disconnect (item->canvas, ethi->drag_motion_id); g_signal_handler_disconnect (item->canvas, ethi->drag_leave_id); @@ -1894,12 +1876,12 @@ ethi_class_init (GObjectClass *object_class) NULL, G_PARAM_READWRITE)); - g_object_class_install_property (object_class, PROP_TABLE_FONTSET, - g_param_spec_string ("fontset", - _("Fontset"), - /*_( */"XXX blurb" /*)*/, - NULL, - G_PARAM_WRITABLE)); + g_object_class_install_property (object_class, PROP_TABLE_FONT_DESC, + g_param_spec_boxed ("font-desc", + _("Font Description"), + /*_( */"XXX blurb" /*)*/, + PANGO_TYPE_FONT_DESCRIPTION, + G_PARAM_WRITABLE)); g_object_class_install_property (object_class, PROP_FULL_HEADER, g_param_spec_object ("full_header", diff --git a/widgets/table/e-table-header-item.h b/widgets/table/e-table-header-item.h index 39bdb45276..53cbdd937a 100644 --- a/widgets/table/e-table-header-item.h +++ b/widgets/table/e-table-header-item.h @@ -47,7 +47,7 @@ typedef struct { GdkCursor *change_cursor; short height, width; - GdkFont *font; + PangoFontDescription *font_desc; /* * Used during resizing; Could be shorts diff --git a/widgets/text/e-entry.c b/widgets/text/e-entry.c index 5601440b8d..f0653a39b6 100644 --- a/widgets/text/e-entry.c +++ b/widgets/text/e-entry.c @@ -70,9 +70,6 @@ enum { PROP_MODEL, PROP_EVENT_PROCESSOR, PROP_TEXT, - PROP_FONT, - PROP_FONTSET, - PROP_FONT_GDK, PROP_ANCHOR, PROP_JUSTIFICATION, PROP_X_OFFSET, @@ -880,10 +877,6 @@ et_get_property (GObject *object, g_object_get_property (G_OBJECT (item), "text", value); break; - case PROP_FONT_GDK: - g_object_get_property (G_OBJECT (item), "font_gdk", value); - break; - case PROP_JUSTIFICATION: g_object_get_property (G_OBJECT (item), "justification", value); break; @@ -986,25 +979,6 @@ et_set_property (GObject *object, gtk_widget_queue_resize (widget); break; - case PROP_FONT: - g_object_set_property (G_OBJECT (item), "font", value); - d(g_print("%s: font: %s\n", __FUNCTION__, g_value_get_string (value))); - if (entry->priv->emulate_label_resize) - gtk_widget_queue_resize (widget); - break; - - case PROP_FONTSET: - g_object_set_property (G_OBJECT (item), "fontset", value); - if (entry->priv->emulate_label_resize) - gtk_widget_queue_resize (widget); - break; - - case PROP_FONT_GDK: - g_object_set_property (G_OBJECT (item), "font_gdk", value); - if (entry->priv->emulate_label_resize) - gtk_widget_queue_resize (widget); - break; - case PROP_JUSTIFICATION: entry->priv->justification = g_value_get_enum (value); g_object_get(item, @@ -1251,27 +1225,6 @@ e_entry_class_init (GObjectClass *object_class) NULL, G_PARAM_READWRITE)); - g_object_class_install_property (object_class, PROP_FONT, - g_param_spec_string ("font", - _( "Font" ), - _( "Font" ), - NULL, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_FONTSET, - g_param_spec_string ("fontset", - _( "Fontset" ), - _( "Fontset" ), - NULL, - G_PARAM_READWRITE)); - - g_object_class_install_property (object_class, PROP_FONT_GDK, - g_param_spec_boxed ("font_gdk", - _( "GDKFont" ), - _( "GDKFont" ), - GDK_TYPE_FONT, - G_PARAM_WRITABLE)); - g_object_class_install_property (object_class, PROP_JUSTIFICATION, g_param_spec_enum ("justification", _( "Justification" ), |