Commit Graph

220 Commits

Author SHA1 Message Date
Matthias Clasen
3f18e76a34 Remove debug spew 2015-07-23 00:45:32 -04:00
Matthias Clasen
91c05f6f6b file chooser entry: Special-case ., .. and ~
Make sure entering the three special strings ".", ".." or "~" in
the location entry works as expected. They already worked correctly
if you append a '/' to force them to be recognized as the 'folder'
part, but that should not be necessary.

https://bugzilla.gnome.org/show_bug.cgi?id=752707
2015-07-23 00:42:19 -04:00
Matthias Clasen
9b5e00b3c4 file chooser entry: Capture Escape and emit :hide-entry
Make the file chooser entry optionally capture Escape
and emit a signal. Make the file chooser widget hide the
entry on that signal and go back to the path bar.
This gives us a two-level undo:
location entry -> path bar -> dialog close.
When the location entry is permanently displayed in the
header for save mode, we still let the first Escape close
the dialog.
2015-07-04 00:29:24 -04:00
Matthias Clasen
fc8516fe75 Formatting fix 2015-04-05 22:09:04 -04:00
Matthias Clasen
898f0fa0b9 Avoid a critical in the file chooser
Hiding the location entry was causing criticals, because
the completion was updated after the widget has already
been disposed.
https://bugzilla.gnome.org/show_bug.cgi?id=720330
2014-05-21 22:50:48 -04:00
William Jon McCann
469d333aa2 docs: use Returns: consistently
Instead of Return value:
2014-02-19 18:56:05 -05:00
Federico Mena Quintero
9162589b5a GtkFileChooserEntry: don't inline-complete if the entry doesn't have the focus
When the file chooser changes directories, it tells the GtkFileChooserEntry to
change its base folder (i.e. the folder from which relative pathnames are resolved).
GtkFileChooserEntry then starts loading a GtkFileSystemModel asynchronously.
In the finished_loading_cb(), however, it would always ask the GtkEntryCompletion
to insert the completion prefix, since that finished_loading_cb() is what is also used
while the user is typing *in the entry*.

But when the entry doesn't have the focus (e.g. the user changed directories by double-clicking
on the file list in the file chooser), there's no reason to insert completions at all.

https://bugzilla.gnome.org/show_bug.cgi?id=672271
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-06-21 18:35:28 -05:00
Federico Mena Quintero
56bcb1933f 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-05 17:17:42 -06:00
Timothy Arceri
cf216d780c 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-05 17:17:42 -06:00
Matthias Clasen
d51840ccf3 filechooser: Fix entry completion
Inserting the selected completion did not actually work. Oops.

https://bugzilla.gnome.org/show_bug.cgi?id=673090
2012-03-29 18:59:07 -04:00
Javier Jardón
9d0febc9a6 Change FSF Address 2012-02-27 17:06:11 +00:00
Benjamin Otte
b9fad15ee6 filechooserentry: Catch tab key earlier
Instead of in the key_press handler, use a signal handler. The signal
handler runs before the default handler, and before other signal
handlers. In particular it runs before the signal handler installed via
gtk_entry_set_completion() which pops down the entry completion, and we
don't want that to happen.

The code does not change the code of the handler in any significant way,
it just refacotrs it to not call the parent anymore.

https://bugzilla.gnome.org/show_bug.cgi?id=663573
2011-12-16 20:09:14 +01:00
Benjamin Otte
640754e98b filechooserentry: Do inline completion only when opening files
When saving files, using <tab> is required. We don't want the UI
randomly changing filenames from below us.

https://bugzilla.gnome.org/show_bug.cgi?id=663573
2011-12-16 20:09:14 +01:00
Benjamin Otte
351dd206bc filechooserentry: Remove unused enum 2011-12-16 20:09:14 +01:00
Benjamin Otte
4fb6961c6a filechooserentry: Allow NULL as base folder again
This was removed previously, but is necessary to support the case where
no base folder is in use, which should cause an error. This can be
experienced in save mode in the recent files list.

