diff options
author | Will Thompson <will.thompson@collabora.co.uk> | 2013-06-22 18:20:06 +0100 |
---|---|---|
committer | Will Thompson <will.thompson@collabora.co.uk> | 2013-06-23 16:06:05 +0100 |
commit | 1bc93dbe2b02b6f44aa5b1a75aeec4a4a0e33ea9 (patch) | |
tree | 9bbfbd53e5695982626d51595379d422af25b9e7 | |
parent | c48dfbe92fa02ecbdace6f7ad608d9ef7d87ec43 (diff) |
console: make the sidecar subclass TpBaseChannel
-rw-r--r-- | plugins/console/sidecar.c | 46 | ||||
-rw-r--r-- | plugins/console/sidecar.h | 7 |
2 files changed, 16 insertions, 37 deletions
diff --git a/plugins/console/sidecar.c b/plugins/console/sidecar.c index 1e01234cd..5484a3ca0 100644 --- a/plugins/console/sidecar.c +++ b/plugins/console/sidecar.c @@ -29,7 +29,6 @@ enum { PROP_0, - PROP_CONNECTION, PROP_SESSION, PROP_SPEW }; @@ -37,7 +36,6 @@ enum { struct _GabbleConsoleSidecarPrivate { WockySession *session; - TpBaseConnection *connection; WockyXmppReader *reader; WockyXmppWriter *writer; @@ -63,7 +61,7 @@ static void gabble_console_sidecar_set_spew ( gboolean spew); G_DEFINE_TYPE_WITH_CODE (GabbleConsoleSidecar, gabble_console_sidecar, - G_TYPE_OBJECT, + TP_TYPE_BASE_CHANNEL, G_IMPLEMENT_INTERFACE (GABBLE_TYPE_SIDECAR, sidecar_iface_init); G_IMPLEMENT_INTERFACE (GABBLE_TYPE_SVC_GABBLE_PLUGIN_CONSOLE, console_iface_init); @@ -112,11 +110,6 @@ gabble_console_sidecar_set_property ( switch (property_id) { - case PROP_CONNECTION: - g_assert (self->priv->connection == NULL); /* construct-only */ - self->priv->connection = g_value_dup_object (value); - break; - case PROP_SESSION: g_assert (self->priv->session == NULL); /* construct-only */ self->priv->session = g_value_dup_object (value); @@ -140,7 +133,6 @@ gabble_console_sidecar_dispose (GObject *object) gabble_console_sidecar_set_spew (self, FALSE); - tp_clear_object (&self->priv->connection); tp_clear_object (&self->priv->reader); tp_clear_object (&self->priv->writer); tp_clear_object (&self->priv->session); @@ -157,21 +149,6 @@ gabble_console_sidecar_class_init (GabbleConsoleSidecarClass *klass) { "SpewStanzas", "spew-stanzas", "spew-stanzas" }, { NULL }, }; - static TpDBusPropertiesMixinIfaceImpl interfaces[] = { - { GABBLE_IFACE_GABBLE_PLUGIN_CONSOLE, - tp_dbus_properties_mixin_getter_gobject_properties, - /* FIXME: if we were feeling clever, we'd override the setter so that - * we can monitor the bus name of any application which sets - * SpewStanzas to TRUE and flip it back to false when that application - * dies. - * - * Alternatively, we could just replace this sidecar with a channel. - */ - tp_dbus_properties_mixin_setter_gobject_properties, - console_props - }, - { NULL }, - }; object_class->get_property = gabble_console_sidecar_get_property; object_class->set_property = gabble_console_sidecar_set_property; @@ -179,12 +156,6 @@ gabble_console_sidecar_class_init (GabbleConsoleSidecarClass *klass) g_type_class_add_private (klass, sizeof (GabbleConsoleSidecarPrivate)); - g_object_class_install_property (object_class, PROP_CONNECTION, - g_param_spec_object ("connection", "Connection", - "Gabble connection", - GABBLE_TYPE_PLUGIN_CONNECTION, - G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS)); - g_object_class_install_property (object_class, PROP_SESSION, g_param_spec_object ("session", "Session", "Wocky session", @@ -197,9 +168,18 @@ gabble_console_sidecar_class_init (GabbleConsoleSidecarClass *klass) FALSE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - klass->props_class.interfaces = interfaces; - tp_dbus_properties_mixin_class_init (object_class, - G_STRUCT_OFFSET (GabbleConsoleSidecarClass, props_class)); + tp_dbus_properties_mixin_implement_interface (object_class, + GABBLE_IFACE_QUARK_GABBLE_PLUGIN_CONSOLE, + tp_dbus_properties_mixin_getter_gobject_properties, + /* FIXME: if we were feeling clever, we'd override the setter so that + * we can monitor the bus name of any application which sets + * SpewStanzas to TRUE and flip it back to false when that application + * dies. + * + * Alternatively, we could just replace this sidecar with a channel. + */ + tp_dbus_properties_mixin_setter_gobject_properties, + console_props); } static void sidecar_iface_init ( diff --git a/plugins/console/sidecar.h b/plugins/console/sidecar.h index b31b2071b..9045b1f02 100644 --- a/plugins/console/sidecar.h +++ b/plugins/console/sidecar.h @@ -25,14 +25,13 @@ typedef struct _GabbleConsoleSidecarClass GabbleConsoleSidecarClass; typedef struct _GabbleConsoleSidecarPrivate GabbleConsoleSidecarPrivate; struct _GabbleConsoleSidecar { - GObject parent; + TpBaseChannel parent; + GabbleConsoleSidecarPrivate *priv; }; struct _GabbleConsoleSidecarClass { - GObjectClass parent; - - TpDBusPropertiesMixinClass props_class; + TpBaseChannelClass parent; }; GType gabble_console_sidecar_get_type (void); |