changeset 31411:5e6997ae07e2

The left/right scroll, and close buttons in a PidginScrollBook should only react to single button presses. This addresses an issue I saw in the minidialog where "extra" authorization requests were closed if I clicked them too fast.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Sat, 27 Nov 2010 07:11:48 +0000
parents b1022aa66b8a
children 72e6fa6caecc
files pidgin/gtkscrollbook.c
diffstat 1 files changed, 13 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/gtkscrollbook.c	Sat Nov 27 07:08:24 2010 +0000
+++ b/pidgin/gtkscrollbook.c	Sat Nov 27 07:11:48 2010 +0000
@@ -65,9 +65,13 @@
 }
 
 static gboolean
-scroll_left_cb(PidginScrollBook *scroll_book)
+scroll_left_cb(PidginScrollBook *scroll_book, GdkEventButton *event)
 {
 	int index;
+
+	if (event->type != GDK_BUTTON_PRESS)
+		return FALSE;
+
 	index = gtk_notebook_get_current_page(GTK_NOTEBOOK(scroll_book->notebook));
 
 	if (index > 0)
@@ -76,9 +80,13 @@
 }
 
 static gboolean
-scroll_right_cb(PidginScrollBook *scroll_book)
+scroll_right_cb(PidginScrollBook *scroll_book, GdkEventButton *event)
 {
 	int index, count;
+
+	if (event->type != GDK_BUTTON_PRESS)
+		return FALSE;
+
 	index = gtk_notebook_get_current_page(GTK_NOTEBOOK(scroll_book->notebook));
 	count = gtk_notebook_get_n_pages(GTK_NOTEBOOK(scroll_book->notebook));
 
@@ -131,9 +139,10 @@
 }
 
 static gboolean
-scroll_close_cb(PidginScrollBook *scroll_book)
+scroll_close_cb(PidginScrollBook *scroll_book, GdkEventButton *event)
 {
-	gtk_widget_destroy(gtk_notebook_get_nth_page(GTK_NOTEBOOK(scroll_book->notebook), gtk_notebook_get_current_page(GTK_NOTEBOOK(scroll_book->notebook))));
+	if (event->type == GDK_BUTTON_PRESS)	
+		gtk_widget_destroy(gtk_notebook_get_nth_page(GTK_NOTEBOOK(scroll_book->notebook), gtk_notebook_get_current_page(GTK_NOTEBOOK(scroll_book->notebook))));
 	return FALSE;
 }