Fixed bug 660 (Need to publish menu positions for components to use)

* libnautilus/nautilus-bonobo-ui.h:
	New file, contains #defines for Bonobo-style menu paths for all
	the menus & menu items in Nautilus that we promise components
	will exist.
	* libnautilus/Makefile.am: Include this new header file in library.

	* src/nautilus-window-menus.c: Extensive changes, too many to list
	every function. Replaced all the GnomeUIInfo mechanism with
	Bonobo-style menu creation, using the menu paths from
	nautilus-bonobo-ui.h. While I was in here, I also renamed some
	functions (especially xxx_cb -> xxx_callback), tweaked some text,
	and used some more standard Gnome menu item pixmaps (not sure if I
	like them or not yet).

	* src/ntl-window-private.h,
	* src/ntl-window.c:
	(nautilus_window_back_cb), (nautilus_window_forward_cb),
	(nautilus_window_up_cb), (nautilus_window_home_cb): Replaced
	these GtkWidget-callback style functions (formerly used
	by both menu items and toolbar buttons) with new NautilusWindow
	oriented ones nautilus_window_go_back, nautilus_window_go_forward,
	nautilus_window_go_up, and nautilus_window_go_home.
	(nautilus_window_allow_back), (nautilus_window_allow_forward),
	(nautilus_window_allow_up): replaced hardwired Bonobo menu paths
	with the new #defines.

	* src/nautilus-window-toolbars.c:
	Renamed some functions xxx_cb -> xxx_callback.
	(toolbar_back_callback), (toolbar_forward_callback),
	(toolbar_up_callback), (toolbar_home_callback): New GtkWidget-callback
	style functions used exclusively by the toolbar.

	* src/file-manager/fm-directory-view.h:
	Removed FM_DIRECTORY_VIEW_PATH_CLOSE and
	FM_DIRECTORY_VIEW_PATH_SELECT_ALL, since callers should use
	the paths defined by Nautilus for these.

	* src/file-manager/fm-directory-view.c:
	(fm_directory_view_real_merge_menus): Replaced special insider knowledge
	of menu positions with use of the new #defines. Also tweaked with the
	keyboard underscore shortcuts for some items.
This commit is contained in:
John Sullivan 2000-04-28 02:37:14 +00:00
parent 7e8e4fa240
commit 604acdd1e3
15 changed files with 1172 additions and 656 deletions

View file

@ -1,3 +1,49 @@
2000-04-27 John Sullivan <sullivan@eazel.com>
Fixed bug 660 (Need to publish menu positions for components to use)
* libnautilus/nautilus-bonobo-ui.h:
New file, contains #defines for Bonobo-style menu paths for all
the menus & menu items in Nautilus that we promise components
will exist.
* libnautilus/Makefile.am: Include this new header file in library.
* src/nautilus-window-menus.c: Extensive changes, too many to list
every function. Replaced all the GnomeUIInfo mechanism with
Bonobo-style menu creation, using the menu paths from
nautilus-bonobo-ui.h. While I was in here, I also renamed some
functions (especially xxx_cb -> xxx_callback), tweaked some text,
and used some more standard Gnome menu item pixmaps (not sure if I
like them or not yet).
* src/ntl-window-private.h,
* src/ntl-window.c:
(nautilus_window_back_cb), (nautilus_window_forward_cb),
(nautilus_window_up_cb), (nautilus_window_home_cb): Replaced
these GtkWidget-callback style functions (formerly used
by both menu items and toolbar buttons) with new NautilusWindow
oriented ones nautilus_window_go_back, nautilus_window_go_forward,
nautilus_window_go_up, and nautilus_window_go_home.
(nautilus_window_allow_back), (nautilus_window_allow_forward),
(nautilus_window_allow_up): replaced hardwired Bonobo menu paths
with the new #defines.
* src/nautilus-window-toolbars.c:
Renamed some functions xxx_cb -> xxx_callback.
(toolbar_back_callback), (toolbar_forward_callback),
(toolbar_up_callback), (toolbar_home_callback): New GtkWidget-callback
style functions used exclusively by the toolbar.
* src/file-manager/fm-directory-view.h:
Removed FM_DIRECTORY_VIEW_PATH_CLOSE and
FM_DIRECTORY_VIEW_PATH_SELECT_ALL, since callers should use
the paths defined by Nautilus for these.
* src/file-manager/fm-directory-view.c:
(fm_directory_view_real_merge_menus): Replaced special insider knowledge
of menu positions with use of the new #defines. Also tweaked with the
keyboard underscore shortcuts for some items.
2000-04-27 Darin Adler <darin@eazel.com>
* libnautilus-extensions/nautilus-directory-async.c:

View file

@ -33,6 +33,7 @@ libnautilusincludedir=$(includedir)/libnautilus
libnautilusinclude_HEADERS= \
libnautilus.h \
nautilus-bonobo-ui.h \
nautilus-clipboard.h \
nautilus-content-view-frame.h \
nautilus-meta-view-frame.h \

View file

@ -0,0 +1,79 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: 8; c-basic-offset: 8 -*- */
/*
* libnautilus: A library for nautilus view implementations.
*
* Copyright (C) 2000 Eazel, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* Author: Maciej Stachowiak <mjs@eazel.com>
*
*/
/* nautilus-bonobo-ui.h: bonobo UI paths usable by Nautilus components
* for merging menus and toolbars.
*/
#ifndef NAUTILUS_BONOBO_UI_H
#define NAUTILUS_BONOBO_UI_H
/* Components can use these paths with BonoboUIHandler calls to
* locate menus and menu items for the purpose of menu merging.
* Note: Not all Nautilus menu items are necessarily published
* here; these are the ones whose existence components can count on.
*/
/* File menu */
#define NAUTILUS_MENU_PATH_FILE_MENU "/File"
#define NAUTILUS_MENU_PATH_NEW_WINDOW_ITEM "/File/New Window"
#define NAUTILUS_MENU_PATH_CLOSE_ITEM "/File/Close"
#define NAUTILUS_MENU_PATH_SEPARATOR_BEFORE_EXIT "/File/Separator before Exit"
#define NAUTILUS_MENU_PATH_EXIT_ITEM "/File/Exit"
/* Edit menu */
#define NAUTILUS_MENU_PATH_EDIT_MENU "/Edit"
#define NAUTILUS_MENU_PATH_UNDO_ITEM "/Edit/Undo"
#define NAUTILUS_MENU_PATH_SEPARATOR_AFTER_UNDO "/Edit/Separator after Undo"
#define NAUTILUS_MENU_PATH_CUT_ITEM "/Edit/Cut"
#define NAUTILUS_MENU_PATH_COPY_ITEM "/Edit/Copy"
#define NAUTILUS_MENU_PATH_PASTE_ITEM "/Edit/Paste"
#define NAUTILUS_MENU_PATH_CLEAR_ITEM "/Edit/Clear"
#define NAUTILUS_MENU_PATH_SEPARATOR_AFTER_CLEAR "/Edit/Separator after Clear"
#define NAUTILUS_MENU_PATH_SELECT_ALL_ITEM "/Edit/Select All"
/* Go menu */
#define NAUTILUS_MENU_PATH_GO_MENU "/Go"
#define NAUTILUS_MENU_PATH_BACK_ITEM "/Go/Back"
#define NAUTILUS_MENU_PATH_FORWARD_ITEM "/Go/Forward"
#define NAUTILUS_MENU_PATH_UP_ITEM "/Go/Up"
#define NAUTILUS_MENU_PATH_HOME_ITEM "/Go/Home"
#define NAUTILUS_MENU_PATH_SEPARATOR_BEFORE_HISTORY "/Go/Separator before History"
/* Bookmarks menu */
#define NAUTILUS_MENU_PATH_BOOKMARKS_MENU "/Bookmarks"
#define NAUTILUS_MENU_PATH_ADD_BOOKMARK_ITEM "/Bookmarks/Add Bookmark"
#define NAUTILUS_MENU_PATH_EDIT_BOOKMARKS_ITEM "/Bookmarks/Edit Bookmarks"
#define NAUTILUS_MENU_PATH_SEPARATOR_BEFORE_BOOKMARKS "/Bookmarks/Separator before Bookmarks"
/* Settings menu */
#define NAUTILUS_MENU_PATH_SETTINGS_MENU "/Settings"
#define NAUTILUS_MENU_PATH_SEPARATOR_AFTER_USER_LEVELS "/Settings/Separator after User Levels"
/* Help menu */
#define NAUTILUS_MENU_PATH_HELP_MENU "/Help"
#define NAUTILUS_MENU_PATH_ABOUT_ITEM "/Help/About Nautilus"
#endif /* NAUTILUS_BONOBO_UI_H */

View file

