Commit b26a8bde authored by Benjamin Berg's avatar Benjamin Berg

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
parent f45dcff8
......@@ -169,25 +169,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)
{
......@@ -278,6 +259,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)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment