Re: [evolution-patches] Seeking review for bug #47751 & #47752



Hi guys,

I did some investigation of keybindings in gtkdialog - it already hooks
up the escape key.  Only - it only activates if you have a
GTK_RESPONSE_CANCEL in the dialog buttons(!).  We only have a
GTK_RESPONSE_REJECT, even though we actually have a GTK_STOCK_CANCEL
button ....

So all we need to do is change it to use GTK_RESPONSE_CANCEL and the
escape binding will happen automagically, and also be rebindable 'for
free' as well.  This already happens for the top-level filter editor
window and probably others.

The attached patch does some of the work, but more is required in
mail/*, and possibly in the addressbook (anywhere where the filtereditor
stuff is used).

 Michael

On Wed, 2003-08-20 at 05:19, Maxx Cao wrote:
> Hi Jeff,
> 
> Thanks a lot for your rapid comments! 
> 
> As you suggested, I've changed the warning message to
> 
>     "You are about to cancel editing this rule. Are you sure you want
> to cancel?"
> 
> I think it's clear enough and not too long. Users can understand what
> canceling 
> means, don't they?
> 
> I've attached the new patch here. Please review, thanks.

? filter/a.diff
? filter/filter-system-flag.c
? filter/filter-system-flag.h
? filter/filter-url.c
? filter/filter-url.h
? filter/filter.diff
? filter/filter.txt
? filter/old
? filter/search-types.xml
? filter/shit.txt
Index: filter/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/filter/ChangeLog,v
retrieving revision 1.371.4.1
diff -u -3 -r1.371.4.1 ChangeLog
--- filter/ChangeLog	5 Aug 2003 21:09:36 -0000	1.371.4.1
+++ filter/ChangeLog	20 Aug 2003 14:54:09 -0000
@@ -1,3 +1,13 @@
+2003-08-20  Not Zed  <NotZed Ximian com>
+
+	** See bug #47751.
+
+	* rule-editor.c (add_editor_response, edit_editor_response) 
+	(rule_edit, rule_add, rule_editor_construct, editor_response):
+	* rule-context.c (new_rule_response, rule_context_add_rule_gui): 
+	* filter-datespec.c (button_clicked): RESPONSE_REJECT/ACCEPT ->
+	RESPONSE_CANCEL/OK
+
 2003-08-05  Not Zed  <NotZed Ximian com>
 
 	** See bug #42636.
Index: filter/filter-datespec.c
===================================================================
RCS file: /cvs/gnome/evolution/filter/filter-datespec.c,v
retrieving revision 1.32
diff -u -3 -r1.32 filter-datespec.c
--- filter/filter-datespec.c	27 Mar 2003 23:54:16 -0000	1.32
+++ filter/filter-datespec.c	20 Aug 2003 14:54:09 -0000
@@ -405,8 +405,8 @@
 	dialog = (GtkDialog *) gtk_dialog_new ();
 	gtk_window_set_title ((GtkWindow *) dialog, _("Select a time to compare against"));
 	gtk_dialog_add_buttons (dialog,
-				GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,
-				GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
+				GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+				GTK_STOCK_OK, GTK_RESPONSE_OK,
 				NULL);
 	
 	p->notebook_type = glade_xml_get_widget (gui, "notebook_type");
@@ -424,7 +424,7 @@
 	
 	gtk_box_pack_start ((GtkBox *) dialog->vbox, toplevel, TRUE, TRUE, 3);
 	
-	if (gtk_dialog_run (dialog) == GTK_RESPONSE_ACCEPT) {
+	if (gtk_dialog_run (dialog) == GTK_RESPONSE_OK) {
 		get_values (fds);
 		set_button (fds);
 	}
Index: filter/rule-context.c
===================================================================
RCS file: /cvs/gnome/evolution/filter/rule-context.c,v
retrieving revision 1.49
diff -u -3 -r1.49 rule-context.c
--- filter/rule-context.c	11 Jun 2003 15:56:38 -0000	1.49
+++ filter/rule-context.c	20 Aug 2003 14:54:09 -0000
@@ -649,7 +649,7 @@
 static void
 new_rule_response(GtkWidget *dialog, int button, RuleContext *context)
 {
-	if (button == GTK_RESPONSE_ACCEPT) {
+	if (button == GTK_RESPONSE_OK) {
 		FilterRule *rule = g_object_get_data((GObject *) dialog, "rule");
 		char *user = g_object_get_data((GObject *) dialog, "path");
 		
@@ -696,9 +696,9 @@
 	
 	dialog =(GtkDialog *) gtk_dialog_new();
 	gtk_dialog_add_buttons(dialog,
-				GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,
-				GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
-				NULL);
+			       GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+			       GTK_STOCK_OK, GTK_RESPONSE_OK,
+			       NULL);
 	
 	gtk_window_set_title((GtkWindow *) dialog, title);
 	gtk_window_set_default_size((GtkWindow *) dialog, 600, 400);
Index: filter/rule-editor.c
===================================================================
RCS file: /cvs/gnome/evolution/filter/rule-editor.c,v
retrieving revision 1.54
diff -u -3 -r1.54 rule-editor.c
--- filter/rule-editor.c	29 Apr 2003 17:08:40 -0000	1.54
+++ filter/rule-editor.c	20 Aug 2003 14:54:09 -0000
@@ -229,7 +229,7 @@
 	GtkTreePath *path;
 	GtkTreeIter iter;
 	
-	if (button == GTK_RESPONSE_ACCEPT) {
+	if (button == GTK_RESPONSE_OK) {
 		if (!filter_rule_validate (re->edit)) {
 			/* no need to popup a dialog because the validate code does that. */
 			return;
