[gnome-control-center/wip/cdavis/date-and-time-polish: 2/5] cc-datetime-panel: Set `activatable-widget` on rows with switches




commit b88f96d2ead63aeac72927c358ea83d98c39974a
Author: Christopher Davis <christopherdavis gnome org>
Date:   Thu Dec 30 23:54:41 2021 -0800

    cc-datetime-panel: Set `activatable-widget` on rows with switches

 panels/datetime/cc-datetime-panel.c  | 19 +------------------
 panels/datetime/cc-datetime-panel.ui |  2 ++
 2 files changed, 3 insertions(+), 18 deletions(-)
---
diff --git a/panels/datetime/cc-datetime-panel.c b/panels/datetime/cc-datetime-panel.c
index bfef5f030..62c49a7c5 100644
--- a/panels/datetime/cc-datetime-panel.c
+++ b/panels/datetime/cc-datetime-panel.c
@@ -811,15 +811,6 @@ bind_switch_to_row (CcDateTimePanel *self,
                                NULL, self, NULL);
 }
 
-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
 list_box_row_activated (GtkListBox      *listbox,
                         GtkListBoxRow   *row,
@@ -828,15 +819,7 @@ list_box_row_activated (GtkListBox      *listbox,
 {
   gtk_list_box_select_row (listbox, NULL);
 
-  if (row == GTK_LIST_BOX_ROW (self->auto_datetime_row))
-    {
-      toggle_switch (self->network_time_switch);
-    }
-  else if (row == GTK_LIST_BOX_ROW (self->auto_timezone_row))
-    {
-      toggle_switch (self->auto_timezone_switch);
-    }
-  else if (row == GTK_LIST_BOX_ROW (self->datetime_button))
+  if (row == GTK_LIST_BOX_ROW (self->datetime_button))
     {
       run_dialog (self, self->datetime_dialog);
     }
diff --git a/panels/datetime/cc-datetime-panel.ui b/panels/datetime/cc-datetime-panel.ui
index 6c1f934f8..3a9f29f54 100644
--- a/panels/datetime/cc-datetime-panel.ui
+++ b/panels/datetime/cc-datetime-panel.ui
@@ -324,6 +324,7 @@
                         <property name="title" translatable="yes">Automatic _Date &amp;amp; Time</property>
                         <property name="subtitle" translatable="yes">Requires internet access</property>
                         <property name="use_underline">True</property>
+                        <property name="activatable_widget">network_time_switch</property>
                         <child>
                           <object class="GtkSwitch" id="network_time_switch">
                             <property name="valign">center</property>
@@ -358,6 +359,7 @@
                         <property name="title" translatable="yes">Automatic Time _Zone</property>
                         <property name="subtitle" translatable="yes">Requires location services enabled and 
internet access</property>
                         <property name="use_underline">True</property>
+                        <property name="activatable_widget">auto_timezone_switch</property>
                         <child>
                           <object class="GtkSwitch" id="auto_timezone_switch">
                             <property name="valign">center</property>


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