[telepathy-mission-control/master] McdAccount: add a way to adjust presence temporarily
Simon McVittie
simon.mcvittie at collabora.co.uk
Wed Apr 8 10:53:05 PDT 2009
This can be used for auto-away embedded in MC (as seen in
McdMaster).
---
src/mcd-account.c | 15 ++++++++++++++-
src/mcd-account.h | 2 ++
2 files changed, 16 insertions(+), 1 deletions(-)
diff --git a/src/mcd-account.c b/src/mcd-account.c
index 14dfb1f..469b5f9 100644
--- a/src/mcd-account.c
+++ b/src/mcd-account.c
@@ -134,6 +134,7 @@ struct _McdAccountPrivate
guint enabled : 1;
guint valid : 1;
guint loaded : 1;
+ guint temporary_presence : 1;
/* These fields are used to cache the changed properties */
GHashTable *changed_properties;
@@ -457,7 +458,8 @@ mcd_account_request_presence_int (McdAccount *account,
changed = TRUE;
}
- if (!changed) return changed;
+ if (!(changed || priv->temporary_presence))
+ return FALSE;
if (type >= TP_CONNECTION_PRESENCE_TYPE_AVAILABLE && !priv->connection)
{
@@ -2393,3 +2395,14 @@ _mcd_account_set_connection (McdAccount *account, McdConnection *connection)
}
}
+void
+_mcd_account_request_temporary_presence (McdAccount *self,
+ TpConnectionPresenceType type,
+ const gchar *status)
+{
+ /* tell the McdConnection (if it exists) to update our presence, but don't
+ * alter RequestedPresence (so we can go back to the old value later) */
+ g_signal_emit (self, _mcd_account_signals[REQUESTED_PRESENCE_CHANGED],
+ 0, type, status, "");
+ self->priv->temporary_presence = TRUE;
+}
diff --git a/src/mcd-account.h b/src/mcd-account.h
index 9f261c8..9adeca8 100644
--- a/src/mcd-account.h
+++ b/src/mcd-account.h
@@ -119,6 +119,8 @@ void mcd_account_get_requested_presence (McdAccount *account,
TpConnectionPresenceType *presence,
const gchar **status,
const gchar **message);
+G_GNUC_INTERNAL void _mcd_account_request_temporary_presence (McdAccount *self,
+ TpConnectionPresenceType type, const gchar *status);
gboolean mcd_account_get_connect_automatically (McdAccount *account);
void mcd_account_get_automatic_presence (McdAccount *account,
--
1.5.6.5
More information about the telepathy-commits
mailing list