Filechooser default widget is lost because of opening two consecutive popovers
Steps to reproduce:
- Open a "Save as" filechooser (e.g. in Gedit)
- right click on a file and click "Rename"
- Press ESC to dismiss the rename popover (or you can actually rename the file, bug happens either case)
- Click on the name entry (optionally modify the filename to save)
- Press ENTER key (to close filechooser and save the file)
Actual result:
Nothing happens.
Expected result:
Filechooser default widget ('Save' button) is activated, so file is saved and Filechooser is closed.
Bug rationale:
When the first popover is opened (the one that contains the Rename item) the popover saves internally the current default widget (the save button)to later restablish it when the popover is closed and sets it to NULL
in the Filechooser, so when the second popover (the Rename dialog) is opened it also saves the current default widget which is now NULL, and when the Rename dialog is dismissed (or confirmed) it leaves that NULL default widget on filechooser.
Fix rationale:
Restore early the default widget on the first popover, the restoration is usually done on popover_unmap but we do it manually after clicking the "Rename" action but before the Rename popover is launched, this way when the Rename popover is launched it can save the correct default widget, to later restablish it when it's dismissed.