Bug 18556

Summary: Escape should close/cancel focused toplevel dialog
Product: PackageKit Reporter: Rui Tiago Matos <tiagomatos>
Component: GeneralAssignee: Richard Hughes <richard>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: activate cancel/close button on escape
activate cancel/close button on escape

Description Rui Tiago Matos 2008-11-16 13:51:12 UTC
Created attachment 20342 [details] [review]
activate cancel/close button on escape

Hi,

gnome-packagekit's GUIs don't usually bind the Escape key to close dialogs. Maybe it is intentional, maybe not, but please consider applying the patch I'm attaching to do that.

As an added bit of polish I've made the patch in a way that the close/cancel button in question will give visual feedback that its action is being activated.

I'm actually thinking of adding this patch to all GNOME modules and to GTK+ itself so any comments on this first version are very welcome.
Comment 1 Rui Tiago Matos 2008-11-16 13:53:07 UTC
Created attachment 20344 [details] [review]
activate cancel/close button on escape

The previous patch was mangled by my git color settings.
Comment 2 Rui Tiago Matos 2008-11-17 01:48:50 UTC
(In reply to comment #0)
> gnome-packagekit's GUIs don't usually bind the Escape key to close dialogs.
> Maybe it is intentional, maybe not, but please consider applying the patch I'm
> attaching to do that.

Reading through GTK+'s code I've found exactly why. The binding is made at the GtkDialog class level like so:

  gtk_binding_entry_add_signal (binding_set, GDK_Escape, 0,
                                "close", 0);

Since the toplevel windows used on gnome-packagekit are not derived from GtkDialog they don't automatically have this binding.

Should I add this comment to http://bugzilla.gnome.org/show_bug.cgi?id=561114 too? :-)
Comment 3 Richard Hughes 2008-11-17 05:28:55 UTC
I've just fixed this in gnome-packagekit master. I'll do the same for gnome-power-manager now. Thanks for working out the real problem! :-)

commit d18d9330f1b785c54ab47c68ce2fbb28835ebb07
Author: Richard Hughes <richard@hughsie.com>
Date:   Mon Nov 17 13:25:28 2008 +0000

    bugfix: make the root windows of the glade files be GtkDialog type, not GtkWindow

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.