[gnome-control-center] display: Don't always set the primary monitor to the first in list



commit 49957ef8181232254187e93572eb52d065f5cf76
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date:   Mon Mar 18 01:00:49 2019 +0000

    display: Don't always set the primary monitor to the first in list
    
    As per the binding that we have between the list store and the combo-box, when
    the first element is added to the list-store, the combo box set this value as
    the selected-index, and this leads to a call to cc_display_monitor_set_primary
    which set the first-listed monitor as primary and unset the real primary monitor.
    
    To avoid this, just ignore the binding when rebuilding the UI, since in this
    phase control-center should just reflect the actual state without changing
    anything.
    
    Fixes https://gitlab.gnome.org/GNOME/gnome-control-center/issues/419

 panels/display/cc-display-panel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/panels/display/cc-display-panel.c b/panels/display/cc-display-panel.c
index 9604883d6..85ea4ce07 100644
--- a/panels/display/cc-display-panel.c
+++ b/panels/display/cc-display-panel.c
@@ -550,7 +550,7 @@ on_primary_display_selected_index_changed_cb (CcDisplayPanel *panel)
   gint idx = hdy_combo_row_get_selected_index (panel->primary_display_row);
   g_autoptr(CcDisplayMonitor) output = NULL;
 
-  if (idx < 0)
+  if (idx < 0 || panel->rebuilding)
     return;
 
   output = g_list_model_get_item (G_LIST_MODEL (panel->primary_display_list), idx);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]