[gtk+] inspector: Add a font button to the visual tab
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] inspector: Add a font button to the visual tab
- Date: Sat, 19 Jul 2014 23:17:26 +0000 (UTC)
commit 70e898bc90d52326578707cf0d9e1f01b65f7729
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Jul 19 19:15:58 2014 -0400
inspector: Add a font button to the visual tab
The font was already settable via the gtk-font-name property
of the settings object, but this this much more convenient.
gtk/inspector/visual.c | 11 +++++++++++
gtk/inspector/visual.ui | 43 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 54 insertions(+), 0 deletions(-)
---
diff --git a/gtk/inspector/visual.c b/gtk/inspector/visual.c
index 9af4853..0fb6a80 100644
--- a/gtk/inspector/visual.c
+++ b/gtk/inspector/visual.c
@@ -40,6 +40,7 @@ struct _GtkInspectorVisualPrivate
GtkWidget *dark_switch;
GtkWidget *icon_combo;
GtkWidget *direction_combo;
+ GtkWidget *font_button;
GtkWidget *hidpi_spin;
GtkAdjustment *scale_adjustment;
@@ -338,6 +339,14 @@ icons_changed (GtkComboBox *c,
g_free (theme);
}
+static void
+init_font (GtkInspectorVisual *vis)
+{
+ g_object_bind_property (gtk_settings_get_default (), "gtk-font-name",
+ vis->priv->font_button, "font-name",
+ G_BINDING_BIDIRECTIONAL|G_BINDING_SYNC_CREATE);
+}
+
#if defined (GDK_WINDOWING_X11) && defined (HAVE_CAIRO_SURFACE_SET_DEVICE_SCALE)
static void
scale_changed (GtkAdjustment *adjustment, GtkInspectorVisual *vis)
@@ -457,6 +466,7 @@ gtk_inspector_visual_init (GtkInspectorVisual *vis)
init_theme (vis);
init_dark (vis);
init_icons (vis);
+ init_font (vis);
init_scale (vis);
init_touchscreen (vis);
}
@@ -497,6 +507,7 @@ gtk_inspector_visual_class_init (GtkInspectorVisualClass *klass)
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, touchscreen_switch);
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, visual_box);
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, debug_box);
+ gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, font_button);
gtk_widget_class_bind_template_callback (widget_class, updates_activate);
gtk_widget_class_bind_template_callback (widget_class, direction_changed);
diff --git a/gtk/inspector/visual.ui b/gtk/inspector/visual.ui
index 3305223..c1228a4 100644
--- a/gtk/inspector/visual.ui
+++ b/gtk/inspector/visual.ui
@@ -138,6 +138,39 @@
<property name="margin">10</property>
<property name="spacing">40</property>
<child>
+ <object class="GtkLabel" id="font_label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Font</property>
+ <property name="halign">start</property>
+ <property name="valign">baseline</property>
+ <property name="xalign">0.0</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkFontButton" id="font_button">
+ <property name="visible">True</property>
+ <property name="halign">end</property>
+ <property name="valign">baseline</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkListBoxRow">
+ <property name="visible">True</property>
+ <property name="activatable">False</property>
+ <child>
+ <object class="GtkBox">
+ <property name="visible">True</property>
+ <property name="orientation">horizontal</property>
+ <property name="margin">10</property>
+ <property name="spacing">40</property>
+ <child>
<object class="GtkLabel" id="direction_label">
<property name="visible">True</property>
<property name="label" translatable="yes">Text Direction</property>
@@ -360,6 +393,7 @@
<widget name="theme_label"/>
<widget name="dark_label"/>
<widget name="icon_label"/>
+ <widget name="font_label"/>
<widget name="direction_label"/>
<widget name="hidpi_label"/>
<widget name="updates_label"/>
@@ -371,6 +405,15 @@
<object class="GtkSizeGroup">
<property name="mode">horizontal</property>
<widgets>
+ <widget name="theme_combo"/>
+ <widget name="icon_combo"/>
+ <widget name="font_button"/>
+ <widget name="direction_combo"/>
+ </widgets>
+ </object>
+ <object class="GtkSizeGroup">
+ <property name="mode">horizontal</property>
+ <widgets>
<widget name="visual_frame"/>
<widget name="debug_frame"/>
</widgets>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]