Commit Graph

21631 Commits

Author SHA1 Message Date
6a94cedee3 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.

Conflicts:
	gtk/gtkfilechooserentry.c
2016-03-10 15:15:37 -06:00
ea2129fda1 filechooserentry: Remove the file column
It is not needed anymore.
2016-03-10 15:15:37 -06:00
af39ce608b 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 "./".
2016-03-10 15:15:37 -06:00
c351227a9d filechooserentry: Refactor function
Name the function set_completion_folder() and make it accept NULL, so it
behaves like a regular setter function.
2016-03-10 15:15:37 -06:00
1945577a61 filechooserentry: Set minimum key length to 0
We want the empty chooser to show possible completions, too.
2016-03-10 15:15:37 -06:00
83dd275d21 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.
2016-03-10 15:15:37 -06:00
dbb59f3dc4 filechooserentry: Get rid of unused member variable
in_change isn't set anymore.
2016-03-10 15:15:37 -06:00
33fffa727a filechooserentry: Remove _gtk_file_chooser_entry_set_file_part()
gtk_entry_set_text() is fine.
2016-03-10 15:15:37 -06:00
ef5088f879 filechooserentry: Use completion for completion
Reduce the amount of code even more by using the entry completion to
query the prefix.
2016-03-10 15:15:37 -06:00
87a67aa0e3 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.
2016-03-10 15:15:37 -06:00
8a4dda06fe 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.)
2016-03-10 15:15:37 -06:00
6ae5aa7429 filechooserentry: Don't override activate
The code is no longer necessary, because the relevant parts for inline
completion are now handled by GtkEntry.
2016-03-10 15:15:37 -06:00
310b484eee 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.
2016-03-10 15:15:37 -06:00
75be2cca58 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.

Conflicts:
	gtk/gtkfilechooserentry.c
2016-03-10 15:15:37 -06:00
8a9a377527 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.

Conflicts:
	gtk/gtkfilechooserentry.c
2016-03-10 15:15:37 -06:00
7570e54212 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.
2016-03-10 15:15:37 -06:00
46adc18c1d 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.

Conflicts:
	gtk/gtkfilechooserentry.c
2016-03-10 15:15:36 -06:00
ad88e6d5c6 filechooserentry: Merge function 2016-03-10 15:15:36 -06:00
3bf9b56234 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.
2016-03-10 15:15:36 -06:00
755d8163ea filechooserentry: Simplify match_selected function
Conflicts:
	gtk/gtkfilechooserentry.c
2016-03-10 15:15:36 -06:00
83421a5f8e 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.
2016-03-10 15:15:36 -06:00
a0ee779cc2 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.
2016-03-10 15:15:36 -06:00
877e238133 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.
2016-03-10 15:15:36 -06:00
143306a515 filechooserentry: Split out function
I want to use that function elsewhere, so split it out.
2016-03-10 15:15:36 -06:00
623c3a6aec filechooserentry: Simplify code
Now that the base folder is always != NULL, we can remove the parts of
the code that check for NULL.
2016-03-10 15:15:36 -06:00
39dbcbab97 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?
2016-03-10 15:15:36 -06:00
02705bce36 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.
2016-03-10 15:15:36 -06:00
f0573f8b42 filechooserentry: Start autocomplete immediately
Don't do idle handlers for this.

Conflicts:
	gtk/gtkfilechooserentry.c
2016-03-10 15:15:36 -06:00
a8c766991a filechooserentry: Remove file_system argument
It's not needed anymore.
2016-03-10 15:15:36 -06:00
ce8d0599dc 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.
2016-03-10 15:15:36 -06:00
c2978cc394 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.

Also, remove _gtk_file_system_get_folder() as it's no longer used.

Conflicts:
	gtk/gtkfilesystem.h
2016-03-10 15:15:36 -06:00
85563ccd35 filechooserentry: Use a GtkFileSystemModel
Replace the usage of a list store and a GtkFolder with a
GtkFileSystemModel. This improves performance and reduces code size.

Conflicts:
	gtk/gtkfilechooserentry.c
2016-03-10 15:15:30 -06:00
88810509ca filechooserentry: Store the liststore as a treemodel
Just changes the type of the member variable. This way we can avoid a
lot of casts.
2016-03-08 20:45:31 -06:00
c94e902894 filechooserentry: Make appending / to directories simpler 2016-03-08 20:45:17 -06:00
5280da05ee 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.
2016-03-08 20:45:13 -06:00
29d7464922 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.
2016-03-08 20:45:04 -06:00
fc84c3e02e filechooserentry: Fold in start_loading_current_folder()
The function just did one thing, we can just fold it into the only
caller.

Conflicts:
	gtk/gtkfilechooserentry.c
2016-03-08 20:44:43 -06:00
82a1d9fb18 filechooserentry: The file system cannot be NULL
Remove code that checked this.
2016-03-08 20:43:02 -06:00
707aadf6b1 filechooserentry: Make the filesystem a construct-only argument
This allows simplifications in the code.
2016-03-08 20:42:30 -06:00
bdb4727f7f filechooserentry: Keep finished_loading variable ourselves
This will be useful in the next commits when the GtkFolder code
previously keeping that variable gets repalced.
2016-03-08 20:42:09 -06:00
0e6d18eaef filechooserentry: force_reload is never TRUE
.. so remove it.
2016-03-08 20:42:03 -06:00
9c5b7b7892 filechooserentry: Fold function into other
There's no need to discard the current folder's file without also
discarding the folder object.
2016-03-08 20:41:57 -06:00
aff9158d41 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.
2016-03-08 20:41:49 -06:00
a82a166700 filechooserentry: Use the actual discarding function to discard a folder 2016-03-08 20:41:42 -06:00
6d184e9707 filechooserentry: Don't use a magic number
... when we have a proper enum value for a column.
2016-03-08 20:41:34 -06:00
5fb443d236 Include <package/> tag in generated GIR
Specify pkg-config name when generating GIR files, used for mapping GIR
name to pkg-config names

https://bugzilla.gnome.org/show_bug.cgi?id=635287
2016-03-07 18:09:49 +01:00
674d0eb7e9 printing: Properly initialize auth_info in gtkprintbackend.c
auth_info should be a NULL-terminated array as it is used in
e.g. g_strdupv invocations iterating over its elements until
a NULL element is encountered.

https://bugzilla.gnome.org/show_bug.cgi?id=737777

(cherry picked from commit 15dbadf38992aa09364f0dd06a71a51b99b6e800)
2016-03-07 17:56:41 +01:00
407c89863d Avoid integer overflow
Use g_malloc_n in gdk_cairo_set_source_pixbuf when allocating
a large block of memory, to avoid integer overflow.

Pointed out by Bert Massop in
https://bugzilla.gnome.org/show_bug.cgi?id=703220

(cherry picked from commit 894b1ae76a32720f4bb3d39cf460402e3ce331d6)
2016-03-07 17:38:33 +01:00
ba91ab6604 2.34.30 2016-03-05 12:30:46 -05:00
2289695b69 status icon: Prevent size dithering
We're seeing loops where the size of some status icons constantly
dithers between 24 and 25. Since I couldn't track down exactly
where the one extra pixel comes from, just stop reacting
to single-pixel size changes.

https://bugzilla.gnome.org/show_bug.cgi?id=758893
2016-03-05 12:16:08 -05:00