Commit Graph

29797 Commits

Author SHA1 Message Date
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
fc775dfa5b entrycompletion: Export gtk_entry_completion_compute_prefix()
I want to use it in the file chooser entry autocomplete code.
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
036195e7a8 gtkfolder: Remove
It's not used anymore. And new code should of course use gio.
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
Benjamin Otte
06a64daefc filechooserentry: Store the liststore as a treemodel
Just changes the type of the member variable. This way we can avoid a
lot of casts.
2011-12-16 20:09:11 +01:00
Benjamin Otte
5ebc69066a filechooserentry: Make appending / to directories simpler 2011-12-16 20:09:11 +01:00
Benjamin Otte
2b9ecd9706 filechooserentry: Only append / to directory names once
Since 069d78ed31 the / is appended to
directories upon constructing the display name, so there is no need to
do it later.
2011-12-16 20:09:11 +01:00
Benjamin Otte
8389922de9 filechooserentry: Don't trim away the slash after directories
It's not necessary as the code appending the slashes checks for a slash
these days.
2011-12-16 20:09:11 +01:00
Benjamin Otte
2ead847f7d filechooserentry: Fold in start_loading_current_folder()
The function just did one thing, we can just fold it into the only
caller.
2011-12-16 20:09:11 +01:00
Benjamin Otte
a04b70e51f filechooserentry: The file system cannot be NULL
Remove code that checked this.
2011-12-16 20:09:11 +01:00
Benjamin Otte
05398b8f1a filechooserentry: Make the filesystem a construct-only argument
This allows simplifications in the code.
2011-12-16 20:09:11 +01:00
Benjamin Otte
5aeac0bccb filechooserentry: Keep finished_loading variable ourselves
This will be useful in the next commits when the GtkFolder code
previously keeping that variable gets repalced.
2011-12-16 20:09:11 +01:00
Benjamin Otte
b6f6e33801 filechooserentry: force_reload is never TRUE
.. so remove it.
2011-12-16 20:09:11 +01:00
Benjamin Otte
f0cf1117e1 filechooserentry: Fold function into other
There's no need to discard the current folder's file without also
discarding the folder object.
2011-12-16 20:09:11 +01:00
Benjamin Otte
d5e5ca3e2a filechooserentry: Reorganize function
Setter functions the way I code it look like this (in order):
1) Figure out if the value changed. If not, exit early.
2) Clear the old value (ie unref stuff, disconnect signals
3) Copy the new value
4) Set up things about the new value

This reorganization does that.

And by doing that, it even reduces the amount of code and the amount of
branches (and with it, nesting) needed.
2011-12-16 20:09:11 +01:00
Benjamin Otte
7b51ca9a47 filechooserentry: Use the actual discarding function to discard a folder 2011-12-16 20:09:11 +01:00
Benjamin Otte
edddb666a7 filechooserentry: Don't use a magic number
... when we have a proper enum value for a column.
2011-12-16 20:09:11 +01:00
Benjamin Otte
92a72ce3e5 entry: Move freeze/thaw into begin/end_change 2011-12-16 20:09:11 +01:00
Benjamin Otte
cf8f3c07f2 entry: Don't try to handle Tab in entry completions
Instead, fall through to the default handler after closing the
completion. This has the advantage of letting the file chooser entry
capture the tab key properly, so one can't accidentally move out of the
entry by pressing tab while the completion is popped up.

I also suspect it fixes bugs with weird tab keys and shift/ctrl
oddities. But who knows...
2011-12-16 20:09:11 +01:00
Daniel Mustieles
88da2e81ab Updated Spanish translation 2011-12-16 14:22:49 +01:00
Benjamin Otte
e104219ab1 tests: Relax a refcount comparison check
We now test for real_refcount >= expected_refcount, because various
parts of the code (a11y, selection, cursor, ...) can and do add
references.
2011-12-16 13:39:43 +01:00
Benjamin Otte
113aff673f a11y: Don't emit children-changed when nothing changed
When we have 0 columns, no children ever get added or removed.
2011-12-16 13:39:43 +01:00
Benjamin Otte
d78971b31d treeview: Run unref helper for all rows
Don't do shortcuts. Because all rows need to be unreffed.
Introduced in 92929b968b.
2011-12-16 13:39:43 +01:00
Matthias Clasen
afa945f480 Updates 2011-12-15 23:59:36 -05:00
Matthias Clasen
7f5a665b95 Fix more linking fallout
We are using xinput and gmodule API in a few places in libgtk.
https://bugzilla.gnome.org/show_bug.cgi?id=665326
2011-12-15 23:35:06 -05:00