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 332078 - Search button should be a toggle button
Search button should be a toggle button
Status: RESOLVED FIXED
Product: nautilus
Classification: Core
Component: File Search Interface
2.13.x
Other All
: Normal minor
: ---
Assigned To: Nautilus Maintainers
Nautilus Maintainers
: 575347 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2006-02-21 20:00 UTC by Dennis Laumen
Modified: 2009-11-25 09:34 UTC
See Also:
GNOME target: ---
GNOME version: 2.15/2.16


Attachments
Patch to hide the search bar (if it is shown) when you click on the search button. (2.65 KB, patch)
2006-04-27 21:55 UTC, Mattias Larsson
none Details | Review
Remove the search bar (23.01 KB, patch)
2006-08-30 08:15 UTC, Stephen Cook
none Details | Review
fix search patch bugs both must be applied! (3.52 KB, patch)
2006-08-31 05:49 UTC, Stephen Cook
none Details | Review
Working Patch On Current GIT (4.47 KB, patch)
2009-06-20 14:49 UTC, Jean-Louis Dupond
reviewed Details | Review
Adjusted patch (4.88 KB, patch)
2009-06-23 15:26 UTC, Jean-Louis Dupond
none Details | Review
Small Change to tooltip text (4.87 KB, patch)
2009-07-01 16:34 UTC, Jean-Louis Dupond
needs-work Details | Review
Improved version (6.94 KB, patch)
2009-08-08 14:19 UTC, Nikos Verschore
none Details | Review
improved version^2 (9.07 KB, patch)
2009-09-01 22:29 UTC, Nikos Verschore
none Details | Review
patch ^3 (8.55 KB, patch)
2009-09-04 22:13 UTC, Nikos Verschore
none Details | Review
patch ^4 (9.34 KB, patch)
2009-09-21 19:41 UTC, Nikos Verschore
none Details | Review
patch^5 removed "Go" button (8.68 KB, patch)
2009-10-13 11:27 UTC, Nikos Verschore
needs-work Details | Review
fix ctrl-l and code style (9.66 KB, patch)
2009-11-24 15:41 UTC, Nikos Verschore
none Details | Review

Description Dennis Laumen 2006-02-21 20:00:26 UTC
Make the Search button a toggle button (which lets the search bar appear and
disappear) and put a confirm button next to the textbox to execute the search.

Other information:
Comment 1 Dennis Laumen 2006-02-21 20:04:05 UTC
The Search button in Nautilus works a little clumsy. When clicked it shows a textbox but this textbox is not hideable with mouse input. It is with the [ESC] button however but this is probably a little difficult for unexperienced users.

It would improve usability as well if the textbox featured a button which would execute the search query (it only executes on [ENTER])
Comment 2 Mattias Larsson 2006-04-27 21:55:18 UTC
Created attachment 64425 [details] [review]
Patch to hide the search bar (if it is shown) when you click on the search button.

This is my first patch so rewiev it carefully. It works on my computer anyway. It would be nice if the search button was a toggle button, but I didn't manage to change that.
Comment 3 Stephen Cook 2006-08-30 08:15:16 UTC
Created attachment 71889 [details] [review]
Remove the search bar

