[gtk+/wip/matthiasc/font-variations: 5/13] font chooser: Move font variations to the tweaks



commit 35a233d9c95cfb4f94b9f8a0ea95263379b3411f
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu Dec 28 12:45:27 2017 -0500

    font chooser: Move font variations to the tweaks
    
    This puts everything nicely in the right place.

 gtk/gtkfontchooserwidget.c     |   10 ++++++----
 gtk/ui/gtkfontchooserwidget.ui |   17 +++++++++++++++--
 2 files changed, 21 insertions(+), 6 deletions(-)
---
diff --git a/gtk/gtkfontchooserwidget.c b/gtk/gtkfontchooserwidget.c
index cd5444f..de4156d 100644
--- a/gtk/gtkfontchooserwidget.c
+++ b/gtk/gtkfontchooserwidget.c
@@ -143,6 +143,7 @@ struct _GtkFontChooserWidgetPrivate
 
   GtkWidget *font_grid;
 
+  GtkWidget       *axis_grid;
   GtkWidget       *feature_box;
   GtkWidget       *feature_language_combo;
 
@@ -761,6 +762,7 @@ gtk_font_chooser_widget_class_init (GtkFontChooserWidgetClass *klass)
   gtk_widget_class_bind_template_child_private (widget_class, GtkFontChooserWidget, stack);
   gtk_widget_class_bind_template_child_private (widget_class, GtkFontChooserWidget, grid);
   gtk_widget_class_bind_template_child_private (widget_class, GtkFontChooserWidget, font_grid);
+  gtk_widget_class_bind_template_child_private (widget_class, GtkFontChooserWidget, axis_grid);
   gtk_widget_class_bind_template_child_private (widget_class, GtkFontChooserWidget, feature_box);
   gtk_widget_class_bind_template_child_private (widget_class, GtkFontChooserWidget, feature_language_combo);
 
@@ -2081,7 +2083,7 @@ add_axis (GtkFontChooserWidget *fontchooser,
   axis->label = gtk_label_new (name);
   gtk_widget_set_halign (axis->label, GTK_ALIGN_START);
   gtk_widget_set_valign (axis->label, GTK_ALIGN_BASELINE);
-  gtk_grid_attach (GTK_GRID (priv->font_grid), axis->label, 0, row, 1, 1);
+  gtk_grid_attach (GTK_GRID (priv->axis_grid), axis->label, 0, row, 1, 1);
   axis->adjustment = gtk_adjustment_new ((double)FixedToFloat(value),
                                          (double)FixedToFloat(ax->minimum),
                                          (double)FixedToFloat(ax->maximum),
@@ -2092,11 +2094,11 @@ add_axis (GtkFontChooserWidget *fontchooser,
   gtk_widget_set_hexpand (axis->scale, TRUE);
   gtk_widget_set_size_request (axis->scale, 100, -1);
   gtk_scale_set_draw_value (GTK_SCALE (axis->scale), FALSE);
-  gtk_grid_attach (GTK_GRID (priv->font_grid), axis->scale, 1, row, 1, 1);
+  gtk_grid_attach (GTK_GRID (priv->axis_grid), axis->scale, 1, row, 1, 1);
   axis->spin = gtk_spin_button_new (axis->adjustment, 0, 0);
   g_signal_connect (axis->spin, "output", G_CALLBACK (output_cb), fontchooser);
   gtk_widget_set_valign (axis->spin, GTK_ALIGN_BASELINE);
-  gtk_grid_attach (GTK_GRID (priv->font_grid), axis->spin, 2, row, 1, 1);
+  gtk_grid_attach (GTK_GRID (priv->axis_grid), axis->spin, 2, row, 1, 1);
 
   g_hash_table_add (priv->axes, axis);
 
@@ -2150,7 +2152,7 @@ gtk_font_chooser_widget_update_font_variations (GtkFontChooserWidget *fontchoose
         }
 
       for (i = 0; i < ft_mm_var->num_axis; i++)
-        add_axis (fontchooser, ft_face, &ft_mm_var->axis[i], coords[i], i + 4);
+        add_axis (fontchooser, ft_face, &ft_mm_var->axis[i], coords[i], i + 1);
 
       g_free (coords);
       free (ft_mm_var);
diff --git a/gtk/ui/gtkfontchooserwidget.ui b/gtk/ui/gtkfontchooserwidget.ui
index 9f1fd35..bd24e7a 100644
--- a/gtk/ui/gtkfontchooserwidget.ui
+++ b/gtk/ui/gtkfontchooserwidget.ui
@@ -247,14 +247,19 @@
                     <property name="spacing">12</property>
                     <property name="margin">12</property>
                     <child>
-                      <object class="GtkBox">
-                        <property name="spacing">6</property>
+                      <object class="GtkGrid" id="axis_grid">
+                        <property name="row-spacing">6</property>
+                        <property name="column-spacing">12</property>
                         <child>
                           <object class="GtkLabel" id="size_label2">
                             <property name="label" translatable="yes">Size</property>
                             <property name="xalign">0</property>
                             <property name="valign">baseline</property>
                           </object>
+                          <packing>
+                            <property name="left-attach">0</property>
+                            <property name="top-attach">0</property>
+                          </packing>
                         </child>
                         <child>
                           <object class="GtkScale" id="size_slider2">
@@ -265,6 +270,10 @@
                             <property name="round-digits">0</property>
                             <signal name="scroll-event" handler="resize_by_scroll_cb" swapped="no"/>
                           </object>
+                          <packing>
+                            <property name="left-attach">1</property>
+                            <property name="top-attach">0</property>
+                          </packing>
                         </child>
                         <child>
                           <object class="GtkSpinButton" id="size_spin2">
@@ -272,6 +281,10 @@
                             <property name="adjustment">spin_adjustment</property>
                             <signal name="output" handler="output_cb"/>
                           </object>
+                          <packing>
+                            <property name="left-attach">2</property>
+                            <property name="top-attach">0</property>
+                          </packing>
                         </child>
                       </object>
                     </child>


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