[gnome-flashback] backends: split monitor manager creation into create and setup



commit 768d141118c750028ca2a5923dd22aedbadc5dda
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Sat Jul 6 19:09:20 2019 +0300

    backends: split monitor manager creation into create and setup
    
    Based on mutter commit:
    https://gitlab.gnome.org/GNOME/mutter/commit/518fb9fb5eafb7e52704

 backends/gf-backend.c                 |  4 +++-
 backends/gf-monitor-manager-private.h |  2 ++
 backends/gf-monitor-manager.c         | 29 ++++++++++++++++++-----------
 3 files changed, 23 insertions(+), 12 deletions(-)
---
diff --git a/backends/gf-backend.c b/backends/gf-backend.c
index 81d8862..e660a33 100644
--- a/backends/gf-backend.c
+++ b/backends/gf-backend.c
@@ -77,6 +77,8 @@ gf_backend_initable_init (GInitable     *initable,
   priv->settings = gf_settings_new (backend);
   priv->orientation_manager = gf_orientation_manager_new ();
 
+  priv->monitor_manager = create_monitor_manager (backend);
+
   return TRUE;
 }
 
@@ -109,7 +111,7 @@ gf_backend_real_post_init (GfBackend *backend)
 
   priv = gf_backend_get_instance_private (backend);
 
-  priv->monitor_manager = create_monitor_manager (backend);
+  gf_monitor_manager_setup (priv->monitor_manager);
 }
 
 static void
diff --git a/backends/gf-monitor-manager-private.h b/backends/gf-monitor-manager-private.h
index 913d25e..8f54436 100644
--- a/backends/gf-monitor-manager-private.h
+++ b/backends/gf-monitor-manager-private.h
@@ -156,6 +156,8 @@ GType                       gf_monitor_manager_get_type                     (voi
 
 GfBackend                  *gf_monitor_manager_get_backend                  (GfMonitorManager            
*manager);
 
+void                        gf_monitor_manager_setup                        (GfMonitorManager            
*manager);
+
 void                        gf_monitor_manager_rebuild_derived              (GfMonitorManager            
*manager,
                                                                              GfMonitorsConfig            
*config);
 
diff --git a/backends/gf-monitor-manager.c b/backends/gf-monitor-manager.c
index da8613f..e422350 100644
--- a/backends/gf-monitor-manager.c
+++ b/backends/gf-monitor-manager.c
@@ -1971,11 +1971,6 @@ gf_monitor_manager_constructed (GObject *object)
 
   manager->current_switch_config = GF_MONITOR_SWITCH_CONFIG_UNKNOWN;
 
-  manager->config_manager = gf_monitor_config_manager_new (manager);
-
-  gf_monitor_manager_read_current_state (manager);
-  manager_class->ensure_initial_config (manager);
-
   priv->bus_name_id = g_bus_own_name (G_BUS_TYPE_SESSION,
                                       "org.gnome.Mutter.DisplayConfig",
                                       G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT |
@@ -1985,8 +1980,6 @@ gf_monitor_manager_constructed (GObject *object)
                                       name_lost_cb,
                                       g_object_ref (manager),
                                       g_object_unref);
-
-  priv->in_init = FALSE;
 }
 
 static void
@@ -2124,22 +2117,36 @@ gf_monitor_manager_class_init (GfMonitorManagerClass *manager_class)
 
 static void
 gf_monitor_manager_init (GfMonitorManager *manager)
+{
+}
+
+GfBackend *
+gf_monitor_manager_get_backend (GfMonitorManager *manager)
 {
   GfMonitorManagerPrivate *priv;
 
   priv = gf_monitor_manager_get_instance_private (manager);
 
-  priv->in_init = TRUE;
+  return priv->backend;
 }
 
-GfBackend *
-gf_monitor_manager_get_backend (GfMonitorManager *manager)
+void
+gf_monitor_manager_setup (GfMonitorManager *manager)
 {
   GfMonitorManagerPrivate *priv;
+  GfMonitorManagerClass *manager_class;
 
   priv = gf_monitor_manager_get_instance_private (manager);
+  manager_class = GF_MONITOR_MANAGER_GET_CLASS (manager);
 
-  return priv->backend;
+  priv->in_init = TRUE;
+
+  manager->config_manager = gf_monitor_config_manager_new (manager);
+
+  gf_monitor_manager_read_current_state (manager);
+  manager_class->ensure_initial_config (manager);
+
+  priv->in_init = FALSE;
 }
 
 void


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