https://bugzilla.gnome.org/show_bug.cgi?id=663573
2011-12-16 20:09:14 +01:00
Benjamin Otte
523a45d927 filechooserentry: Don't show files when selecting directory
We don't want to complete on files when they're not supposed to be
selectable.
2011-12-16 20:09:14 +01:00
Benjamin Otte
57766f1948 filechooserentry: Remove beep function
There's only 2 places left where we potentially beep. We can call
gtk_widget_error_bell() directly there.
2011-12-16 20:09:14 +01:00
Benjamin Otte
0d10583695 filechooserentry: Simplify load completion
Most importantly, consistently trigger a beep when we abort a pending
completion.
2011-12-16 20:09:14 +01:00
Benjamin Otte
c4a331f934 filechooserentry: Use a GtkFileFilter for filtering
That way, we can use the regular filtering features of the
filesystemmodel instead of having our own filtering function that
duplicates much of the matching code.

This also removes the broken-on-windows feature where files strting with
a dot were not autocompleted.
2011-12-16 20:09:14 +01:00
Benjamin Otte
b47b6d307e filechooserentry: Remove the file column
It is not needed anymore.
2011-12-16 20:09:14 +01:00
Benjamin Otte
5607cd9170 filechooserentry: Simplify code
Use all the clever functions we invented in recent refactorings to
compute the file and dir part and the current folder.

This also fixes the bug where "./" was not taken as the current
directory but interpreted as a file named "./".
2011-12-16 20:09:13 +01:00
Benjamin Otte
d27d73f885 filechooserentry: Refactor function
Name the function set_completion_folder() and make it accept NULL, so it
behaves like a regular setter function.
2011-12-16 20:09:13 +01:00
Benjamin Otte
ea8f5f15c1 filechooserentry: Set minimum key length to 0
We want the empty chooser to show possible completions, too.
2011-12-16 20:09:13 +01:00
Benjamin Otte
af9e385616 filechooserentry: Simplify refresh_current_folder_and_file_part()
The function can get the text it's refreshing from itself, as there is
only one possible value. And it doesn't need to return a value anymore.
2011-12-16 20:09:13 +01:00
Benjamin Otte
357ae09b54 filechooserentry: Get rid of unused member variable
in_change isn't set anymore.
2011-12-16 20:09:13 +01:00
Benjamin Otte
6ab681c094 filechooserentry: Remove _gtk_file_chooser_entry_set_file_part()
gtk_entry_set_text() is fine.
2011-12-16 20:09:13 +01:00
Benjamin Otte
c9b220275a filechooserentry: Use completion for completion
Reduce the amount of code even more by using the entry completion to
query the prefix.
2011-12-16 20:09:13 +01:00
Benjamin Otte
d3fd759f77 filechooserentry: Add gtk_file_chooser_entry_get_completion_text()
This returns the text that should be completed on. As this is somewhat
tricky to compute (and in fact one place did it wrong), let's make it a
function.
2011-12-16 20:09:13 +01:00
Benjamin Otte
f6f2a78d3e filechooserentry: Don't update the folder when completing
The folder is always up to date, there's no need to update it. (If the
folder is not up to date, that is a bug and needs to be fixed
elsewhere.)
2011-12-16 20:09:13 +01:00
Benjamin Otte
ad1672c194 filechooserentry: Don't override activate
The code is no longer necessary, because the relevant parts for inline
completion are now handled by GtkEntry.
2011-12-16 20:09:13 +01:00
Benjamin Otte
6e7b2de21e filechooserentry: Simplify append_common_prefix()
Now that we don't need to know anymore why insertion failed, we can
simplify the append function quite a lot.

A simple rule now: If we did not insert anything, beep.
2011-12-16 20:09:13 +01:00
Benjamin Otte
f7e5a773ff filechooserentry: Remove completion feedback
Too much special code for no gain.

I did a totally unscientific questionnaire on GNOME IRC (assuming
autocompletion is for advanced users) and nobody even knew what this is.
So I suspect it's useless. Also, it's positioned completely wrong anyway
and nobody noticed so far. Last but not least, I'm trying to imitate
bash here and bash doesn't show feedback.
2011-12-16 20:09:13 +01:00
Benjamin Otte
93263dcd33 filechooserentry: Redo completion popup trigger
Use dispatch_properties_changed() instead of GtkEditable to watch for
changes to the to-be-completed text. This is necessary because various
functions in GtkEntry don't use the interface vfuncs and one only
becomes aware of them via notifications. I'm not sure this is intended
behavior, but it's how it works today.
Also, use the same code for triggering in all situations.

