[gnome-builder] prefs: add font button to editor preferences page



commit 61831380a8b0548bc51e67bcc55e4cb7126b263b
Author: Christian Hergert <christian hergert me>
Date:   Wed Oct 15 23:11:55 2014 -0700

    prefs: add font button to editor preferences page

 src/preferences/gb-preferences-page-editor.c   |   15 ++++++++++-----
 src/resources/ui/gb-preferences-page-editor.ui |   13 +++++++++++++
 2 files changed, 23 insertions(+), 5 deletions(-)
---
diff --git a/src/preferences/gb-preferences-page-editor.c b/src/preferences/gb-preferences-page-editor.c
index 5462084..74c9925 100644
--- a/src/preferences/gb-preferences-page-editor.c
+++ b/src/preferences/gb-preferences-page-editor.c
@@ -20,11 +20,12 @@
 
 struct _GbPreferencesPageEditorPrivate
 {
-  GSettings *settings;
+  GSettings     *settings;
 
-  GtkSwitch *restore_insert_mark_switch;
-  GtkSwitch *vim_mode_switch;
-  GtkSwitch *word_completion_switch;
+  GtkSwitch     *restore_insert_mark_switch;
+  GtkSwitch     *vim_mode_switch;
+  GtkSwitch     *word_completion_switch;
+  GtkFontButton *font_button;
 };
 
 G_DEFINE_TYPE_WITH_PRIVATE (GbPreferencesPageEditor, gb_preferences_page_editor,
@@ -50,6 +51,9 @@ gb_preferences_page_editor_constructed (GObject *object)
   g_settings_bind (priv->settings, "word-completion",
                    priv->word_completion_switch, "active",
                    G_SETTINGS_BIND_DEFAULT);
+  g_settings_bind (priv->settings, "font-name",
+                   priv->font_button, "font-name",
+                   G_SETTINGS_BIND_DEFAULT);
 
   G_OBJECT_CLASS (gb_preferences_page_editor_parent_class)->constructed (object);
 }
@@ -76,8 +80,9 @@ gb_preferences_page_editor_class_init (GbPreferencesPageEditorClass *klass)
   gtk_widget_class_set_template_from_resource (widget_class,
                                                "/org/gnome/builder/ui/gb-preferences-page-editor.ui");
 
-  gtk_widget_class_bind_template_child_private (widget_class, GbPreferencesPageEditor, vim_mode_switch);
+  gtk_widget_class_bind_template_child_private (widget_class, GbPreferencesPageEditor, font_button);
   gtk_widget_class_bind_template_child_private (widget_class, GbPreferencesPageEditor, 
restore_insert_mark_switch);
+  gtk_widget_class_bind_template_child_private (widget_class, GbPreferencesPageEditor, vim_mode_switch);
   gtk_widget_class_bind_template_child_private (widget_class, GbPreferencesPageEditor, 
word_completion_switch);
 }
 
diff --git a/src/resources/ui/gb-preferences-page-editor.ui b/src/resources/ui/gb-preferences-page-editor.ui
index b2ef973..6622a80 100644
--- a/src/resources/ui/gb-preferences-page-editor.ui
+++ b/src/resources/ui/gb-preferences-page-editor.ui
@@ -85,6 +85,19 @@
             <property name="height">1</property>
           </packing>
         </child>
+        <child>
+          <object class="GtkFontButton" id="font_button">
+            <property name="visible">True</property>
+            <property name="halign">end</property>
+            <property name="hexpand">True</property>
+          </object>
+          <packing>
+            <property name="left-attach">0</property>
+            <property name="width">2</property>
+            <property name="top-attach">3</property>
+            <property name="height">1</property>
+          </packing>
+        </child>
       </object>
     </child>
   </template>


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