changeset 12710:2d326453b33d

[gaim-migrate @ 15054] Make the context-menu send item do its work by firing the message_send signal, instead of calling the internal callback directly. Change the message_send handlers to connect after the default handler. This way, we can be sure that plugins can block the message from being sent, at a UI level. I'm not sure if that was strictly necessary, but it shouldn't hurt anything. committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Wed, 04 Jan 2006 02:41:11 +0000
parents b4bd3b41bf3b
children 145f76e74a9f
files src/gtkconv.c
diffstat 1 files changed, 10 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/gtkconv.c	Wed Jan 04 02:38:56 2006 +0000
+++ b/src/gtkconv.c	Wed Jan 04 02:41:11 2006 +0000
@@ -3616,6 +3616,11 @@
 	buddy_cb_common(buddy, conv, FALSE);
 }
 
+static void send_menu_cb(GtkWidget *widget, GaimGtkConversation *gtkconv)
+{
+	g_signal_emit_by_name(gtkconv->entry, "message_send");
+}
+
 static void
 entry_popup_menu_cb(GtkIMHtml *imhtml, GtkMenu *menu, gpointer data)
 {
@@ -3626,7 +3631,7 @@
 	g_return_if_fail(gtkconv != NULL);
 
 	menuitem = gaim_new_item_from_stock(NULL, _("_Send"), GAIM_STOCK_SEND,
-										G_CALLBACK(send_cb), gtkconv,
+										G_CALLBACK(send_menu_cb), gtkconv,
 										0, 0, NULL);
 	if (gtk_text_buffer_get_char_count(imhtml->text_buffer) == 0)
 		gtk_widget_set_sensitive(menuitem, FALSE);
@@ -3868,8 +3873,8 @@
 
 	g_signal_connect(G_OBJECT(gtkconv->entry), "key_press_event",
 	                 G_CALLBACK(entry_key_press_cb), gtkconv);
-	g_signal_connect(G_OBJECT(gtkconv->entry), "message_send",
-	                 G_CALLBACK(send_cb), gtkconv);
+	g_signal_connect_after(G_OBJECT(gtkconv->entry), "message_send",
+	                       G_CALLBACK(send_cb), gtkconv);
 	g_signal_connect_after(G_OBJECT(gtkconv->entry), "button_press_event",
 	                       G_CALLBACK(entry_stop_rclick_cb), NULL);
 	g_signal_connect(G_OBJECT(gtkconv->entry), "size-allocate",
@@ -3959,7 +3964,8 @@
 
 	g_signal_connect(G_OBJECT(gtkconv->entry), "key_press_event",
 	                 G_CALLBACK(entry_key_press_cb), gtkconv);
-	g_signal_connect(G_OBJECT(gtkconv->entry), "message_send", G_CALLBACK(send_cb), gtkconv);
+	g_signal_connect_after(G_OBJECT(gtkconv->entry), "message_send",
+	                       G_CALLBACK(send_cb), gtkconv);
 	g_signal_connect_after(G_OBJECT(gtkconv->entry), "button_press_event",
 	                       G_CALLBACK(entry_stop_rclick_cb), NULL);
 	g_signal_connect(G_OBJECT(gtkconv->entry), "size-allocate",