GNOME Bugzilla – Bug 82902
Support for searching
Last modified: 2004-12-22 21:47:04 UTC
Hi, the next patch add support for searching in gconf-editor. Currently it has implementes only search in the tree, but will be easy to add search in key names and key values (already in the gui stuff).
Ups. I forget the patch. Here is it, with suppor for searching in tree, key names and values. I think gtk2 treeview search feature is not as flexible as gconf-editro need, and so this implementation,
Created attachment 9218 [details] [review] Patch for searching
After bug #85778 discussion, search for unexpanded trees is not a good feature for gtk2 widget. But I'm still thinking that search in gconf-editor is extremadly useful. So we have two approach: a) Add a menuitem/button to expand the whole tree and use the gtk_tree search b) Implement search inside gconf-editor for unexpanded trees.
That patch no longer applies :( It'd be really great to get searching in
hummm, I supose that gconf-editor has changed a lot... if useful, I'll update the patch against cvs HEAD
Well the bug you linked to above will not get fixed, so if the patch can be updated and it works well i'd like to push to get it committed. May be impossible because of freezage though
Created attachment 12794 [details] [review] Patch updated to current CVS.
I've have updated the patch. But it should need review, and the tree_view scroll is not working properly, any gtk_tree_view guru?
The search seems to work very well - but the dialog isn't very hig. Maybe looking at the gedit find dialog or something like that might be of help.
Ok. I have updated the dialog to look like the gedit one. BTW, gtk_tree_view_scroll stuff is not working properly, and I would like someone to review it, because is a bit old. Another issue... does we want case insensitve search in gconf-editor?
Created attachment 12841 [details] [review] Patch updated to follow the HIG
*** Bug 100465 has been marked as a duplicate of this bug. ***
Fernando: as soon as 2.4 development starts, pester Anders to get this patch in.
*** Bug 105162 has been marked as a duplicate of this bug. ***
My fifteen minute mini-review of Fernando's work: You should always code with all error reporting turned on in your compiler. You've got missing declarations in header files, unused values and pointer abuse. Similiarly you should follow the whitespace and indentation style in gconf-editor and GNOME in general. Also that Node struct looks really out of place. On to more concrete things. Specifically having to search for a key, value or "tree" is bothersome, usually you just want to find something, anything, and you shouldn't have to do multiple searches to get it. Instead of radiobuttons you should go with checkbuttons for Keys and Values. "Tree" (nodes, I assume) is not something typical of GConf's terminology, the only distinction is if the key has subkeys or a value attached to it, something I seriously doubt anyone cares about. So get rid of "tree" as a search option, key and values is enough. It still doesn't follow the HIG. Having the menu option "Search" attached to the accelerator Control-F should tip you off ;) To follow the HIG the Search item should be removed from the "Edit" menu, a new "Search" menu should be created with the items Find and Find Next. I also found untranslated strings, "Pattern not found" springs to mind. It's also no good as an error message, take a look at how gedit does it. Also you shouldn't present an error (information is probably the correct one) dialog when the search fails, again, look at gedit. Well, that's just some things of the top of my mind. I'm interested in this issue so I might fix these problems myself, if you don't beat me to it :)
Thank you very much for your review Tomas. It was my first serious GNOME coding, it was only I try. Feel free to hack on it (or rewrite it :). I coded it as a proof of concept. I don't have time at this very moment (after one month of holydays, I need to do lot of university and Onirica work!).
*** Bug 140007 has been marked as a duplicate of this bug. ***
Created attachment 26651 [details] [review] Patch from Sujay SA and Varadharaj KP
Some comments on your patch: + window->find_combo_items->data=NULL; If you look at the GNOME source code, we usually do var = value; (spaces between "=") and my_cool_function (parameter1, parameter2); (more spaces :) Please, follow the coding style for the next patches There are also some comments on the implementation, but the most importants are over the functionality: * It only looks for dirnames, it should look also for key names and key values. * It also should look for partial matches (look at gedit, it defaults look for partial matches and add a checkbox to search exact words). so it needs more work, but you are on the right way! Good work. Please, feel free to ask/comment anything!
Created attachment 26660 [details] [review] Modified patch of patch #26651 This patch also takes care of partial matches. As of now we think it may not be useful to search key names and key values because, the key names keep repeating in most of the directories. So, it is effective to go through the directory name for searching.
Some key names keep repeating, yes. But it's still a very useful feature for other, less common key names. The same is true for values. Thanks anyway for doing something about this bug, it's a really important one IMHO.
Created attachment 27259 [details] [review] This is the reworked patch of #26660, the searching now takes care of keynames and values also This patch, includes searching based on keynames, and keyvalues. Also, partial matches can also be found on any of these - directory name, keyname or keyvalue. Neccessary option buttons are given to search the required item easily.
Comment on attachment 27259 [details] [review] This is the reworked patch of #26660, the searching now takes care of keynames and values also Some comments after apliying it: * The find box is resized after it is showed. * As a comment said before, maybe making Directories and key names a separate option is not clear, because a directory is a part of the key so it should matched when looking for keys. * Looking for values is segfaulting right now (I'll try to look at the code later) * Searching and the repositioning the cursor is not working properly * the go_to is also not working correctly (yep, I also love-hate GtkTreeView) * You are searching in gconf data directly instead of the liststore, and just now some additions/mofitications to the database are not correctly showed in the tree view, so a search could find a result not presented in the tree view (just now if a dir addition occurs where the parent is expanded, it is not realized). But I'm working on fixing this so the liststore should be equal to the gconf dir always.
The segmentation fault that occur while searching a key value was because of the insufficient memory when an exhaustive search is made. This can be overcome by searching a part of the tree and continuing further to find a desired key. For example /apps, /desktop, /system. by doing this the searching becomes faster and also the memory required for searching is also minimized. Searching and repositiong of the cursor is working properly, if not the fault may be in the gtk_tree. The corrections will be made and soon will be put up as a patch.
Created attachment 27605 [details] [review] reworked patch of #27259 Search for key name and key value do not cause segmantation fault now. Now key names and key values can be searched under a selected directory recursively by selecting a directory in the tree. Search for a key value under the directory "/schemas" has been skipped because no key values are found in it. Repositioning of the cursor in the tree view works fine after searching.
I've redone the search stuff, with a new fancy window showing results. Thank you very much to all of you working on this!!!