[gnome-control-center] universal access: toggle child switch if parent list box row is activated



commit 0b2a0a37b972e89a3107aa1b14c39f9bc64409af
Author: Alejandro PiƱeiro <apinheiro igalia com>
Date:   Tue Sep 10 19:12:52 2013 +0200

    universal access: toggle child switch if parent list box row is activated
    
    Focusing on the main view.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=707778

 panels/universal-access/cc-ua-panel.c |   38 +++++++++++++++++++++++++++++++++
 1 files changed, 38 insertions(+), 0 deletions(-)
---
diff --git a/panels/universal-access/cc-ua-panel.c b/panels/universal-access/cc-ua-panel.c
index 7825b4f..ea46fe1 100644
--- a/panels/universal-access/cc-ua-panel.c
+++ b/panels/universal-access/cc-ua-panel.c
@@ -346,11 +346,49 @@ cc_ua_panel_init_status (CcUaPanel *self)
 }
 
 static void
+toggle_switch (GtkWidget *sw)
+{
+  gboolean active;
+
+  active = gtk_switch_get_active (GTK_SWITCH (sw));
+  gtk_switch_set_active (GTK_SWITCH (sw), !active);
+}
+
+static void
 activate_row (CcUaPanel *self, GtkListBoxRow *row)
 {
+  CcUaPanelPrivate *priv = self->priv;
   GtkWidget *dialog;
   const gchar *dialog_id;
+  const gchar *widget_name;
+
+  // Check switches to toggle
+  widget_name = gtk_buildable_get_name (GTK_BUILDABLE (row));
+  if (widget_name)
+    {
+      if (!g_strcmp0 (widget_name, "row_highcontrast"))
+        {
+          toggle_switch (WID ("value_highcontrast"));
+          return;
+        }
+      if (!g_strcmp0 (widget_name, "row_large_text"))
+        {
+          toggle_switch (WID ("value_large_text"));
+          return;
+        }
+      if (!g_strcmp0 (widget_name, "row_screen_keyboard"))
+        {
+          toggle_switch (WID ("screen_keyboard_switch"));
+          return;
+        }
+      if (!g_strcmp0 (widget_name, "row_mouse_keys"))
+        {
+          toggle_switch (WID ("mouse_keys_switch"));
+          return;
+        }
+    }
 
+  // Check dialog to open
   dialog_id = (const gchar *)g_object_get_data (G_OBJECT (row), "dialog-id");
   if (g_strcmp0 (dialog_id, "zoom") == 0)
     {


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