[mutter/wip/display-no-wayland: 16/33] MonitorManager: inherit directly from DisplayConfig instead of handling signals



commit f82f3ef67be08c19f7a8c755b7adba6563fe5f64
Author: Giovanni Campagna <gcampagn redhat com>
Date:   Tue Jul 23 19:32:17 2013 +0200

    MonitorManager: inherit directly from DisplayConfig instead of handling signals
    
    This way we can handle properties too.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=705670

 src/core/monitor.c |   48 ++++++++++++++++++++++++------------------------
 1 files changed, 24 insertions(+), 24 deletions(-)
---
diff --git a/src/core/monitor.c b/src/core/monitor.c
index 67e9a0a..f5a0ff4 100644
--- a/src/core/monitor.c
+++ b/src/core/monitor.c
@@ -52,7 +52,7 @@ typedef enum {
 
 struct _MetaMonitorManager
 {
-  GObject parent_instance;
+  MetaDBusDisplayConfigSkeleton parent_instance;
 
   MetaMonitorBackend backend;
 
@@ -96,12 +96,11 @@ struct _MetaMonitorManager
 #endif
 
   int dbus_name_id;
-  MetaDBusDisplayConfig *skeleton;
 };
 
 struct _MetaMonitorManagerClass
 {
-  GObjectClass parent_class;
+  MetaDBusDisplayConfigSkeletonClass parent_class;
 };
 
 enum {
@@ -111,7 +110,10 @@ enum {
 
 static int signals[SIGNALS_LAST];
 
-G_DEFINE_TYPE (MetaMonitorManager, meta_monitor_manager, G_TYPE_OBJECT);
+static void meta_monitor_manager_display_config_init (MetaDBusDisplayConfigIface *iface);
+
+G_DEFINE_TYPE_WITH_CODE (MetaMonitorManager, meta_monitor_manager, META_DBUS_TYPE_DISPLAY_CONFIG_SKELETON,
+                         G_IMPLEMENT_INTERFACE (META_DBUS_TYPE_DISPLAY_CONFIG, 
meta_monitor_manager_display_config_init));
 
 static void invalidate_logical_config (MetaMonitorManager *manager);
 
@@ -751,8 +753,6 @@ meta_monitor_manager_dispose (GObject *object)
       manager->dbus_name_id = 0;
     }
 
-  g_clear_object (&manager->skeleton);
-
   G_OBJECT_CLASS (meta_monitor_manager_parent_class)->dispose (object);
 }
 
@@ -818,10 +818,10 @@ make_display_name (MetaOutput *output)
 }
 
 static gboolean
-handle_get_resources (MetaDBusDisplayConfig *skeleton,
-                      GDBusMethodInvocation *invocation,
-                      MetaMonitorManager    *manager)
+meta_monitor_manager_handle_get_resources (MetaDBusDisplayConfig *skeleton,
+                                           GDBusMethodInvocation *invocation)
 {
+  MetaMonitorManager *manager = META_MONITOR_MANAGER (skeleton);
   GVariantBuilder crtc_builder, output_builder, mode_builder;
   unsigned int i, j;
 
@@ -1217,14 +1217,14 @@ apply_config_dummy (MetaMonitorManager *manager,
 }
 
 static gboolean
-handle_apply_configuration  (MetaDBusDisplayConfig *skeleton,
-                             GDBusMethodInvocation *invocation,
-                             guint                  serial,
-                             gboolean               persistent,
-                             GVariant              *crtcs,
-                             GVariant              *outputs,
-                             MetaMonitorManager    *manager)
+meta_monitor_manager_handle_apply_configuration  (MetaDBusDisplayConfig *skeleton,
+                                                  GDBusMethodInvocation *invocation,
+                                                  guint                  serial,
+                                                  gboolean               persistent,
+                                                  GVariant              *crtcs,
+                                                  GVariant              *outputs)
 {
+  MetaMonitorManager *manager = META_MONITOR_MANAGER (skeleton);
   GVariantIter crtc_iter, output_iter, *nested_outputs;
   guint crtc_id;
   int new_mode, x, y;
@@ -1383,20 +1383,20 @@ handle_apply_configuration  (MetaDBusDisplayConfig *skeleton,
 }
 
 static void
+meta_monitor_manager_display_config_init (MetaDBusDisplayConfigIface *iface)
+{
+  iface->handle_get_resources = meta_monitor_manager_handle_get_resources;
+  iface->handle_apply_configuration = meta_monitor_manager_handle_apply_configuration;
+}
+
+static void
 on_bus_acquired (GDBusConnection *connection,
                  const char      *name,
                  gpointer         user_data)
 {
   MetaMonitorManager *manager = user_data;
 
-  manager->skeleton = META_DBUS_DISPLAY_CONFIG (meta_dbus_display_config_skeleton_new ());
-
-  g_signal_connect_object (manager->skeleton, "handle-get-resources",
-                           G_CALLBACK (handle_get_resources), manager, 0);
-  g_signal_connect_object (manager->skeleton, "handle-apply-configuration",
-                           G_CALLBACK (handle_apply_configuration), manager, 0);
-
-  g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (manager->skeleton),
+  g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (manager),
                                     connection,
                                     "/org/gnome/Mutter/DisplayConfig",
                                     NULL);


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