[gnome-control-center/wip/every-detail-matters-round1: 9/19] display: Rework Night Light page



commit 28b0acb24ee4dbd104fea7b818de72673833622b
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Tue Jun 11 10:55:30 2019 -0300

    display: Rework Night Light page
    
    The new Night Light page, as described by the latest mockups [1],
    uses a listbox to display the options. Also, there is a small
    revamp on how the disabled state is handled; it now is a switch
    in a row, instead of an extra radio button.
    
    This commit changes the Night Light page to have a listbox, and
    uses libhandy's rows to achieve the desired interface.
    
    Fixes https://gitlab.gnome.org/GNOME/gnome-control-center/issues/533

 panels/display/cc-night-light-page.c  | 127 +++----
 panels/display/cc-night-light-page.ui | 637 ++++++++++++++++------------------
 panels/display/night-light.css        |   3 +-
 3 files changed, 358 insertions(+), 409 deletions(-)
---
diff --git a/panels/display/cc-night-light-page.c b/panels/display/cc-night-light-page.c
index 7b4d212ea..8fb276646 100644
--- a/panels/display/cc-night-light-page.c
+++ b/panels/display/cc-night-light-page.c
@@ -26,6 +26,7 @@
 #include <math.h>
 
 #include "cc-night-light-page.h"
+#include "list-box-helper.h"
 
 #include "shell/cc-object-storage.h"
 
@@ -34,17 +35,16 @@ struct _CcNightLightPage {
 
   GtkWidget           *box_manual;
   GtkWidget           *infobar_disabled;
+  GtkListBox          *listbox;
   GtkWidget           *scale_color_temperature;
+  GtkWidget           *night_light_toggle_switch;
+  GtkComboBox         *schedule_type_combo;
   GtkWidget           *spinbutton_from_hours;
   GtkWidget           *spinbutton_from_minutes;
   GtkWidget           *spinbutton_to_hours;
   GtkWidget           *spinbutton_to_minutes;
   GtkStack            *stack_from;
   GtkStack            *stack_to;
-  GtkWidget           *togglebutton_box;
-  GtkWidget           *togglebutton_automatic;
-  GtkWidget           *togglebutton_manual;
-  GtkWidget           *togglebutton_off;
 
   GtkAdjustment       *adjustment_from_hours;
   GtkAdjustment       *adjustment_from_minutes;
@@ -122,7 +122,6 @@ dialog_update_state (CcNightLightPage *self)
   gboolean disabled_until_tomorrow = FALSE;
   gboolean enabled;
   gdouble value = 0.f;
-  GtkToggleButton *toggle_button;
 
   /* only show the infobar if we are disabled */
   if (self->proxy_color != NULL)
@@ -139,45 +138,9 @@ dialog_update_state (CcNightLightPage *self)
   enabled = g_settings_get_boolean (self->settings_display, "night-light-enabled");
   automatic = g_settings_get_boolean (self->settings_display, "night-light-schedule-automatic");
 
-  self->ignore_value_changed = TRUE;
-  if (!enabled)
-    toggle_button = GTK_TOGGLE_BUTTON (self->togglebutton_off);
-  else if (automatic)
-    toggle_button = GTK_TOGGLE_BUTTON (self->togglebutton_automatic);
-  else
-    toggle_button = GTK_TOGGLE_BUTTON (self->togglebutton_manual);
-  gtk_toggle_button_set_active (toggle_button, TRUE);
-  self->ignore_value_changed = FALSE;
-
   gtk_widget_set_sensitive (self->box_manual, enabled && !automatic);
-  gtk_widget_set_sensitive (self->scale_color_temperature, enabled);
 
-  /* Don't show the off button if it can't be turned off */
-  /* Don't allow choosing Manual or "Sunset to Sunrise" if it can't be turned on */
-  if (!g_settings_is_writable (self->settings_display, "night-light-enabled"))
-    {
-        gtk_widget_set_visible (self->togglebutton_off, !enabled);
-        gtk_widget_set_sensitive (self->togglebutton_box, enabled);
-    }
-  else
-    {
-        gtk_widget_set_visible (self->togglebutton_off, TRUE);
-        gtk_widget_set_sensitive (self->togglebutton_box, TRUE);
-    }
-
-  /* Don't show the Manual buttons if Manual can't be enabled. Same for "Sunset to Sunrise". */
-  if (!g_settings_is_writable (self->settings_display, "night-light-schedule-automatic"))
-    {
-        gtk_widget_set_visible (self->togglebutton_automatic, automatic);
-        gtk_widget_set_visible (self->togglebutton_manual, !automatic);
-        gtk_widget_set_visible (self->box_manual, !automatic);
-    }
-  else
-    {
-        gtk_widget_set_visible (self->togglebutton_automatic, TRUE);
-        gtk_widget_set_visible (self->togglebutton_manual, TRUE);
-        gtk_widget_set_visible (self->box_manual, TRUE);
-    }
+  gtk_combo_box_set_active_id (self->schedule_type_combo, automatic ? "automatic" : "manual");
 
   /* set from */
   if (automatic && self->proxy_color != NULL)
@@ -235,6 +198,42 @@ dialog_update_state (CcNightLightPage *self)
   self->ignore_value_changed = FALSE;
 }
 
