changeset 29701:28880022598c

Temporary workaround to not break ABI, to allow this in for 2.7.0
author Marcus Lundblad <ml@update.uu.se>
date Mon, 16 Nov 2009 18:54:40 +0000
parents 9bc902d88fa2
children 430badc49904
files pidgin/gtkconv.c pidgin/gtkconvwin.h pidgin/gtkimhtmltoolbar.c pidgin/gtkimhtmltoolbar.h
diffstat 4 files changed, 34 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/gtkconv.c	Sun Nov 15 21:03:10 2009 +0000
+++ b/pidgin/gtkconv.c	Mon Nov 16 18:54:40 2009 +0000
@@ -3589,9 +3589,9 @@
 		gtk_item_factory_get_widget(win->menu.item_factory,
 		                            N_("/Conversation/Send File..."));
 
-	win->menu.get_attention =
+	g_object_set_data(G_OBJECT(win->window), "get_attention",
 		gtk_item_factory_get_widget(win->menu.item_factory,
-			                    N_("/Conversation/Get Attention"));
+			                    N_("/Conversation/Get Attention")));
 	win->menu.add_pounce =
 		gtk_item_factory_get_widget(win->menu.item_factory,
 		                            N_("/Conversation/Add Buddy Pounce..."));
@@ -6522,7 +6522,7 @@
 		/* Deal with menu items */
 		gtk_widget_show(win->menu.view_log);
 		gtk_widget_show(win->menu.send_file);
-		gtk_widget_show(win->menu.get_attention);
+		gtk_widget_show(g_object_get_data(G_OBJECT(win->window), "get_attention"));
 		gtk_widget_show(win->menu.add_pounce);
 		gtk_widget_show(win->menu.get_info);
 		gtk_widget_hide(win->menu.invite);
@@ -6551,7 +6551,7 @@
 		/* Deal with menu items */
 		gtk_widget_show(win->menu.view_log);
 		gtk_widget_hide(win->menu.send_file);
-		gtk_widget_hide(win->menu.get_attention);
+		gtk_widget_hide(g_object_get_data(G_OBJECT(win->window), "get_attention"));
 		gtk_widget_hide(win->menu.add_pounce);
 		gtk_widget_hide(win->menu.get_info);
 		gtk_widget_show(win->menu.invite);
@@ -6629,7 +6629,7 @@
 			gtk_widget_set_sensitive(win->menu.send_file,
 									 (prpl_info->send_file != NULL && (!prpl_info->can_receive_file ||
 									  prpl_info->can_receive_file(gc, purple_conversation_get_name(conv)))));
-			gtk_widget_set_sensitive(win->menu.get_attention, (prpl_info->send_attention != NULL));
+			gtk_widget_set_sensitive(g_object_get_data(G_OBJECT(win->window), "get_attention"), (prpl_info->send_attention != NULL));
 			gtk_widget_set_sensitive(win->menu.alias,
 									 (account != NULL) &&
 									 (purple_find_buddy(account, purple_conversation_get_name(conv)) != NULL));
@@ -6650,7 +6650,8 @@
 		/* Then deal with menu items */
 		gtk_widget_set_sensitive(win->menu.view_log, TRUE);
 		gtk_widget_set_sensitive(win->menu.send_file, FALSE);
-		gtk_widget_set_sensitive(win->menu.get_attention, FALSE);
+		gtk_widget_set_sensitive(g_object_get_data(G_OBJECT(win->window),
+			"get_attention"), FALSE);
 		gtk_widget_set_sensitive(win->menu.add_pounce, TRUE);
 		gtk_widget_set_sensitive(win->menu.get_info, FALSE);
 		gtk_widget_set_sensitive(win->menu.invite, FALSE);
--- a/pidgin/gtkconvwin.h	Sun Nov 15 21:03:10 2009 +0000
+++ b/pidgin/gtkconvwin.h	Mon Nov 16 18:54:40 2009 +0000
@@ -51,7 +51,6 @@
 		GtkWidget *view_log;
 
 		GtkWidget *send_file;
-		GtkWidget *get_attention;
 		GtkWidget *add_pounce;
 		GtkWidget *get_info;
 		GtkWidget *invite;
--- a/pidgin/gtkimhtmltoolbar.c	Sun Nov 15 21:03:10 2009 +0000
+++ b/pidgin/gtkimhtmltoolbar.c	Mon Nov 16 18:54:40 2009 +0000
@@ -924,12 +924,14 @@
 
 static void send_attention_cb(GtkWidget *attention, GtkIMHtmlToolbar *toolbar)
 {
-	PurpleConversation *conv = toolbar->active_conv;
+	PurpleConversation *conv =
+		g_object_get_data(G_OBJECT(toolbar), "active_conv");
 	const gchar *who = purple_conversation_get_name(conv);
 	PurpleConnection *gc = purple_conversation_get_gc(conv);
-	
-	toggle_button_set_active_block(GTK_TOGGLE_BUTTON(toolbar->attention), FALSE, 
-		toolbar);
+
+	toggle_button_set_active_block(GTK_TOGGLE_BUTTON(attention), FALSE, toolbar);
+	/*toggle_button_set_active_block(GTK_TOGGLE_BUTTON(
+	    g_object_get_data(G_OBJECT(toolbar->imhtml), "attention")), FALSE, toolbar);*/
 	purple_conversation_attention(conv, who, 0, PURPLE_MESSAGE_SEND, time(NULL));
 	purple_prpl_send_attention(gc, who, 0);
 }
