Commit Graph

10285 Commits

Author SHA1 Message Date
Federico Mena Quintero
aaa922bedb 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>
2013-03-12 18:29:15 -06:00
Federico Mena Quintero
aa958f089d filechooserbutton: whitespace fixes 2013-03-12 18:29:11 -06:00
Federico Mena Quintero
29ed8d781e 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>
2013-03-12 18:29:06 -06:00
Federico Mena Quintero
9cfec7d3db 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>
2013-03-12 18:29:02 -06:00
Federico Mena Quintero
f9f76a3a0f 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>
2013-03-12 18:28:59 -06:00
Federico Mena Quintero
2b6db9fb31 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>
2013-03-12 18:28:55 -06:00
Federico Mena Quintero
bc604fe9f0 filechooserbutton: whitespace fixes 2013-03-12 18:28:50 -06:00
Federico Mena Quintero
d09b75b9ed 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>
2013-03-12 18:28:41 -06:00
Federico Mena Quintero
2368a31984 filechooserbutton: Add tests for unselect_all()
These all pass except one.
2013-03-12 18:28:37 -06:00
Federico Mena Quintero
15f9422adf 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.
2013-03-12 18:28:29 -06:00
Federico Mena Quintero
a37a8158bb gtkfilechooserbutton: In tests, allow the possibility of doing unselect_all 2013-03-12 18:28:23 -06:00
Federico Mena Quintero
82a5a0240c 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>
2013-03-12 18:28:13 -06:00
Aleksander Morgado
b994bcd4f2 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
2013-03-12 12:42:21 +01:00
Federico Mena Quintero
979e8bd9ec filechooserbutton: Update the combo box even after the dialog is cancelled
We assumed that we didn't have to update the combo box if the dialog got cancelled,
as it should simply retain its previous contents.  But this assumption doesn't work
as the dialog is brought up with the 'Other...' item - we don't want the
combo box to keep showing 'Other...' if the dialog is cancelled.

The test from the previous commit now passes.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-03-08 12:58:02 -06:00
Federico Mena Quintero
e16591780d filechooserbutton: New test for opening the Other item in the combo box and then canceling the dialog
There is this bug:

1. Start with a file chooser button in SELECT_FOLDER mode, and select a folder from the combo box.

2. Click on the button's combo box, select 'Other...'

3. You get the file chooser dialog. Cancel the dialog.

4. The file chooser button's combo box still shows 'Other...' instead of
   showing the selection from (1).

This is a test to ensure that the original selection is restored.
The test fails right now.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-03-08 12:57:58 -06:00
Federico Mena Quintero
dc5c12b437 filechooserbutton: Sync the tests a bit with the master branch
The tests fail right now in gtk-2-24 because accessibility is not available out of the box.
2013-03-08 11:13:12 -06:00
Federico Mena Quintero
6dc11c26a8 filechooserbutton: Don't show the (None) item when the combo box is popped up
This is surprisingly tricky, since the (None) item *has* to be a visible item while
the combo box is *not* popped up, so that it can show its contents.  But the item
has to be *not* visible when the combo box is popped up.

Also, update the whole button's selection, not just the underlying dialog's, when
the combo box changes its selection - based on a patch by Paul Davis in
https://bugzilla.gnome.org/show_bug.cgi?id=691040#c20

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-03-08 10:56:49 -06:00
Federico Mena Quintero
b714446fd8 filechooserbutton: In SELECT_FOLDER, when the selection is empty, show (None) in the combo box
We do this by adding a new row type, ROW_TYPE_EMPTY_SELECTION.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-03-08 10:54:43 -06:00
Federico Mena Quintero
a72b31bac1 filechooserbutton: Update the button/combo at construction time
This way the internal labels will show the correct selection even if nothing
has been selected programmatically.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-03-08 10:54:39 -06:00
Federico Mena Quintero
6fb7087758 filechooserbutton: Update the button/combo whenever the selection is changed programmatically
We didn't change it when the file chooser button's dialog was inactive, and so
the actual file chooser button would not visually reflect the current selection.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-03-08 10:54:32 -06:00
Federico Mena Quintero
c4b47464a2 filechooserbutton: Test that the expected filename is shown
We do some gymnastics to pull the string out of the GtkButton or the GtkComboBox that is
being used in GtkFileChooserButton to show the current selection when the dialog
is inactive - namely, we look for the subwidget with the correct ATK role, and pull its
accessible name.

