empathy r2054 - trunk/libempathy
- From: xclaesse svn gnome org
- To: svn-commits-list gnome org
- Subject: empathy r2054 - trunk/libempathy
- Date: Tue, 6 Jan 2009 16:47:31 +0000 (UTC)
Author: xclaesse
Date: Tue Jan 6 16:47:31 2009
New Revision: 2054
URL: http://svn.gnome.org/viewvc/empathy?rev=2054&view=rev
Log:
Add an API to EmpathyAccountManager to find out if an account has just
connected.
Modified:
trunk/libempathy/empathy-account-manager.c
trunk/libempathy/empathy-account-manager.h
Modified: trunk/libempathy/empathy-account-manager.c
==============================================================================
--- trunk/libempathy/empathy-account-manager.c (original)
+++ trunk/libempathy/empathy-account-manager.c Tue Jan 6 16:47:31 2009
@@ -41,7 +41,9 @@
typedef struct {
McPresence presence;
TpConnectionStatus connection;
- gboolean is_enabled;
+ gboolean is_enabled;
+
+ guint source_id;
} AccountData;
enum {
@@ -70,6 +72,7 @@
retval->presence = presence;
retval->connection = connection;
retval->is_enabled = is_enabled;
+ retval->source_id = 0;
return retval;
}
@@ -100,6 +103,11 @@
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 @@
}
}
+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 @@
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 @@
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);
+}
Modified: trunk/libempathy/empathy-account-manager.h
==============================================================================
--- trunk/libempathy/empathy-account-manager.h (original)
+++ trunk/libempathy/empathy-account-manager.h Tue Jan 6 16:47:31 2009
@@ -24,6 +24,8 @@
#include <glib-object.h>
+#include <libmissioncontrol/mc-account.h>
+
G_BEGIN_DECLS
#define EMPATHY_TYPE_ACCOUNT_MANAGER (empathy_account_manager_get_type ())
@@ -54,6 +56,10 @@
(EmpathyAccountManager *manager);
int empathy_account_manager_get_connecting_accounts
(EmpathyAccountManager *manager);
+gboolean empathy_account_manager_is_account_just_connected
+ (EmpathyAccountManager *manager,
+ McAccount *account);
+
G_END_DECLS
#endif /* __EMPATHY_ACCOUNT_MANAGER_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]