1
0
Fork 0

ui: Don't use deprecated GtkStyleContext API

Update for deprecations.

https://bugzilla.gnome.org/show_bug.cgi?id=690593
This commit is contained in:
Jasper St. Pierre 2012-12-16 18:41:42 -05:00
parent 02c2cf1960
commit 4e21d5d610
3 changed files with 19 additions and 9 deletions

View file

@ -777,7 +777,7 @@ int
main (int argc, char **argv)
{
GtkStyleContext *style;
const PangoFontDescription *font_desc;
PangoFontDescription *font_desc;
GtkWidget *window;
GtkWidget *collection;
GError *err;
@ -855,7 +855,7 @@ main (int argc, char **argv)
gtk_widget_realize (window);
style = gtk_widget_get_style_context (window);
font_desc = gtk_style_context_get_font (style, 0);
gtk_style_context_get (style, GTK_STATE_FLAG_NORMAL, "font", &font_desc, NULL);
g_assert (style);
g_assert (font_desc);
@ -890,7 +890,9 @@ main (int argc, char **argv)
gtk_notebook_append_page (GTK_NOTEBOOK (notebook),
collection,
gtk_label_new (_("Benchmark")));
pango_font_description_free (font_desc);
i = 0;
while (i < (int) G_N_ELEMENTS (previews))
{
@ -928,12 +930,15 @@ static int
get_text_height (GtkWidget *widget)
{
GtkStyleContext *style;
const PangoFontDescription *font_desc;
PangoFontDescription *font_desc;
int text_height;
style = gtk_widget_get_style_context (widget);
font_desc = gtk_style_context_get_font (style, 0);
return meta_pango_font_desc_get_text_height (font_desc,
gtk_widget_get_pango_context (widget));
gtk_style_context_get (style, GTK_STATE_FLAG_NORMAL, "font", &font_desc, NULL);
text_height = meta_pango_font_desc_get_text_height (font_desc,
gtk_widget_get_pango_context (widget));
pango_font_description_free (font_desc);
return text_height;
}
static PangoLayout*

View file

@ -5841,7 +5841,7 @@ meta_gtk_widget_get_font_desc (GtkWidget *widget,
g_return_val_if_fail (gtk_widget_get_realized (widget), NULL);
style = gtk_widget_get_style_context (widget);
font_desc = pango_font_description_copy (gtk_style_context_get_font (style, 0));
gtk_style_context_get (style, GTK_STATE_FLAG_NORMAL, "font", &font_desc, NULL);
if (override)
pango_font_description_merge (font_desc, override, TRUE);

View file

@ -735,6 +735,7 @@ meta_ui_theme_get_frame_borders (MetaUI *ui,
GtkStyleContext *style = NULL;
PangoContext *context;
const PangoFontDescription *font_desc;
PangoFontDescription *free_font_desc = NULL;
if (meta_ui_have_a_theme ())
{
@ -744,7 +745,8 @@ meta_ui_theme_get_frame_borders (MetaUI *ui,
if (!font_desc)
{
style = gtk_style_context_new ();
font_desc = gtk_style_context_get_font (style, 0);
gtk_style_context_get (style, GTK_STATE_FLAG_NORMAL, "font", &free_font_desc, NULL);
font_desc = (const PangoFontDescription *) free_font_desc;
}
text_height = meta_pango_font_desc_get_text_height (font_desc, context);
@ -752,6 +754,9 @@ meta_ui_theme_get_frame_borders (MetaUI *ui,
meta_theme_get_frame_borders (meta_theme_get_current (),
type, text_height, flags,
borders);
if (free_font_desc)
pango_font_description_free (free_font_desc);
}
else
{