combobox: popdown the combobox when on 'grab-broken-event'

And also explicitly remove pointer/keyboard grabs from the display.

Whenever the grab is reported lost, we should popdown the combobox, so that the
GDK_WINDOW_TEMP window is hidden and removed from the toplevel, as done with
the menu for example.

Leaving the GDK_WINDOW_TEMP window open when re-activating the application
triggers several issues in the win32 backend, due to restacking windows of the
non-toplevel group into the toplevel group:

https://bugzilla.gnome.org/show_bug.cgi?id=695200
filechooserbutton: When the combo box changes, set the *file*, not the current folder

The currently-selected file *is* the selection even in SELECT_FOLDER mode.  Do not confuse this
with the current folder.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
gtkfilechooserbutton: In tests, allow the possibility of doing unselect_all
filechooserbutton: HACK: Set a reasonable size for the dialog in the tests' second iteration

Something is causing the GtkFileChooserDialog to be resized really small on the second time it is run
during each test for GtkFileChooserButton.  So as a temporary hack we set it to 500x500 pixels on
the second run, so the size allocation code doesn't bomb on us.
filechooserbutton: Add tests for unselect_all()

These all pass except one.
filechooserbutton: During unselect_all(), update the widgets in all situations

Not just if we thought we had a selection.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
filechooserbutton: whitespace fixes
filechooserbutton: For tests, wait for signals instead of just sleeping

This should let tests complete faster.  Also, this will let us test
that the correct signals are actually being emitted.

The tests now fail, as the signals are not being emitted when they
should.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
filechooserbutton: Emit 'selection-changed' when changing the selection programmatically

We only emitted that signal when the selection changed through the underlying GtkFileChooserDialog.

To do this when the dialog is not active and the selection is changed by the calling program
(instead of by the user), we need to wait until the GtkFileChooserButton's UI has been updated
via an async callback from GIO.  So, we keep track of whether an entry point into the
button's API caused a programmatic change in the selection.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
filechooserbutton: Update the button's state only on programmatic changes to the filechooser's state

The idea is that the button will only update its state of the selection and current folder
when changes to those are done either by the calling program (with the filechooser's API)
or when the user actually confirms and dismisses the underlying GtkFileChooserDialog.

If the user makes changes to the dialog but has not dismissed it yet, those changes
will not be reflected in the button (as one would expect).

This commit also makes sure the current-folder-changed and selection-changed signals
are emitted at the right times.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
filechooserbutton: For the open-dialog-cancel-* tests, add a real nomenclature and test all the combinations

We used to have numeric names, which are a pain to maintain when new tests are added.
Now we have a real nomenclature (see the comment at the beginning of the open-dialog-cancel-* tests),
which lets us see easily if we have tested all the combinations.

Also, added all the combinations that were missing and removed redundant tests.
Not all the tests pass currently.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
filechooserbutton: whitespace fixes
filechooserbutton: Do not propagate state from the dialog unless it is active

Change of plans to match the tests from the previous commit.

The state of the underlying dialog is never reflected by GtkFileChooserButton's API,
as the dialog is a transient thing.  The file chooser button only updates its state from the dialog,
and reflects the dialog's state, when the dialog has been confirmed and dismissed by the user.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
filechooserbutton: Don't duplicate tests for GTK_RESPONSE_DELETE_EVENT

Instead, re-run tests made for GTK_RESPONSE_CANCEL with the delete-event response.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
filechooserbutton: Give proper names to the SELECT_FOLDER tests with cancelled dialog

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
filechooserbutton: Add a description string to assertions about emitted signals

On failed tests, this lets us more easily see see which assertion failed.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
filechooserbutton: Duh, remove all the timeouts after tests

Otherwise tests may start failing if they start after an old timeout triggers.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>