pidgin: 2f52df3d: Move the Attention toolbar button into t...

qulogic at pidgin.im qulogic at pidgin.im
Mon Oct 24 02:45:48 EDT 2011


----------------------------------------------------------------------
Revision: 2f52df3dff988ee35b40b877dd495bd2bc43ef7f
Parent:   17307fa16b87cf60ca1869e6eb0b603ebb36433c
Author:   qulogic at pidgin.im
Date:     10/24/11 02:04:43
Branch:   im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/2f52df3dff988ee35b40b877dd495bd2bc43ef7f

Changelog: 

Move the Attention toolbar button into the GtkIMHtmlToolbar struct.

Changes against parent 17307fa16b87cf60ca1869e6eb0b603ebb36433c

  patched  pidgin/gtkimhtmltoolbar.c
  patched  pidgin/gtkimhtmltoolbar.h

-------------- next part --------------
============================================================
--- pidgin/gtkimhtmltoolbar.c	7fd17fae28b4f94cc8d88c73fc450d32099a35de
+++ pidgin/gtkimhtmltoolbar.c	bf9d3ba9258de28fa1331a89e823e9ac5c560c0c
@@ -1239,6 +1239,7 @@ 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")},
 		{NULL, NULL, NULL, NULL}
 	};
 	int iter;
@@ -1257,14 +1258,6 @@ 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), "button-press-event", G_CALLBACK(gtk_imhtmltoolbar_popup_menu), toolbar);
-	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);
@@ -1327,7 +1320,6 @@ static void gtk_imhtmltoolbar_init (GtkI
 	GtkWidget *insert_menu;
 	GtkWidget *menuitem;
 	GtkWidget *sep;
-	GObject *wide_attention_button;
 	int i;
 	struct {
 		const char *label;
@@ -1478,8 +1470,6 @@ static void gtk_imhtmltoolbar_init (GtkI
 	gtk_widget_show_all(sep);
 
 	/* Attention */
-	wide_attention_button = g_object_get_data(G_OBJECT(toolbar), "attention");
-
 	attention_button = gtk_button_new();
 	gtk_button_set_relief(GTK_BUTTON(attention_button), GTK_RELIEF_NONE);
 	bbox = gtk_hbox_new(FALSE, 3);
@@ -1491,16 +1481,16 @@ 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), wide_attention_button);
+		G_CALLBACK(gtk_button_clicked), toolbar->attention);
 	gtk_widget_show_all(attention_button);
 
-	g_signal_connect(wide_attention_button, "notify::sensitive",
+	g_signal_connect(G_OBJECT(toolbar->attention), "notify::sensitive",
 			G_CALLBACK(button_sensitiveness_changed), attention_button);
-	g_signal_connect(wide_attention_button, "notify::visible",
+	g_signal_connect(G_OBJECT(toolbar->attention), "notify::visible",
 			G_CALLBACK(button_visibility_changed), attention_button);
 
 	/* set attention button to be greyed out until we get a conversation */
-	gtk_widget_set_sensitive(GTK_WIDGET(wide_attention_button), FALSE);
+	gtk_widget_set_sensitive(toolbar->attention, FALSE);
 
 	gtk_box_pack_start(GTK_BOX(hbox), box, FALSE, FALSE, 0);
 	g_object_set_data(G_OBJECT(hbox), "lean-view", box);
@@ -1583,14 +1573,12 @@ void gtk_imhtmltoolbar_switch_active_con
 {
 	PurpleConnection *gc = purple_conversation_get_connection(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);
 
 	/* 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(attention,
+	gtk_widget_set_sensitive(toolbar->attention,
 		conv && prpl && purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM &&
 		PURPLE_PLUGIN_PROTOCOL_INFO(prpl)->send_attention != NULL);
 }
============================================================
--- pidgin/gtkimhtmltoolbar.h	9c2d607fe8b91cfc264123f86d311a171b776ead
+++ pidgin/gtkimhtmltoolbar.h	3541ac626d8b91bd93477a87653ed0b7c9877b00
@@ -65,6 +65,7 @@ struct _GtkIMHtmlToolbar {
 	GtkWidget *image;
 	GtkWidget *link;
 	GtkWidget *smiley;
+	GtkWidget *attention;
 
 	GtkWidget *font_dialog;
 	GtkWidget *fgcolor_dialog;


More information about the Commits mailing list