summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2010-05-25 15:47:38 +0100
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2010-05-25 16:01:09 +0100
commitffa1154dddfdb8a1b52cab61fa8b93079ba28da7 (patch)
tree85122d2ec5cc8227a196deb06e3dc61870313cbd
parent2948ab95e843a969840d9e2696103e9b63282c92 (diff)
tp_account_get_changing_presence, TpAccount:changing-presence: add
-rw-r--r--docs/reference/telepathy-glib-sections.txt1
-rw-r--r--telepathy-glib/account.c60
-rw-r--r--telepathy-glib/account.h2
3 files changed, 63 insertions, 0 deletions
diff --git a/docs/reference/telepathy-glib-sections.txt b/docs/reference/telepathy-glib-sections.txt
index 21b2d248..c78e34d3 100644
--- a/docs/reference/telepathy-glib-sections.txt
+++ b/docs/reference/telepathy-glib-sections.txt
@@ -3391,6 +3391,7 @@ tp_account_set_connect_automatically_async
tp_account_set_connect_automatically_finish
tp_account_get_has_been_online
tp_account_get_connection_status
+tp_account_get_changing_presence
tp_account_get_current_presence
tp_account_get_requested_presence
tp_account_get_parameters
diff --git a/telepathy-glib/account.c b/telepathy-glib/account.c
index d5bdb95d..4f68b12d 100644
--- a/telepathy-glib/account.c
+++ b/telepathy-glib/account.c
@@ -94,6 +94,7 @@ struct _TpAccountPrivate {
gchar *requested_status;
gchar *requested_message;
+ gboolean changing_presence;
gboolean connect_automatically;
gboolean has_been_online;
@@ -126,6 +127,7 @@ static guint signals[LAST_SIGNAL];
/* properties */
enum {
PROP_ENABLED = 1,
+ PROP_CHANGING_PRESENCE,
PROP_CURRENT_PRESENCE_TYPE,
PROP_CURRENT_STATUS,
PROP_CURRENT_STATUS_MESSAGE,
@@ -487,6 +489,17 @@ _tp_account_update (TpAccount *account,
}
}
+ if (g_hash_table_lookup (properties, "ChangingPresence") != NULL)
+ {
+ gboolean old = priv->changing_presence;
+
+ priv->changing_presence =
+ tp_asv_get_boolean (properties, "ChangingPresence", NULL);
+
+ if (old != priv->changing_presence)
+ g_object_notify (G_OBJECT (account), "changing-presence");
+ }
+
if (g_hash_table_lookup (properties, "ConnectAutomatically") != NULL)
{
gboolean old = priv->connect_automatically;
@@ -634,6 +647,9 @@ _tp_account_get_property (GObject *object,
case PROP_ICON_NAME:
g_value_set_string (value, self->priv->icon_name);
break;
+ case PROP_CHANGING_PRESENCE:
+ g_value_set_boolean (value, self->priv->changing_presence);
+ break;
case PROP_CONNECT_AUTOMATICALLY:
g_value_set_boolean (value, self->priv->connect_automatically);
break;
@@ -810,6 +826,32 @@ tp_account_class_init (TpAccountClass *klass)
G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
/**
+ * TpAccount:changing-presence:
+ *
+ * %TRUE if an attempt is currently being made to change the account's
+ * presence (#TpAccount:current-presence-type, #TpAccount:current-status
+ * and #TpAccount:current-status-message) to match its requested presence
+ * (#TpAccount:requested-presence-type, #TpAccount:requested-status
+ * and #TpAccount:requested-status-message).
+ *
+ * One can receive change notifications on this property by connecting
+ * to the #GObject::notify signal and using this property as the signal
+ * detail.
+ *
+ * This is not guaranteed to have been retrieved until
+ * tp_proxy_prepare_async() has finished; until then, the value is
+ * %FALSE.
+ *
+ * Since: 0.11.UNRELEASED
+ */
+ g_object_class_install_property (object_class, PROP_CHANGING_PRESENCE,
+ g_param_spec_boolean ("changing-presence",
+ "Changing Presence",
+ "TRUE if presence is changing",
+ FALSE,
+ G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
+
+ /**
* TpAccount:connection-status:
*
* The account's connection status type (a %TpConnectionStatus).
@@ -2014,6 +2056,24 @@ tp_account_remove_finish (TpAccount *account,
}
/**
+ * tp_account_get_changing_presence:
+ * @self: an account
+ *
+ * <!-- -->
+ *
+ * Returns: the same as the #TpAccount:changing-presence property
+ *
+ * Since: 0.11.UNRELEASED
+ */
+gboolean
+tp_account_get_changing_presence (TpAccount *self)
+{
+ g_return_val_if_fail (TP_IS_ACCOUNT (self), FALSE);
+
+ return self->priv->changing_presence;
+}
+
+/**
* tp_account_get_connect_automatically:
* @account: a #TpAccount
*
diff --git a/telepathy-glib/account.h b/telepathy-glib/account.h
index f305070c..4edad98d 100644
--- a/telepathy-glib/account.h
+++ b/telepathy-glib/account.h
@@ -198,6 +198,8 @@ gboolean tp_account_set_avatar_finish (TpAccount *self,
GAsyncResult *result,
GError **error);
+gboolean tp_account_get_changing_presence (TpAccount *self);
+
G_END_DECLS
#include <telepathy-glib/_gen/tp-cli-account.h>