+static void
+build_schedule_combo_row (CcNightLightPage *self)
+{
+  gboolean automatic;
+  gboolean enabled;
+
+  self->ignore_value_changed = TRUE;
+
+
+  enabled = g_settings_get_boolean (self->settings_display, "night-light-enabled");
+  automatic = g_settings_get_boolean (self->settings_display, "night-light-schedule-automatic");
+
+  gtk_widget_set_sensitive (self->box_manual, enabled && !automatic);
+
+  gtk_combo_box_set_active_id (self->schedule_type_combo, automatic ? "automatic" : "manual");
+
+  self->ignore_value_changed = FALSE;
+}
+
+static void
+on_schedule_type_combo_active_changed_cb (GtkComboBox      *combo_box,
+                                          GParamSpec       *pspec,
+                                          CcNightLightPage *self)
+{
+  const gchar *active_id;
+  gboolean automatic;
+
+  if (self->ignore_value_changed)
+    return;
+
+  active_id = gtk_combo_box_get_active_id (combo_box);
+  automatic = g_str_equal (active_id, "automatic");
+
+  g_settings_set_boolean (self->settings_display, "night-light-schedule-automatic", automatic);
+}
+
 static gboolean
 dialog_tick_cb (gpointer user_data)
 {
@@ -252,29 +251,6 @@ dialog_enabled_notify_cb (GtkSwitch        *sw,
                           gtk_switch_get_active (sw));
 }
 