This patch removes the ghastly search bar.  I was going to just convert Mattias's patch to a toggle button.  This was until I saw that the spatial nautilus window implemented search really really well.  So I just imported it to the navigation view and removed redundant code.  This patch also lowers the time of the beagle search timeout.  If the commiter does not want this then just exclude it :) but I thought it improves interactivity with no bad side effects.
Comment 4 Stephen Cook 2006-08-30 09:05:03 UTC
Thinking a little more about my patch, because you can search more locations than just your home dir (if not using beagle), you want to see the current directory before you push go or enter a search term.  This will make the user more aware of where they are going to search, but due to nautilus currently having major problems with the search my patch is still worth merging for 2.17 (if it doesn't break anything).

This bug is related to #340719 where I will try and implement multiple search options in a user friendly way.
Comment 5 Stephen Cook 2006-08-31 05:49:26 UTC
Created attachment 71948 [details] [review]
fix search patch bugs both must be applied!

this patch fixes some bugs.  Make sure you apply the first one then this one!
Comment 6 Jean-Philippe Fleury 2008-12-03 21:02:44 UTC
(In reply to comment #1)
> The Search button in Nautilus works a little clumsy. When clicked it shows a
> textbox but this textbox is not hideable with mouse input. It is with the [ESC]
> button however but this is probably a little difficult for unexperienced users.

I agree. I didn't even knew that I was possible to close the search box with ESC. I think that we should be able to click again on the Search button to close it.
Comment 7 Jean-Louis Dupond 2009-06-20 14:49:12 UTC
Created attachment 137067 [details] [review]
Working Patch On Current GIT

This patch fixes the Bug ! Its made on the current GIT (20/06/2009)
Comment 8 A. Walton 2009-06-20 18:37:00 UTC
Stephen's patch outright removed the search feature from the browser window, and there's no way we can tolerate that kind of regression, so that's out.

For your patch Jean-Louis - Everything looks alright except for a few trivial formatting issues, but my main concern is that it's no more obvious now that it toggles than it was before when it was a single click action. The least we could do is mention it in the tooltip text, like we have with the toggle pathbar/location entry.
Comment 9 A. Walton 2009-06-22 14:05:03 UTC
What I meant by my last comment: If you hover over most of the buttons in our toolbar, you can get a good feel for the kind of action that the buttons have. The word "Toggle" or the phrase "Change the visibility" in the tooltip is a clue.

Also the state of the button breaks if someone clicks the location bar after having clicked the search button, and there's a missing GTK_TOGGLE_ACTION cast in nautilus-navigation-window.c.
Comment 10 Jean-Louis Dupond 2009-06-23 15:26:11 UTC
Created attachment 137258 [details] [review]
Adjusted patch

This patch replaces the old patch. It has the changes A. Walton requested!
Comment 11 Jean-Louis Dupond 2009-06-23 15:28:41 UTC
Comment on attachment 137258 [details] [review]
Adjusted patch

>diff --git a/src/nautilus-navigation-window-menus.c b/src/nautilus-navigation-window-menus.c
>index 774a778..4459bd8 100644
>--- a/src/nautilus-navigation-window-menus.c
>+++ b/src/nautilus-navigation-window-menus.c
>@@ -716,14 +716,18 @@ action_go_to_location_callback (GtkAction *action,
> }			   
> 
> static void
>-action_search_callback (GtkAction *action,
>-			gpointer user_data)
>+action_show_hide_search_callback (GtkAction *action,
>+			          gpointer user_data)
> {
> 	NautilusNavigationWindow *window;
> 
> 	window = NAUTILUS_NAVIGATION_WINDOW (user_data);
> 
>-	nautilus_navigation_window_show_search (window);
>+	if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action))) {
>+		nautilus_navigation_window_show_search (window);
>+	} else {
>+		nautilus_navigation_window_hide_search (window);
>+	}
> }
> 
> static void
>@@ -794,9 +798,6 @@ static const GtkActionEntry navigation_entries[] = {
>   /* name, stock id, label */  { "Edit Bookmarks", NULL, N_("_Edit Bookmarks..."),
>                                  "<control>b", N_("Display a window that allows editing the bookmarks in this menu"),
>                                  G_CALLBACK (action_edit_bookmarks_callback) },
>-  /* name, stock id, label */  { "Search", "gtk-find", N_("_Search for Files..."),
>-                                 "<control>F", N_("Locate documents and folders on this computer by name or content"),
>-                                 G_CALLBACK (action_search_callback) },
> 
> 	{ "TabsPrevious", NULL, N_("_Previous Tab"), "<control>Page_Up",
> 	  N_("Activate previous tab"),
>@@ -833,7 +834,12 @@ static const GtkToggleActionEntry navigation_toggle_entries[] = {
>   /* label, accelerator */   N_("St_atusbar"), NULL,
>   /* tooltip */              N_("Change the visibility of this window's statusbar"),
>                              G_CALLBACK (action_show_hide_statusbar_callback),
>-  /* is_active */            TRUE }, 
>+  /* is_active */            TRUE },
>+  /* name, stock id */     { "Search", "gtk-find",
>+  /* label, accelerator */   N_("_Search for Files..."), "<control>F", 
>+  /* tooltip */              N_("Toggle the Search Bar to locate documents and folders on this computer by name or content"),
>+                             G_CALLBACK (action_show_hide_search_callback),
>+  /* is_active */            FALSE }, 
> };
> 
> void 
>diff --git a/src/nautilus-navigation-window.c b/src/nautilus-navigation-window.c
>index f698dfc..a0c8bef 100644
>--- a/src/nautilus-navigation-window.c
>+++ b/src/nautilus-navigation-window.c
>@@ -753,6 +753,7 @@ hide_temporary_bars (NautilusNavigationWindow *window)
> 		} else {
> 			nautilus_navigation_window_set_bar_mode (window, NAUTILUS_BAR_NAVIGATION);
> 		}
>+		nautilus_navigation_window_set_search_button (window, FALSE);
> 		window->details->temporary_search_bar = FALSE;
> 		success = TRUE;
> 	}
>@@ -1521,9 +1522,28 @@ nautilus_navigation_window_show_search (NautilusNavigationWindow *window)
> 		nautilus_navigation_window_set_bar_mode (window, NAUTILUS_BAR_SEARCH);
> 		window->details->temporary_search_bar = TRUE;
> 		nautilus_search_bar_clear (NAUTILUS_SEARCH_BAR (window->search_bar));
>+		nautilus_search_bar_grab_focus (NAUTILUS_SEARCH_BAR (window->search_bar));	
> 	}
>-	
>-	nautilus_search_bar_grab_focus (NAUTILUS_SEARCH_BAR (window->search_bar));
>+}
>+
>+void
>+nautilus_navigation_window_hide_search (NautilusNavigationWindow *window)
>+{
>+	if (nautilus_navigation_window_search_bar_showing (window)) {
>+		if (hide_temporary_bars (window)) {
>+                	restore_focus_widget (window);
>+        	}
>+	}
>+}
>+
>+void
>+nautilus_navigation_window_set_search_button (NautilusNavigationWindow *window,
>+					      gboolean state)
>+{
>+	GtkAction *action;	
>+
>+	action = gtk_action_group_get_action (window->details->navigation_action_group, "Search");
>+      gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), state);
> }
> 
> /* either called due to slot change, or due to location change in the current slot. */
>@@ -1745,6 +1765,7 @@ nautilus_navigation_window_set_bar_mode (NautilusNavigationWindow *window,
> 		g_signal_handlers_unblock_by_func (window->details->location_button,
> 						   G_CALLBACK (location_button_toggled_cb),
> 						   window);
>+		nautilus_navigation_window_set_search_button (window, FALSE);
> 	}
> }
> 
>diff --git a/src/nautilus-navigation-window.h b/src/nautilus-navigation-window.h
>index e34a978..df86f01 100644
>--- a/src/nautilus-navigation-window.h
>+++ b/src/nautilus-navigation-window.h
>@@ -120,5 +120,8 @@ void     nautilus_navigation_window_back_or_forward      (NautilusNavigationWind
>                                                           guint                     distance,
> 							  gboolean                  new_tab);
> void     nautilus_navigation_window_show_search          (NautilusNavigationWindow *window);
>+void     nautilus_navigation_window_hide_search          (NautilusNavigationWindow *window);
>+void     nautilus_navigation_window_set_search_button	 (NautilusNavigationWindow *window,
>+							  gboolean		    state);
> 
> #endif
Comment 12 Jean-Louis Dupond 2009-07-01 16:34:26 UTC
Created attachment 137700 [details] [review]
Small Change to tooltip text

