changeset 22722:0ccc0e9ae565

Reset typing timeout if arrow keys are pressed when editing status message. Also replace a double-negative with a less confusing statement.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Sat, 26 Apr 2008 06:19:34 +0000
parents 35621ae24544
children ac66a8c73845 fe546f9e3cbf
files pidgin/gtkstatusbox.c
diffstat 1 files changed, 14 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/gtkstatusbox.c	Sat Apr 26 04:34:11 2008 +0000
+++ b/pidgin/gtkstatusbox.c	Sat Apr 26 06:19:34 2008 +0000
@@ -1140,7 +1140,7 @@
 				                  GTK_DIR_TAB_BACKWARD: GTK_DIR_TAB_FORWARD);
 		return TRUE;
 	}
-	if (!status_box->typing != 0)
+	if (status_box->typing == 0)
 		return FALSE;
 
 	/* Reset the status if Escape was pressed */
@@ -1695,6 +1695,17 @@
 }
 
 static void
+imhtml_cursor_moved_cb(gpointer data, GtkMovementStep step, gint count, gboolean extend,
+		GtkWidget *widget)
+{
+	/* Restart the typing timeout if arrow keys are pressed while editing the message */
+	PidginStatusBox *status_box = data;
+	if (status_box->typing == 0)
+		return;
+	imhtml_changed_cb(NULL, status_box);
+}
+
+static void
 pidgin_status_box_init (PidginStatusBox *status_box)
 {
 	GtkCellRenderer *text_rend;
@@ -1836,6 +1847,8 @@
 	g_signal_connect(G_OBJECT(buffer), "changed", G_CALLBACK(imhtml_changed_cb), status_box);
 	g_signal_connect(G_OBJECT(status_box->imhtml), "format_function_toggle",
 			 G_CALLBACK(imhtml_format_changed_cb), status_box);
+	g_signal_connect_swapped(G_OBJECT(status_box->imhtml), "move_cursor",
+			 G_CALLBACK(imhtml_cursor_moved_cb), status_box);
 	g_signal_connect(G_OBJECT(status_box->imhtml), "key_press_event",
 			 G_CALLBACK(imhtml_remove_focus), status_box);
 	g_signal_connect_swapped(G_OBJECT(status_box->imhtml), "message_send", G_CALLBACK(remove_typing_cb), status_box);