changeset 21458:11101e8c5793

Add a clickable link to the SSL FAQ to errors about accounts which need SSL support.
author Will Thompson <will.thompson@collabora.co.uk>
date Mon, 12 Nov 2007 18:47:40 +0000
parents 5dddaf6e6136
children 675fbb9a402e
files pidgin/gtkblist.c
diffstat 1 files changed, 29 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/gtkblist.c	Sun Nov 11 22:31:16 2007 +0000
+++ b/pidgin/gtkblist.c	Mon Nov 12 18:47:40 2007 +0000
@@ -4469,6 +4469,15 @@
 	g_hash_table_remove(gtkblist->connection_errors, account);
 }
 
+#define SSL_FAQ_URI "http://d.pidgin.im/wiki/FAQssl"
+
+static void
+ssl_faq_clicked_cb(GtkButton *button,
+                   PurpleAccount *account)
+{
+	purple_notify_uri(NULL, SSL_FAQ_URI);
+}
+
 static void
 add_generic_error_dialog(PurpleAccount *account,
                          const PurpleConnectionErrorInfo *err)
@@ -4498,6 +4507,26 @@
 	g_object_set_data(G_OBJECT(mini_dialog), OBJECT_DATA_KEY_ACCOUNT,
 		account);
 
+	if(err->type == PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT) {
+		GtkWidget *faq_button = gtk_button_new();
+		GtkWidget *faq_label = gtk_label_new(NULL);
+		gtk_label_set_markup(GTK_LABEL(faq_label),
+			"<span underline=\"single\" foreground=\"blue\""
+			" size=\"smaller\">" SSL_FAQ_URI "</span>");
+#if GTK_CHECK_VERSION(2,6,0)
+		g_object_set(G_OBJECT(faq_label), "ellipsize",
+			PANGO_ELLIPSIZE_MIDDLE, NULL);
+#endif
+		gtk_container_add(GTK_CONTAINER(faq_button), faq_label);
+		gtk_button_set_relief(GTK_BUTTON(faq_button), GTK_RELIEF_NONE);
+
+		g_signal_connect(faq_button, "clicked",
+			(GCallback)ssl_faq_clicked_cb, account);
+
+		gtk_box_pack_start(PIDGIN_MINI_DIALOG(mini_dialog)->contents,
+			faq_button, FALSE, FALSE, 0);
+	}
+
 	g_signal_connect_after(mini_dialog, "destroy",
 		(GCallback)generic_error_destroy_cb,
 		account);