[gnome-control-center/wip/benzea/display-settings-widget: 21/30] display: Move setter for cloning mode into CcDisplayConfig



commit 06e497f2412c25a325ba5d524418c5d6da5f9e87
Author: Benjamin Berg <bberg redhat com>
Date:   Fri Jan 18 11:49:21 2019 +0100

    display: Move setter for cloning mode into CcDisplayConfig
    
    It will be used from multiple files in the future.

 panels/display/cc-display-config.c | 15 +++++++++++++++
 panels/display/cc-display-config.h |  4 ++++
 panels/display/cc-display-panel.c  | 20 +++-----------------
 3 files changed, 22 insertions(+), 17 deletions(-)
---
diff --git a/panels/display/cc-display-config.c b/panels/display/cc-display-config.c
index 6670edb00..cf45ff33a 100644
--- a/panels/display/cc-display-config.c
+++ b/panels/display/cc-display-config.c
@@ -509,6 +509,21 @@ cc_display_config_is_applicable (CcDisplayConfig *self)
   return CC_DISPLAY_CONFIG_GET_CLASS (self)->is_applicable (self);
 }
 
+void
+cc_display_config_set_mode_on_all_outputs (CcDisplayConfig *config,
+                                           CcDisplayMode   *mode)
+{
+  GList *outputs, *l;
+
+  outputs = cc_display_config_get_monitors (config);
+  for (l = outputs; l; l = l->next)
+    {
+      CcDisplayMonitor *output = l->data;
+      cc_display_monitor_set_mode (output, mode);
+      cc_display_monitor_set_position (output, 0, 0);
+    }
+}
+
 gboolean
 cc_display_config_equal (CcDisplayConfig *self,
                          CcDisplayConfig *other)
diff --git a/panels/display/cc-display-config.h b/panels/display/cc-display-config.h
index e74422705..d4dcc5998 100644
--- a/panels/display/cc-display-config.h
+++ b/panels/display/cc-display-config.h
@@ -169,6 +169,10 @@ gboolean          cc_display_config_is_cloning              (CcDisplayConfig
 void              cc_display_config_set_cloning             (CcDisplayConfig    *config,
                                                              gboolean            clone);
 GList*            cc_display_config_get_cloning_modes       (CcDisplayConfig    *config);
+
+void              cc_display_config_set_mode_on_all_outputs (CcDisplayConfig *config,
+                                                             CcDisplayMode   *mode);
+
 gboolean          cc_display_config_is_layout_logical       (CcDisplayConfig    *self);
 
 const char*       cc_display_monitor_get_display_name       (CcDisplayMonitor   *monitor);
diff --git a/panels/display/cc-display-panel.c b/panels/display/cc-display-panel.c
index 39002decf..d3d9d982f 100644
--- a/panels/display/cc-display-panel.c
+++ b/panels/display/cc-display-panel.c
@@ -1478,27 +1478,13 @@ make_two_single_ui (CcDisplayPanel *panel)
   return vbox;
 }
 
-static void
-set_mode_on_all_outputs (CcDisplayConfig *config,
-                         CcDisplayMode   *mode)
-{
-  GList *outputs, *l;
-  outputs = cc_display_config_get_monitors (config);
-  for (l = outputs; l; l = l->next)
-    {
-      CcDisplayMonitor *output = l->data;
-      cc_display_monitor_set_mode (output, mode);
-      cc_display_monitor_set_position (output, 0, 0);
-    }
-}
-
 static void
 mirror_resolution_row_activated (CcDisplayPanel *panel,
                                  GtkListBoxRow  *row)
 {
   CcDisplayMode *mode = g_object_get_data (G_OBJECT (row), "mode");
 
-  set_mode_on_all_outputs (panel->current_config, mode);
+  cc_display_config_set_mode_on_all_outputs (panel->current_config, mode);
   update_apply_button (panel);
 }
 
@@ -1596,8 +1582,8 @@ make_two_mirror_ui (CcDisplayPanel *panel)
       GList *modes;
       cc_display_config_set_cloning (panel->current_config, TRUE);
       modes = g_object_get_data (G_OBJECT (panel->current_config), "mirror-res-list");
-      set_mode_on_all_outputs (panel->current_config,
-                               CC_DISPLAY_MODE (g_list_nth_data (modes, 0)));
+      cc_display_config_set_mode_on_all_outputs (panel->current_config,
+                                                 CC_DISPLAY_MODE (g_list_nth_data (modes, 0)));
     }
 
   panel->rows_size_group = gtk_size_group_new (GTK_SIZE_GROUP_BOTH);


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