changeset 29644:0efd688ed086

Added connection flag ALLOW_ATTENTION Gray out attention button when the connection doesn't support sending attentions
author Marcus Lundblad <ml@update.uu.se>
date Tue, 28 Oct 2008 23:08:13 +0000
parents bb9f7ba4f299
children 602f3b6ddbbf
files libpurple/connection.h libpurple/protocols/jabber/jabber.c libpurple/protocols/msn/msn.c libpurple/protocols/msnp9/msn.c libpurple/protocols/myspace/myspace.c libpurple/protocols/yahoo/yahoo.c pidgin/gtkimhtmltoolbar.c
diffstat 7 files changed, 20 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/connection.h	Mon Oct 27 23:12:03 2008 +0000
+++ b/libpurple/connection.h	Tue Oct 28 23:08:13 2008 +0000
@@ -45,7 +45,8 @@
 	PURPLE_CONNECTION_NO_URLDESC = 0x0040,  /**< Connection does not support descriptions with links */ 
 	PURPLE_CONNECTION_NO_IMAGES = 0x0080,  /**< Connection does not support sending of images */
 	PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY = 0x0100, /**< Connection supports sending and receiving custom smileys */
-
+	PURPLE_CONNECTION_ALLOW_ATTENTION = 0x0200, /**< Connection supports sending attention */
+	
 } PurpleConnectionFlags;
 
 typedef enum
--- a/libpurple/protocols/jabber/jabber.c	Mon Oct 27 23:12:03 2008 +0000
+++ b/libpurple/protocols/jabber/jabber.c	Tue Oct 28 23:08:13 2008 +0000
@@ -646,7 +646,8 @@
 	JabberBuddy *my_jb = NULL;
 
 	gc->flags |= PURPLE_CONNECTION_HTML |
-		PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY;
+		PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY |
+		PURPLE_CONNECTION_ALLOW_ATTENTION;
 	js = gc->proto_data = g_new0(JabberStream, 1);
 	js->gc = gc;
 	js->fd = -1;
--- a/libpurple/protocols/msn/msn.c	Mon Oct 27 23:12:03 2008 +0000
+++ b/libpurple/protocols/msn/msn.c	Tue Oct 28 23:08:13 2008 +0000
@@ -986,7 +986,8 @@
 
 	gc->proto_data = session;
 	gc->flags |= PURPLE_CONNECTION_HTML | PURPLE_CONNECTION_FORMATTING_WBFO | PURPLE_CONNECTION_NO_BGCOLOR |
-		PURPLE_CONNECTION_NO_FONTSIZE | PURPLE_CONNECTION_NO_URLDESC | PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY;
+		PURPLE_CONNECTION_NO_FONTSIZE | PURPLE_CONNECTION_NO_URLDESC | PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY |
+		PURPLE_CONNECTION_ALLOW_ATTENTION;
 
 	msn_session_set_login_step(session, MSN_LOGIN_STEP_START);
 
--- a/libpurple/protocols/msnp9/msn.c	Mon Oct 27 23:12:03 2008 +0000
+++ b/libpurple/protocols/msnp9/msn.c	Tue Oct 28 23:08:13 2008 +0000
@@ -775,7 +775,8 @@
 
 	gc->proto_data = session;
 	gc->flags |= PURPLE_CONNECTION_HTML | PURPLE_CONNECTION_FORMATTING_WBFO | PURPLE_CONNECTION_NO_BGCOLOR |
-		PURPLE_CONNECTION_NO_FONTSIZE | PURPLE_CONNECTION_NO_URLDESC | PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY;
+		PURPLE_CONNECTION_NO_FONTSIZE | PURPLE_CONNECTION_NO_URLDESC | PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY |
+		PURPLE_CONNECTION_ALLOW_ATTENTION;
 
 	msn_session_set_login_step(session, MSN_LOGIN_STEP_START);
 
--- a/libpurple/protocols/myspace/myspace.c	Mon Oct 27 23:12:03 2008 +0000
+++ b/libpurple/protocols/myspace/myspace.c	Tue Oct 28 23:08:13 2008 +0000
@@ -289,7 +289,8 @@
 
 	gc = purple_account_get_connection(acct);
 	gc->proto_data = msim_session_new(acct);
-	gc->flags |= PURPLE_CONNECTION_HTML | PURPLE_CONNECTION_NO_URLDESC;
+	gc->flags |= PURPLE_CONNECTION_HTML | PURPLE_CONNECTION_NO_URLDESC |
+		PURPLE_CONNECTION_ALLOW_ATTENTION;
 
 	/* 1. connect to server */
 	purple_connection_update_progress(gc, _("Connecting"),
--- a/libpurple/protocols/yahoo/yahoo.c	Mon Oct 27 23:12:03 2008 +0000
+++ b/libpurple/protocols/yahoo/yahoo.c	Tue Oct 28 23:08:13 2008 +0000
@@ -2994,7 +2994,8 @@
 	PurpleConnection *gc = purple_account_get_connection(account);
 	struct yahoo_data *yd = gc->proto_data = g_new0(struct yahoo_data, 1);
 	PurpleStatus *status = purple_account_get_active_status(account);
-	gc->flags |= PURPLE_CONNECTION_HTML | PURPLE_CONNECTION_NO_BGCOLOR | PURPLE_CONNECTION_NO_URLDESC;
+	gc->flags |= PURPLE_CONNECTION_HTML | PURPLE_CONNECTION_NO_BGCOLOR | PURPLE_CONNECTION_NO_URLDESC |
+		PURPLE_CONNECTION_ALLOW_ATTENTION;
 
 	purple_connection_update_progress(gc, _("Connecting"), 1, 2);
 
--- a/pidgin/gtkimhtmltoolbar.c	Mon Oct 27 23:12:03 2008 +0000
+++ b/pidgin/gtkimhtmltoolbar.c	Tue Oct 28 23:08:13 2008 +0000
@@ -1472,6 +1472,10 @@
 		G_CALLBACK(gtk_button_clicked), toolbar->attention);
 	gtk_widget_show_all(attention_button);
 	
+	g_signal_connect(G_OBJECT(toolbar->attention), "notify::sensitive",
+			G_CALLBACK(button_sensitiveness_changed), attention_button);
+
+	
 	gtk_box_pack_start(GTK_BOX(hbox), box, FALSE, FALSE, 0);
 	g_object_set_data(G_OBJECT(hbox), "lean-view", box);
 	gtk_widget_show(box);
@@ -1557,9 +1561,12 @@
 void gtk_imhtmltoolbar_switch_active_conversation(GtkIMHtmlToolbar *toolbar,
 	PurpleConversation *conv)
 {
+	PurpleConnection *gc = purple_conversation_get_gc(conv);
 	purple_debug_info("gtkimhtmltoolbar", "switch active conversation to %p\n",
 		conv);
 	toolbar->active_conv = conv;
-	// gray out buttons...
+	
+	gtk_widget_set_sensitive(toolbar->attention, 
+		gc->flags & PURPLE_CONNECTION_ALLOW_ATTENTION);
 }