[gnome-control-center/wip/every-detail-matters-round1: 4/13] display: Make night light dialog a GtkBin



commit 9438579af0e3f662f5a0e6f7efe017463c30ba20
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Tue Jun 11 08:26:53 2019 -0300

    display: Make night light dialog a GtkBin
    
    And create the dialog manually instead. The next commit
    will move it to a different page in the panel itself,
    so not much care was put into makin the dialog perfectly
    matching.
    
    https://gitlab.gnome.org/GNOME/gnome-control-center/issues/533

 panels/display/cc-display-panel.c                  |  20 +-
 panels/display/cc-night-light-dialog.ui            | 542 ---------------------
 ...-night-light-dialog.c => cc-night-light-page.c} | 159 +++---
 ...-night-light-dialog.h => cc-night-light-page.h} |   6 +-
 panels/display/cc-night-light-page.ui              | 514 +++++++++++++++++++
 panels/display/display.gresource.xml               |   2 +-
 panels/display/meson.build                         |   4 +-
 7 files changed, 615 insertions(+), 632 deletions(-)
---
diff --git a/panels/display/cc-display-panel.c b/panels/display/cc-display-panel.c
index 7970e8654..5030221d0 100644
--- a/panels/display/cc-display-panel.c
+++ b/panels/display/cc-display-panel.c
@@ -36,7 +36,7 @@
 #include "cc-display-config-manager-dbus.h"
 #include "cc-display-config.h"
 #include "cc-display-arrangement.h"
-#include "cc-night-light-dialog.h"
+#include "cc-night-light-page.h"
 #include "cc-display-resources.h"
 #include "cc-display-settings.h"
 
@@ -73,7 +73,8 @@ struct _CcDisplayPanel
 
   guint           focus_id;
 
-  CcNightLightDialog *night_light_dialog;
+  CcNightLightPage *night_light_page;
+  GtkDialog *night_light_dialog;
   GSettings *settings_color;
 
   UpClient *up_client;
@@ -478,6 +479,19 @@ on_night_light_list_box_row_activated_cb (CcDisplayPanel *panel)
 {
   GtkWindow *toplevel;
   toplevel = GTK_WINDOW (cc_shell_get_toplevel (cc_panel_get_shell (CC_PANEL (panel))));
+
+  if (!panel->night_light_dialog)
+    {
+      GtkWidget *content_area;
+
+      panel->night_light_dialog = (GtkDialog *)gtk_dialog_new ();
+
+      content_area = gtk_dialog_get_content_area (panel->night_light_dialog);
+      gtk_container_add (GTK_CONTAINER (content_area),
+                         GTK_WIDGET (panel->night_light_page));
+      gtk_widget_show (GTK_WIDGET (panel->night_light_page));
+    }
+
   gtk_window_set_transient_for (GTK_WINDOW (panel->night_light_dialog), toplevel);
   gtk_window_present (GTK_WINDOW (panel->night_light_dialog));
 }
@@ -1208,7 +1222,7 @@ cc_display_panel_init (CcDisplayPanel *self)
                                  0);
   gtk_cell_renderer_set_visible (renderer, TRUE);
 
