From 8cc41d121d1579893c2c7f7cc7bc90670170380f Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Fri, 24 Jan 2014 16:31:53 -0500 Subject: TpBaseConnection: add "account-path-suffix" property --- docs/reference/telepathy-glib-sections.txt | 1 + telepathy-glib/base-connection.c | 52 ++++++++++++++++++++++++++++++ telepathy-glib/base-connection.h | 4 +++ 3 files changed, 57 insertions(+) diff --git a/docs/reference/telepathy-glib-sections.txt b/docs/reference/telepathy-glib-sections.txt index 3940cba44..c6ac9fffb 100644 --- a/docs/reference/telepathy-glib-sections.txt +++ b/docs/reference/telepathy-glib-sections.txt @@ -86,6 +86,7 @@ TP_BASE_CONNECTION_ERROR_IF_NOT_CONNECTED tp_base_connection_register_with_contacts_mixin tp_base_connection_add_possible_client_interest tp_base_connection_add_client_interest +tp_base_connection_get_account_path_suffix TpChannelManagerIter tp_base_connection_channel_manager_iter_init diff --git a/telepathy-glib/base-connection.c b/telepathy-glib/base-connection.c index c44027951..8608dc2ef 100644 --- a/telepathy-glib/base-connection.c +++ b/telepathy-glib/base-connection.c @@ -291,6 +291,7 @@ enum PROP_DBUS_STATUS, PROP_DBUS_DAEMON, PROP_HAS_IMMORTAL_HANDLES, + PROP_ACCOUNT_PATH_SUFFIX, N_PROPS }; @@ -441,6 +442,8 @@ struct _TpBaseConnectionPrivate /* GQuark iface => GHashTable { * unique name borrowed from interested_clients => gsize count } */ GHashTable *client_interests; + + gchar *account_path_suffix; }; static const gchar * const *tp_base_connection_get_interfaces ( @@ -500,6 +503,10 @@ tp_base_connection_get_property (GObject *object, g_value_set_boolean (value, TRUE); break; + case PROP_ACCOUNT_PATH_SUFFIX: + g_value_set_string (value, self->priv->account_path_suffix); + break; + default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; @@ -537,6 +544,11 @@ tp_base_connection_set_property (GObject *object, } break; + case PROP_ACCOUNT_PATH_SUFFIX: + g_assert (self->priv->account_path_suffix == NULL); /* construct-only */ + self->priv->account_path_suffix = g_value_dup_string (value); + break; + default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; @@ -637,6 +649,7 @@ tp_base_connection_finalize (GObject *object) g_free (self->object_path); g_hash_table_unref (priv->client_interests); g_hash_table_unref (priv->interested_clients); + g_free (priv->account_path_suffix); G_OBJECT_CLASS (tp_base_connection_parent_class)->finalize (object); } @@ -1668,6 +1681,27 @@ tp_base_connection_class_init (TpBaseConnectionClass *klass) g_object_class_install_property (object_class, PROP_HAS_IMMORTAL_HANDLES, param_spec); + /** + * TpBaseConnection:account-path-suffix: + * + * The suffix of the account object path such as + * "gabble/jabber/chris_40example_2ecom0" for the account whose object path is + * %TP_ACCOUNT_OBJECT_PATH_BASE + "gabble/jabber/chris_40example_2ecom0". + * The same as returned by tp_account_get_path_suffix(). + * + * It is given by the AccountManager in the connection parameters. Or %NULL if + * the ConnectionManager or the AccountManager are too old. + * + * Since: 0.UNRELEASED + */ + param_spec = g_param_spec_string ("account-path-suffix", + "Account path suffix", + "The suffix of the account path", + NULL, + G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS); + g_object_class_install_property (object_class, PROP_ACCOUNT_PATH_SUFFIX, + param_spec); + /* signal definitions */ /** @@ -4094,3 +4128,21 @@ tp_base_connection_get_object_path (TpBaseConnection *self) return self->object_path; } + +/** + * tp_base_connection_get_account_path_suffix: + * @self: the connection + * + * + * + * Returns: the same value has the #TpBaseConnection:account-path-suffix + * property. + * Since: 0.UNRELEASED + */ +const gchar * +tp_base_connection_get_account_path_suffix (TpBaseConnection *self) +{ + g_return_val_if_fail (TP_IS_BASE_CONNECTION (self), NULL); + + return self->priv->account_path_suffix; +} diff --git a/telepathy-glib/base-connection.h b/telepathy-glib/base-connection.h index 264f64213..e0e414e9f 100644 --- a/telepathy-glib/base-connection.h +++ b/telepathy-glib/base-connection.h @@ -241,6 +241,10 @@ void tp_base_connection_add_client_interest (TpBaseConnection *self, void tp_base_connection_add_possible_client_interest (TpBaseConnection *self, GQuark token); +_TP_AVAILABLE_IN_UNRELEASED +const gchar *tp_base_connection_get_account_path_suffix ( + TpBaseConnection *self); + G_END_DECLS #endif /* #ifndef __TP_BASE_CONNECTION_H__*/ -- cgit v1.2.1