[Telepathy-commits] [telepathy-mission-control/master] Add _mcd_connection_update_property
Alberto Mardegan
alberto.mardegan at nokia.com
Mon Feb 9 00:58:18 PST 2009
Convenience function that changes the value of a connection property.
Will be used by McdAccount to set the parameters having the DBus_Property flag.
---
src/mcd-connection.c | 33 +++++++++++++++++++++++++++++++++
src/mcd-connection.h | 5 +++++
2 files changed, 38 insertions(+), 0 deletions(-)
diff --git a/src/mcd-connection.c b/src/mcd-connection.c
index 42009c6..031b2c4 100644
--- a/src/mcd-connection.c
+++ b/src/mcd-connection.c
@@ -2546,3 +2546,36 @@ mcd_connection_set_reconnect (McdConnection *connection, gboolean reconnect)
connection->priv->auto_reconnect = reconnect;
}
+/**
+ * _mcd_connection_update_property:
+ * @connection: the #McdConnection.
+ * @name: the qualified name of the property to be updated.
+ * @value: the new value of the property.
+ *
+ * Sets the property @name to @value.
+ */
+void
+_mcd_connection_update_property (McdConnection *connection, const gchar *name,
+ const GValue *value)
+{
+ McdConnectionPrivate *priv;
+ const gchar *dot, *member;
+ gchar *interface;
+
+ g_return_if_fail (MCD_IS_CONNECTION (connection));
+ g_return_if_fail (name != NULL);
+ priv = connection->priv;
+
+ if (G_UNLIKELY (!priv->tp_conn)) return;
+
+ dot = strrchr (name, '.');
+ if (G_UNLIKELY (!dot)) return;
+
+ interface = g_strndup (name, dot - name);
+ member = dot + 1;
+ tp_cli_dbus_properties_call_set (priv->tp_conn, -1,
+ interface, member, value,
+ NULL, NULL, NULL, NULL);
+ g_free (interface);
+}
+
diff --git a/src/mcd-connection.h b/src/mcd-connection.h
index db68dd0..d2e7074 100644
--- a/src/mcd-connection.h
+++ b/src/mcd-connection.h
@@ -105,5 +105,10 @@ void mcd_connection_set_reconnect (McdConnection *connection,
void mcd_connection_connect (McdConnection *connection, GHashTable *params);
void mcd_connection_close (McdConnection *connection);
+/* not exported */
+G_GNUC_INTERNAL
+void _mcd_connection_update_property (McdConnection *connection,
+ const gchar *name, const GValue *value);
+
G_END_DECLS
#endif /* __MCD_CONNECTION_H__ */
--
1.5.6.5
More information about the telepathy-commits
mailing list