-  self->night_light_dialog = cc_night_light_dialog_new ();
+  self->night_light_page = cc_night_light_page_new ();
   self->settings_color = g_settings_new ("org.gnome.settings-daemon.plugins.color");
 
   g_signal_connect_object (self->settings_color, "changed",
diff --git a/panels/display/cc-night-light-dialog.c b/panels/display/cc-night-light-page.c
similarity index 84%
rename from panels/display/cc-night-light-dialog.c
rename to panels/display/cc-night-light-page.c
index 906815537..7b4d212ea 100644
--- a/panels/display/cc-night-light-dialog.c
+++ b/panels/display/cc-night-light-page.c
@@ -25,12 +25,12 @@
 #include <glib/gi18n.h>
 #include <math.h>
 
-#include "cc-night-light-dialog.h"
+#include "cc-night-light-page.h"
 
 #include "shell/cc-object-storage.h"
 
-struct _CcNightLightDialog {
-  GtkDialog            parent;
+struct _CcNightLightPage {
+  GtkBin               parent;
 
   GtkWidget           *box_manual;
   GtkWidget           *infobar_disabled;
@@ -62,7 +62,7 @@ struct _CcNightLightDialog {
   GDesktopClockFormat  clock_format;
 };
 
-G_DEFINE_TYPE (CcNightLightDialog, cc_night_light_dialog, GTK_TYPE_DIALOG);
+G_DEFINE_TYPE (CcNightLightPage, cc_night_light_page, GTK_TYPE_BIN);
 
 #define CLOCK_SCHEMA     "org.gnome.desktop.interface"
 #define DISPLAY_SCHEMA   "org.gnome.settings-daemon.plugins.color"
@@ -70,11 +70,11 @@ G_DEFINE_TYPE (CcNightLightDialog, cc_night_light_dialog, GTK_TYPE_DIALOG);
 #define NIGHT_LIGHT_PREVIEW_TIMEOUT_SECONDS 5
 
 static void
-dialog_adjustments_set_frac_hours (CcNightLightDialog *self,
-                                   gdouble             value,
-                                   GtkAdjustment      *adj_hours,
-                                   GtkAdjustment      *adj_mins,
-                                   GtkStack           *stack)
+dialog_adjustments_set_frac_hours (CcNightLightPage *self,
+                                   gdouble           value,
+                                   GtkAdjustment    *adj_hours,
+                                   GtkAdjustment    *adj_mins,
+                                   GtkStack         *stack)
 {
   gdouble hours;
   gdouble mins = 0.f;
@@ -116,13 +116,12 @@ dialog_adjustments_set_frac_hours (CcNightLightDialog *self,
 }
 
 static void
-dialog_update_state (CcNightLightDialog *self)
+dialog_update_state (CcNightLightPage *self)
 {
   gboolean automatic;
   gboolean disabled_until_tomorrow = FALSE;
   gboolean enabled;
   gdouble value = 0.f;
-  g_autoptr(GDateTime) dt = g_date_time_new_now_local ();
   GtkToggleButton *toggle_button;
 
   /* only show the infobar if we are disabled */
@@ -239,23 +238,23 @@ dialog_update_state (CcNightLightDialog *self)
 static gboolean
 dialog_tick_cb (gpointer user_data)
 {
-  CcNightLightDialog *self = (CcNightLightDialog *) user_data;
+  CcNightLightPage *self = (CcNightLightPage *) user_data;
   dialog_update_state (self);
   return G_SOURCE_CONTINUE;
 }
 
 static void
-dialog_enabled_notify_cb (GtkSwitch          *sw,
-                          GParamSpec         *pspec,
-                          CcNightLightDialog *self)
+dialog_enabled_notify_cb (GtkSwitch        *sw,
+                          GParamSpec       *pspec,
+                          CcNightLightPage *self)
 {
   g_settings_set_boolean (self->settings_display, "night-light-enabled",
                           gtk_switch_get_active (sw));
 }
 
 static void
-dialog_mode_changed_cb (GtkToggleButton    *togglebutton,
-                        CcNightLightDialog *self)
+dialog_mode_changed_cb (GtkToggleButton  *togglebutton,
+                        CcNightLightPage *self)
 {
   if (self->ignore_value_changed)
     return;
@@ -294,8 +293,8 @@ dialog_undisable_call_cb (GObject      *source_object,
 }
 
 static void
-dialog_undisable_clicked_cb (GtkButton          *button,
-                             CcNightLightDialog *self)
+dialog_undisable_clicked_cb (GtkButton        *button,
+                             CcNightLightPage *self)
 {
   g_dbus_proxy_call (self->proxy_color_props,
                      "Set",
@@ -311,10 +310,10 @@ dialog_undisable_clicked_cb (GtkButton          *button,
 }
 
 static gdouble
-dialog_adjustments_get_frac_hours (CcNightLightDialog *self,
-                                   GtkAdjustment      *adj_hours,
-                                   GtkAdjustment      *adj_mins,
-                                   GtkStack           *stack)
+dialog_adjustments_get_frac_hours (CcNightLightPage *self,
+                                   GtkAdjustment    *adj_hours,
+                                   GtkAdjustment    *adj_mins,
+                                   GtkStack         *stack)
 {
   gdouble value;
 
@@ -328,8 +327,8 @@ dialog_adjustments_get_frac_hours (CcNightLightDialog *self,
 }
 
 static void
-dialog_time_from_value_changed_cb (GtkAdjustment      *adjustment,
-                                   CcNightLightDialog *self)
+dialog_time_from_value_changed_cb (GtkAdjustment    *adjustment,
+                                   CcNightLightPage *self)
 {
   gdouble value;
 
@@ -350,8 +349,8 @@ dialog_time_from_value_changed_cb (GtkAdjustment      *adjustment,
 }
 
 static void
-dialog_time_to_value_changed_cb (GtkAdjustment      *adjustment,
-                                 CcNightLightDialog *self)
+dialog_time_to_value_changed_cb (GtkAdjustment    *adjustment,
+                                 CcNightLightPage *self)
 {
   gdouble value;
 
@@ -371,8 +370,8 @@ dialog_time_to_value_changed_cb (GtkAdjustment      *adjustment,
 }
 
 static void
-dialog_color_temperature_value_changed_cb (GtkAdjustment      *adjustment,
-                                           CcNightLightDialog *self)
+dialog_color_temperature_value_changed_cb (GtkAdjustment    *adjustment,
+                                           CcNightLightPage *self)
 {
   gdouble value;
 
@@ -397,10 +396,10 @@ dialog_color_temperature_value_changed_cb (GtkAdjustment      *adjustment,
 }
 
 static void
-dialog_color_properties_changed_cb (GDBusProxy         *proxy,
-                                    GVariant           *changed_properties,
-                                    GStrv               invalidated_properties,
-                                    CcNightLightDialog *self)
+dialog_color_properties_changed_cb (GDBusProxy       *proxy,
+                                    GVariant         *changed_properties,
+                                    GStrv             invalidated_properties,
+                                    CcNightLightPage *self)
 {
   dialog_update_state (self);
 }
@@ -410,7 +409,7 @@ dialog_got_proxy_cb (GObject      *source_object,
                      GAsyncResult *res,
                      gpointer      user_data)
 {
-  CcNightLightDialog *self = (CcNightLightDialog *) user_data;
+  CcNightLightPage *self = (CcNightLightPage *) user_data;
   GDBusProxy *proxy;
   g_autoptr(GError) error = NULL;
 
@@ -435,7 +434,7 @@ dialog_got_proxy_props_cb (GObject      *source_object,
                            GAsyncResult *res,
                            gpointer      user_data)
 {
-  CcNightLightDialog *self = (CcNightLightDialog *) user_data;
+  CcNightLightPage *self = (CcNightLightPage *) user_data;
   GDBusProxy *proxy;
   g_autoptr(GError) error = NULL;
 
@@ -451,8 +450,8 @@ dialog_got_proxy_props_cb (GObject      *source_object,
 }
 
 static gboolean
-dialog_format_minutes_combobox (GtkSpinButton      *spin,
-                                CcNightLightDialog *self)
+dialog_format_minutes_combobox (GtkSpinButton    *spin,
+                                CcNightLightPage *self)
 {
   GtkAdjustment *adjustment;
   g_autofree gchar *text = NULL;
@@ -464,7 +463,7 @@ dialog_format_minutes_combobox (GtkSpinButton      *spin,
 
 static gboolean
 dialog_format_hours_combobox (GtkSpinButton      *spin,
-                              CcNightLightDialog *self)
+                              CcNightLightPage *self)
 {
   GtkAdjustment *adjustment;
   g_autofree gchar *text = NULL;
@@ -478,7 +477,7 @@ dialog_format_hours_combobox (GtkSpinButton      *spin,
 }
 
 static void
-dialog_update_adjustments (CcNightLightDialog *self)
+dialog_update_adjustments (CcNightLightPage *self)
 {
   /* from */
   if (self->clock_format == G_DESKTOP_CLOCK_FORMAT_24H)
@@ -512,17 +511,17 @@ dialog_update_adjustments (CcNightLightDialog *self)
 }
 
 static void
-dialog_settings_changed_cb (GSettings          *settings_display,
-                            gchar              *key,
-                            CcNightLightDialog *self)
+dialog_settings_changed_cb (GSettings        *settings_display,
+                            gchar            *key,
+                            CcNightLightPage *self)
 {
   dialog_update_state (self);
 }
 
 static void
-dialog_clock_settings_changed_cb (GSettings          *settings_display,
-                                  gchar              *key,
-                                  CcNightLightDialog *self)
+dialog_clock_settings_changed_cb (GSettings        *settings_display,
+                                  gchar            *key,
+                                  CcNightLightPage *self)
 {
   self->clock_format = g_settings_get_enum (settings_display, CLOCK_FORMAT_KEY);
 
@@ -542,8 +541,8 @@ dialog_clock_settings_changed_cb (GSettings          *settings_display,
 }
 
 static void
-dialog_am_pm_from_button_clicked_cb (GtkButton          *button,
-                                     CcNightLightDialog *self)
+dialog_am_pm_from_button_clicked_cb (GtkButton        *button,
+                                     CcNightLightPage *self)
 {
   gdouble value;
   value = g_settings_get_double (self->settings_display, "night-light-schedule-from");
@@ -558,8 +557,8 @@ dialog_am_pm_from_button_clicked_cb (GtkButton          *button,
 }
 
 static void
-dialog_am_pm_to_button_clicked_cb (GtkButton          *button,
-                                   CcNightLightDialog *self)
+dialog_am_pm_to_button_clicked_cb (GtkButton        *button,
+                                   CcNightLightPage *self)
 {
   gdouble value;
   value = g_settings_get_double (self->settings_display, "night-light-schedule-to");
@@ -575,9 +574,9 @@ dialog_am_pm_to_button_clicked_cb (GtkButton          *button,
 
 /* GObject overrides */
 static void
-cc_night_light_dialog_finalize (GObject *object)
+cc_night_light_page_finalize (GObject *object)
 {
-  CcNightLightDialog *self = CC_NIGHT_LIGHT_DIALOG (object);
+  CcNightLightPage *self = CC_NIGHT_LIGHT_PAGE (object);
 
   g_cancellable_cancel (self->cancellable);
 
@@ -589,37 +588,37 @@ cc_night_light_dialog_finalize (GObject *object)
   if (self->timer_id > 0)
     g_source_remove (self->timer_id);
 
-  G_OBJECT_CLASS (cc_night_light_dialog_parent_class)->finalize (object);
+  G_OBJECT_CLASS (cc_night_light_page_parent_class)->finalize (object);
 }
 
 static void
-cc_night_light_dialog_class_init (CcNightLightDialogClass *klass)
+cc_night_light_page_class_init (CcNightLightPageClass *klass)
 {
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
   GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
 
-  object_class->finalize = cc_night_light_dialog_finalize;
-
-  gtk_widget_class_set_template_from_resource (widget_class, 
"/org/gnome/control-center/display/cc-night-light-dialog.ui");
-
-  gtk_widget_class_bind_template_child (widget_class, CcNightLightDialog, adjustment_from_hours);
-  gtk_widget_class_bind_template_child (widget_class, CcNightLightDialog, adjustment_from_minutes);
-  gtk_widget_class_bind_template_child (widget_class, CcNightLightDialog, adjustment_to_hours);
-  gtk_widget_class_bind_template_child (widget_class, CcNightLightDialog, adjustment_to_minutes);
-  gtk_widget_class_bind_template_child (widget_class, CcNightLightDialog, adjustment_color_temperature);
-  gtk_widget_class_bind_template_child (widget_class, CcNightLightDialog, box_manual);
-  gtk_widget_class_bind_template_child (widget_class, CcNightLightDialog, infobar_disabled);
-  gtk_widget_class_bind_template_child (widget_class, CcNightLightDialog, scale_color_temperature);
-  gtk_widget_class_bind_template_child (widget_class, CcNightLightDialog, spinbutton_from_hours);
-  gtk_widget_class_bind_template_child (widget_class, CcNightLightDialog, spinbutton_from_minutes);
-  gtk_widget_class_bind_template_child (widget_class, CcNightLightDialog, spinbutton_to_hours);
-  gtk_widget_class_bind_template_child (widget_class, CcNightLightDialog, spinbutton_to_minutes);
-  gtk_widget_class_bind_template_child (widget_class, CcNightLightDialog, stack_from);
-  gtk_widget_class_bind_template_child (widget_class, CcNightLightDialog, stack_to);
-  gtk_widget_class_bind_template_child (widget_class, CcNightLightDialog, togglebutton_box);
-  gtk_widget_class_bind_template_child (widget_class, CcNightLightDialog, togglebutton_automatic);
-  gtk_widget_class_bind_template_child (widget_class, CcNightLightDialog, togglebutton_manual);
-  gtk_widget_class_bind_template_child (widget_class, CcNightLightDialog, togglebutton_off);
+  object_class->finalize = cc_night_light_page_finalize;
+
+  gtk_widget_class_set_template_from_resource (widget_class, 
"/org/gnome/control-center/display/cc-night-light-page.ui");
+
+  gtk_widget_class_bind_template_child (widget_class, CcNightLightPage, adjustment_from_hours);
+  gtk_widget_class_bind_template_child (widget_class, CcNightLightPage, adjustment_from_minutes);
+  gtk_widget_class_bind_template_child (widget_class, CcNightLightPage, adjustment_to_hours);
+  gtk_widget_class_bind_template_child (widget_class, CcNightLightPage, adjustment_to_minutes);
+  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, 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);
+  gtk_widget_class_bind_template_child (widget_class, CcNightLightPage, spinbutton_to_hours);
+  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);
@@ -635,10 +634,9 @@ cc_night_light_dialog_class_init (CcNightLightDialogClass *klass)
 }
 
 static void
-cc_night_light_dialog_init (CcNightLightDialog *self)
+cc_night_light_page_init (CcNightLightPage *self)
 {
   g_autoptr(GtkCssProvider) provider = NULL;
-  g_autoptr(GError) error = NULL;
 
   gtk_widget_init_template (GTK_WIDGET (self));
 
@@ -713,11 +711,10 @@ cc_night_light_dialog_init (CcNightLightDialog *self)
   dialog_update_state (self);
 }
 
-CcNightLightDialog *
-cc_night_light_dialog_new (void)
+CcNightLightPage *
+cc_night_light_page_new (void)
 {
-  return g_object_new (CC_TYPE_NIGHT_LIGHT_DIALOG,
-                       "use-header-bar", TRUE,
+  return g_object_new (CC_TYPE_NIGHT_LIGHT_PAGE,
                        NULL);
 }
 
diff --git a/panels/display/cc-night-light-dialog.h b/panels/display/cc-night-light-page.h
similarity index 80%
rename from panels/display/cc-night-light-dialog.h
rename to panels/display/cc-night-light-page.h
index fec383367..79422bbcb 100644
--- a/panels/display/cc-night-light-dialog.h
+++ b/panels/display/cc-night-light-page.h
@@ -24,9 +24,9 @@
 
 G_BEGIN_DECLS
 
-#define CC_TYPE_NIGHT_LIGHT_DIALOG (cc_night_light_dialog_get_type ())
-G_DECLARE_FINAL_TYPE (CcNightLightDialog, cc_night_light_dialog, CC, NIGHT_LIGHT_DIALOG, GtkDialog)
+#define CC_TYPE_NIGHT_LIGHT_PAGE (cc_night_light_page_get_type ())
+G_DECLARE_FINAL_TYPE (CcNightLightPage, cc_night_light_page, CC, NIGHT_LIGHT_PAGE, GtkBin)
 
-CcNightLightDialog* cc_night_light_dialog_new (void);
+CcNightLightPage* cc_night_light_page_new (void);
 
 G_END_DECLS
diff --git a/panels/display/cc-night-light-page.ui b/panels/display/cc-night-light-page.ui
new file mode 100644
index 000000000..fc58b20ab
--- /dev/null
+++ b/panels/display/cc-night-light-page.ui
@@ -0,0 +1,514 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <template class="CcNightLightPage" parent="GtkBin">
+    <property name="can_focus">False</property>
+    <child>
+      <object class="GtkBox">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="halign">center</property>
+        <property name="valign">start</property>
+        <property name="orientation">vertical</property>
+        <child>
+          <object class="GtkInfoBar" id="infobar_disabled">
+            <property name="name">infobar_disabled</property>
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="border_width">0</property>
+            <property name="orientation">vertical</property>
+            <property name="spacing">12</property>
+            <child internal-child="action_area">
+              <object class="GtkButtonBox">
+                <property name="can_focus">False</property>
+                <property name="border_width">12</property>
+                <property name="spacing">6</property>
+                <property name="layout_style">end</property>
+                <child>
+                  <object class="GtkButton" id="button_undisable">
+                    <property name="label" translatable="yes" comments="This cancels the redshift 
inhibit.">Restart Filter</property>
+                    <property name="name">button_undisable</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                    <signal name="clicked" handler="dialog_undisable_clicked_cb" object="CcNightLightPage" 
swapped="no" />
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="pack_type">end</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="pack_type">end</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child internal-child="content_area">
+              <object class="GtkBox">
+                <property name="can_focus">False</property>
+                <property name="spacing">16</property>
+                <child>
+                  <object class="GtkLabel">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="halign">start</property>
+                    <property name="margin_left">12</property>
+                    <property name="hexpand">False</property>
+                    <property name="label" translatable="yes" comments="Inhibit the redshift functionality 
until the next day starts">Temporarily Disabled Until Tomorrow</property>
+                    <attributes>
+                      <attribute name="weight" value="bold"/>
+                    </attributes>
+                  </object>
+                </child>
+              </object>
+            </child>
+          </object>
+        </child>
+
+        <child>
+          <object class="GtkBox">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="margin_top">30</property>
+            <property name="margin_end">36</property>
+            <property name="margin_start">36</property>
+            <property name="margin_bottom">36</property>
+            <property name="orientation">vertical</property>
+            <property name="spacing">26</property>
+            <child>
+              <object class="GtkLabel">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="halign">start</property>
+                <property name="valign">start</property>
+                <property name="label" translatable="yes">Night light makes the screen color warmer. This 
can help to prevent eye strain and sleeplessness.</property>
+                <property name="wrap">True</property>
+                <property name="max_width_chars">60</property>
+                <property name="xalign">0</property>
+                <style>
+                  <class name="dim-label"/>
+                </style>
+              </object>
+            </child>
+            <child>
+              <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">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="orientation">vertical</property>
+                    <property name="spacing">22</property>
+                    <child>
+                      <object class="GtkButtonBox" id="togglebutton_box">
+                        <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="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>
+                          </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>
+                        <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="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>
+                          </object>
+                        </child>
+                      </object>
+                    </child>
+                    <child>
+                      <object class="GtkStack" id="stack_to">
+                        <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="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>
+                  <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>
+    </child>
+  </template>
+
+  <object class="GtkAdjustment" id="adjustment_from_hours">
+    <property name="upper">23</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+    <signal name="value-changed" handler="dialog_time_from_value_changed_cb" object="CcNightLightPage" 
swapped="no" />
+  </object>
+  <object class="GtkAdjustment" id="adjustment_from_minutes">
+    <property name="upper">59</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+    <signal name="value-changed" handler="dialog_time_from_value_changed_cb" object="CcNightLightPage" 
swapped="no" />
+  </object>
+  <object class="GtkAdjustment" id="adjustment_to_hours">
+    <property name="upper">23</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+    <signal name="value-changed" handler="dialog_time_to_value_changed_cb" object="CcNightLightPage" 
swapped="no" />
+  </object>
+  <object class="GtkAdjustment" id="adjustment_to_minutes">
+    <property name="upper">59</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+    <signal name="value-changed" handler="dialog_time_to_value_changed_cb" object="CcNightLightPage" 
swapped="no" />
+  </object>
+  <object class="GtkAdjustment" id="adjustment_color_temperature">
+    <property name="lower">3000</property>
+    <property name="upper">6000</property>
+    <property name="step_increment">100</property>
+    <property name="page_increment">500</property>
+    <signal name="value-changed" handler="dialog_color_temperature_value_changed_cb" 
object="CcNightLightPage" swapped="no" />
+  </object>
+</interface>
diff --git a/panels/display/display.gresource.xml b/panels/display/display.gresource.xml
index 04600346b..fcac1a274 100644
--- a/panels/display/display.gresource.xml
+++ b/panels/display/display.gresource.xml
@@ -3,7 +3,7 @@
   <gresource prefix="/org/gnome/control-center/display">
     <file preprocess="xml-stripblanks">cc-display-panel.ui</file>
     <file preprocess="xml-stripblanks">cc-display-settings.ui</file>
-    <file preprocess="xml-stripblanks">cc-night-light-dialog.ui</file>
+    <file preprocess="xml-stripblanks">cc-night-light-page.ui</file>
     <file>display-arrangement.css</file>
     <file>night-light.css</file>
   </gresource>
diff --git a/panels/display/meson.build b/panels/display/meson.build
index d448e822c..f2b6f09c4 100644
--- a/panels/display/meson.build
+++ b/panels/display/meson.build
@@ -25,13 +25,13 @@ sources = files(
   'cc-display-config-manager-dbus.c',
   'cc-display-config-manager.c',
   'cc-display-settings.c',
-  'cc-night-light-dialog.c',
+  'cc-night-light-page.c',
 )
 
 resource_data = files(
   'cc-display-panel.ui',
   'cc-display-settings.ui',
-  'cc-night-light-dialog.ui',
+  'cc-night-light-page.ui',
 )
 
 sources += gnome.compile_resources(


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