-static void
-dialog_mode_changed_cb (GtkToggleButton  *togglebutton,
-                        CcNightLightPage *self)
-{
-  if (self->ignore_value_changed)
-    return;
-
-  if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->togglebutton_automatic)))
-    {
-      g_settings_set_boolean (self->settings_display, "night-light-enabled", TRUE);
-      g_settings_set_boolean (self->settings_display, "night-light-schedule-automatic", TRUE);
-    }
-  else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->togglebutton_manual)))
-    {
-      g_settings_set_boolean (self->settings_display, "night-light-enabled", TRUE);
-      g_settings_set_boolean (self->settings_display, "night-light-schedule-automatic", FALSE);
-    }
-  if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->togglebutton_off)))
-    {
-      g_settings_set_boolean (self->settings_display, "night-light-enabled", FALSE);
-    }
-}
-
 static void
 dialog_undisable_call_cb (GObject      *source_object,
                           GAsyncResult *res,
@@ -608,6 +584,9 @@ cc_night_light_page_class_init (CcNightLightPageClass *klass)
   gtk_widget_class_bind_template_child (widget_class, CcNightLightPage, adjustment_color_temperature);
   gtk_widget_class_bind_template_child (widget_class, CcNightLightPage, box_manual);
   gtk_widget_class_bind_template_child (widget_class, CcNightLightPage, infobar_disabled);
+  gtk_widget_class_bind_template_child (widget_class, CcNightLightPage, listbox);
+  gtk_widget_class_bind_template_child (widget_class, CcNightLightPage, night_light_toggle_switch);
+  gtk_widget_class_bind_template_child (widget_class, CcNightLightPage, schedule_type_combo);
   gtk_widget_class_bind_template_child (widget_class, CcNightLightPage, scale_color_temperature);
   gtk_widget_class_bind_template_child (widget_class, CcNightLightPage, spinbutton_from_hours);
   gtk_widget_class_bind_template_child (widget_class, CcNightLightPage, spinbutton_from_minutes);
@@ -615,21 +594,17 @@ cc_night_light_page_class_init (CcNightLightPageClass *klass)
   gtk_widget_class_bind_template_child (widget_class, CcNightLightPage, spinbutton_to_minutes);
   gtk_widget_class_bind_template_child (widget_class, CcNightLightPage, stack_from);
   gtk_widget_class_bind_template_child (widget_class, CcNightLightPage, stack_to);
-  gtk_widget_class_bind_template_child (widget_class, CcNightLightPage, togglebutton_box);
-  gtk_widget_class_bind_template_child (widget_class, CcNightLightPage, togglebutton_automatic);
-  gtk_widget_class_bind_template_child (widget_class, CcNightLightPage, togglebutton_manual);
-  gtk_widget_class_bind_template_child (widget_class, CcNightLightPage, togglebutton_off);
 
   gtk_widget_class_bind_template_callback (widget_class, dialog_am_pm_from_button_clicked_cb);
   gtk_widget_class_bind_template_callback (widget_class, dialog_am_pm_to_button_clicked_cb);
   gtk_widget_class_bind_template_callback (widget_class, dialog_enabled_notify_cb);
   gtk_widget_class_bind_template_callback (widget_class, dialog_format_hours_combobox);
   gtk_widget_class_bind_template_callback (widget_class, dialog_format_minutes_combobox);
-  gtk_widget_class_bind_template_callback (widget_class, dialog_mode_changed_cb);
   gtk_widget_class_bind_template_callback (widget_class, dialog_time_from_value_changed_cb);
   gtk_widget_class_bind_template_callback (widget_class, dialog_time_to_value_changed_cb);
   gtk_widget_class_bind_template_callback (widget_class, dialog_color_temperature_value_changed_cb);
   gtk_widget_class_bind_template_callback (widget_class, dialog_undisable_clicked_cb);
+  gtk_widget_class_bind_template_callback (widget_class, on_schedule_type_combo_active_changed_cb);
 
 }
 
@@ -640,6 +615,8 @@ cc_night_light_page_init (CcNightLightPage *self)
 
   gtk_widget_init_template (GTK_WIDGET (self));
 
+  gtk_list_box_set_header_func (self->listbox, cc_list_box_update_header_func, NULL, NULL);
+
   gtk_scale_add_mark (GTK_SCALE (self->scale_color_temperature),
                       3000, GTK_POS_BOTTOM,
                       _("More Warm"));
@@ -661,6 +638,16 @@ cc_night_light_page_init (CcNightLightPage *self)
 
   g_signal_connect (self->settings_display, "changed", G_CALLBACK (dialog_settings_changed_cb), self);
 
+  build_schedule_combo_row (self);
+
+  g_settings_bind (self->settings_display, "night-light-enabled",
+                   self->night_light_toggle_switch, "active",
+                   G_SETTINGS_BIND_DEFAULT);
+
+  g_settings_bind_writable (self->settings_display, "night-light-enabled",
+                            self->night_light_toggle_switch, "sensitive",
+                            FALSE);
+
   g_settings_bind_writable (self->settings_display, "night-light-schedule-from",
                             self->spinbutton_from_hours, "sensitive",
                             FALSE);
diff --git a/panels/display/cc-night-light-page.ui b/panels/display/cc-night-light-page.ui
index fc58b20ab..45ab12627 100644
--- a/panels/display/cc-night-light-page.ui
+++ b/panels/display/cc-night-light-page.ui
@@ -98,382 +98,345 @@
               <object class="GtkFrame">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="shadow_type">none</property>
-                <child type="label">
-                  <object class="GtkLabel">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="halign">start</property>
-                    <property name="hexpand">True</property>
-                    <property name="margin-bottom">22</property>
-                    <property name="label" translatable="yes">Schedule</property>
-                    <attributes>
-                      <attribute name="weight" value="bold"/>
-                    </attributes>
-                  </object>
-                </child>
                 <child>
-                  <object class="GtkBox">
+                  <object class="GtkListBox" id="listbox">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="orientation">vertical</property>
-                    <property name="spacing">22</property>
+                    <property name="selection-mode">none</property>
+
+                    <!-- Schedule -->
                     <child>
-                      <object class="GtkButtonBox" id="togglebutton_box">
+                      <object class="HdyActionRow">
                         <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="halign">fill</property>
