[gnome-control-center/gbsneto/gtk4: 48/53] display: Port to GTK4
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center/gbsneto/gtk4: 48/53] display: Port to GTK4
- Date: Wed, 15 Dec 2021 01:34:35 +0000 (UTC)
commit f598fb3ed6af1b82fceeea4ddbfff59b857951e1
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Thu Nov 11 15:31:41 2021 -0300
display: Port to GTK4
panels/display/cc-display-arrangement.c | 137 ++++-----
panels/display/cc-display-panel.c | 177 +++++------
panels/display/cc-display-panel.ui | 499 +++++++++++---------------------
panels/display/cc-display-settings.c | 147 ++++++----
panels/display/cc-display-settings.h | 4 +-
panels/display/cc-display-settings.ui | 124 ++++----
panels/display/cc-night-light-page.c | 17 +-
panels/display/cc-night-light-page.h | 4 +-
panels/display/cc-night-light-page.ui | 499 ++++++++++++++------------------
panels/display/meson.build | 2 +-
panels/display/night-light.css | 2 +-
panels/meson.build | 2 +-
shell/cc-panel-loader.c | 4 +-
13 files changed, 689 insertions(+), 929 deletions(-)
---
diff --git a/panels/display/cc-display-arrangement.c b/panels/display/cc-display-arrangement.c
index adbbcbc28..efe8d5718 100644
--- a/panels/display/cc-display-arrangement.c
+++ b/panels/display/cc-display-arrangement.c
@@ -494,24 +494,6 @@ cc_display_arrangement_find_monitor_at (CcDisplayArrangement *self,
return NULL;
}
-static void
-cc_display_arrangement_update_cursor (CcDisplayArrangement *self,
- gboolean dragable)
-{
- g_autoptr(GdkCursor) cursor = NULL;
- GdkWindow *window;
-
- if (dragable)
- cursor = gdk_cursor_new_for_display (gtk_widget_get_display (GTK_WIDGET (self)), GDK_FLEUR);
- else
- cursor = NULL;
-
- window = gtk_widget_get_window (GTK_WIDGET (self));
-
- if (window)
- gdk_window_set_cursor (window, cursor);
-}
-
static void
on_output_changed_cb (CcDisplayArrangement *self,
CcDisplayMonitor *output)
@@ -524,17 +506,20 @@ on_output_changed_cb (CcDisplayArrangement *self,
gtk_widget_queue_draw (GTK_WIDGET (self));
}
-static gboolean
-cc_display_arrangement_draw (GtkWidget *widget,
- cairo_t *cr)
+static void
+cc_display_arrangement_draw (GtkDrawingArea *drawing_area,
+ cairo_t *cr,
+ gint width,
+ gint height,
+ gpointer user_data)
{
- CcDisplayArrangement *self = CC_DISPLAY_ARRANGEMENT (widget);
- GtkStyleContext *context = gtk_widget_get_style_context (widget);
+ CcDisplayArrangement *self = CC_DISPLAY_ARRANGEMENT (drawing_area);
+ GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET (self));
g_autoptr(GList) outputs = NULL;
GList *l;
if (!self->config)
- return FALSE;
+ return;
cc_display_arrangement_update_matrices (self);
@@ -584,7 +569,7 @@ cc_display_arrangement_draw (GtkWidget *widget,
cairo_translate (cr, x1, y1);
- gtk_style_context_get_margin (context, state, &margin);
+ gtk_style_context_get_margin (context, &margin);
cairo_translate (cr, margin.left, margin.top);
@@ -594,8 +579,8 @@ cc_display_arrangement_draw (GtkWidget *widget,
gtk_render_background (context, cr, 0, 0, w, h);
gtk_render_frame (context, cr, 0, 0, w, h);
- gtk_style_context_get_border (context, state, &border);
- gtk_style_context_get_padding (context, state, &padding);
+ gtk_style_context_get_border (context, &border);
+ gtk_style_context_get_padding (context, &padding);
w -= border.left + border.right + padding.left + padding.right;
h -= border.top + border.bottom + padding.top + padding.bottom;
@@ -605,7 +590,7 @@ cc_display_arrangement_draw (GtkWidget *widget,
if (num > 0)
{
PangoLayout *layout;
- PangoFontDescription *font = NULL;
+ //PangoFontDescription *font = NULL;
g_autofree gchar *number_str = NULL;
PangoRectangle extents;
GdkRGBA color;
@@ -614,16 +599,16 @@ cc_display_arrangement_draw (GtkWidget *widget,
gtk_style_context_add_class (context, "monitor-label");
gtk_style_context_remove_class (context, "monitor");
- gtk_style_context_get_border (context, state, &border);
- gtk_style_context_get_padding (context, state, &padding);
- gtk_style_context_get_margin (context, state, &margin);
+ gtk_style_context_get_border (context, &border);
+ gtk_style_context_get_padding (context, &padding);
+ gtk_style_context_get_margin (context, &margin);
cairo_translate (cr, margin.left, margin.top);
number_str = g_strdup_printf ("%d", num);
- gtk_style_context_get (context, state, "font", &font, NULL);
+ //gtk_style_context_get (context, state, "font", &font, NULL);
layout = gtk_widget_create_pango_layout (GTK_WIDGET (self), number_str);
- pango_layout_set_font_description (layout, font);
+ //pango_layout_set_font_description (layout, font);
pango_layout_get_extents (layout, NULL, &extents);
h = (extents.height - extents.y) / PANGO_SCALE;
@@ -640,7 +625,7 @@ cc_display_arrangement_draw (GtkWidget *widget,
cairo_translate (cr, border.left + padding.left, border.top + padding.top);
cairo_translate (cr, extents.x + text_padding / 2, 0);
- gtk_style_context_get_color (context, state, &color);
+ gtk_style_context_get_color (context, &color);
gdk_cairo_set_source_rgba (cr, &color);
gtk_render_layout (context, cr, 0, 0, layout);
@@ -652,15 +637,15 @@ cc_display_arrangement_draw (GtkWidget *widget,
}
gtk_style_context_restore (context);
-
- return TRUE;
}
static gboolean
-cc_display_arrangement_button_press_event (GtkWidget *widget,
- GdkEventButton *event)
+on_click_gesture_pressed_cb (GtkGestureClick *click_gesture,
+ gint n_press,
+ gdouble x,
+ gdouble y,
+ CcDisplayArrangement *self)
{
- CcDisplayArrangement *self = CC_DISPLAY_ARRANGEMENT (widget);
CcDisplayMonitor *output;
gdouble event_x, event_y;
gint mon_x, mon_y;
@@ -668,18 +653,14 @@ cc_display_arrangement_button_press_event (GtkWidget *widget,
if (!self->config)
return FALSE;
- /* Only handle normal presses of the left mouse button. */
- if (event->button != 1 || event->type != GDK_BUTTON_PRESS)
- return FALSE;
-
g_return_val_if_fail (self->drag_active == FALSE, FALSE);
- output = cc_display_arrangement_find_monitor_at (self, event->x, event->y);
+ output = cc_display_arrangement_find_monitor_at (self, x, y);
if (!output)
return FALSE;
- event_x = event->x;
- event_y = event->y;
+ event_x = x;
+ event_y = y;
cairo_matrix_transform_point (&self->to_actual, &event_x, &event_y);
cc_display_monitor_get_geometry (output, &mon_x, &mon_y, NULL, NULL);
@@ -697,40 +678,40 @@ cc_display_arrangement_button_press_event (GtkWidget *widget,
}
static gboolean
-cc_display_arrangement_button_release_event (GtkWidget *widget,
- GdkEventButton *event)
+on_click_gesture_released_cb (GtkGestureClick *click_gesture,
+ gint n_press,
+ gdouble x,
+ gdouble y,
+ CcDisplayArrangement *self)
{
- CcDisplayArrangement *self = CC_DISPLAY_ARRANGEMENT (widget);
CcDisplayMonitor *output;
if (!self->config)
return FALSE;
- /* Only handle left mouse button */
- if (event->button != 1)
- return FALSE;
-
if (!self->drag_active)
return FALSE;
self->drag_active = FALSE;
- output = cc_display_arrangement_find_monitor_at (self, event->x, event->y);
- cc_display_arrangement_update_cursor (self, output != NULL);
+ output = cc_display_arrangement_find_monitor_at (self, x, y);
+ gtk_widget_set_cursor_from_name (GTK_WIDGET (self),
+ output != NULL ? "fleur" : NULL);
/* And queue a redraw to recenter everything */
- gtk_widget_queue_draw (widget);
+ gtk_widget_queue_draw (GTK_WIDGET (self));
- g_signal_emit_by_name (G_OBJECT (widget), "updated");
+ g_signal_emit_by_name (G_OBJECT (self), "updated");
return TRUE;
}
static gboolean
-cc_display_arrangement_motion_notify_event (GtkWidget *widget,
- GdkEventMotion *event)
+on_motion_controller_motion_cb (GtkEventControllerMotion *motion_controller,
+ gdouble x,
+ gdouble y,
+ CcDisplayArrangement *self)
{
- CcDisplayArrangement *self = CC_DISPLAY_ARRANGEMENT (widget);
gdouble event_x, event_y;
gint mon_x, mon_y;
SnapData snap_data;
@@ -744,11 +725,12 @@ cc_display_arrangement_motion_notify_event (GtkWidget *widget,
if (!self->drag_active)
{
CcDisplayMonitor *output;
- output = cc_display_arrangement_find_monitor_at (self, event->x, event->y);
+ output = cc_display_arrangement_find_monitor_at (self, x, y);
- cc_display_arrangement_update_cursor (self, output != NULL);
+ gtk_widget_set_cursor_from_name (GTK_WIDGET (self),
+ output != NULL ? "fleur" : NULL);
if (self->prelit_output != output)
- gtk_widget_queue_draw (widget);
+ gtk_widget_queue_draw (GTK_WIDGET (self));
self->prelit_output = output;
@@ -757,8 +739,8 @@ cc_display_arrangement_motion_notify_event (GtkWidget *widget,
g_assert (self->selected_output);
- event_x = event->x;
- event_y = event->y;
+ event_x = x;
+ event_y = y;
cairo_matrix_transform_point (&self->to_actual, &event_x, &event_y);
@@ -843,17 +825,11 @@ static void
cc_display_arrangement_class_init (CcDisplayArrangementClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
gobject_class->finalize = cc_display_arrangement_finalize;
gobject_class->get_property = cc_display_arrangement_get_property;
gobject_class->set_property = cc_display_arrangement_set_property;
- widget_class->draw = cc_display_arrangement_draw;
- widget_class->button_press_event = cc_display_arrangement_button_press_event;
- widget_class->button_release_event = cc_display_arrangement_button_release_event;
- widget_class->motion_notify_event = cc_display_arrangement_motion_notify_event;
-
props[PROP_CONFIG] = g_param_spec_object ("config", "Display Config",
"The display configuration to work with",
CC_TYPE_DISPLAY_CONFIG,
@@ -878,9 +854,22 @@ cc_display_arrangement_class_init (CcDisplayArrangementClass *klass)
static void
cc_display_arrangement_init (CcDisplayArrangement *self)
{
- /* XXX: Do we need to listen to touch events here? */
- gtk_widget_add_events (GTK_WIDGET (self),
- GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK);
+ GtkEventController *motion_controller;
+ GtkGesture *click_gesture;
+
+ click_gesture = gtk_gesture_click_new ();
+ g_signal_connect (click_gesture, "pressed", G_CALLBACK (on_click_gesture_pressed_cb), self);
+ g_signal_connect (click_gesture, "released", G_CALLBACK (on_click_gesture_released_cb), self);
+ gtk_widget_add_controller (GTK_WIDGET (self), GTK_EVENT_CONTROLLER (click_gesture));
+
+ motion_controller = gtk_event_controller_motion_new ();
+ g_signal_connect (motion_controller, "motion", G_CALLBACK (on_motion_controller_motion_cb), self);
+ gtk_widget_add_controller (GTK_WIDGET (self), motion_controller);
+
+ gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (self),
+ cc_display_arrangement_draw,
+ self,
+ NULL);
self->major_snap_distance = MAJOR_SNAP_DISTANCE;
}
diff --git a/panels/display/cc-display-panel.c b/panels/display/cc-display-panel.c
index 91b3f3387..4f082aaa0 100644
--- a/panels/display/cc-display-panel.c
+++ b/panels/display/cc-display-panel.c
@@ -25,10 +25,8 @@
#include <stdlib.h>
#include <gdesktop-enums.h>
#include <math.h>
-#include <handy.h>
#include "shell/cc-object-storage.h"
-#include "list-box-helper.h"
#include <libupower-glib/upower.h>
#include "cc-display-config-manager-dbus.h"
@@ -83,31 +81,34 @@ struct _CcDisplayPanel
GDBusProxy *shell_proxy;
gchar *main_title;
- GtkWidget *main_titlebar;
GtkWidget *apply_titlebar;
GtkWidget *apply_titlebar_apply;
+ GtkWidget *apply_titlebar_cancel;
GtkWidget *apply_titlebar_warning;
GListStore *primary_display_list;
GtkListStore *output_selection_list;
- GtkWidget *arrangement_frame;
- GtkAlignment *arrangement_bin;
- GtkRadioButton *config_type_join;
- GtkRadioButton *config_type_mirror;
- GtkRadioButton *config_type_single;
- GtkWidget *config_type_switcher_frame;
+ GtkWidget *arrangement_group;
+ AdwBin *arrangement_bin;
+ GtkToggleButton *config_type_join;
+ GtkToggleButton *config_type_mirror;
+ GtkToggleButton *config_type_single;
+ GtkWidget *config_type_switcher_group;
GtkLabel *current_output_label;
- GtkWidget *display_settings_frame;
+ AdwBin *display_settings_bin;
GtkBox *multi_selection_box;
GtkSwitch *output_enabled_switch;
GtkComboBox *output_selection_combo;
GtkStack *output_selection_stack;
- GtkButtonBox *output_selection_two_buttonbox;
- GtkRadioButton *output_selection_two_first;
- GtkRadioButton *output_selection_two_second;
- HdyComboRow *primary_display_row;
+ GtkBox *output_selection_two_buttonbox;
+ GtkToggleButton *output_selection_two_first;
+ GtkToggleButton *output_selection_two_second;
+ AdwComboRow *primary_display_row;
GtkWidget *stack_switcher;
+
+ GtkShortcutController *toplevel_shortcuts;
+ GtkShortcut *escape_shortcut;
};
CC_PANEL_REGISTER (CcDisplayPanel, cc_display_panel)
@@ -404,7 +405,7 @@ ensure_monitor_labels (CcDisplayPanel *self)
for (w = windows; w; w = w->next)
{
- if (gtk_window_has_toplevel_focus (GTK_WINDOW (w->data)))
+ if (gtk_widget_has_focus (GTK_WIDGET (w->data)))
{
monitor_labeler_show (self);
break;
@@ -424,20 +425,16 @@ dialog_toplevel_focus_changed (CcDisplayPanel *self)
static void
reset_titlebar (CcDisplayPanel *self)
{
- GtkWidget *toplevel = cc_shell_get_toplevel (cc_panel_get_shell (CC_PANEL (self)));
+ CcShell *shell = cc_panel_get_shell (CC_PANEL (self));
- if (self->main_titlebar)
- {
- gtk_window_set_titlebar (GTK_WINDOW (toplevel), self->main_titlebar);
- g_clear_object (&self->main_titlebar);
+ gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (self->toplevel_shortcuts),
+ GTK_PHASE_NONE);
- /* The split header bar will not reset the window title, so do that here. */
- gtk_window_set_title (GTK_WINDOW (toplevel), self->main_title);
- g_clear_pointer (&self->main_title, g_free);
- }
+ cc_shell_set_custom_titlebar (shell, NULL);
g_clear_object (&self->apply_titlebar);
g_clear_object (&self->apply_titlebar_apply);
+ g_clear_object (&self->apply_titlebar_cancel);
g_clear_object (&self->apply_titlebar_warning);
}
@@ -473,7 +470,7 @@ cc_display_panel_dispose (GObject *object)
g_clear_object (&self->shell_proxy);
- g_clear_pointer ((GtkWidget **) &self->night_light_dialog, gtk_widget_destroy);
+ g_clear_pointer ((GtkWindow **) &self->night_light_dialog, gtk_window_destroy);
g_signal_handlers_disconnect_by_data (toplevel, self);
@@ -498,7 +495,7 @@ on_monitor_settings_updated_cb (CcDisplayPanel *panel,
static void
on_config_type_toggled_cb (CcDisplayPanel *panel,
- GtkRadioButton *btn)
+ GtkCheckButton *btn)
{
CcDisplayConfigType type;
@@ -528,8 +525,7 @@ on_night_light_list_box_row_activated_cb (CcDisplayPanel *panel)
panel->night_light_dialog = (GtkDialog *)gtk_dialog_new ();
content_area = gtk_dialog_get_content_area (panel->night_light_dialog);
- gtk_container_add (GTK_CONTAINER (content_area),
- GTK_WIDGET (panel->night_light_page));
+ gtk_box_append (GTK_BOX (content_area), GTK_WIDGET (panel->night_light_page));
gtk_widget_show (GTK_WIDGET (panel->night_light_page));
}
@@ -599,7 +595,7 @@ on_output_selection_combo_changed_cb (CcDisplayPanel *panel)
}
static void
-on_output_selection_two_toggled_cb (CcDisplayPanel *panel, GtkRadioButton *btn)
+on_output_selection_two_toggled_cb (CcDisplayPanel *panel, GtkCheckButton *btn)
{
CcDisplayMonitor *output;
@@ -633,7 +629,7 @@ on_output_selection_two_toggled_cb (CcDisplayPanel *panel, GtkRadioButton *btn)
static void
on_primary_display_selected_index_changed_cb (CcDisplayPanel *panel)
{
- gint idx = hdy_combo_row_get_selected_index (panel->primary_display_row);
+ gint idx = adw_combo_row_get_selected (panel->primary_display_row);
g_autoptr(CcDisplayMonitor) output = NULL;
if (idx < 0 || panel->rebuilding_counter > 0)
@@ -657,6 +653,20 @@ on_toplevel_folded (CcDisplayPanel *panel, GParamSpec *pspec, GtkWidget *topleve
cc_display_settings_refresh_layout (panel->settings, folded);
}
+static gboolean
+on_toplevel_escape_pressed_cb (GtkWidget *widget,
+ GVariant *args,
+ CcDisplayPanel *self)
+{
+ if (self->apply_titlebar_cancel)
+ {
+ g_signal_emit_by_name (self->apply_titlebar_cancel, "activate");
+ return GDK_EVENT_STOP;
+ }
+
+ return GDK_EVENT_PROPAGATE;
+}
+
static void
cc_display_panel_constructed (GObject *object)
{
@@ -702,14 +712,15 @@ cc_display_panel_class_init (CcDisplayPanelClass *klass)
gtk_widget_class_set_template_from_resource (widget_class,
"/org/gnome/control-center/display/cc-display-panel.ui");
- gtk_widget_class_bind_template_child (widget_class, CcDisplayPanel, arrangement_frame);
+ gtk_widget_class_bind_template_child (widget_class, CcDisplayPanel, arrangement_group);
gtk_widget_class_bind_template_child (widget_class, CcDisplayPanel, arrangement_bin);
- gtk_widget_class_bind_template_child (widget_class, CcDisplayPanel, config_type_switcher_frame);
+ gtk_widget_class_bind_template_child (widget_class, CcDisplayPanel, config_type_switcher_group);
gtk_widget_class_bind_template_child (widget_class, CcDisplayPanel, config_type_join);
gtk_widget_class_bind_template_child (widget_class, CcDisplayPanel, config_type_mirror);
gtk_widget_class_bind_template_child (widget_class, CcDisplayPanel, config_type_single);
gtk_widget_class_bind_template_child (widget_class, CcDisplayPanel, current_output_label);
- gtk_widget_class_bind_template_child (widget_class, CcDisplayPanel, display_settings_frame);
+ gtk_widget_class_bind_template_child (widget_class, CcDisplayPanel, display_settings_bin);
+ gtk_widget_class_bind_template_child (widget_class, CcDisplayPanel, escape_shortcut);
gtk_widget_class_bind_template_child (widget_class, CcDisplayPanel, multi_selection_box);
gtk_widget_class_bind_template_child (widget_class, CcDisplayPanel, night_light_page);
gtk_widget_class_bind_template_child (widget_class, CcDisplayPanel, output_enabled_switch);
@@ -720,6 +731,7 @@ cc_display_panel_class_init (CcDisplayPanelClass *klass)
gtk_widget_class_bind_template_child (widget_class, CcDisplayPanel, output_selection_two_second);
gtk_widget_class_bind_template_child (widget_class, CcDisplayPanel, primary_display_row);
gtk_widget_class_bind_template_child (widget_class, CcDisplayPanel, stack_switcher);
+ gtk_widget_class_bind_template_child (widget_class, CcDisplayPanel, toplevel_shortcuts);
gtk_widget_class_bind_template_callback (widget_class, on_config_type_toggled_cb);
gtk_widget_class_bind_template_callback (widget_class, on_night_light_list_box_row_activated_cb);
@@ -727,6 +739,7 @@ cc_display_panel_class_init (CcDisplayPanelClass *klass)
gtk_widget_class_bind_template_callback (widget_class, on_output_selection_combo_changed_cb);
gtk_widget_class_bind_template_callback (widget_class, on_output_selection_two_toggled_cb);
gtk_widget_class_bind_template_callback (widget_class, on_primary_display_selected_index_changed_cb);
+ gtk_widget_class_bind_template_callback (widget_class, on_toplevel_escape_pressed_cb);
}
static void
@@ -853,8 +866,8 @@ rebuild_ui (CcDisplayPanel *panel)
g_list_store_append (panel->primary_display_list, output);
if (cc_display_monitor_is_primary (output))
- hdy_combo_row_set_selected_index (panel->primary_display_row,
- g_list_model_get_n_items (G_LIST_MODEL
(panel->primary_display_list)) - 1);
+ adw_combo_row_set_selected (panel->primary_display_row,
+ g_list_model_get_n_items (G_LIST_MODEL
(panel->primary_display_list)) - 1);
/* Ensure that an output is selected; note that this doesn't ensure
* the selected output is any useful (i.e. when switching types).
@@ -879,8 +892,8 @@ rebuild_ui (CcDisplayPanel *panel)
if (type > CC_DISPLAY_CONFIG_LAST_VALID)
type = CC_DISPLAY_CONFIG_JOIN;
- gtk_widget_set_visible (panel->config_type_switcher_frame, TRUE);
- gtk_widget_set_visible (panel->arrangement_frame, type == CC_DISPLAY_CONFIG_JOIN);
+ gtk_widget_set_visible (panel->config_type_switcher_group, TRUE);
+ gtk_widget_set_visible (panel->arrangement_group, type == CC_DISPLAY_CONFIG_JOIN);
/* We need a switcher except in CLONE mode */
if (type == CC_DISPLAY_CONFIG_CLONE)
@@ -893,8 +906,8 @@ rebuild_ui (CcDisplayPanel *panel)
/* We have more than one usable monitor. In this case there is no chooser,
* and we always show the arrangement widget even if we are in SINGLE mode.
*/
- gtk_widget_set_visible (panel->config_type_switcher_frame, FALSE);
- gtk_widget_set_visible (panel->arrangement_frame, TRUE);
+ gtk_widget_set_visible (panel->config_type_switcher_group, FALSE);
+ gtk_widget_set_visible (panel->arrangement_group, TRUE);
/* Mirror is also invalid as it cannot be configured using this UI. */
if (type == CC_DISPLAY_CONFIG_CLONE || type > CC_DISPLAY_CONFIG_LAST_VALID)
@@ -909,8 +922,8 @@ rebuild_ui (CcDisplayPanel *panel)
* mode (and not e.g. mirroring across one display) */
type = CC_DISPLAY_CONFIG_SINGLE;
- gtk_widget_set_visible (panel->config_type_switcher_frame, FALSE);
- gtk_widget_set_visible (panel->arrangement_frame, FALSE);
+ gtk_widget_set_visible (panel->config_type_switcher_group, FALSE);
+ gtk_widget_set_visible (panel->arrangement_group, FALSE);
gtk_stack_set_visible_child (panel->output_selection_stack, GTK_WIDGET (panel->current_output_label));
}
@@ -997,70 +1010,57 @@ on_screen_changed (CcDisplayPanel *panel)
ensure_monitor_labels (panel);
}
-static gboolean
-on_toplevel_key_press (GtkWidget *button,
- GdkEventKey *event)
-{
- if (event->keyval != GDK_KEY_Escape)
- return GDK_EVENT_PROPAGATE;
-
- g_signal_emit_by_name (button, "activate");
- return GDK_EVENT_STOP;
-}
-
static void
show_apply_titlebar (CcDisplayPanel *panel, gboolean is_applicable)
{
+ GtkWidget *title;
+
if (!panel->apply_titlebar)
{
g_autoptr(GtkSizeGroup) size_group = NULL;
- GtkWidget *header, *button, *toplevel;
+ GtkWidget *header, *button;
+ CcShell *shell;
+
+ shell = cc_panel_get_shell (CC_PANEL (panel));
+
panel->apply_titlebar = header = gtk_header_bar_new ();
- gtk_widget_show (header);
+ gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (header), FALSE);
size_group = gtk_size_group_new (GTK_SIZE_GROUP_VERTICAL);
- button = gtk_button_new_with_mnemonic (_("_Cancel"));
- gtk_widget_show (button);
+ panel->apply_titlebar_cancel = button = gtk_button_new_with_mnemonic (_("_Cancel"));
gtk_header_bar_pack_start (GTK_HEADER_BAR (header), button);
gtk_size_group_add_widget (size_group, button);
g_signal_connect_object (button, "clicked", G_CALLBACK (on_screen_changed),
panel, G_CONNECT_SWAPPED);
- toplevel = cc_shell_get_toplevel (cc_panel_get_shell (CC_PANEL (panel)));
- g_signal_connect_object (toplevel, "key-press-event", G_CALLBACK (on_toplevel_key_press),
- button, G_CONNECT_SWAPPED);
-
panel->apply_titlebar_apply = button = gtk_button_new_with_mnemonic (_("_Apply"));
- gtk_widget_show (button);
gtk_header_bar_pack_end (GTK_HEADER_BAR (header), button);
gtk_size_group_add_widget (size_group, button);
g_signal_connect_object (button, "clicked", G_CALLBACK (apply_current_configuration),
panel, G_CONNECT_SWAPPED);
- gtk_style_context_add_class (gtk_widget_get_style_context (button),
- GTK_STYLE_CLASS_SUGGESTED_ACTION);
-
- header = gtk_window_get_titlebar (GTK_WINDOW (toplevel));
- if (header)
- panel->main_titlebar = g_object_ref (header);
- panel->main_title = g_strdup (gtk_window_get_title (GTK_WINDOW (toplevel)));
+ gtk_widget_add_css_class (button, "suggested-action");
- gtk_window_set_titlebar (GTK_WINDOW (toplevel), panel->apply_titlebar);
+ cc_shell_set_custom_titlebar (shell, panel->apply_titlebar);
g_object_ref (panel->apply_titlebar);
g_object_ref (panel->apply_titlebar_apply);
+ g_object_ref (panel->apply_titlebar_cancel);
}
if (is_applicable)
{
- gtk_header_bar_set_title (GTK_HEADER_BAR (panel->apply_titlebar), _("Apply Changes?"));
- gtk_header_bar_set_subtitle (GTK_HEADER_BAR (panel->apply_titlebar), NULL);
+ title = adw_window_title_new (_("Apply Changes?"), NULL);
}
else
{
- gtk_header_bar_set_title (GTK_HEADER_BAR (panel->apply_titlebar), _("Changes Cannot be Applied"));
- gtk_header_bar_set_subtitle (GTK_HEADER_BAR (panel->apply_titlebar), _("This could be due to hardware
limitations."));
+ title = adw_window_title_new (_("Changes Cannot be Applied"),
+ _("This could be due to hardware limitations."));
}
+ gtk_header_bar_set_title_widget (GTK_HEADER_BAR (panel->apply_titlebar), title);
gtk_widget_set_sensitive (panel->apply_titlebar_apply, is_applicable);
+
+ gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (panel->toplevel_shortcuts),
+ GTK_PHASE_BUBBLE);
}
static void
@@ -1179,16 +1179,15 @@ cc_display_panel_init (CcDisplayPanel *self)
{
g_autoptr(GtkCssProvider) provider = NULL;
GtkCellRenderer *renderer;
+ GtkExpression *expression;
g_resources_register (cc_display_get_resource ());
gtk_widget_init_template (GTK_WIDGET (self));
self->arrangement = cc_display_arrangement_new (NULL);
-
- gtk_widget_show (GTK_WIDGET (self->arrangement));
gtk_widget_set_size_request (GTK_WIDGET (self->arrangement), 400, 175);
- gtk_container_add (GTK_CONTAINER (self->arrangement_bin), GTK_WIDGET (self->arrangement));
+ adw_bin_set_child (self->arrangement_bin, GTK_WIDGET (self->arrangement));
g_signal_connect_object (self->arrangement, "updated",
G_CALLBACK (update_apply_button), self,
@@ -1198,17 +1197,20 @@ cc_display_panel_init (CcDisplayPanel *self)
G_CONNECT_SWAPPED);
self->settings = cc_display_settings_new ();
- gtk_widget_show (GTK_WIDGET (self->settings));
- gtk_container_add (GTK_CONTAINER (self->display_settings_frame), GTK_WIDGET (self->settings));
+ adw_bin_set_child (self->display_settings_bin, GTK_WIDGET (self->settings));
g_signal_connect_object (self->settings, "updated",
G_CALLBACK (on_monitor_settings_updated_cb), self,
G_CONNECT_SWAPPED);
self->primary_display_list = g_list_store_new (CC_TYPE_DISPLAY_MONITOR);
- hdy_combo_row_bind_name_model (self->primary_display_row,
- G_LIST_MODEL (self->primary_display_list),
- (HdyComboRowGetNameFunc) cc_display_monitor_dup_ui_number_name,
- NULL, NULL);
+
+ expression = gtk_cclosure_expression_new (G_TYPE_STRING,
+ NULL, 0, NULL,
+ G_CALLBACK (cc_display_monitor_dup_ui_number_name),
+ self, NULL);
+ adw_combo_row_set_expression (self->primary_display_row, expression);
+ adw_combo_row_set_model (self->primary_display_row,
+ G_LIST_MODEL (self->primary_display_list));
self->output_selection_list = gtk_list_store_new (2, G_TYPE_STRING, CC_TYPE_DISPLAY_MONITOR);
gtk_combo_box_set_model (self->output_selection_combo, GTK_TREE_MODEL (self->output_selection_list));
@@ -1253,7 +1255,12 @@ cc_display_panel_init (CcDisplayPanel *self)
provider = gtk_css_provider_new ();
gtk_css_provider_load_from_resource (provider,
"/org/gnome/control-center/display/display-arrangement.css");
- gtk_style_context_add_provider_for_screen (gdk_screen_get_default (),
- GTK_STYLE_PROVIDER (provider),
- GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+ gtk_style_context_add_provider_for_display (gdk_display_get_default (),
+ GTK_STYLE_PROVIDER (provider),
+ GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+
+ gtk_shortcut_set_action (self->escape_shortcut,
+ gtk_callback_action_new ((GtkShortcutFunc) on_toplevel_escape_pressed_cb,
+ self,
+ NULL));
}
diff --git a/panels/display/cc-display-panel.ui b/panels/display/cc-display-panel.ui
index 855b34814..96064c864 100644
--- a/panels/display/cc-display-panel.ui
+++ b/panels/display/cc-display-panel.ui
@@ -1,284 +1,197 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.0 -->
<interface>
- <requires lib="gtk+" version="3.20"/>
- <requires lib="libhandy" version="0.0"/>
- <object class="GtkImage" id="image-join-displays">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <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="icon_name">video-joined-displays-symbolic</property>
- <property name="icon_size">3</property>
- </object>
- <object class="GtkImage" id="image-mirror">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <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="icon_name">view-mirror-symbolic</property>
- <property name="icon_size">3</property>
- </object>
- <object class="GtkImage" id="image-single-display">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <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="icon_name">video-single-display-symbolic</property>
- <property name="icon_size">3</property>
- </object>
<object class="GtkStackSwitcher" id="stack_switcher">
- <property name="visible">True</property>
<property name="stack">stack</property>
</object>
<template class="CcDisplayPanel" parent="CcPanel">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
+
+ <child>
+ <object class="GtkShortcutController" id="toplevel_shortcuts">
+ <property name="scope">global</property>
+ <property name="name">Display Panel Globals Shortcuts</property>
+ <child>
+ <object class="GtkShortcut" id="escape_shortcut">
+ <property name="trigger">Escape</property>
+ <property name="action">callback(on_toplevel_escape_pressed_cb)</property>
+ </object>
+ </child>
+ </object>
+ </child>
+
<child>
<object class="GtkStack" id="stack">
- <property name="visible">True</property>
<property name="transition-type">crossfade</property>
<!-- Displays page -->
<child>
- <object class="GtkScrolledWindow">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hscrollbar_policy">never</property>
- <child>
- <object class="GtkViewport">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="shadow_type">none</property>
+ <object class="GtkStackPage">
+ <property name="name">displays</property>
+ <property name="title" translatable="yes">Displays</property>
+ <property name="child">
+ <object class="GtkScrolledWindow">
+ <property name="hscrollbar_policy">never</property>
<child>
- <object class="HdyClamp">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="valign">start</property>
- <property name="margin_top">32</property>
- <property name="margin_bottom">32</property>
- <property name="margin_start">12</property>
- <property name="margin_end">12</property>
+ <object class="GtkViewport">
<child>
- <object class="GtkBox">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <property name="orientation">vertical</property>
- <property name="spacing">32</property>
+ <object class="AdwClamp">
+ <property name="valign">start</property>
+ <property name="margin_top">32</property>
+ <property name="margin_bottom">32</property>
+ <property name="margin_start">12</property>
+ <property name="margin_end">12</property>
<child>
- <object class="GtkFrame" id="config_type_switcher_frame">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label_xalign">0</property>
- <property name="shadow_type">none</property>
+ <object class="GtkBox">
+ <property name="hexpand">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">32</property>
<child>
- <object class="GtkButtonBox">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="homogeneous">True</property>
- <property name="layout_style">expand</property>
+ <object class="AdwPreferencesGroup" id="config_type_switcher_group">
+ <property name="title" translatable="yes">Display Mode</property>
<child>
- <object class="GtkRadioButton" id="config_type_single">
- <property name="label" translatable="yes">Single Display</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="image">image-single-display</property>
- <property name="always_show_image">True</property>
- <property name="active">True</property>
- <property name="draw_indicator">False</property>
- <property name="group">config_type_join</property>
- <signal name="toggled" handler="on_config_type_toggled_cb"
swapped="yes"/>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkRadioButton" id="config_type_join">
- <property name="label" translatable="yes">Join Displays</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="image">image-join-displays</property>
- <property name="always_show_image">True</property>
- <property name="active">True</property>
- <property name="draw_indicator">False</property>
- <signal name="toggled" handler="on_config_type_toggled_cb"
swapped="yes"/>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkRadioButton" id="config_type_mirror">
- <property name="label" translatable="yes">Mirror</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="image">image-mirror</property>
- <property name="always_show_image">True</property>
- <property name="active">True</property>
- <property name="draw_indicator">False</property>
- <property name="group">config_type_join</property>
- <signal name="toggled" handler="on_config_type_toggled_cb"
swapped="yes"/>
+ <object class="GtkBox">
+ <property name="homogeneous">True</property>
+ <style>
+ <class name="linked" />
+ </style>
+ <child>
+ <object class="GtkToggleButton" id="config_type_join">
+ <property name="hexpand">True</property>
+ <property name="active">True</property>
+ <signal name="toggled" handler="on_config_type_toggled_cb"
swapped="yes"/>
+ <child>
+ <object class="GtkBox">
+ <property name="halign">center</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkImage">
+ <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="icon_name">video-joined-displays-symbolic</property>
+ <property name="icon_size">large</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="label" translatable="yes">Join
Displays</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkToggleButton" id="config_type_mirror">
+ <property name="hexpand">True</property>
+ <property name="group">config_type_join</property>
+ <signal name="toggled" handler="on_config_type_toggled_cb"
swapped="yes"/>
+ <child>
+ <object class="GtkBox">
+ <property name="halign">center</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkImage">
+ <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="icon_name">view-mirror-symbolic</property>
+ <property name="icon_size">large</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="label" translatable="yes">Mirror</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkToggleButton" id="config_type_single">
+ <property name="hexpand">True</property>
+ <property name="group">config_type_join</property>
+ <signal name="toggled" handler="on_config_type_toggled_cb"
swapped="yes"/>
+ <child>
+ <object class="GtkBox">
+ <property name="halign">center</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkImage">
+ <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="icon_name">video-single-display-symbolic</property>
+ <property name="icon_size">large</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="label" translatable="yes">Single
Display</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
</object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
</child>
</object>
</child>
- <child type="label">
- <object class="GtkLabel">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="halign">start</property>
- <property name="margin_bottom">12</property>
- <property name="label" translatable="yes">Display Mode</property>
- <attributes>
- <attribute name="weight" value="bold"/>
- </attributes>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkFrame" id="arrangement_frame">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label_xalign">0</property>
- <property name="label_yalign">1</property>
- <property name="shadow_type">none</property>
<child>
- <object class="GtkBox">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="orientation">vertical</property>
- <property name="spacing">12</property>
+ <object class="AdwPreferencesGroup" id="arrangement_group">
+ <property name="description" translatable="yes">Drag displays to match your
physical display setup. Select a display to change its settings.</property>
<child>
- <object class="GtkFrame">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label_xalign">0</property>
- <property name="shadow_type">in</property>
+ <object class="GtkBox">
+ <property name="orientation">vertical</property>
+ <property name="spacing">12</property>
<child>
- <object class="GtkAlignment" id="arrangement_bin">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
+ <object class="GtkFrame">
<child>
- <placeholder/>
+ <object class="AdwBin" id="arrangement_bin" />
</child>
+ <style>
+ <class name="view"/>
+ </style>
</object>
</child>
- <child type="label_item">
- <placeholder/>
- </child>
- <style>
- <class name="view"/>
- </style>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkFrame">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label_xalign">0</property>
- <property name="shadow_type">in</property>
<child>
- <object class="GtkListBox">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="selection_mode">none</property>
+ <object class="GtkFrame">
<child>
- <object class="HdyComboRow" id="primary_display_row">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="subtitle" translatable="yes">Contains top bar
and Activities</property>
- <property name="title" translatable="yes">Primary
Display</property>
- <signal name="notify::selected-index"
handler="on_primary_display_selected_index_changed_cb" swapped="yes"/>
+ <object class="GtkListBox">
+ <property name="selection_mode">none</property>
+ <child>
+ <object class="AdwComboRow" id="primary_display_row">
+ <property name="subtitle" translatable="yes">Contains top
bar and Activities</property>
+ <property name="title" translatable="yes">Primary
Display</property>
+ <signal name="notify::selected-index"
handler="on_primary_display_selected_index_changed_cb" swapped="yes"/>
+ </object>
+ </child>
</object>
</child>
</object>
</child>
- <child type="label_item">
- <placeholder/>
- </child>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
</child>
+ <accessibility>
+ <property name="label" translatable="yes">Display Arrangement</property>
+ </accessibility>
</object>
</child>
- <child type="label">
- <object class="GtkLabel">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Drag displays to match your
physical display setup. Select a display to change its settings.</property>
- <property name="wrap">True</property>
- <property name="margin_bottom">12</property>
- </object>
- </child>
- <child internal-child="accessible">
- <object class="AtkObject" id="frame_arrangement-atkobject">
- <property name="AtkObject::accessible-name" translatable="yes">Display
Arrangement</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkFrame">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label_xalign">0</property>
- <property name="shadow_type">none</property>
<child>
<object class="GtkBox">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child>
<object class="GtkStack" id="output_selection_stack">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="hhomogeneous">False</property>
<property name="vhomogeneous">False</property>
<child>
<object class="GtkLabel" id="current_output_label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="halign">start</property>
<attributes>
<attribute name="weight" value="bold"/>
@@ -286,170 +199,88 @@
</object>
</child>
<child>
- <object class="GtkButtonBox" id="output_selection_two_buttonbox">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="layout_style">expand</property>
+ <object class="GtkBox" id="output_selection_two_buttonbox">
+ <style>
+ <class name="linked" />
+ </style>
<child>
- <object class="GtkRadioButton" id="output_selection_two_first">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="draw_indicator">False</property>
+ <object class="GtkToggleButton" id="output_selection_two_first">
+ <property name="hexpand">True</property>
<property name="group">output_selection_two_second</property>
<signal name="toggled"
handler="on_output_selection_two_toggled_cb" swapped="yes"/>
</object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
</child>
<child>
- <object class="GtkRadioButton" id="output_selection_two_second">
+ <object class="GtkToggleButton" id="output_selection_two_second">
+ <property name="hexpand">True</property>
<property name="label" translatable="yes">Join
Displays</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="draw_indicator">False</property>
<signal name="toggled"
handler="on_output_selection_two_toggled_cb" swapped="yes"/>
</object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
</child>
</object>
</child>
<child>
<object class="GtkBox" id="multi_selection_box">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
<child>
<object class="GtkComboBox" id="output_selection_combo">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="halign">start</property>
<property name="hexpand">True</property>
<signal name="changed"
handler="on_output_selection_combo_changed_cb" swapped="yes"/>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
</child>
<child>
<object class="GtkSwitch" id="output_enabled_switch">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
<property name="halign">end</property>
<property name="valign">center</property>
<signal name="notify::active"
handler="on_output_enabled_active_changed_cb" swapped="yes"/>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
+ </object>>
</child>
</object>
</child>
<child>
<object class="GtkFrame">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label_xalign">0</property>
- <property name="shadow_type">in</property>
<child>
<object class="GtkListBox">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="selection_mode">none</property>
<child>
- <object class="HdyComboRow">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
+ <object class="AdwComboRow">
<property name="title" translatable="yes">Active
Display</property>
</object>
</child>
</object>
</child>
- <child type="label_item">
- <placeholder/>
- </child>
</object>
- <packing>
- <property name="name">single-select</property>
- <property name="position">3</property>
- </packing>
</child>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
</child>
<child>
- <object class="GtkFrame" id="display_settings_frame">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label_xalign">0</property>
- <property name="shadow_type">in</property>
- <child>
- <placeholder/>
- </child>
- <child type="label_item">
- <placeholder/>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
+ <object class="AdwBin" id="display_settings_bin" />
</child>
- </object>
- </child>
- <child type="label_item">
- <placeholder/>
- </child>
- <child internal-child="accessible">
- <object class="AtkObject">
- <property name="AtkObject::accessible-name" translatable="yes">Display
Configuration</property>
+ <accessibility>
+ <property name="label" translatable="yes">Display Configuration</property>
+ </accessibility>
</object>
</child>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">2</property>
- </packing>
</child>
</object>
</child>
</object>
</child>
</object>
- </child>
+ </property>
</object>
- <packing>
- <property name="name">displays</property>
- <property name="title" translatable="yes">Displays</property>
- </packing>
</child>
<!-- Night Light page -->
<child>
- <object class="CcNightLightPage" id="night_light_page">
- <property name="visible">True</property>
- </object>
- <packing>
+ <object class="GtkStackPage">
<property name="name">night-light</property>
<property name="title" translatable="yes" comments="This is the redshift functionality where we
suppress blue light when the sun has gone down">Night Light</property>
- </packing>
+ <property name="child">
+ <object class="CcNightLightPage" id="night_light_page" />
+ </property>
+ </object>
</child>
</object>
diff --git a/panels/display/cc-display-settings.c b/panels/display/cc-display-settings.c
index efda19473..2d83972f2 100644
--- a/panels/display/cc-display-settings.c
+++ b/panels/display/cc-display-settings.c
@@ -20,11 +20,9 @@
*/
#include <float.h>
-#include <handy.h>
#include <glib/gi18n.h>
#include <float.h>
#include <math.h>
-#include "list-box-helper.h"
#include "cc-display-settings.h"
#include "cc-display-config.h"
@@ -32,7 +30,7 @@
struct _CcDisplaySettings
{
- GtkDrawingArea object;
+ AdwBin object;
gboolean updating;
gboolean num_scales;
@@ -43,10 +41,10 @@ struct _CcDisplaySettings
CcDisplayConfig *config;
CcDisplayMonitor *selected_output;
- GListStore *orientation_list;
+ GListModel *orientation_list;
GListStore *refresh_rate_list;
GListStore *resolution_list;
- GListStore *scale_list;
+ GListModel *scale_list;
GtkWidget *orientation_row;
GtkWidget *refresh_rate_row;
@@ -68,7 +66,7 @@ enum {
PROP_LAST
};
-G_DEFINE_TYPE (CcDisplaySettings, cc_display_settings, GTK_TYPE_LIST_BOX)
+G_DEFINE_TYPE (CcDisplaySettings, cc_display_settings, ADW_TYPE_BIN)
static GParamSpec *props[PROP_LAST];
@@ -170,15 +168,22 @@ make_aspect_string (gint width,
return aspect;
}
-static char *
+static gchar *
+make_refresh_rate_string (CcDisplayMode *mode)
+{
+ return g_strdup_printf (_("%.2lf Hz"), cc_display_mode_get_freq_f (mode));
+}
+
+static gchar *
make_resolution_string (CcDisplayMode *mode)
{
- const char *interlaced = cc_display_mode_is_interlaced (mode) ? "i" : "";
+ const char *interlaced;
const char *aspect;
int width, height;
cc_display_mode_get_resolution (mode, &width, &height);
aspect = make_aspect_string (width, height);
+ interlaced = cc_display_mode_is_interlaced (mode) ? "i" : "";
if (aspect != NULL)
return g_strdup_printf ("%d × %d%s (%s)", width, height, interlaced, aspect);
@@ -186,12 +191,6 @@ make_resolution_string (CcDisplayMode *mode)
return g_strdup_printf ("%d × %d%s", width, height, interlaced);
}
-static gchar *
-get_frequency_string (CcDisplayMode *mode)
-{
- return g_strdup_printf (_("%.2lf Hz"), cc_display_mode_get_freq_f (mode));
-}
-
static double
round_scale_for_ui (double scale)
{
@@ -232,11 +231,12 @@ sort_modes_by_freq_desc (CcDisplayMode *a, CcDisplayMode *b)
static gboolean
cc_display_settings_rebuild_ui (CcDisplaySettings *self)
{
+ GtkWidget *child;
GList *modes;
GList *item;
gint width, height;
CcDisplayMode *current_mode;
- GtkRadioButton *group = NULL;
+ GtkToggleButton *group = NULL;
g_autoptr(GArray) scales = NULL;
gint i;
@@ -283,21 +283,25 @@ cc_display_settings_rebuild_ui (CcDisplaySettings *self)
gtk_widget_set_visible (self->orientation_row, TRUE);
- g_list_store_remove_all (self->orientation_list);
+ gtk_string_list_splice (GTK_STRING_LIST (self->orientation_list),
+ 0,
+ g_list_model_get_n_items (self->orientation_list),
+ NULL);
for (i = 0; i < G_N_ELEMENTS (rotations); i++)
{
- g_autoptr(HdyValueObject) obj = NULL;
+ g_autoptr(GObject) obj = NULL;
if (!cc_display_monitor_supports_rotation (self->selected_output, rotations[i]))
continue;
- obj = hdy_value_object_new_collect (G_TYPE_STRING, string_for_rotation (rotations[i]));
- g_list_store_append (self->orientation_list, obj);
+ gtk_string_list_append (GTK_STRING_LIST (self->orientation_list),
+ string_for_rotation (rotations[i]));
+ obj = g_list_model_get_item (self->orientation_list, i);
g_object_set_data (G_OBJECT (obj), "rotation-value", GINT_TO_POINTER (rotations[i]));
if (cc_display_monitor_get_rotation (self->selected_output) == rotations[i])
- hdy_combo_row_set_selected_index (HDY_COMBO_ROW (self->orientation_row),
- g_list_model_get_n_items (G_LIST_MODEL
(self->orientation_list)) - 1);
+ adw_combo_row_set_selected (ADW_COMBO_ROW (self->orientation_row),
+ g_list_model_get_n_items (G_LIST_MODEL (self->orientation_list)) -
1);
}
}
else
@@ -335,7 +339,7 @@ cc_display_settings_rebuild_ui (CcDisplaySettings *self)
(GCompareDataFunc) sort_modes_by_freq_desc,
NULL);
if (freq == cc_display_mode_get_freq_f (mode))
- hdy_combo_row_set_selected_index (HDY_COMBO_ROW (self->refresh_rate_row), new);
+ adw_combo_row_set_selected (ADW_COMBO_ROW (self->refresh_rate_row), new);
}
/* Show if we have more than one frequency to choose from. */
@@ -357,7 +361,7 @@ cc_display_settings_rebuild_ui (CcDisplaySettings *self)
g_list_store_remove_all (self->resolution_list);
g_list_store_append (self->resolution_list, current_mode);
- hdy_combo_row_set_selected_index (HDY_COMBO_ROW (self->resolution_row), 0);
+ adw_combo_row_set_selected (ADW_COMBO_ROW (self->resolution_row), 0);
for (item = modes; item != NULL; item = item->next)
{
gint ins;
@@ -393,14 +397,19 @@ cc_display_settings_rebuild_ui (CcDisplaySettings *self)
/* Scale row is usually shown. */
- gtk_container_foreach (GTK_CONTAINER (self->scale_bbox), (GtkCallback) gtk_widget_destroy, NULL);
- g_list_store_remove_all (self->scale_list);
+ while ((child = gtk_widget_get_first_child (self->scale_bbox)) != NULL)
+ gtk_box_remove (GTK_BOX (self->scale_bbox), child);
+
+ gtk_string_list_splice (GTK_STRING_LIST (self->scale_list),
+ 0,
+ g_list_model_get_n_items (self->scale_list),
+ NULL);
scales = cc_display_mode_get_supported_scales (current_mode);
self->num_scales = scales->len;
for (i = 0; i < scales->len; i++)
{
g_autofree gchar *scale_str = NULL;
- g_autoptr(HdyValueObject) value_object = NULL;
+ g_autoptr(GObject) value_object = NULL;
double scale = g_array_index (scales, double, i);
GtkWidget *scale_btn;
gboolean is_selected;
@@ -410,24 +419,23 @@ cc_display_settings_rebuild_ui (CcDisplaySettings *self)
is_selected = G_APPROX_VALUE (cc_display_monitor_get_scale (self->selected_output),
scale, DBL_EPSILON);
- value_object = hdy_value_object_new_collect (G_TYPE_STRING, scale_str);
- g_list_store_append (self->scale_list, value_object);
+ gtk_string_list_append (GTK_STRING_LIST (self->scale_list), scale_str);
+ value_object = g_list_model_get_item (self->scale_list, i);
g_object_set_data_full (G_OBJECT (value_object), "scale",
g_memdup2 (&scale, sizeof (double)), g_free);
if (is_selected)
- hdy_combo_row_set_selected_index (HDY_COMBO_ROW (self->scale_combo_row),
- g_list_model_get_n_items (G_LIST_MODEL (self->scale_list)) - 1);
+ adw_combo_row_set_selected (ADW_COMBO_ROW (self->scale_combo_row),
+ g_list_model_get_n_items (G_LIST_MODEL (self->scale_list)) - 1);
/* ButtonBox */
- scale_btn = gtk_radio_button_new_with_label_from_widget (group, scale_str);
+ scale_btn = gtk_toggle_button_new_with_label (scale_str);
+ gtk_toggle_button_set_group (GTK_TOGGLE_BUTTON (scale_btn), group);
g_object_set_data_full (G_OBJECT (scale_btn), "scale",
g_memdup2 (&scale, sizeof (double)), g_free);
if (!group)
- group = GTK_RADIO_BUTTON (scale_btn);
- gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (scale_btn), FALSE);
- gtk_widget_show (scale_btn);
- gtk_container_add (GTK_CONTAINER (self->scale_bbox), scale_btn);
+ group = GTK_TOGGLE_BUTTON (scale_btn);
+ gtk_box_append (GTK_BOX (self->scale_bbox), scale_btn);
/* Set active before connecting the signal */
if (is_selected)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (scale_btn), TRUE);
@@ -476,14 +484,17 @@ on_orientation_selection_changed_cb (GtkWidget *widget,
CcDisplaySettings *self)
{
gint idx;
- g_autoptr(HdyValueObject) obj = NULL;
+ g_autoptr(GObject) obj = NULL;
if (self->updating)
return;
- idx = hdy_combo_row_get_selected_index (HDY_COMBO_ROW (self->orientation_row));
+ idx = adw_combo_row_get_selected (ADW_COMBO_ROW (self->orientation_row));
obj = g_list_model_get_item (G_LIST_MODEL (self->orientation_list), idx);
+ if (!obj)
+ return;
+
cc_display_monitor_set_rotation (self->selected_output,
GPOINTER_TO_INT (g_object_get_data (G_OBJECT (obj), "rotation-value")));
@@ -501,9 +512,12 @@ on_refresh_rate_selection_changed_cb (GtkWidget *widget,
if (self->updating)
return;
- idx = hdy_combo_row_get_selected_index (HDY_COMBO_ROW (self->refresh_rate_row));
+ idx = adw_combo_row_get_selected (ADW_COMBO_ROW (self->refresh_rate_row));
mode = g_list_model_get_item (G_LIST_MODEL (self->refresh_rate_list), idx);
+ if (!mode)
+ return;
+
cc_display_monitor_set_mode (self->selected_output, mode);
g_signal_emit_by_name (G_OBJECT (self), "updated", self->selected_output);
@@ -520,9 +534,12 @@ on_resolution_selection_changed_cb (GtkWidget *widget,
if (self->updating)
return;
- idx = hdy_combo_row_get_selected_index (HDY_COMBO_ROW (self->resolution_row));
+ idx = adw_combo_row_get_selected (ADW_COMBO_ROW (self->resolution_row));
mode = g_list_model_get_item (G_LIST_MODEL (self->resolution_list), idx);
+ if (!mode)
+ return;
+
/* This is the only row that can be changed when in cloning mode. */
if (!cc_display_config_is_cloning (self->config))
cc_display_monitor_set_mode (self->selected_output, mode);
@@ -558,13 +575,15 @@ on_scale_selection_changed_cb (GtkWidget *widget,
{
int idx;
double scale;
- g_autoptr(HdyValueObject) obj = NULL;
+ g_autoptr(GObject) obj = NULL;
if (self->updating)
return;
- idx = hdy_combo_row_get_selected_index (HDY_COMBO_ROW (self->scale_combo_row));
+ idx = adw_combo_row_get_selected (ADW_COMBO_ROW (self->scale_combo_row));
obj = g_list_model_get_item (G_LIST_MODEL (self->scale_list), idx);
+ if (!obj)
+ return;
scale = *(gdouble*) g_object_get_data (G_OBJECT (obj), "scale");
cc_display_monitor_set_scale (self->selected_output, scale);
@@ -718,35 +737,37 @@ cc_display_settings_class_init (CcDisplaySettingsClass *klass)
static void
cc_display_settings_init (CcDisplaySettings *self)
{
- gtk_widget_init_template (GTK_WIDGET (self));
+ GtkExpression *expression;
- gtk_list_box_set_header_func (GTK_LIST_BOX (self),
- cc_list_box_update_header_func,
- NULL, NULL);
+ gtk_widget_init_template (GTK_WIDGET (self));
- self->orientation_list = g_list_store_new (HDY_TYPE_VALUE_OBJECT);
+ self->orientation_list = G_LIST_MODEL (gtk_string_list_new (NULL));
self->refresh_rate_list = g_list_store_new (CC_TYPE_DISPLAY_MODE);
self->resolution_list = g_list_store_new (CC_TYPE_DISPLAY_MODE);
- self->scale_list = g_list_store_new (HDY_TYPE_VALUE_OBJECT);
+ self->scale_list = G_LIST_MODEL (gtk_string_list_new (NULL));
self->updating = TRUE;
- hdy_combo_row_bind_name_model (HDY_COMBO_ROW (self->orientation_row),
- G_LIST_MODEL (self->orientation_list),
- (HdyComboRowGetNameFunc) hdy_value_object_dup_string,
- NULL, NULL);
- hdy_combo_row_bind_name_model (HDY_COMBO_ROW (self->refresh_rate_row),
- G_LIST_MODEL (self->refresh_rate_list),
- (HdyComboRowGetNameFunc) get_frequency_string,
- NULL, NULL);
- hdy_combo_row_bind_name_model (HDY_COMBO_ROW (self->resolution_row),
- G_LIST_MODEL (self->resolution_list),
- (HdyComboRowGetNameFunc) make_resolution_string,
- NULL, NULL);
- hdy_combo_row_bind_name_model (HDY_COMBO_ROW (self->scale_combo_row),
- G_LIST_MODEL (self->scale_list),
- (HdyComboRowGetNameFunc) hdy_value_object_dup_string,
- NULL, NULL);
+ adw_combo_row_set_model (ADW_COMBO_ROW (self->orientation_row),
+ G_LIST_MODEL (self->orientation_list));
+ adw_combo_row_set_model (ADW_COMBO_ROW (self->scale_combo_row),
+ G_LIST_MODEL (self->scale_list));
+
+ expression = gtk_cclosure_expression_new (G_TYPE_STRING,
+ NULL, 0, NULL,
+ G_CALLBACK (make_refresh_rate_string),
+ self, NULL);
+ adw_combo_row_set_expression (ADW_COMBO_ROW (self->refresh_rate_row), expression);
+ adw_combo_row_set_model (ADW_COMBO_ROW (self->refresh_rate_row),
+ G_LIST_MODEL (self->refresh_rate_list));
+
+ expression = gtk_cclosure_expression_new (G_TYPE_STRING,
+ NULL, 0, NULL,
+ G_CALLBACK (make_resolution_string),
+ self, NULL);
+ adw_combo_row_set_expression (ADW_COMBO_ROW (self->resolution_row), expression);
+ adw_combo_row_set_model (ADW_COMBO_ROW (self->resolution_row),
+ G_LIST_MODEL (self->resolution_list));
self->updating = FALSE;
}
diff --git a/panels/display/cc-display-settings.h b/panels/display/cc-display-settings.h
index de3c88d48..2ed074861 100644
--- a/panels/display/cc-display-settings.h
+++ b/panels/display/cc-display-settings.h
@@ -20,13 +20,13 @@
#pragma once
-#include <gtk/gtk.h>
+#include <adwaita.h>
#include "cc-display-config.h"
G_BEGIN_DECLS
#define CC_TYPE_DISPLAY_SETTINGS cc_display_settings_get_type ()
-G_DECLARE_FINAL_TYPE (CcDisplaySettings, cc_display_settings, CC, DISPLAY_SETTINGS, GtkListBox);
+G_DECLARE_FINAL_TYPE (CcDisplaySettings, cc_display_settings, CC, DISPLAY_SETTINGS, AdwBin);
CcDisplaySettings* cc_display_settings_new (void);
diff --git a/panels/display/cc-display-settings.ui b/panels/display/cc-display-settings.ui
index 647e6838f..6bd157620 100644
--- a/panels/display/cc-display-settings.ui
+++ b/panels/display/cc-display-settings.ui
@@ -1,80 +1,70 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.0 -->
<interface>
- <requires lib="gtk+" version="3.20"/>
- <requires lib="libhandy" version="0.0"/>
- <template class="CcDisplaySettings" parent="GtkListBox">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="selection_mode">none</property>
+ <template class="CcDisplaySettings" parent="AdwBin">
<child>
- <object class="HdyComboRow" id="orientation_row">
- <property name="width_request">100</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="title" translatable="yes" context="display setting">Orientation</property>
- <signal name="notify::selected-index" handler="on_orientation_selection_changed_cb" swapped="no"/>
- </object>
- </child>
- <child>
- <object class="HdyComboRow" id="resolution_row">
- <property name="width_request">100</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="title" translatable="yes" context="display setting">Resolution</property>
- <signal name="notify::selected-index" handler="on_resolution_selection_changed_cb" swapped="no"/>
- </object>
- </child>
- <child>
- <object class="HdyComboRow" id="refresh_rate_row">
- <property name="width_request">100</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="title" translatable="yes">Refresh Rate</property>
- <signal name="notify::selected-index" handler="on_refresh_rate_selection_changed_cb" swapped="no"/>
- </object>
- </child>
- <child>
- <object class="HdyActionRow" id="underscanning_row">
- <property name="width_request">100</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="title" translatable="yes">Adjust for TV</property>
+ <object class="GtkListBox" id="listbox">
+ <property name="selection_mode">none</property>
+ <style>
+ <class name="content" />
+ </style>
<child>
- <object class="GtkSwitch" id="underscanning_switch">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="halign">end</property>
- <property name="valign">center</property>
- <signal name="notify::active" handler="on_underscanning_switch_active_changed_cb" swapped="no"/>
+ <object class="AdwComboRow" id="orientation_row">
+ <property name="width_request">100</property>
+ <property name="title" translatable="yes" context="display setting">Orientation</property>
+ <signal name="notify::selected-item" handler="on_orientation_selection_changed_cb" swapped="no"/>
</object>
</child>
- </object>
- </child>
- <child>
- <object class="HdyActionRow" id="scale_buttons_row">
- <property name="width_request">100</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="title" translatable="yes" context="display setting">Scale</property>
<child>
- <object class="GtkButtonBox" id="scale_bbox">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="halign">end</property>
- <property name="valign">center</property>
- <property name="layout_style">expand</property>
+ <object class="AdwComboRow" id="resolution_row">
+ <property name="width_request">100</property>
+ <property name="title" translatable="yes" context="display setting">Resolution</property>
+ <signal name="notify::selected-item" handler="on_resolution_selection_changed_cb" swapped="no"/>
+ </object>
+ </child>
+ <child>
+ <object class="AdwComboRow" id="refresh_rate_row">
+ <property name="width_request">100</property>
+ <property name="title" translatable="yes">Refresh Rate</property>
+ <signal name="notify::selected-item" handler="on_refresh_rate_selection_changed_cb"
swapped="no"/>
+ </object>
+ </child>
+ <child>
+ <object class="AdwActionRow" id="underscanning_row">
+ <property name="width_request">100</property>
+ <property name="title" translatable="yes">Adjust for TV</property>
+ <child>
+ <object class="GtkSwitch" id="underscanning_switch">
+ <property name="can_focus">False</property>
+ <property name="halign">end</property>
+ <property name="valign">center</property>
+ <signal name="notify::active" handler="on_underscanning_switch_active_changed_cb"
swapped="no"/>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="AdwActionRow" id="scale_buttons_row">
+ <property name="width_request">100</property>
+ <property name="title" translatable="yes" context="display setting">Scale</property>
+ <child>
+ <object class="GtkBox" id="scale_bbox">
+ <property name="halign">end</property>
+ <property name="valign">center</property>
+ <style>
+ <class name="linked" />
+ </style>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="AdwComboRow" id="scale_combo_row">
+ <property name="width_request">100</property>
+ <property name="title" translatable="yes" context="display setting">Scale</property>
+ <signal name="notify::selected-item" handler="on_scale_selection_changed_cb" swapped="no"/>
</object>
</child>
- </object>
- </child>
- <child>
- <object class="HdyComboRow" id="scale_combo_row">
- <property name="width_request">100</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="title" translatable="yes" context="display setting">Scale</property>
- <signal name="notify::selected-index" handler="on_scale_selection_changed_cb" swapped="no"/>
</object>
</child>
</template>
diff --git a/panels/display/cc-night-light-page.c b/panels/display/cc-night-light-page.c
index f51b0ba69..d1a992f65 100644
--- a/panels/display/cc-night-light-page.c
+++ b/panels/display/cc-night-light-page.c
@@ -26,12 +26,11 @@
#include <math.h>
#include "cc-night-light-page.h"
-#include "list-box-helper.h"
#include "shell/cc-object-storage.h"
struct _CcNightLightPage {
- GtkBin parent;
+ AdwBin parent;
GtkWidget *box_manual;
GtkButton *button_from_am;
@@ -66,7 +65,7 @@ struct _CcNightLightPage {
GDesktopClockFormat clock_format;
};
-G_DEFINE_TYPE (CcNightLightPage, cc_night_light_page, GTK_TYPE_BIN);
+G_DEFINE_TYPE (CcNightLightPage, cc_night_light_page, ADW_TYPE_BIN);
#define CLOCK_SCHEMA "org.gnome.desktop.interface"
#define DISPLAY_SCHEMA "org.gnome.settings-daemon.plugins.color"
@@ -438,7 +437,7 @@ dialog_format_minutes_combobox (GtkSpinButton *spin,
g_autofree gchar *text = NULL;
adjustment = gtk_spin_button_get_adjustment (spin);
text = g_strdup_printf ("%02.0f", gtk_adjustment_get_value (adjustment));
- gtk_entry_set_text (GTK_ENTRY (spin), text);
+ gtk_editable_set_text (GTK_EDITABLE (spin), text);
return TRUE;
}
@@ -453,7 +452,7 @@ dialog_format_hours_combobox (GtkSpinButton *spin,
text = g_strdup_printf ("%.0f", gtk_adjustment_get_value (adjustment));
else
text = g_strdup_printf ("%02.0f", gtk_adjustment_get_value (adjustment));
- gtk_entry_set_text (GTK_ENTRY (spin), text);
+ gtk_editable_set_text (GTK_EDITABLE (spin), text);
return TRUE;
}
@@ -620,8 +619,6 @@ cc_night_light_page_init (CcNightLightPage *self)
gtk_widget_init_template (GTK_WIDGET (self));
- gtk_list_box_set_header_func (self->listbox, cc_list_box_update_header_func, NULL, NULL);
-
gtk_scale_add_mark (GTK_SCALE (self->scale_color_temperature),
1700, GTK_POS_BOTTOM,
_("More Warm"));
@@ -669,9 +666,9 @@ cc_night_light_page_init (CcNightLightPage *self)
/* use custom CSS */
provider = gtk_css_provider_new ();
gtk_css_provider_load_from_resource (provider, "/org/gnome/control-center/display/night-light.css");
- gtk_style_context_add_provider_for_screen (gdk_screen_get_default (),
- GTK_STYLE_PROVIDER (provider),
- GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+ gtk_style_context_add_provider_for_display (gdk_display_get_default (),
+ GTK_STYLE_PROVIDER (provider),
+ GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
cc_object_storage_create_dbus_proxy (G_BUS_TYPE_SESSION,
G_DBUS_PROXY_FLAGS_NONE,
diff --git a/panels/display/cc-night-light-page.h b/panels/display/cc-night-light-page.h
index 79422bbcb..7e7be4bc1 100644
--- a/panels/display/cc-night-light-page.h
+++ b/panels/display/cc-night-light-page.h
@@ -20,12 +20,12 @@
#pragma once
-#include <gtk/gtk.h>
+#include <adwaita.h>
G_BEGIN_DECLS
#define CC_TYPE_NIGHT_LIGHT_PAGE (cc_night_light_page_get_type ())
-G_DECLARE_FINAL_TYPE (CcNightLightPage, cc_night_light_page, CC, NIGHT_LIGHT_PAGE, GtkBin)
+G_DECLARE_FINAL_TYPE (CcNightLightPage, cc_night_light_page, CC, NIGHT_LIGHT_PAGE, AdwBin)
CcNightLightPage* cc_night_light_page_new (void);
diff --git a/panels/display/cc-night-light-page.ui b/panels/display/cc-night-light-page.ui
index 02b14f731..9e69c3438 100644
--- a/panels/display/cc-night-light-page.ui
+++ b/panels/display/cc-night-light-page.ui
@@ -1,62 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
- <template class="CcNightLightPage" parent="GtkBin">
- <property name="can_focus">False</property>
+ <template class="CcNightLightPage" parent="AdwBin">
<child>
<object class="GtkBox">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="halign">center</property>
<property name="valign">start</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkInfoBar" id="infobar_disabled">
<property name="name">infobar_disabled</property>
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="border_width">0</property>
- <property name="orientation">vertical</property>
- <property name="spacing">12</property>
- <child internal-child="action_area">
- <object class="GtkButtonBox">
- <property name="can_focus">False</property>
- <property name="border_width">12</property>
- <property name="spacing">6</property>
- <property name="layout_style">end</property>
- <child>
- <object class="GtkButton" id="button_undisable">
- <property name="label" translatable="yes" comments="This cancels the redshift
inhibit.">Restart Filter</property>
- <property name="name">button_undisable</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <signal name="clicked" handler="dialog_undisable_clicked_cb" object="CcNightLightPage"
swapped="no" />
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="pack_type">end</property>
- <property name="position">0</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="pack_type">end</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child internal-child="content_area">
+ <child>
<object class="GtkBox">
- <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
<property name="spacing">16</property>
<child>
<object class="GtkLabel">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="halign">start</property>
- <property name="margin_left">12</property>
+ <property name="margin-start">12</property>
<property name="hexpand">False</property>
<property name="label" translatable="yes" comments="Inhibit the redshift functionality
until the next day starts">Temporarily Disabled Until Tomorrow</property>
<attributes>
@@ -66,13 +26,24 @@
</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>
+ <signal name="clicked" handler="dialog_undisable_clicked_cb" object="CcNightLightPage"
swapped="no" />
+ </object>
+ </child>
</object>
</child>
<child>
<object class="GtkBox">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="margin_top">30</property>
<property name="margin_end">12</property>
<property name="margin_start">12</property>
@@ -81,8 +52,6 @@
<property name="spacing">26</property>
<child>
<object class="GtkLabel">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="halign">start</property>
<property name="valign">start</property>
<property name="label" translatable="yes">Night light makes the screen color warmer. This
can help to prevent eye strain and sleeplessness.</property>
@@ -95,269 +64,227 @@
</object>
</child>
<child>
- <object class="GtkFrame">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
+ <object class="GtkListBox" id="listbox">
+ <property name="selection-mode">none</property>
+
+ <style>
+ <class name="content" />
+ </style>
+
+ <!-- Night Light -->
<child>
- <object class="GtkListBox" id="listbox">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="selection-mode">none</property>
+ <object class="AdwActionRow">
+ <property name="title" translatable="yes">Night Light</property>
+ <property name="activatable-widget">night_light_toggle_switch</property>
- <!-- Night Light -->
<child>
- <object class="HdyActionRow">
- <property name="visible">True</property>
- <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="visible">True</property>
- <property name="valign">center</property>
- </object>
- </child>
+ <object class="GtkSwitch" id="night_light_toggle_switch">
+ <property name="valign">center</property>
</object>
</child>
+ </object>
+ </child>
- <!-- Schedule -->
- <child>
- <object class="HdyActionRow">
- <property name="visible">True</property>
- <property name="title" translatable="yes">Schedule</property>
- <property name="sensitive" bind-source="night_light_toggle_switch"
bind-property="active" bind-flags="default|sync-create" />
+ <!-- Schedule -->
+ <child>
+ <object class="AdwActionRow">
+ <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="GtkComboBoxText" id="schedule_type_combo">
- <property name="visible">True</property>
- <property name="valign">center</property>
- <signal name="notify::active" handler="on_schedule_type_combo_active_changed_cb"
object="CcNightLightPage" swapped="no" />
- <items>
- <item translatable="yes" id="automatic">Sunset to Sunrise</item>
- <item translatable="yes" id="manual">Manual Schedule</item>
- </items>
- </object>
- </child>
+ <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>
</object>
</child>
+ </object>
+ </child>
- <!-- Time -->
- <child>
- <object class="HdyActionRow">
- <property name="visible">True</property>
- <property name="title" translatable="yes">Times</property>
- <property name="sensitive" bind-source="night_light_toggle_switch"
bind-property="active" bind-flags="default|sync-create" />
+ <!-- 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="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="GtkBox" id="box_manual">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="spacing">6</property>
- <property name="margin-top">12</property>
- <property name="margin-bottom">12</property>
+ <object class="GtkLabel">
+ <property name="label" translatable="yes">From</property>
+ <property name="mnemonic_widget">spinbutton_from_hours</property>
<style>
- <class name="time-widget" />
+ <class name="dim-label"/>
</style>
+ </object>
+ </child>
+ <child>
+ <object class="GtkBox">
+ <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>
<child>
<object class="GtkLabel">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">From</property>
- <property name="mnemonic_widget">spinbutton_from_hours</property>
+ <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" />
<style>
- <class name="dim-label"/>
+ <class name="padded-spinbutton"/>
</style>
+ <accessibility>
+ <property name="description" translatable="yes">Minute</property>
+ </accessibility>
</object>
</child>
<child>
- <object class="GtkBox">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="spacing">4</property>
+ <object class="GtkStack" id="stack_from">
+ <property name="hhomogeneous">False</property>
+ <property name="vhomogeneous">False</property>
<child>
- <object class="GtkSpinButton" id="spinbutton_from_hours">
- <property name="visible">True</property>
+ <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="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" />
+ <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="padded-spinbutton"/>
+ <class name="unpadded-button"/>
</style>
- <child internal-child="accessible">
- <object class="AtkObject" id="from_h_spinbutton-atkobject">
- <property name="AtkObject::accessible-description"
translatable="yes">Hour</property>
- </object>
- </child>
- </object>
- </child>
- <child>
- <object class="GtkLabel">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">:</property>
</object>
</child>
<child>
- <object class="GtkSpinButton" id="spinbutton_from_minutes">
- <property name="visible">True</property>
+ <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="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="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="padded-spinbutton"/>
+ <class name="unpadded-button"/>
</style>
- <child internal-child="accessible">
- <object class="AtkObject" id="from_m_spinbutton-atkobject">
- <property name="AtkObject::accessible-description"
translatable="yes">Minute</property>
- </object>
- </child>
- </object>
- </child>
- <child>
- <object class="GtkStack" id="stack_from">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="homogeneous">False</property>
- <child>
- <object class="GtkButton" id="button_from_am">
- <property name="label" translatable="yes" comments="This is the
short form for the time period in the morning">AM</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="valign">center</property>
- <signal name="clicked" handler="dialog_am_pm_from_button_clicked_cb"
object="CcNightLightPage" swapped="no" />
- <style>
- <class name="unpadded-button"/>
- </style>
- </object>
- </child>
- <child>
- <object class="GtkButton" id="button_from_pm">
- <property name="label" translatable="yes" comments="This is the
short form for the time period in the afternoon">PM</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="valign">center</property>
- <signal name="clicked" handler="dialog_am_pm_from_button_clicked_cb"
object="CcNightLightPage" swapped="no" />
- <style>
- <class name="unpadded-button"/>
- </style>
- </object>
- </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">
+ <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="visible">True</property>
- <property name="can_focus">False</property>
- <property name="margin-start">6</property>
- <property name="label" translatable="yes">To</property>
- <property name="mnemonic_widget">spinbutton_to_hours</property>
+ <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" />
<style>
- <class name="dim-label"/>
+ <class name="padded-spinbutton"/>
</style>
+ <accessibility>
+ <property name="description" translatable="yes">Minute</property>
+ </accessibility>
</object>
</child>
<child>
- <object class="GtkBox">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="spacing">4</property>
+ <object class="GtkStack" id="stack_to">
+ <property name="hhomogeneous">False</property>
+ <property name="vhomogeneous">False</property>
<child>
- <object class="GtkSpinButton" id="spinbutton_to_hours">
- <property name="visible">True</property>
+ <object class="GtkButton" id="button_to_am">
+ <property name="label" translatable="yes">AM</property>
<property name="can_focus">True</property>
- <property name="max_width_chars">2</property>
- <property name="text">4</property>
- <property name="input_purpose">number</property>
- <property name="orientation">vertical</property>
- <property name="adjustment">adjustment_to_hours</property>
- <property name="numeric">True</property>
- <property name="wrap">True</property>
- <property name="value">4</property>
- <signal name="output" handler="dialog_format_hours_combobox"
object="CcNightLightPage" swapped="no" />
+ <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="padded-spinbutton"/>
+ <class name="unpadded-button"/>
</style>
- <child internal-child="accessible">
- <object class="AtkObject" id="to_h_spinbutton-atkobject">
- <property name="AtkObject::accessible-description"
translatable="yes">Hour</property>
- </object>
- </child>
- </object>
- </child>
- <child>
- <object class="GtkLabel">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">:</property>
</object>
</child>
<child>
- <object class="GtkSpinButton" id="spinbutton_to_minutes">
- <property name="visible">True</property>
+ <object class="GtkButton" id="button_to_pm">
+ <property name="label" translatable="yes">PM</property>
<property name="can_focus">True</property>
- <property name="max_width_chars">2</property>
- <property name="text">0</property>
- <property name="orientation">vertical</property>
- <property name="adjustment">adjustment_to_minutes</property>
- <property name="numeric">True</property>
- <property name="wrap">True</property>
- <signal name="output" handler="dialog_format_minutes_combobox"
object="CcNightLightPage" swapped="no" />
+ <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="padded-spinbutton"/>
+ <class name="unpadded-button"/>
</style>
- <child internal-child="accessible">
- <object class="AtkObject" id="to_m_spinbutton-atkobject">
- <property name="AtkObject::accessible-description"
translatable="yes">Minute</property>
- </object>
- </child>
- </object>
- </child>
- <child>
- <object class="GtkStack" id="stack_to">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="homogeneous">False</property>
- <child>
- <object class="GtkButton" id="button_to_am">
- <property name="label" translatable="yes">AM</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="valign">center</property>
- <signal name="clicked" handler="dialog_am_pm_to_button_clicked_cb"
object="CcNightLightPage" swapped="no" />
- <style>
- <class name="unpadded-button"/>
- </style>
- </object>
- </child>
- <child>
- <object class="GtkButton" id="button_to_pm">
- <property name="label" translatable="yes">PM</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="valign">center</property>
- <signal name="clicked" handler="dialog_am_pm_to_button_clicked_cb"
object="CcNightLightPage" swapped="no" />
- <style>
- <class name="unpadded-button"/>
- </style>
- </object>
- </child>
</object>
</child>
</object>
@@ -366,40 +293,38 @@
</child>
</object>
</child>
+ </object>
+ </child>
- <!-- Color Temperature -->
- <child>
- <object class="HdyActionRow">
- <property name="visible">True</property>
- <property name="title" translatable="yes">Color Temperature</property>
- <property name="sensitive" bind-source="night_light_toggle_switch"
bind-property="active" bind-flags="default|sync-create" />
+ <!-- Color Temperature -->
+ <child>
+ <object class="AdwActionRow">
+ <property name="title" translatable="yes">Color Temperature</property>
+ <property name="sensitive" bind-source="night_light_toggle_switch"
bind-property="active" bind-flags="default|sync-create" />
- <child>
- <object class="GtkScale" id="scale_color_temperature">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="hexpand">True</property>
- <property name="margin-top">12</property>
- <property name="margin-bottom">12</property>
- <property name="width-request">280</property>
- <property name="adjustment">adjustment_color_temperature</property>
- <property name="inverted">True</property>
- <property name="restrict_to_fill_level">False</property>
- <property name="fill_level">1</property>
- <property name="digits">0</property>
- <property name="draw_value">False</property>
- <property name="has_origin">False</property>
- <property name="value_pos">bottom</property>
- <style>
- <class name="night-light-temperature"/>
- </style>
- </object>
- </child>
+ <child>
+ <object class="GtkScale" id="scale_color_temperature">
+ <property name="can_focus">True</property>
+ <property name="hexpand">True</property>
+ <property name="margin-top">12</property>
+ <property name="margin-bottom">12</property>
+ <property name="width-request">280</property>
+ <property name="adjustment">adjustment_color_temperature</property>
+ <property name="inverted">True</property>
+ <property name="restrict_to_fill_level">False</property>
+ <property name="fill_level">1</property>
+ <property name="digits">0</property>
+ <property name="draw_value">False</property>
+ <property name="has_origin">False</property>
+ <property name="value_pos">bottom</property>
+ <style>
+ <class name="night-light-temperature"/>
+ </style>
</object>
</child>
-
</object>
</child>
+
</object>
</child>
diff --git a/panels/display/meson.build b/panels/display/meson.build
index 12f35cc25..97db0ebdc 100644
--- a/panels/display/meson.build
+++ b/panels/display/meson.build
@@ -45,7 +45,7 @@ sources += gnome.compile_resources(
deps = common_deps + [
colord_dep,
- gnome_desktop_dep,
+ gnome_rr_dep,
m_dep,
upower_glib_dep
]
diff --git a/panels/display/night-light.css b/panels/display/night-light.css
index b73f51080..02c0a09fd 100644
--- a/panels/display/night-light.css
+++ b/panels/display/night-light.css
@@ -2,7 +2,7 @@
@define-color ORANGE_100 #ffc27d;
@define-color ORANGE_500 #f37329;
@define-color base_color white;
-@define-color bg_color shade (@base_color, 0.96);
+@define-color bg_color shade(@base_color, 0.96);
/* Hide the marks at the beginning and the end */
.night-light-temperature mark indicator:nth-child(even) {
diff --git a/panels/meson.build b/panels/meson.build
index 52760cb1e..29b96450c 100644
--- a/panels/meson.build
+++ b/panels/meson.build
@@ -8,7 +8,7 @@ panels = [
'datetime',
'default-apps',
'diagnostics',
-# 'display',
+ 'display',
'info-overview',
'keyboard',
'location',
diff --git a/shell/cc-panel-loader.c b/shell/cc-panel-loader.c
index de804ff9a..a3622ef86 100644
--- a/shell/cc-panel-loader.c
+++ b/shell/cc-panel-loader.c
@@ -39,7 +39,7 @@ extern GType cc_bluetooth_panel_get_type (void);
extern GType cc_color_panel_get_type (void);
extern GType cc_date_time_panel_get_type (void);
extern GType cc_default_apps_panel_get_type (void);
-//extern GType cc_display_panel_get_type (void);
+extern GType cc_display_panel_get_type (void);
extern GType cc_info_overview_panel_get_type (void);
extern GType cc_keyboard_panel_get_type (void);
extern GType cc_mouse_panel_get_type (void);
@@ -107,7 +107,7 @@ static CcPanelLoaderVtable default_panels[] =
PANEL_TYPE("datetime", cc_date_time_panel_get_type, NULL),
PANEL_TYPE("default-apps", cc_default_apps_panel_get_type, NULL),
PANEL_TYPE("diagnostics", cc_diagnostics_panel_get_type,
cc_diagnostics_panel_static_init_func),
- //PANEL_TYPE("display", cc_display_panel_get_type, NULL),
+ PANEL_TYPE("display", cc_display_panel_get_type, NULL),
PANEL_TYPE("info-overview", cc_info_overview_panel_get_type, NULL),
PANEL_TYPE("keyboard", cc_keyboard_panel_get_type, NULL),
PANEL_TYPE("location", cc_location_panel_get_type, NULL),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]