aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy
diff options
context:
space:
mode:
Diffstat (limited to 'libempathy')
-rw-r--r--libempathy/empathy-account-manager.c694
-rw-r--r--libempathy/empathy-account-manager.h16
-rw-r--r--libempathy/empathy-contact-monitor.c518
-rw-r--r--libempathy/empathy-contact-monitor.h10
-rw-r--r--libempathy/empathy-types.h2
5 files changed, 620 insertions, 620 deletions
diff --git a/libempathy/empathy-account-manager.c b/libempathy/empathy-account-manager.c
index 2eab490ac..aeef880bc 100644
--- a/libempathy/empathy-account-manager.c
+++ b/libempathy/empathy-account-manager.c
@@ -1,4 +1,4 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; -*- */
/*
* Copyright (C) 2008 Collabora Ltd.
*
@@ -30,31 +30,31 @@
#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyAccountManager)
typedef struct {
- McAccountMonitor *monitor;
- MissionControl *mc;
+ McAccountMonitor *monitor;
+ MissionControl *mc;
- GHashTable *accounts;
- int connected;
- int connecting;
+ GHashTable *accounts;
+ int connected;
+ int connecting;
} EmpathyAccountManagerPriv;
typedef struct {
- McPresence presence;
- TpConnectionStatus connection;
- gboolean is_enabled;
+ McPresence presence;
+ TpConnectionStatus connection;
+ gboolean is_enabled;
- guint source_id;
+ guint source_id;
} AccountData;
enum {
- ACCOUNT_CREATED,
- ACCOUNT_DELETED,
- ACCOUNT_ENABLED,
- ACCOUNT_DISABLED,
- ACCOUNT_CHANGED,
- ACCOUNT_CONNECTION_CHANGED,
- ACCOUNT_PRESENCE_CHANGED,
- LAST_SIGNAL
+ ACCOUNT_CREATED,
+ ACCOUNT_DELETED,
+ ACCOUNT_ENABLED,
+ ACCOUNT_DISABLED,
+ ACCOUNT_CHANGED,
+ ACCOUNT_CONNECTION_CHANGED,
+ ACCOUNT_PRESENCE_CHANGED,
+ LAST_SIGNAL
};
static guint signals[LAST_SIGNAL];
@@ -64,406 +64,406 @@ G_DEFINE_TYPE (EmpathyAccountManager, empathy_account_manager, G_TYPE_OBJECT);
static AccountData *
account_data_new (McPresence presence, TpConnectionStatus connection,
- gboolean is_enabled)
+ gboolean is_enabled)
{
- AccountData *retval;
+ AccountData *retval;
- retval = g_slice_new0 (AccountData);
- retval->presence = presence;
- retval->connection = connection;
- retval->is_enabled = is_enabled;
- retval->source_id = 0;
+ retval = g_slice_new0 (AccountData);
+ retval->presence = presence;
+ retval->connection = connection;
+ retval->is_enabled = is_enabled;
+ retval->source_id = 0;
- return retval;
+ return retval;
}
static AccountData *
account_data_new_default (MissionControl *mc,
- McAccount *account)
+ McAccount *account)
{
- McPresence actual_p;
- TpConnectionStatus actual_c;
- GError *err = NULL;
-
- actual_p = mission_control_get_presence_actual (mc, &err);
- if (err) {
- actual_p = MC_PRESENCE_UNSET;
- g_clear_error (&err);
- }
-
- actual_c = mission_control_get_connection_status (mc,
- account, &err);
- if (err) {
- actual_c = TP_CONNECTION_STATUS_DISCONNECTED;
- }
-
- return account_data_new (actual_p, actual_c, mc_account_is_enabled (account));
+ McPresence actual_p;
+ TpConnectionStatus actual_c;
+ GError *err = NULL;
+
+ actual_p = mission_control_get_presence_actual (mc, &err);
+ if (err) {
+ actual_p = MC_PRESENCE_UNSET;
+ g_clear_error (&err);
+ }
+
+ actual_c = mission_control_get_connection_status (mc,
+ account, &err);
+ if (err) {
+ actual_c = TP_CONNECTION_STATUS_DISCONNECTED;
+ }
+
+ return account_data_new (actual_p, actual_c, mc_account_is_enabled (account));
}
static void
account_data_free (AccountData *data)
{
- if (data->source_id > 0) {
- g_source_remove (data->source_id);
- data->source_id = 0;
- }
+ if (data->source_id > 0) {
+ g_source_remove (data->source_id);
+ data->source_id = 0;
+ }
- g_slice_free (AccountData, data);
+ g_slice_free (AccountData, data);
}
static void
account_created_cb (McAccountMonitor *mon,
- gchar *account_name,
- EmpathyAccountManager *manager)
+ gchar *account_name,
+ EmpathyAccountManager *manager)
{
- McAccount *account;
- EmpathyAccountManagerPriv *priv = GET_PRIV (manager);
+ McAccount *account;
+ EmpathyAccountManagerPriv *priv = GET_PRIV (manager);
- account = mc_account_lookup (account_name);
+ account = mc_account_lookup (account_name);
- if (account) {
- AccountData *data;
+ if (account) {
+ AccountData *data;
- data = account_data_new_default (priv->mc, account);
+ data = account_data_new_default (priv->mc, account);
- g_hash_table_insert (priv->accounts, account, data);
+ g_hash_table_insert (priv->accounts, account, data);
- g_signal_emit (manager, signals[ACCOUNT_CREATED], 0, account);
- }
+ g_signal_emit (manager, signals[ACCOUNT_CREATED], 0, account);
+ }
}
static void
account_deleted_cb (McAccountMonitor *mon,
- gchar *account_name,
- EmpathyAccountManager *manager)
+ gchar *account_name,
+ EmpathyAccountManager *manager)
{
- McAccount *account;
- EmpathyAccountManagerPriv *priv = GET_PRIV (manager);
+ McAccount *account;
+ EmpathyAccountManagerPriv *priv = GET_PRIV (manager);
- account = mc_account_lookup (account_name);
+ account = mc_account_lookup (account_name);
- if (account) {
- g_signal_emit (manager, signals[ACCOUNT_DELETED], 0, account);
-
- g_hash_table_remove (priv->accounts, account);
- g_object_unref (account);
- }
+ if (account) {
+ g_signal_emit (manager, signals[ACCOUNT_DELETED], 0, account);
+
+ g_hash_table_remove (priv->accounts, account);
+ g_object_unref (account);
+ }
}
static void
account_changed_cb (McAccountMonitor *mon,
- gchar *account_name,
- EmpathyAccountManager *manager)
+ gchar *account_name,
+ EmpathyAccountManager *manager)
{
- McAccount *account;
+ McAccount *account;
- account = mc_account_lookup (account_name);
+ account = mc_account_lookup (account_name);
- if (account) {
- g_signal_emit (manager, signals[ACCOUNT_CHANGED], 0, account);
- g_object_unref (account);
- }
+ if (account) {
+ g_signal_emit (manager, signals[ACCOUNT_CHANGED], 0, account);
+ g_object_unref (account);
+ }
}
static void
account_disabled_cb (McAccountMonitor *mon,
- gchar *account_name,
- EmpathyAccountManager *manager)
+ gchar *account_name,
+ EmpathyAccountManager *manager)
{
- McAccount *account;
- EmpathyAccountManagerPriv *priv = GET_PRIV (manager);
- AccountData *data;
+ McAccount *account;
+ EmpathyAccountManagerPriv *priv = GET_PRIV (manager);
+ AccountData *data;
- account = mc_account_lookup (account_name);
+ account = mc_account_lookup (account_name);
- if (account) {
- data = g_hash_table_lookup (priv->accounts, account);
- g_assert (data);
- data->is_enabled = FALSE;
+ if (account) {
+ data = g_hash_table_lookup (priv->accounts, account);
+ g_assert (data);
+ data->is_enabled = FALSE;
- g_signal_emit (manager, signals[ACCOUNT_DISABLED], 0, account);
- }
+ g_signal_emit (manager, signals[ACCOUNT_DISABLED], 0, account);
+ }
}
static void
account_enabled_cb (McAccountMonitor *mon,
- gchar *account_name,
- EmpathyAccountManager *manager)
+ gchar *account_name,
+ EmpathyAccountManager *manager)
{
- McAccount *account;
- EmpathyAccountManagerPriv *priv = GET_PRIV (manager);
- AccountData *data;
+ McAccount *account;
+ EmpathyAccountManagerPriv *priv = GET_PRIV (manager);
+ AccountData *data;
- account = mc_account_lookup (account_name);
+ account = mc_account_lookup (account_name);
- if (account) {
- data = g_hash_table_lookup (priv->accounts, account);
- g_assert (data);
- data->is_enabled = TRUE;
+ if (account) {
+ data = g_hash_table_lookup (priv->accounts, account);
+ g_assert (data);
+ data->is_enabled = TRUE;
- g_signal_emit (manager, signals[ACCOUNT_ENABLED], 0, account);
- g_object_unref (account);
- }
+ g_signal_emit (manager, signals[ACCOUNT_ENABLED], 0, account);
+ g_object_unref (account);
+ }
}
static void
update_connection_numbers (EmpathyAccountManager *manager,
- TpConnectionStatus conn,
- TpConnectionStatus old_c)
+ TpConnectionStatus conn,
+ TpConnectionStatus old_c)
{
- EmpathyAccountManagerPriv *priv = GET_PRIV (manager);
-
- if (conn == TP_CONNECTION_STATUS_CONNECTED) {
- priv->connected++;
- if (old_c == TP_CONNECTION_STATUS_CONNECTING) {
- priv->connecting--;
- }
- }
-
- if (conn == TP_CONNECTION_STATUS_CONNECTING) {
- priv->connecting++;
- if (old_c == TP_CONNECTION_STATUS_CONNECTED) {
- priv->connected--;
- }
- }
-
- if (conn == TP_CONNECTION_STATUS_DISCONNECTED) {
- if (old_c == TP_CONNECTION_STATUS_CONNECTED) {
- priv->connected--;
- }
- if (old_c == TP_CONNECTION_STATUS_CONNECTING) {
- priv->connecting--;
- }
- }
+ EmpathyAccountManagerPriv *priv = GET_PRIV (manager);
+
+ if (conn == TP_CONNECTION_STATUS_CONNECTED) {
+ priv->connected++;
+ if (old_c == TP_CONNECTION_STATUS_CONNECTING) {
+ priv->connecting--;
+ }
+ }
+
+ if (conn == TP_CONNECTION_STATUS_CONNECTING) {
+ priv->connecting++;
+ if (old_c == TP_CONNECTION_STATUS_CONNECTED) {
+ priv->connected--;
+ }
+ }
+
+ if (conn == TP_CONNECTION_STATUS_DISCONNECTED) {
+ if (old_c == TP_CONNECTION_STATUS_CONNECTED) {
+ priv->connected--;
+ }
+ if (old_c == TP_CONNECTION_STATUS_CONNECTING) {
+ priv->connecting--;
+ }
+ }
}
static gboolean
remove_data_timeout (gpointer _data)
{
- AccountData *data = _data;
+ AccountData *data = _data;
- data->source_id = 0;
+ data->source_id = 0;
- return FALSE;
+ return FALSE;
}
static void
account_status_changed_cb (MissionControl *mc,
- TpConnectionStatus connection,
- McPresence presence,
- TpConnectionStatusReason reason,
- const gchar *unique_name,
- EmpathyAccountManager *manager)
+ TpConnectionStatus connection,
+ McPresence presence,
+ TpConnectionStatusReason reason,
+ const gchar *unique_name,
+ EmpathyAccountManager *manager)
{
- McAccount *account;
- EmpathyAccountManagerPriv *priv = GET_PRIV (manager);
- AccountData *data;
- McPresence old_p;
- TpConnectionStatus old_c;
-
- account = mc_account_lookup (unique_name);
-
- if (account) {
- data = g_hash_table_lookup (priv->accounts, account);
- g_assert (data);
-
- old_p = data->presence;
- old_c = data->connection;
-
- if (old_p != presence) {
- data->presence = presence;
- g_signal_emit (manager, signals[ACCOUNT_PRESENCE_CHANGED], 0,
- account, presence, old_p);
- }
-
- if (old_c != connection) {
- data->connection = connection;
- update_connection_numbers (manager, connection, old_c);
-
- 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) {
- if (data->source_id > 0) {
- g_source_remove (data->source_id);
- data->source_id = 0;
- }
-
- data->source_id = g_timeout_add_seconds (10,
- remove_data_timeout,
- data);
- }
- }
-
- g_object_unref (account);
- }
+ McAccount *account;
+ EmpathyAccountManagerPriv *priv = GET_PRIV (manager);
+ AccountData *data;
+ McPresence old_p;
+ TpConnectionStatus old_c;
+
+ account = mc_account_lookup (unique_name);
+
+ if (account) {
+ data = g_hash_table_lookup (priv->accounts, account);
+ g_assert (data);
+
+ old_p = data->presence;
+ old_c = data->connection;
+
+ if (old_p != presence) {
+ data->presence = presence;
+ g_signal_emit (manager, signals[ACCOUNT_PRESENCE_CHANGED], 0,
+ account, presence, old_p);
+ }
+
+ if (old_c != connection) {
+ data->connection = connection;
+ update_connection_numbers (manager, connection, old_c);
+
+ 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) {
+ if (data->source_id > 0) {
+ g_source_remove (data->source_id);
+ data->source_id = 0;
+ }
+
+ data->source_id = g_timeout_add_seconds (10,
+ remove_data_timeout,
+ data);
+ }
+ }
+
+ g_object_unref (account);
+ }
}
static void
empathy_account_manager_init (EmpathyAccountManager *manager)
{
- EmpathyAccountManagerPriv *priv =
- G_TYPE_INSTANCE_GET_PRIVATE (manager,
- EMPATHY_TYPE_ACCOUNT_MANAGER, EmpathyAccountManagerPriv);
- GList *mc_accounts, *l;
- AccountData *data;
-
- manager->priv = priv;
- priv->monitor = mc_account_monitor_new ();
- priv->mc = empathy_mission_control_new ();
- priv->connected = priv->connecting = 0;
-
- priv->accounts = g_hash_table_new_full (empathy_account_hash,
- empathy_account_equal,
- g_object_unref,
- (GDestroyNotify) account_data_free);
-
- mc_accounts = mc_accounts_list ();
-
- for (l = mc_accounts; l; l = l->next) {
- data = account_data_new_default (priv->mc, l->data);
-
- g_hash_table_insert (priv->accounts, g_object_ref (l->data),
- data);
- }
-
- g_signal_connect (priv->monitor, "account-created",
- G_CALLBACK (account_created_cb), manager);
- g_signal_connect (priv->monitor, "account-deleted",
- G_CALLBACK (account_deleted_cb), manager);
- g_signal_connect (priv->monitor, "account-disabled",
- G_CALLBACK (account_disabled_cb), manager);
- g_signal_connect (priv->monitor, "account-enabled",
- G_CALLBACK (account_enabled_cb), manager);
- g_signal_connect (priv->monitor, "account-changed",
- G_CALLBACK (account_changed_cb), manager);
-
- dbus_g_proxy_connect_signal (DBUS_G_PROXY (priv->mc), "AccountStatusChanged",
- G_CALLBACK (account_status_changed_cb),
- manager, NULL);
+ EmpathyAccountManagerPriv *priv =
+ G_TYPE_INSTANCE_GET_PRIVATE (manager,
+ EMPATHY_TYPE_ACCOUNT_MANAGER, EmpathyAccountManagerPriv);
+ GList *mc_accounts, *l;
+ AccountData *data;
+
+ manager->priv = priv;
+ priv->monitor = mc_account_monitor_new ();
+ priv->mc = empathy_mission_control_new ();
+ priv->connected = priv->connecting = 0;
+
+ priv->accounts = g_hash_table_new_full (empathy_account_hash,
+ empathy_account_equal,
+ g_object_unref,
+ (GDestroyNotify) account_data_free);
+
+ mc_accounts = mc_accounts_list ();
+
+ for (l = mc_accounts; l; l = l->next) {
+ data = account_data_new_default (priv->mc, l->data);
+
+ g_hash_table_insert (priv->accounts, g_object_ref (l->data),
+ data);
+ }
+
+ g_signal_connect (priv->monitor, "account-created",
+ G_CALLBACK (account_created_cb), manager);
+ g_signal_connect (priv->monitor, "account-deleted",
+ G_CALLBACK (account_deleted_cb), manager);
+ g_signal_connect (priv->monitor, "account-disabled",
+ G_CALLBACK (account_disabled_cb), manager);
+ g_signal_connect (priv->monitor, "account-enabled",
+ G_CALLBACK (account_enabled_cb), manager);
+ g_signal_connect (priv->monitor, "account-changed",
+ G_CALLBACK (account_changed_cb), manager);
+
+ dbus_g_proxy_connect_signal (DBUS_G_PROXY (priv->mc), "AccountStatusChanged",
+ G_CALLBACK (account_status_changed_cb),
+ manager, NULL);
}
static void
disconnect_monitor_signals (McAccountMonitor *monitor,
- GObject *obj)
+ GObject *obj)
{
- g_signal_handlers_disconnect_by_func (monitor,
- account_created_cb, obj);
- g_signal_handlers_disconnect_by_func (monitor,
- account_deleted_cb, obj);
- g_signal_handlers_disconnect_by_func (monitor,
- account_disabled_cb, obj);
- g_signal_handlers_disconnect_by_func (monitor,
- account_enabled_cb, obj);
- g_signal_handlers_disconnect_by_func (monitor,
- account_changed_cb, obj);
+ g_signal_handlers_disconnect_by_func (monitor,
+ account_created_cb, obj);
+ g_signal_handlers_disconnect_by_func (monitor,
+ account_deleted_cb, obj);
+ g_signal_handlers_disconnect_by_func (monitor,
+ account_disabled_cb, obj);
+ g_signal_handlers_disconnect_by_func (monitor,
+ account_enabled_cb, obj);
+ g_signal_handlers_disconnect_by_func (monitor,
+ account_changed_cb, obj);
}
-
+
static void
do_finalize (GObject *obj)
{
- EmpathyAccountManager *manager = EMPATHY_ACCOUNT_MANAGER (obj);
- EmpathyAccountManagerPriv *priv = GET_PRIV (manager);
+ EmpathyAccountManager *manager = EMPATHY_ACCOUNT_MANAGER (obj);
+ EmpathyAccountManagerPriv *priv = GET_PRIV (manager);
- dbus_g_proxy_disconnect_signal (DBUS_G_PROXY (priv->mc),
- "AccountStatusChanged",
- G_CALLBACK (account_status_changed_cb),
- obj);
+ dbus_g_proxy_disconnect_signal (DBUS_G_PROXY (priv->mc),
+ "AccountStatusChanged",
+ G_CALLBACK (account_status_changed_cb),
+ obj);
- disconnect_monitor_signals (priv->monitor, obj);
+ disconnect_monitor_signals (priv->monitor, obj);
- g_object_unref (priv->monitor);
- g_object_unref (priv->mc);
+ g_object_unref (priv->monitor);
+ g_object_unref (priv->mc);
- g_hash_table_destroy (priv->accounts);
+ g_hash_table_destroy (priv->accounts);
- G_OBJECT_CLASS (empathy_account_manager_parent_class)->finalize (obj);
+ G_OBJECT_CLASS (empathy_account_manager_parent_class)->finalize (obj);
}
static void
empathy_account_manager_class_init (EmpathyAccountManagerClass *klass)
{
- GObjectClass *oclass = G_OBJECT_CLASS (klass);
-
- oclass->finalize = do_finalize;
-
- signals[ACCOUNT_CREATED] =
- g_signal_new ("account-created",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- 0,
- NULL, NULL,
- g_cclosure_marshal_VOID__OBJECT,
- G_TYPE_NONE,
- 1, MC_TYPE_ACCOUNT);
- signals[ACCOUNT_DELETED] =
- g_signal_new ("account-deleted",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- 0,
- NULL, NULL,
- g_cclosure_marshal_VOID__OBJECT,
- G_TYPE_NONE,
- 1, MC_TYPE_ACCOUNT);
-
- signals[ACCOUNT_ENABLED] =
- g_signal_new ("account-enabled",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- 0,
- NULL, NULL,
- g_cclosure_marshal_VOID__OBJECT,
- G_TYPE_NONE,
- 1, MC_TYPE_ACCOUNT);
-
- signals[ACCOUNT_DISABLED] =
- g_signal_new ("account-disabled",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- 0,
- NULL, NULL,
- g_cclosure_marshal_VOID__OBJECT,
- G_TYPE_NONE,
- 1, MC_TYPE_ACCOUNT);
-
- signals[ACCOUNT_CHANGED] =
- g_signal_new ("account-changed",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- 0,
- NULL, NULL,
- g_cclosure_marshal_VOID__OBJECT,
- G_TYPE_NONE,
- 1, MC_TYPE_ACCOUNT);
-
- signals[ACCOUNT_CONNECTION_CHANGED] =
- g_signal_new ("account-connection-changed",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- 0,
- NULL, NULL,
- _empathy_marshal_VOID__OBJECT_INT_UINT_UINT,
- G_TYPE_NONE,
- 4, MC_TYPE_ACCOUNT,
- G_TYPE_INT, /* reason */
- G_TYPE_UINT, /* actual connection */
- G_TYPE_UINT); /* previous connection */
-
- signals[ACCOUNT_PRESENCE_CHANGED] =
- g_signal_new ("account-presence-changed",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- 0,
- NULL, NULL,
- _empathy_marshal_VOID__OBJECT_INT_INT,
- G_TYPE_NONE,
- 3, MC_TYPE_ACCOUNT,
- G_TYPE_INT, /* actual presence */
- G_TYPE_INT); /* previous presence */
-
-
- g_type_class_add_private (oclass, sizeof (EmpathyAccountManagerPriv));
+ GObjectClass *oclass = G_OBJECT_CLASS (klass);
+
+ oclass->finalize = do_finalize;
+
+ signals[ACCOUNT_CREATED] =
+ g_signal_new ("account-created",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL, NULL,
+ g_cclosure_marshal_VOID__OBJECT,
+ G_TYPE_NONE,
+ 1, MC_TYPE_ACCOUNT);
+
+ signals[ACCOUNT_DELETED] =
+ g_signal_new ("account-deleted",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL, NULL,
+ g_cclosure_marshal_VOID__OBJECT,
+ G_TYPE_NONE,
+ 1, MC_TYPE_ACCOUNT);
+
+ signals[ACCOUNT_ENABLED] =
+ g_signal_new ("account-enabled",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL, NULL,
+ g_cclosure_marshal_VOID__OBJECT,
+ G_TYPE_NONE,
+ 1, MC_TYPE_ACCOUNT);
+
+ signals[ACCOUNT_DISABLED] =
+ g_signal_new ("account-disabled",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL, NULL,
+ g_cclosure_marshal_VOID__OBJECT,
+ G_TYPE_NONE,
+ 1, MC_TYPE_ACCOUNT);
+
+ signals[ACCOUNT_CHANGED] =
+ g_signal_new ("account-changed",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL, NULL,
+ g_cclosure_marshal_VOID__OBJECT,
+ G_TYPE_NONE,
+ 1, MC_TYPE_ACCOUNT);
+
+ signals[ACCOUNT_CONNECTION_CHANGED] =
+ g_signal_new ("account-connection-changed",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL, NULL,
+ _empathy_marshal_VOID__OBJECT_INT_UINT_UINT,
+ G_TYPE_NONE,
+ 4, MC_TYPE_ACCOUNT,
+ G_TYPE_INT, /* reason */
+ G_TYPE_UINT, /* actual connection */
+ G_TYPE_UINT); /* previous connection */
+
+ signals[ACCOUNT_PRESENCE_CHANGED] =
+ g_signal_new ("account-presence-changed",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL, NULL,
+ _empathy_marshal_VOID__OBJECT_INT_INT,
+ G_TYPE_NONE,
+ 3, MC_TYPE_ACCOUNT,
+ G_TYPE_INT, /* actual presence */
+ G_TYPE_INT); /* previous presence */
+
+ g_type_class_add_private (oclass, sizeof (EmpathyAccountManagerPriv));
}
/* public methods */
@@ -471,53 +471,53 @@ empathy_account_manager_class_init (EmpathyAccountManagerClass *klass)
EmpathyAccountManager *
empathy_account_manager_new (void)
{
- if (!manager) {
- manager = g_object_new (EMPATHY_TYPE_ACCOUNT_MANAGER, NULL);
- g_object_add_weak_pointer (G_OBJECT (manager), (gpointer) &manager);
- } else {
- g_object_ref (manager);
- }
-
- return manager;
+ if (!manager) {
+ manager = g_object_new (EMPATHY_TYPE_ACCOUNT_MANAGER, NULL);
+ g_object_add_weak_pointer (G_OBJECT (manager), (gpointer) &manager);
+ } else {
+ g_object_ref (manager);
+ }
+
+ return manager;
}
int
empathy_account_manager_get_connected_accounts (EmpathyAccountManager *manager)
{
- EmpathyAccountManagerPriv *priv;
+ EmpathyAccountManagerPriv *priv;
- g_assert (EMPATHY_IS_ACCOUNT_MANAGER (manager));
+ g_assert (EMPATHY_IS_ACCOUNT_MANAGER (manager));
- priv = GET_PRIV (manager);
+ priv = GET_PRIV (manager);
- return priv->connected;
+ return priv->connected;
}
int
empathy_account_manager_get_connecting_accounts (EmpathyAccountManager *manager)
{
- EmpathyAccountManagerPriv *priv;
+ EmpathyAccountManagerPriv *priv;
- g_assert (EMPATHY_IS_ACCOUNT_MANAGER (manager));
+ g_assert (EMPATHY_IS_ACCOUNT_MANAGER (manager));
- priv = GET_PRIV (manager);
+ priv = GET_PRIV (manager);
- return priv->connecting;
+ return priv->connecting;
}
gboolean
empathy_account_manager_is_account_just_connected (EmpathyAccountManager *manager,
- McAccount *account)
+ McAccount *account)
{
- EmpathyAccountManagerPriv *priv;
- AccountData *data;
+ EmpathyAccountManagerPriv *priv;
+ AccountData *data;
- g_assert (EMPATHY_IS_ACCOUNT_MANAGER (manager));
+ g_assert (EMPATHY_IS_ACCOUNT_MANAGER (manager));
- priv = GET_PRIV (manager);
- data = g_hash_table_lookup (priv->accounts, account);
+ priv = GET_PRIV (manager);
+ data = g_hash_table_lookup (priv->accounts, account);
- g_assert (data);
+ g_assert (data);
- return (data->source_id > 0);
+ return (data->source_id > 0);
}
diff --git a/libempathy/empathy-account-manager.h b/libempathy/empathy-account-manager.h
index 9e1cfce69..a6ebd5f73 100644
--- a/libempathy/empathy-account-manager.h
+++ b/libempathy/empathy-account-manager.h
@@ -1,4 +1,4 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; -*- */
/*
* Copyright (C) 2008 Collabora Ltd.
*
@@ -39,12 +39,12 @@ typedef struct _EmpathyAccountManager EmpathyAccountManager;
typedef struct _EmpathyAccountManagerClass EmpathyAccountManagerClass;
struct _EmpathyAccountManager {
- GObject parent;
- gpointer priv;
+ GObject parent;
+ gpointer priv;
};
struct _EmpathyAccountManagerClass {
- GObjectClass parent_class;
+ GObjectClass parent_class;
};
GType empathy_account_manager_get_type (void);
@@ -53,12 +53,12 @@ GType empathy_account_manager_get_type (void);
EmpathyAccountManager * empathy_account_manager_new (void);
int empathy_account_manager_get_connected_accounts
- (EmpathyAccountManager *manager);
+ (EmpathyAccountManager *manager);
int empathy_account_manager_get_connecting_accounts
- (EmpathyAccountManager *manager);
+ (EmpathyAccountManager *manager);
gboolean empathy_account_manager_is_account_just_connected
- (EmpathyAccountManager *manager,
- McAccount *account);
+ (EmpathyAccountManager *manager,
+ McAccount *account);
G_END_DECLS
diff --git a/libempathy/empathy-contact-monitor.c b/libempathy/empathy-contact-monitor.c
index 8cd55d932..e48f08655 100644
--- a/libempathy/empathy-contact-monitor.c
+++ b/libempathy/empathy-contact-monitor.c
@@ -1,4 +1,4 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; -*- */
/*
* Copyright (C) 2008 Collabora Ltd.
*
@@ -33,35 +33,35 @@
#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyContactMonitor)
typedef struct {
- EmpathyContactList *proxy;
- GPtrArray *contacts;
+ EmpathyContactList *proxy;
+ GPtrArray *contacts;
} EmpathyContactMonitorPriv;
enum {
- CONTACT_ADDED,
- CONTACT_AVATAR_CHANGED,
- CONTACT_CAPABILITIES_CHANGED,
- CONTACT_NAME_CHANGED,
- CONTACT_PRESENCE_CHANGED,
- CONTACT_PRESENCE_MESSAGE_CHANGED,
- CONTACT_REMOVED,
- LAST_SIGNAL
+ CONTACT_ADDED,
+ CONTACT_AVATAR_CHANGED,
+ CONTACT_CAPABILITIES_CHANGED,
+ CONTACT_NAME_CHANGED,
+ CONTACT_PRESENCE_CHANGED,
+ CONTACT_PRESENCE_MESSAGE_CHANGED,
+ CONTACT_REMOVED,
+ LAST_SIGNAL
};
enum {
- PROP_0,
- PROP_PROXY
+ PROP_0,
+ PROP_PROXY
};
static void contact_remove_foreach (EmpathyContact *contact,
- EmpathyContactMonitor *monitor);
+ EmpathyContactMonitor *monitor);
static void cl_members_changed_cb (EmpathyContactList *cl,
- EmpathyContact *contact,
- EmpathyContact *actor,
- guint reason,
- gchar *message,
- gboolean is_member,
- EmpathyContactMonitor *monitor);
+ EmpathyContact *contact,
+ EmpathyContact *actor,
+ guint reason,
+ gchar *message,
+ gboolean is_member,
+ EmpathyContactMonitor *monitor);
static guint signals[LAST_SIGNAL];
@@ -69,335 +69,335 @@ G_DEFINE_TYPE (EmpathyContactMonitor, empathy_contact_monitor, G_TYPE_OBJECT);
static void
do_set_property (GObject *object,
- guint param_id,
- const GValue *value,
- GParamSpec *pspec)
+ guint param_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
- switch (param_id) {
- case PROP_PROXY:
- empathy_contact_monitor_set_proxy
- (EMPATHY_CONTACT_MONITOR (object),
- g_value_get_object (value));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
- break;
- };
+ switch (param_id) {
+ case PROP_PROXY:
+ empathy_contact_monitor_set_proxy
+ (EMPATHY_CONTACT_MONITOR (object),
+ g_value_get_object (value));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
+ break;
+ };
}
static void
do_get_property (GObject *object,
- guint param_id,
- GValue *value,
- GParamSpec *pspec)
+ guint param_id,
+ GValue *value,
+ GParamSpec *pspec)
{
- EmpathyContactMonitorPriv *priv = GET_PRIV (object);
-
- switch (param_id) {
- case PROP_PROXY:
- g_value_set_object (value, priv->proxy);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
- break;
- };
+ EmpathyContactMonitorPriv *priv = GET_PRIV (object);
+
+ switch (param_id) {
+ case PROP_PROXY:
+ g_value_set_object (value, priv->proxy);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
+ break;
+ };
}
static void
do_finalize (GObject *obj)
{
- EmpathyContactMonitorPriv *priv;
-
- priv = GET_PRIV (obj);
-
- if (priv->contacts) {
- g_ptr_array_foreach (priv->contacts,
- (GFunc) contact_remove_foreach, obj);
- g_ptr_array_free (priv->contacts, TRUE);
- priv->contacts = NULL;
- }
-
- if (priv->proxy) {
- g_signal_handlers_disconnect_by_func (priv->proxy,
- cl_members_changed_cb, obj);
- }
-
- G_OBJECT_CLASS (empathy_contact_monitor_parent_class)->finalize (obj);
+ EmpathyContactMonitorPriv *priv;
+
+ priv = GET_PRIV (obj);
+
+ if (priv->contacts) {
+ g_ptr_array_foreach (priv->contacts,
+ (GFunc) contact_remove_foreach, obj);
+ g_ptr_array_free (priv->contacts, TRUE);
+ priv->contacts = NULL;
+ }
+
+ if (priv->proxy) {
+ g_signal_handlers_disconnect_by_func (priv->proxy,
+ cl_members_changed_cb, obj);
+ }
+
+ G_OBJECT_CLASS (empathy_contact_monitor_parent_class)->finalize (obj);
}
static void
empathy_contact_monitor_class_init (EmpathyContactMonitorClass *klass)
{
- GObjectClass *oclass = G_OBJECT_CLASS (klass);
-
- oclass->finalize = do_finalize;
- oclass->get_property = do_get_property;
- oclass->set_property = do_set_property;
-
- g_object_class_install_property (oclass,
- PROP_PROXY,
- g_param_spec_object ("proxy",
- "Monitor's proxy",
- "The contact list associated we're monitoring",
- EMPATHY_TYPE_CONTACT_LIST,
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_STATIC_STRINGS));
-
- signals[CONTACT_ADDED] =
- g_signal_new ("contact-added",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- 0,
- NULL, NULL,
- g_cclosure_marshal_VOID__OBJECT,
- G_TYPE_NONE,
- 1, EMPATHY_TYPE_CONTACT);
- signals[CONTACT_AVATAR_CHANGED] =
- g_signal_new ("contact-avatar-changed",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- 0,
- NULL, NULL,
- g_cclosure_marshal_VOID__OBJECT,
- G_TYPE_NONE,
- 1, EMPATHY_TYPE_CONTACT);
- signals[CONTACT_CAPABILITIES_CHANGED] =
- g_signal_new ("contact-capabilities-changed",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- 0,
- NULL, NULL,
- g_cclosure_marshal_VOID__OBJECT,
- G_TYPE_NONE,
- 1, EMPATHY_TYPE_CONTACT);
- signals[CONTACT_NAME_CHANGED] =
- g_signal_new ("contact-name-changed",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- 0,
- NULL, NULL,
- _empathy_marshal_VOID__OBJECT_STRING,
- G_TYPE_NONE,
- 2, EMPATHY_TYPE_CONTACT,
- G_TYPE_STRING);
- signals[CONTACT_PRESENCE_CHANGED] =
- g_signal_new ("contact-presence-changed",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- 0,
- NULL, NULL,
- _empathy_marshal_VOID__OBJECT_ENUM_ENUM,
- G_TYPE_NONE,
- 3, EMPATHY_TYPE_CONTACT,
- MC_TYPE_PRESENCE,
- MC_TYPE_PRESENCE);
- signals[CONTACT_PRESENCE_MESSAGE_CHANGED] =
- g_signal_new ("contact-presence-message-changed",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- 0,
- NULL, NULL,
- _empathy_marshal_VOID__OBJECT_STRING,
- G_TYPE_NONE,
- 2, EMPATHY_TYPE_CONTACT,
- G_TYPE_STRING);
- signals[CONTACT_REMOVED] =
- g_signal_new ("contact-removed",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- 0,
- NULL, NULL,
- g_cclosure_marshal_VOID__OBJECT,
- G_TYPE_NONE,
- 1, EMPATHY_TYPE_CONTACT);
-
- g_type_class_add_private (klass, sizeof (EmpathyContactMonitorPriv));
+ GObjectClass *oclass = G_OBJECT_CLASS (klass);
+
+ oclass->finalize = do_finalize;
+ oclass->get_property = do_get_property;
+ oclass->set_property = do_set_property;
+
+ g_object_class_install_property (oclass,
+ PROP_PROXY,
+ g_param_spec_object ("proxy",
+ "Monitor's proxy",
+ "The contact list associated we're monitoring",
+ EMPATHY_TYPE_CONTACT_LIST,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS));
+
+ signals[CONTACT_ADDED] =
+ g_signal_new ("contact-added",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL, NULL,
+ g_cclosure_marshal_VOID__OBJECT,
+ G_TYPE_NONE,
+ 1, EMPATHY_TYPE_CONTACT);
+ signals[CONTACT_AVATAR_CHANGED] =
+ g_signal_new ("contact-avatar-changed",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL, NULL,
+ g_cclosure_marshal_VOID__OBJECT,
+ G_TYPE_NONE,
+ 1, EMPATHY_TYPE_CONTACT);
+ signals[CONTACT_CAPABILITIES_CHANGED] =
+ g_signal_new ("contact-capabilities-changed",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL, NULL,
+ g_cclosure_marshal_VOID__OBJECT,
+ G_TYPE_NONE,
+ 1, EMPATHY_TYPE_CONTACT);
+ signals[CONTACT_NAME_CHANGED] =
+ g_signal_new ("contact-name-changed",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL, NULL,
+ _empathy_marshal_VOID__OBJECT_STRING,
+ G_TYPE_NONE,
+ 2, EMPATHY_TYPE_CONTACT,
+ G_TYPE_STRING);
+ signals[CONTACT_PRESENCE_CHANGED] =
+ g_signal_new ("contact-presence-changed",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL, NULL,
+ _empathy_marshal_VOID__OBJECT_ENUM_ENUM,
+ G_TYPE_NONE,
+ 3, EMPATHY_TYPE_CONTACT,
+ MC_TYPE_PRESENCE,
+ MC_TYPE_PRESENCE);
+ signals[CONTACT_PRESENCE_MESSAGE_CHANGED] =
+ g_signal_new ("contact-presence-message-changed",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL, NULL,
+ _empathy_marshal_VOID__OBJECT_STRING,
+ G_TYPE_NONE,
+ 2, EMPATHY_TYPE_CONTACT,
+ G_TYPE_STRING);
+ signals[CONTACT_REMOVED] =
+ g_signal_new ("contact-removed",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL, NULL,
+ g_cclosure_marshal_VOID__OBJECT,
+ G_TYPE_NONE,
+ 1, EMPATHY_TYPE_CONTACT);
+
+ g_type_class_add_private (klass, sizeof (EmpathyContactMonitorPriv));
}
static void
empathy_contact_monitor_init (EmpathyContactMonitor *self)
{
- EmpathyContactMonitorPriv *priv =
- G_TYPE_INSTANCE_GET_PRIVATE (self,
- EMPATHY_TYPE_CONTACT_MONITOR, EmpathyContactMonitorPriv);
+ EmpathyContactMonitorPriv *priv =
+ G_TYPE_INSTANCE_GET_PRIVATE (self,
+ EMPATHY_TYPE_CONTACT_MONITOR, EmpathyContactMonitorPriv);
- self->priv = priv;
- priv->contacts = NULL;
- priv->proxy = NULL;
+ self->priv = priv;
+ priv->contacts = NULL;
+ priv->proxy = NULL;
}
static void
contact_monitor_presence_changed_cb (EmpathyContact *contact,
- McPresence current_presence,
- McPresence previous_presence,
- EmpathyContactMonitor *self)
+ McPresence current_presence,
+ McPresence previous_presence,
+ EmpathyContactMonitor *self)
{
- g_signal_emit (self, signals[CONTACT_PRESENCE_CHANGED], 0, contact,
- current_presence, previous_presence);
+ g_signal_emit (self, signals[CONTACT_PRESENCE_CHANGED], 0, contact,
+ current_presence, previous_presence);
}
static void
contact_monitor_presence_message_changed_cb (EmpathyContact *contact,
- GParamSpec *pspec,
- EmpathyContactMonitor *self)
+ GParamSpec *pspec,
+ EmpathyContactMonitor *self)
{
- const char *status;
+ const char *status;
- /* use the status so that we always have a presence message */
- status = empathy_contact_get_status (contact);
+ /* use the status so that we always have a presence message */
+ status = empathy_contact_get_status (contact);
- g_signal_emit (self, signals[CONTACT_PRESENCE_MESSAGE_CHANGED], 0,
- contact, status);
+ g_signal_emit (self, signals[CONTACT_PRESENCE_MESSAGE_CHANGED], 0,
+ contact, status);
}
static void
contact_monitor_name_changed_cb (EmpathyContact *contact,
- GParamSpec *pspec,
- EmpathyContactMonitor *self)
+ GParamSpec *pspec,
+ EmpathyContactMonitor *self)
{
- const char *name;
+ const char *name;
- name = empathy_contact_get_name (contact);
+ name = empathy_contact_get_name (contact);
- g_signal_emit (self, signals[CONTACT_NAME_CHANGED], 0, contact, name);
+ g_signal_emit (self, signals[CONTACT_NAME_CHANGED], 0, contact, name);
}
static void
contact_monitor_avatar_changed_cb (EmpathyContact *contact,
- GParamSpec *pspec,
- EmpathyContactMonitor *self)
+ GParamSpec *pspec,
+ EmpathyContactMonitor *self)
{
- /* don't emit a pixbuf in the signal, as we don't know how large
- * a client would like it to be.
- */
+ /* don't emit a pixbuf in the signal, as we don't know how large
+ * a client would like it to be.
+ */
- g_signal_emit (self, signals[CONTACT_AVATAR_CHANGED], 0, contact);
+ g_signal_emit (self, signals[CONTACT_AVATAR_CHANGED], 0, contact);
}
static void
contact_monitor_capabilities_changed_cb (EmpathyContact *contact,
- GParamSpec *pspec,
- EmpathyContactMonitor *self)
+ GParamSpec *pspec,
+ EmpathyContactMonitor *self)
{
- g_signal_emit (self, signals[CONTACT_CAPABILITIES_CHANGED], 0, contact);
+ g_signal_emit (self, signals[CONTACT_CAPABILITIES_CHANGED], 0, contact);
}
static void
contact_add (EmpathyContactMonitor *monitor,
- EmpathyContact *contact)
+ EmpathyContact *contact)
{
- EmpathyContactMonitorPriv *priv = GET_PRIV (monitor);
-
- g_signal_connect (contact, "presence-changed",
- G_CALLBACK (contact_monitor_presence_changed_cb),
- monitor);
- g_signal_connect (contact, "notify::presence-message",
- G_CALLBACK (contact_monitor_presence_message_changed_cb),
- monitor);
- g_signal_connect (contact, "notify::name",
- G_CALLBACK (contact_monitor_name_changed_cb),
- monitor);
- g_signal_connect (contact, "notify::avatar",
- G_CALLBACK (contact_monitor_avatar_changed_cb),
- monitor);
- g_signal_connect (contact, "notify::capabilities",
- G_CALLBACK (contact_monitor_capabilities_changed_cb),
- monitor);
-
- g_ptr_array_add (priv->contacts, g_object_ref (contact));
-
- g_signal_emit (monitor, signals[CONTACT_ADDED], 0, contact);
+ EmpathyContactMonitorPriv *priv = GET_PRIV (monitor);
+
+ g_signal_connect (contact, "presence-changed",
+ G_CALLBACK (contact_monitor_presence_changed_cb),
+ monitor);
+ g_signal_connect (contact, "notify::presence-message",
+ G_CALLBACK (contact_monitor_presence_message_changed_cb),
+ monitor);
+ g_signal_connect (contact, "notify::name",
+ G_CALLBACK (contact_monitor_name_changed_cb),
+ monitor);
+ g_signal_connect (contact, "notify::avatar",
+ G_CALLBACK (contact_monitor_avatar_changed_cb),
+ monitor);
+ g_signal_connect (contact, "notify::capabilities",
+ G_CALLBACK (contact_monitor_capabilities_changed_cb),
+ monitor);
+
+ g_ptr_array_add (priv->contacts, g_object_ref (contact));
+
+ g_signal_emit (monitor, signals[CONTACT_ADDED], 0, contact);
}
static void
contact_remove (EmpathyContactMonitor *monitor,
- EmpathyContact *contact)
+ EmpathyContact *contact)
{
- EmpathyContactMonitorPriv *priv = GET_PRIV (monitor);
-
- g_signal_handlers_disconnect_by_func (contact,
- G_CALLBACK (contact_monitor_presence_changed_cb),
- monitor);
- g_signal_handlers_disconnect_by_func (contact,
- G_CALLBACK (contact_monitor_presence_message_changed_cb),
- monitor);
- g_signal_handlers_disconnect_by_func (contact,
- G_CALLBACK (contact_monitor_name_changed_cb),
- monitor);
- g_signal_handlers_disconnect_by_func (contact,
- G_CALLBACK (contact_monitor_avatar_changed_cb),
- monitor);
- g_signal_handlers_disconnect_by_func (contact,
- G_CALLBACK (contact_monitor_capabilities_changed_cb),
- monitor);
-
- g_ptr_array_remove (priv->contacts, contact);
-
- g_signal_emit (monitor, signals[CONTACT_REMOVED], 0, contact);
-
- g_object_unref (contact);
+ EmpathyContactMonitorPriv *priv = GET_PRIV (monitor);
+
+ g_signal_handlers_disconnect_by_func (contact,
+ G_CALLBACK (contact_monitor_presence_changed_cb),
+ monitor);
+ g_signal_handlers_disconnect_by_func (contact,
+ G_CALLBACK (contact_monitor_presence_message_changed_cb),
+ monitor);
+ g_signal_handlers_disconnect_by_func (contact,
+ G_CALLBACK (contact_monitor_name_changed_cb),
+ monitor);
+ g_signal_handlers_disconnect_by_func (contact,
+ G_CALLBACK (contact_monitor_avatar_changed_cb),
+ monitor);
+ g_signal_handlers_disconnect_by_func (contact,
+ G_CALLBACK (contact_monitor_capabilities_changed_cb),
+ monitor);
+
+ g_ptr_array_remove (priv->contacts, contact);
+
+ g_signal_emit (monitor, signals[CONTACT_REMOVED], 0, contact);
+
+ g_object_unref (contact);
}
static void
contact_remove_foreach (EmpathyContact *contact,
- EmpathyContactMonitor *monitor)
+ EmpathyContactMonitor *monitor)
{
- contact_remove (monitor, contact);
+ contact_remove (monitor, contact);
}
static void
cl_members_changed_cb (EmpathyContactList *cl,
- EmpathyContact *contact,
- EmpathyContact *actor,
- guint reason,
- gchar *message,
- gboolean is_member,
- EmpathyContactMonitor *monitor)
+ EmpathyContact *contact,
+ EmpathyContact *actor,
+ guint reason,
+ gchar *message,
+ gboolean is_member,
+ EmpathyContactMonitor *monitor)
{
- if (is_member) {
- contact_add (monitor, contact);
- } else {
- contact_remove (monitor, contact);
- }
+ if (is_member) {
+ contact_add (monitor, contact);
+ } else {
+ contact_remove (monitor, contact);
+ }
}
/* public methods */
void
empathy_contact_monitor_set_proxy (EmpathyContactMonitor *self,
- EmpathyContactList *proxy)
+ EmpathyContactList *proxy)
{
- EmpathyContactMonitorPriv *priv;
+ EmpathyContactMonitorPriv *priv;
- g_assert (EMPATHY_IS_CONTACT_MONITOR (self));
- g_assert (EMPATHY_IS_CONTACT_LIST (proxy));
+ g_assert (EMPATHY_IS_CONTACT_MONITOR (self));
+ g_assert (EMPATHY_IS_CONTACT_LIST (proxy));
- priv = GET_PRIV (self);
+ priv = GET_PRIV (self);
- if (priv->contacts != NULL) {
- g_ptr_array_foreach (priv->contacts,
- (GFunc) contact_remove_foreach, self);
- g_ptr_array_free (priv->contacts, TRUE);
- priv->contacts = NULL;
- }
+ if (priv->contacts != NULL) {
+ g_ptr_array_foreach (priv->contacts,
+ (GFunc) contact_remove_foreach, self);
+ g_ptr_array_free (priv->contacts, TRUE);
+ priv->contacts = NULL;
+ }
- priv->proxy = proxy;
- priv->contacts = g_ptr_array_new ();
+ priv->proxy = proxy;
+ priv->contacts = g_ptr_array_new ();
- g_signal_connect (proxy, "members-changed",
- G_CALLBACK (cl_members_changed_cb), self);
+ g_signal_connect (proxy, "members-changed",
+ G_CALLBACK (cl_members_changed_cb), self);
}
EmpathyContactMonitor *
empathy_contact_monitor_new_for_proxy (EmpathyContactList *proxy)
{
- EmpathyContactMonitor *retval;
+ EmpathyContactMonitor *retval;
- g_assert (EMPATHY_IS_CONTACT_LIST (proxy));
+ g_assert (EMPATHY_IS_CONTACT_LIST (proxy));
- retval = g_object_new (EMPATHY_TYPE_CONTACT_MONITOR,
- "proxy", proxy, NULL);
+ retval = g_object_new (EMPATHY_TYPE_CONTACT_MONITOR,
+ "proxy", proxy, NULL);
- return retval;
+ return retval;
}
diff --git a/libempathy/empathy-contact-monitor.h b/libempathy/empathy-contact-monitor.h
index e9a060544..55541a8a1 100644
--- a/libempathy/empathy-contact-monitor.h
+++ b/libempathy/empathy-contact-monitor.h
@@ -1,4 +1,4 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; -*- */
/*
* Copyright (C) 2008 Collabora Ltd.
*
@@ -38,12 +38,12 @@ G_BEGIN_DECLS
typedef struct _EmpathyContactMonitorClass EmpathyContactMonitorClass;
struct _EmpathyContactMonitor {
- GObject parent;
- gpointer priv;
+ GObject parent;
+ gpointer priv;
};
struct _EmpathyContactMonitorClass {
- GObjectClass parent_class;
+ GObjectClass parent_class;
};
GType empathy_contact_monitor_get_type (void);
@@ -52,7 +52,7 @@ GType empathy_contact_monitor_get_type (void);
void
empathy_contact_monitor_set_proxy (EmpathyContactMonitor *self,
- EmpathyContactList *proxy);
+ EmpathyContactList *proxy);
EmpathyContactMonitor *
empathy_contact_monitor_new_for_proxy (EmpathyContactList *proxy);
diff --git a/libempathy/empathy-types.h b/libempathy/empathy-types.h
index 0ca300efa..78a934f0f 100644
--- a/libempathy/empathy-types.h
+++ b/libempathy/empathy-types.h
@@ -1,4 +1,4 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; -*- */
/*
* Copyright (C) 2008 Collabora Ltd.
*