[gnome-control-center/benzea/ensure-valid-config-after-loading] display: Ensure configuration has the expected type
- From: Benjamin Berg <bberg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center/benzea/ensure-valid-config-after-loading] display: Ensure configuration has the expected type
- Date: Fri, 22 Feb 2019 15:22:19 +0000 (UTC)
commit 60bf49b62408309098800cd0f742a62edbed41f0
Author: Benjamin Berg <bberg redhat com>
Date: Fri Feb 22 16:17:26 2019 +0100
display: Ensure configuration has the expected type
In almost all cases, the configuration will be "valid" in the sense that
g-c-c can represent it in the UI. However, there are cases like
mirroring setups with three monitors that we do not allow.
In case that the user has such a configuration, ensure that the
configuration we represent is actually valid according to our
expectations. This should not affect normal use cases, but allows users
to recover again if the configuration is broken for some reason.
Fixes #383
panels/display/cc-display-panel.c | 40 ++++++++++++++++++++-------------------
1 file changed, 21 insertions(+), 19 deletions(-)
---
diff --git a/panels/display/cc-display-panel.c b/panels/display/cc-display-panel.c
index bb574c5c9..517e82928 100644
--- a/panels/display/cc-display-panel.c
+++ b/panels/display/cc-display-panel.c
@@ -189,25 +189,6 @@ cc_panel_get_selected_type (CcDisplayPanel *panel)
g_assert_not_reached ();
}
-static void
-cc_panel_set_selected_type (CcDisplayPanel *panel, CcDisplayConfigType type)
-{
- switch (type)
- {
- case CC_DISPLAY_CONFIG_JOIN:
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (panel->config_type_join), TRUE);
- break;
- case CC_DISPLAY_CONFIG_CLONE:
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (panel->config_type_mirror), TRUE);
- break;
- case CC_DISPLAY_CONFIG_SINGLE:
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (panel->config_type_single), TRUE);
- break;
- default:
- g_assert_not_reached ();
- }
-}
-
static void
config_ensure_of_type (CcDisplayPanel *panel, CcDisplayConfigType type)
{
@@ -296,6 +277,27 @@ config_ensure_of_type (CcDisplayPanel *panel, CcDisplayConfigType type)
rebuild_ui (panel);
}
+static void
+cc_panel_set_selected_type (CcDisplayPanel *panel, CcDisplayConfigType type)
+{
+ switch (type)
+ {
+ case CC_DISPLAY_CONFIG_JOIN:
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (panel->config_type_join), TRUE);
+ break;
+ case CC_DISPLAY_CONFIG_CLONE:
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (panel->config_type_mirror), TRUE);
+ break;
+ case CC_DISPLAY_CONFIG_SINGLE:
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (panel->config_type_single), TRUE);
+ break;
+ default:
+ g_assert_not_reached ();
+ }
+
+ config_ensure_of_type (panel, type);
+}
+
static void
monitor_labeler_hide (CcDisplayPanel *self)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]