[gnome-control-center] universal-access: add Cursor Blinking settings to the Typing section



commit 417ffaa014dd3bedf9458c3171c3f8644ad28ce5
Author: Felipe Borges <feborges redhat com>
Date:   Mon Nov 2 16:16:53 2015 +0100

    universal-access: add Cursor Blinking settings to the Typing section
    
    https://bugzilla.gnome.org/show_bug.cgi?id=757486

 panels/universal-access/cc-ua-panel.c |   35 ++++++
 panels/universal-access/uap.ui        |  186 +++++++++++++++++++++++++++++++++
 2 files changed, 221 insertions(+), 0 deletions(-)
---
diff --git a/panels/universal-access/cc-ua-panel.c b/panels/universal-access/cc-ua-panel.c
index 278a334..71ce67b 100644
--- a/panels/universal-access/cc-ua-panel.c
+++ b/panels/universal-access/cc-ua-panel.c
@@ -48,6 +48,8 @@
 #define KEY_TEXT_SCALING_FACTOR      "text-scaling-factor"
 #define KEY_GTK_THEME                "gtk-theme"
 #define KEY_ICON_THEME               "icon-theme"
+#define KEY_CURSOR_BLINKING          "cursor-blink"
+#define KEY_CURSOR_BLINKING_TIME     "cursor-blink-time"
 
 /* application settings */
 #define APPLICATION_SETTINGS         "org.gnome.desktop.a11y.applications"
@@ -584,6 +586,16 @@ on_repeat_keys_toggled (GSettings *settings, const gchar *key, CcUaPanel *self)
 }
 
 static void
+on_cursor_blinking_toggled (GSettings *settings, const gchar *key, CcUaPanel *self)
+{
+  gboolean on;
+
+  on = g_settings_get_boolean (settings, KEY_CURSOR_BLINKING);
+
+  gtk_label_set_text (GTK_LABEL (WID ("value_row_cursor_blinking")), on ? _("On") : _("Off"));
+}
+
+static void
 update_accessx_label (GSettings *settings, const gchar *key, CcUaPanel *self)
 {
   gboolean on;
@@ -643,6 +655,29 @@ cc_ua_panel_init_keyboard (CcUaPanel *self)
                    gtk_range_get_adjustment (GTK_RANGE (WID ("repeat_keys_speed_scale"))), "value",
                    G_SETTINGS_BIND_DEFAULT);
 
+  /* Cursor Blinking */
+  g_signal_connect (priv->interface_settings, "changed",
+                    G_CALLBACK (on_cursor_blinking_toggled), self);
+
+  dialog = WID ("cursor_blinking_dialog");
+  priv->toplevels = g_slist_prepend (priv->toplevels, dialog);
+
+  g_object_set_data (G_OBJECT (WID ("row_cursor_blinking")), "dialog", dialog);
+
+  g_signal_connect (dialog, "delete-event",
+                    G_CALLBACK (gtk_widget_hide_on_delete), NULL);
+
+  sw = WID ("cursor_blinking_switch");
+  g_settings_bind (priv->interface_settings, KEY_CURSOR_BLINKING,
+                   sw, "active",
+                   G_SETTINGS_BIND_DEFAULT);
+  on_cursor_blinking_toggled (priv->interface_settings, NULL, self);
+
+  g_settings_bind (priv->interface_settings, KEY_CURSOR_BLINKING_TIME,
+                   gtk_range_get_adjustment (GTK_RANGE (WID ("cursor_blinking_scale"))), "value",
+                   G_SETTINGS_BIND_DEFAULT);
+
+
   /* accessx */
   g_signal_connect (priv->kb_settings, "changed",
                     G_CALLBACK (update_accessx_label), self);
diff --git a/panels/universal-access/uap.ui b/panels/universal-access/uap.ui
index c49eab9..d7bf232 100644
--- a/panels/universal-access/uap.ui
+++ b/panels/universal-access/uap.ui
@@ -21,6 +21,13 @@
     <property name="step_increment">1</property>
     <property name="page_increment">1</property>
   </object>
+  <object class="GtkAdjustment" id="cursor_blink_time_adjustment">
+    <property name="lower">100</property>
+    <property name="upper">2500</property>
+    <property name="value">1000</property>
+    <property name="step_increment">200</property>
+    <property name="page_increment">200</property>
+  </object>
   <!-- interface-requires gtk+ 3.0 -->
       <object class="GtkScrolledWindow" id="universal_access_panel">
         <property name="visible">True</property>
@@ -613,6 +620,52 @@
                               </object>
                             </child>
                             <child>
