summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Sullivan <sullivan@src.gnome.org>2001-03-27 20:31:28 +0000
committerJohn Sullivan <sullivan@src.gnome.org>2001-03-27 20:31:28 +0000
commitbc5a63eb6e589437c44f6ace18585edf6be4d850 (patch)
tree608b4fd28e375bf9e6fd9b5c575b3dacd4f95b9e /src
parentbffd9f61a95df994c091a89b22108f973f39d8bb (diff)
downloadnautilus-bc5a63eb6e589437c44f6ace18585edf6be4d850.tar.gz
reviewed by: Maciej Stachowiak <mjs@eazel.com>
Fixed bug 2328 (No way to go to a specific URI if location bar is hidden) Fixed by adding a new item "Location ..." to the Go menu, with control-L as keyboard shortcut. ("Create Link", formerly control-L, is now "Make Link", control-M.) Choosing "Location ..." makes the location bar visible if necessary and selects the location text field's contents so you can start typing to replace it. If the location bar had been hidden, it will hide itself again when you hit Return. At the same time, made the "Find" menu item (control-F) always show the Find controls and move the focus there, instead of toggling between Find & Browse. The Find toolbar button remains a toggle button. Fixed bug 3590 (Remove workaround for Bonobo design flaw) Fixed bug 7303 (Conflicts on menu item underline accelerators) Fixed these incidentally when working on 2328. * src/file-manager/fm-directory-view.c: (real_update_menus): * src/file-manager/nautilus-directory-view-ui.xml: Changed Create Link(s) to Make Link(s), and changed its accelerator to Control-M. * src/nautilus-location-bar.c: (real_activate): select all text when activating (used to just grab focus) (nautilus_location_bar_initialize): Changed definition of entry to be a NautilusEntry. * src/nautilus-shell-ui.xml: added "Location ..." item in Go menu; renamed some commands and items for clarity; moved a couple of accelerators into verbs. * src/nautilus-switchable-navigation-bar.h: * src/nautilus-switchable-navigation-bar.c: (nautilus_switchable_navigation_bar_activate), (nautilus_switchable_navigation_bar_set_mode): Broke _activate out of _set_mode and made it public; tweaked _set_mode a little. * src/nautilus-window-private.h: Added temporary_navigation_bar boolean to details struct. * src/nautilus-window-menus.c: (nautilus_window_show_location_bar_temporarily): New function, shows location bar and sets the flag to hide it after it signals for a location change. (file_menu_find_callback): New function, switches to find mode, showing location bar temporarily if necessary. (toolbar_toggle_find_mode_callback): renamed from file_menu_xxx now that it's only used by the toolbar, toggles Find mode, showing location bar temporarily if necessary. (go_menu_location_callback): New function, switches to browse mode, showing location bar temporarily if necessary. (nautilus_window_initialize_menus_part_1): futz with verbs for these menu items. (nautilus_window_update_find_menu_item): Remove this call since the menu item is no longer dynamic. (nautilus_window_remove_go_menu_items): Remove call to nautilus_window_update_find_menu_item. * src/nautilus-window.c: (go_to_callback): Cleaned up style a little. (navigation_bar_location_changed_callback): New function, called when location bar says "hey, here's a new location for you". Hides the location bar if it was temporarily showing. (navigation_bar_mode_changed_callback): Remove call to nautilus_window_update_find_item. (nautilus_window_constructed): Wire up navigation_bar_location_changed_callback. (nautilus_window_hide_location_bar): Clear the temporary_navigation_bar flag. * components/text/nautilus-text-view-ui.xml: Change _Fonts to F_onts to avoid conflict with _File.
Diffstat (limited to 'src')
-rw-r--r--src/file-manager/fm-directory-view.c4
-rw-r--r--src/file-manager/nautilus-directory-view-ui.xml6
-rw-r--r--src/nautilus-location-bar.c9
-rw-r--r--src/nautilus-navigation-window-menus.c89
-rw-r--r--src/nautilus-navigation-window.c39
-rw-r--r--src/nautilus-object-window.c39
-rw-r--r--src/nautilus-shell-ui.xml17
-rw-r--r--src/nautilus-spatial-window.c39
-rw-r--r--src/nautilus-switchable-navigation-bar.c39
-rw-r--r--src/nautilus-switchable-navigation-bar.h2
-rw-r--r--src/nautilus-window-menus.c89
-rw-r--r--src/nautilus-window-private.h3
-rw-r--r--src/nautilus-window.c39
13 files changed, 258 insertions, 156 deletions
diff --git a/src/file-manager/fm-directory-view.c b/src/file-manager/fm-directory-view.c
index 1a362e44f..5bfb4c3ff 100644
--- a/src/file-manager/fm-directory-view.c
+++ b/src/file-manager/fm-directory-view.c
@@ -4107,8 +4107,8 @@ real_update_menus (FMDirectoryView *view)
FM_DIRECTORY_VIEW_MENU_PATH_CREATE_LINK,
FM_DIRECTORY_VIEW_COMMAND_CREATE_LINK,
selection_count > 1
- ? _("Create _Links")
- : _("Create _Link"));
+ ? _("Make _Links")
+ : _("Make _Link"));
nautilus_bonobo_set_sensitive (view->details->ui,
FM_DIRECTORY_VIEW_COMMAND_CREATE_LINK,
can_create_files
diff --git a/src/file-manager/nautilus-directory-view-ui.xml b/src/file-manager/nautilus-directory-view-ui.xml
index 4d5a101ea..b5adb98bb 100644
--- a/src/file-manager/nautilus-directory-view-ui.xml
+++ b/src/file-manager/nautilus-directory-view-ui.xml
@@ -1,7 +1,7 @@
<Root>
<commands>
<cmd name="Create Link"
- _label="Create Link"
+ _label="Make Link"
_tip="Create a symbolic link for each selected item"/>
<cmd name="Delete"
_label="Delete"
@@ -117,8 +117,8 @@
accel="*Control*d"
verb="Duplicate"/>
<menuitem name="Create Link"
- _label="Create _Link"
- accel="*Control*l"
+ _label="Make _Link"
+ accel="*Control*m"
verb="Create Link"/>
</placeholder>
diff --git a/src/nautilus-location-bar.c b/src/nautilus-location-bar.c
index 05ee9584c..9ebf51859 100644
--- a/src/nautilus-location-bar.c
+++ b/src/nautilus-location-bar.c
@@ -66,7 +66,7 @@ static const char untranslated_go_to_label[] = N_("Go To:");
struct NautilusLocationBarDetails {
GtkLabel *label;
- GtkEntry *entry;
+ NautilusEntry *entry;
char *last_location;
@@ -566,8 +566,11 @@ real_activate (NautilusNavigationBar *navigation_bar)
bar = NAUTILUS_LOCATION_BAR (navigation_bar);
- /* Put the keyboard focus in the text field when switching to this mode */
+ /* Put the keyboard focus in the text field when switching to this mode,
+ * and select all text for easy overtyping
+ */
gtk_widget_grab_focus (GTK_WIDGET (bar->details->entry));
+ nautilus_entry_select_all (bar->details->entry);
}
static void
@@ -676,7 +679,7 @@ nautilus_location_bar_initialize (NautilusLocationBar *bar)
gtk_widget_show_all (hbox);
bar->details->label = GTK_LABEL (label);
- bar->details->entry = GTK_ENTRY (entry);
+ bar->details->entry = NAUTILUS_ENTRY (entry);
}
diff --git a/src/nautilus-navigation-window-menus.c b/src/nautilus-navigation-window-menus.c
index 0bc96ee9d..56e8a5651 100644
--- a/src/nautilus-navigation-window-menus.c
+++ b/src/nautilus-navigation-window-menus.c
@@ -34,6 +34,7 @@
#include "nautilus-bookmarks-window.h"
#include "nautilus-property-browser.h"
#include "nautilus-signaller.h"
+#include "nautilus-switchable-navigation-bar.h"
#include "nautilus-theme-selector.h"
#include "nautilus-window-manage-views.h"
#include "nautilus-window-private.h"
@@ -72,8 +73,6 @@
* don't want other code relying on their existence.
*/
-#define MENU_PATH_TOGGLE_FIND_MODE "/menu/File/Toggle Find Mode"
-
#define MENU_PATH_SHOW_HIDE_SIDEBAR "/menu/View/Show Hide Placeholder/Show Hide Sidebar"
#define MENU_PATH_SHOW_HIDE_TOOLBAR "/menu/View/Show Hide Placeholder/Show Hide Toolbar"
#define MENU_PATH_SHOW_HIDE_LOCATION_BAR "/menu/View/Show Hide Placeholder/Show Hide Location Bar"
@@ -213,7 +212,36 @@ file_menu_close_all_windows_callback (BonoboUIComponent *component,
}
static void
-file_menu_toggle_find_mode_callback (BonoboUIComponent *component,
+nautilus_window_show_location_bar_temporarily (NautilusWindow *window,
+ gboolean in_search_mode)
+{
+ if (!nautilus_window_location_bar_showing (window)) {
+ nautilus_window_show_location_bar (window);
+ window->details->temporary_navigation_bar = TRUE;
+ }
+ nautilus_window_set_search_mode
+ (window, in_search_mode);
+ nautilus_switchable_navigation_bar_activate
+ (NAUTILUS_SWITCHABLE_NAVIGATION_BAR (window->navigation_bar));
+}
+
+static void
+file_menu_find_callback (BonoboUIComponent *component,
+ gpointer user_data,
+ const char *verb)
+{
+ NautilusWindow *window;
+
+ window = NAUTILUS_WINDOW (user_data);
+
+ if (!window->details->updating_bonobo_state) {
+ nautilus_window_show_location_bar_temporarily
+ (window, TRUE);
+ }
+}
+
+static void
+toolbar_toggle_find_mode_callback (BonoboUIComponent *component,
gpointer user_data,
const char *verb)
{
@@ -222,16 +250,27 @@ file_menu_toggle_find_mode_callback (BonoboUIComponent *component,
window = NAUTILUS_WINDOW (user_data);
if (!window->details->updating_bonobo_state) {
- /* Show location bar if it's hidden */
- if (!nautilus_window_location_bar_showing (window)) {
- nautilus_window_show_location_bar (window);
- }
- nautilus_window_set_search_mode
+ nautilus_window_show_location_bar_temporarily
(window, !nautilus_window_get_search_mode (window));
}
}
static void
+go_menu_location_callback (BonoboUIComponent *component,
+ gpointer user_data,
+ const char *verb)
+{
+ NautilusWindow *window;
+
+ window = NAUTILUS_WINDOW (user_data);
+
+ if (!window->details->updating_bonobo_state) {
+ nautilus_window_show_location_bar_temporarily
+ (window, FALSE);
+ }
+}
+
+static void
file_menu_web_search_callback (BonoboUIComponent *component,
gpointer user_data,
const char *verb)
@@ -1182,13 +1221,8 @@ nautilus_window_initialize_menus_part_1 (NautilusWindow *window)
BONOBO_UI_VERB ("New Window", file_menu_new_window_callback),
BONOBO_UI_VERB ("Close", file_menu_close_window_callback),
BONOBO_UI_VERB ("Close All Windows", file_menu_close_all_windows_callback),
- BONOBO_UI_VERB ("Toggle Find Mode", file_menu_toggle_find_mode_callback),
- /* FIXME: bugzilla.eazel.com 3590:
- * Note that we use a different verb for the toolbar button since
- * the toolbar button has state but the menu item doesn't. This would
- * otherwise confuse Bonobo.
- */
- BONOBO_UI_VERB ("Toggle Find Mode With State", file_menu_toggle_find_mode_callback),
+ BONOBO_UI_VERB ("Find", file_menu_find_callback),
+ BONOBO_UI_VERB ("Toggle Find Mode", toolbar_toggle_find_mode_callback),
BONOBO_UI_VERB ("Go to Web Search", file_menu_web_search_callback),
BONOBO_UI_VERB ("Undo", edit_menu_undo_callback),
BONOBO_UI_VERB ("Customize", customize_callback),
@@ -1197,6 +1231,7 @@ nautilus_window_initialize_menus_part_1 (NautilusWindow *window)
BONOBO_UI_VERB ("Forward", go_menu_forward_callback),
BONOBO_UI_VERB ("Up", go_menu_up_callback),
BONOBO_UI_VERB ("Home", go_menu_home_callback),
+ BONOBO_UI_VERB ("Go to Location", go_menu_location_callback),
BONOBO_UI_VERB ("Forget History", go_menu_forget_history_callback),
BONOBO_UI_VERB ("Reload", view_menu_reload_callback),
BONOBO_UI_VERB ("Show Hide Sidebar", view_menu_show_hide_sidebar_callback),
@@ -1243,7 +1278,6 @@ nautilus_window_initialize_menus_part_1 (NautilusWindow *window)
bonobo_ui_component_add_verb_list_with_data (window->details->shell_ui, verbs, window);
- nautilus_window_update_find_menu_item (window);
nautilus_window_update_show_hide_menu_items (window);
add_user_level_menu_item (window, NAUTILUS_MENU_PATH_NOVICE_ITEM,
@@ -1317,29 +1351,6 @@ nautilus_window_remove_go_menu_items (NautilusWindow *window)
nautilus_window_ui_thaw (window);
}
-void
-nautilus_window_update_find_menu_item (NautilusWindow *window)
-{
- char *label_string;
-
- g_return_if_fail (NAUTILUS_IS_WINDOW (window));
-
- nautilus_window_ui_freeze (window);
-
- label_string = g_strdup
- (nautilus_window_get_search_mode (window)
- ? _("_Browse")
- : _("_Find"));
-
- nautilus_bonobo_set_label (window->details->shell_ui,
- MENU_PATH_TOGGLE_FIND_MODE,
- label_string);
- g_free (label_string);
-
- nautilus_window_ui_thaw (window);
-}
-
-
static void
append_dynamic_bookmarks (NautilusWindow *window)
{
diff --git a/src/nautilus-navigation-window.c b/src/nautilus-navigation-window.c
index 1e48b1de4..9ea784fe0 100644
--- a/src/nautilus-navigation-window.c
+++ b/src/nautilus-navigation-window.c
@@ -95,10 +95,7 @@
#define STATUS_BAR_PATH "/status"
#define MENU_BAR_PATH "/menu"
-/* FIXME: bugzilla.eazel.com 3590
- * This shouldn't need to exist. See bug report for details.
- */
-#define NAUTILUS_COMMAND_TOGGLE_FIND_MODE_WITH_STATE "/commands/Toggle Find Mode With State"
+#define NAUTILUS_COMMAND_TOGGLE_FIND_MODE "/commands/Toggle Find Mode"
enum {
ARG_0,
@@ -377,9 +374,28 @@ nautilus_window_get_location (NautilusWindow *window)
static void
go_to_callback (GtkWidget *widget,
const char *uri,
- GtkWidget *window)
+ NautilusWindow *window)
+{
+ g_assert (NAUTILUS_IS_WINDOW (window));
+
+ nautilus_window_go_to (window, uri);
+}
+
+static void
+navigation_bar_location_changed_callback (GtkWidget *widget,
+ const char *uri,
+ NautilusWindow *window)
{
- nautilus_window_go_to (NAUTILUS_WINDOW (window), uri);
+ g_assert (NAUTILUS_IS_WINDOW (window));
+
+ if (window->details->temporary_navigation_bar) {
+ if (nautilus_window_location_bar_showing (window)) {
+ nautilus_window_hide_location_bar (window);
+ }
+ window->details->temporary_navigation_bar = FALSE;
+ }
+
+ nautilus_window_go_to (window, uri);
}
static void
@@ -387,8 +403,6 @@ navigation_bar_mode_changed_callback (GtkWidget *widget,
NautilusSwitchableNavigationBarMode mode,
NautilusWindow *window)
{
- nautilus_window_update_find_menu_item (window);
-
window->details->updating_bonobo_state = TRUE;
g_assert (mode == NAUTILUS_SWITCHABLE_NAVIGATION_BAR_MODE_LOCATION
@@ -396,12 +410,8 @@ navigation_bar_mode_changed_callback (GtkWidget *widget,
nautilus_window_ui_freeze (window);
- /* FIXME: bugzilla.eazel.com 3590:
- * We shouldn't need a separate command for the toggle button and menu item.
- * This is a Bonobo design flaw, explained in the bug report.
- */
nautilus_bonobo_set_toggle_state (window->details->shell_ui,
- NAUTILUS_COMMAND_TOGGLE_FIND_MODE_WITH_STATE,
+ NAUTILUS_COMMAND_TOGGLE_FIND_MODE,
mode == NAUTILUS_SWITCHABLE_NAVIGATION_BAR_MODE_SEARCH);
window->details->updating_bonobo_state = FALSE;
@@ -660,7 +670,7 @@ nautilus_window_constructed (NautilusWindow *window)
gtk_widget_show (GTK_WIDGET (window->navigation_bar));
gtk_signal_connect (GTK_OBJECT (window->navigation_bar), "location_changed",
- go_to_callback, window);
+ navigation_bar_location_changed_callback, window);
gtk_signal_connect (GTK_OBJECT (window->navigation_bar), "mode_changed",
navigation_bar_mode_changed_callback, window);
@@ -1836,6 +1846,7 @@ dock_item_showing (NautilusWindow *window, const char *dock_item_path)
void
nautilus_window_hide_location_bar (NautilusWindow *window)
{
+ window->details->temporary_navigation_bar = FALSE;
hide_dock_item (window, LOCATION_BAR_PATH);
}
diff --git a/src/nautilus-object-window.c b/src/nautilus-object-window.c
index 1e48b1de4..9ea784fe0 100644
--- a/src/nautilus-object-window.c
+++ b/src/nautilus-object-window.c
@@ -95,10 +95,7 @@
#define STATUS_BAR_PATH "/status"
#define MENU_BAR_PATH "/menu"
-/* FIXME: bugzilla.eazel.com 3590
- * This shouldn't need to exist. See bug report for details.
- */
-#define NAUTILUS_COMMAND_TOGGLE_FIND_MODE_WITH_STATE "/commands/Toggle Find Mode With State"
+#define NAUTILUS_COMMAND_TOGGLE_FIND_MODE "/commands/Toggle Find Mode"
enum {
ARG_0,
@@ -377,9 +374,28 @@ nautilus_window_get_location (NautilusWindow *window)
static void
go_to_callback (GtkWidget *widget,
const char *uri,
- GtkWidget *window)
+ NautilusWindow *window)
+{
+ g_assert (NAUTILUS_IS_WINDOW (window));
+
+ nautilus_window_go_to (window, uri);
+}
+
+static void
+navigation_bar_location_changed_callback (GtkWidget *widget,
+ const char *uri,
+ NautilusWindow *window)
{
- nautilus_window_go_to (NAUTILUS_WINDOW (window), uri);
+ g_assert (NAUTILUS_IS_WINDOW (window));
+
+ if (window->details->temporary_navigation_bar) {
+ if (nautilus_window_location_bar_showing (window)) {
+ nautilus_window_hide_location_bar (window);
+ }
+ window->details->temporary_navigation_bar = FALSE;
+ }
+
+ nautilus_window_go_to (window, uri);
}
static void
@@ -387,8 +403,6 @@ navigation_bar_mode_changed_callback (GtkWidget *widget,
NautilusSwitchableNavigationBarMode mode,
NautilusWindow *window)
{
- nautilus_window_update_find_menu_item (window);
-
window->details->updating_bonobo_state = TRUE;
g_assert (mode == NAUTILUS_SWITCHABLE_NAVIGATION_BAR_MODE_LOCATION
@@ -396,12 +410,8 @@ navigation_bar_mode_changed_callback (GtkWidget *widget,
nautilus_window_ui_freeze (window);
- /* FIXME: bugzilla.eazel.com 3590:
- * We shouldn't need a separate command for the toggle button and menu item.
- * This is a Bonobo design flaw, explained in the bug report.
- */
nautilus_bonobo_set_toggle_state (window->details->shell_ui,
- NAUTILUS_COMMAND_TOGGLE_FIND_MODE_WITH_STATE,
+ NAUTILUS_COMMAND_TOGGLE_FIND_MODE,
mode == NAUTILUS_SWITCHABLE_NAVIGATION_BAR_MODE_SEARCH);
window->details->updating_bonobo_state = FALSE;
@@ -660,7 +670,7 @@ nautilus_window_constructed (NautilusWindow *window)
gtk_widget_show (GTK_WIDGET (window->navigation_bar));
gtk_signal_connect (GTK_OBJECT (window->navigation_bar), "location_changed",
- go_to_callback, window);
+ navigation_bar_location_changed_callback, window);
gtk_signal_connect (GTK_OBJECT (window->navigation_bar), "mode_changed",
navigation_bar_mode_changed_callback, window);
@@ -1836,6 +1846,7 @@ dock_item_showing (NautilusWindow *window, const char *dock_item_path)
void
nautilus_window_hide_location_bar (NautilusWindow *window)
{
+ window->details->temporary_navigation_bar = FALSE;
hide_dock_item (window, LOCATION_BAR_PATH);
}
diff --git a/src/nautilus-shell-ui.xml b/src/nautilus-shell-ui.xml
index 3e5db2b95..a8a521557 100644
--- a/src/nautilus-shell-ui.xml
+++ b/src/nautilus-shell-ui.xml
@@ -12,6 +12,8 @@
_tip="Go to the previous visited location"/>
<cmd name="Forward" accel="*Control*bracketright"
_tip="Go to the next visited location"/>
+ <cmd name="Find" accel="*Control*f"
+ _tip="Search this computer for files"/>
<cmd name="New Window"
_label="New Window"
_tip="Open another Nautilus window for the displayed location"/>
@@ -24,7 +26,7 @@
<cmd name="Copy" accel="*Control*c" sensitive="0"/>
<cmd name="Paste" accel="*Control*v" sensitive="0"/>
<cmd name="Clear" sensitive="0"/>
- <cmd name="Up" accel="*Control*u"
+ <cmd name="Up"
_tip="Go to the location that contains this one"/>
<cmd name="Zoom In" _label="Zoom In"
_tip="Show the contents in more detail"/>
@@ -61,11 +63,9 @@
<separator/>
- <menuitem name="Toggle Find Mode"
+ <menuitem name="Find"
_label="_Find"
- _tip="Search this computer for files"
- accel="*Control*f"
- verb="Toggle Find Mode"/>
+ verb="Find"/>
<menuitem name="Go to Web Search"
_label="We_b Search"
_tip="Search the World Wide Web"
@@ -179,12 +179,17 @@
verb="Forward"/>
<menuitem name="Up"
_label="_Up a Level"
+ accel="*Control*u"
verb="Up"/>
<menuitem name="Home"
_label="_Home"
_tip="Go to the home location"
accel="*Control*h"
verb="Home"/>
+ <menuitem name="Go to Location"
+ _label="_Location..."
+ accel="*Control*l"
+ verb="Go to Location"/>
<separator/>
@@ -323,7 +328,7 @@
min_width="48"
type="toggle"
pixtype="stock" pixname="Search"
- verb="Toggle Find Mode With State"/>
+ verb="Toggle Find Mode"/>
<toolitem name="Go to Web Search"
_label="Web Search"
_tip="Search the World Wide Web"
diff --git a/src/nautilus-spatial-window.c b/src/nautilus-spatial-window.c
index 1e48b1de4..9ea784fe0 100644
--- a/src/nautilus-spatial-window.c
+++ b/src/nautilus-spatial-window.c
@@ -95,10 +95,7 @@
#define STATUS_BAR_PATH "/status"
#define MENU_BAR_PATH "/menu"
-/* FIXME: bugzilla.eazel.com 3590
- * This shouldn't need to exist. See bug report for details.
- */
-#define NAUTILUS_COMMAND_TOGGLE_FIND_MODE_WITH_STATE "/commands/Toggle Find Mode With State"
+#define NAUTILUS_COMMAND_TOGGLE_FIND_MODE "/commands/Toggle Find Mode"
enum {
ARG_0,
@@ -377,9 +374,28 @@ nautilus_window_get_location (NautilusWindow *window)
static void
go_to_callback (GtkWidget *widget,
const char *uri,
- GtkWidget *window)
+ NautilusWindow *window)
+{
+ g_assert (NAUTILUS_IS_WINDOW (window));
+
+ nautilus_window_go_to (window, uri);
+}
+
+static void
+navigation_bar_location_changed_callback (GtkWidget *widget,
+ const char *uri,
+ NautilusWindow *window)
{
- nautilus_window_go_to (NAUTILUS_WINDOW (window), uri);
+ g_assert (NAUTILUS_IS_WINDOW (window));
+
+ if (window->details->temporary_navigation_bar) {
+ if (nautilus_window_location_bar_showing (window)) {
+ nautilus_window_hide_location_bar (window);
+ }
+ window->details->temporary_navigation_bar = FALSE;
+ }
+
+ nautilus_window_go_to (window, uri);
}
static void
@@ -387,8 +403,6 @@ navigation_bar_mode_changed_callback (GtkWidget *widget,
NautilusSwitchableNavigationBarMode mode,
NautilusWindow *window)
{
- nautilus_window_update_find_menu_item (window);
-
window->details->updating_bonobo_state = TRUE;
g_assert (mode == NAUTILUS_SWITCHABLE_NAVIGATION_BAR_MODE_LOCATION
@@ -396,12 +410,8 @@ navigation_bar_mode_changed_callback (GtkWidget *widget,
nautilus_window_ui_freeze (window);
- /* FIXME: bugzilla.eazel.com 3590:
- * We shouldn't need a separate command for the toggle button and menu item.
- * This is a Bonobo design flaw, explained in the bug report.
- */
nautilus_bonobo_set_toggle_state (window->details->shell_ui,
- NAUTILUS_COMMAND_TOGGLE_FIND_MODE_WITH_STATE,
+ NAUTILUS_COMMAND_TOGGLE_FIND_MODE,
mode == NAUTILUS_SWITCHABLE_NAVIGATION_BAR_MODE_SEARCH);
window->details->updating_bonobo_state = FALSE;
@@ -660,7 +670,7 @@ nautilus_window_constructed (NautilusWindow *window)
gtk_widget_show (GTK_WIDGET (window->navigation_bar));
gtk_signal_connect (GTK_OBJECT (window->navigation_bar), "location_changed",
- go_to_callback, window);
+ navigation_bar_location_changed_callback, window);
gtk_signal_connect (GTK_OBJECT (window->navigation_bar), "mode_changed",
navigation_bar_mode_changed_callback, window);
@@ -1836,6 +1846,7 @@ dock_item_showing (NautilusWindow *window, const char *dock_item_path)
void
nautilus_window_hide_location_bar (NautilusWindow *window)
{
+ window->details->temporary_navigation_bar = FALSE;
hide_dock_item (window, LOCATION_BAR_PATH);
}
diff --git a/src/nautilus-switchable-navigation-bar.c b/src/nautilus-switchable-navigation-bar.c
index b9549b8d2..c72efc679 100644
--- a/src/nautilus-switchable-navigation-bar.c
+++ b/src/nautilus-switchable-navigation-bar.c
@@ -156,30 +156,56 @@ nautilus_switchable_navigation_bar_get_mode (NautilusSwitchableNavigationBar
}
void
+nautilus_switchable_navigation_bar_activate (NautilusSwitchableNavigationBar *bar)
+{
+ NautilusNavigationBar *bar_to_activate;
+
+ switch (bar->details->mode) {
+ case NAUTILUS_SWITCHABLE_NAVIGATION_BAR_MODE_LOCATION:
+ bar_to_activate = NAUTILUS_NAVIGATION_BAR (bar->details->location_bar);
+ break;
+ case NAUTILUS_SWITCHABLE_NAVIGATION_BAR_MODE_SEARCH:
+ bar_to_activate = NAUTILUS_NAVIGATION_BAR (bar->details->search_bar);
+ break;
+ default:
+ g_return_if_fail (FALSE);
+ }
+
+ nautilus_navigation_bar_activate (bar_to_activate);
+}
+
+
+void
nautilus_switchable_navigation_bar_set_mode (NautilusSwitchableNavigationBar *bar,
NautilusSwitchableNavigationBarMode mode)
{
+ GtkWidget *widget_to_hide, *widget_to_show;
GtkWidget *dock;
if (bar->details->mode == mode) {
return;
}
+ bar->details->mode = mode;
+
switch (mode) {
case NAUTILUS_SWITCHABLE_NAVIGATION_BAR_MODE_LOCATION:
- gtk_widget_show (GTK_WIDGET (bar->details->location_bar));
- nautilus_navigation_bar_activate (NAUTILUS_NAVIGATION_BAR (bar->details->location_bar));
- gtk_widget_hide (GTK_WIDGET (bar->details->search_bar));
+ widget_to_show = GTK_WIDGET (bar->details->location_bar);
+ widget_to_hide = GTK_WIDGET (bar->details->search_bar);
break;
case NAUTILUS_SWITCHABLE_NAVIGATION_BAR_MODE_SEARCH:
- gtk_widget_show (GTK_WIDGET (bar->details->search_bar));
- nautilus_navigation_bar_activate (NAUTILUS_NAVIGATION_BAR (bar->details->search_bar));
- gtk_widget_hide (GTK_WIDGET (bar->details->location_bar));
+ widget_to_show = GTK_WIDGET (bar->details->search_bar);
+ widget_to_hide = GTK_WIDGET (bar->details->location_bar);
break;
default:
g_return_if_fail (mode && 0);
}
+ gtk_widget_show (widget_to_show);
+ gtk_widget_hide (widget_to_hide);
+
+ nautilus_switchable_navigation_bar_activate (bar);
+
/* FIXME bugzilla.eazel.com 3171:
* We don't know why this line is needed here, but if it's removed
* then the bar won't shrink when we switch from the complex search
@@ -191,7 +217,6 @@ nautilus_switchable_navigation_bar_set_mode (NautilusSwitchableNavigationBar
gtk_widget_queue_resize (dock);
}
- bar->details->mode = mode;
gtk_signal_emit (GTK_OBJECT (bar), signals[MODE_CHANGED], mode);
}
diff --git a/src/nautilus-switchable-navigation-bar.h b/src/nautilus-switchable-navigation-bar.h
index 8f514b29b..5dab5ac6d 100644
--- a/src/nautilus-switchable-navigation-bar.h
+++ b/src/nautilus-switchable-navigation-bar.h
@@ -68,6 +68,6 @@ GtkWidget* nautilus_switchable_navigation_bar_new (NautilusWindow *w
NautilusSwitchableNavigationBarMode nautilus_switchable_navigation_bar_get_mode (NautilusSwitchableNavigationBar *switchable_navigation_bar);
void nautilus_switchable_navigation_bar_set_mode (NautilusSwitchableNavigationBar *switchable_navigation_bar,
NautilusSwitchableNavigationBarMode mode);
-
+void nautilus_switchable_navigation_bar_activate (NautilusSwitchableNavigationBar *switchable_navigation_bar);
#endif /* NAUTILUS_SWITCHABLE_NAVIGATION_BAR_H */
diff --git a/src/nautilus-window-menus.c b/src/nautilus-window-menus.c
index 0bc96ee9d..56e8a5651 100644
--- a/src/nautilus-window-menus.c
+++ b/src/nautilus-window-menus.c
@@ -34,6 +34,7 @@
#include "nautilus-bookmarks-window.h"
#include "nautilus-property-browser.h"
#include "nautilus-signaller.h"
+#include "nautilus-switchable-navigation-bar.h"
#include "nautilus-theme-selector.h"
#include "nautilus-window-manage-views.h"
#include "nautilus-window-private.h"
@@ -72,8 +73,6 @@
* don't want other code relying on their existence.
*/
-#define MENU_PATH_TOGGLE_FIND_MODE "/menu/File/Toggle Find Mode"
-
#define MENU_PATH_SHOW_HIDE_SIDEBAR "/menu/View/Show Hide Placeholder/Show Hide Sidebar"
#define MENU_PATH_SHOW_HIDE_TOOLBAR "/menu/View/Show Hide Placeholder/Show Hide Toolbar"
#define MENU_PATH_SHOW_HIDE_LOCATION_BAR "/menu/View/Show Hide Placeholder/Show Hide Location Bar"
@@ -213,7 +212,36 @@ file_menu_close_all_windows_callback (BonoboUIComponent *component,
}
static void
-file_menu_toggle_find_mode_callback (BonoboUIComponent *component,
+nautilus_window_show_location_bar_temporarily (NautilusWindow *window,
+ gboolean in_search_mode)
+{
+ if (!nautilus_window_location_bar_showing (window)) {
+ nautilus_window_show_location_bar (window);
+ window->details->temporary_navigation_bar = TRUE;
+ }
+ nautilus_window_set_search_mode
+ (window, in_search_mode);
+ nautilus_switchable_navigation_bar_activate
+ (NAUTILUS_SWITCHABLE_NAVIGATION_BAR (window->navigation_bar));
+}
+
+static void
+file_menu_find_callback (BonoboUIComponent *component,
+ gpointer user_data,
+ const char *verb)
+{
+ NautilusWindow *window;
+
+ window = NAUTILUS_WINDOW (user_data);
+
+ if (!window->details->updating_bonobo_state) {
+ nautilus_window_show_location_bar_temporarily
+ (window, TRUE);
+ }
+}
+
+static void
+toolbar_toggle_find_mode_callback (BonoboUIComponent *component,
gpointer user_data,
const char *verb)
{
@@ -222,16 +250,27 @@ file_menu_toggle_find_mode_callback (BonoboUIComponent *component,
window = NAUTILUS_WINDOW (user_data);
if (!window->details->updating_bonobo_state) {
- /* Show location bar if it's hidden */
- if (!nautilus_window_location_bar_showing (window)) {
- nautilus_window_show_location_bar (window);
- }
- nautilus_window_set_search_mode
+ nautilus_window_show_location_bar_temporarily
(window, !nautilus_window_get_search_mode (window));
}
}
static void
+go_menu_location_callback (BonoboUIComponent *component,
+ gpointer user_data,
+ const char *verb)
+{
+ NautilusWindow *window;
+
+ window = NAUTILUS_WINDOW (user_data);
+
+ if (!window->details->updating_bonobo_state) {
+ nautilus_window_show_location_bar_temporarily
+ (window, FALSE);
+ }
+}
+
+static void
file_menu_web_search_callback (BonoboUIComponent *component,
gpointer user_data,
const char *verb)
@@ -1182,13 +1221,8 @@ nautilus_window_initialize_menus_part_1 (NautilusWindow *window)
BONOBO_UI_VERB ("New Window", file_menu_new_window_callback),
BONOBO_UI_VERB ("Close", file_menu_close_window_callback),
BONOBO_UI_VERB ("Close All Windows", file_menu_close_all_windows_callback),
- BONOBO_UI_VERB ("Toggle Find Mode", file_menu_toggle_find_mode_callback),
- /* FIXME: bugzilla.eazel.com 3590:
- * Note that we use a different verb for the toolbar button since
- * the toolbar button has state but the menu item doesn't. This would
- * otherwise confuse Bonobo.
- */
- BONOBO_UI_VERB ("Toggle Find Mode With State", file_menu_toggle_find_mode_callback),
+ BONOBO_UI_VERB ("Find", file_menu_find_callback),
+ BONOBO_UI_VERB ("Toggle Find Mode", toolbar_toggle_find_mode_callback),
BONOBO_UI_VERB ("Go to Web Search", file_menu_web_search_callback),
BONOBO_UI_VERB ("Undo", edit_menu_undo_callback),
BONOBO_UI_VERB ("Customize", customize_callback),
@@ -1197,6 +1231,7 @@ nautilus_window_initialize_menus_part_1 (NautilusWindow *window)
BONOBO_UI_VERB ("Forward", go_menu_forward_callback),
BONOBO_UI_VERB ("Up", go_menu_up_callback),
BONOBO_UI_VERB ("Home", go_menu_home_callback),
+ BONOBO_UI_VERB ("Go to Location", go_menu_location_callback),
BONOBO_UI_VERB ("Forget History", go_menu_forget_history_callback),
BONOBO_UI_VERB ("Reload", view_menu_reload_callback),
BONOBO_UI_VERB ("Show Hide Sidebar", view_menu_show_hide_sidebar_callback),
@@ -1243,7 +1278,6 @@ nautilus_window_initialize_menus_part_1 (NautilusWindow *window)
bonobo_ui_component_add_verb_list_with_data (window->details->shell_ui, verbs, window);
- nautilus_window_update_find_menu_item (window);
nautilus_window_update_show_hide_menu_items (window);
add_user_level_menu_item (window, NAUTILUS_MENU_PATH_NOVICE_ITEM,
@@ -1317,29 +1351,6 @@ nautilus_window_remove_go_menu_items (NautilusWindow *window)
nautilus_window_ui_thaw (window);
}
-void
-nautilus_window_update_find_menu_item (NautilusWindow *window)
-{
- char *label_string;
-
- g_return_if_fail (NAUTILUS_IS_WINDOW (window));
-
- nautilus_window_ui_freeze (window);
-
- label_string = g_strdup
- (nautilus_window_get_search_mode (window)
- ? _("_Browse")
- : _("_Find"));
-
- nautilus_bonobo_set_label (window->details->shell_ui,
- MENU_PATH_TOGGLE_FIND_MODE,
- label_string);
- g_free (label_string);
-
- nautilus_window_ui_thaw (window);
-}
-
-
static void
append_dynamic_bookmarks (NautilusWindow *window)
{
diff --git a/src/nautilus-window-private.h b/src/nautilus-window-private.h
index 8cf0161fc..5433d22aa 100644
--- a/src/nautilus-window-private.h
+++ b/src/nautilus-window-private.h
@@ -84,6 +84,9 @@ struct NautilusWindowDetails
/* Deferred location change. */
char *location_to_change_to_at_idle;
guint location_change_at_idle_id;
+
+ /* Location bar */
+ gboolean temporary_navigation_bar;
};
#define NAUTILUS_MENU_PATH_BACK_ITEM "/menu/Go/Back"
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index 1e48b1de4..9ea784fe0 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -95,10 +95,7 @@
#define STATUS_BAR_PATH "/status"
#define MENU_BAR_PATH "/menu"
-/* FIXME: bugzilla.eazel.com 3590
- * This shouldn't need to exist. See bug report for details.
- */
-#define NAUTILUS_COMMAND_TOGGLE_FIND_MODE_WITH_STATE "/commands/Toggle Find Mode With State"
+#define NAUTILUS_COMMAND_TOGGLE_FIND_MODE "/commands/Toggle Find Mode"
enum {
ARG_0,
@@ -377,9 +374,28 @@ nautilus_window_get_location (NautilusWindow *window)
static void
go_to_callback (GtkWidget *widget,
const char *uri,
- GtkWidget *window)
+ NautilusWindow *window)
+{
+ g_assert (NAUTILUS_IS_WINDOW (window));
+
+ nautilus_window_go_to (window, uri);
+}
+
+static void
+navigation_bar_location_changed_callback (GtkWidget *widget,
+ const char *uri,
+ NautilusWindow *window)
{
- nautilus_window_go_to (NAUTILUS_WINDOW (window), uri);
+ g_assert (NAUTILUS_IS_WINDOW (window));
+
+ if (window->details->temporary_navigation_bar) {
+ if (nautilus_window_location_bar_showing (window)) {
+ nautilus_window_hide_location_bar (window);
+ }
+ window->details->temporary_navigation_bar = FALSE;
+ }
+
+ nautilus_window_go_to (window, uri);
}
static void
@@ -387,8 +403,6 @@ navigation_bar_mode_changed_callback (GtkWidget *widget,
NautilusSwitchableNavigationBarMode mode,
NautilusWindow *window)
{
- nautilus_window_update_find_menu_item (window);
-
window->details->updating_bonobo_state = TRUE;
g_assert (mode == NAUTILUS_SWITCHABLE_NAVIGATION_BAR_MODE_LOCATION
@@ -396,12 +410,8 @@ navigation_bar_mode_changed_callback (GtkWidget *widget,
nautilus_window_ui_freeze (window);
- /* FIXME: bugzilla.eazel.com 3590:
- * We shouldn't need a separate command for the toggle button and menu item.
- * This is a Bonobo design flaw, explained in the bug report.
- */
nautilus_bonobo_set_toggle_state (window->details->shell_ui,
- NAUTILUS_COMMAND_TOGGLE_FIND_MODE_WITH_STATE,
+ NAUTILUS_COMMAND_TOGGLE_FIND_MODE,
mode == NAUTILUS_SWITCHABLE_NAVIGATION_BAR_MODE_SEARCH);
window->details->updating_bonobo_state = FALSE;
@@ -660,7 +670,7 @@ nautilus_window_constructed (NautilusWindow *window)
gtk_widget_show (GTK_WIDGET (window->navigation_bar));
gtk_signal_connect (GTK_OBJECT (window->navigation_bar), "location_changed",
- go_to_callback, window);
+ navigation_bar_location_changed_callback, window);
gtk_signal_connect (GTK_OBJECT (window->navigation_bar), "mode_changed",
navigation_bar_mode_changed_callback, window);
@@ -1836,6 +1846,7 @@ dock_item_showing (NautilusWindow *window, const char *dock_item_path)
void
nautilus_window_hide_location_bar (NautilusWindow *window)
{
+ window->details->temporary_navigation_bar = FALSE;
hide_dock_item (window, LOCATION_BAR_PATH);
}