night-light: Rework implementation
This commit improves the Night Light code in various ways: * Turn it into a template class, subclass of GtkDialog, and adapts all the code to reflect that. * Update the code style in various places, to make it more conformant with the documented code style. * Reorganize the code a bit, moving functions around, to make it more conformant with the documented order.
This commit is contained in:
parent
f0bba59699
commit
ed36688c58
7 changed files with 258 additions and 387 deletions
|
@ -269,13 +269,14 @@ cc_display_panel_dispose (GObject *object)
|
||||||
g_clear_object (&priv->current_config);
|
g_clear_object (&priv->current_config);
|
||||||
g_clear_object (&priv->up_client);
|
g_clear_object (&priv->up_client);
|
||||||
g_clear_object (&priv->settings_color);
|
g_clear_object (&priv->settings_color);
|
||||||
g_clear_object (&priv->night_light_dialog);
|
|
||||||
g_clear_object (&priv->main_size_group);
|
g_clear_object (&priv->main_size_group);
|
||||||
|
|
||||||
g_cancellable_cancel (priv->shell_cancellable);
|
g_cancellable_cancel (priv->shell_cancellable);
|
||||||
g_clear_object (&priv->shell_cancellable);
|
g_clear_object (&priv->shell_cancellable);
|
||||||
g_clear_object (&priv->shell_proxy);
|
g_clear_object (&priv->shell_proxy);
|
||||||
|
|
||||||
|
g_clear_pointer (&priv->night_light_dialog, gtk_widget_destroy);
|
||||||
|
|
||||||
G_OBJECT_CLASS (cc_display_panel_parent_class)->dispose (object);
|
G_OBJECT_CLASS (cc_display_panel_parent_class)->dispose (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2145,7 +2146,8 @@ cc_display_panel_night_light_activated (CcDisplayPanel *panel)
|
||||||
CcDisplayPanelPrivate *priv = panel->priv;
|
CcDisplayPanelPrivate *priv = panel->priv;
|
||||||
GtkWindow *toplevel;
|
GtkWindow *toplevel;
|
||||||
toplevel = GTK_WINDOW (cc_shell_get_toplevel (cc_panel_get_shell (CC_PANEL (panel))));
|
toplevel = GTK_WINDOW (cc_shell_get_toplevel (cc_panel_get_shell (CC_PANEL (panel))));
|
||||||
cc_night_light_dialog_present (priv->night_light_dialog, toplevel);
|
gtk_window_set_transient_for (GTK_WINDOW (priv->night_light_dialog), toplevel);
|
||||||
|
gtk_window_present (GTK_WINDOW (priv->night_light_dialog));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -30,73 +30,42 @@
|
||||||
#include "shell/cc-object-storage.h"
|
#include "shell/cc-object-storage.h"
|
||||||
|
|
||||||
struct _CcNightLightDialog {
|
struct _CcNightLightDialog {
|
||||||
GObject parent;
|
GtkDialog parent;
|
||||||
GtkBuilder *builder;
|
|
||||||
|
GtkWidget *box_manual;
|
||||||
|
GtkWidget *infobar_disabled;
|
||||||
|
GtkWidget *night_light_widget;
|
||||||
|
GtkWidget *spinbutton_from_hours;
|
||||||
|
GtkWidget *spinbutton_from_minutes;
|
||||||
|
GtkWidget *spinbutton_to_hours;
|
||||||
|
GtkWidget *spinbutton_to_minutes;
|
||||||
|
GtkStack *stack_from;
|
||||||
|
GtkStack *stack_to;
|
||||||
|
GtkWidget *switch_enable;
|
||||||
|
GtkWidget *togglebutton_automatic;
|
||||||
|
GtkWidget *togglebutton_manual;
|
||||||
|
|
||||||
|
GtkAdjustment *adjustment_from_hours;
|
||||||
|
GtkAdjustment *adjustment_from_minutes;
|
||||||
|
GtkAdjustment *adjustment_to_hours;
|
||||||
|
GtkAdjustment *adjustment_to_minutes;
|
||||||
|
|
||||||
GSettings *settings_display;
|
GSettings *settings_display;
|
||||||
GSettings *settings_clock;
|
GSettings *settings_clock;
|
||||||
GDBusProxy *proxy_color;
|
GDBusProxy *proxy_color;
|
||||||
GDBusProxy *proxy_color_props;
|
GDBusProxy *proxy_color_props;
|
||||||
GCancellable *cancellable;
|
GCancellable *cancellable;
|
||||||
GtkWidget *night_light_widget;
|
|
||||||
GtkWidget *main_window;
|
|
||||||
gboolean ignore_value_changed;
|
gboolean ignore_value_changed;
|
||||||
guint timer_id;
|
guint timer_id;
|
||||||
GDesktopClockFormat clock_format;
|
GDesktopClockFormat clock_format;
|
||||||
};
|
};
|
||||||
|
|
||||||
G_DEFINE_TYPE (CcNightLightDialog, cc_night_light_dialog, G_TYPE_OBJECT);
|
G_DEFINE_TYPE (CcNightLightDialog, cc_night_light_dialog, GTK_TYPE_DIALOG);
|
||||||
|
|
||||||
#define CLOCK_SCHEMA "org.gnome.desktop.interface"
|
#define CLOCK_SCHEMA "org.gnome.desktop.interface"
|
||||||
#define DISPLAY_SCHEMA "org.gnome.settings-daemon.plugins.color"
|
#define DISPLAY_SCHEMA "org.gnome.settings-daemon.plugins.color"
|
||||||
#define CLOCK_FORMAT_KEY "clock-format"
|
#define CLOCK_FORMAT_KEY "clock-format"
|
||||||
|
|
||||||
void
|
|
||||||
cc_night_light_dialog_present (CcNightLightDialog *self, GtkWindow *parent)
|
|
||||||
{
|
|
||||||
GtkWindow *window = GTK_WINDOW (self->main_window);
|
|
||||||
if (parent != NULL)
|
|
||||||
{
|
|
||||||
gtk_window_set_transient_for (window, parent);
|
|
||||||
gtk_window_set_modal (window, TRUE);
|
|
||||||
}
|
|
||||||
gtk_window_present (window);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
cc_night_light_dialog_finalize (GObject *object)
|
|
||||||
{
|
|
||||||
CcNightLightDialog *self = CC_NIGHT_LIGHT_DIALOG (object);
|
|
||||||
|
|
||||||
if (self->cancellable != NULL)
|
|
||||||
{
|
|
||||||
g_cancellable_cancel (self->cancellable);
|
|
||||||
g_clear_object (&self->cancellable);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (self->main_window)
|
|
||||||
{
|
|
||||||
gtk_widget_destroy (self->main_window);
|
|
||||||
self->main_window = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
g_clear_object (&self->builder);
|
|
||||||
g_clear_object (&self->proxy_color);
|
|
||||||
g_clear_object (&self->proxy_color_props);
|
|
||||||
g_clear_object (&self->settings_display);
|
|
||||||
g_clear_object (&self->settings_clock);
|
|
||||||
if (self->timer_id > 0)
|
|
||||||
g_source_remove (self->timer_id);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (cc_night_light_dialog_parent_class)->finalize (object);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
cc_night_light_dialog_class_init (CcNightLightDialogClass *klass)
|
|
||||||
{
|
|
||||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
|
||||||
object_class->finalize = cc_night_light_dialog_finalize;
|
|
||||||
}
|
|
||||||
|
|
||||||
static gdouble
|
static gdouble
|
||||||
frac_day_from_dt (GDateTime *dt)
|
frac_day_from_dt (GDateTime *dt)
|
||||||
{
|
{
|
||||||
|
@ -107,17 +76,15 @@ frac_day_from_dt (GDateTime *dt)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dialog_adjustments_set_frac_hours (CcNightLightDialog *self,
|
dialog_adjustments_set_frac_hours (CcNightLightDialog *self,
|
||||||
gdouble value,
|
gdouble value,
|
||||||
const gchar *id_hours,
|
GtkAdjustment *adj_hours,
|
||||||
const gchar *id_mins,
|
GtkAdjustment *adj_mins,
|
||||||
const gchar *id_stack)
|
GtkStack *stack)
|
||||||
{
|
{
|
||||||
GtkAdjustment *adj;
|
|
||||||
gdouble hours;
|
gdouble hours;
|
||||||
gdouble mins = 0.f;
|
gdouble mins = 0.f;
|
||||||
gboolean is_pm = FALSE;
|
gboolean is_pm = FALSE;
|
||||||
gboolean is_24h;
|
gboolean is_24h;
|
||||||
GtkWidget *widget;
|
|
||||||
|
|
||||||
/* display the right thing for AM/PM */
|
/* display the right thing for AM/PM */
|
||||||
is_24h = self->clock_format == G_DESKTOP_CLOCK_FORMAT_24H;
|
is_24h = self->clock_format == G_DESKTOP_CLOCK_FORMAT_24H;
|
||||||
|
@ -139,26 +106,23 @@ dialog_adjustments_set_frac_hours (CcNightLightDialog *self,
|
||||||
is_pm = TRUE;
|
is_pm = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
g_debug ("setting adjustment %.3f to %.0f:%02.0f", value, hours, mins);
|
g_debug ("setting adjustment %.3f to %.0f:%02.0f", value, hours, mins);
|
||||||
|
|
||||||
self->ignore_value_changed = TRUE;
|
self->ignore_value_changed = TRUE;
|
||||||
adj = GTK_ADJUSTMENT (gtk_builder_get_object (self->builder, id_hours));
|
gtk_adjustment_set_value (GTK_ADJUSTMENT (adj_hours), hours);
|
||||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (adj), hours);
|
gtk_adjustment_set_value (GTK_ADJUSTMENT (adj_mins), mins);
|
||||||
adj = GTK_ADJUSTMENT (gtk_builder_get_object (self->builder, id_mins));
|
|
||||||
gtk_adjustment_set_value (GTK_ADJUSTMENT (adj), mins);
|
|
||||||
self->ignore_value_changed = FALSE;
|
self->ignore_value_changed = FALSE;
|
||||||
|
|
||||||
widget = GTK_WIDGET (gtk_builder_get_object (self->builder, id_stack));
|
|
||||||
if (is_24h)
|
if (is_24h)
|
||||||
gtk_stack_set_visible_child_name (GTK_STACK (widget), "blank");
|
gtk_stack_set_visible_child_name (stack, "blank");
|
||||||
else
|
else
|
||||||
gtk_stack_set_visible_child_name (GTK_STACK (widget), is_pm ? "pm" : "am");
|
gtk_stack_set_visible_child_name (stack, is_pm ? "pm" : "am");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dialog_update_state (CcNightLightDialog *self)
|
dialog_update_state (CcNightLightDialog *self)
|
||||||
{
|
{
|
||||||
GtkWidget *widget;
|
|
||||||
gboolean automatic;
|
gboolean automatic;
|
||||||
gboolean disabled_until_tomorrow = FALSE;
|
gboolean disabled_until_tomorrow = FALSE;
|
||||||
gboolean enabled;
|
gboolean enabled;
|
||||||
|
@ -174,27 +138,22 @@ dialog_update_state (CcNightLightDialog *self)
|
||||||
if (disabled != NULL)
|
if (disabled != NULL)
|
||||||
disabled_until_tomorrow = g_variant_get_boolean (disabled);
|
disabled_until_tomorrow = g_variant_get_boolean (disabled);
|
||||||
}
|
}
|
||||||
widget = GTK_WIDGET (gtk_builder_get_object (self->builder, "infobar_disabled"));
|
gtk_widget_set_visible (self->infobar_disabled, disabled_until_tomorrow);
|
||||||
gtk_widget_set_visible (widget, disabled_until_tomorrow);
|
|
||||||
|
|
||||||
/* make things insensitive if the switch is disabled */
|
/* make things insensitive if the switch is disabled */
|
||||||
enabled = g_settings_get_boolean (self->settings_display,
|
enabled = g_settings_get_boolean (self->settings_display, "night-light-enabled");
|
||||||
"night-light-enabled");
|
automatic = g_settings_get_boolean (self->settings_display, "night-light-schedule-automatic");
|
||||||
automatic = g_settings_get_boolean (self->settings_display,
|
|
||||||
"night-light-schedule-automatic");
|
|
||||||
gtk_widget_set_sensitive (self->night_light_widget, enabled);
|
gtk_widget_set_sensitive (self->night_light_widget, enabled);
|
||||||
widget = GTK_WIDGET (gtk_builder_get_object (self->builder, "togglebutton_automatic"));
|
gtk_widget_set_sensitive (self->togglebutton_automatic, enabled);
|
||||||
gtk_widget_set_sensitive (widget, enabled);
|
gtk_widget_set_sensitive (self->togglebutton_manual, enabled);
|
||||||
|
|
||||||
self->ignore_value_changed = TRUE;
|
self->ignore_value_changed = TRUE;
|
||||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), automatic);
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->togglebutton_automatic), automatic);
|
||||||
|
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->togglebutton_manual), !automatic);
|
||||||
self->ignore_value_changed = FALSE;
|
self->ignore_value_changed = FALSE;
|
||||||
widget = GTK_WIDGET (gtk_builder_get_object (self->builder, "togglebutton_manual"));
|
|
||||||
gtk_widget_set_sensitive (widget, enabled);
|
gtk_widget_set_sensitive (self->box_manual, enabled && !automatic);
|
||||||
self->ignore_value_changed = TRUE;
|
|
||||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), !automatic);
|
|
||||||
self->ignore_value_changed = FALSE;
|
|
||||||
widget = GTK_WIDGET (gtk_builder_get_object (self->builder, "box_manual"));
|
|
||||||
gtk_widget_set_sensitive (widget, enabled && !automatic);
|
|
||||||
|
|
||||||
/* show the sunset & sunrise icons when required */
|
/* show the sunset & sunrise icons when required */
|
||||||
cc_night_light_widget_set_mode (CC_NIGHT_LIGHT_WIDGET (self->night_light_widget),
|
cc_night_light_widget_set_mode (CC_NIGHT_LIGHT_WIDGET (self->night_light_widget),
|
||||||
|
@ -222,9 +181,9 @@ dialog_update_state (CcNightLightDialog *self)
|
||||||
value = fmod (value, 24.f);
|
value = fmod (value, 24.f);
|
||||||
}
|
}
|
||||||
dialog_adjustments_set_frac_hours (self, value,
|
dialog_adjustments_set_frac_hours (self, value,
|
||||||
"adjustment_from_hours",
|
self->adjustment_from_hours,
|
||||||
"adjustment_from_minutes",
|
self->adjustment_from_minutes,
|
||||||
"stack_from");
|
self->stack_from);
|
||||||
cc_night_light_widget_set_from (CC_NIGHT_LIGHT_WIDGET (self->night_light_widget), value);
|
cc_night_light_widget_set_from (CC_NIGHT_LIGHT_WIDGET (self->night_light_widget), value);
|
||||||
|
|
||||||
/* set to */
|
/* set to */
|
||||||
|
@ -248,14 +207,14 @@ dialog_update_state (CcNightLightDialog *self)
|
||||||
value = fmod (value, 24.f);
|
value = fmod (value, 24.f);
|
||||||
}
|
}
|
||||||
dialog_adjustments_set_frac_hours (self, value,
|
dialog_adjustments_set_frac_hours (self, value,
|
||||||
"adjustment_to_hours",
|
self->adjustment_to_hours,
|
||||||
"adjustment_to_minutes",
|
self->adjustment_to_minutes,
|
||||||
"stack_to");
|
self->stack_to);
|
||||||
|
|
||||||
cc_night_light_widget_set_to (CC_NIGHT_LIGHT_WIDGET (self->night_light_widget), value);
|
cc_night_light_widget_set_to (CC_NIGHT_LIGHT_WIDGET (self->night_light_widget), value);
|
||||||
|
|
||||||
/* set new time */
|
/* set new time */
|
||||||
cc_night_light_widget_set_now (CC_NIGHT_LIGHT_WIDGET (self->night_light_widget),
|
cc_night_light_widget_set_now (CC_NIGHT_LIGHT_WIDGET (self->night_light_widget), frac_day_from_dt (dt));
|
||||||
frac_day_from_dt (dt));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
@ -267,14 +226,17 @@ dialog_tick_cb (gpointer user_data)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dialog_enabled_notify_cb (GtkSwitch *sw, GParamSpec *pspec, CcNightLightDialog *self)
|
dialog_enabled_notify_cb (GtkSwitch *sw,
|
||||||
|
GParamSpec *pspec,
|
||||||
|
CcNightLightDialog *self)
|
||||||
{
|
{
|
||||||
g_settings_set_boolean (self->settings_display, "night-light-enabled",
|
g_settings_set_boolean (self->settings_display, "night-light-enabled",
|
||||||
gtk_switch_get_active (sw));
|
gtk_switch_get_active (sw));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dialog_mode_changed_cb (GtkToggleButton *togglebutton, CcNightLightDialog *self)
|
dialog_mode_changed_cb (GtkToggleButton *togglebutton,
|
||||||
|
CcNightLightDialog *self)
|
||||||
{
|
{
|
||||||
gboolean ret;
|
gboolean ret;
|
||||||
|
|
||||||
|
@ -288,7 +250,9 @@ dialog_mode_changed_cb (GtkToggleButton *togglebutton, CcNightLightDialog *self)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dialog_undisable_call_cb (GObject *source_object, GAsyncResult *res, gpointer user_data)
|
dialog_undisable_call_cb (GObject *source_object,
|
||||||
|
GAsyncResult *res,
|
||||||
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
g_autoptr(GVariant) val = NULL;
|
g_autoptr(GVariant) val = NULL;
|
||||||
g_autoptr(GError) error = NULL;
|
g_autoptr(GError) error = NULL;
|
||||||
|
@ -303,7 +267,8 @@ dialog_undisable_call_cb (GObject *source_object, GAsyncResult *res, gpointer us
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dialog_undisable_clicked_cb (GtkButton *button, CcNightLightDialog *self)
|
dialog_undisable_clicked_cb (GtkButton *button,
|
||||||
|
CcNightLightDialog *self)
|
||||||
{
|
{
|
||||||
g_dbus_proxy_call (self->proxy_color_props,
|
g_dbus_proxy_call (self->proxy_color_props,
|
||||||
"Set",
|
"Set",
|
||||||
|
@ -320,25 +285,24 @@ dialog_undisable_clicked_cb (GtkButton *button, CcNightLightDialog *self)
|
||||||
|
|
||||||
static gdouble
|
static gdouble
|
||||||
dialog_adjustments_get_frac_hours (CcNightLightDialog *self,
|
dialog_adjustments_get_frac_hours (CcNightLightDialog *self,
|
||||||
const gchar *id_hours,
|
GtkAdjustment *adj_hours,
|
||||||
const gchar *id_mins,
|
GtkAdjustment *adj_mins,
|
||||||
const gchar *id_stack)
|
GtkStack *stack)
|
||||||
{
|
{
|
||||||
GtkAdjustment *adj;
|
|
||||||
GtkWidget *widget;
|
|
||||||
gdouble value;
|
gdouble value;
|
||||||
adj = GTK_ADJUSTMENT (gtk_builder_get_object (self->builder, id_hours));
|
|
||||||
value = gtk_adjustment_get_value (adj);
|
value = gtk_adjustment_get_value (adj_hours);
|
||||||
adj = GTK_ADJUSTMENT (gtk_builder_get_object (self->builder, id_mins));
|
value += gtk_adjustment_get_value (adj_mins) / 60.0f;
|
||||||
value += gtk_adjustment_get_value (adj) / 60.0f;
|
|
||||||
widget = GTK_WIDGET (gtk_builder_get_object (self->builder, id_stack));
|
if (g_strcmp0 (gtk_stack_get_visible_child_name (stack), "pm") == 0)
|
||||||
if (g_strcmp0 (gtk_stack_get_visible_child_name (GTK_STACK (widget)), "pm") == 0)
|
|
||||||
value += 12.f;
|
value += 12.f;
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dialog_time_from_value_changed_cb (GtkAdjustment *adjustment, CcNightLightDialog *self)
|
dialog_time_from_value_changed_cb (GtkAdjustment *adjustment,
|
||||||
|
CcNightLightDialog *self)
|
||||||
{
|
{
|
||||||
gdouble value;
|
gdouble value;
|
||||||
|
|
||||||
|
@ -346,17 +310,21 @@ dialog_time_from_value_changed_cb (GtkAdjustment *adjustment, CcNightLightDialog
|
||||||
return;
|
return;
|
||||||
|
|
||||||
value = dialog_adjustments_get_frac_hours (self,
|
value = dialog_adjustments_get_frac_hours (self,
|
||||||
"adjustment_from_hours",
|
self->adjustment_from_hours,
|
||||||
"adjustment_from_minutes",
|
self->adjustment_from_minutes,
|
||||||
"stack_from");
|
self->stack_from);
|
||||||
|
|
||||||
if (value >= 24.f)
|
if (value >= 24.f)
|
||||||
value = fmod (value, 24);
|
value = fmod (value, 24);
|
||||||
|
|
||||||
g_debug ("new value = %.3f", value);
|
g_debug ("new value = %.3f", value);
|
||||||
|
|
||||||
g_settings_set_double (self->settings_display, "night-light-schedule-from", value);
|
g_settings_set_double (self->settings_display, "night-light-schedule-from", value);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dialog_time_to_value_changed_cb (GtkAdjustment *adjustment, CcNightLightDialog *self)
|
dialog_time_to_value_changed_cb (GtkAdjustment *adjustment,
|
||||||
|
CcNightLightDialog *self)
|
||||||
{
|
{
|
||||||
gdouble value;
|
gdouble value;
|
||||||
|
|
||||||
|
@ -364,26 +332,30 @@ dialog_time_to_value_changed_cb (GtkAdjustment *adjustment, CcNightLightDialog *
|
||||||
return;
|
return;
|
||||||
|
|
||||||
value = dialog_adjustments_get_frac_hours (self,
|
value = dialog_adjustments_get_frac_hours (self,
|
||||||
"adjustment_to_hours",
|
self->adjustment_to_hours,
|
||||||
"adjustment_to_minutes",
|
self->adjustment_to_minutes,
|
||||||
"stack_to");
|
self->stack_to);
|
||||||
if (value >= 24.f)
|
if (value >= 24.f)
|
||||||
value = fmod (value, 24);
|
value = fmod (value, 24);
|
||||||
|
|
||||||
g_debug ("new value = %.3f", value);
|
g_debug ("new value = %.3f", value);
|
||||||
|
|
||||||
g_settings_set_double (self->settings_display, "night-light-schedule-to", value);
|
g_settings_set_double (self->settings_display, "night-light-schedule-to", value);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dialog_color_properties_changed_cb (GDBusProxy *proxy,
|
dialog_color_properties_changed_cb (GDBusProxy *proxy,
|
||||||
GVariant *changed_properties,
|
GVariant *changed_properties,
|
||||||
GStrv invalidated_properties,
|
GStrv invalidated_properties,
|
||||||
CcNightLightDialog *self)
|
CcNightLightDialog *self)
|
||||||
{
|
{
|
||||||
dialog_update_state (self);
|
dialog_update_state (self);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dialog_got_proxy_cb (GObject *source_object, GAsyncResult *res, gpointer user_data)
|
dialog_got_proxy_cb (GObject *source_object,
|
||||||
|
GAsyncResult *res,
|
||||||
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
CcNightLightDialog *self = (CcNightLightDialog *) user_data;
|
CcNightLightDialog *self = (CcNightLightDialog *) user_data;
|
||||||
GDBusProxy *proxy;
|
GDBusProxy *proxy;
|
||||||
|
@ -406,7 +378,9 @@ dialog_got_proxy_cb (GObject *source_object, GAsyncResult *res, gpointer user_da
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dialog_got_proxy_props_cb (GObject *source_object, GAsyncResult *res, gpointer user_data)
|
dialog_got_proxy_props_cb (GObject *source_object,
|
||||||
|
GAsyncResult *res,
|
||||||
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
CcNightLightDialog *self = (CcNightLightDialog *) user_data;
|
CcNightLightDialog *self = (CcNightLightDialog *) user_data;
|
||||||
GDBusProxy *proxy;
|
GDBusProxy *proxy;
|
||||||
|
@ -424,7 +398,8 @@ dialog_got_proxy_props_cb (GObject *source_object, GAsyncResult *res, gpointer u
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
dialog_format_minutes_combobox (GtkSpinButton *spin, CcNightLightDialog *self)
|
dialog_format_minutes_combobox (GtkSpinButton *spin,
|
||||||
|
CcNightLightDialog *self)
|
||||||
{
|
{
|
||||||
GtkAdjustment *adjustment;
|
GtkAdjustment *adjustment;
|
||||||
g_autofree gchar *text = NULL;
|
g_autofree gchar *text = NULL;
|
||||||
|
@ -435,7 +410,8 @@ dialog_format_minutes_combobox (GtkSpinButton *spin, CcNightLightDialog *self)
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
dialog_format_hours_combobox (GtkSpinButton *spin, CcNightLightDialog *self)
|
dialog_format_hours_combobox (GtkSpinButton *spin,
|
||||||
|
CcNightLightDialog *self)
|
||||||
{
|
{
|
||||||
GtkAdjustment *adjustment;
|
GtkAdjustment *adjustment;
|
||||||
g_autofree gchar *text = NULL;
|
g_autofree gchar *text = NULL;
|
||||||
|
@ -451,73 +427,61 @@ dialog_format_hours_combobox (GtkSpinButton *spin, CcNightLightDialog *self)
|
||||||
static void
|
static void
|
||||||
dialog_update_adjustments (CcNightLightDialog *self)
|
dialog_update_adjustments (CcNightLightDialog *self)
|
||||||
{
|
{
|
||||||
GtkAdjustment *adj;
|
|
||||||
GtkWidget *widget;
|
|
||||||
|
|
||||||
/* from */
|
/* from */
|
||||||
adj = GTK_ADJUSTMENT (gtk_builder_get_object (self->builder, "adjustment_from_hours"));
|
|
||||||
if (self->clock_format == G_DESKTOP_CLOCK_FORMAT_24H)
|
if (self->clock_format == G_DESKTOP_CLOCK_FORMAT_24H)
|
||||||
{
|
{
|
||||||
gtk_adjustment_set_lower (adj, 0);
|
gtk_adjustment_set_lower (self->adjustment_from_hours, 0);
|
||||||
gtk_adjustment_set_upper (adj, 23);
|
gtk_adjustment_set_upper (self->adjustment_from_hours, 23);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (gtk_adjustment_get_value (adj) > 12)
|
if (gtk_adjustment_get_value (self->adjustment_from_hours) > 12)
|
||||||
{
|
gtk_stack_set_visible_child_name (self->stack_from, "pm");
|
||||||
widget = GTK_WIDGET (gtk_builder_get_object (self->builder, "stack_from"));
|
|
||||||
gtk_stack_set_visible_child_name (GTK_STACK (widget), "pm");
|
gtk_adjustment_set_lower (self->adjustment_from_hours, 1);
|
||||||
}
|
gtk_adjustment_set_upper (self->adjustment_from_hours, 12);
|
||||||
gtk_adjustment_set_lower (adj, 1);
|
|
||||||
gtk_adjustment_set_upper (adj, 12);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* to */
|
/* to */
|
||||||
adj = GTK_ADJUSTMENT (gtk_builder_get_object (self->builder, "adjustment_to_hours"));
|
|
||||||
if (self->clock_format == G_DESKTOP_CLOCK_FORMAT_24H)
|
if (self->clock_format == G_DESKTOP_CLOCK_FORMAT_24H)
|
||||||
{
|
{
|
||||||
gtk_adjustment_set_lower (adj, 0);
|
gtk_adjustment_set_lower (self->adjustment_to_hours, 0);
|
||||||
gtk_adjustment_set_upper (adj, 23);
|
gtk_adjustment_set_upper (self->adjustment_to_hours, 23);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (gtk_adjustment_get_value (adj) > 12)
|
if (gtk_adjustment_get_value (self->adjustment_to_hours) > 12)
|
||||||
{
|
gtk_stack_set_visible_child_name (self->stack_to, "pm");
|
||||||
widget = GTK_WIDGET (gtk_builder_get_object (self->builder, "stack_to"));
|
|
||||||
gtk_stack_set_visible_child_name (GTK_STACK (widget), "pm");
|
gtk_adjustment_set_lower (self->adjustment_to_hours, 1);
|
||||||
}
|
gtk_adjustment_set_upper (self->adjustment_to_hours, 12);
|
||||||
gtk_adjustment_set_lower (adj, 1);
|
|
||||||
gtk_adjustment_set_upper (adj, 12);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dialog_settings_changed_cb (GSettings *settings_display, gchar *key, CcNightLightDialog *self)
|
dialog_settings_changed_cb (GSettings *settings_display,
|
||||||
|
gchar *key,
|
||||||
|
CcNightLightDialog *self)
|
||||||
{
|
{
|
||||||
dialog_update_state (self);
|
dialog_update_state (self);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dialog_clock_settings_changed_cb (GSettings *settings_display, gchar *key, CcNightLightDialog *self)
|
dialog_clock_settings_changed_cb (GSettings *settings_display,
|
||||||
|
gchar *key,
|
||||||
|
CcNightLightDialog *self)
|
||||||
{
|
{
|
||||||
GtkAdjustment *adj;
|
|
||||||
GtkWidget *widget;
|
|
||||||
|
|
||||||
self->clock_format = g_settings_get_enum (settings_display, CLOCK_FORMAT_KEY);
|
self->clock_format = g_settings_get_enum (settings_display, CLOCK_FORMAT_KEY);
|
||||||
|
|
||||||
/* uncontionally widen this to avoid truncation */
|
/* uncontionally widen this to avoid truncation */
|
||||||
adj = GTK_ADJUSTMENT (gtk_builder_get_object (self->builder, "adjustment_from_hours"));
|
gtk_adjustment_set_lower (self->adjustment_from_hours, 0);
|
||||||
gtk_adjustment_set_lower (adj, 0);
|
gtk_adjustment_set_upper (self->adjustment_from_hours, 23);
|
||||||
gtk_adjustment_set_upper (adj, 23);
|
gtk_adjustment_set_lower (self->adjustment_to_hours, 0);
|
||||||
adj = GTK_ADJUSTMENT (gtk_builder_get_object (self->builder, "adjustment_to_hours"));
|
gtk_adjustment_set_upper (self->adjustment_to_hours, 23);
|
||||||
gtk_adjustment_set_lower (adj, 0);
|
|
||||||
gtk_adjustment_set_upper (adj, 23);
|
|
||||||
|
|
||||||
/* update spinbuttons */
|
/* update spinbuttons */
|
||||||
widget = GTK_WIDGET (gtk_builder_get_object (self->builder, "spinbutton_from_hours"));
|
gtk_spin_button_update (GTK_SPIN_BUTTON (self->spinbutton_from_hours));
|
||||||
gtk_spin_button_update (GTK_SPIN_BUTTON (widget));
|
gtk_spin_button_update (GTK_SPIN_BUTTON (self->spinbutton_to_hours));
|
||||||
widget = GTK_WIDGET (gtk_builder_get_object (self->builder, "spinbutton_to_hours"));
|
|
||||||
gtk_spin_button_update (GTK_SPIN_BUTTON (widget));
|
|
||||||
|
|
||||||
/* update UI */
|
/* update UI */
|
||||||
dialog_update_state (self);
|
dialog_update_state (self);
|
||||||
|
@ -525,7 +489,8 @@ dialog_clock_settings_changed_cb (GSettings *settings_display, gchar *key, CcNig
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dialog_am_pm_from_button_clicked_cb (GtkButton *button, CcNightLightDialog *self)
|
dialog_am_pm_from_button_clicked_cb (GtkButton *button,
|
||||||
|
CcNightLightDialog *self)
|
||||||
{
|
{
|
||||||
gdouble value;
|
gdouble value;
|
||||||
value = g_settings_get_double (self->settings_display, "night-light-schedule-from");
|
value = g_settings_get_double (self->settings_display, "night-light-schedule-from");
|
||||||
|
@ -540,7 +505,8 @@ dialog_am_pm_from_button_clicked_cb (GtkButton *button, CcNightLightDialog *self
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dialog_am_pm_to_button_clicked_cb (GtkButton *button, CcNightLightDialog *self)
|
dialog_am_pm_to_button_clicked_cb (GtkButton *button,
|
||||||
|
CcNightLightDialog *self)
|
||||||
{
|
{
|
||||||
gdouble value;
|
gdouble value;
|
||||||
value = g_settings_get_double (self->settings_display, "night-light-schedule-to");
|
value = g_settings_get_double (self->settings_display, "night-light-schedule-to");
|
||||||
|
@ -554,92 +520,89 @@ dialog_am_pm_to_button_clicked_cb (GtkButton *button, CcNightLightDialog *self)
|
||||||
g_debug ("new value = %.3f", value);
|
g_debug ("new value = %.3f", value);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
/* GObject overrides */
|
||||||
dialog_delete_event_cb (GtkWidget *widget,
|
static void
|
||||||
GdkEvent *event,
|
cc_night_light_dialog_finalize (GObject *object)
|
||||||
CcNightLightDialog *self)
|
|
||||||
{
|
{
|
||||||
gtk_widget_hide (widget);
|
CcNightLightDialog *self = CC_NIGHT_LIGHT_DIALOG (object);
|
||||||
return TRUE;
|
|
||||||
|
g_cancellable_cancel (self->cancellable);
|
||||||
|
|
||||||
|
g_clear_object (&self->cancellable);
|
||||||
|
g_clear_object (&self->proxy_color);
|
||||||
|
g_clear_object (&self->proxy_color_props);
|
||||||
|
g_clear_object (&self->settings_display);
|
||||||
|
g_clear_object (&self->settings_clock);
|
||||||
|
if (self->timer_id > 0)
|
||||||
|
g_source_remove (self->timer_id);
|
||||||
|
|
||||||
|
G_OBJECT_CLASS (cc_night_light_dialog_parent_class)->finalize (object);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
cc_night_light_dialog_class_init (CcNightLightDialogClass *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, box_manual);
|
||||||
|
gtk_widget_class_bind_template_child (widget_class, CcNightLightDialog, infobar_disabled);
|
||||||
|
gtk_widget_class_bind_template_child (widget_class, CcNightLightDialog, night_light_widget);
|
||||||
|
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, switch_enable);
|
||||||
|
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_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_undisable_clicked_cb);
|
||||||
|
|
||||||
|
g_type_ensure (CC_TYPE_NIGHT_LIGHT_WIDGET);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
cc_night_light_dialog_init (CcNightLightDialog *self)
|
cc_night_light_dialog_init (CcNightLightDialog *self)
|
||||||
{
|
{
|
||||||
GdkScreen *screen;
|
|
||||||
GtkAdjustment *adj;
|
|
||||||
GtkBox *box;
|
|
||||||
GtkWidget *sw;
|
|
||||||
GtkWidget *widget;
|
|
||||||
g_autoptr(GError) error = NULL;
|
|
||||||
g_autoptr(GtkCssProvider) provider = NULL;
|
g_autoptr(GtkCssProvider) provider = NULL;
|
||||||
|
g_autoptr(GError) error = NULL;
|
||||||
|
|
||||||
|
gtk_widget_init_template (GTK_WIDGET (self));
|
||||||
|
|
||||||
self->cancellable = g_cancellable_new ();
|
self->cancellable = g_cancellable_new ();
|
||||||
self->settings_display = g_settings_new (DISPLAY_SCHEMA);
|
self->settings_display = g_settings_new (DISPLAY_SCHEMA);
|
||||||
g_signal_connect (self->settings_display, "changed",
|
|
||||||
G_CALLBACK (dialog_settings_changed_cb), self);
|
|
||||||
|
|
||||||
self->builder = gtk_builder_new ();
|
g_signal_connect (self->settings_display, "changed", G_CALLBACK (dialog_settings_changed_cb), self);
|
||||||
gtk_builder_add_from_resource (self->builder,
|
|
||||||
"/org/gnome/control-center/display/display.ui",
|
|
||||||
&error);
|
|
||||||
|
|
||||||
if (error != NULL)
|
|
||||||
{
|
|
||||||
g_critical ("Could not load interface file: %s", error->message);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* connect widgets */
|
/* connect widgets */
|
||||||
sw = GTK_WIDGET (gtk_builder_get_object (self->builder, "switch_enable"));
|
|
||||||
g_settings_bind (self->settings_display,
|
g_settings_bind (self->settings_display,
|
||||||
"night-light-enabled",
|
"night-light-enabled",
|
||||||
GTK_SWITCH (sw),
|
self->switch_enable,
|
||||||
"active",
|
"active",
|
||||||
G_SETTINGS_BIND_DEFAULT);
|
G_SETTINGS_BIND_DEFAULT);
|
||||||
g_signal_connect (sw, "notify::active",
|
|
||||||
G_CALLBACK (dialog_enabled_notify_cb), self);
|
|
||||||
g_settings_bind_writable (self->settings_display, "night-light-enabled",
|
g_settings_bind_writable (self->settings_display, "night-light-enabled",
|
||||||
sw, "sensitive",
|
self->switch_enable, "sensitive",
|
||||||
FALSE);
|
FALSE);
|
||||||
widget = GTK_WIDGET (gtk_builder_get_object (self->builder, "togglebutton_automatic"));
|
|
||||||
g_signal_connect (widget, "toggled",
|
|
||||||
G_CALLBACK (dialog_mode_changed_cb), self);
|
|
||||||
widget = GTK_WIDGET (gtk_builder_get_object (self->builder, "togglebutton_manual"));
|
|
||||||
g_signal_connect (widget, "toggled",
|
|
||||||
G_CALLBACK (dialog_mode_changed_cb), self);
|
|
||||||
adj = GTK_ADJUSTMENT (gtk_builder_get_object (self->builder, "adjustment_from_hours"));
|
|
||||||
g_signal_connect (adj, "value-changed",
|
|
||||||
G_CALLBACK (dialog_time_from_value_changed_cb), self);
|
|
||||||
adj = GTK_ADJUSTMENT (gtk_builder_get_object (self->builder, "adjustment_from_minutes"));
|
|
||||||
g_signal_connect (adj, "value-changed",
|
|
||||||
G_CALLBACK (dialog_time_from_value_changed_cb), self);
|
|
||||||
adj = GTK_ADJUSTMENT (gtk_builder_get_object (self->builder, "adjustment_to_hours"));
|
|
||||||
g_signal_connect (adj, "value-changed",
|
|
||||||
G_CALLBACK (dialog_time_to_value_changed_cb), self);
|
|
||||||
adj = GTK_ADJUSTMENT (gtk_builder_get_object (self->builder, "adjustment_to_minutes"));
|
|
||||||
g_signal_connect (adj, "value-changed",
|
|
||||||
G_CALLBACK (dialog_time_to_value_changed_cb), self);
|
|
||||||
widget = GTK_WIDGET (gtk_builder_get_object (self->builder, "button_undisable"));
|
|
||||||
g_signal_connect (widget, "clicked",
|
|
||||||
G_CALLBACK (dialog_undisable_clicked_cb), self);
|
|
||||||
|
|
||||||
widget = GTK_WIDGET (gtk_builder_get_object (self->builder, "button_from_pm"));
|
|
||||||
g_signal_connect (widget, "clicked",
|
|
||||||
G_CALLBACK (dialog_am_pm_from_button_clicked_cb), self);
|
|
||||||
widget = GTK_WIDGET (gtk_builder_get_object (self->builder, "button_from_am"));
|
|
||||||
g_signal_connect (widget, "clicked",
|
|
||||||
G_CALLBACK (dialog_am_pm_from_button_clicked_cb), self);
|
|
||||||
widget = GTK_WIDGET (gtk_builder_get_object (self->builder, "button_to_pm"));
|
|
||||||
g_signal_connect (widget, "clicked",
|
|
||||||
G_CALLBACK (dialog_am_pm_to_button_clicked_cb), self);
|
|
||||||
widget = GTK_WIDGET (gtk_builder_get_object (self->builder, "button_to_am"));
|
|
||||||
g_signal_connect (widget, "clicked",
|
|
||||||
G_CALLBACK (dialog_am_pm_to_button_clicked_cb), self);
|
|
||||||
|
|
||||||
self->main_window = GTK_WIDGET (gtk_builder_get_object (self->builder, "window_night_light"));
|
|
||||||
g_signal_connect (self->main_window, "delete-event",
|
|
||||||
G_CALLBACK (dialog_delete_event_cb), self);
|
|
||||||
|
|
||||||
/* use custom CSS */
|
/* use custom CSS */
|
||||||
provider = gtk_css_provider_new ();
|
provider = gtk_css_provider_new ();
|
||||||
|
@ -656,31 +619,11 @@ cc_night_light_dialog_init (CcNightLightDialog *self)
|
||||||
{
|
{
|
||||||
g_error ("Failed to load CSS: %s", error->message);
|
g_error ("Failed to load CSS: %s", error->message);
|
||||||
}
|
}
|
||||||
widget = GTK_WIDGET (gtk_builder_get_object (self->builder, "spinbutton_from_hours"));
|
|
||||||
screen = gtk_widget_get_screen (widget);
|
gtk_style_context_add_provider_for_screen (gdk_screen_get_default (),
|
||||||
gtk_style_context_add_provider_for_screen (screen, GTK_STYLE_PROVIDER (provider),
|
GTK_STYLE_PROVIDER (provider),
|
||||||
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
|
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
|
||||||
|
|
||||||
widget = GTK_WIDGET (gtk_builder_get_object (self->builder, "spinbutton_from_hours"));
|
|
||||||
g_signal_connect (widget, "output",
|
|
||||||
G_CALLBACK (dialog_format_hours_combobox), self);
|
|
||||||
widget = GTK_WIDGET (gtk_builder_get_object (self->builder, "spinbutton_from_minutes"));
|
|
||||||
g_signal_connect (widget, "output",
|
|
||||||
G_CALLBACK (dialog_format_minutes_combobox), self);
|
|
||||||
widget = GTK_WIDGET (gtk_builder_get_object (self->builder, "spinbutton_to_hours"));
|
|
||||||
g_signal_connect (widget, "output",
|
|
||||||
G_CALLBACK (dialog_format_hours_combobox), self);
|
|
||||||
widget = GTK_WIDGET (gtk_builder_get_object (self->builder, "spinbutton_to_minutes"));
|
|
||||||
g_signal_connect (widget, "output",
|
|
||||||
G_CALLBACK (dialog_format_minutes_combobox), self);
|
|
||||||
|
|
||||||
/* add custom widget */
|
|
||||||
self->night_light_widget = cc_night_light_widget_new ();
|
|
||||||
gtk_widget_set_size_request (self->night_light_widget, -1, 40);
|
|
||||||
box = GTK_BOX (gtk_builder_get_object (self->builder, "box_content"));
|
|
||||||
gtk_box_pack_start (box, self->night_light_widget, FALSE, FALSE, 0);
|
|
||||||
gtk_widget_show (self->night_light_widget);
|
|
||||||
|
|
||||||
cc_object_storage_create_dbus_proxy (G_BUS_TYPE_SESSION,
|
cc_object_storage_create_dbus_proxy (G_BUS_TYPE_SESSION,
|
||||||
G_DBUS_PROXY_FLAGS_NONE,
|
G_DBUS_PROXY_FLAGS_NONE,
|
||||||
"org.gnome.SettingsDaemon.Color",
|
"org.gnome.SettingsDaemon.Color",
|
||||||
|
@ -703,8 +646,10 @@ cc_night_light_dialog_init (CcNightLightDialog *self)
|
||||||
self->settings_clock = g_settings_new (CLOCK_SCHEMA);
|
self->settings_clock = g_settings_new (CLOCK_SCHEMA);
|
||||||
self->clock_format = g_settings_get_enum (self->settings_clock, CLOCK_FORMAT_KEY);
|
self->clock_format = g_settings_get_enum (self->settings_clock, CLOCK_FORMAT_KEY);
|
||||||
dialog_update_adjustments (self);
|
dialog_update_adjustments (self);
|
||||||
g_signal_connect (self->settings_clock, "changed::" CLOCK_FORMAT_KEY,
|
g_signal_connect (self->settings_clock,
|
||||||
G_CALLBACK (dialog_clock_settings_changed_cb), self);
|
"changed::" CLOCK_FORMAT_KEY,
|
||||||
|
G_CALLBACK (dialog_clock_settings_changed_cb),
|
||||||
|
self);
|
||||||
|
|
||||||
dialog_update_state (self);
|
dialog_update_state (self);
|
||||||
}
|
}
|
||||||
|
@ -712,6 +657,8 @@ cc_night_light_dialog_init (CcNightLightDialog *self)
|
||||||
CcNightLightDialog *
|
CcNightLightDialog *
|
||||||
cc_night_light_dialog_new (void)
|
cc_night_light_dialog_new (void)
|
||||||
{
|
{
|
||||||
return g_object_new (CC_TYPE_NIGHT_LIGHT_DIALOG, NULL);
|
return g_object_new (CC_TYPE_NIGHT_LIGHT_DIALOG,
|
||||||
|
"use-header-bar", TRUE,
|
||||||
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,10 +25,8 @@
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
#define CC_TYPE_NIGHT_LIGHT_DIALOG (cc_night_light_dialog_get_type ())
|
#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, GObject)
|
G_DECLARE_FINAL_TYPE (CcNightLightDialog, cc_night_light_dialog, CC, NIGHT_LIGHT_DIALOG, GtkDialog)
|
||||||
|
|
||||||
CcNightLightDialog *cc_night_light_dialog_new (void);
|
CcNightLightDialog* cc_night_light_dialog_new (void);
|
||||||
void cc_night_light_dialog_present (CcNightLightDialog *self,
|
|
||||||
GtkWindow *parent);
|
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
|
@ -1,36 +1,12 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!-- Generated with glade 3.20.0 -->
|
|
||||||
<interface>
|
<interface>
|
||||||
<requires lib="gtk+" version="3.20"/>
|
<template class="CcNightLightDialog" parent="GtkDialog">
|
||||||
<object class="GtkSizeGroup">
|
|
||||||
<property name="mode">both</property>
|
|
||||||
</object>
|
|
||||||
<object class="GtkAdjustment" id="adjustment_from_hours">
|
|
||||||
<property name="upper">23</property>
|
|
||||||
<property name="step_increment">1</property>
|
|
||||||
<property name="page_increment">10</property>
|
|
||||||
</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>
|
|
||||||
</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>
|
|
||||||
</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>
|
|
||||||
</object>
|
|
||||||
<object class="GtkDialog" id="window_night_light">
|
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="resizable">False</property>
|
<property name="resizable">False</property>
|
||||||
<property name="modal">True</property>
|
<property name="modal">True</property>
|
||||||
<property name="destroy_with_parent">True</property>
|
<property name="destroy_with_parent">True</property>
|
||||||
<property name="type_hint">dialog</property>
|
<property name="type_hint">dialog</property>
|
||||||
|
<!-- <signal name="delete-event" handler="gtk_widget_hide_on_delete" object="CcNightLightDialog" swapped="no" /> -->
|
||||||
<child internal-child="vbox">
|
<child internal-child="vbox">
|
||||||
<object class="GtkBox">
|
<object class="GtkBox">
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
|
@ -73,6 +49,7 @@
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="receives_default">True</property>
|
<property name="receives_default">True</property>
|
||||||
|
<signal name="clicked" handler="dialog_undisable_clicked_cb" object="CcNightLightDialog" swapped="no" />
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
|
@ -105,33 +82,19 @@
|
||||||
<attribute name="weight" value="bold"/>
|
<attribute name="weight" value="bold"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
|
||||||
<property name="expand">True</property>
|
|
||||||
<property name="fill">True</property>
|
|
||||||
<property name="position">0</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
|
||||||
<property name="expand">False</property>
|
|
||||||
<property name="fill">False</property>
|
|
||||||
<property name="position">0</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
|
||||||
<property name="expand">False</property>
|
|
||||||
<property name="fill">True</property>
|
|
||||||
<property name="position">0</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
</child>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkBox" id="box_content">
|
<object class="GtkBox">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="margin_top">30</property>
|
<property name="margin_top">30</property>
|
||||||
<property name="margin_left">36</property>
|
<property name="margin_end">36</property>
|
||||||
<property name="margin_right">36</property>
|
<property name="margin_start">36</property>
|
||||||
<property name="margin_bottom">36</property>
|
<property name="margin_bottom">36</property>
|
||||||
<property name="orientation">vertical</property>
|
<property name="orientation">vertical</property>
|
||||||
<property name="spacing">26</property>
|
<property name="spacing">26</property>
|
||||||
|
@ -149,11 +112,6 @@
|
||||||
<class name="dim-label"/>
|
<class name="dim-label"/>
|
||||||
</style>
|
</style>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
|
||||||
<property name="expand">False</property>
|
|
||||||
<property name="fill">False</property>
|
|
||||||
<property name="position">0</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkGrid">
|
<object class="GtkGrid">
|
||||||
|
@ -199,6 +157,7 @@
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="halign">start</property>
|
<property name="halign">start</property>
|
||||||
|
<signal name="notify::active" handler="dialog_enabled_notify_cb" object="CcNightLightDialog" swapped="no" />
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left_attach">1</property>
|
<property name="left_attach">1</property>
|
||||||
|
@ -217,6 +176,7 @@
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="receives_default">True</property>
|
<property name="receives_default">True</property>
|
||||||
<property name="active">True</property>
|
<property name="active">True</property>
|
||||||
|
<signal name="toggled" handler="dialog_mode_changed_cb" object="CcNightLightDialog" swapped="no" />
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">True</property>
|
<property name="expand">True</property>
|
||||||
|
@ -230,6 +190,7 @@
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="receives_default">True</property>
|
<property name="receives_default">True</property>
|
||||||
|
<signal name="toggled" handler="dialog_mode_changed_cb" object="CcNightLightDialog" swapped="no" />
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">True</property>
|
<property name="expand">True</property>
|
||||||
|
@ -247,11 +208,6 @@
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
|
||||||
<property name="expand">False</property>
|
|
||||||
<property name="fill">True</property>
|
|
||||||
<property name="position">1</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkBox" id="box_manual">
|
<object class="GtkBox" id="box_manual">
|
||||||
|
@ -270,11 +226,6 @@
|
||||||
<class name="dim-label"/>
|
<class name="dim-label"/>
|
||||||
</style>
|
</style>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
|
||||||
<property name="expand">False</property>
|
|
||||||
<property name="fill">False</property>
|
|
||||||
<property name="position">0</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkBox">
|
<object class="GtkBox">
|
||||||
|
@ -292,15 +243,11 @@
|
||||||
<property name="numeric">True</property>
|
<property name="numeric">True</property>
|
||||||
<property name="wrap">True</property>
|
<property name="wrap">True</property>
|
||||||
<property name="value">4</property>
|
<property name="value">4</property>
|
||||||
|
<signal name="output" handler="dialog_format_hours_combobox" object="CcNightLightDialog" swapped="no" />
|
||||||
<style>
|
<style>
|
||||||
<class name="padded-spinbutton"/>
|
<class name="padded-spinbutton"/>
|
||||||
</style>
|
</style>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
|
||||||
<property name="expand">False</property>
|
|
||||||
<property name="fill">True</property>
|
|
||||||
<property name="position">0</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkLabel">
|
<object class="GtkLabel">
|
||||||
|
@ -308,11 +255,6 @@
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="label" translatable="yes">:</property>
|
<property name="label" translatable="yes">:</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
|
||||||
<property name="expand">False</property>
|
|
||||||
<property name="fill">True</property>
|
|
||||||
<property name="position">1</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkSpinButton" id="spinbutton_from_minutes">
|
<object class="GtkSpinButton" id="spinbutton_from_minutes">
|
||||||
|
@ -324,15 +266,11 @@
|
||||||
<property name="adjustment">adjustment_from_minutes</property>
|
<property name="adjustment">adjustment_from_minutes</property>
|
||||||
<property name="numeric">True</property>
|
<property name="numeric">True</property>
|
||||||
<property name="wrap">True</property>
|
<property name="wrap">True</property>
|
||||||
|
<signal name="output" handler="dialog_format_minutes_combobox" object="CcNightLightDialog" swapped="no" />
|
||||||
<style>
|
<style>
|
||||||
<class name="padded-spinbutton"/>
|
<class name="padded-spinbutton"/>
|
||||||
</style>
|
</style>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
|
||||||
<property name="expand">False</property>
|
|
||||||
<property name="fill">True</property>
|
|
||||||
<property name="position">2</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkStack" id="stack_from">
|
<object class="GtkStack" id="stack_from">
|
||||||
|
@ -345,13 +283,13 @@
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="receives_default">True</property>
|
<property name="receives_default">True</property>
|
||||||
<property name="valign">center</property>
|
<property name="valign">center</property>
|
||||||
|
<signal name="clicked" handler="dialog_am_pm_from_button_clicked_cb" object="CcNightLightDialog" swapped="no" />
|
||||||
<style>
|
<style>
|
||||||
<class name="unpadded-button"/>
|
<class name="unpadded-button"/>
|
||||||
</style>
|
</style>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="name">am</property>
|
<property name="name">am</property>
|
||||||
<property name="title">page0</property>
|
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
|
@ -361,13 +299,13 @@
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="receives_default">True</property>
|
<property name="receives_default">True</property>
|
||||||
<property name="valign">center</property>
|
<property name="valign">center</property>
|
||||||
|
<signal name="clicked" handler="dialog_am_pm_from_button_clicked_cb" object="CcNightLightDialog" swapped="no" />
|
||||||
<style>
|
<style>
|
||||||
<class name="unpadded-button"/>
|
<class name="unpadded-button"/>
|
||||||
</style>
|
</style>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="name">pm</property>
|
<property name="name">pm</property>
|
||||||
<property name="title">page1</property>
|
|
||||||
<property name="position">1</property>
|
<property name="position">1</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
@ -378,23 +316,12 @@
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="name">blank</property>
|
<property name="name">blank</property>
|
||||||
<property name="title">page0</property>
|
|
||||||
<property name="position">2</property>
|
<property name="position">2</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
|
||||||
<property name="expand">False</property>
|
|
||||||
<property name="fill">True</property>
|
|
||||||
<property name="position">3</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
|
||||||
<property name="expand">False</property>
|
|
||||||
<property name="fill">True</property>
|
|
||||||
<property name="position">1</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkBox">
|
<object class="GtkBox">
|
||||||
|
@ -413,15 +340,11 @@
|
||||||
<property name="numeric">True</property>
|
<property name="numeric">True</property>
|
||||||
<property name="wrap">True</property>
|
<property name="wrap">True</property>
|
||||||
<property name="value">4</property>
|
<property name="value">4</property>
|
||||||
|
<signal name="output" handler="dialog_format_hours_combobox" object="CcNightLightDialog" swapped="no" />
|
||||||
<style>
|
<style>
|
||||||
<class name="padded-spinbutton"/>
|
<class name="padded-spinbutton"/>
|
||||||
</style>
|
</style>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
|
||||||
<property name="expand">False</property>
|
|
||||||
<property name="fill">True</property>
|
|
||||||
<property name="position">0</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkLabel">
|
<object class="GtkLabel">
|
||||||
|
@ -429,11 +352,6 @@
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="label" translatable="yes">:</property>
|
<property name="label" translatable="yes">:</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
|
||||||
<property name="expand">False</property>
|
|
||||||
<property name="fill">True</property>
|
|
||||||
<property name="position">1</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkSpinButton" id="spinbutton_to_minutes">
|
<object class="GtkSpinButton" id="spinbutton_to_minutes">
|
||||||
|
@ -445,15 +363,11 @@
|
||||||
<property name="adjustment">adjustment_to_minutes</property>
|
<property name="adjustment">adjustment_to_minutes</property>
|
||||||
<property name="numeric">True</property>
|
<property name="numeric">True</property>
|
||||||
<property name="wrap">True</property>
|
<property name="wrap">True</property>
|
||||||
|
<signal name="output" handler="dialog_format_minutes_combobox" object="CcNightLightDialog" swapped="no" />
|
||||||
<style>
|
<style>
|
||||||
<class name="padded-spinbutton"/>
|
<class name="padded-spinbutton"/>
|
||||||
</style>
|
</style>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
|
||||||
<property name="expand">False</property>
|
|
||||||
<property name="fill">True</property>
|
|
||||||
<property name="position">2</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkStack" id="stack_to">
|
<object class="GtkStack" id="stack_to">
|
||||||
|
@ -466,13 +380,13 @@
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="receives_default">True</property>
|
<property name="receives_default">True</property>
|
||||||
<property name="valign">center</property>
|
<property name="valign">center</property>
|
||||||
|
<signal name="clicked" handler="dialog_am_pm_to_button_clicked_cb" object="CcNightLightDialog" swapped="no" />
|
||||||
<style>
|
<style>
|
||||||
<class name="unpadded-button"/>
|
<class name="unpadded-button"/>
|
||||||
</style>
|
</style>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="name">am</property>
|
<property name="name">am</property>
|
||||||
<property name="title">page0</property>
|
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
|
@ -482,13 +396,13 @@
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="receives_default">True</property>
|
<property name="receives_default">True</property>
|
||||||
<property name="valign">center</property>
|
<property name="valign">center</property>
|
||||||
|
<signal name="clicked" handler="dialog_am_pm_to_button_clicked_cb" object="CcNightLightDialog" swapped="no" />
|
||||||
<style>
|
<style>
|
||||||
<class name="unpadded-button"/>
|
<class name="unpadded-button"/>
|
||||||
</style>
|
</style>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="name">pm</property>
|
<property name="name">pm</property>
|
||||||
<property name="title">page1</property>
|
|
||||||
<property name="position">1</property>
|
<property name="position">1</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
@ -499,16 +413,10 @@
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="name">blank</property>
|
<property name="name">blank</property>
|
||||||
<property name="title">page0</property>
|
|
||||||
<property name="position">2</property>
|
<property name="position">2</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
|
||||||
<property name="expand">False</property>
|
|
||||||
<property name="fill">True</property>
|
|
||||||
<property name="position">3</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
|
@ -538,25 +446,16 @@
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
</child>
|
||||||
<property name="expand">False</property>
|
<child>
|
||||||
<property name="fill">True</property>
|
<object class="CcNightLightWidget" id="night_light_widget">
|
||||||
<property name="position">2</property>
|
<property name="visible">True</property>
|
||||||
</packing>
|
<property name="height_request">40</property>
|
||||||
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
|
||||||
<property name="expand">False</property>
|
|
||||||
<property name="fill">True</property>
|
|
||||||
<property name="position">1</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
|
||||||
<property name="expand">False</property>
|
|
||||||
<property name="fill">True</property>
|
|
||||||
<property name="position">1</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
|
@ -568,5 +467,30 @@
|
||||||
<property name="show_close_button">True</property>
|
<property name="show_close_button">True</property>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</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="CcNightLightDialog" swapped="no" />
|
||||||
</object>
|
</object>
|
||||||
</interface>
|
<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="CcNightLightDialog" 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="CcNightLightDialog" 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="CcNightLightDialog" swapped="no" />
|
||||||
|
</object>
|
||||||
|
</interface>
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<gresources>
|
<gresources>
|
||||||
<gresource prefix="/org/gnome/control-center/display">
|
<gresource prefix="/org/gnome/control-center/display">
|
||||||
<file preprocess="xml-stripblanks">display.ui</file>
|
<file preprocess="xml-stripblanks">cc-night-light-dialog.ui</file>
|
||||||
<file>display-arrangement.css</file>
|
<file>display-arrangement.css</file>
|
||||||
<file>16x16/sunrise.png</file>
|
<file>16x16/sunrise.png</file>
|
||||||
<file>16x16/sunset.png</file>
|
<file>16x16/sunset.png</file>
|
||||||
|
|
|
@ -29,7 +29,7 @@ sources = files(
|
||||||
)
|
)
|
||||||
|
|
||||||
resource_data = files(
|
resource_data = files(
|
||||||
'display.ui',
|
'cc-night-light-dialog.ui',
|
||||||
'icons/16x16/sunset.png',
|
'icons/16x16/sunset.png',
|
||||||
'icons/16x16/sunrise.png'
|
'icons/16x16/sunrise.png'
|
||||||
)
|
)
|
||||||
|
|
|
@ -31,7 +31,7 @@ panels/datetime/middle.ui
|
||||||
panels/datetime/org.gnome.controlcenter.datetime.policy.in
|
panels/datetime/org.gnome.controlcenter.datetime.policy.in
|
||||||
panels/datetime/ydm.ui
|
panels/datetime/ydm.ui
|
||||||
panels/display/cc-display-panel.c
|
panels/display/cc-display-panel.c
|
||||||
panels/display/display.ui
|
panels/display/cc-night-light-dialog.ui
|
||||||
panels/display/gnome-display-panel.desktop.in.in
|
panels/display/gnome-display-panel.desktop.in.in
|
||||||
panels/info/cc-info-overview-panel.c
|
panels/info/cc-info-overview-panel.c
|
||||||
panels/info/cc-info-removable-media-panel.c
|
panels/info/cc-info-removable-media-panel.c
|
||||||
|
|
Loading…
Add table
Reference in a new issue