What the code does is this: It looks at the part of the text in front of
the cursor (or selection) and completes for it. Once the directory has
been enumerated, inline completion is activated. Note that popping up of
the completion popup is completely handled by GtkEntry.
2011-12-16 20:09:13 +01:00
Benjamin Otte
132c42ccbd filechooserentry: Get rid of RefreshMode
Instead, pass the text to use to refresh_current_folder_and_file_part().
This also gets rid of the problem introduced earlier that the position
is not properly updated in do_insert_text() and therefor the completion
is wrong.
2011-12-16 20:09:13 +01:00
Benjamin Otte
45d54fcba6 filechooserentry: Use inline completion
... from GtkEntryCompletion instead of implementing a poor copy
ourselves. This also makes the file chooser entry behave a lot closer to
normal entries.
2011-12-16 20:09:13 +01:00
Benjamin Otte
cdd236ddd4 filechooserentry: Merge function 2011-12-16 20:09:13 +01:00
Benjamin Otte
c585471baf filechooserentry: Set the text column of the entry completion
I want to use it in the next commits, but am doing this in a separate
commit so we can find side effects causing bugs easier when bisecting.
2011-12-16 20:09:12 +01:00
Benjamin Otte
e3ef8a568e filechooserentry: Simplify match_selected function 2011-12-16 20:09:12 +01:00
Benjamin Otte
cde8ae7b1e filechooserentry: Keep an extra column for the full path
This is identical to the display name when not having a path that
changes the folder. Otherwise it will have the full path that was
entered in the entry. Say when from your home dir, you type
"../../usr/li", the full path for "lib" and "lib64" will be
"../../usr/lib" and "../../usr/lib64" respectively. This value isn't
used yet, but will be soon.
2011-12-16 20:09:12 +01:00
Benjamin Otte
1ac6ace87d filechooserentry: Redo _gtk_file_chooser_entry_get_file_part()
The new version does not need to update any text, it just strips the
last part of the existing entry.
2011-12-16 20:09:12 +01:00
Benjamin Otte
e2105c2bef filechooserentry: Modify _gtk_file_chooser_entry_get_current_folder()
The new version does not need to muck with the entry, it just extracts
the required information. It returns a reference to the folder though,
as we extract the information now instead of returning something stored.
2011-12-16 20:09:12 +01:00
Benjamin Otte
5c42972735 filechooserentry: Split out function
I want to use that function elsewhere, so split it out.
2011-12-16 20:09:12 +01:00
Benjamin Otte
2186c28263 filechooserentry: Simplify code
Now that the base folder is always != NULL, we can remove the parts of
the code that check for NULL.
2011-12-16 20:09:12 +01:00
Benjamin Otte
35198e142d filechooserentry: Ensure the base folder is always valid
If the base folder is set to NULL, then we just assume the home dir.
FIXME: Should we disallow a NULL folder?
2011-12-16 20:09:12 +01:00
Benjamin Otte
e0859004f6 filechooserentry: Don't complain about incomplete hostnames
First of all, those hostnames may very well be complete, second of all,
smb:// is a valid uri to enter.
2011-12-16 20:09:12 +01:00
Benjamin Otte
242afcfeff filechooserentry: Start autocomplete immediately
Don't do idle handlers for this.
2011-12-16 20:09:12 +01:00
Benjamin Otte
9ee577d5ee filechooserentry: Remove file_system argument
It's not needed anymore.
2011-12-16 20:09:12 +01:00
Benjamin Otte
c3da748cb2 filechooserentry: Simplify code
Now that we've imported the function in the last commit, rename it and
omit useless arguments by instead passing in the entry directly.
2011-12-16 20:09:12 +01:00
Benjamin Otte
9d09028970 filechooserentry: Move _gtk_file_system_parse()
It's very specific to the file chooser entry, so it's better kept there.
It's also not used anywhere else in the code.
2011-12-16 20:09:12 +01:00
Benjamin Otte
a1e0c1e042 filechooserentry: Use a GtkFileSystemModel
Replace the usage of a list store and a GtkFolder with a
GtkFileSystemModel. This improves performance and reduces code size.
2011-12-16 20:09:11 +01:00