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.
This commit is contained in:
John Sullivan 2001-03-27 20:31:28 +00:00
parent bffd9f61a9
commit bc5a63eb6e
15 changed files with 345 additions and 157 deletions

View file

@ -1,3 +1,89 @@
2001-03-27 John Sullivan <sullivan@eazel.com>
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.
Tue Mar 27 02:25:31 2001 George Lebl <jirka@5z.com>
* components/help/hyperbola-nav-tree.c (ensure_italic_style)

View file

@ -1,7 +1,7 @@
<Root>
<menu>
<placeholder name="Services Placeholder">
<submenu name="Fonts" _label="_Fonts">
<submenu name="Fonts" _label="F_onts">
<menuitem name="Helvetica"
_label="_Helvetica"
_tip="Use the Helvetica Font"

View file

@ -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

View file

@ -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>

View file

@ -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);
}

View file

@ -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,15 +250,26 @@ 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,
@ -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)
{

View file

@ -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)
{
nautilus_window_go_to (NAUTILUS_WINDOW (window), uri);
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)
{
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);
}

View file

@ -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)
{
nautilus_window_go_to (NAUTILUS_WINDOW (window), uri);
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)
{
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);
}

View file

@ -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"

View file

@ -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)
{
nautilus_window_go_to (NAUTILUS_WINDOW (window), uri);
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)
{
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);
}

View file

@ -155,31 +155,57 @@ nautilus_switchable_navigation_bar_get_mode (NautilusSwitchableNavigationBar
return bar->details->mode;
}
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);
}

View file

@ -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 */

View file

@ -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,15 +250,26 @@ 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,
@ -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)
{

View file

@ -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"

View file

@ -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)
{
nautilus_window_go_to (NAUTILUS_WINDOW (window), uri);
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)
{
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);
}