Skip to content

Commit

Permalink
avoid deprecated 'gtk_font_button_set/get_font_name'
Browse files Browse the repository at this point in the history
  • Loading branch information
sc0w committed May 5, 2018
1 parent a28da51 commit a3dfb66
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 23 deletions.
10 changes: 5 additions & 5 deletions pluma/dialogs/pluma-preferences-dialog.c
Expand Up @@ -539,17 +539,17 @@ default_font_font_checkbutton_toggled (GtkToggleButton *button,
}

static void
editor_font_button_font_set (GtkFontButton *font_button,
editor_font_button_font_set (GtkFontChooser *font_button,
PlumaPreferencesDialog *dlg)
{
const gchar *font_name;

pluma_debug (DEBUG_PREFS);

g_return_if_fail (font_button == GTK_FONT_BUTTON (dlg->priv->font_button));
g_return_if_fail (font_button == GTK_FONT_CHOOSER (dlg->priv->font_button));

/* FIXME: Can this fail? Gtk docs are a bit terse... 21-02-2004 pbor */
font_name = gtk_font_button_get_font_name (font_button);
font_name = gtk_font_chooser_get_font (font_button);
if (!font_name)
{
g_warning ("Could not get font name");
Expand Down Expand Up @@ -594,8 +594,8 @@ setup_font_colors_page_font_section (PlumaPreferencesDialog *dlg)
editor_font = pluma_prefs_manager_get_editor_font ();
if (editor_font != NULL)
{
gtk_font_button_set_font_name (GTK_FONT_BUTTON (dlg->priv->font_button),
editor_font);
gtk_font_chooser_set_font (GTK_FONT_CHOOSER (dlg->priv->font_button),
editor_font);
g_free (editor_font);
}

Expand Down
33 changes: 15 additions & 18 deletions pluma/pluma-print-job.c
Expand Up @@ -273,9 +273,8 @@ restore_button_clicked (GtkButton *button,

font = pluma_prefs_manager_get_default_print_font_body ();

gtk_font_button_set_font_name (
GTK_FONT_BUTTON (job->priv->body_fontbutton),
font);
gtk_font_chooser_set_font (GTK_FONT_CHOOSER (job->priv->body_fontbutton),
font);

g_free (font);
}
Expand All @@ -286,9 +285,8 @@ restore_button_clicked (GtkButton *button,

font = pluma_prefs_manager_get_default_print_font_header ();

gtk_font_button_set_font_name (
GTK_FONT_BUTTON (job->priv->headers_fontbutton),
font);
gtk_font_chooser_set_font (GTK_FONT_CHOOSER (job->priv->headers_fontbutton),
font);

g_free (font);
}
Expand All @@ -299,9 +297,8 @@ restore_button_clicked (GtkButton *button,

font = pluma_prefs_manager_get_default_print_font_numbers ();

gtk_font_button_set_font_name (
GTK_FONT_BUTTON (job->priv->numbers_fontbutton),
font);
gtk_font_chooser_set_font (GTK_FONT_CHOOSER (job->priv->numbers_fontbutton),
font);

g_free (font);
}
Expand Down Expand Up @@ -418,18 +415,18 @@ create_custom_widget_cb (GtkPrintOperation *operation,

/* Set initial values */
font = pluma_prefs_manager_get_print_font_body ();
gtk_font_button_set_font_name (GTK_FONT_BUTTON (job->priv->body_fontbutton),
font);
gtk_font_chooser_set_font (GTK_FONT_CHOOSER (job->priv->body_fontbutton),
font);
g_free (font);

font = pluma_prefs_manager_get_print_font_header ();
gtk_font_button_set_font_name (GTK_FONT_BUTTON (job->priv->headers_fontbutton),
font);
gtk_font_chooser_set_font (GTK_FONT_CHOOSER (job->priv->headers_fontbutton),
font);
g_free (font);

font = pluma_prefs_manager_get_print_font_numbers ();
gtk_font_button_set_font_name (GTK_FONT_BUTTON (job->priv->numbers_fontbutton),
font);
gtk_font_chooser_set_font (GTK_FONT_CHOOSER (job->priv->numbers_fontbutton),
font);
g_free (font);

can_set = pluma_prefs_manager_print_font_body_can_set ();
Expand Down Expand Up @@ -499,9 +496,9 @@ custom_widget_apply_cb (GtkPrintOperation *operation,
}
}

pluma_prefs_manager_set_print_font_body (gtk_font_button_get_font_name (GTK_FONT_BUTTON (job->priv->body_fontbutton)));
pluma_prefs_manager_set_print_font_header (gtk_font_button_get_font_name (GTK_FONT_BUTTON (job->priv->headers_fontbutton)));
pluma_prefs_manager_set_print_font_numbers (gtk_font_button_get_font_name (GTK_FONT_BUTTON (job->priv->numbers_fontbutton)));
pluma_prefs_manager_set_print_font_body (gtk_font_chooser_get_font (GTK_FONT_CHOOSER (job->priv->body_fontbutton)));
pluma_prefs_manager_set_print_font_header (gtk_font_chooser_get_font (GTK_FONT_CHOOSER (job->priv->headers_fontbutton)));
pluma_prefs_manager_set_print_font_numbers (gtk_font_chooser_get_font (GTK_FONT_CHOOSER (job->priv->numbers_fontbutton)));
}

static void
Expand Down

0 comments on commit a3dfb66

Please sign in to comment.