Commit bc4cb175 authored by John Sullivan's avatar John Sullivan
Browse files

Lots of work to use Bonobo menu merging. The file manager now merges various

items into the window's menubar, which has been slightly tweaked also.
parent 4019aa50
2000-03-06 John Sullivan <sullivan@eazel.com>
The file manager now uses Bonobo menu-merging to install
and remove its menu items from the window's menu bar.
I didn't put Zoom In/Zoom Out in the menu bar because
that seems unnecessary once the control works (they're
still in the right-click menu). I haven't yet put
Stretch/Restore in the menu bar, will do so soon. And
now you get a whole bunch of Gtk-CRITICALs when closing
a window because of all the double-destroyed bonobo menu
items (just like the two you used to get). Hope to fix
this soon. Added new "Settings" menu, which needs to be
organized better someday, and will be.
* components/history/ntl-history-view.c:
(menu_setup): Removed function.
(make_obj): Removed code to set up merged menu. This was
sample code for menu merging; now that we have real menu
merging working elsewhere we don't need this sample.
* libnautilus/nautilus-string.h,
* libnautilus/nautilus-string.c:
(nautilus_strstrip): New function, strips all occurrences
of a given char from a char *.
(nautilus_self_check_string): Added tests for nautilus_strstrip.
* src/ntl-view-nautilus.c:
(nautilus_view_try_load_client): Activate the new bonobo control
when it's installed.
(destroy_nautilus_view): Deactivate the bonobo control.
* src/nautilus-window-menus.c:
edit_menu_info[]: Removed "Preferences..." and preceding separator.
settings_menu_info[]: New menu, added "General Settings..."
(formerly "Preferences...") and "Use Eazel Theme Icons".
main_menu[]: Include settings_menu_info.
(edit_menu_prefs_cb): Renamed to general_settings_cb
(use_eazel_theme_icons_cb): New function, swaps themes.
(update_eazel_theme_menu_item): New function, sets the toggle state
of this menu item based on current theme.
(nautilus_window_initialize_menus): Call update_eazel_theme_menu_item
explicitly, also wire it up to theme change signal.
* src/ntl-prefs.c: (nautilus_prefs_ui_show): Renamed dialog
from "Preferences" to "General Settings" to match menu item. This
name will probably go away entirely eventually, but may as well
keep it consistent for now.
* src/file-manager/fm-directory-view.h: (merge_menus): New function
pointer. (update_menus): New function pointer.
(fm_directory_view_update_menus): Prototype for new function. *
src/file-manager/fm-directory-view.c:
(fm_directory_view_initialize_class): Set up merge_menus and
update_menus function pointers. (bonobo_menu_open_cb),
(bonobo_menu_open_in_new_window_cb), (bonobo_menu_delete_cb): New
callback functions with parameters the way Bonobo likes 'em.
(get_bonobo_control): New utility function for getting the
BonoboControl out of an FMDirectoryView.
(bonobo_control_activate_cb): New function, called when the view's
BonoboControl is activated or deactivated. Merges menus on
activate, unsets bonobo container on deactivate.
(fm_directory_view_initialize): Wire up bonobo_control_activate_cb
to "activate" signal of view's bonobo control.
(use_eazel_theme_icons_cb): Removed this function (it's in the
standard Nautilus menus now, not component-dependent).
(delete_one): Added a FIXME comment noting that the view is being
told to delete the entire selection for every selected item.
(fm_directory_view_delete_with_confirm): Moved the guts of
delete_cb into here so it can be conveniently called from both
bonobo menu and right-click menu. (delete_cb): Now just calls
fm_directory_view_delete_with_confirm.
(add_check_menu_item): Removed function, had only been used by
eazel theme icons menu item.
(fm_directory_view_real_append_background_context_menu_items):
Removed eazel theme icons menu item from right-click menu (now
accessible always in the Settings menu).
(compute_menu_item_info): New function, determines current label
and sensitivity for dynamic menu items, common to both bonobo menus
and context menus. Uses nautilus_strstrip to remove underlines used
for accelerators when item is used for context menu.
(append_one_selection_context_menu_item): New helper function,
wraps up common code for constructing a menu item for the
selection-dependent part of the context menu.
(fm_directory_view_real_append_selection_context_menu_items):
Replaced a lot of duplicated code with calls to
append_one_selection_context_menu_item.
(fm_directory_view_real_merge_menus): New funciton. Here lieth the
code to put directory view menu items into the window's menu bar.
(update_one_menu_item): New function, uses compute_menu_item_info
to update the label & sensitivity of one bonobo-style menu item.
(fm_directory_view_real_update_menus): New function, calls
update_one_menu_item on each menu item whose label or sensitivity
is dynamic.
(fm_directory_view_notify_selection_changed):
Call fm_directory_view_update_menus to update menu labels &
sensitivity that depend on the selection.
(fm_directory_view_merge_menus): New function, calls the function pointer.
(fm_directory_view_update_menus): New function, calls the function pointer.
* src/file-manager/fm-directory-view-icons.c:
(fm_directory_view_icons_initialize_class): Supply function pointer
for merge_menus.
(customize_icon_text_cb): Just added comments about its dual use.
(fm_directory_view_icons_merge_menus): Merge a "Customize Icon Text"
item into the Settings menu. Still need to do the Stretch/Restore items
here.
2000-03-06 Darin Adler <darin@eazel.com>
Fixed bug in Unstretch I just introduced.
......
......@@ -192,31 +192,11 @@ do_destroy(GtkObject *obj, HistoryView *hview)
gtk_main_quit();
}
static void
menu_setup(BonoboObject *ctl, HistoryView *hview)
{
Bonobo_UIHandler remote_uih;
GnomeUIInfo history_menu[] = {
GNOMEUIINFO_MENU_NEW_ITEM("_Do nothing (menu merge test)", "Testing", NULL, NULL),
GNOMEUIINFO_END
};
hview->uih = bonobo_control_get_ui_handler(BONOBO_CONTROL(ctl));
remote_uih = bonobo_control_get_remote_ui_handler(BONOBO_CONTROL(ctl));
bonobo_ui_handler_set_container(hview->uih, remote_uih);
bonobo_ui_handler_menu_new_subtree(hview->uih, "/History", _("H_istory"), NULL, -1, BONOBO_UI_HANDLER_PIXMAP_NONE,
NULL, 0, 0);
bonobo_ui_handler_menu_add_tree(hview->uih, "/History",
bonobo_ui_handler_menu_parse_uiinfo_tree(history_menu));
}
static BonoboObject *
make_obj(BonoboGenericFactory *Factory, const char *goad_id, gpointer closure)
{
GtkWidget *wtmp;
GtkCList *clist;
BonoboObject *ctl;
HistoryView *hview;
g_return_val_if_fail(!strcmp(goad_id, "ntl_history_view"), NULL);
......@@ -243,9 +223,6 @@ make_obj(BonoboGenericFactory *Factory, const char *goad_id, gpointer closure)
gtk_signal_connect (GTK_OBJECT (hview->view), "destroy", do_destroy, hview);
object_count++;
ctl = nautilus_view_frame_get_bonobo_control (NAUTILUS_VIEW_FRAME (hview->view));
gtk_signal_connect(GTK_OBJECT (ctl), "set_frame", menu_setup, hview);
hview->clist = (GtkCList *)clist;
/* set description */
......
......@@ -192,31 +192,11 @@ do_destroy(GtkObject *obj, HistoryView *hview)
gtk_main_quit();
}
static void
menu_setup(BonoboObject *ctl, HistoryView *hview)
{
Bonobo_UIHandler remote_uih;
GnomeUIInfo history_menu[] = {
GNOMEUIINFO_MENU_NEW_ITEM("_Do nothing (menu merge test)", "Testing", NULL, NULL),
GNOMEUIINFO_END
};
hview->uih = bonobo_control_get_ui_handler(BONOBO_CONTROL(ctl));
remote_uih = bonobo_control_get_remote_ui_handler(BONOBO_CONTROL(ctl));
bonobo_ui_handler_set_container(hview->uih, remote_uih);
bonobo_ui_handler_menu_new_subtree(hview->uih, "/History", _("H_istory"), NULL, -1, BONOBO_UI_HANDLER_PIXMAP_NONE,
NULL, 0, 0);
bonobo_ui_handler_menu_add_tree(hview->uih, "/History",
bonobo_ui_handler_menu_parse_uiinfo_tree(history_menu));
}
static BonoboObject *
make_obj(BonoboGenericFactory *Factory, const char *goad_id, gpointer closure)
{
GtkWidget *wtmp;
GtkCList *clist;
BonoboObject *ctl;
HistoryView *hview;
g_return_val_if_fail(!strcmp(goad_id, "ntl_history_view"), NULL);
......@@ -243,9 +223,6 @@ make_obj(BonoboGenericFactory *Factory, const char *goad_id, gpointer closure)
gtk_signal_connect (GTK_OBJECT (hview->view), "destroy", do_destroy, hview);
object_count++;
ctl = nautilus_view_frame_get_bonobo_control (NAUTILUS_VIEW_FRAME (hview->view));
gtk_signal_connect(GTK_OBJECT (ctl), "set_frame", menu_setup, hview);
hview->clist = (GtkCList *)clist;
/* set description */
......
......@@ -167,6 +167,35 @@ nautilus_string_to_int (const char *string, int *integer)
return TRUE;
}
/**
* nautilus_strstrip:
* Remove all occurrences of a character from a string. The
* original string is modified, and also returned for convenience.
*
* @string_null_allowed: The string to be stripped.
* @remove_this: The char to remove from @string_null_allowed
*
* Return value: @string_null_allowed, after removing all occurrences
* of @remove_this.
*/
char *
nautilus_strstrip (char *string_null_allowed, char remove_this)
{
if (string_null_allowed != NULL) {
char *pos;
pos = string_null_allowed;
while (*pos != '\0') {
if (*pos == remove_this) {
g_memmove (pos, pos + 1, strlen (pos));
}
++pos;
}
}
return string_null_allowed;
}
gboolean
nautilus_eat_string_to_int (char *string, int *integer)
{
......@@ -203,6 +232,7 @@ void
nautilus_self_check_string (void)
{
int integer;
char *test_string;
NAUTILUS_CHECK_INTEGER_RESULT (nautilus_strlen (NULL), 0);
NAUTILUS_CHECK_INTEGER_RESULT (nautilus_strlen (""), 0);
......@@ -261,6 +291,16 @@ nautilus_self_check_string (void)
NAUTILUS_CHECK_STRING_RESULT (nautilus_strdup_prefix ("foo:bar", ":"), "foo");
NAUTILUS_CHECK_STRING_RESULT (nautilus_strdup_prefix ("footle:bar", "tle:"), "foo");
NAUTILUS_CHECK_STRING_RESULT (nautilus_strstrip (NULL, '_'), NULL);
test_string = g_strdup ("foo");
NAUTILUS_CHECK_STRING_RESULT (nautilus_strstrip (test_string, '_'), "foo");
test_string = g_strdup ("_foo");
NAUTILUS_CHECK_STRING_RESULT (nautilus_strstrip (test_string, '_'), "foo");
test_string = g_strdup ("foo_");
NAUTILUS_CHECK_STRING_RESULT (nautilus_strstrip (test_string, '_'), "foo");
test_string = g_strdup ("_foo_");
NAUTILUS_CHECK_STRING_RESULT (nautilus_strstrip (test_string, '_'), "foo");
#define TEST_INTEGER_CONVERSION_FUNCTIONS(string, boolean_result, integer_result) \
NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_string_to_int (string, &integer), boolean_result); \
NAUTILUS_CHECK_INTEGER_RESULT (call_string_to_int (string), integer_result); \
......
......@@ -47,6 +47,9 @@ char * nautilus_strdup_prefix (const char *source_null_allowed,
gboolean nautilus_has_suffix (const char *target_null_allowed,
const char *suffix_null_allowed);
char * nautilus_strstrip (char *string_null_allowed,
char remove_this);
/* Conversions to and from strings. */
gboolean nautilus_string_to_int (const char *string,
......
......@@ -167,6 +167,35 @@ nautilus_string_to_int (const char *string, int *integer)
return TRUE;
}
/**
* nautilus_strstrip:
* Remove all occurrences of a character from a string. The
* original string is modified, and also returned for convenience.
*
* @string_null_allowed: The string to be stripped.
* @remove_this: The char to remove from @string_null_allowed
*
* Return value: @string_null_allowed, after removing all occurrences
* of @remove_this.
*/
char *
nautilus_strstrip (char *string_null_allowed, char remove_this)
{
if (string_null_allowed != NULL) {
char *pos;
pos = string_null_allowed;
while (*pos != '\0') {
if (*pos == remove_this) {
g_memmove (pos, pos + 1, strlen (pos));
}
++pos;
}
}
return string_null_allowed;
}
gboolean
nautilus_eat_string_to_int (char *string, int *integer)
{
......@@ -203,6 +232,7 @@ void
nautilus_self_check_string (void)
{
int integer;
char *test_string;
NAUTILUS_CHECK_INTEGER_RESULT (nautilus_strlen (NULL), 0);
NAUTILUS_CHECK_INTEGER_RESULT (nautilus_strlen (""), 0);
......@@ -261,6 +291,16 @@ nautilus_self_check_string (void)
NAUTILUS_CHECK_STRING_RESULT (nautilus_strdup_prefix ("foo:bar", ":"), "foo");
NAUTILUS_CHECK_STRING_RESULT (nautilus_strdup_prefix ("footle:bar", "tle:"), "foo");
NAUTILUS_CHECK_STRING_RESULT (nautilus_strstrip (NULL, '_'), NULL);
test_string = g_strdup ("foo");
NAUTILUS_CHECK_STRING_RESULT (nautilus_strstrip (test_string, '_'), "foo");
test_string = g_strdup ("_foo");
NAUTILUS_CHECK_STRING_RESULT (nautilus_strstrip (test_string, '_'), "foo");
test_string = g_strdup ("foo_");
NAUTILUS_CHECK_STRING_RESULT (nautilus_strstrip (test_string, '_'), "foo");
test_string = g_strdup ("_foo_");
NAUTILUS_CHECK_STRING_RESULT (nautilus_strstrip (test_string, '_'), "foo");
#define TEST_INTEGER_CONVERSION_FUNCTIONS(string, boolean_result, integer_result) \
NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_string_to_int (string, &integer), boolean_result); \
NAUTILUS_CHECK_INTEGER_RESULT (call_string_to_int (string), integer_result); \
......
......@@ -47,6 +47,9 @@ char * nautilus_strdup_prefix (const char *source_null_allowed,
gboolean nautilus_has_suffix (const char *target_null_allowed,
const char *suffix_null_allowed);
char * nautilus_strstrip (char *string_null_allowed,
char remove_this);
/* Conversions to and from strings. */
gboolean nautilus_string_to_int (const char *string,
......
......@@ -167,6 +167,35 @@ nautilus_string_to_int (const char *string, int *integer)
return TRUE;
}
/**
* nautilus_strstrip:
* Remove all occurrences of a character from a string. The
* original string is modified, and also returned for convenience.
*
* @string_null_allowed: The string to be stripped.
* @remove_this: The char to remove from @string_null_allowed
*
* Return value: @string_null_allowed, after removing all occurrences
* of @remove_this.
*/
char *
nautilus_strstrip (char *string_null_allowed, char remove_this)
{
if (string_null_allowed != NULL) {
char *pos;
pos = string_null_allowed;
while (*pos != '\0') {
if (*pos == remove_this) {
g_memmove (pos, pos + 1, strlen (pos));
}
++pos;
}
}
return string_null_allowed;
}
gboolean
nautilus_eat_string_to_int (char *string, int *integer)
{
......@@ -203,6 +232,7 @@ void
nautilus_self_check_string (void)
{
int integer;
char *test_string;
NAUTILUS_CHECK_INTEGER_RESULT (nautilus_strlen (NULL), 0);
NAUTILUS_CHECK_INTEGER_RESULT (nautilus_strlen (""), 0);
......@@ -261,6 +291,16 @@ nautilus_self_check_string (void)
NAUTILUS_CHECK_STRING_RESULT (nautilus_strdup_prefix ("foo:bar", ":"), "foo");
NAUTILUS_CHECK_STRING_RESULT (nautilus_strdup_prefix ("footle:bar", "tle:"), "foo");
NAUTILUS_CHECK_STRING_RESULT (nautilus_strstrip (NULL, '_'), NULL);
test_string = g_strdup ("foo");
NAUTILUS_CHECK_STRING_RESULT (nautilus_strstrip (test_string, '_'), "foo");
test_string = g_strdup ("_foo");
NAUTILUS_CHECK_STRING_RESULT (nautilus_strstrip (test_string, '_'), "foo");
test_string = g_strdup ("foo_");
NAUTILUS_CHECK_STRING_RESULT (nautilus_strstrip (test_string, '_'), "foo");
test_string = g_strdup ("_foo_");
NAUTILUS_CHECK_STRING_RESULT (nautilus_strstrip (test_string, '_'), "foo");
#define TEST_INTEGER_CONVERSION_FUNCTIONS(string, boolean_result, integer_result) \
NAUTILUS_CHECK_BOOLEAN_RESULT (nautilus_string_to_int (string, &integer), boolean_result); \
NAUTILUS_CHECK_INTEGER_RESULT (call_string_to_int (string), integer_result); \
......
......@@ -47,6 +47,9 @@ char * nautilus_strdup_prefix (const char *source_null_allowed,
gboolean nautilus_has_suffix (const char *target_null_allowed,
const char *suffix_null_allowed);
char * nautilus_strstrip (char *string_null_allowed,
char remove_this);
/* Conversions to and from strings. */
gboolean nautilus_string_to_int (const char *string,
......
......@@ -47,6 +47,9 @@
#define DEFAULT_BACKGROUND_COLOR "rgb:FFFF/FFFF/FFFF"
/* Paths to use when creating & referring to bonobo menu items */
#define FM_DIRECTORY_VIEW_ICONS_MENU_PATH_CUSTOMIZE_ICON_TEXT "/Settings/Icon Text"
/* forward declarations */
static void add_icon_at_free_position (FMDirectoryViewIcons *icon_view,
......@@ -84,6 +87,8 @@ static GList * fm_directory_view_icons_get_selection
static NautilusZoomLevel fm_directory_view_icons_get_zoom_level (FMDirectoryViewIcons *view);
static void fm_directory_view_icons_initialize (FMDirectoryViewIcons *icon_view);
static void fm_directory_view_icons_initialize_class (FMDirectoryViewIconsClass *klass);
static void fm_directory_view_icons_merge_menus (FMDirectoryView *view,
BonoboUIHandler *ui_handler);
static void fm_directory_view_icons_select_all (FMDirectoryView *view);
static void fm_directory_view_icons_set_zoom_level (FMDirectoryViewIcons *view,
NautilusZoomLevel new_level);
......@@ -149,6 +154,8 @@ fm_directory_view_icons_initialize_class (FMDirectoryViewIconsClass *klass)
= fm_directory_view_icons_append_selection_context_menu_items;
fm_directory_view_class->append_background_context_menu_items
= fm_directory_view_icons_append_background_context_menu_items;
fm_directory_view_class->merge_menus
= fm_directory_view_icons_merge_menus;
/* FIXME: Read this from global preferences */
default_icon_text_attribute_names = g_strdup ("name|size|date_modified|type");
......@@ -363,12 +370,16 @@ fm_directory_view_icons_append_selection_context_menu_items (FMDirectoryView *vi
gtk_menu_append (menu, menu_item);
}
/**
*
* Note that this is used both as a Bonobo menu callback and a signal callback.
* The first parameter is different in these cases, but we just ignore it anyway.
*/
static void
customize_icon_text_cb (GtkMenuItem *menu_item, gpointer view)
customize_icon_text_cb (gpointer ignored, gpointer view)
{
GtkWindow *window;
g_assert (GTK_IS_MENU_ITEM (menu_item));
g_assert (FM_IS_DIRECTORY_VIEW_ICONS (view));
window = GTK_WINDOW (fm_icon_text_window_get_or_create ());
......@@ -398,7 +409,8 @@ fm_directory_view_icons_append_background_context_menu_items (FMDirectoryView *v
menu_item = gtk_menu_item_new_with_label (_("Customize Icon Text..."));
gtk_widget_show (menu_item);
gtk_signal_connect (GTK_OBJECT (menu_item), "activate",
GTK_SIGNAL_FUNC (customize_icon_text_cb), view);
GTK_SIGNAL_FUNC (customize_icon_text_cb),
view);
gtk_menu_append (menu, menu_item);
}
......@@ -672,6 +684,29 @@ fm_directory_view_icons_get_selection (FMDirectoryView *view)
return list;
}
static void
fm_directory_view_icons_merge_menus (FMDirectoryView *view, BonoboUIHandler *ui_handler)
{
g_assert (FM_IS_DIRECTORY_VIEW_ICONS (view));
g_message ("called fm_directory_view_icons_merge_menus");
NAUTILUS_CALL_PARENT_CLASS (FM_DIRECTORY_VIEW_CLASS,
merge_menus,
(view, ui_handler));
bonobo_ui_handler_menu_new_item (ui_handler,
FM_DIRECTORY_VIEW_ICONS_MENU_PATH_CUSTOMIZE_ICON_TEXT,
_("Customize _Icon Text..."),
_("Choose which information appears beneath each icon's name"),
-1,
BONOBO_UI_HANDLER_PIXMAP_NONE,
NULL,
0,
0,
(BonoboUIHandlerCallbackFunc)customize_icon_text_cb,
view);
}
static void
fm_directory_view_icons_select_all (FMDirectoryView *view)
{
......
This diff is collapsed.
......@@ -25,6 +25,7 @@
#ifndef FM_DIRECTORY_VIEW_H
#define FM_DIRECTORY_VIEW_H
#include <bonobo/bonobo-ui-handler.h>
#include <gtk/gtkmenu.h>
#include <gtk/gtkscrolledwindow.h>
#include <libnautilus/ntl-content-view-frame.h>
......@@ -132,6 +133,20 @@ struct _FMDirectoryViewClass {
/* select_all is a function pointer that subclasses must override to
* select all of the items in the view */
void (* select_all) (FMDirectoryView *view);
/* merge_menus is a function pointer that subclasses can override to
* add their own menu items to the window's menu bar.
* If overridden, subclasses must call parent class's function.
*/
void (* merge_menus) (FMDirectoryView *view,
BonoboUIHandler *ui_handler);
/* update_menus is a function pointer that subclasses can override to
* update the sensitivity or wording of menu items in the menu bar.
* It is called (at least) whenever the selection changes. If overridden,
* subclasses must call parent class's function.
*/
void (* update_menus) (FMDirectoryView *view);
};
......@@ -177,5 +192,6 @@ void fm_directory_view_notify_selection_changed (FMDir
NautilusDirectory * fm_directory_view_get_model (FMDirectoryView *view);
void fm_directory_view_pop_up_background_context_menu (FMDirectoryView *view);
void fm_directory_view_pop_up_selection_context_menu (FMDirectoryView *view);
void fm_directory_view_update_menus (FMDirectoryView *view);
#endif /* FM_DIRECTORY_VIEW_H */
......@@ -32,6 +32,7 @@
#include <libnautilus/nautilus-gtk-extensions.h>
#include <libnautilus/nautilus-icon-factory.h>
#include <libnautilus/nautilus-string.h>
static void activate_bookmark_in_menu_item (BonoboUIHandler *uih,
......@@ -53,6 +54,7 @@ static void debug_menu_show_color_picker_cb (GtkWidget *wid
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);
/* Struct that stores all the info necessary to activate a bookmark. */
......@@ -99,8 +101,8 @@ file_menu_exit_cb (GtkWidget *widget,
}
static void
edit_menu_prefs_cb(GtkWidget *widget,
GtkWindow *mainwin)
general_settings_cb (GtkWidget *widget,
GtkWindow *mainwin)
{
nautilus_prefs_ui_show(mainwin);
}
......@@ -138,8 +140,6 @@ static GnomeUIInfo edit_menu_info[] = {
GNOME_APP_PIXMAP_NONE, NULL,
'A', GDK_CONTROL_MASK, NULL
},
GNOMEUIINFO_SEPARATOR,
GNOMEUIINFO_MENU_PREFERENCES_ITEM(edit_menu_prefs_cb, NULL),
GNOMEUIINFO_END
};
......@@ -226,6 +226,40 @@ static GnomeUIInfo bookmarks_menu_info[] = {
GNOMEUIINFO_END
};
static void
use_eazel_theme_icons_cb (GtkCheckMenuItem *item, gpointer user_data)
{
char *theme;
theme = nautilus_icon_factory_get_theme ();
if (nautilus_strcmp (theme, "eazel") == 0) {
nautilus_icon_factory_set_theme (NULL);
} else {
nautilus_icon_factory_set_theme ("eazel");
}
g_free (theme);
}
static GnomeUIInfo settings_menu_info[] = {
{
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
};
static GnomeUIInfo help_menu_info[] = {
{
GNOME_APP_UI_ITEM,
......@@ -248,6 +282,7 @@ static GnomeUIInfo main_menu[] = {
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
......@@ -532,8 +567,9 @@ nautilus_window_initialize_menus (NautilusWindow *window)
bonobo_ui_handler_menu_add_list (ui_handler, "/", menu_items);
bonobo_ui_handler_menu_free_list (menu_items);
/* desensitize the items that haven't yet been implemented