aboutsummaryrefslogtreecommitdiffstats
path: root/src/empathy-accounts-dialog.c
diff options
context:
space:
mode:
authorFelix Kaser <f.kaser@gmx.net>2009-12-09 01:50:55 +0800
committerFelix Kaser <f.kaser@gmx.net>2009-12-15 20:52:45 +0800
commit76af01fa4ced883f28b8464d835522b3f0af1cb6 (patch)
treed9bf15f13b9eb8f56bd5731ded790cf668436bb1 /src/empathy-accounts-dialog.c
parent904a7310bff53399f126a343741bc3812a2c4864 (diff)
downloadgsoc2013-empathy-76af01fa4ced883f28b8464d835522b3f0af1cb6.tar
gsoc2013-empathy-76af01fa4ced883f28b8464d835522b3f0af1cb6.tar.gz
gsoc2013-empathy-76af01fa4ced883f28b8464d835522b3f0af1cb6.tar.bz2
gsoc2013-empathy-76af01fa4ced883f28b8464d835522b3f0af1cb6.tar.lz
gsoc2013-empathy-76af01fa4ced883f28b8464d835522b3f0af1cb6.tar.xz
gsoc2013-empathy-76af01fa4ced883f28b8464d835522b3f0af1cb6.tar.zst
gsoc2013-empathy-76af01fa4ced883f28b8464d835522b3f0af1cb6.zip
handle presence changes
some refactoring was neccesary to handl correctly the presence changes. all information about the connection status and reason and presence are gathered explicitly in update_status_infobar and not passed by the callbacks.
Diffstat (limited to 'src/empathy-accounts-dialog.c')
-rw-r--r--src/empathy-accounts-dialog.c30
1 files changed, 20 insertions, 10 deletions
diff --git a/src/empathy-accounts-dialog.c b/src/empathy-accounts-dialog.c
index ad5156ba9..b0bc79d6a 100644
--- a/src/empathy-accounts-dialog.c
+++ b/src/empathy-accounts-dialog.c
@@ -174,12 +174,15 @@ accounts_dialog_update_name_label (EmpathyAccountsDialog *dialog,
static void
accounts_dialog_update_status_infobar (EmpathyAccountsDialog *dialog,
- TpAccount *account, guint status, guint reason)
+ TpAccount *account)
{
EmpathyAccountsDialogPriv *priv = GET_PRIV (dialog);
const gchar *message;
+ guint status;
+ guint reason;
guint presence;
+ status = tp_account_get_connection_status (account, &reason);
presence = tp_account_get_current_presence (account, NULL, NULL);
gtk_image_set_from_icon_name (GTK_IMAGE (priv->image_status),
@@ -357,8 +360,6 @@ account_dialog_create_settings_widget (EmpathyAccountsDialog *dialog,
{
EmpathyAccountsDialogPriv *priv = GET_PRIV (dialog);
gchar *icon_name;
- guint status;
- guint reason;
TpAccount *account;
priv->setting_widget_object =
@@ -398,9 +399,7 @@ account_dialog_create_settings_widget (EmpathyAccountsDialog *dialog,
empathy_account_settings_get_display_name (settings));
account = empathy_account_settings_get_account (settings);
-
- status = tp_account_get_connection_status (account, &reason);
- accounts_dialog_update_status_infobar (dialog, account, status, reason);
+ accounts_dialog_update_status_infobar (dialog, account);
}
static void
@@ -1258,7 +1257,7 @@ accounts_dialog_connection_changed_cb (TpAccount *account,
EmpathyAccountsDialogPriv *priv = GET_PRIV (dialog);
/* Update the status-infobar in the details view*/
- accounts_dialog_update_status_infobar (dialog, account, current, reason);
+ accounts_dialog_update_status_infobar (dialog, account);
/* Update the status in the model */
model = gtk_tree_view_get_model (GTK_TREE_VIEW (priv->treeview));
@@ -1291,6 +1290,17 @@ accounts_dialog_connection_changed_cb (TpAccount *account,
}
static void
+accounts_dialog_presence_changed_cb (TpAccount *account,
+ guint presence,
+ gchar *status,
+ gchar *status_message,
+ EmpathyAccountsDialog *dialog)
+{
+ /* Update the status-infobar in the details view*/
+ accounts_dialog_update_status_infobar (dialog, account);
+}
+
+static void
accounts_dialog_account_display_name_changed_cb (TpAccount *account,
GParamSpec *pspec,
gpointer user_data)
@@ -1424,9 +1434,7 @@ enable_or_disable_account (EmpathyAccountsDialog *dialog,
/* Update the status-infobar in the details view when disabling*/
if (!enabled)
- accounts_dialog_update_status_infobar (dialog, account,
- TP_CONNECTION_STATUS_DISCONNECTED,
- TP_CONNECTION_STATUS_REASON_NONE_SPECIFIED);
+ accounts_dialog_update_status_infobar (dialog, account);
DEBUG ("Account %s is now %s",
tp_account_get_display_name (account),
@@ -1653,6 +1661,8 @@ accounts_dialog_accounts_setup (EmpathyAccountsDialog *dialog)
empathy_signal_connect_weak (l->data, "status-changed",
G_CALLBACK (accounts_dialog_connection_changed_cb), G_OBJECT (dialog));
+ empathy_signal_connect_weak (l->data, "presence-changed",
+ G_CALLBACK (accounts_dialog_presence_changed_cb), G_OBJECT (dialog));
}
g_list_free (accounts);