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

Wired up the remaining new global view preferences,

	and added a menu item for resetting the current view
	to match preferences. I know of one large bug (the
	default choice of Icons vs List doesn't work) and several
	small bugs that I'll write up now.

	This change requires a recent API change in eel (for
	eel_list_set_sort_type and eel_list_set_sort_column).

	* libnautilus-extensions/nautilus-global-preferences.c:
	Fixed typo.

	* src/file-manager/fm-directory-view.h:
	* src/file-manager/fm-directory-view.c:
	(reset_to_defaults_callback), (real_merge_menus),
	(fm_directory_view_reset_to_defaults),
	(fm_directory_view_initialize_class): Added support for
	"Reset to Defaults" command, which subclasses override
	to Do The Right Thing.

	* src/file-manager/nautilus-directory-view-ui.xml:
	Add "Reset to View Preferences" menu item.

	* src/nautilus-shell-ui.xml: Add placeholder to support location
	of "Reset to View Preferences" menu item.

	* src/file-manager/fm-icon-view.c:
	(fm_icon_view_reset_to_defaults), (fm_icon_view_initialize_class):
	Set sort criterion, sort-reversedness, tighter layout, and
	zoom level to match defaults.

	* src/file-manager/fm-list-view.c:
	(fm_list_view_initialize_class): wire up reset_to_defaults handler;
	set up auto-storage variables for sort order & sort reversed preferences.
	(fm_list_view_initialize): Set up preferences callbacks to notice changes
	to default sort order, sort reversed, and zoom level.
	(set_sort_order_from_metadata_and_preferences),
	(set_zoom_level_from_metadata_and_preferences): New functions, broken
	out of fm_list_view_begin_loading for reuse.
	(default_sort_criteria_changed_callback),
	(default_zoom_level_changed_callback): React to preference changes
	by resorting or rezooming as appropriate.
	(fm_list_view_begin_loading): Call broken-out functions.
	(fm_list_view_reset_to_defaults): Set sort order, sort-reversedness,
	and zoom level to default values.
	(fm_list_view_sort_items): Use variable defaults instead of hardwired
	constants for sort order & sort-reversedness. Call new eel_list versions
	of set_sort_type and set_sort_column so the column titles redraw
	correctly.
	(get_sort_column_from_attribute): Use variable default for sort attribute
	instead of hardwired constant.
	(get_attribute_from_sort_type): New function, converts between
	NautilusFileSortType enum values and named attributes.
	(real_get_default_sort_attribute): Use get_attribute_from_sort_type instead
	of hardwired constant.

	* src/nautilus-application.c:
	(default_folder_viewer_changed_callback),
	(nautilus_application_startup): When the default folder viewer
	preference changes, tell gnome-vfs about it.
parent 68cc0f06
2001-04-09 John Sullivan <sullivan@eazel.com>
reviewed by: <delete if not using a buddy>
Wired up the remaining new view global preferences,
and added a menu item for resetting the current view
to match preferences. I know of one large bug (the
default choice of Icons vs List doesn't work) and several
small bugs that I'll write up now.
This change requires a recent API change in eel (for
eel_list_set_sort_type and eel_list_set_sort_column).
* libnautilus-extensions/nautilus-global-preferences.c:
Fixed typo.
* src/file-manager/fm-directory-view.h:
* src/file-manager/fm-directory-view.c:
(reset_to_defaults_callback), (real_merge_menus),
(fm_directory_view_reset_to_defaults),
(fm_directory_view_initialize_class): Added support for
"Reset to Defaults" command, which subclasses override
to Do The Right Thing.
* src/file-manager/nautilus-directory-view-ui.xml:
Add "Reset to View Preferences" menu item.
* src/nautilus-shell-ui.xml: Add placeholder to support location
of "Reset to View Preferences" menu item.
* src/file-manager/fm-icon-view.c:
(fm_icon_view_reset_to_defaults), (fm_icon_view_initialize_class):
Set sort criterion, sort-reversedness, tighter layout, and
zoom level to match defaults.
* src/file-manager/fm-list-view.c:
(fm_list_view_initialize_class): wire up reset_to_defaults handler;
set up auto-storage variables for sort order & sort reversed preferences.
(fm_list_view_initialize): Set up preferences callbacks to notice changes
to default sort order, sort reversed, and zoom level.
(set_sort_order_from_metadata_and_preferences),
(set_zoom_level_from_metadata_and_preferences): New functions, broken
out of fm_list_view_begin_loading for reuse.
(default_sort_criteria_changed_callback),
(default_zoom_level_changed_callback): React to preference changes
by resorting or rezooming as appropriate.
(fm_list_view_begin_loading): Call broken-out functions.
(fm_list_view_reset_to_defaults): Set sort order, sort-reversedness,
and zoom level to default values.
(fm_list_view_sort_items): Use variable defaults instead of hardwired
constants for sort order & sort-reversedness. Call new eel_list versions
of set_sort_type and set_sort_column so the column titles redraw
correctly.
(get_sort_column_from_attribute): Use variable default for sort attribute
instead of hardwired constant.
(get_attribute_from_sort_type): New function, converts between
NautilusFileSortType enum values and named attributes.
(real_get_default_sort_attribute): Use get_attribute_from_sort_type instead
of hardwired constant.
* src/nautilus-application.c:
(default_folder_viewer_changed_callback),
(nautilus_application_startup): When the default folder viewer
preference changes, tell gnome-vfs about it.
2001-04-09 Pavel Cisler <pavel@eazel.com>
reviewed by: Michael Engber <engber@eazel.com>
......
......@@ -162,7 +162,7 @@ static EelEnumerationEntry default_sort_order_enum_entries[] = {
{ "size", N_("By Size"), NAUTILUS_FILE_SORT_BY_SIZE },
{ "type", N_("By Type"), NAUTILUS_FILE_SORT_BY_TYPE },
{ "modification date", N_("By Modification Date"), NAUTILUS_FILE_SORT_BY_MTIME },
{ "emblemd", N_("By Emblems"), NAUTILUS_FILE_SORT_BY_EMBLEMS },
{ "emblems", N_("By Emblems"), NAUTILUS_FILE_SORT_BY_EMBLEMS },
{ NULL }
};
......
......@@ -162,7 +162,7 @@ static EelEnumerationEntry default_sort_order_enum_entries[] = {
{ "size", N_("By Size"), NAUTILUS_FILE_SORT_BY_SIZE },
{ "type", N_("By Type"), NAUTILUS_FILE_SORT_BY_TYPE },
{ "modification date", N_("By Modification Date"), NAUTILUS_FILE_SORT_BY_MTIME },
{ "emblemd", N_("By Emblems"), NAUTILUS_FILE_SORT_BY_EMBLEMS },
{ "emblems", N_("By Emblems"), NAUTILUS_FILE_SORT_BY_EMBLEMS },
{ NULL }
};
......
......@@ -313,6 +313,7 @@ EEL_IMPLEMENT_MUST_OVERRIDE_SIGNAL (fm_directory_view, clear)
EEL_IMPLEMENT_MUST_OVERRIDE_SIGNAL (fm_directory_view, file_changed)
EEL_IMPLEMENT_MUST_OVERRIDE_SIGNAL (fm_directory_view, get_selection)
EEL_IMPLEMENT_MUST_OVERRIDE_SIGNAL (fm_directory_view, is_empty)
EEL_IMPLEMENT_MUST_OVERRIDE_SIGNAL (fm_directory_view, reset_to_defaults)
EEL_IMPLEMENT_MUST_OVERRIDE_SIGNAL (fm_directory_view, select_all)
EEL_IMPLEMENT_MUST_OVERRIDE_SIGNAL (fm_directory_view, set_selection)
EEL_IMPLEMENT_MUST_OVERRIDE_SIGNAL (fm_directory_view, get_selected_icon_locations)
......@@ -850,6 +851,16 @@ bonobo_menu_select_all_callback (BonoboUIComponent *component,
fm_directory_view_select_all (callback_data);
}
static void
reset_to_defaults_callback (BonoboUIComponent *component,
gpointer callback_data,
const char *verb)
{
g_assert (FM_IS_DIRECTORY_VIEW (callback_data));
fm_directory_view_reset_to_defaults (callback_data);
}
static void
show_trash_callback (BonoboUIComponent *component,
gpointer callback_data,
......@@ -3883,6 +3894,7 @@ real_merge_menus (FMDirectoryView *view)
BONOBO_UI_VERB ("Paste Files", paste_files_callback),
BONOBO_UI_VERB ("Remove Custom Icons", remove_custom_icons_callback),
BONOBO_UI_VERB ("Reset Background", reset_background_callback),
BONOBO_UI_VERB ("Reset to Defaults", reset_to_defaults_callback),
BONOBO_UI_VERB ("Select All", bonobo_menu_select_all_callback),
BONOBO_UI_VERB ("Show Properties", open_properties_window_callback),
BONOBO_UI_VERB ("Show Trash", show_trash_callback),
......@@ -4873,6 +4885,22 @@ disconnect_script_handlers (FMDirectoryView *view)
view);
}
/**
* fm_directory_view_reset_to_defaults:
*
* set sorting order, zoom level, etc. to match defaults
*
**/
void
fm_directory_view_reset_to_defaults (FMDirectoryView *view)
{
g_return_if_fail (FM_IS_DIRECTORY_VIEW (view));
EEL_CALL_METHOD
(FM_DIRECTORY_VIEW_CLASS, view,
reset_to_defaults, (view));
}
/**
* fm_directory_view_select_all:
*
......@@ -5524,6 +5552,7 @@ fm_directory_view_initialize_class (FMDirectoryViewClass *klass)
EEL_ASSIGN_MUST_OVERRIDE_SIGNAL (klass, fm_directory_view, file_changed);
EEL_ASSIGN_MUST_OVERRIDE_SIGNAL (klass, fm_directory_view, get_selection);
EEL_ASSIGN_MUST_OVERRIDE_SIGNAL (klass, fm_directory_view, is_empty);
EEL_ASSIGN_MUST_OVERRIDE_SIGNAL (klass, fm_directory_view, reset_to_defaults);
EEL_ASSIGN_MUST_OVERRIDE_SIGNAL (klass, fm_directory_view, select_all);
EEL_ASSIGN_MUST_OVERRIDE_SIGNAL (klass, fm_directory_view, set_selection);
EEL_ASSIGN_MUST_OVERRIDE_SIGNAL (klass, fm_directory_view, get_selected_icon_locations);
......
......@@ -121,6 +121,12 @@ struct FMDirectoryViewClass {
/* Function pointers that don't have corresponding signals */
/* reset_to_defaults is a function pointer that subclasses must
* override to set sort order, zoom level, etc to match default
* values.
*/
void (* reset_to_defaults) (FMDirectoryView *view);
/* get_selection is not a signal; it is just a function pointer for
* subclasses to replace (override). Subclasses must replace it
* with a function that returns a newly-allocated GList of
......@@ -294,6 +300,7 @@ void fm_directory_view_zoom_to_level (FMDirect
void fm_directory_view_set_zoom_level (FMDirectoryView *view,
int zoom_level);
void fm_directory_view_restore_default_zoom_level (FMDirectoryView *view);
void fm_directory_view_reset_to_defaults (FMDirectoryView *view);
void fm_directory_view_select_all (FMDirectoryView *view);
void fm_directory_view_set_selection (FMDirectoryView *view,
GList *selection);
......
......@@ -1346,6 +1346,31 @@ fm_icon_view_update_menus (FMDirectoryView *view)
nautilus_file_list_free (selection);
}
static void
fm_icon_view_reset_to_defaults (FMDirectoryView *view)
{
NautilusIconContainer *icon_container;
FMIconView *icon_view;
icon_view = FM_ICON_VIEW (view);
icon_container = get_icon_container (icon_view);
set_sort_criterion (icon_view, get_sort_criterion_by_sort_type (get_default_sort_order ()));
set_sort_reversed (icon_view, get_default_sort_in_reverse_order ());
nautilus_icon_container_set_tighter_layout
(icon_container, get_default_directory_tighter_layout ());
/* FIXME bugzilla.eazel.com 8023:
* There's currently no way to specify manual layout as the default.
*/
nautilus_icon_container_set_auto_layout (icon_container, FALSE);
nautilus_icon_container_sort (icon_container);
update_layout_menus (icon_view);
fm_icon_view_restore_default_zoom_level (view);
}
static void
fm_icon_view_select_all (FMDirectoryView *view)
{
......@@ -2119,6 +2144,7 @@ fm_icon_view_initialize_class (FMIconViewClass *klass)
fm_directory_view_class->file_changed = fm_icon_view_file_changed;
fm_directory_view_class->is_empty = fm_icon_view_is_empty;
fm_directory_view_class->get_selection = fm_icon_view_get_selection;
fm_directory_view_class->reset_to_defaults = fm_icon_view_reset_to_defaults;
fm_directory_view_class->select_all = fm_icon_view_select_all;
fm_directory_view_class->set_selection = fm_icon_view_set_selection;
fm_directory_view_class->reveal_selection = fm_icon_view_reveal_selection;
......@@ -2246,7 +2272,7 @@ fm_icon_view_update_icon_container_fonts (FMIconView *icon_view)
static int default_zoom_level_font_size = 12;
static NautilusFileSortType
static int
get_default_zoom_level_font_size (void)
{
static gboolean auto_storaged_added = FALSE;
......
......@@ -56,6 +56,9 @@ struct FMListViewDetails {
guint zoom_level;
};
static NautilusFileSortType default_sort_order_auto_value;
static gboolean default_sort_reversed_auto_value;
/* The list view receives files from the directory model
in chunks, to improve responsiveness during loading.
This is the number of files we add to the list, or change
......@@ -89,8 +92,6 @@ struct FMListViewDetails {
#define LIST_VIEW_COLUMN_ICON 0
#define LIST_VIEW_COLUMN_EMBLEMS 1
#define LIST_VIEW_DEFAULT_SORTING_ATTRIBUTE "name"
/* special values for get_data and set_data */
......@@ -137,6 +138,7 @@ static void fm_list_view_initialize (gpointer
static void fm_list_view_initialize_class (gpointer klass);
static void fm_list_view_destroy (GtkObject *object);
static void fm_list_view_done_adding_files (FMDirectoryView *view);
static void fm_list_view_reset_to_defaults (FMDirectoryView *view);
static void fm_list_view_select_all (FMDirectoryView *view);
static void fm_list_view_set_selection (FMDirectoryView *view,
GList *selection);
......@@ -189,6 +191,8 @@ static void real_sort_directories_first_changed (FMDirecto
static void real_start_renaming_item (FMDirectoryView *view,
const char *uri);
static void font_or_font_size_changed_callback (gpointer callback_data);
static void default_sort_criteria_changed_callback (gpointer callback_data);
static void default_zoom_level_changed_callback (gpointer callback_data);
EEL_DEFINE_CLASS_BOILERPLATE (FMListView,
fm_list_view,
......@@ -223,6 +227,7 @@ fm_list_view_initialize_class (gpointer klass)
fm_directory_view_class->file_changed = fm_list_view_file_changed;
fm_directory_view_class->is_empty = real_is_empty;
fm_directory_view_class->get_selection = fm_list_view_get_selection;
fm_directory_view_class->reset_to_defaults = fm_list_view_reset_to_defaults;
fm_directory_view_class->select_all = fm_list_view_select_all;
fm_directory_view_class->set_selection = fm_list_view_set_selection;
fm_directory_view_class->reveal_selection = fm_list_view_reveal_selection;
......@@ -242,6 +247,11 @@ fm_list_view_initialize_class (gpointer klass)
fm_list_view_class->get_column_specification = real_get_column_specification;
fm_list_view_class->get_default_sort_attribute = real_get_default_sort_attribute;
fm_list_view_class->file_still_belongs = real_file_still_belongs;
nautilus_preferences_add_auto_integer (NAUTILUS_PREFERENCES_LIST_VIEW_DEFAULT_SORT_ORDER,
(int *) &default_sort_order_auto_value);
nautilus_preferences_add_auto_boolean (NAUTILUS_PREFERENCES_LIST_VIEW_DEFAULT_SORT_IN_REVERSE_ORDER,
&default_sort_reversed_auto_value);
}
static void
......@@ -272,6 +282,18 @@ fm_list_view_initialize (gpointer object, gpointer klass)
font_or_font_size_changed_callback,
list_view,
GTK_OBJECT (list_view));
nautilus_preferences_add_callback_while_alive (NAUTILUS_PREFERENCES_LIST_VIEW_DEFAULT_SORT_ORDER,
default_sort_criteria_changed_callback,
list_view,
GTK_OBJECT (list_view));
nautilus_preferences_add_callback_while_alive (NAUTILUS_PREFERENCES_LIST_VIEW_DEFAULT_ZOOM_LEVEL,
default_zoom_level_changed_callback,
list_view,
GTK_OBJECT (list_view));
nautilus_preferences_add_callback_while_alive (NAUTILUS_PREFERENCES_LIST_VIEW_DEFAULT_SORT_IN_REVERSE_ORDER,
default_sort_criteria_changed_callback,
list_view,
GTK_OBJECT (list_view));
nautilus_preferences_add_callback_while_alive (NAUTILUS_PREFERENCES_LIST_VIEW_DEFAULT_ZOOM_LEVEL_FONT_SIZE,
font_or_font_size_changed_callback,
list_view,
......@@ -1445,28 +1467,12 @@ fm_list_view_begin_adding_files (FMDirectoryView *view)
}
static void
fm_list_view_begin_loading (FMDirectoryView *view)
set_sort_order_from_metadata_and_preferences (FMListView *list_view)
{
NautilusFile *file;
FMListView *list_view;
char *default_sort_attribute;
NautilusFile *file;
g_return_if_fail (FM_IS_LIST_VIEW (view));
file = fm_directory_view_get_directory_as_file (view);
list_view = FM_LIST_VIEW (view);
/* Set up the background color from the metadata. */
nautilus_connect_background_to_file_metadata (GTK_WIDGET (get_list (list_view)),
file);
fm_list_view_set_zoom_level (
list_view,
nautilus_file_get_integer_metadata (
file,
NAUTILUS_METADATA_KEY_LIST_VIEW_ZOOM_LEVEL,
get_default_zoom_level ()),
TRUE);
file = fm_directory_view_get_directory_as_file (FM_DIRECTORY_VIEW (list_view));
default_sort_attribute = get_default_sort_attribute (list_view);
fm_list_view_sort_items (
......@@ -1477,10 +1483,55 @@ fm_list_view_begin_loading (FMDirectoryView *view)
default_sort_attribute)),
nautilus_file_get_boolean_metadata (file,
NAUTILUS_METADATA_KEY_LIST_VIEW_SORT_REVERSED,
FALSE));
default_sort_reversed_auto_value));
g_free (default_sort_attribute);
}
static void
set_zoom_level_from_metadata_and_preferences (FMListView *list_view)
{
fm_list_view_set_zoom_level (
list_view,
nautilus_file_get_integer_metadata (
fm_directory_view_get_directory_as_file (FM_DIRECTORY_VIEW (list_view)),
NAUTILUS_METADATA_KEY_LIST_VIEW_ZOOM_LEVEL,
get_default_zoom_level ()),
TRUE);
}
static void
default_sort_criteria_changed_callback (gpointer callback_data)
{
g_return_if_fail (FM_IS_LIST_VIEW (callback_data));
set_sort_order_from_metadata_and_preferences (FM_LIST_VIEW (callback_data));
}
static void
default_zoom_level_changed_callback (gpointer callback_data)
{
g_return_if_fail (FM_IS_LIST_VIEW (callback_data));
set_zoom_level_from_metadata_and_preferences (FM_LIST_VIEW (callback_data));
}
static void
fm_list_view_begin_loading (FMDirectoryView *view)
{
FMListView *list_view;
g_return_if_fail (FM_IS_LIST_VIEW (view));
list_view = FM_LIST_VIEW (view);
/* Set up the background color from the metadata. */
nautilus_connect_background_to_file_metadata (GTK_WIDGET (get_list (list_view)),
fm_directory_view_get_directory_as_file (view));
set_zoom_level_from_metadata_and_preferences (list_view);
set_sort_order_from_metadata_and_preferences (list_view);
}
static void
fm_list_view_add_file (FMDirectoryView *view, NautilusFile *file)
{
......@@ -1732,6 +1783,24 @@ fm_list_view_reset_row_height (FMListView *list_view)
LIST_VIEW_MINIMUM_ROW_HEIGHT));
}
/* Reset sort criteria and zoom level to match defaults */
static void
fm_list_view_reset_to_defaults (FMDirectoryView *view)
{
FMListView *list_view;
char *default_sort_attribute;
list_view = FM_LIST_VIEW (view);
default_sort_attribute = get_default_sort_attribute (list_view);
fm_list_view_sort_items (list_view,
get_sort_column_from_attribute (list_view, default_sort_attribute),
default_sort_reversed_auto_value);
g_free (default_sort_attribute);
fm_list_view_restore_default_zoom_level (view);
}
/* select all of the items in the view */
static void
fm_list_view_select_all (FMDirectoryView *view)
......@@ -1890,6 +1959,7 @@ fm_list_view_sort_items (FMListView *list_view,
EelList *list;
EelCList *clist;
NautilusFile *file;
char *default_sort_attribute;
g_return_if_fail (FM_IS_LIST_VIEW (list_view));
g_return_if_fail (column >= 0);
......@@ -1901,15 +1971,18 @@ fm_list_view_sort_items (FMListView *list_view,
}
file = fm_directory_view_get_directory_as_file (FM_DIRECTORY_VIEW (list_view));
default_sort_attribute = get_default_sort_attribute (list_view);
nautilus_file_set_metadata
(file,
NAUTILUS_METADATA_KEY_LIST_VIEW_SORT_COLUMN,
LIST_VIEW_DEFAULT_SORTING_ATTRIBUTE,
default_sort_attribute,
get_column_attribute (list_view, column));
g_free (default_sort_attribute);
nautilus_file_set_boolean_metadata
(file,
NAUTILUS_METADATA_KEY_LIST_VIEW_SORT_REVERSED,
FALSE,
default_sort_reversed_auto_value,
reversed);
list = get_list (list_view);
......@@ -1923,13 +1996,13 @@ fm_list_view_sort_items (FMListView *list_view,
* games with the sort order in list_view_compare_files_for_sort
* to make up for this.
*/
eel_clist_set_sort_type (clist, reversed
eel_list_set_sort_type (list, reversed
? GTK_SORT_DESCENDING
: GTK_SORT_ASCENDING);
list_view->details->sort_reversed = reversed;
}
eel_clist_set_sort_column (clist, column);
eel_list_set_sort_column (list, column);
eel_clist_sort (clist);
}
......@@ -1975,11 +2048,16 @@ get_sort_column_from_attribute (FMListView *list_view,
const char *value)
{
int result;
char *default_sort_attribute;
result = get_column_from_attribute (list_view, value);
if (result == LIST_VIEW_COLUMN_NONE)
if (result == LIST_VIEW_COLUMN_NONE) {
default_sort_attribute = get_default_sort_attribute (list_view);
result = get_column_from_attribute (list_view,
LIST_VIEW_DEFAULT_SORTING_ATTRIBUTE);
default_sort_attribute);
g_free (default_sort_attribute);
}
return result;
}
......@@ -2205,10 +2283,30 @@ fm_list_view_column_set (FMListViewColumn *column,
column->right_justified = right_justified;
}
static char *
get_attribute_from_sort_type (NautilusFileSortType sort_type)
{
switch (sort_type) {
case NAUTILUS_FILE_SORT_BY_NAME:
return g_strdup ("name");
case NAUTILUS_FILE_SORT_BY_SIZE:
return g_strdup ("size");
case NAUTILUS_FILE_SORT_BY_TYPE:
return g_strdup ("type");
case NAUTILUS_FILE_SORT_BY_MTIME:
return g_strdup ("date_modified");
case NAUTILUS_FILE_SORT_BY_EMBLEMS:
return g_strdup ("emblems");
default:
g_warning ("unknown sort type %d in get_attribute_from_sort_type", sort_type);
return g_strdup ("name");
}
}
static char *
real_get_default_sort_attribute (FMListView *view)
{
return g_strdup (LIST_VIEW_DEFAULT_SORTING_ATTRIBUTE);
return get_attribute_from_sort_type (default_sort_order_auto_value);
}
static int
......
......@@ -33,6 +33,9 @@
<cmd name="Remove Custom Icons"
_label="Remove Custom Images"
_tip="Remove any custom images from selected icons"/>
<cmd name="Reset to Defaults"
_label="Reset to View Preferences"
_tip="Reset sorting order and zoom level to match preferences for this view"/>
<cmd name="Reset Background"
_label="Reset Background"
_tip="Remove any custom pattern or color from the background of this location"/>
......@@ -159,6 +162,14 @@
</placeholder>
</submenu>
<submenu name="View">
<placeholder name="View Preferences Placeholder">
<menuitem name="Reset to Defaults"
_label="Reset to View _Preferences"
verb="Reset to Defaults"/>
</placeholder>
</submenu>
</menu>
<popups>
<popup name="background">
......
......@@ -51,6 +51,7 @@
#include <libgnomeui/gnome-client.h>
#include <libgnomeui/gnome-messagebox.h>
#include <libgnomeui/gnome-stock.h>
#include <libgnomevfs/gnome-vfs-mime-handlers.h>
#include <libgnomevfs/gnome-vfs-ops.h>
#include <libgnomevfs/gnome-vfs-utils.h>
#include <libnautilus-extensions/nautilus-file-utilities.h>
......@@ -334,6 +335,37 @@ nautilus_make_uri_list_from_shell_strv (const char * const *strv)
return uri_list;
}
/* This is a bit of a hack to make the Preferences dialog version of the List View/Icon View
* default choice work with the gnome-vfs-based mechanism for choosing a handler for a MIME type.
*/
static void
default_folder_viewer_changed_callback (gpointer callback_data)
{
int preference_value;
const char *viewer_iid;
g_assert (callback_data == NULL);
preference_value =
nautilus_preferences_get_integer (NAUTILUS_PREFERENCES_DEFAULT_FOLDER_VIEWER);
if (preference_value == NAUTILUS_DEFAULT_FOLDER_VIEWER_LIST_VIEW) {
viewer_iid = LIST_VIEW_IID;
} else {
g_return_if_fail (preference_value == NAUTILUS_DEFAULT_FOLDER_VIEWER_ICON_VIEW);
viewer_iid = ICON_VIEW_IID;
}
gnome_vfs_mime_set_default_action_type ("x-directory/normal", GNOME_VFS_MIME_ACTION_TYPE_COMPONENT);
gnome_vfs_mime_set_default_component ("x-directory/normal", viewer_iid);
/* FIXME bugzilla.eazel.com 8024:
* when preference changes, we tell gnome-vfs. But if gnome-vfs value changes
* some other way, preferences mechanism isn't told, so value displayed in
* preferences dialog might be incorrect.
*/
}
void
nautilus_application_startup (NautilusApplication *application,
gboolean kill_shell,
......@@ -499,6 +531,11 @@ nautilus_application_startup (NautilusApplication *application,
application,
GTK_OBJECT (application));
nautilus_preferences_add_callback_while_alive (NAUTILUS_PREFERENCES_DEFAULT_FOLDER_VIEWER,
default_folder_viewer_changed_callback,
NULL,
GTK_OBJECT (application));
/* CORBA C mapping doesn't allow NULL to be passed
for string parameters */
corba_geometry = (geometry != NULL) ? geometry : "";
......
......@@ -157,6 +157,7 @@
_tip="Change the visibility of this window's status bar"
verb="Show Hide Status Bar"/>
</placeholder>
<placeholder name="View Preferences Placeholder" delimit = "top"/>
<placeholder name="View Items Placeholder" delimit="top"/>
<placeholder name="Zoom Items Placeholder" delimit="top">
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment