GNOME Bugzilla – Bug 435343
Fix search capabilities in GtkFileChooser
Last modified: 2007-05-11 21:31:23 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.
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(-)
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(-)
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(-)
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(-)
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(-)
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.
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(-)
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.
I've committed the complete patchset of bug #435342. the patches address the remaining bits: working filters, bookmarks and UI of the results.
With the obligatory beer-per-patch, Emmanuele is going to get quite drunk during the next GUADEC :)