-                        <property name="hexpand">True</property>
-                        <property name="layout_style">expand</property>
-                        <child>
-                          <object class="GtkRadioButton" id="togglebutton_automatic">
-                            <property name="label" translatable="yes">Sunset to Sunrise</property>
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="receives_default">True</property>
-                            <property name="draw_indicator">False</property>
-                            <property name="active">True</property>
-                            <signal name="toggled" handler="dialog_mode_changed_cb" 
object="CcNightLightPage" swapped="no" />
-                          </object>
-                          <packing>
-                            <property name="expand">True</property>
-                            <property name="fill">True</property>
-                            <property name="position">0</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkRadioButton" id="togglebutton_manual">
-                            <property name="label" translatable="yes">Manual</property>
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="receives_default">True</property>
-                            <property name="group">togglebutton_automatic</property>
-                            <property name="draw_indicator">False</property>
-                            <signal name="toggled" handler="dialog_mode_changed_cb" 
object="CcNightLightPage" swapped="no" />
-                          </object>
-                          <packing>
-                            <property name="expand">True</property>
-                            <property name="fill">True</property>
-                            <property name="position">1</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkRadioButton" id="togglebutton_off">
-                            <property name="label" translatable="yes">_Off</property>
+                        <property name="title" translatable="yes">Schedule</property>
+                        <property name="activatable-widget">night_light_toggle_switch</property>
+
+                        <child type="action">
+                          <object class="GtkSwitch" id="night_light_toggle_switch">
                             <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="receives_default">True</property>
-                            <property name="draw_indicator">False</property>
-                            <property name="group">togglebutton_automatic</property>
-                            <property name="use_underline">True</property>
-                            <signal name="toggled" handler="dialog_mode_changed_cb" 
object="CcNightLightPage" swapped="no" />
-                          </object>
-                          <packing>
-                            <property name="expand">True</property>
-                            <property name="fill">True</property>
-                            <property name="position">2</property>
-                          </packing>
-                        </child>
-                        <style>
-                          <class name="linked"/>
-                        </style>
-                      </object>
-                    </child>
-                  </object>
-                </child>
-              </object>
-            </child>
-            <child>
-              <object class="GtkBox" id="box_manual">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="margin-top">12</property>
-                <property name="spacing">18</property>
-                <child>
-                  <object class="GtkLabel">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="halign">start</property>
-                    <property name="valign">center</property>
-                    <property name="label" translatable="yes">From</property>
-                    <property name="mnemonic_widget">spinbutton_from_hours</property>
-                    <style>
-                      <class name="dim-label"/>
-                    </style>
-                  </object>
-                </child>
-                <child>
-                  <object class="GtkBox">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="spacing">6</property>
-                    <child>
-                      <object class="GtkSpinButton" id="spinbutton_from_hours">
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="max_width_chars">2</property>
-                        <property name="text">4</property>
-                        <property name="orientation">vertical</property>
-                        <property name="adjustment">adjustment_from_hours</property>
-                        <property name="numeric">True</property>
-                        <property name="wrap">True</property>
-                        <property name="value">4</property>
-                        <signal name="output" handler="dialog_format_hours_combobox" 
object="CcNightLightPage" swapped="no" />
-                        <style>
-                          <class name="padded-spinbutton"/>
-                        </style>
-                        <child internal-child="accessible">
-                          <object class="AtkObject" id="from_h_spinbutton-atkobject">
-                            <property name="AtkObject::accessible-description" 
translatable="yes">Hour</property>
+                            <property name="valign">center</property>
                           </object>
                         </child>
                       </object>
                     </child>
+
+                    <!-- Schedule Type -->
                     <child>
-                      <object class="GtkLabel">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="label" translatable="yes">:</property>
-                      </object>
-                    </child>
-                    <child>
-                      <object class="GtkSpinButton" id="spinbutton_from_minutes">
+                      <object class="HdyActionRow">
                         <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="max_width_chars">2</property>
