cpw.attention_ui: 40a9c7e8: Temporary workaround to not break ABI, t...

malu at pidgin.im malu at pidgin.im
Mon Nov 16 14:01:14 EST 2009


-----------------------------------------------------------------
Revision: 40a9c7e81c19e9d7b52ec973cdf3962be885f6b9
Ancestor: b5fc47725420cb03a8df1fbfe1bc722e866c9278
Author: malu at pidgin.im
Date: 2009-11-16T18:54:40
Branch: im.pidgin.cpw.attention_ui
URL: http://d.pidgin.im/viewmtn/revision/info/40a9c7e81c19e9d7b52ec973cdf3962be885f6b9

Modified files:
        pidgin/gtkconv.c pidgin/gtkconvwin.h
        pidgin/gtkimhtmltoolbar.c pidgin/gtkimhtmltoolbar.h

ChangeLog: 

Temporary workaround to not break ABI, to allow this in for 2.7.0

-------------- next part --------------
============================================================
--- pidgin/gtkconv.c	7e71b28188912e1426f38cdc203823b5187ecc76
+++ pidgin/gtkconv.c	5f87f6e5bbfdbade45911b47c7a81dabe1c8e320
@@ -3589,9 +3589,9 @@ setup_menubar(PidginWindow *win)
 		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 @@ gray_stuff_out(PidginConversation *gtkco
 		/* 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 @@ gray_stuff_out(PidginConversation *gtkco
 		/* 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 @@ gray_stuff_out(PidginConversation *gtkco
 			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 @@ gray_stuff_out(PidginConversation *gtkco
 		/* 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);
============================================================
--- pidgin/gtkconvwin.h	51291492c83e22094dbf297aabf37a8fd0f92132
+++ pidgin/gtkconvwin.h	64dce6ceccc0449184700ec1ea13f9930a035d0f
@@ -51,7 +51,6 @@ struct _PidginWindow
 		GtkWidget *view_log;
 
 		GtkWidget *send_file;
-		GtkWidget *get_attention;
 		GtkWidget *add_pounce;
 		GtkWidget *get_info;
 		GtkWidget *invite;
============================================================
--- pidgin/gtkimhtmltoolbar.c	d8a242005177b1e7d679edf8007b17d01de15d79
+++ pidgin/gtkimhtmltoolbar.c	36d599dd4081b3c011c975d745578b90e3b37e24
@@ -924,12 +924,14 @@ static void send_attention_cb(GtkWidget 
 
 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 @@ static void gtk_imhtmltoolbar_create_old
 		{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 @@ static void gtk_imhtmltoolbar_create_old
 			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 @@ static void gtk_imhtmltoolbar_init (GtkI
 	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 @@ void gtk_imhtmltoolbar_switch_active_con
 {
 	PurpleConnection *gc = purple_conversation_get_gc(conv);
 	PurplePlugin *prpl = purple_connection_get_prpl(gc);
+	GtkWidget *attention =
+		g_object_get_data(G_OBJECT(toolbar), "attention");
+
+	g_object_set_data(G_OBJECT(toolbar), "active_conv", conv);
 	
-	purple_debug_info("gtkimhtmltoolbar", "switch active conversation to %p\n",
-		conv);
-	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);
 }
============================================================
--- pidgin/gtkimhtmltoolbar.h	aec8e4102b151f4ac1464fc3666b91db8b181067
+++ pidgin/gtkimhtmltoolbar.h	9c2d607fe8b91cfc264123f86d311a171b776ead
@@ -65,8 +65,7 @@ struct _GtkIMHtmlToolbar {
 	GtkWidget *image;
 	GtkWidget *link;
 	GtkWidget *smiley;
-	GtkWidget *attention;
-	
+
 	GtkWidget *font_dialog;
 	GtkWidget *fgcolor_dialog;
 	GtkWidget *bgcolor_dialog;
@@ -78,8 +77,6 @@ struct _GtkIMHtmlToolbar {
 	GtkWidget *strikethrough;
 	GtkWidget *insert_hr;
 	GtkWidget *call;
-	
-	PurpleConversation *active_conv;
 };
 
 struct _GtkIMHtmlToolbarClass {


More information about the Commits mailing list