[gnome-control-center] universal-access: Keep "text size" items a constant size



commit dcd6fe129a18284e223edcb02983e2b7f6b4d2f6
Author: Bastien Nocera <hadess hadess net>
Date:   Fri Aug 26 19:20:05 2011 +0100

    universal-access: Keep "text size" items a constant size
    
    https://bugzilla.gnome.org/show_bug.cgi?id=657188

 panels/universal-access/cc-ua-panel.c |   21 +++++++++++++++++++++
 panels/universal-access/uap.ui        |    8 +++++++-
 2 files changed, 28 insertions(+), 1 deletions(-)
---
diff --git a/panels/universal-access/cc-ua-panel.c b/panels/universal-access/cc-ua-panel.c
index cf09443..2a0f093 100644
--- a/panels/universal-access/cc-ua-panel.c
+++ b/panels/universal-access/cc-ua-panel.c
@@ -302,6 +302,7 @@ gconf_on_off_peditor_new (CcUaPanelPrivate  *priv,
 #define ICON_THEME_KEY "icon-theme"
 #define CONTRAST_MODEL_THEME_COLUMN 2
 #define DPI_MODEL_FACTOR_COLUMN 2
+#define DPI_MODEL_FACTOR_CALC_COLUMN 3
 
 static void text_scaling_factor_combo_box_changed (GtkComboBox *box, CcUaPanel *panel);
 
@@ -327,6 +328,26 @@ text_scaling_factor_notify_cb (GSettings   *settings,
   combo = WID (priv->builder, "seeing_text_size_combobox");
   model = gtk_combo_box_get_model (GTK_COMBO_BOX (combo));
 
+  /* Recalculate the font sizes so that
+   * their size is about constant when changing text size */
+  valid = gtk_tree_model_get_iter_first (model, &iter);
+  while (valid)
+    {
+      gfloat factor;
+
+      gtk_tree_model_get (model, &iter,
+                          DPI_MODEL_FACTOR_COLUMN, &factor,
+                          -1);
+
+      factor /= conf_value;
+
+      gtk_list_store_set (GTK_LIST_STORE (model), &iter,
+                          DPI_MODEL_FACTOR_CALC_COLUMN, factor,
+                          -1);
+
+      valid = gtk_tree_model_iter_next (model, &iter);
+    }
+
   /* find the closest match in the combobox model */
   distance = 1e6;
   valid = gtk_tree_model_get_iter_first (model, &iter);
diff --git a/panels/universal-access/uap.ui b/panels/universal-access/uap.ui
index 93b83e1..903b1ad 100644
--- a/panels/universal-access/uap.ui
+++ b/panels/universal-access/uap.ui
@@ -33,27 +33,33 @@
       <column type="gchararray"/>
       <!-- column-name text_scale -->
       <column type="gfloat"/>
+      <!-- column-name calculated_text_scale -->
+      <column type="gfloat"/>
     </columns>
     <data>
       <row>
         <col id="0" translatable="yes">75%</col>
         <col id="1" translatable="yes">Small</col>
         <col id="2">0.75</col>
+        <col id="3">0.75</col>
       </row>
       <row>
         <col id="0" translatable="yes">100%</col>
         <col id="1" translatable="yes">Normal</col>
         <col id="2">1</col>
+        <col id="3">1</col>
       </row>
       <row>
         <col id="0" translatable="yes">125%</col>
         <col id="1" translatable="yes">Large</col>
         <col id="2">1.25</col>
+        <col id="3">1.25</col>
       </row>
       <row>
         <col id="0" translatable="yes">150%</col>
         <col id="1" translatable="yes">Larger</col>
         <col id="2">1.5</col>
+        <col id="3">1.5</col>
       </row>
     </data>
   </object>
@@ -279,7 +285,7 @@
                                         <child>
                                           <object class="GtkCellRendererText" id="text_size_renderer"/>
                                           <attributes>
-                                            <attribute name="scale">2</attribute>
+                                            <attribute name="scale">3</attribute>
                                             <attribute name="text">1</attribute>
                                           </attributes>
                                         </child>



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