+                              <object class="GtkListBoxRow" id="row_cursor_blinking">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <child>
+                                  <object class="GtkBox" id="box_row_cursor_blinking">
+                                    <property name="visible">True</property>
+                                    <child>
+                                      <object class="GtkLabel" id="heading_row_cursor_blinking">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">False</property>
+                                        <property name="margin_start">20</property>
+                                        <property name="margin_end">20</property>
+                                        <property name="margin_top">6</property>
+                                        <property name="margin_bottom">6</property>
+                                        <property name="xalign">0</property>
+                                        <property name="label" translatable="yes">_Cursor Blinking</property>
+                                        <property name="use_underline">True</property>
+                                      </object>
+                                      <packing>
+                                        <property name="expand">True</property>
+                                        <property name="fill">True</property>
+                                        <property name="position">0</property>
+                                      </packing>
+                                    </child>
+                                    <child>
+                                      <object class="GtkLabel" id="value_row_cursor_blinking">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">False</property>
+                                        <property name="margin_start">20</property>
+                                        <property name="margin_end">20</property>
+                                        <property name="margin_top">6</property>
+                                        <property name="margin_bottom">6</property>
+                                        <property name="xalign">1</property>
+                                        <property name="label" translatable="yes">Off</property>
+                                      </object>
+                                      <packing>
+                                        <property name="expand">False</property>
+                                        <property name="fill">True</property>
+                                        <property name="position">1</property>
+                                      </packing>
+                                    </child>
+                                  </object>
+                                </child>
+                              </object>
+                            </child>
+                            <child>
                               <object class="GtkListBoxRow" id="row_accessx">
                                 <property name="visible">True</property>
                                 <property name="can_focus">True</property>
@@ -1439,6 +1492,139 @@
       </object>
     </child>
   </object>
+  <object class="GtkDialog" id="cursor_blinking_dialog">
+    <property name="can_focus">False</property>
+    <property name="border_width">5</property>
+    <property name="title" translatable="yes">Cursor Blinking</property>
+    <property name="resizable">False</property>
+    <property name="modal">True</property>
+    <property name="type_hint">dialog</property>
+    <property name="use_header_bar">1</property>
+    <child internal-child="headerbar">
+      <object class="GtkHeaderBar" id="cursor_blinking_headerbar">
+        <property name="visible">True</property>
+        <child>
+          <object class="GtkSwitch" id="cursor_blinking_switch">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="valign">center</property>
+          </object>
+          <packing>
+            <property name="pack_type">end</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <child internal-child="vbox">
+      <object class="GtkBox" id="cursor_blinking-vbox5">
+        <property name="can_focus">False</property>
+        <property name="orientation">vertical</property>
+        <child>
+          <object class="GtkLabel" id="cursor_blinking-description">
+            <property name="visible">True</property>
+            <property name="use_underline">True</property>
+            <property name="can_focus">False</property>
+            <property name="xalign">0</property>
+            <property name="label" translatable="yes">Cursor blinks in text fields.</property>
+            <property name="margin_start">12</property>
+            <property name="margin_end">6</property>
+            <property name="margin_top">6</property>
+            <property name="margin_bottom">12</property>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkGrid" id="cursor_blinking-grid">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="valign">start</property>
+            <property name="margin_start">12</property>
+            <property name="margin_end">6</property>
+            <property name="margin_top">6</property>
+            <property name="margin_bottom">12</property>
+            <property name="orientation">vertical</property>
+            <property name="row_spacing">18</property>
+            <property name="column_spacing">24</property>
+            <child>
+              <object class="GtkBox" id="cursor_blinking-box6">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="valign">start</property>
+                <property name="orientation">vertical</property>
+                <property name="spacing">6</property>
+                <child>
+                  <object class="GtkBox" id="cursor_blinking-box7">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="orientation">vertical</property>
+                    <child>
+                      <object class="GtkLabel" id="cursor_blinking-label">
+                        <property name="visible">True</property>
+                        <property name="use_underline">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="xalign">0</property>
+                        <property name="label" translatable="yes">Speed</property>
+                        <property name="mnemonic_widget">cursor_blinking_scale</property>
+                        <attributes>
+                          <attribute name="weight" value="bold"/>
+                        </attributes>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">1</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkHScale" id="cursor_blinking_scale">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="hexpand">True</property>
+                <property name="adjustment">cursor_blink_time_adjustment</property>
+                <property name="draw_value">False</property>
+                <property name="width-request">400</property>
+                <child internal-child="accessible">
+                  <object class="AtkObject" id="cursor_blinking_scale-atkobject">
+                    <property name="AtkObject::accessible-description" translatable="yes">Cursor blinking 
speed</property>
+                  </object>
+                </child>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="top_attach">1</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+  </object>
   <object class="GtkSizeGroup" id="repeat-keys-dialog-labels-sizegroup">
     <widgets>
       <widget name="repeat-keys-delay-label"/>


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