aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.co.uk>2013-08-08 22:58:07 +0800
committerXavier Claessens <xavier.claessens@collabora.co.uk>2013-08-09 16:43:53 +0800
commit2031d27b406ce42602b5f8ed2c059c2a9296a87c (patch)
tree22f9af3bf8d57a013cfe9d6bef39879bb227700e /src
parent1db39a3dc2832b385070206aeccd24587c052394 (diff)
downloadgsoc2013-empathy-2031d27b406ce42602b5f8ed2c059c2a9296a87c.tar.gz
gsoc2013-empathy-2031d27b406ce42602b5f8ed2c059c2a9296a87c.tar.zst
gsoc2013-empathy-2031d27b406ce42602b5f8ed2c059c2a9296a87c.zip
EmpathyAccountsDialog: Simplify the way we update account display name label in infobar
accounts_dialog_update_status_infobar() is the function responsible for doing all updates. https://bugzilla.gnome.org/show_bug.cgi?id=705668
Diffstat (limited to 'src')
-rw-r--r--src/empathy-accounts-dialog.c47
1 files changed, 12 insertions, 35 deletions
diff --git a/src/empathy-accounts-dialog.c b/src/empathy-accounts-dialog.c
index a6a45f233..7e99913ec 100644
--- a/src/empathy-accounts-dialog.c
+++ b/src/empathy-accounts-dialog.c
@@ -176,19 +176,6 @@ static gboolean accounts_dialog_has_pending_change (
EmpathyAccountsDialog *dialog, TpAccount **account);
static void
-accounts_dialog_update_name_label (EmpathyAccountsDialog *dialog,
- const gchar *display_name)
-{
- gchar *text;
- EmpathyAccountsDialogPriv *priv = GET_PRIV (dialog);
-
- text = g_markup_printf_escaped ("<b>%.50s</b>", display_name);
- gtk_label_set_markup (GTK_LABEL (priv->label_name), text);
-
- g_free (text);
-}
-
-static void
accounts_dialog_status_infobar_set_message (EmpathyAccountsDialog *dialog,
const gchar *message)
{
@@ -337,6 +324,8 @@ accounts_dialog_update_status_infobar (EmpathyAccountsDialog *dialog,
if (account != NULL)
{
+ gchar *text;
+
status = tp_account_get_connection_status (account, &reason);
presence = tp_account_get_current_presence (account, NULL, &status_message);
account_enabled = tp_account_is_enabled (account);
@@ -356,6 +345,11 @@ accounts_dialog_update_status_infobar (EmpathyAccountsDialog *dialog,
presence = TP_CONNECTION_PRESENCE_TYPE_OFFLINE;
display_switch = account_can_be_enabled (account);
+
+ text = g_markup_printf_escaped ("<b>%.50s</b>",
+ tp_account_get_display_name (account));
+ gtk_label_set_markup (GTK_LABEL (priv->label_name), text);
+ g_free (text);
}
else
{
@@ -738,9 +732,6 @@ account_dialog_create_dialog_content (EmpathyAccountsDialog *dialog,
(empathy_account_settings_get_protocol (settings)));
gtk_widget_show (priv->image_type);
- accounts_dialog_update_name_label (dialog,
- empathy_account_settings_get_display_name (settings));
-
accounts_dialog_update_status_infobar (dialog, account);
}
@@ -1784,35 +1775,21 @@ accounts_dialog_presence_changed_cb (TpAccount *account,
static void
accounts_dialog_account_display_name_changed_cb (TpAccount *account,
GParamSpec *pspec,
- gpointer user_data)
+ EmpathyAccountsDialog *dialog)
{
- const gchar *display_name;
- GtkTreeIter iter;
- GtkTreeModel *model;
- EmpathyAccountSettings *settings;
- TpAccount *selected_account;
- EmpathyAccountsDialog *dialog = EMPATHY_ACCOUNTS_DIALOG (user_data);
EmpathyAccountsDialogPriv *priv = GET_PRIV (dialog);
+ GtkTreeModel *model;
+ GtkTreeIter iter;
- display_name = tp_account_get_display_name (account);
model = gtk_tree_view_get_model (GTK_TREE_VIEW (priv->treeview));
- settings = accounts_dialog_model_get_selected_settings (dialog);
- if (settings == NULL)
- return;
-
- selected_account = empathy_account_settings_get_account (settings);
-
if (accounts_dialog_get_account_iter (dialog, account, &iter))
{
gtk_list_store_set (GTK_LIST_STORE (model), &iter,
- COL_NAME, display_name,
+ COL_NAME, tp_account_get_display_name (account),
-1);
}
- if (selected_account == account)
- accounts_dialog_update_name_label (dialog, display_name);
-
- g_object_unref (settings);
+ accounts_dialog_update_status_infobar (dialog, account);
}
static void