summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco Trevisan (TreviƱo) <mail@3v1n0.net>2023-03-17 16:39:41 +0100
committerFelipe Borges <felipeborges@gnome.org>2023-03-21 15:33:16 +0000
commit852b39cdc63519a4ed2a2438da338571fee3dccc (patch)
tree40abba47735a5b77b520dcdfe6a544fdafe94a9a
parentcde1ee6b30a0692675cee98f5b065f11ff96238f (diff)
downloadgnome-control-center-852b39cdc63519a4ed2a2438da338571fee3dccc.tar.gz
dispaly: Allow configuring all monitors and apply settings at once
When multiple monitors are available, it's not possible anymore to configure them all and eventually apply all the changed parameters. To make this possible again, add a back button in the apply titlebar that is shown only when we are in the display-settings child. See: https://bugs.launchpad.net/ubuntu/+source/gnome-control-center/+bug/2012043
-rw-r--r--panels/display/cc-display-panel.c21
-rw-r--r--panels/display/cc-display-panel.ui11
2 files changed, 32 insertions, 0 deletions
diff --git a/panels/display/cc-display-panel.c b/panels/display/cc-display-panel.c
index 86941e636..bb269623e 100644
--- a/panels/display/cc-display-panel.c
+++ b/panels/display/cc-display-panel.c
@@ -86,6 +86,7 @@ struct _CcDisplayPanel
GtkWidget *apply_button;
GtkWidget *cancel_button;
AdwWindowTitle *apply_titlebar_title_widget;
+ GtkButton *apply_titlebar_back_button;
GListStore *primary_display_list;
GList *monitor_rows;
@@ -117,6 +118,8 @@ update_apply_button (CcDisplayPanel *panel);
static void
apply_current_configuration (CcDisplayPanel *self);
static void
+on_apply_titlebar_back_button_clicked (CcDisplayPanel *self);
+static void
reset_current_config (CcDisplayPanel *panel);
static void
rebuild_ui (CcDisplayPanel *panel);
@@ -583,6 +586,7 @@ cc_display_panel_class_init (CcDisplayPanelClass *klass)
gtk_widget_class_bind_template_child (widget_class, CcDisplayPanel, apply_button);
gtk_widget_class_bind_template_child (widget_class, CcDisplayPanel, apply_titlebar);
gtk_widget_class_bind_template_child (widget_class, CcDisplayPanel, apply_titlebar_title_widget);
+ gtk_widget_class_bind_template_child (widget_class, CcDisplayPanel, apply_titlebar_back_button);
gtk_widget_class_bind_template_child (widget_class, CcDisplayPanel, display_settings_disabled_group);
gtk_widget_class_bind_template_child (widget_class, CcDisplayPanel, arrangement_bin);
gtk_widget_class_bind_template_child (widget_class, CcDisplayPanel, arrangement_row);
@@ -608,6 +612,7 @@ cc_display_panel_class_init (CcDisplayPanelClass *klass)
gtk_widget_class_bind_template_callback (widget_class, on_primary_display_selected_item_changed_cb);
gtk_widget_class_bind_template_callback (widget_class, on_screen_changed);
gtk_widget_class_bind_template_callback (widget_class, on_toplevel_escape_pressed_cb);
+ gtk_widget_class_bind_template_callback (widget_class, on_apply_titlebar_back_button_clicked);
}
static void
@@ -982,6 +987,19 @@ apply_current_configuration (CcDisplayPanel *self)
}
static void
+on_apply_titlebar_back_button_clicked (CcDisplayPanel *self)
+{
+ adw_leaflet_set_visible_child_name (self->leaflet, "displays");
+}
+
+static void
+on_leaflet_visible_child_changed (CcDisplayPanel *self)
+{
+ gtk_widget_set_visible (GTK_WIDGET (self->apply_titlebar_back_button),
+ g_strcmp0 (adw_leaflet_get_visible_child_name (self->leaflet), "display-settings") == 0);
+}
+
+static void
mapped_cb (CcDisplayPanel *panel)
{
CcShell *shell;
@@ -1075,6 +1093,9 @@ cc_display_panel_init (CcDisplayPanel *self)
g_signal_connect_object (self->arrangement, "notify::selected-output",
G_CALLBACK (on_arrangement_selected_ouptut_changed_cb), self,
G_CONNECT_SWAPPED);
+ g_signal_connect_object (self->leaflet, "notify::visible-child",
+ G_CALLBACK (on_leaflet_visible_child_changed),
+ self, G_CONNECT_SWAPPED);
self->settings = cc_display_settings_new ();
adw_bin_set_child (self->display_settings_bin, GTK_WIDGET (self->settings));
diff --git a/panels/display/cc-display-panel.ui b/panels/display/cc-display-panel.ui
index 418e845cd..773853035 100644
--- a/panels/display/cc-display-panel.ui
+++ b/panels/display/cc-display-panel.ui
@@ -26,6 +26,17 @@
<property name="show-end-title-buttons">False</property>
<child type="start">
+ <object class="GtkButton" id="apply_titlebar_back_button">
+ <property name="visible">False</property>
+ <property name="icon-name">go-previous-symbolic</property>
+ <accessibility>
+ <property name="label" translatable="yes">Back</property>
+ </accessibility>
+ <signal name="clicked" handler="on_apply_titlebar_back_button_clicked" object="CcDisplayPanel" swapped="yes" />
+ </object>
+ </child>
+
+ <child type="start">
<object class="GtkButton" id="cancel_button">
<property name="use-underline">True</property>
<property name="label" translatable="yes">_Cancel</property>