Skip to content

Commit a3dfb66

Browse files
committed
avoid deprecated 'gtk_font_button_set/get_font_name'
1 parent a28da51 commit a3dfb66

File tree

2 files changed

+20
-23
lines changed

2 files changed

+20
-23
lines changed

‎pluma/dialogs/pluma-preferences-dialog.c‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -539,17 +539,17 @@ default_font_font_checkbutton_toggled (GtkToggleButton *button,
539539
}
540540

541541
static void
542-
editor_font_button_font_set (GtkFontButton *font_button,
542+
editor_font_button_font_set (GtkFontChooser *font_button,
543543
PlumaPreferencesDialog *dlg)
544544
{
545545
const gchar *font_name;
546546

547547
pluma_debug (DEBUG_PREFS);
548548

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

551551
/* FIXME: Can this fail? Gtk docs are a bit terse... 21-02-2004 pbor */
552-
font_name = gtk_font_button_get_font_name (font_button);
552+
font_name = gtk_font_chooser_get_font (font_button);
553553
if (!font_name)
554554
{
555555
g_warning ("Could not get font name");
@@ -594,8 +594,8 @@ setup_font_colors_page_font_section (PlumaPreferencesDialog *dlg)
594594
editor_font = pluma_prefs_manager_get_editor_font ();
595595
if (editor_font != NULL)
596596
{
597-
gtk_font_button_set_font_name (GTK_FONT_BUTTON (dlg->priv->font_button),
598-
editor_font);
597+
gtk_font_chooser_set_font (GTK_FONT_CHOOSER (dlg->priv->font_button),
598+
editor_font);
599599
g_free (editor_font);
600600
}
601601

‎pluma/pluma-print-job.c‎

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -273,9 +273,8 @@ restore_button_clicked (GtkButton *button,
273273

274274
font = pluma_prefs_manager_get_default_print_font_body ();
275275

276-
gtk_font_button_set_font_name (
277-
GTK_FONT_BUTTON (job->priv->body_fontbutton),
278-
font);
276+
gtk_font_chooser_set_font (GTK_FONT_CHOOSER (job->priv->body_fontbutton),
277+
font);
279278

280279
g_free (font);
281280
}
@@ -286,9 +285,8 @@ restore_button_clicked (GtkButton *button,
286285

287286
font = pluma_prefs_manager_get_default_print_font_header ();
288287

289-
gtk_font_button_set_font_name (
290-
GTK_FONT_BUTTON (job->priv->headers_fontbutton),
291-
font);
288+
gtk_font_chooser_set_font (GTK_FONT_CHOOSER (job->priv->headers_fontbutton),
289+
font);
292290

293291
g_free (font);
294292
}
@@ -299,9 +297,8 @@ restore_button_clicked (GtkButton *button,
299297

300298
font = pluma_prefs_manager_get_default_print_font_numbers ();
301299

302-
gtk_font_button_set_font_name (
303-
GTK_FONT_BUTTON (job->priv->numbers_fontbutton),
304-
font);
300+
gtk_font_chooser_set_font (GTK_FONT_CHOOSER (job->priv->numbers_fontbutton),
301+
font);
305302

306303
g_free (font);
307304
}
@@ -418,18 +415,18 @@ create_custom_widget_cb (GtkPrintOperation *operation,
418415

419416
/* Set initial values */
420417
font = pluma_prefs_manager_get_print_font_body ();
421-
gtk_font_button_set_font_name (GTK_FONT_BUTTON (job->priv->body_fontbutton),
422-
font);
418+
gtk_font_chooser_set_font (GTK_FONT_CHOOSER (job->priv->body_fontbutton),
419+
font);
423420
g_free (font);
424421

425422
font = pluma_prefs_manager_get_print_font_header ();
426-
gtk_font_button_set_font_name (GTK_FONT_BUTTON (job->priv->headers_fontbutton),
427-
font);
423+
gtk_font_chooser_set_font (GTK_FONT_CHOOSER (job->priv->headers_fontbutton),
424+
font);
428425
g_free (font);
429426

430427
font = pluma_prefs_manager_get_print_font_numbers ();
431-
gtk_font_button_set_font_name (GTK_FONT_BUTTON (job->priv->numbers_fontbutton),
432-
font);
428+
gtk_font_chooser_set_font (GTK_FONT_CHOOSER (job->priv->numbers_fontbutton),
429+
font);
433430
g_free (font);
434431

435432
can_set = pluma_prefs_manager_print_font_body_can_set ();
@@ -499,9 +496,9 @@ custom_widget_apply_cb (GtkPrintOperation *operation,
499496
}
500497
}
501498

502-
pluma_prefs_manager_set_print_font_body (gtk_font_button_get_font_name (GTK_FONT_BUTTON (job->priv->body_fontbutton)));
503-
pluma_prefs_manager_set_print_font_header (gtk_font_button_get_font_name (GTK_FONT_BUTTON (job->priv->headers_fontbutton)));
504-
pluma_prefs_manager_set_print_font_numbers (gtk_font_button_get_font_name (GTK_FONT_BUTTON (job->priv->numbers_fontbutton)));
499+
pluma_prefs_manager_set_print_font_body (gtk_font_chooser_get_font (GTK_FONT_CHOOSER (job->priv->body_fontbutton)));
500+
pluma_prefs_manager_set_print_font_header (gtk_font_chooser_get_font (GTK_FONT_CHOOSER (job->priv->headers_fontbutton)));
501+
pluma_prefs_manager_set_print_font_numbers (gtk_font_chooser_get_font (GTK_FONT_CHOOSER (job->priv->numbers_fontbutton)));
505502
}
506503

507504
static void

0 commit comments

Comments
 (0)