diff src/gtkimhtml.c @ 10108:f0100b414d98

[gaim-migrate @ 11141] Two things: a. Added Enter as a gtk_binding to GtkIMHtml. This fixes everything. Input methods now work. The "Enter sends" and "Ctrl-Enter sends" preferences were removed and defaulted to yes and no respectively, BUT, in a very super-cool turn of events, you can now add your own bindings to .gtkrc to make WHATEVER YOU WANT send. Awesome. Someone should use g_signal_accumulator_true_handled or something to make profiles and away messages able to insert newlines. b. Removed "Use multi-colored screennames in chats," defaulted to yes, and wrote a nifty algorithm to automatically adjust the colors to accomodate the background (see http://gaim.sf.net/sean/porn-chat.png). People should play around and tweak it a bit. The algorithm takes into consideration the luminosity of the current background and the base hue to use for the screenname in generating the new colors. Note that it does this while maintaining the hues. Someone should optimize this so it skips over the floating point arithmatic when the background color is white. committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Sun, 17 Oct 2004 23:55:49 +0000
parents fad5d3354cc1
children 4b276d2e5589
line wrap: on
line diff
--- a/src/gtkimhtml.c	Sun Oct 17 22:38:24 2004 +0000
+++ b/src/gtkimhtml.c	Sun Oct 17 23:55:49 2004 +0000
@@ -120,6 +120,7 @@
 	TOGGLE_FORMAT,
 	CLEAR_FORMAT,
 	UPDATE_FORMAT,
+	MESSAGE_SEND,
 	LAST_SIGNAL
 };
 static guint signals [LAST_SIGNAL] = { 0 };
@@ -522,13 +523,14 @@
 		case GDK_Home:
 			return TRUE;
 			break;
-
+			
 		case GDK_End:
 			return TRUE;
 			break;
-
+			
 #endif /* !(Gtk+ >= 2.2.0) */
 		}
+	
 	return FALSE;
 }
 static void paste_unformatted_cb(GtkMenuItem *menu, GtkIMHtml *imhtml)
@@ -888,6 +890,11 @@
 	return FALSE;
 }
 
+static gboolean imhtml_message_send(GtkIMHtml *imhtml)
+{
+	return FALSE;
+}
+
 static void imhtml_toggle_format(GtkIMHtml *imhtml, GtkIMHtmlButtons buttons)
 {
 	switch (buttons) {
@@ -1007,9 +1014,17 @@
 					      0,
 					      g_cclosure_marshal_VOID__VOID,
 					      G_TYPE_NONE, 0);
+	signals[MESSAGE_SEND] = g_signal_new("message_send",
+					     G_TYPE_FROM_CLASS(gobject_class),
+					     G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+					     G_STRUCT_OFFSET(GtkIMHtmlClass, message_send),
+					     NULL,
+					     0, g_cclosure_marshal_VOID__VOID,
+					     G_TYPE_NONE, 0);
 
 	klass->toggle_format = imhtml_toggle_format;
-
+	klass->message_send = imhtml_message_send;
+	
 	gobject_class->finalize = gtk_imhtml_finalize;
       	widget_class->drag_motion = gtk_text_view_drag_motion;
 	gtk_widget_class_install_style_property(widget_class, g_param_spec_boxed("hyperlink-color",
@@ -1024,6 +1039,9 @@
 	gtk_binding_entry_add_signal (binding_set, GDK_plus, GDK_CONTROL_MASK, "format_function_toggle", 1, G_TYPE_INT, GTK_IMHTML_GROW);
 	gtk_binding_entry_add_signal (binding_set, GDK_equal, GDK_CONTROL_MASK, "format_function_toggle", 1, G_TYPE_INT, GTK_IMHTML_GROW);
 	gtk_binding_entry_add_signal (binding_set, GDK_minus, GDK_CONTROL_MASK, "format_function_toggle", 1, G_TYPE_INT, GTK_IMHTML_SHRINK);
+	binding_set = gtk_binding_set_by_class(klass);
+	gtk_binding_entry_add_signal (binding_set, GDK_KP_Enter, 0, "message_send", 0);
+	gtk_binding_entry_add_signal (binding_set, GDK_Return, 0, "message_send", 0);
 }
 
 static void gtk_imhtml_init (GtkIMHtml *imhtml)