[evolution-patches] HIG-compliance for the mail search dialog



Hi,

This patch makes the C-s mail search dialog a bit more HIG-compliant. 
Also, it makes it so that you can close the dialog by pressing Escape.

Is it OK to commit?

  Federico

2003-06-03  Federico Mena Quintero  <federico ximian com>

	* mail-search.c (mail_search_construct): Put the buttons in HIG
	order; don't replace the label of the stock Find button.  Also,
	add Escape as a keybinding for the Close button (see why GTK+ is
	on crack on b.g.o #74221 and #101293).

Index: mail-search.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/mail-search.c,v
retrieving revision 1.27
diff -u -r1.27 mail-search.c
--- mail-search.c	21 May 2003 15:27:54 -0000	1.27
+++ mail-search.c	3 Jun 2003 17:59:20 -0000
@@ -32,6 +32,7 @@
 #include <gtkhtml/gtkhtml-search.h>
 #include <gtkhtml/htmlengine.h>
 #include <libgnomeui/gnome-window-icon.h>
+#include <gdk/gdkkeysyms.h>
 
 
 static ESearchingTokenizer *mail_search_tokenizer (MailSearch *ms);
@@ -273,6 +274,7 @@
 	GtkWidget *button;
 	GtkWidget *msg_hbox;
 	GtkWidget *msg_frame;
+	GtkAccelGroup *accel_group;
 	
 	g_return_if_fail (ms != NULL && IS_MAIL_SEARCH (ms));
 	g_return_if_fail (mail != NULL && IS_MAIL_DISPLAY (mail));
@@ -284,12 +286,14 @@
 	
 	gtk_window_set_title ((GtkWindow *) ms, _("Find in Message"));
 	
-	button = gtk_button_new_from_stock (GTK_STOCK_FIND);
-	gtk_button_set_label ((GtkButton *) button, _("Search"));
-	gtk_dialog_add_action_widget ((GtkDialog*) ms, button, GTK_RESPONSE_ACCEPT);
-	gtk_dialog_add_button ((GtkDialog *) ms, GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE);
+	button = gtk_dialog_add_button ((GtkDialog *) ms, GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE);
 	gtk_dialog_set_default_response ((GtkDialog *) ms, GTK_RESPONSE_ACCEPT);
-	
+	accel_group = gtk_accel_group_new ();
+	gtk_window_add_accel_group (GTK_WINDOW (ms), accel_group);
+	gtk_widget_add_accelerator (button, "activate", accel_group, GDK_Escape, 0, GTK_ACCEL_LOCKED);
+
+	gtk_dialog_add_button ((GtkDialog *) ms, GTK_STOCK_FIND, GTK_RESPONSE_ACCEPT);
+
 	ms->search_forward = TRUE;
 	ms->case_sensitive = FALSE;
 	


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]