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 435343 - Fix search capabilities in GtkFileChooser
Fix search capabilities in GtkFileChooser
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: GtkFileChooser
unspecified
Other Linux
: Normal enhancement
: ---
Assigned To: gtk-bugs
Federico Mena Quintero
Depends on: 344785
Blocks: 435342
 
 
Reported: 2007-05-02 22:48 UTC by Emmanuele Bassi (:ebassi)
Modified: 2007-05-11 21:31 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Add key binding for the Search shortcut (4.21 KB, patch)
2007-05-07 19:21 UTC, Emmanuele Bassi (:ebassi)
none Details | Review
Retrieve informations on search hits (16.99 KB, patch)
2007-05-07 19:21 UTC, Emmanuele Bassi (:ebassi)
none Details | Review
Show the file type icon in the search results (1019 bytes, patch)
2007-05-07 19:22 UTC, Emmanuele Bassi (:ebassi)
none Details | Review
Follow search hits if they are folders (3.52 KB, patch)
2007-05-07 19:23 UTC, Emmanuele Bassi (:ebassi)
none Details | Review
Remember last search query (5.14 KB, patch)
2007-05-07 23:13 UTC, Emmanuele Bassi (:ebassi)
none Details | Review
Do not switch to filename entry when not in browse mode (1.63 KB, patch)
2007-05-08 20:44 UTC, Emmanuele Bassi (:ebassi)
none Details | Review

Description Emmanuele Bassi (:ebassi) 2007-05-02 22:48:21 UTC
as per comment #16 in bug #344785:

+++

Some issues with the patch:

* Filter dropdown does not affect Search mode (in gedit you care only about text
files, not about searchterm.jpg).

* Paths and filenames in the same row look horrible.

* No differentiation between files and folders; icons are not displayed.

* Double-clicking on a folder tries to open it as a filename.

* Can't add bookmarks for items in a search result.

* If I search and then go back to a place (like my home directory, or my
desktop), double-clicking on Search takes me back to a blank slate.  It would
be nice if it remembered my last query.

* No shortcut for Search.

* Search not shown in Firefox.

+++

this is an "umbrella" bug.
Comment 1 Emmanuele Bassi (:ebassi) 2007-05-07 19:21:05 UTC
Created attachment 87734 [details] [review]
Add key binding for the Search shortcut

Add "search-shortcut", an action signal bound to MOD1+S. It will activate
the Search shortcut item of the GtkFileChooserDefault widget.
---
 gtk/gtkfilechooserdefault.c |   43 +++++++++++++++++++++++++++++++++----------
 1 files changed, 33 insertions(+), 10 deletions(-)
Comment 2 Emmanuele Bassi (:ebassi) 2007-05-07 19:21:34 UTC
Created attachment 87735 [details] [review]
Retrieve informations on search hits

Use the GtkFileSystem API to retrieve meta-data on each search hit and
store the returned data into the search results GtkListStore.
---
 gtk/gtkfilechooserdefault.c |  298 ++++++++++++++++++++++++++++++-------------
 1 files changed, 207 insertions(+), 91 deletions(-)
Comment 3 Emmanuele Bassi (:ebassi) 2007-05-07 19:22:19 UTC
Created attachment 87736 [details] [review]
Show the file type icon in the search results

Use the newly added column containing the file icon pixbuf inside the
icon cell data function to show the icon of each search hit.
---
 gtk/gtkfilechooserdefault.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
Comment 4 Emmanuele Bassi (:ebassi) 2007-05-07 19:23:01 UTC
Created attachment 87737 [details] [review]
Follow search hits if they are folders

If a hit returned by the search query is a folder, follow it and return
the file chooser to browse mode, with the current directory changed to
the folder path.
---
 gtk/gtkfilechooserdefault.c |   67 ++++++++++++++++++++++++++++++-------------
 1 files changed, 47 insertions(+), 20 deletions(-)
Comment 5 Emmanuele Bassi (:ebassi) 2007-05-07 23:13:21 UTC
Created attachment 87757 [details] [review]
Remember last search query

Save the GtkQuery object when switching to browse mode, and free it only
when destroying the GtkFileChooserDefault widget or when the search query
changes.
---
 gtk/gtkfilechooserdefault.c |   58 +++++++++++++++++++++++++++++++++---------
 1 files changed, 45 insertions(+), 13 deletions(-)
Comment 6 Emmanuele Bassi (:ebassi) 2007-05-08 08:57:20 UTC
missing bits updated count:

* Filter dropdown does not affect Search mode (in gedit you care only about text files, not about searchterm.jpg).

* Paths and filenames in the same row look horrible.

* Can't add bookmarks for items in a search result.

* Search not shown in Firefox.

not sure about what to do for firefox (and everyone should use epiphany anyway).

saving a search query needs something more than the .gtk-bookmarks format, and even more so if we switch to GBookmarkFile to store the bookmarks, unless we switch to a custom URI like "search://query+terms+separated+by+plus", which wouldn't be bad per se.

the results can be shown by basename and the full path using a tooltip, now that we can.

I'll work on the filtering, which should also be useful for the recently used list view.
Comment 7 Emmanuele Bassi (:ebassi) 2007-05-08 20:44:29 UTC
Created attachment 87838 [details] [review]
Do not switch to filename entry when not in browse mode

The location entry is not shown in the OPERATION_MODE_SEARCH mode of the
file chooser widget, so do not switch to it when in that mode. This fixes
the sudden appearance of the location entry when unmapping and mapping
the file choose in non-browse mode.
---
 gtk/gtkfilechooserdefault.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
Comment 8 Emmanuele Bassi (:ebassi) 2007-05-08 20:46:27 UTC
this last patch might not apply cleanly, as I did a couple of whitespace/indentation only local commits before that. anyway, after applying all these patches you should have the basic search functionality ready for merging the recent-files support in bug #435342.
Comment 9 Emmanuele Bassi (:ebassi) 2007-05-11 19:49:09 UTC
I've committed the complete patchset of bug #435342. the patches address the remaining bits: working filters, bookmarks and UI of the results. 
Comment 10 Federico Mena Quintero 2007-05-11 21:31:23 UTC
With the obligatory beer-per-patch, Emmanuele is going to get quite drunk during the next GUADEC :)