-                        <property name="text">0</property>
-                        <property name="orientation">vertical</property>
-                        <property name="adjustment">adjustment_from_minutes</property>
-                        <property name="numeric">True</property>
-                        <property name="wrap">True</property>
-                        <signal name="output" handler="dialog_format_minutes_combobox" 
object="CcNightLightPage" swapped="no" />
-                        <style>
-                          <class name="padded-spinbutton"/>
-                        </style>
-                        <child internal-child="accessible">
-                          <object class="AtkObject" id="from_m_spinbutton-atkobject">
-                            <property name="AtkObject::accessible-description" 
translatable="yes">Minute</property>
+                        <property name="title" translatable="yes">Schedule Type</property>
+                        <property name="sensitive" bind-source="night_light_toggle_switch" 
bind-property="active" bind-flags="default|sync-create" />
+
+                        <child type="action">
+                          <object class="GtkComboBoxText" id="schedule_type_combo">
+                            <property name="visible">True</property>
+                            <property name="valign">center</property>
+                            <signal name="notify::active" handler="on_schedule_type_combo_active_changed_cb" 
object="CcNightLightPage" swapped="no" />
+                            <items>
+                              <item translatable="yes" id="automatic">Sunset to Sunrise</item>
+                              <item translatable="yes" id="manual">Set Time</item>
+                            </items>
                           </object>
                         </child>
                       </object>
                     </child>
+
+                    <!-- Time -->
                     <child>
-                      <object class="GtkStack" id="stack_from">
+                      <object class="HdyActionRow">
                         <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <child>
-                          <object class="GtkButton" id="button_from_am">
-                            <property name="label" translatable="yes" comments="This is the short form for 
the time period in the morning">AM</property>
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="receives_default">True</property>
-                            <property name="valign">center</property>
-                            <signal name="clicked" handler="dialog_am_pm_from_button_clicked_cb" 
object="CcNightLightPage" swapped="no" />
-                            <style>
-                              <class name="unpadded-button"/>
-                            </style>
-                          </object>
-                          <packing>
-                            <property name="name">am</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkButton" id="button_from_pm">
-                            <property name="label" translatable="yes" comments="This is the short form for 
the time period in the afternoon">PM</property>
+                        <property name="title" translatable="yes">Times</property>
+                        <property name="sensitive" bind-source="night_light_toggle_switch" 
bind-property="active" bind-flags="default|sync-create" />
+
+                        <child type="action">
+                          <object class="GtkBox" id="box_manual">
                             <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="receives_default">True</property>
-                            <property name="valign">center</property>
-                            <signal name="clicked" handler="dialog_am_pm_from_button_clicked_cb" 
object="CcNightLightPage" swapped="no" />
+                            <property name="can_focus">False</property>
+                            <property name="spacing">6</property>
+                            <property name="margin-top">12</property>
+                            <property name="margin-bottom">12</property>
                             <style>
-                              <class name="unpadded-button"/>
+                              <class name="time-widget" />
                             </style>