@@ -1254,8 +1256,8 @@
 		{PIDGIN_STOCK_TOOLBAR_INSERT_LINK, insert_link_cb, &toolbar->link, _("Insert Link")},
 		{"", NULL, NULL, NULL},
 		{PIDGIN_STOCK_TOOLBAR_SMILEY, insert_smiley_cb, &toolbar->smiley, _("Insert Smiley")},
-		{PIDGIN_STOCK_TOOLBAR_SEND_ATTENTION, send_attention_cb, &toolbar->attention,
-			_("Send Attention")},
+		/*{PIDGIN_STOCK_TOOLBAR_SEND_ATTENTION, send_attention_cb, 
+			g_object_get_data(G_OBJECT(toolbar->imhtml), "attention"), _("Send Attention")},*/
 		{NULL, NULL, NULL, NULL}
 	};
 	int iter;
@@ -1273,6 +1275,13 @@
 			button = gtk_vseparator_new();
 		gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
 	}
+	/* create the attention button (this is a bit hacky to not break ABI) */
+	button = pidgin_pixbuf_toolbar_button_from_stock(PIDGIN_STOCK_TOOLBAR_SEND_ATTENTION);
+	g_signal_connect(G_OBJECT(button), "clicked",
+		G_CALLBACK(send_attention_cb), toolbar);
+	g_object_set_data(G_OBJECT(toolbar), "attention", button);
+	gtk_tooltips_set_tip(toolbar->tooltips, button, _("Send Attention"), NULL);
+	gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
 
 	gtk_box_pack_start(GTK_BOX(toolbar), hbox, FALSE, FALSE, 0);
 	g_object_set_data(G_OBJECT(toolbar), "wide-view", hbox);
@@ -1480,14 +1489,17 @@
 	gtk_box_pack_start(GTK_BOX(bbox), label, FALSE, FALSE, 0);
 	gtk_box_pack_start(GTK_BOX(box), attention_button, FALSE, FALSE, 0);
 	g_signal_connect_swapped(G_OBJECT(attention_button), "clicked", 
-		G_CALLBACK(gtk_button_clicked), toolbar->attention);
+		G_CALLBACK(gtk_button_clicked),
+	    g_object_get_data(G_OBJECT(toolbar), "attention"));
 	gtk_widget_show_all(attention_button);
 	
-	g_signal_connect(G_OBJECT(toolbar->attention), "notify::sensitive",
+	g_signal_connect(G_OBJECT(g_object_get_data(G_OBJECT(toolbar), "attention")),
+	        "notify::sensitive",
 			G_CALLBACK(button_sensitiveness_changed), attention_button);
 
 	/* set attention button to be greyed out until we get a conversation */
-	gtk_widget_set_sensitive(toolbar->attention, FALSE);
+	gtk_widget_set_sensitive(g_object_get_data(G_OBJECT(toolbar), "attention"),
+		FALSE);
 	
 	gtk_box_pack_start(GTK_BOX(hbox), box, FALSE, FALSE, 0);
 	g_object_set_data(G_OBJECT(hbox), "lean-view", box);
@@ -1576,14 +1588,14 @@
 {
 	PurpleConnection *gc = purple_conversation_get_gc(conv);
 	PurplePlugin *prpl = purple_connection_get_prpl(gc);
-	
-	purple_debug_info("gtkimhtmltoolbar", "switch active conversation to %p\n",
-		conv);
-	toolbar->active_conv = conv;
+	GtkWidget *attention =
+		g_object_get_data(G_OBJECT(toolbar), "attention");
+
+	g_object_set_data(G_OBJECT(toolbar), "active_conv", conv);
 	
 	/* gray out attention button on protocols that don't support it
 	 for the time being it is always disabled for chats */
-	gtk_widget_set_sensitive(toolbar->attention,
+	gtk_widget_set_sensitive(attention,
 		conv && prpl && purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM && 
 		PURPLE_PLUGIN_PROTOCOL_INFO(prpl)->send_attention != NULL);
 }
--- a/pidgin/gtkimhtmltoolbar.h	Sun Nov 15 21:03:10 2009 +0000
+++ b/pidgin/gtkimhtmltoolbar.h	Mon Nov 16 18:54:40 2009 +0000
@@ -65,8 +65,7 @@
 	GtkWidget *image;
 	GtkWidget *link;
 	GtkWidget *smiley;
-	GtkWidget *attention;
-	
+
 	GtkWidget *font_dialog;
 	GtkWidget *fgcolor_dialog;
 	GtkWidget *bgcolor_dialog;
@@ -78,8 +77,6 @@
 	GtkWidget *strikethrough;
 	GtkWidget *insert_hr;
 	GtkWidget *call;
-	
-	PurpleConversation *active_conv;
 };
 
 struct _GtkIMHtmlToolbarClass {