[mutter/wip/wayland-display] MonitorManager: inherit directly from DisplayConfig instead of handling signals
- From: Giovanni Campagna <gcampagna src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/wayland-display] MonitorManager: inherit directly from DisplayConfig instead of handling signals
- Date: Wed, 24 Jul 2013 16:13:28 +0000 (UTC)
commit e9698d8d3d5c46009cc5a199a9f9f36a243ec19a
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.
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 c33026c..329681d 100644
--- a/src/core/monitor.c
+++ b/src/core/monitor.c
@@ -54,7 +54,7 @@ typedef enum {
struct _MetaMonitorManager
{
- GObject parent_instance;
+ MetaDBusDisplayConfigSkeleton parent_instance;
MetaMonitorBackend backend;
@@ -98,12 +98,11 @@ struct _MetaMonitorManager
#endif
int dbus_name_id;
- MetaDBusDisplayConfig *skeleton;
};
struct _MetaMonitorManagerClass
{
- GObjectClass parent_class;
+ MetaDBusDisplayConfigSkeletonClass parent_class;
};
enum {
@@ -113,7 +112,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);
@@ -915,8 +917,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);
}
@@ -938,10 +938,10 @@ meta_monitor_manager_class_init (MetaMonitorManagerClass *klass)
}
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;
@@ -1320,14 +1320,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;
@@ -1478,20 +1478,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]