Currently the test fails; this is https://bugzilla.gnome.org/show_bug.cgi?id=691040#c18

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-03-08 10:54:08 -06:00
Aleksander Morgado
b2a65ebfb6 spinbutton: don't override initial text in non-numeric-only spin buttons
https://bugzilla.gnome.org/show_bug.cgi?id=695312
2013-03-08 11:23:58 +01:00
Federico Mena Quintero
461c1a547e Remove some unused variables 2013-03-06 12:42:24 -06:00
Federico Mena Quintero
3c993547a4 filechooser: Use _gtk_file_has_native_path() throughout when testing for local_only
In the case of checking for local_only, g_file_is_native() is not useful, since it
will return FALSE for something in a FUSE mount.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-03-06 12:25:43 -06:00
Federico Mena Quintero
7a93355977 filechooser: Also convert get_uris() to returning native paths
It was only being done in gtk_file_chooser_get_uri().

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-03-06 12:08:03 -06:00
Federico Mena Quintero
f907d16329 filechooser: Rename _gtk_file_is_path_not_local() to _gtk_file_has_native_path()
Negatives in names of boolean functions are confusing.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-03-06 12:07:12 -06:00
Timothy Arceri
5d32c05578 filechooser: Show FUSE mounted locations in shortcuts
Since FUSE locations can be handled safely by applications show these mounted locations regardless of whether gtk_file_chooser_set_local_only()
is set to TRUE

https://bugzilla.gnome.org/show_bug.cgi?id=586367
2013-03-06 12:05:37 -06:00
Cosimo Cecchi
3087e8b74e Revert "entry: never use GTK_STATE_ACTIVE to paint the background"
This reverts commit 87115e00a8.

https://bugzilla.gnome.org/show_bug.cgi?id=695003
2013-03-05 17:50:01 -05:00
Changwoo Ryu
b01f90b8d1 immodule: Fix context ID lookup on module with multiple contexts
https://bugzilla.gnome.org/show_bug.cgi?id=690247
2013-03-04 13:07:10 +09:00
Federico Mena Quintero
8eb2278f6a filechooserbutton: Don't ever use gtk_file_chooser_get_files()
The file chooser button only supports single-selection modes, so
switch the code to a simpler gtk_file_chooser_get_file() to avoid
dealing with GSLists of a single file.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-02-21 18:44:38 -06:00
Руслан Ижбулатов
d9f87ff098 Make sure icon cache has /-separated subdirs only (v2 - use g_build_path)
https://bugzilla.gnome.org/show_bug.cgi?id=692955
(cherry picked from commit 8e80fd1ab9)

Conflicts:
	gtk/updateiconcache.c
