[gnome-terminal] profile: editor: Only show monospace fonts



commit 0760f28a7fc8856716097a41e1567bdcf36eef7e
Author: Christian Persch <chpe src gnome org>
Date:   Wed Dec 27 23:26:51 2017 +0100

    profile: editor: Only show monospace fonts
    
    https://bugzilla.gnome.org/show_bug.cgi?id=791969

 src/profile-editor.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/src/profile-editor.c b/src/profile-editor.c
index b52dd9c..2fa9a8e 100644
--- a/src/profile-editor.c
+++ b/src/profile-editor.c
@@ -778,6 +778,14 @@ fixup_color_chooser_button (void)
 
 #endif /* GTK+ < 3.19.8 HACK */
 
+static gboolean
+monospace_filter (const PangoFontFamily *family,
+                  const PangoFontFace   *face,
+                  gpointer data)
+{
+  return pango_font_family_is_monospace ((PangoFontFamily *) family);
+}
+
 /**
  * terminal_profile_edit:
  * @profile: a #GSettings
@@ -1086,8 +1094,10 @@ terminal_profile_edit (GSettings  *profile,
                                 (GSettingsBindGetMapping) string_to_enum,
                                 (GSettingsBindSetMapping) enum_to_string,
                                 terminal_exit_action_get_type, NULL);
+  w = (GtkWidget*) gtk_builder_get_object (builder, "font-selector");
+  gtk_font_chooser_set_filter_func (GTK_FONT_CHOOSER (w), monospace_filter, NULL, NULL);
   g_settings_bind (profile, TERMINAL_PROFILE_FONT_KEY,
-                   gtk_builder_get_object (builder, "font-selector"),
+                   w,
                    "font-name", G_SETTINGS_BIND_GET | G_SETTINGS_BIND_SET);
   g_settings_bind_with_mapping (profile,
                                 TERMINAL_PROFILE_FOREGROUND_COLOR_KEY,


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