Changed the tooltip text to only search files by name. Because it doesn't search in the context of the files like told in the old tooltip text
Comment 13 David Siegel 2009-07-01 22:58:14 UTC
1. The fact that the button toggles a toolbar to allow search is of little or no importance to the user, who merely is trying to find his/her file.
2. The fact that the files are "on this computer" does not need to be made explicit.
3. If in fact the search is not content-based, do not say that it is.

I suggest changing:

  "Toggle the Search Bar to locate documents and folders on this computer by name or content"

to:

  "Locate documents and folders by name"
Comment 14 Cosimo Cecchi 2009-07-08 12:02:11 UTC
Apart from David's suggestion on the action's tooltip, the patch doesn't actually work properly in all cases:
- click on the search button
- actually search for something
- click again on the button, the search window should close and go back to the previous navigation window.
- nothing happens instead.
Comment 15 Nikos Verschore 2009-08-08 14:19:01 UTC
Created attachment 140201 [details] [review]
Improved version

Patch contain Jean-Louis Dupond changes and some additional changes:
- fixes the scenario Cosimo Cecchi described. When you toggle search off, nautilus will show the contents of the directory you were searching in.
- I agree with David Siegel about the tooltip. The user will notice it is a toggle when hitting it.
- When the search bar is showing, the toggle between button and text-based location bar is hidden. That button is not necessary in search-mode.
Comment 16 Alexander Kojevnikov 2009-08-19 01:45:35 UTC
*** Bug 575347 has been marked as a duplicate of this bug. ***
Comment 17 Nikos Verschore 2009-08-20 19:50:00 UTC
Can someone please review my patch?
Comment 18 Nikos Verschore 2009-09-01 22:29:38 UTC
Created attachment 142283 [details] [review]
improved version^2

jango noticed a small glitch when toggling between search mode and navigation mode. The navigation bar would become 2px smaller in search mode. This patch solves this.

downstream comment from jango:
https://bugs.launchpad.net/ubuntu/+source/nautilus/+bug/57210/comments/11
Comment 19 Nikos Verschore 2009-09-04 22:13:23 UTC
Created attachment 142509 [details] [review]
patch ^3

This fixes the wrong behavior when you untoggle the search button when you removed the search location. It now will go to your home directory.