@ -42,6 +42,7 @@
#include <libgnomevfs/gnome-vfs-utils.h>
#include <libgnomevfs/gnome-vfs-result.h>
#include <libnautilus/nautilus-bonobo-ui.h>
#include <libnautilus/nautilus-zoomable.h>
#include <libnautilus-extensions/nautilus-alloc.h>
@ -1620,17 +1621,11 @@ fm_directory_view_real_merge_menus (FMDirectoryView *view)
ui_handler = fm_directory_view_get_bonobo_ui_handler (view);
/* FIXME bugzilla.eazel.com 660:
* The first few items here have magic number indexes. Need to
* invent and use a scheme whereby Nautilus publishes some or all of
* its menu item paths so that components can merge items into the
* right places without special knowledge like this.
*/
bonobo_ui_handler_menu_new_item (ui_handler,
FM_DIRECTORY_VIEW_MENU_PATH_OPEN,
_("_Open"),
_("Open the selected item in this window"),
1,
bonobo_ui_handler_menu_get_pos (ui_handler, NAUTILUS_MENU_PATH_NEW_WINDOW_ITEM) + 1,
BONOBO_UI_HANDLER_PIXMAP_NONE,
NULL,
'O',
@ -1641,7 +1636,7 @@ fm_directory_view_real_merge_menus (FMDirectoryView *view)
FM_DIRECTORY_VIEW_MENU_PATH_OPEN_IN_NEW_WINDOW,
_("Open in New Window"),
_("Open each selected item in a new window"),
2,
bonobo_ui_handler_menu_get_pos (ui_handler, NAUTILUS_MENU_PATH_NEW_WINDOW_ITEM) + 2,
BONOBO_UI_HANDLER_PIXMAP_NONE,
NULL,
0,
@ -1650,12 +1645,12 @@ fm_directory_view_real_merge_menus (FMDirectoryView *view)
view);
bonobo_ui_handler_menu_new_separator (ui_handler,
FM_DIRECTORY_VIEW_MENU_PATH_SEPARATOR_AFTER_CLOSE,
bonobo_ui_handler_menu_get_pos (ui_handler, FM_DIRECTORY_VIEW_MENU_PATH_CLOSE) + 1);
bonobo_ui_handler_menu_get_pos (ui_handler, NAUTILUS_MENU_PATH_CLOSE_ITEM) + 1);
bonobo_ui_handler_menu_new_item (ui_handler,
FM_DIRECTORY_VIEW_MENU_PATH_SET_PROPERTIES,
_("Set Properties..."),
_("View or modify the properties of the selected items"),
bonobo_ui_handler_menu_get_pos (ui_handler, FM_DIRECTORY_VIEW_MENU_PATH_CLOSE) + 2,
bonobo_ui_handler_menu_get_pos (ui_handler, NAUTILUS_MENU_PATH_CLOSE_ITEM) + 2,
BONOBO_UI_HANDLER_PIXMAP_NONE,
NULL,
0,
@ -1670,7 +1665,7 @@ fm_directory_view_real_merge_menus (FMDirectoryView *view)
FM_DIRECTORY_VIEW_MENU_PATH_DELETE,
_("Delete..."),
_("Delete all selected items"),
bonobo_ui_handler_menu_get_pos (ui_handler, FM_DIRECTORY_VIEW_MENU_PATH_CLOSE) + 3,
bonobo_ui_handler_menu_get_pos (ui_handler, NAUTILUS_MENU_PATH_CLOSE_ITEM) + 3,
BONOBO_UI_HANDLER_PIXMAP_NONE,
NULL,
0,
@ -1682,7 +1677,7 @@ fm_directory_view_real_merge_menus (FMDirectoryView *view)
FM_DIRECTORY_VIEW_MENU_PATH_TRASH,
_("Move to Trash"),
_("Move all selected items to Trash"),
bonobo_ui_handler_menu_get_pos (ui_handler, FM_DIRECTORY_VIEW_MENU_PATH_CLOSE) + 3,
bonobo_ui_handler_menu_get_pos (ui_handler, NAUTILUS_MENU_PATH_CLOSE_ITEM) + 3,
BONOBO_UI_HANDLER_PIXMAP_NONE,
NULL,
'T',
@ -1693,7 +1688,7 @@ fm_directory_view_real_merge_menus (FMDirectoryView *view)
FM_DIRECTORY_VIEW_MENU_PATH_DUPLICATE,
_("Duplicate"),
_("Duplicate all selected items"),
bonobo_ui_handler_menu_get_pos (ui_handler, FM_DIRECTORY_VIEW_MENU_PATH_CLOSE) + 4,
bonobo_ui_handler_menu_get_pos (ui_handler, NAUTILUS_MENU_PATH_CLOSE_ITEM) + 4,
BONOBO_UI_HANDLER_PIXMAP_NONE,
NULL,
'D',
@ -1702,9 +1697,9 @@ fm_directory_view_real_merge_menus (FMDirectoryView *view)
view);
bonobo_ui_handler_menu_new_item (ui_handler,
FM_DIRECTORY_VIEW_MENU_PATH_EMPTY_TRASH,
_("Empty Trash"),
_("Empty the Trash folder"),
bonobo_ui_handler_menu_get_pos (ui_handler, FM_DIRECTORY_VIEW_MENU_PATH_CLOSE) + 5,
_("_Empty Trash"),
_("Delete all items in the trash"),
bonobo_ui_handler_menu_get_pos (ui_handler, NAUTILUS_MENU_PATH_CLOSE_ITEM) + 5,
BONOBO_UI_HANDLER_PIXMAP_NONE,
NULL,
0,
@ -1712,10 +1707,10 @@ fm_directory_view_real_merge_menus (FMDirectoryView *view)
bonobo_menu_empty_trash_cb,
view);
bonobo_ui_handler_menu_new_item (ui_handler,
FM_DIRECTORY_VIEW_MENU_PATH_SELECT_ALL,
_("Select All"),
NAUTILUS_MENU_PATH_SELECT_ALL_ITEM,
_("_Select All"),
_("Select all items in this window"),
bonobo_ui_handler_menu_get_pos (ui_handler, FM_DIRECTORY_VIEW_MENU_PATH_SELECT_ALL),
bonobo_ui_handler_menu_get_pos (ui_handler, NAUTILUS_MENU_PATH_SELECT_ALL_ITEM),
BONOBO_UI_HANDLER_PIXMAP_NONE,
NULL,
0,
@ -2344,7 +2339,7 @@ fm_directory_view_get_context_menu_index(const char *menu_name)
return 2;
} else if (g_strcasecmp(FM_DIRECTORY_VIEW_MENU_PATH_DUPLICATE, menu_name) == 0) {
return 3;
} else if (g_strcasecmp(FM_DIRECTORY_VIEW_MENU_PATH_SELECT_ALL, menu_name) == 0) {
} else if (g_strcasecmp(NAUTILUS_MENU_PATH_SELECT_ALL_ITEM, menu_name) == 0) {
return 4;
} else if (g_strcasecmp(FM_DIRECTORY_VIEW_MENU_PATH_SET_PROPERTIES, menu_name) == 0) {
return 5;

View file

@ -36,15 +36,16 @@
typedef struct FMDirectoryView FMDirectoryView;
typedef struct FMDirectoryViewClass FMDirectoryViewClass;
/* Paths to use when creating & referring to bonobo menu items */
/* Paths to use when creating & referring to bonobo menu items.
* These are the new ones defined by FMDirectoryView. The
* Nautilus-wide ones are in <libnautilus/nautilus-bonobo-ui.h>
*/
#define FM_DIRECTORY_VIEW_MENU_PATH_OPEN "/File/Open"
#define FM_DIRECTORY_VIEW_MENU_PATH_OPEN_IN_NEW_WINDOW "/File/OpenNew"
#define FM_DIRECTORY_VIEW_MENU_PATH_CLOSE "/File/Close"
#define FM_DIRECTORY_VIEW_MENU_PATH_SEPARATOR_AFTER_CLOSE "/File/SeparatorAfterClose"
#define FM_DIRECTORY_VIEW_MENU_PATH_DELETE "/File/Delete"
#define FM_DIRECTORY_VIEW_MENU_PATH_TRASH "/File/Trash"
#define FM_DIRECTORY_VIEW_MENU_PATH_DUPLICATE "/File/Duplicate"
#define FM_DIRECTORY_VIEW_MENU_PATH_SELECT_ALL "/Edit/Select All"
#define FM_DIRECTORY_VIEW_MENU_PATH_EMPTY_TRASH "/File/Empty Trash"
#define FM_DIRECTORY_VIEW_MENU_PATH_SET_PROPERTIES "/File/Set Properties"

View file

@ -30,6 +30,8 @@
#include "ntl-window-private.h"
#include "libnautilus-extensions/nautilus-undo-manager.h"
#include <libnautilus/nautilus-bonobo-ui.h>
#include <libnautilus-extensions/nautilus-bonobo-extensions.h>
#include <libnautilus-extensions/nautilus-glib-extensions.h>
#include <libnautilus-extensions/nautilus-gtk-extensions.h>
@ -37,34 +39,18 @@
#include <libnautilus-extensions/nautilus-string.h>
#include <libnautilus-extensions/nautilus-global-preferences.h>
static void edit_menu_undo_callback (GtkWidget *widget,
gpointer data) ;
static void edit_menu_cut_cb (GtkWidget *widget,
gpointer data) ;
static void edit_menu_copy_cb (GtkWidget *widget,
gpointer data) ;
static void edit_menu_paste_cb (GtkWidget *widget,
gpointer data) ;
static void edit_menu_clear_cb (GtkWidget *widget,
gpointer data) ;
static void activate_bookmark_in_menu_item (BonoboUIHandler *uih,
gpointer user_data,
const char *path);
static void append_bookmark_to_menu (NautilusWindow *window,
const NautilusBookmark *bookmark,
const char *menu_item_path);
static void append_separator_to_menu (NautilusWindow *window,
const char *separator_path);
static void clear_appended_bookmark_items (NautilusWindow *window,
const char *menu_path,
const char *last_static_item_path);
static NautilusBookmarkList *get_bookmark_list (void);
static GtkWidget *get_bookmarks_window (void);
static void nautilus_window_about_cb (GtkWidget *widget,
NautilusWindow *window);
static void debug_menu_show_color_picker_cb (GtkWidget *widget,
NautilusWindow *window);
static void refresh_bookmarks_in_go_menu (NautilusWindow *window);
static void refresh_bookmarks_in_bookmarks_menu (NautilusWindow *window);
static void update_eazel_theme_menu_item (NautilusWindow *window);
@ -76,134 +62,104 @@ typedef struct {
NautilusWindow *window;
} BookmarkHolder;
/* Private menu definitions; others are in <libnautilus/nautilus-bonobo-ui.h>.
* These are not part of the published set, either because they are
* development-only (e.g. Debug) or because we expect to change them and
* don't want other code relying on their existence.
*/
#define NAUTILUS_MENU_PATH_GENERAL_SETTINGS_ITEM "/Settings/General Settings"
#define NAUTILUS_MENU_PATH_USE_EAZEL_THEME_ICONS_ITEM "/Settings/Use Eazel Theme Icons"
#define NAUTILUS_MENU_PATH_DEBUG_MENU "/Debug"
#define NAUTILUS_MENU_PATH_SHOW_COLOR_SELECTOR_ITEM "/Debug/Show Color Selector"
/* menu definitions */
static void
file_menu_close_cb (GtkWidget *widget,
gpointer data)
{
g_assert (NAUTILUS_IS_WINDOW (data));
nautilus_window_close (NAUTILUS_WINDOW (data));
}
static void
file_menu_new_window_cb (GtkWidget *widget,
gpointer data)
file_menu_new_window_callback (BonoboUIHandler *ui_handler,
gpointer user_data,
const char *path)
{
NautilusWindow *current_mainwin;
NautilusWindow *new_mainwin;
g_return_if_fail(NAUTILUS_IS_WINDOW(data));
g_return_if_fail (NAUTILUS_IS_WINDOW (user_data));
current_mainwin = NAUTILUS_WINDOW(data);
current_mainwin = NAUTILUS_WINDOW (user_data);
new_mainwin = nautilus_app_create_window(NAUTILUS_APP(current_mainwin->app));
new_mainwin = nautilus_app_create_window (NAUTILUS_APP (current_mainwin->app));
nautilus_window_goto_uri(new_mainwin,
nautilus_window_get_requested_uri(current_mainwin));
nautilus_window_goto_uri (new_mainwin,
nautilus_window_get_requested_uri (current_mainwin));
gtk_widget_show(GTK_WIDGET(new_mainwin));
gtk_widget_show (GTK_WIDGET (new_mainwin));
}
static void
file_menu_exit_cb (GtkWidget *widget,
gpointer data)
file_menu_close_window_callback (BonoboUIHandler *ui_handler,
gpointer user_data,
const char *path)
{
g_assert (NAUTILUS_IS_WINDOW (user_data));
nautilus_window_close (NAUTILUS_WINDOW (user_data));
}
static void
file_menu_exit_callback (BonoboUIHandler *ui_handler,
gpointer user_data,
const char *path)
{
gtk_main_quit ();
}
static void
general_settings_cb (GtkWidget *widget,
GtkWindow *mainwin)
{
nautilus_global_preferences_show_dialog ();
}
static GnomeUIInfo file_menu_info[] = {
{
GNOME_APP_UI_ITEM,
N_("New Window"), N_("Create a new window"),
file_menu_new_window_cb, NULL, NULL,
GNOME_APP_PIXMAP_NONE, NULL,
'N', GDK_CONTROL_MASK, NULL
},
GNOMEUIINFO_MENU_CLOSE_ITEM(file_menu_close_cb, NULL),
GNOMEUIINFO_SEPARATOR,
GNOMEUIINFO_MENU_EXIT_ITEM(file_menu_exit_cb, NULL),
GNOMEUIINFO_END
};
/* These items are always present, but they're insensitive unless
* a component has merged a sensitive item over them.
* Except the undo item...
*/
static GnomeUIInfo edit_menu_info[] = {
GNOMEUIINFO_MENU_UNDO_ITEM(edit_menu_undo_callback, NULL),
GNOMEUIINFO_SEPARATOR,
GNOMEUIINFO_MENU_CUT_ITEM(edit_menu_cut_cb, NULL),
GNOMEUIINFO_MENU_COPY_ITEM(edit_menu_copy_cb, NULL),
GNOMEUIINFO_MENU_PASTE_ITEM(edit_menu_paste_cb, NULL),
GNOMEUIINFO_MENU_CLEAR_ITEM(edit_menu_clear_cb, NULL),
GNOMEUIINFO_SEPARATOR,
/* Didn't use standard SELECT_ALL_ITEM 'cuz it didn't have accelerator */
{
GNOME_APP_UI_ITEM,
N_("Select All"), NULL,
NULL, NULL, NULL,
GNOME_APP_PIXMAP_NONE, NULL,
'A', GDK_CONTROL_MASK, NULL
},
GNOMEUIINFO_END
};
static void
edit_menu_undo_callback (GtkWidget *widget, gpointer data)
edit_menu_undo_callback (BonoboUIHandler *ui_handler,
gpointer user_data,
const char *path)
{
if (nautilus_undo_manager_can_undo ())
nautilus_undo_manager_undo_last_transaction ();
}
static void
edit_menu_cut_cb (GtkWidget *widget,
gpointer data)
edit_menu_cut_callback (BonoboUIHandler *ui_handler,
gpointer user_data,
const char *path)
{
GtkWindow *main_window;
g_assert (GTK_IS_WINDOW (data));
main_window=GTK_WINDOW (data);
if (GTK_IS_EDITABLE (main_window->focus_widget)) {
g_assert (GTK_IS_WINDOW (user_data));
main_window=GTK_WINDOW (user_data);
if (GTK_IS_EDITABLE (main_window->focus_widget)) {
gtk_editable_cut_clipboard (GTK_EDITABLE (main_window->focus_widget));
}
}
static void
edit_menu_copy_cb (GtkWidget *widget,
gpointer data)
edit_menu_copy_callback (BonoboUIHandler *ui_handler,
gpointer user_data,
const char *path)
{
GtkWindow *main_window;
g_assert (GTK_IS_WINDOW (data));
main_window=GTK_WINDOW (data);
g_assert (GTK_IS_WINDOW (user_data));
main_window=GTK_WINDOW (user_data);
if (GTK_IS_EDITABLE (main_window->focus_widget)) {
gtk_editable_copy_clipboard (GTK_EDITABLE (main_window->focus_widget));
}
}
static void
edit_menu_paste_cb (GtkWidget *widget,
gpointer data)
edit_menu_paste_callback (BonoboUIHandler *ui_handler,
gpointer user_data,
const char *path)
{
GtkWindow *main_window;
main_window=GTK_WINDOW (data);
main_window=GTK_WINDOW (user_data);
if (GTK_IS_EDITABLE (main_window->focus_widget)) {
gtk_editable_paste_clipboard (GTK_EDITABLE (main_window->focus_widget));
}
@ -212,11 +168,12 @@ edit_menu_paste_cb (GtkWidget *widget,
static void
edit_menu_clear_cb (GtkWidget *widget,
gpointer data)
edit_menu_clear_callback (BonoboUIHandler *ui_handler,
gpointer user_data,
const char *path)
{
GtkWindow *main_window;
main_window=GTK_WINDOW (data);
main_window=GTK_WINDOW (user_data);
if (GTK_IS_EDITABLE (main_window->focus_widget)) {
/* A negative index deletes until the end of the string */
gtk_editable_delete_text (GTK_EDITABLE (main_window->focus_widget),0, -1);
@ -224,93 +181,74 @@ edit_menu_clear_cb (GtkWidget *widget,
}
static GnomeUIInfo go_menu_info[] = {
{
GNOME_APP_UI_ITEM,
N_("Back"), N_("Go to the previous visited location"),
nautilus_window_back_cb, NULL, NULL,
GNOME_APP_PIXMAP_NONE, NULL,
'B', GDK_CONTROL_MASK, NULL
},
{
GNOME_APP_UI_ITEM,
N_("Forward"), N_("Go to the next visited location"),
nautilus_window_forward_cb, NULL, NULL,
GNOME_APP_PIXMAP_NONE, NULL,
'F', GDK_CONTROL_MASK, NULL
},
{
GNOME_APP_UI_ITEM,
N_("Up"), N_("Go to the location that contains this one"),
nautilus_window_up_cb, NULL, NULL,
GNOME_APP_PIXMAP_NONE, NULL,
'U', GDK_CONTROL_MASK, NULL
},
{
GNOME_APP_UI_ITEM,
N_("Home"), N_("Go to the home location"),
nautilus_window_home_cb, NULL, NULL,
GNOME_APP_PIXMAP_NONE, NULL,
'H', GDK_CONTROL_MASK, NULL
},
GNOMEUIINFO_END
};
static void
add_bookmark_cb (GtkMenuItem* item, gpointer func_data)
go_menu_back_callback (BonoboUIHandler *ui_handler,
gpointer user_data,
const char *path)
{
g_return_if_fail(NAUTILUS_IS_WINDOW (func_data));
nautilus_window_add_bookmark_for_current_location (NAUTILUS_WINDOW (func_data));
}
/* handle the OK button being pushed on the color selector */
/* for now, just vanquish it, since it's only for testing */
static void
debug_color_confirm (GtkWidget *widget)
{
gtk_widget_destroy (gtk_widget_get_toplevel (widget));
}
static void
debug_menu_show_color_picker_cb (GtkWidget *btn, NautilusWindow *window)
{
GtkWidget *c;
c = gtk_color_selection_dialog_new (_("Color selector"));
gtk_signal_connect (GTK_OBJECT (GTK_COLOR_SELECTION_DIALOG (c)->ok_button),
"clicked", GTK_SIGNAL_FUNC (debug_color_confirm), c);
gtk_widget_hide (GTK_COLOR_SELECTION_DIALOG (c)->cancel_button);
gtk_widget_hide (GTK_COLOR_SELECTION_DIALOG (c)->help_button);
gtk_widget_show (c);
g_assert (NAUTILUS_IS_WINDOW (user_data));
nautilus_window_go_back (NAUTILUS_WINDOW (user_data));
}
static void
edit_bookmarks_cb(GtkMenuItem* item, gpointer user_data)
go_menu_forward_callback (BonoboUIHandler *ui_handler,
gpointer user_data,
const char *path)
{
g_assert (NAUTILUS_IS_WINDOW (user_data));
nautilus_window_go_forward (NAUTILUS_WINDOW (user_data));
}
static void
go_menu_up_callback (BonoboUIHandler *ui_handler,
gpointer user_data,
const char *path)
{
g_assert (NAUTILUS_IS_WINDOW (user_data));
nautilus_window_go_up (NAUTILUS_WINDOW (user_data));
}
static void
go_menu_home_callback (BonoboUIHandler *ui_handler,
gpointer user_data,
const char *path)
{
g_assert (NAUTILUS_IS_WINDOW (user_data));
nautilus_window_go_home (NAUTILUS_WINDOW (user_data));
}
static void
bookmarks_menu_add_bookmark_callback (BonoboUIHandler *ui_handler,
gpointer user_data,
const char *path)
{
g_return_if_fail(NAUTILUS_IS_WINDOW (user_data));
nautilus_window_add_bookmark_for_current_location (NAUTILUS_WINDOW (user_data));
}
static void
bookmarks_menu_edit_bookmarks_callback (BonoboUIHandler *ui_handler,
gpointer user_data,
const char *path)
{
g_return_if_fail (NAUTILUS_IS_WINDOW (user_data));
nautilus_window_edit_bookmarks (NAUTILUS_WINDOW (user_data));
}
static GnomeUIInfo bookmarks_menu_info[] = {
{
GNOME_APP_UI_ITEM,
N_("_Add Bookmark"),
N_("Add a bookmark for the current location to this menu."),
(gpointer)add_bookmark_cb, NULL, NULL,
GNOME_APP_PIXMAP_NONE, NULL, 0, (GdkModifierType) 0, NULL
},
GNOMEUIINFO_ITEM_NONE(N_("_Edit Bookmarks..."),
N_("Display a window that allows editing the bookmarks in this menu."),
edit_bookmarks_cb),
GNOMEUIINFO_END
};
static void
settings_menu_general_settings_callback (BonoboUIHandler *ui_handler,
gpointer user_data,
const char *path)
{
nautilus_global_preferences_show_dialog ();
}
static void
use_eazel_theme_icons_cb (GtkCheckMenuItem *item, gpointer user_data)
settings_menu_use_eazel_theme_icons_callback (BonoboUIHandler *ui_handler,
gpointer user_data,
const char *path)
{
char *current_theme;
char *new_theme;
@ -327,54 +265,61 @@ use_eazel_theme_icons_cb (GtkCheckMenuItem *item, gpointer user_data)
g_free (current_theme);
}
static GnomeUIInfo settings_menu_info[] = {
static void
help_menu_about_nautilus_callback (BonoboUIHandler *ui_handler,
gpointer user_data,
const char *path)
{
static GtkWidget *aboot = NULL;
if (aboot == NULL)
{
GNOME_APP_UI_ITEM,
N_("_General Settings..."), N_("Customize various aspects of Nautilus's appearance and behavior"),
general_settings_cb, NULL, NULL,
GNOME_APP_PIXMAP_NONE, NULL,
0, 0, NULL
},
GNOMEUIINFO_SEPARATOR,
{
GNOME_APP_UI_TOGGLEITEM,
N_("Use _Eazel Theme Icons"),
N_("Select whether to use standard or Eazel icons"),
use_eazel_theme_icons_cb, NULL, NULL,
GNOME_APP_PIXMAP_NONE, NULL,
0, (GdkModifierType)0, NULL
},
GNOMEUIINFO_END
};
const char *authors[] = {
"Darin Adler",
"Ramiro Estrugo",
"Andy Hertzfeld",
"Elliot Lee",
"Ettore Perazzoli",
"Maciej Stachowiak",
"John Sullivan",
NULL
};
static GnomeUIInfo help_menu_info[] = {
{
GNOME_APP_UI_ITEM,
N_("About Nautilus..."), N_("Info about the Nautilus program"),
nautilus_window_about_cb, NULL, NULL,
GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_ABOUT,
0, 0, NULL
},
GNOMEUIINFO_END
};
aboot = gnome_about_new(_("Nautilus"),
VERSION,
"Copyright (C) 1999, 2000",
authors,
_("The Cool Shell Program"),
"nautilus/nautilus3.jpg");
static GnomeUIInfo debug_menu_info [] = {
GNOMEUIINFO_ITEM_NONE (N_("Show Color selector..."), N_("Show the color picker window"), debug_menu_show_color_picker_cb),
GNOMEUIINFO_END
};
gnome_dialog_close_hides (GNOME_DIALOG (aboot), TRUE);
}
nautilus_gtk_window_present (GTK_WINDOW (aboot));
}
static GnomeUIInfo main_menu[] = {
GNOMEUIINFO_MENU_FILE_TREE (file_menu_info),
GNOMEUIINFO_MENU_EDIT_TREE (edit_menu_info),
GNOMEUIINFO_SUBTREE(N_("_Go"), go_menu_info),
GNOMEUIINFO_SUBTREE(N_("_Bookmarks"), bookmarks_menu_info),
GNOMEUIINFO_MENU_SETTINGS_TREE (settings_menu_info),
GNOMEUIINFO_MENU_HELP_TREE (help_menu_info),
GNOMEUIINFO_SUBTREE(N_("_Debug"), debug_menu_info),
GNOMEUIINFO_END
};
/* handle the OK button being pushed on the color selector */
/* for now, just vanquish it, since it's only for testing */
static void
debug_color_confirm (GtkWidget *widget)
{
gtk_widget_destroy (gtk_widget_get_toplevel (widget));
}
static void
debug_menu_show_color_picker_callback (BonoboUIHandler *ui_handler,
gpointer user_data,
const char *path)
{
GtkWidget *c;
c = gtk_color_selection_dialog_new (_("Color selector"));
gtk_signal_connect (GTK_OBJECT (GTK_COLOR_SELECTION_DIALOG (c)->ok_button),
"clicked", GTK_SIGNAL_FUNC (debug_color_confirm), c);
gtk_widget_hide (GTK_COLOR_SELECTION_DIALOG (c)->cancel_button);
gtk_widget_hide (GTK_COLOR_SELECTION_DIALOG (c)->help_button);
gtk_widget_show (c);
}
static void
activate_bookmark_in_menu_item (BonoboUIHandler *uih, gpointer user_data, const char *path)
@ -430,22 +375,6 @@ append_bookmark_to_menu (NautilusWindow *window,
g_free (name);
}
static void
append_separator_to_menu (NautilusWindow *window, const char *separator_path)
{
bonobo_ui_handler_menu_new_item (window->uih,
separator_path,
NULL,
NULL,
-1,
BONOBO_UI_HANDLER_PIXMAP_NONE,
NULL,
0,
0,
NULL,
NULL);
}
/**
* clear_appended_bookmark_items
*
@ -526,46 +455,6 @@ nautilus_bookmarks_exiting (void)
nautilus_bookmarks_window_save_geometry (get_bookmarks_window ());
}
/**
* nautilus_window_about_cb:
*
* Display about box, creating it first if necessary. Callback used when
* user selects "About Nautilus".
* @widget: ignored
* @window: ignored
**/
static void
nautilus_window_about_cb (GtkWidget *widget,
NautilusWindow *window)
{
static GtkWidget *aboot = NULL;
if (aboot == NULL)
{
const char *authors[] = {
"Darin Adler",
"Ramiro Estrugo",
"Andy Hertzfeld",
"Elliot Lee",
"Ettore Perazzoli",
"Maciej Stachowiak",
"John Sullivan",
NULL
};
aboot = gnome_about_new(_("Nautilus"),
VERSION,
"Copyright (C) 1999, 2000",
authors,
_("The Cool Shell Program"),
"nautilus/nautilus3.jpg");
gnome_dialog_close_hides (GNOME_DIALOG (aboot), TRUE);
}
nautilus_gtk_window_present (GTK_WINDOW (aboot));
}
/**
* nautilus_window_add_bookmark_for_current_location
*
@ -650,6 +539,33 @@ nautilus_window_initialize_go_menu (NautilusWindow *window)
}
static void
append_separator (NautilusWindow *window, const char *separator_path)
{
bonobo_ui_handler_menu_new_separator (window->uih,
separator_path,
-1);
}
static void
new_top_level_menu (NautilusWindow *window,
const char *menu_path,
const char *title)
{
/* Note that we don't bother with hints for menu titles.
* We can revisit this anytime if someone thinks they're useful.
*/
bonobo_ui_handler_menu_new_subtree (window->uih,
menu_path,
title,
NULL,
-1,
BONOBO_UI_HANDLER_PIXMAP_NONE,
NULL,
0,
0);
}
/**
* nautilus_window_initialize_menus
*
@ -660,25 +576,282 @@ void
nautilus_window_initialize_menus (NautilusWindow *window)
{
BonoboUIHandler *ui_handler;
BonoboUIHandlerMenuItem *menu_items;
ui_handler = window->uih;
g_assert (ui_handler != NULL);
bonobo_ui_handler_create_menubar (ui_handler);
/* Convert the menu items from their GnomeUIInfo form.
* Maybe we should eliminate this initial form altogether.
*/
menu_items = bonobo_ui_handler_menu_parse_uiinfo_list_with_data (main_menu, window);
bonobo_ui_handler_menu_add_list (ui_handler, "/", menu_items);
bonobo_ui_handler_menu_free_list (menu_items);
/* File menu */
new_top_level_menu (window, NAUTILUS_MENU_PATH_FILE_MENU, _("_File"));
bonobo_ui_handler_menu_new_item (ui_handler,
NAUTILUS_MENU_PATH_NEW_WINDOW_ITEM,
_("_New Window"),
_("Create a new window"),
-1,
BONOBO_UI_HANDLER_PIXMAP_STOCK,
GNOME_STOCK_MENU_NEW,
GNOME_KEY_NAME_NEW,
GNOME_KEY_MOD_NEW,
file_menu_new_window_callback,
window);
bonobo_ui_handler_menu_new_item (ui_handler,
NAUTILUS_MENU_PATH_CLOSE_ITEM,
_("_Close Window"),
_("Close this window"),
-1,
BONOBO_UI_HANDLER_PIXMAP_STOCK,
GNOME_STOCK_MENU_CLOSE,
GNOME_KEY_NAME_CLOSE,
GNOME_KEY_MOD_CLOSE,
file_menu_close_window_callback,
window);
append_separator (window, NAUTILUS_MENU_PATH_SEPARATOR_BEFORE_EXIT);
bonobo_ui_handler_menu_new_item (ui_handler,
NAUTILUS_MENU_PATH_EXIT_ITEM,
_("_Exit"),
_("Exit from Nautilus"),
-1,
BONOBO_UI_HANDLER_PIXMAP_STOCK,
GNOME_STOCK_MENU_EXIT,
GNOME_KEY_NAME_EXIT,
GNOME_KEY_MOD_EXIT,
file_menu_exit_callback,
NULL);
/* Edit menu */
new_top_level_menu (window, NAUTILUS_MENU_PATH_EDIT_MENU, _("_Edit"));
bonobo_ui_handler_menu_new_item (ui_handler,
NAUTILUS_MENU_PATH_UNDO_ITEM,
_("_Undo"),
_("Undo the last text change"),
-1,
BONOBO_UI_HANDLER_PIXMAP_STOCK,
GNOME_STOCK_MENU_UNDO,
GNOME_KEY_NAME_UNDO,
GNOME_KEY_MOD_UNDO,
edit_menu_undo_callback,
NULL);
append_separator (window, NAUTILUS_MENU_PATH_SEPARATOR_AFTER_UNDO);
bonobo_ui_handler_menu_new_item (ui_handler,
NAUTILUS_MENU_PATH_CUT_ITEM,
_("_Cut Text"),
_("Cuts the selected text to the clipboard"),
-1,
BONOBO_UI_HANDLER_PIXMAP_STOCK,
GNOME_STOCK_MENU_CUT,
GNOME_KEY_NAME_CUT,
GNOME_KEY_MOD_CUT,
edit_menu_cut_callback,
window);
bonobo_ui_handler_menu_new_item (ui_handler,
NAUTILUS_MENU_PATH_COPY_ITEM,
_("_Copy Text"),
_("Copies the selected text to the clipboard"),
-1,
BONOBO_UI_HANDLER_PIXMAP_STOCK,
GNOME_STOCK_MENU_COPY,
GNOME_KEY_NAME_COPY,
GNOME_KEY_MOD_COPY,
edit_menu_copy_callback,
window);
bonobo_ui_handler_menu_new_item (ui_handler,
NAUTILUS_MENU_PATH_PASTE_ITEM,
_("_Paste Text"),
_("Pastes the text stored on the clipboard"),
-1,
BONOBO_UI_HANDLER_PIXMAP_STOCK,
GNOME_STOCK_MENU_PASTE,
GNOME_KEY_NAME_PASTE,
GNOME_KEY_MOD_PASTE,
edit_menu_paste_callback,
window);
bonobo_ui_handler_menu_new_item (ui_handler,
NAUTILUS_MENU_PATH_CLEAR_ITEM,
_("C_lear Text"),
_("Removes the selected text without putting it on the clipboard"),
-1,
BONOBO_UI_HANDLER_PIXMAP_NONE,
NULL,
GNOME_KEY_NAME_CLEAR,
GNOME_KEY_MOD_CLEAR,
edit_menu_clear_callback,
window);
append_separator (window, NAUTILUS_MENU_PATH_SEPARATOR_AFTER_CLEAR);
bonobo_ui_handler_menu_new_item (ui_handler,
NAUTILUS_MENU_PATH_SELECT_ALL_ITEM,
_("_Select All"),
NULL, /* No hint since it's insensitive here */
-1,
BONOBO_UI_HANDLER_PIXMAP_NONE,
NULL,
'A', /* Keyboard shortcut applies to overriders too */
GDK_CONTROL_MASK,
NULL,
NULL);
/* Go menu */
new_top_level_menu (window, NAUTILUS_MENU_PATH_GO_MENU, _("_Go"));
bonobo_ui_handler_menu_new_item (ui_handler,
NAUTILUS_MENU_PATH_BACK_ITEM,
_("_Back"),
_("Go to the previous visited location"),
-1,
BONOBO_UI_HANDLER_PIXMAP_NONE,
NULL,
'B',
GDK_CONTROL_MASK,
go_menu_back_callback,
window);
bonobo_ui_handler_menu_new_item (ui_handler,
NAUTILUS_MENU_PATH_FORWARD_ITEM,
_("_Forward"),
_("Go to the next visited location"),
-1,
BONOBO_UI_HANDLER_PIXMAP_NONE,
NULL,
'F',
GDK_CONTROL_MASK,
go_menu_forward_callback,
window);
bonobo_ui_handler_menu_new_item (ui_handler,
NAUTILUS_MENU_PATH_UP_ITEM,
_("_Up"),
_("Go to the location that contains this one"),
-1,
BONOBO_UI_HANDLER_PIXMAP_NONE,
NULL,
'U',
GDK_CONTROL_MASK,
go_menu_up_callback,
window);
bonobo_ui_handler_menu_new_item (ui_handler,
NAUTILUS_MENU_PATH_HOME_ITEM,
_("_Home"),
_("Go to the home location"),
-1,
BONOBO_UI_HANDLER_PIXMAP_NONE,
NULL,
'H',
GDK_CONTROL_MASK,
go_menu_home_callback,
window);
append_separator (window, NAUTILUS_MENU_PATH_SEPARATOR_BEFORE_HISTORY);
/* Bookmarks */
new_top_level_menu (window, NAUTILUS_MENU_PATH_BOOKMARKS_MENU, _("_Bookmarks"));
bonobo_ui_handler_menu_new_item (ui_handler,
NAUTILUS_MENU_PATH_ADD_BOOKMARK_ITEM,
_("_Add Bookmark"),
_("Add a bookmark for the current location to this menu"),
-1,
BONOBO_UI_HANDLER_PIXMAP_NONE,
NULL,
0,
0,
bookmarks_menu_add_bookmark_callback,
window);
bonobo_ui_handler_menu_new_item (ui_handler,
NAUTILUS_MENU_PATH_EDIT_BOOKMARKS_ITEM,
_("_Edit Bookmarks..."),
_("Display a window that allows editing the bookmarks in this menu"),
-1,
BONOBO_UI_HANDLER_PIXMAP_NONE,
NULL,
0,
0,
bookmarks_menu_edit_bookmarks_callback,
window);
/* Settings */
new_top_level_menu (window, NAUTILUS_MENU_PATH_SETTINGS_MENU, _("_Settings"));
bonobo_ui_handler_menu_new_item (ui_handler,
NAUTILUS_MENU_PATH_GENERAL_SETTINGS_ITEM,
_("_General Settings..."),
_("Customize various aspects of Nautilus's appearance and behavior"),
-1,
BONOBO_UI_HANDLER_PIXMAP_NONE,
NULL,
0,
0,
settings_menu_general_settings_callback,
NULL);
/* It's called SEPARATOR_AFTER_USER_LEVELS because "General Settings" is
* going to expand into the user level choices plus the choice that brings
* up the user-level-details customizing dialog.
*/
append_separator (window, NAUTILUS_MENU_PATH_SEPARATOR_AFTER_USER_LEVELS);
bonobo_ui_handler_menu_new_toggleitem (ui_handler,
NAUTILUS_MENU_PATH_USE_EAZEL_THEME_ICONS_ITEM,
_("Use _Eazel Theme Icons"),
_("Select whether to use standard or Eazel icons"),
-1,
0,
0,
settings_menu_use_eazel_theme_icons_callback,
NULL);
/* Help */
new_top_level_menu (window, NAUTILUS_MENU_PATH_HELP_MENU, _("_Help"));
bonobo_ui_handler_menu_new_item (ui_handler,
NAUTILUS_MENU_PATH_ABOUT_ITEM,
_("_About Nautilus..."),
_("Displays information about the Nautilus program"),
-1,
BONOBO_UI_HANDLER_PIXMAP_STOCK,
GNOME_STOCK_MENU_ABOUT,
0,
0,
help_menu_about_nautilus_callback,
NULL);
/* Debug */
new_top_level_menu (window, NAUTILUS_MENU_PATH_DEBUG_MENU, _("_Debug"));
bonobo_ui_handler_menu_new_item (ui_handler,
NAUTILUS_MENU_PATH_SHOW_COLOR_SELECTOR_ITEM,
_("Show _Color selector..."),
_("Show the color picker window"),
-1,
BONOBO_UI_HANDLER_PIXMAP_NONE,
NULL,
0,
0,
debug_menu_show_color_picker_callback,
NULL);
/* Desensitize the items that aren't implemented at this level.
* Some (hopefully all) will be overridden by implementations by the
* different content views.
*/
bonobo_ui_handler_menu_set_sensitivity(ui_handler, "/Edit/Select All", FALSE);
bonobo_ui_handler_menu_set_sensitivity(ui_handler,
NAUTILUS_MENU_PATH_SELECT_ALL_ITEM,
FALSE);
/* Set initial toggle state of Eazel theme menu item */
update_eazel_theme_menu_item (window);
@ -712,13 +885,15 @@ refresh_bookmarks_in_bookmarks_menu (NautilusWindow *window)
bookmarks = get_bookmark_list ();
/* Remove old set of bookmarks. */
clear_appended_bookmark_items (window, "/Bookmarks", "/Bookmarks/Edit Bookmarks...");
clear_appended_bookmark_items (window,
NAUTILUS_MENU_PATH_BOOKMARKS_MENU,
NAUTILUS_MENU_PATH_EDIT_BOOKMARKS_ITEM);
bookmark_count = nautilus_bookmark_list_length (bookmarks);
/* Add separator before bookmarks, unless there are no bookmarks. */
if (bookmark_count > 0) {
append_separator_to_menu (window, "/Bookmarks/Separator");
append_separator (window, NAUTILUS_MENU_PATH_SEPARATOR_BEFORE_BOOKMARKS);
}
/* append new set of bookmarks */
@ -749,10 +924,9 @@ refresh_bookmarks_in_go_menu (NautilusWindow *window)
g_assert (NAUTILUS_IS_WINDOW (window));
/* Remove old set of history items. */
clear_appended_bookmark_items (window, "/Go", "/Go/Home");
/* Add separator before history items */
append_separator_to_menu (window, "/Go/Separator");
clear_appended_bookmark_items (window,
NAUTILUS_MENU_PATH_GO_MENU,
NAUTILUS_MENU_PATH_SEPARATOR_BEFORE_HISTORY);
/* Add in a new set of history items. */
index = 0;
@ -777,7 +951,7 @@ update_eazel_theme_menu_item (NautilusWindow *window)
/* Change the state of the menu item without invoking our callback function. */
nautilus_bonobo_ui_handler_menu_set_toggle_appearance (
window->uih,
"/Settings/Use Eazel Theme Icons",
NAUTILUS_MENU_PATH_USE_EAZEL_THEME_ICONS_ITEM,
nautilus_eat_strcmp (nautilus_preferences_get (NAUTILUS_PREFERENCES_ICON_THEME,
"default"),
"eazel") == 0);

View file

@ -37,7 +37,11 @@
#include "nautilus-location-bar.h"
#include "ntl-index-panel.h"
#include "ntl-miniicon.h"
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <libnautilus/nautilus-bonobo-ui.h>
#include <libnautilus-extensions/nautilus-gtk-extensions.h>
#include <libnautilus-extensions/nautilus-icon-factory.h>
#include <libnautilus-extensions/nautilus-metadata.h>
@ -803,13 +807,13 @@ nautilus_window_back_or_forward (NautilusWindow *window, gboolean back, guint di
}
void
nautilus_window_back_cb (GtkWidget *widget, NautilusWindow *window)
nautilus_window_go_back (NautilusWindow *window)
{
nautilus_window_back_or_forward (window, TRUE, 0);
}
void
nautilus_window_forward_cb (GtkWidget *widget, NautilusWindow *window)
nautilus_window_go_forward (NautilusWindow *window)
{
nautilus_window_back_or_forward (window, FALSE, 0);
}
@ -827,7 +831,7 @@ nautilus_window_get_uih(NautilusWindow *window)
}
void
nautilus_window_up_cb (GtkWidget *widget, NautilusWindow *window)
nautilus_window_go_up (NautilusWindow *window)
{
const char *requested_uri;
GnomeVFSURI *current_uri;
@ -850,7 +854,7 @@ nautilus_window_up_cb (GtkWidget *widget, NautilusWindow *window)
}
void
nautilus_window_home_cb (GtkWidget *widget, NautilusWindow *window)
nautilus_window_go_home (NautilusWindow *window)
{
nautilus_window_set_initial_state(window, NULL);
}
@ -860,21 +864,21 @@ void
nautilus_window_allow_back (NautilusWindow *window, gboolean allow)
{
gtk_widget_set_sensitive(window->back_button, allow);
bonobo_ui_handler_menu_set_sensitivity(window->uih, "/Go/Back", allow);
bonobo_ui_handler_menu_set_sensitivity(window->uih, NAUTILUS_MENU_PATH_BACK_ITEM, allow);
}
void
nautilus_window_allow_forward (NautilusWindow *window, gboolean allow)
{
gtk_widget_set_sensitive(window->forward_button, allow);
bonobo_ui_handler_menu_set_sensitivity(window->uih, "/Go/Forward", allow);
bonobo_ui_handler_menu_set_sensitivity(window->uih, NAUTILUS_MENU_PATH_FORWARD_ITEM, allow);
}
void
nautilus_window_allow_up (NautilusWindow *window, gboolean allow)
{
gtk_widget_set_sensitive(window->up_button, allow);
bonobo_ui_handler_menu_set_sensitivity(window->uih, "/Go/Up", allow);
bonobo_ui_handler_menu_set_sensitivity(window->uih, NAUTILUS_MENU_PATH_UP_ITEM, allow);
}
void

View file

@ -37,7 +37,11 @@
#include "nautilus-location-bar.h"
#include "ntl-index-panel.h"
#include "ntl-miniicon.h"
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <libnautilus/nautilus-bonobo-ui.h>
#include <libnautilus-extensions/nautilus-gtk-extensions.h>
#include <libnautilus-extensions/nautilus-icon-factory.h>
#include <libnautilus-extensions/nautilus-metadata.h>
@ -803,13 +807,13 @@ nautilus_window_back_or_forward (NautilusWindow *window, gboolean back, guint di
}
void
nautilus_window_back_cb (GtkWidget *widget, NautilusWindow *window)
nautilus_window_go_back (NautilusWindow *window)
{
nautilus_window_back_or_forward (window, TRUE, 0);
}
void
nautilus_window_forward_cb (GtkWidget *widget, NautilusWindow *window)
nautilus_window_go_forward (NautilusWindow *window)
{
nautilus_window_back_or_forward (window, FALSE, 0);
}
@ -827,7 +831,7 @@ nautilus_window_get_uih(NautilusWindow *window)
}
void
nautilus_window_up_cb (GtkWidget *widget, NautilusWindow *window)
nautilus_window_go_up (NautilusWindow *window)
{
const char *requested_uri;
GnomeVFSURI *current_uri;
@ -850,7 +854,7 @@ nautilus_window_up_cb (GtkWidget *widget, NautilusWindow *window)
}
void
nautilus_window_home_cb (GtkWidget *widget, NautilusWindow *window)
nautilus_window_go_home (NautilusWindow *window)
{
nautilus_window_set_initial_state(window, NULL);
}
@ -860,21 +864,21 @@ void
nautilus_window_allow_back (NautilusWindow *window, gboolean allow)
{
gtk_widget_set_sensitive(window->back_button, allow);
bonobo_ui_handler_menu_set_sensitivity(window->uih, "/Go/Back", allow);
bonobo_ui_handler_menu_set_sensitivity(window->uih, NAUTILUS_MENU_PATH_BACK_ITEM, allow);
}
void
nautilus_window_allow_forward (NautilusWindow *window, gboolean allow)
{
gtk_widget_set_sensitive(window->forward_button, allow);
bonobo_ui_handler_menu_set_sensitivity(window->uih, "/Go/Forward", allow);
bonobo_ui_handler_menu_set_sensitivity(window->uih, NAUTILUS_MENU_PATH_FORWARD_ITEM, allow);
}
void
nautilus_window_allow_up (NautilusWindow *window, gboolean allow)
{
gtk_widget_set_sensitive(window->up_button, allow);
bonobo_ui_handler_menu_set_sensitivity(window->uih, "/Go/Up", allow);
bonobo_ui_handler_menu_set_sensitivity(window->uih, NAUTILUS_MENU_PATH_UP_ITEM, allow);
}
void

View file

@ -37,7 +37,11 @@
#include "nautilus-location-bar.h"
#include "ntl-index-panel.h"
#include "ntl-miniicon.h"
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <libnautilus/nautilus-bonobo-ui.h>
#include <libnautilus-extensions/nautilus-gtk-extensions.h>
#include <libnautilus-extensions/nautilus-icon-factory.h>
#include <libnautilus-extensions/nautilus-metadata.h>
@ -803,13 +807,13 @@ nautilus_window_back_or_forward (NautilusWindow *window, gboolean back, guint di
}
void
nautilus_window_back_cb (GtkWidget *widget, NautilusWindow *window)
nautilus_window_go_back (NautilusWindow *window)
{
nautilus_window_back_or_forward (window, TRUE, 0);
}
void
nautilus_window_forward_cb (GtkWidget *widget, NautilusWindow *window)
nautilus_window_go_forward (NautilusWindow *window)
{
nautilus_window_back_or_forward (window, FALSE, 0);
}
@ -827,7 +831,7 @@ nautilus_window_get_uih(NautilusWindow *window)
}
void
nautilus_window_up_cb (GtkWidget *widget, NautilusWindow *window)
nautilus_window_go_up (NautilusWindow *window)
{
const char *requested_uri;
GnomeVFSURI *current_uri;
@ -850,7 +854,7 @@ nautilus_window_up_cb (GtkWidget *widget, NautilusWindow *window)
}
void
nautilus_window_home_cb (GtkWidget *widget, NautilusWindow *window)
nautilus_window_go_home (NautilusWindow *window)
{
nautilus_window_set_initial_state(window, NULL);
}
@ -860,21 +864,21 @@ void
nautilus_window_allow_back (NautilusWindow *window, gboolean allow)
{
gtk_widget_set_sensitive(window->back_button, allow);
bonobo_ui_handler_menu_set_sensitivity(window->uih, "/Go/Back", allow);
bonobo_ui_handler_menu_set_sensitivity(window->uih, NAUTILUS_MENU_PATH_BACK_ITEM, allow);
}
void
nautilus_window_allow_forward (NautilusWindow *window, gboolean allow)
{
gtk_widget_set_sensitive(window->forward_button, allow);
bonobo_ui_handler_menu_set_sensitivity(window->uih, "/Go/Forward", allow);
bonobo_ui_handler_menu_set_sensitivity(window->uih, NAUTILUS_MENU_PATH_FORWARD_ITEM, allow);
}
void
nautilus_window_allow_up (NautilusWindow *window, gboolean allow)
{
gtk_widget_set_sensitive(window->up_button, allow);
bonobo_ui_handler_menu_set_sensitivity(window->uih, "/Go/Up", allow);
bonobo_ui_handler_menu_set_sensitivity(window->uih, NAUTILUS_MENU_PATH_UP_ITEM, allow);
}
void

View file

@ -30,6 +30,8 @@
#include "ntl-window-private.h"
#include "libnautilus-extensions/nautilus-undo-manager.h"
#include <libnautilus/nautilus-bonobo-ui.h>
#include <libnautilus-extensions/nautilus-bonobo-extensions.h>
#include <libnautilus-extensions/nautilus-glib-extensions.h>
#include <libnautilus-extensions/nautilus-gtk-extensions.h>
@ -37,34 +39,18 @@
#include <libnautilus-extensions/nautilus-string.h>
#include <libnautilus-extensions/nautilus-global-preferences.h>
static void edit_menu_undo_callback (GtkWidget *widget,
gpointer data) ;
static void edit_menu_cut_cb (GtkWidget *widget,
gpointer data) ;
static void edit_menu_copy_cb (GtkWidget *widget,
gpointer data) ;
static void edit_menu_paste_cb (GtkWidget *widget,
gpointer data) ;
static void edit_menu_clear_cb (GtkWidget *widget,
gpointer data) ;
static void activate_bookmark_in_menu_item (BonoboUIHandler *uih,
gpointer user_data,
const char *path);
static void append_bookmark_to_menu (NautilusWindow *window,
const NautilusBookmark *bookmark,
const char *menu_item_path);
static void append_separator_to_menu (NautilusWindow *window,
const char *separator_path);
static void clear_appended_bookmark_items (NautilusWindow *window,
const char *menu_path,
const char *last_static_item_path);
static NautilusBookmarkList *get_bookmark_list (void);
static GtkWidget *get_bookmarks_window (void);
static void nautilus_window_about_cb (GtkWidget *widget,
NautilusWindow *window);
static void debug_menu_show_color_picker_cb (GtkWidget *widget,
NautilusWindow *window);
static void refresh_bookmarks_in_go_menu (NautilusWindow *window);
static void refresh_bookmarks_in_bookmarks_menu (NautilusWindow *window);
static void update_eazel_theme_menu_item (NautilusWindow *window);
@ -76,134 +62,104 @@ typedef struct {
NautilusWindow *window;
} BookmarkHolder;
/* Private menu definitions; others are in <libnautilus/nautilus-bonobo-ui.h>.
* These are not part of the published set, either because they are
* development-only (e.g. Debug) or because we expect to change them and
* don't want other code relying on their existence.
*/
#define NAUTILUS_MENU_PATH_GENERAL_SETTINGS_ITEM "/Settings/General Settings"
#define NAUTILUS_MENU_PATH_USE_EAZEL_THEME_ICONS_ITEM "/Settings/Use Eazel Theme Icons"
#define NAUTILUS_MENU_PATH_DEBUG_MENU "/Debug"
#define NAUTILUS_MENU_PATH_SHOW_COLOR_SELECTOR_ITEM "/Debug/Show Color Selector"
/* menu definitions */
static void
file_menu_close_cb (GtkWidget *widget,
gpointer data)
{
g_assert (NAUTILUS_IS_WINDOW (data));
nautilus_window_close (NAUTILUS_WINDOW (data));
}
static void
file_menu_new_window_cb (GtkWidget *widget,
gpointer data)
file_menu_new_window_callback (BonoboUIHandler *ui_handler,
gpointer user_data,
const char *path)
{
NautilusWindow *current_mainwin;
NautilusWindow *new_mainwin;
g_return_if_fail(NAUTILUS_IS_WINDOW(data));
g_return_if_fail (NAUTILUS_IS_WINDOW (user_data));
current_mainwin = NAUTILUS_WINDOW(data);
current_mainwin = NAUTILUS_WINDOW (user_data);
new_mainwin = nautilus_app_create_window(NAUTILUS_APP(current_mainwin->app));
new_mainwin = nautilus_app_create_window (NAUTILUS_APP (current_mainwin->app));
nautilus_window_goto_uri(new_mainwin,
nautilus_window_get_requested_uri(current_mainwin));
nautilus_window_goto_uri (new_mainwin,
nautilus_window_get_requested_uri (current_mainwin));
gtk_widget_show(GTK_WIDGET(new_mainwin));
gtk_widget_show (GTK_WIDGET (new_mainwin));
}
static void
file_menu_exit_cb (GtkWidget *widget,
gpointer data)
file_menu_close_window_callback (BonoboUIHandler *ui_handler,
gpointer user_data,
const char *path)
{
g_assert (NAUTILUS_IS_WINDOW (user_data));
nautilus_window_close (NAUTILUS_WINDOW (user_data));
}
static void
file_menu_exit_callback (BonoboUIHandler *ui_handler,
gpointer user_data,
const char *path)
{
gtk_main_quit ();
}
static void
general_settings_cb (GtkWidget *widget,
GtkWindow *mainwin)
{
nautilus_global_preferences_show_dialog ();
}
static GnomeUIInfo file_menu_info[] = {
{
GNOME_APP_UI_ITEM,
N_("New Window"), N_("Create a new window"),
file_menu_new_window_cb, NULL, NULL,
GNOME_APP_PIXMAP_NONE, NULL,
'N', GDK_CONTROL_MASK, NULL
},
GNOMEUIINFO_MENU_CLOSE_ITEM(file_menu_close_cb, NULL),
GNOMEUIINFO_SEPARATOR,
GNOMEUIINFO_MENU_EXIT_ITEM(file_menu_exit_cb, NULL),
GNOMEUIINFO_END
};
/* These items are always present, but they're insensitive unless
* a component has merged a sensitive item over them.
* Except the undo item...
*/
static GnomeUIInfo edit_menu_info[] = {
GNOMEUIINFO_MENU_UNDO_ITEM(edit_menu_undo_callback, NULL),
GNOMEUIINFO_SEPARATOR,
GNOMEUIINFO_MENU_CUT_ITEM(edit_menu_cut_cb, NULL),
GNOMEUIINFO_MENU_COPY_ITEM(edit_menu_copy_cb, NULL),
GNOMEUIINFO_MENU_PASTE_ITEM(edit_menu_paste_cb, NULL),
GNOMEUIINFO_MENU_CLEAR_ITEM(edit_menu_clear_cb, NULL),
GNOMEUIINFO_SEPARATOR,
/* Didn't use standard SELECT_ALL_ITEM 'cuz it didn't have accelerator */
{
GNOME_APP_UI_ITEM,
N_("Select All"), NULL,
NULL, NULL, NULL,
GNOME_APP_PIXMAP_NONE, NULL,
'A', GDK_CONTROL_MASK, NULL
},
GNOMEUIINFO_END
};
static void
edit_menu_undo_callback (GtkWidget *widget, gpointer data)
edit_menu_undo_callback (BonoboUIHandler *ui_handler,
gpointer user_data,
const char *path)
{
if (nautilus_undo_manager_can_undo ())
nautilus_undo_manager_undo_last_transaction ();
}
static void
edit_menu_cut_cb (GtkWidget *widget,
gpointer data)
edit_menu_cut_callback (BonoboUIHandler *ui_handler,
gpointer user_data,
const char *path)
{
GtkWindow *main_window;
g_assert (GTK_IS_WINDOW (data));
main_window=GTK_WINDOW (data);
if (GTK_IS_EDITABLE (main_window->focus_widget)) {
g_assert (GTK_IS_WINDOW (user_data));
main_window=GTK_WINDOW (user_data);
if (GTK_IS_EDITABLE (main_window->focus_widget)) {
gtk_editable_cut_clipboard (GTK_EDITABLE (main_window->focus_widget));
}
}
static void
edit_menu_copy_cb (GtkWidget *widget,
gpointer data)
edit_menu_copy_callback (BonoboUIHandler *ui_handler,
gpointer user_data,
const char *path)
{
GtkWindow *main_window;
g_assert (GTK_IS_WINDOW (data));
main_window=GTK_WINDOW (data);
g_assert (GTK_IS_WINDOW (user_data));
main_window=GTK_WINDOW (user_data);
if (GTK_IS_EDITABLE (main_window->focus_widget)) {
gtk_editable_copy_clipboard (GTK_EDITABLE (main_window->focus_widget));
}
}
static void
edit_menu_paste_cb (GtkWidget *widget,
gpointer data)
edit_menu_paste_callback (BonoboUIHandler *ui_handler,
gpointer user_data,
const char *path)
{
GtkWindow *main_window;
main_window=GTK_WINDOW (data);
main_window=GTK_WINDOW (user_data);
if (GTK_IS_EDITABLE (main_window->focus_widget)) {
gtk_editable_paste_clipboard (GTK_EDITABLE (main_window->focus_widget));
}
@ -212,11 +168,12 @@ edit_menu_paste_cb (GtkWidget *widget,
static void
edit_menu_clear_cb (GtkWidget *widget,
gpointer data)
edit_menu_clear_callback (BonoboUIHandler *ui_handler,
gpointer user_data,
const char *path)
{
GtkWindow *main_window;
main_window=GTK_WINDOW (data);
main_window=GTK_WINDOW (user_data);
if (GTK_IS_EDITABLE (main_window->focus_widget)) {
/* A negative index deletes until the end of the string */
gtk_editable_delete_text (GTK_EDITABLE (main_window->focus_widget),0, -1);
@ -224,93 +181,74 @@ edit_menu_clear_cb (GtkWidget *widget,
}
static GnomeUIInfo go_menu_info[] = {
{
GNOME_APP_UI_ITEM,
N_("Back"), N_("Go to the previous visited location"),
nautilus_window_back_cb, NULL, NULL,
GNOME_APP_PIXMAP_NONE, NULL,
'B', GDK_CONTROL_MASK, NULL
},
{
GNOME_APP_UI_ITEM,
N_("Forward"), N_("Go to the next visited location"),
nautilus_window_forward_cb, NULL, NULL,
GNOME_APP_PIXMAP_NONE, NULL,
'F', GDK_CONTROL_MASK, NULL
},
{
GNOME_APP_UI_ITEM,
N_("Up"), N_("Go to the location that contains this one"),
nautilus_window_up_cb, NULL, NULL,
GNOME_APP_PIXMAP_NONE, NULL,
'U', GDK_CONTROL_MASK, NULL
},
{
GNOME_APP_UI_ITEM,
N_("Home"), N_("Go to the home location"),
nautilus_window_home_cb, NULL, NULL,
GNOME_APP_PIXMAP_NONE, NULL,
'H', GDK_CONTROL_MASK, NULL
},
GNOMEUIINFO_END
};
static void
add_bookmark_cb (GtkMenuItem* item, gpointer func_data)
go_menu_back_callback (BonoboUIHandler *ui_handler,
gpointer user_data,
const char *path)
{
g_return_if_fail(NAUTILUS_IS_WINDOW (func_data));
nautilus_window_add_bookmark_for_current_location (NAUTILUS_WINDOW (func_data));
}
/* handle the OK button being pushed on the color selector */
/* for now, just vanquish it, since it's only for testing */
static void
debug_color_confirm (GtkWidget *widget)
{
gtk_widget_destroy (gtk_widget_get_toplevel (widget));
}
static void
debug_menu_show_color_picker_cb (GtkWidget *btn, NautilusWindow *window)
{
GtkWidget *c;
c = gtk_color_selection_dialog_new (_("Color selector"));
gtk_signal_connect (GTK_OBJECT (GTK_COLOR_SELECTION_DIALOG (c)->ok_button),
"clicked", GTK_SIGNAL_FUNC (debug_color_confirm), c);
gtk_widget_hide (GTK_COLOR_SELECTION_DIALOG (c)->cancel_button);
gtk_widget_hide (GTK_COLOR_SELECTION_DIALOG (c)->help_button);
gtk_widget_show (c);
g_assert (NAUTILUS_IS_WINDOW (user_data));
nautilus_window_go_back (NAUTILUS_WINDOW (user_data));
}
static void
edit_bookmarks_cb(GtkMenuItem* item, gpointer user_data)
go_menu_forward_callback (BonoboUIHandler *ui_handler,
gpointer user_data,
const char *path)
{
g_assert (NAUTILUS_IS_WINDOW (user_data));
nautilus_window_go_forward (NAUTILUS_WINDOW (user_data));
}
static void
go_menu_up_callback (BonoboUIHandler *ui_handler,
gpointer user_data,
const char *path)
{
g_assert (NAUTILUS_IS_WINDOW (user_data));
nautilus_window_go_up (NAUTILUS_WINDOW (user_data));
}
static void
go_menu_home_callback (BonoboUIHandler *ui_handler,
gpointer user_data,
const char *path)
{
g_assert (NAUTILUS_IS_WINDOW (user_data));
nautilus_window_go_home (NAUTILUS_WINDOW (user_data));
}
static void
bookmarks_menu_add_bookmark_callback (BonoboUIHandler *ui_handler,
gpointer user_data,
const char *path)
{
g_return_if_fail(NAUTILUS_IS_WINDOW (user_data));
nautilus_window_add_bookmark_for_current_location (NAUTILUS_WINDOW (user_data));
}
static void
bookmarks_menu_edit_bookmarks_callback (BonoboUIHandler *ui_handler,
gpointer user_data,
const char *path)
{
g_return_if_fail (NAUTILUS_IS_WINDOW (user_data));
nautilus_window_edit_bookmarks (NAUTILUS_WINDOW (user_data));
}
static GnomeUIInfo bookmarks_menu_info[] = {
{
GNOME_APP_UI_ITEM,
N_("_Add Bookmark"),
N_("Add a bookmark for the current location to this menu."),
(gpointer)add_bookmark_cb, NULL, NULL,
GNOME_APP_PIXMAP_NONE, NULL, 0, (GdkModifierType) 0, NULL
},
GNOMEUIINFO_ITEM_NONE(N_("_Edit Bookmarks..."),
N_("Display a window that allows editing the bookmarks in this menu."),
edit_bookmarks_cb),
GNOMEUIINFO_END
};
static void
settings_menu_general_settings_callback (BonoboUIHandler *ui_handler,
gpointer user_data,
const char *path)
{
nautilus_global_preferences_show_dialog ();
}
static void
use_eazel_theme_icons_cb (GtkCheckMenuItem *item, gpointer user_data)
settings_menu_use_eazel_theme_icons_callback (BonoboUIHandler *ui_handler,
gpointer user_data,
const char *path)
{
char *current_theme;
char *new_theme;
@ -327,54 +265,61 @@ use_eazel_theme_icons_cb (GtkCheckMenuItem *item, gpointer user_data)
g_free (current_theme);
}
static GnomeUIInfo settings_menu_info[] = {
static void
help_menu_about_nautilus_callback (BonoboUIHandler *ui_handler,
gpointer user_data,
const char *path)
{
static GtkWidget *aboot = NULL;
if (aboot == NULL)
{
GNOME_APP_UI_ITEM,
N_("_General Settings..."), N_("Customize various aspects of Nautilus's appearance and behavior"),
general_settings_cb, NULL, NULL,
GNOME_APP_PIXMAP_NONE, NULL,
0, 0, NULL
},
GNOMEUIINFO_SEPARATOR,
{
GNOME_APP_UI_TOGGLEITEM,
N_("Use _Eazel Theme Icons"),
N_("Select whether to use standard or Eazel icons"),
use_eazel_theme_icons_cb, NULL, NULL,
GNOME_APP_PIXMAP_NONE, NULL,
0, (GdkModifierType)0, NULL
},
GNOMEUIINFO_END
};
const char *authors[] = {
"Darin Adler",
"Ramiro Estrugo",
"Andy Hertzfeld",
"Elliot Lee",
"Ettore Perazzoli",
"Maciej Stachowiak",
"John Sullivan",
NULL
};
static GnomeUIInfo help_menu_info[] = {
{
GNOME_APP_UI_ITEM,
N_("About Nautilus..."), N_("Info about the Nautilus program"),
nautilus_window_about_cb, NULL, NULL,
GNOME_APP_PIXMAP_STOCK, GNOME_STOCK_MENU_ABOUT,
0, 0, NULL
},
GNOMEUIINFO_END
};
aboot = gnome_about_new(_("Nautilus"),
VERSION,
"Copyright (C) 1999, 2000",
authors,
_("The Cool Shell Program"),
"nautilus/nautilus3.jpg");
static GnomeUIInfo debug_menu_info [] = {
GNOMEUIINFO_ITEM_NONE (N_("Show Color selector..."), N_("Show the color picker window"), debug_menu_show_color_picker_cb),
GNOMEUIINFO_END
};
gnome_dialog_close_hides (GNOME_DIALOG (aboot), TRUE);
}
nautilus_gtk_window_present (GTK_WINDOW (aboot));
}
static GnomeUIInfo main_menu[] = {
GNOMEUIINFO_MENU_FILE_TREE (file_menu_info),
GNOMEUIINFO_MENU_EDIT_TREE (edit_menu_info),
GNOMEUIINFO_SUBTREE(N_("_Go"), go_menu_info),
GNOMEUIINFO_SUBTREE(N_("_Bookmarks"), bookmarks_menu_info),
GNOMEUIINFO_MENU_SETTINGS_TREE (settings_menu_info),
GNOMEUIINFO_MENU_HELP_TREE (help_menu_info),
GNOMEUIINFO_SUBTREE(N_("_Debug"), debug_menu_info),
GNOMEUIINFO_END
};
/* handle the OK button being pushed on the color selector */
/* for now, just vanquish it, since it's only for testing */
static void
debug_color_confirm (GtkWidget *widget)
{
gtk_widget_destroy (gtk_widget_get_toplevel (widget));
}
static void
debug_menu_show_color_picker_callback (BonoboUIHandler *ui_handler,
gpointer user_data,
const char *path)
{
GtkWidget *c;
c = gtk_color_selection_dialog_new (_("Color selector"));
gtk_signal_connect (GTK_OBJECT (GTK_COLOR_SELECTION_DIALOG (c)->ok_button),
"clicked", GTK_SIGNAL_FUNC (debug_color_confirm), c);
gtk_widget_hide (GTK_COLOR_SELECTION_DIALOG (c)->cancel_button);
gtk_widget_hide (GTK_COLOR_SELECTION_DIALOG (c)->help_button);
gtk_widget_show (c);
}
static void
activate_bookmark_in_menu_item (BonoboUIHandler *uih, gpointer user_data, const char *path)
@ -430,22 +375,6 @@ append_bookmark_to_menu (NautilusWindow *window,
g_free (name);
}
static void
append_separator_to_menu (NautilusWindow *window, const char *separator_path)
{
bonobo_ui_handler_menu_new_item (window->uih,
separator_path,
NULL,
NULL,
-1,
BONOBO_UI_HANDLER_PIXMAP_NONE,
NULL,
0,
0,
NULL,
NULL);
}
/**
* clear_appended_bookmark_items
*
@ -526,46 +455,6 @@ nautilus_bookmarks_exiting (void)
nautilus_bookmarks_window_save_geometry (get_bookmarks_window ());
}
/**
* nautilus_window_about_cb:
*
* Display about box, creating it first if necessary. Callback used when
* user selects "About Nautilus".
* @widget: ignored
* @window: ignored
**/
static void
nautilus_window_about_cb (GtkWidget *widget,
NautilusWindow *window)
{
static GtkWidget *aboot = NULL;
if (aboot == NULL)
{
const char *authors[] = {
"Darin Adler",
"Ramiro Estrugo",
"Andy Hertzfeld",
"Elliot Lee",
"Ettore Perazzoli",
"Maciej Stachowiak",
"John Sullivan",
NULL
};
aboot = gnome_about_new(_("Nautilus"),
VERSION,
"Copyright (C) 1999, 2000",
authors,
_("The Cool Shell Program"),
"nautilus/nautilus3.jpg");
gnome_dialog_close_hides (GNOME_DIALOG (aboot), TRUE);
}
nautilus_gtk_window_present (GTK_WINDOW (aboot));
}
/**
* nautilus_window_add_bookmark_for_current_location
*
@ -650,6 +539,33 @@ nautilus_window_initialize_go_menu (NautilusWindow *window)
}
static void
append_separator (NautilusWindow *window, const char *separator_path)
{
bonobo_ui_handler_menu_new_separator (window->uih,
separator_path,
-1);
}
static void
new_top_level_menu (NautilusWindow *window,
const char *menu_path,
const char *title)
{
/* Note that we don't bother with hints for menu titles.
* We can revisit this anytime if someone thinks they're useful.
*/
bonobo_ui_handler_menu_new_subtree (window->uih,
menu_path,
title,
NULL,
-1,
BONOBO_UI_HANDLER_PIXMAP_NONE,
NULL,
0,
0);
}
/**
* nautilus_window_initialize_menus
*
@ -660,25 +576,282 @@ void
nautilus_window_initialize_menus (NautilusWindow *window)
{
BonoboUIHandler *ui_handler;
BonoboUIHandlerMenuItem *menu_items;
ui_handler = window->uih;
g_assert (ui_handler != NULL);
bonobo_ui_handler_create_menubar (ui_handler);
/* Convert the menu items from their GnomeUIInfo form.
* Maybe we should eliminate this initial form altogether.
*/
menu_items = bonobo_ui_handler_menu_parse_uiinfo_list_with_data (main_menu, window);
bonobo_ui_handler_menu_add_list (ui_handler, "/", menu_items);
bonobo_ui_handler_menu_free_list (menu_items);
/* File menu */
new_top_level_menu (window, NAUTILUS_MENU_PATH_FILE_MENU, _("_File"));
bonobo_ui_handler_menu_new_item (ui_handler,
NAUTILUS_MENU_PATH_NEW_WINDOW_ITEM,
_("_New Window"),
_("Create a new window"),
-1,
BONOBO_UI_HANDLER_PIXMAP_STOCK,
GNOME_STOCK_MENU_NEW,
GNOME_KEY_NAME_NEW,
GNOME_KEY_MOD_NEW,
file_menu_new_window_callback,
window);
bonobo_ui_handler_menu_new_item (ui_handler,
NAUTILUS_MENU_PATH_CLOSE_ITEM,
_("_Close Window"),
_("Close this window"),
-1,
BONOBO_UI_HANDLER_PIXMAP_STOCK,
GNOME_STOCK_MENU_CLOSE,
GNOME_KEY_NAME_CLOSE,
GNOME_KEY_MOD_CLOSE,
file_menu_close_window_callback,
window);
append_separator (window, NAUTILUS_MENU_PATH_SEPARATOR_BEFORE_EXIT);
bonobo_ui_handler_menu_new_item (ui_handler,
NAUTILUS_MENU_PATH_EXIT_ITEM,
_("_Exit"),
_("Exit from Nautilus"),
-1,
BONOBO_UI_HANDLER_PIXMAP_STOCK,
GNOME_STOCK_MENU_EXIT,
GNOME_KEY_NAME_EXIT,
GNOME_KEY_MOD_EXIT,
file_menu_exit_callback,
NULL);
/* Edit menu */
new_top_level_menu (window, NAUTILUS_MENU_PATH_EDIT_MENU, _("_Edit"));
bonobo_ui_handler_menu_new_item (ui_handler,
NAUTILUS_MENU_PATH_UNDO_ITEM,
_("_Undo"),
_("Undo the last text change"),
-1,
BONOBO_UI_HANDLER_PIXMAP_STOCK,
GNOME_STOCK_MENU_UNDO,
GNOME_KEY_NAME_UNDO,
GNOME_KEY_MOD_UNDO,
edit_menu_undo_callback,
NULL);
append_separator (window, NAUTILUS_MENU_PATH_SEPARATOR_AFTER_UNDO);
bonobo_ui_handler_menu_new_item (ui_handler,
NAUTILUS_MENU_PATH_CUT_ITEM,
_("_Cut Text"),
_("Cuts the selected text to the clipboard"),
-1,
BONOBO_UI_HANDLER_PIXMAP_STOCK,
GNOME_STOCK_MENU_CUT,
GNOME_KEY_NAME_CUT,
GNOME_KEY_MOD_CUT,
edit_menu_cut_callback,
window);
bonobo_ui_handler_menu_new_item (ui_handler,
NAUTILUS_MENU_PATH_COPY_ITEM,
_("_Copy Text"),
_("Copies the selected text to the clipboard"),
-1,
BONOBO_UI_HANDLER_PIXMAP_STOCK,
GNOME_STOCK_MENU_COPY,
GNOME_KEY_NAME_COPY,
GNOME_KEY_MOD_COPY,
edit_menu_copy_callback,
window);
bonobo_ui_handler_menu_new_item (ui_handler,
NAUTILUS_MENU_PATH_PASTE_ITEM,
_("_Paste Text"),
_("Pastes the text stored on the clipboard"),
-1,
BONOBO_UI_HANDLER_PIXMAP_STOCK,
GNOME_STOCK_MENU_PASTE,
GNOME_KEY_NAME_PASTE,
GNOME_KEY_MOD_PASTE,
edit_menu_paste_callback,
window);
bonobo_ui_handler_menu_new_item (ui_handler,
NAUTILUS_MENU_PATH_CLEAR_ITEM,
_("C_lear Text"),
_("Removes the selected text without putting it on the clipboard"),
-1,
BONOBO_UI_HANDLER_PIXMAP_NONE,
NULL,
GNOME_KEY_NAME_CLEAR,
GNOME_KEY_MOD_CLEAR,
edit_menu_clear_callback,
window);
append_separator (window, NAUTILUS_MENU_PATH_SEPARATOR_AFTER_CLEAR);
bonobo_ui_handler_menu_new_item (ui_handler,
NAUTILUS_MENU_PATH_SELECT_ALL_ITEM,
_("_Select All"),
NULL, /* No hint since it's insensitive here */
-1,
BONOBO_UI_HANDLER_PIXMAP_NONE,
NULL,
'A', /* Keyboard shortcut applies to overriders too */
GDK_CONTROL_MASK,
NULL,
NULL);
/* Go menu */
new_top_level_menu (window, NAUTILUS_MENU_PATH_GO_MENU, _("_Go"));
bonobo_ui_handler_menu_new_item (ui_handler,
NAUTILUS_MENU_PATH_BACK_ITEM,
_("_Back"),
_("Go to the previous visited location"),
-1,
BONOBO_UI_HANDLER_PIXMAP_NONE,
NULL,
'B',
GDK_CONTROL_MASK,
go_menu_back_callback,
window);
bonobo_ui_handler_menu_new_item (ui_handler,
NAUTILUS_MENU_PATH_FORWARD_ITEM,
_("_Forward"),
_("Go to the next visited location"),
-1,
BONOBO_UI_HANDLER_PIXMAP_NONE,
NULL,
'F',
GDK_CONTROL_MASK,
go_menu_forward_callback,
window);
bonobo_ui_handler_menu_new_item (ui_handler,
NAUTILUS_MENU_PATH_UP_ITEM,
_("_Up"),
_("Go to the location that contains this one"),
-1,
BONOBO_UI_HANDLER_PIXMAP_NONE,
NULL,
'U',
GDK_CONTROL_MASK,
go_menu_up_callback,
window);
bonobo_ui_handler_menu_new_item (ui_handler,
NAUTILUS_MENU_PATH_HOME_ITEM,
_("_Home"),
_("Go to the home location"),
-1,
BONOBO_UI_HANDLER_PIXMAP_NONE,
NULL,
'H',
GDK_CONTROL_MASK,
go_menu_home_callback,
window);
append_separator (window, NAUTILUS_MENU_PATH_SEPARATOR_BEFORE_HISTORY);
/* Bookmarks */
new_top_level_menu (window, NAUTILUS_MENU_PATH_BOOKMARKS_MENU, _("_Bookmarks"));
bonobo_ui_handler_menu_new_item (ui_handler,
NAUTILUS_MENU_PATH_ADD_BOOKMARK_ITEM,
_("_Add Bookmark"),
_("Add a bookmark for the current location to this menu"),
-1,
BONOBO_UI_HANDLER_PIXMAP_NONE,
NULL,
0,
0,
bookmarks_menu_add_bookmark_callback,
window);
bonobo_ui_handler_menu_new_item (ui_handler,
NAUTILUS_MENU_PATH_EDIT_BOOKMARKS_ITEM,
_("_Edit Bookmarks..."),
_("Display a window that allows editing the bookmarks in this menu"),
-1,
BONOBO_UI_HANDLER_PIXMAP_NONE,
NULL,
0,
0,
bookmarks_menu_edit_bookmarks_callback,
window);
/* Settings */
new_top_level_menu (window, NAUTILUS_MENU_PATH_SETTINGS_MENU, _("_Settings"));
bonobo_ui_handler_menu_new_item (ui_handler,
NAUTILUS_MENU_PATH_GENERAL_SETTINGS_ITEM,
_("_General Settings..."),
_("Customize various aspects of Nautilus's appearance and behavior"),
-1,
BONOBO_UI_HANDLER_PIXMAP_NONE,
NULL,
0,
0,
settings_menu_general_settings_callback,
NULL);
/* It's called SEPARATOR_AFTER_USER_LEVELS because "General Settings" is
* going to expand into the user level choices plus the choice that brings
* up the user-level-details customizing dialog.
*/
append_separator (window, NAUTILUS_MENU_PATH_SEPARATOR_AFTER_USER_LEVELS);
bonobo_ui_handler_menu_new_toggleitem (ui_handler,
NAUTILUS_MENU_PATH_USE_EAZEL_THEME_ICONS_ITEM,
_("Use _Eazel Theme Icons"),
_("Select whether to use standard or Eazel icons"),
-1,
0,
0,
settings_menu_use_eazel_theme_icons_callback,
NULL);
/* Help */
new_top_level_menu (window, NAUTILUS_MENU_PATH_HELP_MENU, _("_Help"));
bonobo_ui_handler_menu_new_item (ui_handler,
NAUTILUS_MENU_PATH_ABOUT_ITEM,
_("_About Nautilus..."),
_("Displays information about the Nautilus program"),
-1,
BONOBO_UI_HANDLER_PIXMAP_STOCK,
GNOME_STOCK_MENU_ABOUT,
0,
0,
help_menu_about_nautilus_callback,
NULL);
/* Debug */
new_top_level_menu (window, NAUTILUS_MENU_PATH_DEBUG_MENU, _("_Debug"));
bonobo_ui_handler_menu_new_item (ui_handler,
NAUTILUS_MENU_PATH_SHOW_COLOR_SELECTOR_ITEM,
_("Show _Color selector..."),
_("Show the color picker window"),
-1,
BONOBO_UI_HANDLER_PIXMAP_NONE,
NULL,
0,
0,
debug_menu_show_color_picker_callback,
NULL);
/* Desensitize the items that aren't implemented at this level.
* Some (hopefully all) will be overridden by implementations by the
* different content views.
*/
bonobo_ui_handler_menu_set_sensitivity(ui_handler, "/Edit/Select All", FALSE);
bonobo_ui_handler_menu_set_sensitivity(ui_handler,
NAUTILUS_MENU_PATH_SELECT_ALL_ITEM,
FALSE);
/* Set initial toggle state of Eazel theme menu item */
update_eazel_theme_menu_item (window);
@ -712,13 +885,15 @@ refresh_bookmarks_in_bookmarks_menu (NautilusWindow *window)
bookmarks = get_bookmark_list ();
/* Remove old set of bookmarks. */
clear_appended_bookmark_items (window, "/Bookmarks", "/Bookmarks/Edit Bookmarks...");
clear_appended_bookmark_items (window,
NAUTILUS_MENU_PATH_BOOKMARKS_MENU,
NAUTILUS_MENU_PATH_EDIT_BOOKMARKS_ITEM);
bookmark_count = nautilus_bookmark_list_length (bookmarks);
/* Add separator before bookmarks, unless there are no bookmarks. */
if (bookmark_count > 0) {
append_separator_to_menu (window, "/Bookmarks/Separator");
append_separator (window, NAUTILUS_MENU_PATH_SEPARATOR_BEFORE_BOOKMARKS);
}
/* append new set of bookmarks */
@ -749,10 +924,9 @@ refresh_bookmarks_in_go_menu (NautilusWindow *window)
g_assert (NAUTILUS_IS_WINDOW (window));
/* Remove old set of history items. */
clear_appended_bookmark_items (window, "/Go", "/Go/Home");
/* Add separator before history items */
append_separator_to_menu (window, "/Go/Separator");
clear_appended_bookmark_items (window,
NAUTILUS_MENU_PATH_GO_MENU,
NAUTILUS_MENU_PATH_SEPARATOR_BEFORE_HISTORY);
/* Add in a new set of history items. */
index = 0;
@ -777,7 +951,7 @@ update_eazel_theme_menu_item (NautilusWindow *window)
/* Change the state of the menu item without invoking our callback function. */
nautilus_bonobo_ui_handler_menu_set_toggle_appearance (
window->uih,
"/Settings/Use Eazel Theme Icons",
NAUTILUS_MENU_PATH_USE_EAZEL_THEME_ICONS_ITEM,
nautilus_eat_strcmp (nautilus_preferences_get (NAUTILUS_PREFERENCES_ICON_THEME,
"default"),
"eazel") == 0);

View file

@ -63,9 +63,9 @@ void nautilus_window_edit_bookmarks (NautilusWindow *window);
void nautilus_window_initialize_menus (NautilusWindow *window);
void nautilus_window_initialize_toolbars (NautilusWindow *window);
void nautilus_window_back_cb (GtkWidget *widget, NautilusWindow *window);
void nautilus_window_forward_cb (GtkWidget *widget, NautilusWindow *window);
void nautilus_window_up_cb (GtkWidget *widget, NautilusWindow *window);
void nautilus_window_home_cb (GtkWidget *widget, NautilusWindow *window);
void nautilus_window_go_back (NautilusWindow *window);
void nautilus_window_go_forward (NautilusWindow *window);
void nautilus_window_go_up (NautilusWindow *window);
void nautilus_window_go_home (NautilusWindow *window);
#endif

View file

@ -31,8 +31,8 @@
#include <libnautilus-extensions/nautilus-gtk-extensions.h>
/* forward declarations */
static void nautilus_window_reload_cb (GtkWidget *widget, NautilusWindow *window);
static void nautilus_window_stop_cb (GtkWidget *widget, NautilusWindow *window);
static void toolbar_reload_callback (GtkWidget *widget, NautilusWindow *window);
static void toolbar_stop_callback (GtkWidget *widget, NautilusWindow *window);
/* toolbar definitions */
@ -46,27 +46,53 @@ static void nautilus_window_stop_cb (GtkWidget *widget, NautilusWindow *window);
/* separator */
#define TOOLBAR_STOP_BUTTON_INDEX 7
static void
toolbar_back_callback (GtkWidget *widget, NautilusWindow *window)
{
nautilus_window_go_back (window);
}
static void
toolbar_forward_callback (GtkWidget *widget, NautilusWindow *window)
{
nautilus_window_go_forward (window);
}
static void
toolbar_up_callback (GtkWidget *widget, NautilusWindow *window)
{
nautilus_window_go_up (window);
}
static void
toolbar_home_callback (GtkWidget *widget, NautilusWindow *window)
{
nautilus_window_go_home (window);
}
static GnomeUIInfo toolbar_info[] = {
GNOMEUIINFO_ITEM_STOCK
(N_("Back"), N_("Go to the previously visited directory"),
nautilus_window_back_cb, GNOME_STOCK_PIXMAP_BACK),
toolbar_back_callback, GNOME_STOCK_PIXMAP_BACK),
GNOMEUIINFO_ITEM_STOCK
(N_("Forward"), N_("Go to the next directory"),
nautilus_window_forward_cb, GNOME_STOCK_PIXMAP_FORWARD),
toolbar_forward_callback, GNOME_STOCK_PIXMAP_FORWARD),
GNOMEUIINFO_ITEM_STOCK
(N_("Up"), N_("Go up a level in the directory heirarchy"),
nautilus_window_up_cb, GNOME_STOCK_PIXMAP_UP),
toolbar_up_callback, GNOME_STOCK_PIXMAP_UP),
GNOMEUIINFO_ITEM_STOCK
(N_("Reload"), N_("Reload this view"),
nautilus_window_reload_cb, GNOME_STOCK_PIXMAP_REFRESH),
toolbar_reload_callback, GNOME_STOCK_PIXMAP_REFRESH),
GNOMEUIINFO_SEPARATOR,
GNOMEUIINFO_ITEM_STOCK
(N_("Home"), N_("Go to your home directory"),
nautilus_window_home_cb, GNOME_STOCK_PIXMAP_HOME),
toolbar_home_callback, GNOME_STOCK_PIXMAP_HOME),
GNOMEUIINFO_SEPARATOR,
GNOMEUIINFO_ITEM_STOCK
(N_("Stop"), N_("Interrupt loading"),
nautilus_window_stop_cb, GNOME_STOCK_PIXMAP_STOP),
toolbar_stop_callback, GNOME_STOCK_PIXMAP_STOP),
GNOMEUIINFO_END
};
@ -85,13 +111,13 @@ activate_back_or_forward_menu_item (GtkMenuItem *menu_item,
}
static void
activate_back_menu_item_cb (GtkMenuItem *menu_item, NautilusWindow *window)
activate_back_menu_item_callback (GtkMenuItem *menu_item, NautilusWindow *window)
{
activate_back_or_forward_menu_item (menu_item, window, TRUE);
}
static void
activate_forward_menu_item_cb (GtkMenuItem *menu_item, NautilusWindow *window)
activate_forward_menu_item_callback (GtkMenuItem *menu_item, NautilusWindow *window)
{
activate_back_or_forward_menu_item (menu_item, window, FALSE);
}
@ -117,7 +143,7 @@ create_back_or_forward_menu (NautilusWindow *window, gboolean back)
gtk_widget_show (GTK_WIDGET (menu_item));
gtk_signal_connect(GTK_OBJECT(menu_item),
"activate",
back ? activate_back_menu_item_cb : activate_forward_menu_item_cb,
back ? activate_back_menu_item_callback : activate_forward_menu_item_callback,
window);
gtk_menu_append (menu, menu_item);
@ -129,7 +155,7 @@ create_back_or_forward_menu (NautilusWindow *window, gboolean back)
}
static int
back_or_forward_button_clicked_cb (GtkWidget *widget,
back_or_forward_button_clicked_callback (GtkWidget *widget,
GdkEventButton *event,
gpointer *user_data)
{
@ -180,17 +206,17 @@ nautilus_window_initialize_toolbars (NautilusWindow *window)
gtk_signal_connect (GTK_OBJECT (window->back_button),
"button_press_event",
GTK_SIGNAL_FUNC (back_or_forward_button_clicked_cb),
GTK_SIGNAL_FUNC (back_or_forward_button_clicked_callback),
window);
gtk_signal_connect (GTK_OBJECT (window->forward_button),
"button_press_event",
GTK_SIGNAL_FUNC (back_or_forward_button_clicked_cb),
GTK_SIGNAL_FUNC (back_or_forward_button_clicked_callback),
window);
}
static void
nautilus_window_reload_cb (GtkWidget *widget, NautilusWindow *window)
toolbar_reload_callback (GtkWidget *widget, NautilusWindow *window)
{
Nautilus_NavigationRequestInfo nri;
@ -201,7 +227,7 @@ nautilus_window_reload_cb (GtkWidget *widget, NautilusWindow *window)
}
static void
nautilus_window_stop_cb (GtkWidget *widget, NautilusWindow *window)
toolbar_stop_callback (GtkWidget *widget, NautilusWindow *window)
{
nautilus_window_set_state_info (window, RESET_TO_IDLE, 0);
}

View file

@ -37,7 +37,11 @@
#include "nautilus-location-bar.h"
#include "ntl-index-panel.h"
#include "ntl-miniicon.h"
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <libnautilus/nautilus-bonobo-ui.h>
#include <libnautilus-extensions/nautilus-gtk-extensions.h>
#include <libnautilus-extensions/nautilus-icon-factory.h>
#include <libnautilus-extensions/nautilus-metadata.h>
@ -803,13 +807,13 @@ nautilus_window_back_or_forward (NautilusWindow *window, gboolean back, guint di
}
void
nautilus_window_back_cb (GtkWidget *widget, NautilusWindow *window)
nautilus_window_go_back (NautilusWindow *window)
{
nautilus_window_back_or_forward (window, TRUE, 0);
}
void
nautilus_window_forward_cb (GtkWidget *widget, NautilusWindow *window)
nautilus_window_go_forward (NautilusWindow *window)
{
nautilus_window_back_or_forward (window, FALSE, 0);
}
@ -827,7 +831,7 @@ nautilus_window_get_uih(NautilusWindow *window)
}
void
nautilus_window_up_cb (GtkWidget *widget, NautilusWindow *window)
nautilus_window_go_up (NautilusWindow *window)
{
const char *requested_uri;
GnomeVFSURI *current_uri;
@ -850,7 +854,7 @@ nautilus_window_up_cb (GtkWidget *widget, NautilusWindow *window)
}
void
nautilus_window_home_cb (GtkWidget *widget, NautilusWindow *window)
nautilus_window_go_home (NautilusWindow *window)
{
nautilus_window_set_initial_state(window, NULL);
}
@ -860,21 +864,21 @@ void
nautilus_window_allow_back (NautilusWindow *window, gboolean allow)
{
gtk_widget_set_sensitive(window->back_button, allow);
bonobo_ui_handler_menu_set_sensitivity(window->uih, "/Go/Back", allow);
bonobo_ui_handler_menu_set_sensitivity(window->uih, NAUTILUS_MENU_PATH_BACK_ITEM, allow);
}
void
nautilus_window_allow_forward (NautilusWindow *window, gboolean allow)
{
gtk_widget_set_sensitive(window->forward_button, allow);
bonobo_ui_handler_menu_set_sensitivity(window->uih, "/Go/Forward", allow);
bonobo_ui_handler_menu_set_sensitivity(window->uih, NAUTILUS_MENU_PATH_FORWARD_ITEM, allow);
}
void
nautilus_window_allow_up (NautilusWindow *window, gboolean allow)
{
gtk_widget_set_sensitive(window->up_button, allow);
bonobo_ui_handler_menu_set_sensitivity(window->uih, "/Go/Up", allow);
bonobo_ui_handler_menu_set_sensitivity(window->uih, NAUTILUS_MENU_PATH_UP_ITEM, allow);
}
void