@@ -284,8 +284,8 @@
 	
 	re->dialog = gtk_dialog_new ();
 	gtk_dialog_add_buttons ((GtkDialog *) re->dialog,
-				GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,
-				GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
+				GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+				GTK_STOCK_OK, GTK_RESPONSE_OK,
 				NULL);
 	
 	gtk_window_set_title ((GtkWindow *) re->dialog, _("Add Rule"));
@@ -312,7 +312,7 @@
 	GtkTreeIter iter;
 	int pos;
 	
-	if (button == GTK_RESPONSE_ACCEPT) {
+	if (button == GTK_RESPONSE_OK) {
 		if (!filter_rule_validate (re->edit)) {
 			/* no need to popup a dialog because the validate code does that. */
 			return;
@@ -366,8 +366,8 @@
 	
 	re->dialog = gtk_dialog_new ();
 	gtk_dialog_add_buttons ((GtkDialog *) re->dialog,
-				GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,
-				GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
+				GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+				GTK_STOCK_OK, GTK_RESPONSE_OK,
 				NULL);
 	
 	gtk_window_set_title ((GtkWindow *) re->dialog, _("Edit Rule"));
@@ -649,7 +649,7 @@
 static void
 editor_response (GtkWidget *dialog, int button, RuleEditor *re)
 {
-	if (button == GTK_RESPONSE_REJECT) {
+	if (button == GTK_RESPONSE_CANCEL) {
 		if (enable_undo)
 			rule_editor_play_undo (re);
 		else {
@@ -736,15 +736,8 @@
 	g_signal_connect (re, "response", G_CALLBACK (editor_response), re);
 	rule_editor_set_source (re, source);
 	
-	if (enable_undo) {
-		gtk_dialog_add_buttons ((GtkDialog *) re,
-					GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,
-					GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
-					NULL);
-	} else {
-		gtk_dialog_add_buttons ((GtkDialog *) re,
-					GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
-					GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
-					NULL);
-	}
+	gtk_dialog_add_buttons ((GtkDialog *) re,
+				GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+				GTK_STOCK_OK, GTK_RESPONSE_OK,
+				NULL);
 }


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