downstream comment from jango:
https://bugs.launchpad.net/ubuntu/+source/nautilus/+bug/57210/comments/19
Sorry, i found something else: If you already do a search, and you remove the criterion for the location, you can't toggle back to the navigation window! Clicking on the button does nothing!
Comment 20 Nikos Verschore 2009-09-21 19:41:13 UTC
Created attachment 143633 [details] [review]
patch ^4

Added Go-button
Comment 21 Stefan Hammer 2009-09-22 10:37:36 UTC
The go-button is a great thing, but... :)

*)if you already did a search, and you change the search item and click onto the go-button nothing happens. (pressing enter or clicking reload searches for the new word) This should also be done with the go-button

*)if you clicked the button the first time, the criterion-bar appears with the reload button. Then the go-button is dead and without function. 
Should he do the same thing as the reload button?

Is it necessary to have two buttons?

We can unite the two buttons in one?
For excample: After pressing Go the first time, the search results appear and the button becomes a reload button.
The upper half of the criterion bar would be unnecessary then, because we can move the "add a new criterion"-button into the second line (on the far right) and can make the line with the "Search results"-text a lot smaller. This would also save screen space on netbooks ;-)
Picture, how it can look like:
http://launchpadlibrarian.net/32250950/mocup_search.jpg
Comment 22 Alexander Larsson 2009-10-07 09:16:19 UTC
Nicer than the go button would be an in-entry button, like in this comment (wrt the location entry):
https://bugzilla.gnome.org/show_bug.cgi?id=163245#c9

It would only be visible when the entry has been edited (i.e. is not the same as an in-window active/done search).
Comment 23 Nikos Verschore 2009-10-13 11:27:53 UTC
Created attachment 145343 [details] [review]
patch^5 removed "Go" button

I've removed the search "Go" button, because it isn't part of the "search should be a toggle button". I made a new bug report for the "Go" button. https://bugzilla.gnome.org/show_bug.cgi?id=598256

The patch for the toggle button is done, so please review and test ;)
Comment 24 Alexander Larsson 2009-11-17 11:59:04 UTC
Review of attachment 145343 [details] [review]:

Seems nice overall. However, I don't like the new behaviour when you press ctlr-l while searching. 
It used to let you enter the new location before switching out of search mode, now it just switches
before letting you enter anything.

Also, with this change we lose the keyboard shortcut ctrl-f to regrab the search entry. 
Maybe we should add some replacement, although I'm not sure what would work well...

::: src/nautilus-navigation-window-menus.c
@@ +732,3 @@
+		slot = NAUTILUS_WINDOW (window)->details->active_slot;
+				
+		// Use the location bar as the return location

C++ comments, here and below

@@ +733,3 @@
+				
+		// Use the location bar as the return location
+		if (slot->query_editor == NULL){

Missing space before {

@@ +734,3 @@
+		// Use the location bar as the return location
+		if (slot->query_editor == NULL){
+			location = g_file_dup (nautilus_window_slot_get_location (slot));

No need to dup file, nautilus_window_slot_get_location() does that.

::: src/nautilus-navigation-window.c
@@ +1550,3 @@
+	GtkAction *action;	
+
+	action = gtk_action_group_get_action (window->details->navigation_action_group, "Search");

Weird indentation here

::: src/nautilus-query-editor.c
@@ +1158,3 @@
 	NautilusQueryEditorRow *row;
 
+	if ( editor == NULL || editor->details == NULL || editor->details->entry == NULL){

No space after (
Missing space before {
Comment 25 Nikos Verschore 2009-11-24 15:41:10 UTC
Created attachment 148398 [details] [review]
fix ctrl-l and code style

I've fixed the ctrl-l issue. So now you will get the temporary location bar when searching. Also the issues in style are fixed (c-commentary instead of c++ commentary,...)

About the ctrl-f: we can disable the toggle for ctrl-f. So if you press ctrl-f in the main screen, you get the search bar. If you press ctrl-f again, it will focus the search bar. (Something like firefox is doing). We leave everything else as toggle (so search button and search menu item stays toggle). If you only want to use your keyboard and want to leave the search mode, you can use the ctrl-l key.
Sounds good?
Comment 26 Stefan Hammer 2009-11-24 18:04:28 UTC
the behavior with ctrl-f sounds great.
But i think, that using Esc (like in firefox) would be better for leaving the search mode.
thanks Nikos for your really fast work!
Comment 27 Nikos Verschore 2009-11-24 22:25:04 UTC
thank you ;)

The Esc-binding would be nice, but I'm stuck with my proposal of the ctrl-f. I can't find a way to distinguish the callbacks of the menu-item and the accelerator. Anybody an idea for that?
Comment 28 Alexander Larsson 2009-11-25 09:34:08 UTC
Pushed this without the GO button.
I also added some code to not make ctrl-f be a toggle.