-                          </object>
-                          <packing>
-                            <property name="name">pm</property>
-                            <property name="position">1</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkLabel">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                          </object>
-                          <packing>
-                            <property name="name">blank</property>
-                            <property name="position">2</property>
-                          </packing>
-                        </child>
-                      </object>
-                    </child>
-                  </object>
-                </child>
-                <child>
-                  <object class="GtkBox">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="spacing">6</property>
-                    <child>
-                      <object class="GtkSpinButton" id="spinbutton_to_hours">
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="max_width_chars">2</property>
-                        <property name="text">4</property>
-                        <property name="input_purpose">number</property>
-                        <property name="orientation">vertical</property>
-                        <property name="adjustment">adjustment_to_hours</property>
-                        <property name="numeric">True</property>
-                        <property name="wrap">True</property>
-                        <property name="value">4</property>
-                        <signal name="output" handler="dialog_format_hours_combobox" 
object="CcNightLightPage" swapped="no" />
-                        <style>
-                          <class name="padded-spinbutton"/>
-                        </style>
-                        <child internal-child="accessible">
-                          <object class="AtkObject" id="to_h_spinbutton-atkobject">
-                            <property name="AtkObject::accessible-description" 
translatable="yes">Hour</property>
-                          </object>
-                        </child>
-                      </object>
-                    </child>
-                    <child>
-                      <object class="GtkLabel">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="label" translatable="yes">:</property>
-                      </object>
-                    </child>
-                    <child>
-                      <object class="GtkSpinButton" id="spinbutton_to_minutes">
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="max_width_chars">2</property>
-                        <property name="text">0</property>
-                        <property name="orientation">vertical</property>
-                        <property name="adjustment">adjustment_to_minutes</property>
-                        <property name="numeric">True</property>
-                        <property name="wrap">True</property>
-                        <signal name="output" handler="dialog_format_minutes_combobox" 
object="CcNightLightPage" swapped="no" />
-                        <style>
-                          <class name="padded-spinbutton"/>
-                        </style>
-                        <child internal-child="accessible">
-                          <object class="AtkObject" id="to_m_spinbutton-atkobject">
-                            <property name="AtkObject::accessible-description" 
translatable="yes">Minute</property>
+                            <child>
+                              <object class="GtkLabel">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="label" translatable="yes">From</property>
+                                <property name="mnemonic_widget">spinbutton_from_hours</property>
+                                <style>
+                                  <class name="dim-label"/>
+                                </style>
+                              </object>
+                            </child>
+                            <child>
+                              <object class="GtkBox">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="spacing">4</property>
+                                <child>
+                                  <object class="GtkSpinButton" id="spinbutton_from_hours">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="max_width_chars">2</property>
+                                    <property name="text">4</property>
+                                    <property name="orientation">vertical</property>
+                                    <property name="adjustment">adjustment_from_hours</property>
+                                    <property name="numeric">True</property>
+                                    <property name="wrap">True</property>
+                                    <property name="value">4</property>
+                                    <signal name="output" handler="dialog_format_hours_combobox" 
object="CcNightLightPage" swapped="no" />
+                                    <style>
+                                      <class name="padded-spinbutton"/>
+                                    </style>
+                                    <child internal-child="accessible">
+                                      <object class="AtkObject" id="from_h_spinbutton-atkobject">
+                                        <property name="AtkObject::accessible-description" 
translatable="yes">Hour</property>
+                                      </object>
+                                    </child>
+                                  </object>
+                                </child>
+                                <child>
+                                  <object class="GtkLabel">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
+                                    <property name="label" translatable="yes">:</property>
+                                  </object>
+                                </child>
+                                <child>
+                                  <object class="GtkSpinButton" id="spinbutton_from_minutes">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="max_width_chars">2</property>
+                                    <property name="text">0</property>
+                                    <property name="orientation">vertical</property>
+                                    <property name="adjustment">adjustment_from_minutes</property>
+                                    <property name="numeric">True</property>
+                                    <property name="wrap">True</property>
+                                    <signal name="output" handler="dialog_format_minutes_combobox" 
object="CcNightLightPage" swapped="no" />
+                                    <style>
+                                      <class name="padded-spinbutton"/>
+                                    </style>
+                                    <child internal-child="accessible">
+                                      <object class="AtkObject" id="from_m_spinbutton-atkobject">
+                                        <property name="AtkObject::accessible-description" 
translatable="yes">Minute</property>
+                                      </object>
+                                    </child>
+                                  </object>
+                                </child>
+                                <child>
+                                  <object class="GtkStack" id="stack_from">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
+                                    <property name="homogeneous">False</property>
+                                    <child>
+                                      <object class="GtkButton" id="button_from_am">
+                                        <property name="label" translatable="yes" comments="This is the 
short form for the time period in the morning">AM</property>
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">True</property>
+                                        <property name="receives_default">True</property>
+                                        <property name="valign">center</property>
+                                        <signal name="clicked" handler="dialog_am_pm_from_button_clicked_cb" 
object="CcNightLightPage" swapped="no" />
+                                        <style>
+                                          <class name="unpadded-button"/>
+                                        </style>
+                                      </object>
+                                      <packing>
+                                        <property name="name">am</property>
+                                      </packing>
+                                    </child>
+                                    <child>
+                                      <object class="GtkButton" id="button_from_pm">
+                                        <property name="label" translatable="yes" comments="This is the 
short form for the time period in the afternoon">PM</property>
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">True</property>
+                                        <property name="receives_default">True</property>
+                                        <property name="valign">center</property>
+                                        <signal name="clicked" handler="dialog_am_pm_from_button_clicked_cb" 
object="CcNightLightPage" swapped="no" />
+                                        <style>
+                                          <class name="unpadded-button"/>
+                                        </style>
+                                      </object>
+                                      <packing>
+                                        <property name="name">pm</property>
+                                        <property name="position">1</property>
+                                      </packing>
+                                    </child>
+                                    <child>
+                                      <object class="GtkLabel">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">False</property>
+                                      </object>
+                                      <packing>
+                                        <property name="name">blank</property>
+                                        <property name="position">2</property>
+                                      </packing>
+                                    </child>
+                                  </object>
+                                </child>
+                              </object>
+                            </child>
+                            <child>
+                              <object class="GtkLabel">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="margin-start">6</property>
+                                <property name="label" translatable="yes">To</property>
+                                <property name="mnemonic_widget">spinbutton_to_hours</property>
+                                <style>
+                                  <class name="dim-label"/>
+                                </style>
+                              </object>
+                            </child>
+                            <child>
+                              <object class="GtkBox">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="spacing">4</property>
+                                <child>
+                                  <object class="GtkSpinButton" id="spinbutton_to_hours">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="max_width_chars">2</property>
+                                    <property name="text">4</property>
+                                    <property name="input_purpose">number</property>
+                                    <property name="orientation">vertical</property>
+                                    <property name="adjustment">adjustment_to_hours</property>
+                                    <property name="numeric">True</property>
+                                    <property name="wrap">True</property>
+                                    <property name="value">4</property>
+                                    <signal name="output" handler="dialog_format_hours_combobox" 
object="CcNightLightPage" swapped="no" />
+                                    <style>
+                                      <class name="padded-spinbutton"/>
+                                    </style>
+                                    <child internal-child="accessible">
+                                      <object class="AtkObject" id="to_h_spinbutton-atkobject">
+                                        <property name="AtkObject::accessible-description" 
translatable="yes">Hour</property>
+                                      </object>
+                                    </child>
+                                  </object>
+                                </child>
+                                <child>
+                                  <object class="GtkLabel">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
+                                    <property name="label" translatable="yes">:</property>
+                                  </object>
+                                </child>
+                                <child>
+                                  <object class="GtkSpinButton" id="spinbutton_to_minutes">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="max_width_chars">2</property>
+                                    <property name="text">0</property>
+                                    <property name="orientation">vertical</property>
+                                    <property name="adjustment">adjustment_to_minutes</property>
+                                    <property name="numeric">True</property>
+                                    <property name="wrap">True</property>
+                                    <signal name="output" handler="dialog_format_minutes_combobox" 
object="CcNightLightPage" swapped="no" />
+                                    <style>
+                                      <class name="padded-spinbutton"/>
+                                    </style>
+                                    <child internal-child="accessible">
+                                      <object class="AtkObject" id="to_m_spinbutton-atkobject">
+                                        <property name="AtkObject::accessible-description" 
translatable="yes">Minute</property>
+                                      </object>
+                                    </child>
+                                  </object>
+                                </child>
+                                <child>
+                                  <object class="GtkStack" id="stack_to">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
+                                    <property name="homogeneous">False</property>
+                                    <child>
+                                      <object class="GtkButton" id="button_to_am">
+                                        <property name="label" translatable="yes">AM</property>
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">True</property>
+                                        <property name="receives_default">True</property>
+                                        <property name="valign">center</property>
+                                        <signal name="clicked" handler="dialog_am_pm_to_button_clicked_cb" 
object="CcNightLightPage" swapped="no" />
+                                        <style>
+                                          <class name="unpadded-button"/>
+                                        </style>
+                                      </object>
+                                      <packing>
+                                        <property name="name">am</property>
+                                      </packing>
+                                    </child>
+                                    <child>
+                                      <object class="GtkButton" id="button_to_pm">
+                                        <property name="label" translatable="yes">PM</property>
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">True</property>
+                                        <property name="receives_default">True</property>
+                                        <property name="valign">center</property>
+                                        <signal name="clicked" handler="dialog_am_pm_to_button_clicked_cb" 
object="CcNightLightPage" swapped="no" />
+                                        <style>
+                                          <class name="unpadded-button"/>
+                                        </style>
+                                      </object>
+                                      <packing>
+                                        <property name="name">pm</property>
+                                        <property name="position">1</property>
+                                      </packing>
+                                    </child>
+                                    <child>
+                                      <object class="GtkLabel">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">False</property>
+                                      </object>
+                                      <packing>
+                                        <property name="name">blank</property>
+                                        <property name="position">2</property>
+                                      </packing>
+                                    </child>
+                                  </object>
+                                </child>
+                              </object>
+                            </child>
                           </object>
                         </child>
                       </object>
                     </child>
