summaryrefslogtreecommitdiff
path: root/telepathy-glib/proxy.c
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@gmail.com>2011-07-15 16:30:59 +0200
committerXavier Claessens <xclaesse@gmail.com>2011-07-20 15:00:23 +0200
commitebe0c53202e216cd049e4b59e4d49d5b5e7f67db (patch)
tree1f80465a66b006f42366ab7dc66deb78c3f8444e /telepathy-glib/proxy.c
parentf35ecbc1b9dcc50f79c895e806854938244a37f7 (diff)
downloadtelepathy-glib-ebe0c53202e216cd049e4b59e4d49d5b5e7f67db.tar.gz
Add TpSimpleClientFactory
This is a new object replacing TpBasicProxyFactory but can construct any known TpProxy subclasses, guarantee their uniqueness per object-path and keep a user-defined set of features to prepare on them.
Diffstat (limited to 'telepathy-glib/proxy.c')
-rw-r--r--telepathy-glib/proxy.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/telepathy-glib/proxy.c b/telepathy-glib/proxy.c
index b64e9190d..f4e648a34 100644
--- a/telepathy-glib/proxy.c
+++ b/telepathy-glib/proxy.c
@@ -386,6 +386,8 @@ struct _TpProxyPrivate {
guint pending_will_announce_calls;
gboolean dispose_has_run;
+
+ TpSimpleClientFactory *factory;
};
G_DEFINE_TYPE (TpProxy, tp_proxy, G_TYPE_OBJECT)
@@ -397,6 +399,7 @@ enum
PROP_BUS_NAME,
PROP_OBJECT_PATH,
PROP_INTERFACES,
+ PROP_FACTORY,
N_PROPS
};
@@ -876,6 +879,9 @@ tp_proxy_get_property (GObject *object,
g_value_take_boxed (value, g_ptr_array_free (strings, FALSE));
}
break;
+ case PROP_FACTORY:
+ g_value_set_object (value, self->priv->factory);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
@@ -941,6 +947,10 @@ tp_proxy_set_property (GObject *object,
g_assert (self->object_path == NULL);
self->object_path = g_value_dup_string (value);
break;
+ case PROP_FACTORY:
+ g_assert (self->priv->factory == NULL);
+ self->priv->factory = g_value_dup_object (value);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
@@ -1119,6 +1129,7 @@ tp_proxy_dispose (GObject *object)
tp_proxy_invalidate (self, &e);
tp_clear_object (&self->dbus_daemon);
+ tp_clear_object (&self->priv->factory);
G_OBJECT_CLASS (tp_proxy_parent_class)->dispose (object);
}
@@ -1324,6 +1335,20 @@ tp_proxy_class_init (TpProxyClass *klass)
param_spec);
/**
+ * TpProxy:factory:
+ *
+ * The #TpSimpleClientFactory that has been used to create this proxy,
+ * or %NULL if proxy was not created through a factory.
+ */
+ param_spec = g_param_spec_object ("factory", "Simple Client Factory",
+ "The TpSimpleClientFactory used to create this proxy",
+ TP_TYPE_SIMPLE_CLIENT_FACTORY,
+ G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_NAME |
+ G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB);
+ g_object_class_install_property (object_class, PROP_FACTORY,
+ param_spec);
+
+ /**
* TpProxy::interface-added: (skip)
* @self: the proxy object
* @id: the GQuark representing the interface
@@ -1366,6 +1391,26 @@ tp_proxy_class_init (TpProxyClass *klass)
}
/**
+ * tp_proxy_get_factory:
+ * @self: a #TpProxy or subclass
+ *
+ * <!-- -->
+ *
+ * Returns: (transfer none): the same value as #TpProxy:factory property
+ *
+ * Since: 0.UNRELEASED
+ */
+TpSimpleClientFactory *
+tp_proxy_get_factory (gpointer self)
+{
+ TpProxy *proxy = self;
+
+ g_return_val_if_fail (TP_IS_PROXY (self), NULL);
+
+ return proxy->priv->factory;
+}
+
+/**
* tp_proxy_get_dbus_daemon:
* @self: a #TpProxy or subclass
*