aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.co.uk>2012-09-07 19:55:59 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2012-10-09 22:19:44 +0800
commitc98ab50d33e38d9c131e126e6d7f857388faf47b (patch)
tree1da11f9f262f53c67ab0a868f9a098b9d59286d4 /src
parent8df9026631e8cf6b65782d2dca718ea69c9ea87b (diff)
downloadgsoc2013-empathy-c98ab50d33e38d9c131e126e6d7f857388faf47b.tar
gsoc2013-empathy-c98ab50d33e38d9c131e126e6d7f857388faf47b.tar.gz
gsoc2013-empathy-c98ab50d33e38d9c131e126e6d7f857388faf47b.tar.bz2
gsoc2013-empathy-c98ab50d33e38d9c131e126e6d7f857388faf47b.tar.lz
gsoc2013-empathy-c98ab50d33e38d9c131e126e6d7f857388faf47b.tar.xz
gsoc2013-empathy-c98ab50d33e38d9c131e126e6d7f857388faf47b.tar.zst
gsoc2013-empathy-c98ab50d33e38d9c131e126e6d7f857388faf47b.zip
EmpathyRosterWindow: Add UOA specific error infobar
https://bugzilla.gnome.org/show_bug.cgi?id=681445
Diffstat (limited to 'src')
-rw-r--r--src/empathy-roster-window.c59
1 files changed, 59 insertions, 0 deletions
diff --git a/src/empathy-roster-window.c b/src/empathy-roster-window.c
index b042ba4fb..a8018b778 100644
--- a/src/empathy-roster-window.c
+++ b/src/empathy-roster-window.c
@@ -604,6 +604,54 @@ roster_window_error_add_stock_button (GtkInfoBar *info_bar,
gtk_info_bar_add_action_widget (info_bar, button, response_id);
}
+#ifdef HAVE_UOA
+static const gchar *
+uoa_account_display_string (TpAccount *account)
+{
+ const gchar *service;
+
+ service = tp_account_get_service (account);
+
+ /* Use well known service name, if available */
+ if (!tp_strdiff (service, "windows-live"))
+ return _("Windows Live");
+ else if (!tp_strdiff (service, "google-talk"))
+ return _("Google Talk");
+ else if (!tp_strdiff (service, "facebook"))
+ return _("Facebook");
+
+ return tp_account_get_display_name (account);
+}
+
+static void
+roster_window_uoa_auth_error (EmpathyRosterWindow *self,
+ TpAccount *account)
+{
+ GtkWidget *info_bar;
+ GtkWidget *image;
+ GtkWidget *button;
+ gchar *str;
+
+ /* translators: %s is an account name like 'Facebook' or 'Google Talk' */
+ str = g_strdup_printf (_("%s account requires authorisation"),
+ uoa_account_display_string (account));
+
+ info_bar = roster_window_error_create_info_bar (self, account,
+ GTK_MESSAGE_OTHER, str);
+ g_free (str);
+
+ image = gtk_image_new_from_icon_name ("credentials-preferences",
+ GTK_ICON_SIZE_BUTTON);
+ button = gtk_button_new ();
+ gtk_button_set_image (GTK_BUTTON (button), image);
+ gtk_widget_set_tooltip_text (button, _("Online Accounts"));
+ gtk_widget_show (button);
+
+ gtk_info_bar_add_action_widget (GTK_INFO_BAR (info_bar), button,
+ ERROR_RESPONSE_EDIT);
+}
+#endif
+
static void
roster_window_error_display (EmpathyRosterWindow *self,
TpAccount *account)
@@ -619,6 +667,17 @@ roster_window_error_display (EmpathyRosterWindow *self,
if (user_requested)
return;
+#ifdef HAVE_UOA
+ if (!tp_strdiff (TP_ERROR_STR_AUTHENTICATION_FAILED,
+ tp_account_get_detailed_error (account, NULL)) &&
+ !tp_strdiff (tp_account_get_storage_provider (account),
+ EMPATHY_UOA_PROVIDER))
+ {
+ roster_window_uoa_auth_error (self, account);
+ return;
+ }
+#endif
+
str = g_markup_printf_escaped ("<b>%s</b>\n%s",
tp_account_get_display_name (account), error_message);