aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy/empathy-account-manager.c
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@src.gnome.org>2009-01-07 00:47:31 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2009-01-07 00:47:31 +0800
commit7aa18c1cd5858b1bf3ef353c78400ad2bc6da307 (patch)
treefc42afaec8db0fdd495b7c4ad9d3a028c305a24c /libempathy/empathy-account-manager.c
parentd8496968bd3b210b8b76daaf2feb2ddcd04e9822 (diff)
downloadgsoc2013-empathy-7aa18c1cd5858b1bf3ef353c78400ad2bc6da307.tar
gsoc2013-empathy-7aa18c1cd5858b1bf3ef353c78400ad2bc6da307.tar.gz
gsoc2013-empathy-7aa18c1cd5858b1bf3ef353c78400ad2bc6da307.tar.bz2
gsoc2013-empathy-7aa18c1cd5858b1bf3ef353c78400ad2bc6da307.tar.lz
gsoc2013-empathy-7aa18c1cd5858b1bf3ef353c78400ad2bc6da307.tar.xz
gsoc2013-empathy-7aa18c1cd5858b1bf3ef353c78400ad2bc6da307.tar.zst
gsoc2013-empathy-7aa18c1cd5858b1bf3ef353c78400ad2bc6da307.zip
Add an API to EmpathyAccountManager to find out if an account has just
connected. svn path=/trunk/; revision=2054
Diffstat (limited to 'libempathy/empathy-account-manager.c')
-rw-r--r--libempathy/empathy-account-manager.c45
1 files changed, 43 insertions, 2 deletions
diff --git a/libempathy/empathy-account-manager.c b/libempathy/empathy-account-manager.c
index e3b628146..050144aad 100644
--- a/libempathy/empathy-account-manager.c
+++ b/libempathy/empathy-account-manager.c
@@ -41,7 +41,9 @@ typedef struct {
typedef struct {
McPresence presence;
TpConnectionStatus connection;
- gboolean is_enabled;
+ gboolean is_enabled;
+
+ guint source_id;
} AccountData;
enum {
@@ -70,6 +72,7 @@ account_data_new (McPresence presence, TpConnectionStatus connection,
retval->presence = presence;
retval->connection = connection;
retval->is_enabled = is_enabled;
+ retval->source_id = 0;
return retval;
}
@@ -100,6 +103,11 @@ account_data_new_default (MissionControl *mc,
static void
account_data_free (AccountData *data)
{
+ if (data->source_id > 0) {
+ g_source_remove (data->source_id);
+ data->source_id = 0;
+ }
+
g_slice_free (AccountData, data);
}
@@ -229,6 +237,16 @@ update_connection_numbers (EmpathyAccountManager *manager,
}
}
+static gboolean
+remove_data_timeout (gpointer _data)
+{
+ AccountData *data = _data;
+
+ data->source_id = 0;
+
+ return FALSE;
+}
+
static void
account_status_changed_cb (MissionControl *mc,
TpConnectionStatus connection,
@@ -264,8 +282,15 @@ account_status_changed_cb (MissionControl *mc,
g_signal_emit (manager, signals[ACCOUNT_CONNECTION_CHANGED], 0,
account, reason, connection, old_c);
+
+ if (old_c == TP_CONNECTION_STATUS_CONNECTING &&
+ connection == TP_CONNECTION_STATUS_CONNECTED) {
+ data->source_id = g_timeout_add_seconds (10,
+ remove_data_timeout,
+ data);
+ }
}
-
+
g_object_unref (account);
}
}
@@ -458,3 +483,19 @@ empathy_account_manager_get_connecting_accounts (EmpathyAccountManager *manager)
return priv->connecting;
}
+gboolean
+empathy_account_manager_is_account_just_connected (EmpathyAccountManager *manager,
+ McAccount *account)
+{
+ EmpathyAccountManagerPriv *priv;
+ AccountData *data;
+
+ g_assert (EMPATHY_IS_ACCOUNT_MANAGER (manager));
+
+ priv = GET_PRIV (manager);
+ data = g_hash_table_lookup (priv->accounts, account);
+
+ g_assert (data);
+
+ return (data->source_id > 0);
+}