+
+                    <!-- Color Temperature -->
                     <child>
-                      <object class="GtkStack" id="stack_to">
+                      <object class="HdyActionRow">
                         <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <child>
-                          <object class="GtkButton" id="button_to_am">
-                            <property name="label" translatable="yes">AM</property>
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="receives_default">True</property>
-                            <property name="valign">center</property>
-                            <signal name="clicked" handler="dialog_am_pm_to_button_clicked_cb" 
object="CcNightLightPage" swapped="no" />
-                            <style>
-                              <class name="unpadded-button"/>
-                            </style>
-                          </object>
-                          <packing>
-                            <property name="name">am</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkButton" id="button_to_pm">
-                            <property name="label" translatable="yes">PM</property>
+                        <property name="title" translatable="yes">Color Temperature</property>
+                        <property name="sensitive" bind-source="night_light_toggle_switch" 
bind-property="active" bind-flags="default|sync-create" />
+
+                        <child type="action">
+                          <object class="GtkScale" id="scale_color_temperature">
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
-                            <property name="receives_default">True</property>
-                            <property name="valign">center</property>
-                            <signal name="clicked" handler="dialog_am_pm_to_button_clicked_cb" 
object="CcNightLightPage" swapped="no" />
+                            <property name="hexpand">True</property>
+                            <property name="margin-top">12</property>
+                            <property name="margin-bottom">12</property>
+                            <property name="width-request">280</property>
+                            <property name="adjustment">adjustment_color_temperature</property>
+                            <property name="inverted">True</property>
+                            <property name="restrict_to_fill_level">False</property>
+                            <property name="fill_level">1</property>
+                            <property name="digits">0</property>
+                            <property name="draw_value">False</property>
+                            <property name="has_origin">False</property>
+                            <property name="value_pos">bottom</property>
                             <style>
