After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 368931 - incorrect file entry completion filling when dropping files to the files view
incorrect file entry completion filling when dropping files to the files view
Status: RESOLVED OBSOLETE
Product: gtk+
Classification: Platform
Component: Widget: GtkFileChooser
2.10.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
Federico Mena Quintero
filechooser-possible-obsolete
: 515679 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2006-11-01 16:31 UTC by Carlos Garnacho
Modified: 2016-03-10 21:49 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch (2.01 KB, patch)
2006-11-01 16:32 UTC, Carlos Garnacho
none Details | Review
updated patch (11.28 KB, patch)
2006-11-13 01:50 UTC, Carlos Garnacho
none Details | Review
Use GtkFileSystemModel as the completion model for GtkFileChooserEntry (12.32 KB, patch)
2007-05-23 10:22 UTC, Emmanuele Bassi (:ebassi)
none Details | Review

Description Carlos Garnacho 2006-11-01 16:31:30 UTC
Hi!,

I noticed high CPU churn when running testfilechooser in gtk+/gtk/ and accidentally dragging and dropping a file from and to the file treeview, and it became worst each time I did that.

Some investigation showed me that if the dropped file is in the same folder than the current one, it's anyways reloading the folder and telling the file entry completion widget to add again all files (effectively, files are shown several times after some DnD operations as commented before). With populated folders CPU churn seems to be produced by completion model reordering.

I'm going to attach a patch that just selects the dropped file if it's in the same folder instead of going through the reload folder/select file process
Comment 1 Carlos Garnacho 2006-11-01 16:32:53 UTC
Created attachment 75779 [details] [review]
patch
Comment 2 Carlos Garnacho 2006-11-10 18:49:45 UTC
I've noticed the same behavior through other methods:

* in testfilechooser, pressing several times in the /usr/nonexistent button, it happens the same, if the test is modified to go to /usr/bin/nonexistent, CPU churn is again there due to the ammount of files.

* pressing in the pathbar the currently shown folder.

I guess you'll prefer a common fix in GtkFileChooserEntry to avoid reloading the completion rather than individual fixes, right? I may begin cooking a patch
Comment 3 Federico Mena Quintero 2006-11-10 18:58:45 UTC
Yes, the right fix should go in the file chooser entry.  It should clear its completion list when _gtk_file_chooser_entry_set_base_folder() is called.  The code is a bit hairy, and I don't remember it very well, but thanks for taking a look :)
Comment 4 Carlos Garnacho 2006-11-13 01:50:21 UTC
Created attachment 76454 [details] [review]
updated patch

I've discovered that it doesn't go through that code path, the completion model keeps track of its current GtkFileFolder changes using its "files-added" and "files-removed" signals, particularly, the "files-added" handler is responsible of refilling the completion model each time the folder is got from the GtkFileSystem, producing the duplicates.

I've done a patch that replaces the custom completion model with a GtkFileSystemModel, which already handles fine this situation. Also avoids duplicating some functionality.
Comment 5 Baptiste Mille-Mathias 2007-05-21 16:00:41 UTC
Hello Federico (or somebody else)

Whould it be possible to review the patch ?

Thanks
Comment 6 Emmanuele Bassi (:ebassi) 2007-05-21 16:21:08 UTC
the patch doesn't cleanly apply to trunk anymore. carlos, could you please check it and port it over to svn? thanks!

from a quick look, it seems okay to use GtkFileSystemModel.
Comment 7 Emmanuele Bassi (:ebassi) 2007-05-23 10:21:09 UTC
I've updated the patch, and it seems to work fine. the code has been simplified and the CPU churning is reduced (albeit, a profile might be better suited at confirming this than looking at the cpu monitor :-)).

attaching the patch updated to trunk.
Comment 8 Emmanuele Bassi (:ebassi) 2007-05-23 10:22:23 UTC
Created attachment 88655 [details] [review]
Use GtkFileSystemModel as the completion model for GtkFileChooserEntry

Use GtkFileSystemModel as the completion model for GtkFileChooserEntry

The GtkFileChooserEntry widget uses its own completion model to keep track
of the current GtkFileFolder changes using its "files-added" and
"files-removed" signals; particularly, the "files-added" handler is
responsible of refilling the completion model each time the folder that it
gets from the GtkFileSystem changes, producing the duplicates.

This patch replaces the custom completion model with a GtkFileSystemModel,
which already handles fine this situation. Also avoids duplicating some
functionality.

The patch was originally done by Carlos Garnacho.

Signed-off-by: Emmanuele Bassi <ebassi@gnome.org>
---
 gtk/gtkfilechooserentry.c |  170 +++++++++++----------------------------------
 1 files changed, 42 insertions(+), 128 deletions(-)
Comment 9 Carlos Garnacho 2007-05-30 22:42:03 UTC
Doh! thanks Emmanuele for updating the patch :)
Comment 10 Carlos Garnacho 2008-02-11 10:07:08 UTC
*** Bug 515679 has been marked as a duplicate of this bug. ***
Comment 11 Reinout van Schouwen 2008-02-13 00:26:26 UTC
Emmanuele, Carlos: any progress on this?
Comment 12 Matthias Clasen 2008-09-07 05:10:49 UTC
Is this still relevant, after Federicos completion rework ?
Comment 13 Timothy Arceri 2013-05-31 02:27:21 UTC
Possible obsolete bug???
Comment 14 Federico Mena Quintero 2016-03-10 21:49:58 UTC
Obsolete!