diff options
author | Jonas Ådahl <jadahl@gmail.com> | 2022-02-24 12:31:00 +0100 |
---|---|---|
committer | Jonas Ådahl <jadahl@gmail.com> | 2022-05-17 12:32:48 +0200 |
commit | fc984e90a1c4c91b52c13a963ce364ebaab459e6 (patch) | |
tree | 42987c9e13c9f512d8726c2507e9865beccc27a5 /panels/display | |
parent | 44293e9db2c74bc8b17a99abc42fa72b6a697d4f (diff) | |
download | gnome-control-center-fc984e90a1c4c91b52c13a963ce364ebaab459e6.tar.gz |
display: Show infobar if night light isn't supported
This may be the case on e.g. fully remote / headless sessions, or as of
now, when using the NVIDIA driver to run a Wayland session.
Closes: https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/1659
Diffstat (limited to 'panels/display')
-rw-r--r-- | panels/display/cc-night-light-page.c | 153 | ||||
-rw-r--r-- | panels/display/cc-night-light-page.ui | 545 |
2 files changed, 382 insertions, 316 deletions
diff --git a/panels/display/cc-night-light-page.c b/panels/display/cc-night-light-page.c index 14dc11f45..4b7b112fe 100644 --- a/panels/display/cc-night-light-page.c +++ b/panels/display/cc-night-light-page.c @@ -28,15 +28,18 @@ #include "cc-night-light-page.h" #include "shell/cc-object-storage.h" +#include "cc-display-config-manager-dbus.h" struct _CcNightLightPage { AdwBin parent; + GtkWidget *night_light_settings; GtkWidget *box_manual; GtkButton *button_from_am; GtkButton *button_from_pm; GtkButton *button_to_am; GtkButton *button_to_pm; + GtkWidget *infobar_unsupported; GtkWidget *infobar_disabled; GtkListBox *listbox; GtkWidget *scale_color_temperature; @@ -65,6 +68,8 @@ struct _CcNightLightPage { gboolean ignore_value_changed; guint timer_id; GDesktopClockFormat clock_format; + + CcDisplayConfigManager *config_manager; }; G_DEFINE_TYPE (CcNightLightPage, cc_night_light_page, ADW_TYPE_BIN); @@ -123,88 +128,97 @@ dialog_adjustments_set_frac_hours (CcNightLightPage *self, static void dialog_update_state (CcNightLightPage *self) { - gboolean automatic; - gboolean disabled_until_tomorrow = FALSE; - gboolean enabled; - gdouble value = 0.f; - - /* only show the infobar if we are disabled */ - if (self->proxy_color != NULL) + if (cc_display_config_manager_get_night_light_supported (self->config_manager)) { - g_autoptr(GVariant) disabled = NULL; - disabled = g_dbus_proxy_get_cached_property (self->proxy_color, - "DisabledUntilTomorrow"); - if (disabled != NULL) - disabled_until_tomorrow = g_variant_get_boolean (disabled); - } - gtk_widget_set_visible (self->infobar_disabled, disabled_until_tomorrow); + gboolean automatic; + gboolean disabled_until_tomorrow = FALSE; + gboolean enabled; + gdouble value = 0.f; - /* make things insensitive if the switch is disabled */ - enabled = g_settings_get_boolean (self->settings_display, "night-light-enabled"); - automatic = g_settings_get_boolean (self->settings_display, "night-light-schedule-automatic"); + /* only show the infobar if we are disabled */ + if (self->proxy_color != NULL) + { + g_autoptr(GVariant) disabled = NULL; + disabled = g_dbus_proxy_get_cached_property (self->proxy_color, + "DisabledUntilTomorrow"); + if (disabled != NULL) + disabled_until_tomorrow = g_variant_get_boolean (disabled); + } + gtk_widget_set_visible (self->infobar_disabled, disabled_until_tomorrow); - gtk_widget_set_sensitive (self->box_manual, enabled && !automatic); + /* make things insensitive if the switch is disabled */ + enabled = g_settings_get_boolean (self->settings_display, "night-light-enabled"); + automatic = g_settings_get_boolean (self->settings_display, "night-light-schedule-automatic"); - gtk_combo_box_set_active_id (self->schedule_type_combo, automatic ? "automatic" : "manual"); + gtk_widget_set_sensitive (self->box_manual, enabled && !automatic); - /* set from */ - if (automatic && self->proxy_color != NULL) - { - g_autoptr(GVariant) sunset = NULL; - sunset = g_dbus_proxy_get_cached_property (self->proxy_color, "Sunset"); - if (sunset != NULL) + gtk_combo_box_set_active_id (self->schedule_type_combo, automatic ? "automatic" : "manual"); + + /* set from */ + if (automatic && self->proxy_color != NULL) { - value = g_variant_get_double (sunset); + g_autoptr(GVariant) sunset = NULL; + sunset = g_dbus_proxy_get_cached_property (self->proxy_color, "Sunset"); + if (sunset != NULL) + { + value = g_variant_get_double (sunset); + } + else + { + value = 16.0f; + g_warning ("no sunset data, using %02.2f", value); + } } else { - value = 16.0f; - g_warning ("no sunset data, using %02.2f", value); + value = g_settings_get_double (self->settings_display, "night-light-schedule-from"); + value = fmod (value, 24.f); } - } - else - { - value = g_settings_get_double (self->settings_display, "night-light-schedule-from"); - value = fmod (value, 24.f); - } - dialog_adjustments_set_frac_hours (self, value, - self->adjustment_from_hours, - self->adjustment_from_minutes, - self->stack_from, - self->button_from_am, - self->button_from_pm); - - /* set to */ - if (automatic && self->proxy_color != NULL) - { - g_autoptr(GVariant) sunset = NULL; - sunset = g_dbus_proxy_get_cached_property (self->proxy_color, "Sunrise"); - if (sunset != NULL) + dialog_adjustments_set_frac_hours (self, value, + self->adjustment_from_hours, + self->adjustment_from_minutes, + self->stack_from, + self->button_from_am, + self->button_from_pm); + + /* set to */ + if (automatic && self->proxy_color != NULL) { - value = g_variant_get_double (sunset); + g_autoptr(GVariant) sunset = NULL; + sunset = g_dbus_proxy_get_cached_property (self->proxy_color, "Sunrise"); + if (sunset != NULL) + { + value = g_variant_get_double (sunset); + } + else + { + value = 8.0f; + g_warning ("no sunrise data, using %02.2f", value); + } } else { - value = 8.0f; - g_warning ("no sunrise data, using %02.2f", value); + value = g_settings_get_double (self->settings_display, "night-light-schedule-to"); + value = fmod (value, 24.f); } + dialog_adjustments_set_frac_hours (self, value, + self->adjustment_to_hours, + self->adjustment_to_minutes, + self->stack_to, + self->button_to_am, + self->button_to_pm); + + self->ignore_value_changed = TRUE; + value = (gdouble) g_settings_get_uint (self->settings_display, "night-light-temperature"); + gtk_adjustment_set_value (self->adjustment_color_temperature, value); + self->ignore_value_changed = FALSE; } else { - value = g_settings_get_double (self->settings_display, "night-light-schedule-to"); - value = fmod (value, 24.f); + gtk_widget_set_visible (self->infobar_unsupported, TRUE); + gtk_widget_set_visible (self->infobar_disabled, FALSE); + gtk_widget_set_sensitive (self->night_light_settings, FALSE); } - dialog_adjustments_set_frac_hours (self, value, - self->adjustment_to_hours, - self->adjustment_to_minutes, - self->stack_to, - self->button_to_am, - self->button_to_pm); - - self->ignore_value_changed = TRUE; - value = (gdouble) g_settings_get_uint (self->settings_display, "night-light-temperature"); - gtk_adjustment_set_value (self->adjustment_color_temperature, value); - self->ignore_value_changed = FALSE; } static void @@ -550,6 +564,13 @@ dialog_am_pm_to_button_clicked_cb (GtkButton *button, g_debug ("new value = %.3f", value); } +static void +config_manager_changed_cb (CcDisplayConfigManager *config_manager, + CcNightLightPage *self) +{ + dialog_update_state (self); +} + /* GObject overrides */ static void cc_night_light_page_finalize (GObject *object) @@ -584,11 +605,13 @@ cc_night_light_page_class_init (CcNightLightPageClass *klass) 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, night_light_settings); gtk_widget_class_bind_template_child (widget_class, CcNightLightPage, box_manual); gtk_widget_class_bind_template_child (widget_class, CcNightLightPage, button_from_am); gtk_widget_class_bind_template_child (widget_class, CcNightLightPage, button_from_pm); gtk_widget_class_bind_template_child (widget_class, CcNightLightPage, button_to_am); gtk_widget_class_bind_template_child (widget_class, CcNightLightPage, button_to_pm); + gtk_widget_class_bind_template_child (widget_class, CcNightLightPage, infobar_unsupported); 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); @@ -707,6 +730,10 @@ cc_night_light_page_init (CcNightLightPage *self) gtk_widget_set_direction (self->from_spinbuttons_box, GTK_TEXT_DIR_LTR); } + self->config_manager = cc_display_config_manager_dbus_new (); + g_signal_connect (self->config_manager, "changed", + G_CALLBACK (config_manager_changed_cb), self); + dialog_update_state (self); } diff --git a/panels/display/cc-night-light-page.ui b/panels/display/cc-night-light-page.ui index 7f24f54e6..f3fb3b71d 100644 --- a/panels/display/cc-night-light-page.ui +++ b/panels/display/cc-night-light-page.ui @@ -3,296 +3,334 @@ <template class="CcNightLightPage" parent="AdwBin"> <child> <object class="GtkBox"> - <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> + <object class="GtkInfoBar" id="infobar_unsupported"> + <property name="visible">False</property> + <property name="name">infobar_unsupported</property> + <property name="message-type">warning</property> <child> <object class="GtkBox"> + <property name="orientation">vertical</property> <property name="hexpand">True</property> <property name="spacing">16</property> <child> <object class="GtkLabel"> <property name="halign">start</property> - <property name="margin-start">12</property> + <property name="margin-start">6</property> <property name="hexpand">False</property> - <property name="wrap">True</property> - <property name="label" translatable="yes" comments="Inhibit the redshift functionality until the next day starts">Temporarily Disabled Until Tomorrow</property> + <property name="label" translatable="yes">Night Light unavailable</property> <attributes> <attribute name="weight" value="bold"/> </attributes> </object> </child> - </object> - </child> - <child> - <object class="GtkButton" id="button_undisable"> - <property name="margin-top">12</property> - <property name="margin-bottom">12</property> - <property name="margin-start">12</property> - <property name="margin-end">12</property> - <property name="label" translatable="yes" comments="This cancels the redshift inhibit.">Restart Filter</property> - <property name="name">button_undisable</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="valign">GTK_ALIGN_CENTER</property> - <signal name="clicked" handler="dialog_undisable_clicked_cb" object="CcNightLightPage" swapped="no" /> + <child> + <object class="GtkLabel"> + <property name="halign">start</property> + <property name="margin-start">6</property> + <property name="hexpand">False</property> + <property name="label" translatable="yes">This could be the result of the graphics driver being used, or the desktop being used remotely</property> + </object> + </child> </object> </child> </object> </child> - <child> - <object class="GtkBox"> - <property name="margin_top">30</property> - <property name="margin_end">12</property> - <property name="margin_start">12</property> - <property name="margin_bottom">36</property> + <object class="GtkBox" id="night_light_settings"> + <property name="halign">center</property> + <property name="valign">start</property> <property name="orientation">vertical</property> - <property name="spacing">26</property> - <child> - <object class="GtkLabel"> - <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="GtkListBox" id="listbox"> - <property name="selection-mode">none</property> - - <style> - <class name="boxed-list" /> - </style> - - <!-- Night Light --> + <object class="GtkInfoBar" id="infobar_disabled"> + <property name="name">infobar_disabled</property> <child> - <object class="AdwActionRow"> - <property name="title" translatable="yes">Night Light</property> - <property name="activatable-widget">night_light_toggle_switch</property> - + <object class="GtkBox"> + <property name="hexpand">True</property> + <property name="spacing">16</property> <child> - <object class="GtkSwitch" id="night_light_toggle_switch"> - <property name="valign">center</property> - <accessibility> - <property name="label" translatable="yes">Enable</property> - </accessibility> + <object class="GtkLabel"> + <property name="halign">start</property> + <property name="margin-start">12</property> + <property name="hexpand">False</property> + <property name="wrap">True</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> + <child> + <object class="GtkButton" id="button_undisable"> + <property name="margin-top">12</property> + <property name="margin-bottom">12</property> + <property name="margin-start">12</property> + <property name="margin-end">12</property> + <property name="label" translatable="yes" comments="This cancels the redshift inhibit.">Restart Filter</property> + <property name="name">button_undisable</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="valign">GTK_ALIGN_CENTER</property> + <signal name="clicked" handler="dialog_undisable_clicked_cb" object="CcNightLightPage" swapped="no" /> + </object> + </child> + </object> + </child> - <!-- Schedule --> + <child> + <object class="GtkBox"> + <property name="margin_top">30</property> + <property name="margin_end">12</property> + <property name="margin_start">12</property> + <property name="margin_bottom">36</property> + <property name="orientation">vertical</property> + <property name="spacing">26</property> + <child> + <object class="GtkLabel"> + <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="AdwActionRow" id="schedule_row"> - <property name="title" translatable="yes">Schedule</property> - <property name="sensitive" bind-source="night_light_toggle_switch" bind-property="active" bind-flags="default|sync-create" /> + <object class="GtkListBox" id="listbox"> + <property name="selection-mode">none</property> + + <style> + <class name="boxed-list" /> + </style> + <!-- Night Light --> <child> - <object class="GtkComboBoxText" id="schedule_type_combo"> - <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">Manual Schedule</item> - </items> - <accessibility> - <relation name="labelled-by">schedule_row</relation> - </accessibility> + <object class="AdwActionRow"> + <property name="title" translatable="yes">Night Light</property> + <property name="activatable-widget">night_light_toggle_switch</property> + + <child> + <object class="GtkSwitch" id="night_light_toggle_switch"> + <property name="valign">center</property> + <accessibility> + <property name="label" translatable="yes">Enable</property> + </accessibility> + </object> + </child> </object> </child> - </object> - </child> - - <!-- Time --> - <child> - <object class="AdwActionRow"> - <property name="title" translatable="yes">Times</property> - <property name="sensitive" bind-source="night_light_toggle_switch" bind-property="active" bind-flags="default|sync-create" /> + <!-- Schedule --> <child> - <object class="GtkBox" id="box_manual"> - <property name="spacing">6</property> - <property name="margin-top">12</property> - <property name="margin-bottom">12</property> - <style> - <class name="time-widget" /> - </style> + <object class="AdwActionRow" id="schedule_row"> + <property name="title" translatable="yes">Schedule</property> + <property name="sensitive" bind-source="night_light_toggle_switch" bind-property="active" bind-flags="default|sync-create" /> + <child> - <object class="GtkLabel"> - <property name="label" translatable="yes">From</property> - <property name="mnemonic_widget">spinbutton_from_hours</property> - <style> - <class name="dim-label"/> - </style> + <object class="GtkComboBoxText" id="schedule_type_combo"> + <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">Manual Schedule</item> + </items> + <accessibility> + <relation name="labelled-by">schedule_row</relation> + </accessibility> </object> </child> + </object> + </child> + + <!-- Time --> + <child> + <object class="AdwActionRow"> + <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> - <object class="GtkBox" id="from_spinbuttons_box"> - <property name="spacing">4</property> - <child> - <object class="GtkSpinButton" id="spinbutton_from_hours"> - <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> - <accessibility> - <property name="description" translatable="yes">Hour</property> - </accessibility> - </object> - </child> + <object class="GtkBox" id="box_manual"> + <property name="spacing">6</property> + <property name="margin-top">12</property> + <property name="margin-bottom">12</property> + <style> + <class name="time-widget" /> + </style> <child> <object class="GtkLabel"> - <property name="label" translatable="yes">:</property> - </object> - </child> - <child> - <object class="GtkSpinButton" id="spinbutton_from_minutes"> - <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" /> + <property name="label" translatable="yes">From</property> + <property name="mnemonic_widget">spinbutton_from_hours</property> <style> - <class name="padded-spinbutton"/> + <class name="dim-label"/> </style> - <accessibility> - <property name="description" translatable="yes">Minute</property> - </accessibility> </object> </child> <child> - <object class="GtkStack" id="stack_from"> - <property name="hhomogeneous">False</property> - <property name="vhomogeneous">False</property> + <object class="GtkBox" id="from_spinbuttons_box"> + <property name="spacing">4</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> + <object class="GtkSpinButton" id="spinbutton_from_hours"> <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="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="unpadded-button"/> + <class name="padded-spinbutton"/> </style> + <accessibility> + <property name="description" translatable="yes">Hour</property> + </accessibility> + </object> + </child> + <child> + <object class="GtkLabel"> + <property name="label" translatable="yes">:</property> </object> </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> + <object class="GtkSpinButton" id="spinbutton_from_minutes"> <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="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="unpadded-button"/> + <class name="padded-spinbutton"/> </style> + <accessibility> + <property name="description" translatable="yes">Minute</property> + </accessibility> + </object> + </child> + <child> + <object class="GtkStack" id="stack_from"> + <property name="hhomogeneous">False</property> + <property name="vhomogeneous">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="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> + </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="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> + </child> </object> </child> - </object> - </child> - </object> - </child> - <child> - <object class="GtkLabel"> - <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" id="to_spinbuttons_box"> - <property name="spacing">4</property> - <child> - <object class="GtkSpinButton" id="spinbutton_to_hours"> - <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_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> - <accessibility> - <property name="description" translatable="yes">Hour</property> - </accessibility> </object> </child> <child> <object class="GtkLabel"> - <property name="label" translatable="yes">:</property> - </object> - </child> - <child> - <object class="GtkSpinButton" id="spinbutton_to_minutes"> - <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" /> + <property name="margin-start">6</property> + <property name="label" translatable="yes">To</property> + <property name="mnemonic_widget">spinbutton_to_hours</property> <style> - <class name="padded-spinbutton"/> + <class name="dim-label"/> </style> - <accessibility> - <property name="description" translatable="yes">Minute</property> - </accessibility> </object> </child> <child> - <object class="GtkStack" id="stack_to"> - <property name="hhomogeneous">False</property> - <property name="vhomogeneous">False</property> + <object class="GtkBox" id="to_spinbuttons_box"> + <property name="spacing">4</property> <child> - <object class="GtkButton" id="button_to_am"> - <property name="label" translatable="yes">AM</property> + <object class="GtkSpinButton" id="spinbutton_to_hours"> <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="max_width_chars">2</property> + <property name="text">4</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="unpadded-button"/> + <class name="padded-spinbutton"/> </style> + <accessibility> + <property name="description" translatable="yes">Hour</property> + </accessibility> + </object> + </child> + <child> + <object class="GtkLabel"> + <property name="label" translatable="yes">:</property> </object> </child> <child> - <object class="GtkButton" id="button_to_pm"> - <property name="label" translatable="yes">PM</property> + <object class="GtkSpinButton" id="spinbutton_to_minutes"> <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="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="unpadded-button"/> + <class name="padded-spinbutton"/> </style> + <accessibility> + <property name="description" translatable="yes">Minute</property> + </accessibility> + </object> + </child> + <child> + <object class="GtkStack" id="stack_to"> + <property name="hhomogeneous">False</property> + <property name="vhomogeneous">False</property> + <child> + <object class="GtkButton" id="button_to_am"> + <property name="label" translatable="yes">AM</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> + </child> + <child> + <object class="GtkButton" id="button_to_pm"> + <property name="label" translatable="yes">PM</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> + </child> </object> </child> </object> @@ -301,52 +339,53 @@ </child> </object> </child> - </object> - </child> - - <!-- Color Temperature --> - <child> - <object class="AdwPreferencesRow"> - <property name="activatable">False</property> - <property name="sensitive" bind-source="night_light_toggle_switch" bind-property="active" bind-flags="default|sync-create" /> + <!-- Color Temperature --> <child> - <object class="GtkBox"> - <property name="margin-start">12</property> - <property name="margin-end">12</property> - <property name="margin-top">12</property> - <property name="margin-bottom">12</property> - <property name="spacing">6</property> - <property name="orientation">vertical</property> + <object class="AdwPreferencesRow"> + <property name="activatable">False</property> + <property name="sensitive" bind-source="night_light_toggle_switch" bind-property="active" bind-flags="default|sync-create" /> <child> - <object class="GtkLabel" id="title"> - <property name="label" translatable="yes">Color Temperature</property> - <property name="ellipsize">none</property> - <property name="lines">0</property> - <property name="xalign">0.0</property> - <property name="mnemonic_widget">scale_color_temperature</property> - <style> - <class name="title"/> - </style> - </object> - </child> + <object class="GtkBox"> + <property name="margin-start">12</property> + <property name="margin-end">12</property> + <property name="margin-top">12</property> + <property name="margin-bottom">12</property> + <property name="spacing">6</property> + <property name="orientation">vertical</property> + + <child> + <object class="GtkLabel" id="title"> + <property name="label" translatable="yes">Color Temperature</property> + <property name="ellipsize">none</property> + <property name="lines">0</property> + <property name="xalign">0.0</property> + <property name="mnemonic_widget">scale_color_temperature</property> + <style> + <class name="title"/> + </style> + </object> + </child> + + <child> + <object class="GtkScale" id="scale_color_temperature"> + <property name="hexpand">True</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="night-light-temperature"/> + </style> + </object> + </child> - <child> - <object class="GtkScale" id="scale_color_temperature"> - <property name="hexpand">True</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="night-light-temperature"/> - </style> </object> </child> |