[empathy] stop using gtk_style_context_get_font



commit 3ce67215498ee974d39efc3b49455c9f4d9d4a01
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date:   Thu Sep 5 09:33:12 2013 +0200

    stop using gtk_style_context_get_font
    
    It's been deprecated.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=707538

 libempathy-gtk/empathy-cell-renderer-text.c |    7 +++++--
 src/empathy-chat-window.c                   |    9 ++++++---
 2 files changed, 11 insertions(+), 5 deletions(-)
---
diff --git a/libempathy-gtk/empathy-cell-renderer-text.c b/libempathy-gtk/empathy-cell-renderer-text.c
index 8b488f1..5ce735f 100644
--- a/libempathy-gtk/empathy-cell-renderer-text.c
+++ b/libempathy-gtk/empathy-cell-renderer-text.c
@@ -298,7 +298,7 @@ cell_renderer_text_update_text (EmpathyCellRendererText *cell,
                                gboolean                selected)
 {
        EmpathyCellRendererTextPriv *priv;
-       const PangoFontDescription *font_desc;
+       PangoFontDescription *font_desc;
        PangoAttrList              *attr_list;
        PangoAttribute             *attr_color = NULL, *attr_size;
        GtkStyleContext            *style;
@@ -330,8 +330,11 @@ cell_renderer_text_update_text (EmpathyCellRendererText *cell,
 
        attr_list = pango_attr_list_new ();
 
-       font_desc = gtk_style_context_get_font (style, GTK_STATE_FLAG_NORMAL);
+       gtk_style_context_get (style, GTK_STATE_FLAG_NORMAL,
+               "font", &font_desc,
+               NULL);
        font_size = pango_font_description_get_size (font_desc);
+       pango_font_description_free (font_desc);
        attr_size = pango_attr_size_new (font_size / 1.2);
        attr_size->start_index = strlen (priv->name) + 1;
        attr_size->end_index = -1;
diff --git a/src/empathy-chat-window.c b/src/empathy-chat-window.c
index 609b52c..f7c8707 100644
--- a/src/empathy-chat-window.c
+++ b/src/empathy-chat-window.c
@@ -382,15 +382,17 @@ chat_tab_style_updated_cb (GtkWidget *hbox,
   GtkWidget *button;
   int char_width, h, w;
   PangoContext *context;
-  const PangoFontDescription *font_desc;
+  PangoFontDescription *font_desc;
   PangoFontMetrics *metrics;
 
   button = g_object_get_data (G_OBJECT (user_data),
     "chat-window-tab-close-button");
   context = gtk_widget_get_pango_context (hbox);
 
-  font_desc = gtk_style_context_get_font (gtk_widget_get_style_context (hbox),
-      GTK_STATE_FLAG_NORMAL);
+  gtk_style_context_get (gtk_widget_get_style_context (hbox),
+      GTK_STATE_FLAG_NORMAL,
+      "font", &font_desc,
+      NULL);
 
   metrics = pango_context_get_metrics (context, font_desc,
     pango_context_get_language (context));
@@ -406,6 +408,7 @@ chat_tab_style_updated_cb (GtkWidget *hbox,
     12 * PANGO_PIXELS (char_width) + 2 * w, -1);
 
   gtk_widget_set_size_request (button, w, h);
+  pango_font_description_free (font_desc);
 }
 
 static GtkWidget *


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]