[Telepathy-commits] [telepathy-mission-control/master] Make the Connection account property be an object path
Alberto Mardegan
alberto.mardegan at nokia.com
Mon Nov 17 00:05:14 PST 2008
Code is simpler if the Connection account property is the connection object
path.
Use the value "/" for no connection.
---
libmcclient/mc-account.c | 7 ++++++-
src/mcd-account.c | 10 +++-------
xml/Account.xml | 10 +++++++---
3 files changed, 16 insertions(+), 11 deletions(-)
diff --git a/libmcclient/mc-account.c b/libmcclient/mc-account.c
index 150bd46..8ae2f39 100644
--- a/libmcclient/mc-account.c
+++ b/libmcclient/mc-account.c
@@ -480,8 +480,13 @@ update_property (gpointer key, gpointer ht_value, gpointer user_data)
}
else if (strcmp (name, "Connection") == 0)
{
+ const gchar *object_path;
g_free (props->connection);
- props->connection = g_value_dup_string (value);
+ object_path = g_value_get_boxed (value);
+ if (object_path && strcmp (object_path, "/") != 0)
+ props->connection = g_strdup (object_path);
+ else
+ props->connection = NULL;
}
else if (strcmp (name, "ConnectionStatus") == 0)
{
diff --git a/src/mcd-account.c b/src/mcd-account.c
index 06989ef..80b41c1 100644
--- a/src/mcd-account.c
+++ b/src/mcd-account.c
@@ -714,18 +714,14 @@ get_connection (TpSvcDBusProperties *self, const gchar *name, GValue *value)
McdAccount *account = MCD_ACCOUNT (self);
McdAccountPrivate *priv = account->priv;
const gchar *object_path;
- gchar *bus_name;
g_debug ("%s called for %s", G_STRFUNC, priv->unique_name);
- g_value_init (value, G_TYPE_STRING);
+ g_value_init (value, DBUS_TYPE_G_OBJECT_PATH);
if (priv->connection &&
(object_path = mcd_connection_get_object_path (priv->connection)))
- {
- bus_name = g_strdelimit (g_strdup (object_path + 1), "/", '.');
- g_value_take_string (value, bus_name);
- }
+ g_value_set_boxed (value, object_path);
else
- g_value_set_static_string (value, "");
+ g_value_set_static_boxed (value, "/");
}
static void
diff --git a/xml/Account.xml b/xml/Account.xml
index e5eca7a..334a56a 100644
--- a/xml/Account.xml
+++ b/xml/Account.xml
@@ -363,10 +363,14 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
</tp:docstring>
</property>
- <property name="Connection" type="s" access="read">
+ <property name="Connection" type="o" access="read">
<tp:docstring>
- Either the well-known bus name of the connection to this account,
- or the empty string if there is no connection.
+ Either the object path of the connection to this account,
+ or the special value '/' if there is no connection.
+
+ <tp:rationale>
+ Object paths aren't nullable, so we can't use an empty string.
+ </tp:rationale>
</tp:docstring>
</property>
--
1.5.6.5
More information about the Telepathy-commits
mailing list