2013-02-21 19:44:47 +01:00
Federico Mena Quintero
2cc67fc109 filechooserbutton: In tests, sleep after opening the dialog
This may ensure that the dialog is actually done initializing.  We need to kill this
sleeping business and really use signals, sigh...

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-02-20 18:52:23 -06:00
Federico Mena Quintero
f8de7b1757 filechooserbutton: Don't emit file-set signal when the change is not the result of a user action
We only emit that signal when the user confirms the button's internal GtkFileChooserDialog,
or when he drags-and-drops stuff into the button.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-02-20 18:30:30 -06:00
Federico Mena Quintero
a05d51e7ab filechooserbutton: In the tests, run through the dialog more than one time
This ensures that data maintained by the button while the dialog opens/closes remains consistent.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-02-20 18:29:04 -06:00
Federico Mena Quintero
2f396a74f3 filechooserbutton: Add tests for cancelling the dialog via closing it (delete-event), instead of by simulating the Cancel button (response cancel)
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-02-20 18:14:15 -06:00
Federico Mena Quintero
65cf6295f7 filechooser: When stopping/clearing BROWSE model, really ensure that we end up in LOAD_EMPTY state
Previously we could end up in a situation where browse_list_model==NULL, and yet load_state==LOAD_FINISHED.
This is not a valid state.  So, when we get rid of the list model, really ensure that we end up
in LOAD_EMPTY so nothing assumes that there is a valid list model around.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-02-20 18:02:24 -06:00
Federico Mena Quintero
a070d75a2f filechooser: Tighten up some assertions when actually selecting files in the treeview
The model must be fully loaded, and it must be inserted in the treeview.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-02-20 17:29:05 -06:00
Cosimo Cecchi
c25c2f0a41 Comment out a file chooser test that doesn't pass 2013-02-18 13:58:50 -05:00
William Hua
950084ae18 Make GtkItemFactory produce GtkSeparatorMenuItems.
https://bugzilla.gnome.org/show_bug.cgi?id=694077
2013-02-18 13:40:00 -05:00
Federico Mena Quintero
81df0059cb filechooserbutton: Add tests for SELECT_FOLDER mode with the dialog active
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-02-13 15:21:12 -06:00
Federico Mena Quintero
747a514cfb filechooser: Oops, cancel a file operation that was missing
In addition, remove a list of pending_cancellables that was no longer being used.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-02-13 15:10:08 -06:00
Federico Mena Quintero
670fcf2c41 filechooserbutton: Add a battery of tests for GtkFileChooserButton
These are generic tests that can test the button in all of its modes,
instead of hand-written tests for each combination.

Some tests fail currently.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-02-13 13:50:57 -06:00
Federico Mena Quintero
27eea79537 filechooserbutton: In SELECT_FOLDER mode, consider an empty selection to mean current_folder
If the user didn't explicitly select anything, BUT the file chooser button has
a current_folder set, do the same as what GtkFileChooserDefault would do:
return the current folder as the selection.

This makes the tests in tests/filechooser pass!

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-02-13 12:12:53 -06:00
Federico Mena Quintero
ea3a1ecbd1 filechooserbutton: Keep track of the current_folder while the dialog is inactive
This is analogous to keeping the selection while the dialog is inactive.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-02-13 11:47:35 -06:00
Federico Mena Quintero
c7cae86568 filechooser: Fix cast 2013-02-13 11:14:36 -06:00
Federico Mena Quintero
97aaba8343 filechooserbutton: Remove unused function prototypes 2013-02-13 11:14:17 -06:00
Federico Mena Quintero
bfcaa4228c filechooserbutton: Restore to an empty previous selection properly
If no file was originally selected in the GtkFileChooserButton, then its
internal dialog is brought up and cancelled, then we need to restore the
selection back to none.  GtkFileChooser, though, doesn't like to
select a NULL file, so call _unselect_all() in that condition.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-02-13 11:01:50 -06:00
Michael Natterer
5de08612dc gtk: reliably stop spinning when a GtkSpinButton is hidden
Call stop_spinning() also in unrealize() because unmap() is not
reliably called in GTK+ 2.x. This is not an issue in GTK+ 3.x.
2013-02-13 14:37:11 +01:00
Federico Mena Quintero
30a2f8edcc filechooserbutton: Add test for setting/getting the current folder; currently fails
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-02-11 23:12:20 -06:00
Federico Mena Quintero
1cfd1f372a filechooserbutton: Fix preserving the selection after cancelling the dialog
The button's underlying file chooser dialog should not be used to store the file selection
while the dialog is unmapped.  Instead, the file chooser button now stores the
selection itself.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-02-11 23:11:10 -06:00