[balsa] gtk_font_button_get_font_name is no more



commit 505cfdb4f14bc3bae4f3fc6691dee6f2d758c2fb
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Thu Dec 21 14:13:53 2017 -0500

    gtk_font_button_get_font_name is no more
    
    pref-manager, print-gtk: use gtk_font_chooser_get_name instead of
    gtk_font_button_get_font_name.

 src/pref-manager.c |   47 +++++++++++++++++++++++++++--------------------
 src/print-gtk.c    |    9 +++------
 2 files changed, 30 insertions(+), 26 deletions(-)
---
diff --git a/src/pref-manager.c b/src/pref-manager.c
index a90be2c..781bd62 100644
--- a/src/pref-manager.c
+++ b/src/pref-manager.c
@@ -354,21 +354,22 @@ update_view_defaults(const gchar * group, const gchar * url,
 static void
 check_font_button(GtkWidget * button, gchar ** font)
 {
-    if (GPOINTER_TO_INT
-        (g_object_get_data(G_OBJECT(button), "font-modified"))) {
-        GtkFontButton *font_button = GTK_FONT_BUTTON(button);
-        const gchar *font_name =
-            gtk_font_button_get_font_name(font_button);
+    if (GPOINTER_TO_INT(g_object_get_data(G_OBJECT(button), "font-modified"))) {
+        gchar *fontname;
+
+        fontname = gtk_font_chooser_get_font(GTK_FONT_CHOOSER(button));
 
         g_free(*font);
         if (!gtk_toggle_button_get_active
-            (GTK_TOGGLE_BUTTON(pui->use_default_font_size)))
-            *font = g_strdup(font_name);
-        else {
-            PangoFontDescription *desc =
-                pango_font_description_from_string(font_name);
-            pango_font_description_unset_fields(desc,
-                                                PANGO_FONT_MASK_SIZE);
+            (GTK_TOGGLE_BUTTON(pui->use_default_font_size))) {
+            *font = fontname;
+        } else {
+            PangoFontDescription *desc;
+
+            desc = pango_font_description_from_string(fontname);
+            g_free(fontname);
+
+            pango_font_description_unset_fields(desc, PANGO_FONT_MASK_SIZE);
             *font = pango_font_description_to_string(desc);
             pango_font_description_free(desc);
         }
@@ -1367,22 +1368,28 @@ pm_grid_attach_color_box(GtkGrid     * grid,
 static gboolean
 font_button_check_font_size(GtkWidget * button, GtkWidget * widget)
 {
-    GtkFontButton *font_button = GTK_FONT_BUTTON(button);
-    const gchar *font_name = gtk_font_button_get_font_name(font_button);
+    GtkFontChooser *chooser = GTK_FONT_CHOOSER(button);
+    gchar *fontname;
     PangoFontDescription *desc;
     gboolean retval = FALSE;
 
-    desc = pango_font_description_from_string(font_name);
+    fontname = gtk_font_chooser_get_font(chooser);
+    desc = pango_font_description_from_string(fontname);
+    g_free(fontname);
+
     if (pango_font_description_get_size(desc) <= 0) {
-        PangoContext *context = gtk_widget_get_pango_context(widget);
-        PangoFontDescription *desc2 =
-            pango_context_get_font_description(context);
-        gint size = pango_font_description_get_size(desc2);
+        PangoContext *context;
+        PangoFontDescription *desc2;
+        gint size;
         gchar *desc_string;
 
+        context = gtk_widget_get_pango_context(widget);
+        desc2 = pango_context_get_font_description(context);
+        size = pango_font_description_get_size(desc2);
+
         pango_font_description_set_size(desc, size);
         desc_string = pango_font_description_to_string(desc);
-        gtk_font_button_set_font_name(font_button, desc_string);
+        gtk_font_chooser_set_font(chooser, desc_string);
         g_free(desc_string);
         retval = TRUE;
     }
diff --git a/src/print-gtk.c b/src/print-gtk.c
index ed0a96c..373ff32 100644
--- a/src/print-gtk.c
+++ b/src/print-gtk.c
@@ -642,16 +642,13 @@ message_prefs_apply(GtkPrintOperation * operation, GtkWidget * widget,
 {
     g_free(balsa_app.print_header_font);
     balsa_app.print_header_font =
-       g_strdup(gtk_font_button_get_font_name
-                (GTK_FONT_BUTTON(print_prefs->header_font)));
+       gtk_font_chooser_get_font(GTK_FONT_CHOOSER(print_prefs->header_font));
     g_free(balsa_app.print_body_font);
     balsa_app.print_body_font =
-       g_strdup(gtk_font_button_get_font_name
-                (GTK_FONT_BUTTON(print_prefs->body_font)));
+       gtk_font_chooser_get_font(GTK_FONT_CHOOSER(print_prefs->body_font));
     g_free(balsa_app.print_footer_font);
     balsa_app.print_footer_font =
-       g_strdup(gtk_font_button_get_font_name
-                (GTK_FONT_BUTTON(print_prefs->footer_font)));
+       gtk_font_chooser_get_font(GTK_FONT_CHOOSER(print_prefs->footer_font));
     balsa_app.print_highlight_cited =
        gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
                                      (print_prefs->highlight_cited));


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