-                              <class name="unpadded-button"/>
+                              <class name="night-light-temperature"/>
                             </style>
                           </object>
-                          <packing>
-                            <property name="name">pm</property>
-                            <property name="position">1</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkLabel">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                          </object>
-                          <packing>
-                            <property name="name">blank</property>
-                            <property name="position">2</property>
-                          </packing>
                         </child>
                       </object>
                     </child>
+
                   </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">True</property>
-                    <property name="pack_type">end</property>
-                    <property name="position">2</property>
-                  </packing>
                 </child>
-                <child>
-                  <object class="GtkLabel">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="halign">start</property>
-                    <property name="valign">center</property>
-                    <property name="margin_left">3</property>
-                    <property name="label" translatable="yes">To</property>
-                    <property name="mnemonic_widget">spinbutton_to_hours</property>
-                    <style>
-                      <class name="dim-label"/>
-                    </style>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">False</property>
-                    <property name="pack_type">end</property>
-                    <property name="position">3</property>
-                  </packing>
-                </child>
-              </object>
-            </child>
-            <child>
-              <object class="GtkLabel">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="halign">start</property>
-                <property name="hexpand">True</property>
-                <property name="label" translatable="yes">Color Temperature</property>
-                <property name="mnemonic_widget">scale_color_temperature</property>
-                <attributes>
-                  <attribute name="weight" value="bold"/>
-                </attributes>
-              </object>
-            </child>
-            <child>
-              <object class="GtkScale" id="scale_color_temperature">
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="hexpand">True</property>
-                <property name="adjustment">adjustment_color_temperature</property>
-                <property name="inverted">True</property>
-                <property name="restrict_to_fill_level">False</property>
-                <property name="fill_level">1</property>
-                <property name="digits">0</property>
-                <property name="draw_value">False</property>
-                <property name="has_origin">False</property>
-                <property name="value_pos">bottom</property>
-                <style>
-                  <class name="night-light-temperature"/>
-                </style>
               </object>
             </child>
+
           </object>
         </child>
       </object>
diff --git a/panels/display/night-light.css b/panels/display/night-light.css
index a318f2b20..ce9058208 100644
--- a/panels/display/night-light.css
+++ b/panels/display/night-light.css
@@ -19,8 +19,7 @@
 }
 
 .padded-spinbutton {
-    font-size: 110%;
-    min-width: 50px;
+    min-width: 40px;
 }
 
 .unpadded-button {


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