View file

@ -63,9 +63,9 @@ void nautilus_window_edit_bookmarks (NautilusWindow *window);
void nautilus_window_initialize_menus (NautilusWindow *window);
void nautilus_window_initialize_toolbars (NautilusWindow *window);
void nautilus_window_back_cb (GtkWidget *widget, NautilusWindow *window);
void nautilus_window_forward_cb (GtkWidget *widget, NautilusWindow *window);
void nautilus_window_up_cb (GtkWidget *widget, NautilusWindow *window);
void nautilus_window_home_cb (GtkWidget *widget, NautilusWindow *window);
void nautilus_window_go_back (NautilusWindow *window);
void nautilus_window_go_forward (NautilusWindow *window);
void nautilus_window_go_up (NautilusWindow *window);
void nautilus_window_go_home (NautilusWindow *window);
#endif

View file

@ -37,7 +37,11 @@
#include "nautilus-location-bar.h"
#include "ntl-index-panel.h"
#include "ntl-miniicon.h"
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <libnautilus/nautilus-bonobo-ui.h>
#include <libnautilus-extensions/nautilus-gtk-extensions.h>
#include <libnautilus-extensions/nautilus-icon-factory.h>
#include <libnautilus-extensions/nautilus-metadata.h>
@ -803,13 +807,13 @@ nautilus_window_back_or_forward (NautilusWindow *window, gboolean back, guint di
}
void
nautilus_window_back_cb (GtkWidget *widget, NautilusWindow *window)
nautilus_window_go_back (NautilusWindow *window)
{
nautilus_window_back_or_forward (window, TRUE, 0);
}
void
nautilus_window_forward_cb (GtkWidget *widget, NautilusWindow *window)
nautilus_window_go_forward (NautilusWindow *window)
{
nautilus_window_back_or_forward (window, FALSE, 0);
}
@ -827,7 +831,7 @@ nautilus_window_get_uih(NautilusWindow *window)
}
void
nautilus_window_up_cb (GtkWidget *widget, NautilusWindow *window)
nautilus_window_go_up (NautilusWindow *window)
{
const char *requested_uri;
GnomeVFSURI *current_uri;
@ -850,7 +854,7 @@ nautilus_window_up_cb (GtkWidget *widget, NautilusWindow *window)
}
void
nautilus_window_home_cb (GtkWidget *widget, NautilusWindow *window)
nautilus_window_go_home (NautilusWindow *window)
{
nautilus_window_set_initial_state(window, NULL);
}
@ -860,21 +864,21 @@ void
nautilus_window_allow_back (NautilusWindow *window, gboolean allow)
{
gtk_widget_set_sensitive(window->back_button, allow);
bonobo_ui_handler_menu_set_sensitivity(window->uih, "/Go/Back", allow);
bonobo_ui_handler_menu_set_sensitivity(window->uih, NAUTILUS_MENU_PATH_BACK_ITEM, allow);
}
void
nautilus_window_allow_forward (NautilusWindow *window, gboolean allow)
{
gtk_widget_set_sensitive(window->forward_button, allow);
bonobo_ui_handler_menu_set_sensitivity(window->uih, "/Go/Forward", allow);
bonobo_ui_handler_menu_set_sensitivity(window->uih, NAUTILUS_MENU_PATH_FORWARD_ITEM, allow);
}
void
nautilus_window_allow_up (NautilusWindow *window, gboolean allow)
{
gtk_widget_set_sensitive(window->up_button, allow);
bonobo_ui_handler_menu_set_sensitivity(window->uih, "/Go/Up", allow);
bonobo_ui_handler_menu_set_sensitivity(window->uih, NAUTILUS_MENU_PATH_UP_ITEM, allow);
}
void