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
This commit is contained in:
Benjamin Berg 2019-02-22 16:17:26 +01:00
parent f45dcff81f
commit b26a8bdeed

View file

@ -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)
{