summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRamiro Estrugo <ramiro@src.gnome.org>2001-04-30 08:20:18 +0000
committerRamiro Estrugo <ramiro@src.gnome.org>2001-04-30 08:20:18 +0000
commitf0909799405f2b96d11f99e9a212883f56c6f53e (patch)
tree8f4e663ea9c1ac6850c0874a4c684e5faaa38ebc
parent2ffbdddee1202f7cc5b8392a42fe0b7a514ff16f (diff)
downloadnautilus-f0909799405f2b96d11f99e9a212883f56c6f53e.tar.gz
Add preferences for default manual layout support.
* libnautilus-extensions/nautilus-global-preferences.h: Add preferences for default manual layout support. * libnautilus-extensions/nautilus-global-preferences.c: (default_icon_view_sort_order_or_manual_layout_changed_callback), (nautilus_global_preferences_initialize): Use different enumerations for icon view and list view default sort order since only icon view supports manual layout. Add entries for default manual layout preference. Add proxy preference for both icon view sort order and manual layout so that it can be presented to the user as one choice and thus just one menu. This also matches the view menu. * libnautilus-extensions/nautilus-preferences-item.c: (preferences_item_create_enumeration_list), (preferences_item_create_enumeration_menu): Add support for separators in string pickers. * src/file-manager/fm-icon-view.c: (get_default_directory_manual_layout), (fm_icon_view_real_get_directory_auto_layout), (fm_icon_view_real_set_directory_auto_layout), (fm_icon_view_reset_to_defaults), (default_use_manual_layout_changed_callback), (fm_icon_view_initialize): Add support for a default "use manual layout" preference. * src/nautilus-preferences-dialog.c: Make the default sort order preference use the proxy prefernece instead of the real one.
-rw-r--r--ChangeLog33
-rw-r--r--libnautilus-extensions/nautilus-global-preferences.c90
-rw-r--r--libnautilus-extensions/nautilus-global-preferences.h10
-rw-r--r--libnautilus-extensions/nautilus-preferences-item.c19
-rw-r--r--libnautilus-private/nautilus-global-preferences.c90
-rw-r--r--libnautilus-private/nautilus-global-preferences.h10
-rw-r--r--libnautilus-private/nautilus-preferences-item.c19
-rw-r--r--src/file-manager/fm-icon-view.c60
-rw-r--r--src/nautilus-preferences-dialog.c2
9 files changed, 284 insertions, 49 deletions
diff --git a/ChangeLog b/ChangeLog
index 1cfb6813c..a9fce9b31 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,36 @@
+2001-04-30 Ramiro Estrugo <ramiro@eazel.com>
+
+ * libnautilus-extensions/nautilus-global-preferences.h:
+ Add preferences for default manual layout support.
+
+ * libnautilus-extensions/nautilus-global-preferences.c:
+ (default_icon_view_sort_order_or_manual_layout_changed_callback),
+ (nautilus_global_preferences_initialize):
+ Use different enumerations for icon view and list view default
+ sort order since only icon view supports manual layout. Add
+ entries for default manual layout preference. Add proxy
+ preference for both icon view sort order and manual layout so that
+ it can be presented to the user as one choice and thus just one
+ menu. This also matches the view menu.
+
+ * libnautilus-extensions/nautilus-preferences-item.c:
+ (preferences_item_create_enumeration_list),
+ (preferences_item_create_enumeration_menu):
+ Add support for separators in string pickers.
+
+ * src/file-manager/fm-icon-view.c:
+ (get_default_directory_manual_layout),
+ (fm_icon_view_real_get_directory_auto_layout),
+ (fm_icon_view_real_set_directory_auto_layout),
+ (fm_icon_view_reset_to_defaults),
+ (default_use_manual_layout_changed_callback),
+ (fm_icon_view_initialize):
+ Add support for a default "use manual layout" preference.
+
+ * src/nautilus-preferences-dialog.c:
+ Make the default sort order preference use the proxy prefernece
+ instead of the real one.
+
2001-04-29 Dan Mueth <dan@eazel.com>
Fixing some markup errors.
diff --git a/libnautilus-extensions/nautilus-global-preferences.c b/libnautilus-extensions/nautilus-global-preferences.c
index 401483500..91b65e11e 100644
--- a/libnautilus-extensions/nautilus-global-preferences.c
+++ b/libnautilus-extensions/nautilus-global-preferences.c
@@ -44,6 +44,7 @@
/* Constants */
#define STRING_LIST_DEFAULT_TOKENS_DELIMETER ","
+#define PREFERENCES_SORT_ORDER_MANUALLY 100
/* base path for NAUTILUS_PREFERENCES_HTTP_* */
static const char SYSTEM_GNOME_VFS_PATH[] = "/system/gnome-vfs";
@@ -144,11 +145,22 @@ static EelEnumerationEntry default_folder_viewer_enum_entries[] = {
{ NULL }
};
-static EelEnumerationEntry default_sort_order_enum_entries[] = {
+static EelEnumerationEntry default_icon_view_sort_order_enum_entries[] = {
+ { "manually", N_("Manually"), PREFERENCES_SORT_ORDER_MANUALLY },
+ { "--------", "--------" },
{ "name", N_("By Name"), NAUTILUS_FILE_SORT_BY_NAME },
{ "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 },
+ { "modification_date", N_("By Modification Date"), NAUTILUS_FILE_SORT_BY_MTIME },
+ { "emblems", N_("By Emblems"), NAUTILUS_FILE_SORT_BY_EMBLEMS },
+ { NULL }
+};
+
+static EelEnumerationEntry default_list_view_sort_order_enum_entries[] = {
+ { "name", N_("By Name"), NAUTILUS_FILE_SORT_BY_NAME },
+ { "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 },
{ "emblems", N_("By Emblems"), NAUTILUS_FILE_SORT_BY_EMBLEMS },
{ NULL }
};
@@ -186,16 +198,17 @@ static EelEnumerationEntry icon_captions_enum_entries[] = {
* storage (GConf) and the displayed values.
*/
static EelEnumerationInfo enumerations[] = {
- { "click_policy", click_policy_enum_entries },
- { "default_folder_viewer", default_folder_viewer_enum_entries },
- { "default_sort_order", default_sort_order_enum_entries },
- { "default_zoom_level", default_zoom_level_enum_entries },
- { "executable_text_activation", executable_text_activation_enum_entries },
- { "file_size", file_size_enum_entries },
- { "search_bar_type", search_bar_type_enum_entries },
- { "speed_tradeoff", speed_tradeoff_enum_entries },
- { "standard_font_size", standard_font_size_entries },
- { "icon_captions", icon_captions_enum_entries },
+ { "click_policy", click_policy_enum_entries },
+ { "default_folder_viewer", default_folder_viewer_enum_entries },
+ { "default_icon_view_sort_order", default_icon_view_sort_order_enum_entries },
+ { "default_list_view_sort_order", default_list_view_sort_order_enum_entries },
+ { "default_zoom_level", default_zoom_level_enum_entries },
+ { "executable_text_activation", executable_text_activation_enum_entries },
+ { "file_size", file_size_enum_entries },
+ { "icon_captions", icon_captions_enum_entries },
+ { "search_bar_type", search_bar_type_enum_entries },
+ { "speed_tradeoff", speed_tradeoff_enum_entries },
+ { "standard_font_size", standard_font_size_entries },
{ NULL }
};
@@ -577,7 +590,14 @@ static const PreferenceDefault preference_defaults[] = {
NAUTILUS_USER_LEVEL_NOVICE,
{ NAUTILUS_USER_LEVEL_NOVICE, GINT_TO_POINTER (NAUTILUS_FILE_SORT_BY_NAME) },
{ USER_LEVEL_NONE },
- "default_sort_order"
+ "default_icon_view_sort_order"
+ },
+ { NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_SORT_ORDER_OR_MANUAL_LAYOUT,
+ PREFERENCE_INTEGER,
+ NAUTILUS_USER_LEVEL_NOVICE,
+ { NAUTILUS_USER_LEVEL_NOVICE, GINT_TO_POINTER (NAUTILUS_FILE_SORT_BY_NAME) },
+ { USER_LEVEL_NONE },
+ "default_icon_view_sort_order"
},
{ NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_SORT_IN_REVERSE_ORDER,
PREFERENCE_BOOLEAN,
@@ -591,6 +611,12 @@ static const PreferenceDefault preference_defaults[] = {
{ NAUTILUS_USER_LEVEL_NOVICE, GINT_TO_POINTER (FALSE) },
{ USER_LEVEL_NONE }
},
+ { NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_USE_MANUAL_LAYOUT,
+ PREFERENCE_BOOLEAN,
+ NAUTILUS_USER_LEVEL_NOVICE,
+ { NAUTILUS_USER_LEVEL_NOVICE, GINT_TO_POINTER (FALSE) },
+ { USER_LEVEL_NONE }
+ },
{ NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_ZOOM_LEVEL,
PREFERENCE_INTEGER,
NAUTILUS_USER_LEVEL_NOVICE,
@@ -618,7 +644,7 @@ static const PreferenceDefault preference_defaults[] = {
NAUTILUS_USER_LEVEL_NOVICE,
{ NAUTILUS_USER_LEVEL_NOVICE, GINT_TO_POINTER (NAUTILUS_FILE_SORT_BY_NAME) },
{ USER_LEVEL_NONE },
- "default_sort_order"
+ "default_list_view_sort_order"
},
{ NAUTILUS_PREFERENCES_LIST_VIEW_DEFAULT_SORT_IN_REVERSE_ORDER,
PREFERENCE_BOOLEAN,
@@ -1013,6 +1039,36 @@ nautilus_global_preferences_set_default_folder_viewer (const char *iid)
viewer_preference);
}
+/* The icon view uses 2 variables to store the sort order and
+ * whether to use manual layout. However, the UI for these
+ * preferences presensts them as single option menu. So we
+ * use the following preference as a proxy for the other two.
+ * In nautilus-global-preferences.c we install callbacks for
+ * the proxy preference and update the other 2 when it changes
+ */
+static void
+default_icon_view_sort_order_or_manual_layout_changed_callback (gpointer callback_data)
+{
+ int default_sort_order_or_manual_layout;
+ int default_sort_order;
+
+ default_sort_order_or_manual_layout =
+ nautilus_preferences_get_integer (NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_SORT_ORDER_OR_MANUAL_LAYOUT);
+
+ nautilus_preferences_set_boolean (NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_USE_MANUAL_LAYOUT,
+ default_sort_order_or_manual_layout == PREFERENCES_SORT_ORDER_MANUALLY);
+
+ if (default_sort_order_or_manual_layout != PREFERENCES_SORT_ORDER_MANUALLY) {
+ default_sort_order = default_sort_order_or_manual_layout;
+
+ g_return_if_fail (default_sort_order >= NAUTILUS_FILE_SORT_BY_NAME);
+ g_return_if_fail (default_sort_order <= NAUTILUS_FILE_SORT_BY_EMBLEMS);
+
+ nautilus_preferences_set_integer (NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_SORT_ORDER,
+ default_sort_order);
+ }
+}
+
void
nautilus_global_preferences_initialize (void)
{
@@ -1043,11 +1099,15 @@ nautilus_global_preferences_initialize (void)
nautilus_preferences_add_callback (NAUTILUS_PREFERENCES_SMOOTH_GRAPHICS_MODE,
smooth_graphics_mode_changed_callback,
NULL);
-
+
nautilus_preferences_add_callback (NAUTILUS_PREFERENCES_DEFAULT_FOLDER_VIEWER,
default_folder_viewer_changed_callback,
NULL);
+ nautilus_preferences_add_callback (NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_SORT_ORDER_OR_MANUAL_LAYOUT,
+ default_icon_view_sort_order_or_manual_layout_changed_callback,
+ NULL);
+
/* Keep track of smooth graphics mode changes in order to notify the smooth
* widget machinery.
*/
diff --git a/libnautilus-extensions/nautilus-global-preferences.h b/libnautilus-extensions/nautilus-global-preferences.h
index 4df0c47b5..1e9080ec5 100644
--- a/libnautilus-extensions/nautilus-global-preferences.h
+++ b/libnautilus-extensions/nautilus-global-preferences.h
@@ -118,9 +118,19 @@ enum
#define NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_USE_TIGHTER_LAYOUT "icon-view/default_use_tighter_layout"
#define NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_ZOOM_LEVEL "icon-view/default_zoom_level"
#define NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_ZOOM_LEVEL_FONT_SIZE "icon-view/default_zoom_level_font_size"
+#define NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_USE_MANUAL_LAYOUT "icon-view/default_use_manual_layout"
#define NAUTILUS_PREFERENCES_ICON_VIEW_FONT "icon-view/font"
#define NAUTILUS_PREFERENCES_ICON_VIEW_SMOOTH_FONT "icon-view/smooth_font"
+/* The icon view uses 2 variables to store the sort order and
+ * whether to use manual layout. However, the UI for these
+ * preferences presensts them as single option menu. So we
+ * use the following preference as a proxy for the other two.
+ * In nautilus-global-preferences.c we install callbacks for
+ * the proxy preference and update the other 2 when it changes
+ */
+#define NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_SORT_ORDER_OR_MANUAL_LAYOUT "icon-view/default_sort_order_or_manual_layout"
+
/* Which text attributes appear beneath icon names */
#define NAUTILUS_PREFERENCES_ICON_VIEW_CAPTIONS "icon-view/captions"
diff --git a/libnautilus-extensions/nautilus-preferences-item.c b/libnautilus-extensions/nautilus-preferences-item.c
index 45460efd7..7fb0b3fd0 100644
--- a/libnautilus-extensions/nautilus-preferences-item.c
+++ b/libnautilus-extensions/nautilus-preferences-item.c
@@ -42,9 +42,8 @@
#include <gtk/gtkmain.h>
#include <gtk/gtksignal.h>
-static const guint PREFERENCES_ITEM_TITLE_SPACING = 4;
-static const guint PREFERENCES_ITEM_FRAME_BORDER_WIDTH = 6;
-static const NautilusPreferencesItemType PREFERENCES_ITEM_UNDEFINED_ITEM = -1U;
+#define PREFERENCES_ITEM_UNDEFINED_ITEM -1U
+
static gboolean text_idle_handler = FALSE;
static gboolean integer_idle_handler = FALSE;
@@ -490,8 +489,12 @@ preferences_item_create_enumeration_list (NautilusPreferencesItem *item,
for (i = 0; i < eel_enumeration_id_get_length (enumeration_id); i++) {
enum_description = eel_enumeration_id_get_nth_description_translated (enumeration_id, i);
g_assert (enum_description != NULL);
-
- eel_string_picker_insert_string (EEL_STRING_PICKER (string_picker), enum_description);
+
+ if (enum_description[0] == '-') {
+ eel_string_picker_insert_separator (EEL_STRING_PICKER (string_picker));
+ } else {
+ eel_string_picker_insert_string (EEL_STRING_PICKER (string_picker), enum_description);
+ }
g_free (enum_description);
}
@@ -704,7 +707,11 @@ preferences_item_create_enumeration_menu (NautilusPreferencesItem *item)
description = eel_enumeration_id_get_nth_description_translated (enumeration_id, i);
g_assert (description != NULL);
- eel_string_picker_insert_string (EEL_STRING_PICKER (child), description);
+ if (description[0] == '-') {
+ eel_string_picker_insert_separator (EEL_STRING_PICKER (child));
+ } else {
+ eel_string_picker_insert_string (EEL_STRING_PICKER (child), description);
+ }
g_free (description);
}
diff --git a/libnautilus-private/nautilus-global-preferences.c b/libnautilus-private/nautilus-global-preferences.c
index 401483500..91b65e11e 100644
--- a/libnautilus-private/nautilus-global-preferences.c
+++ b/libnautilus-private/nautilus-global-preferences.c
@@ -44,6 +44,7 @@
/* Constants */
#define STRING_LIST_DEFAULT_TOKENS_DELIMETER ","
+#define PREFERENCES_SORT_ORDER_MANUALLY 100
/* base path for NAUTILUS_PREFERENCES_HTTP_* */
static const char SYSTEM_GNOME_VFS_PATH[] = "/system/gnome-vfs";
@@ -144,11 +145,22 @@ static EelEnumerationEntry default_folder_viewer_enum_entries[] = {
{ NULL }
};
-static EelEnumerationEntry default_sort_order_enum_entries[] = {
+static EelEnumerationEntry default_icon_view_sort_order_enum_entries[] = {
+ { "manually", N_("Manually"), PREFERENCES_SORT_ORDER_MANUALLY },
+ { "--------", "--------" },
{ "name", N_("By Name"), NAUTILUS_FILE_SORT_BY_NAME },
{ "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 },
+ { "modification_date", N_("By Modification Date"), NAUTILUS_FILE_SORT_BY_MTIME },
+ { "emblems", N_("By Emblems"), NAUTILUS_FILE_SORT_BY_EMBLEMS },
+ { NULL }
+};
+
+static EelEnumerationEntry default_list_view_sort_order_enum_entries[] = {
+ { "name", N_("By Name"), NAUTILUS_FILE_SORT_BY_NAME },
+ { "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 },
{ "emblems", N_("By Emblems"), NAUTILUS_FILE_SORT_BY_EMBLEMS },
{ NULL }
};
@@ -186,16 +198,17 @@ static EelEnumerationEntry icon_captions_enum_entries[] = {
* storage (GConf) and the displayed values.
*/
static EelEnumerationInfo enumerations[] = {
- { "click_policy", click_policy_enum_entries },
- { "default_folder_viewer", default_folder_viewer_enum_entries },
- { "default_sort_order", default_sort_order_enum_entries },
- { "default_zoom_level", default_zoom_level_enum_entries },
- { "executable_text_activation", executable_text_activation_enum_entries },
- { "file_size", file_size_enum_entries },
- { "search_bar_type", search_bar_type_enum_entries },
- { "speed_tradeoff", speed_tradeoff_enum_entries },
- { "standard_font_size", standard_font_size_entries },
- { "icon_captions", icon_captions_enum_entries },
+ { "click_policy", click_policy_enum_entries },
+ { "default_folder_viewer", default_folder_viewer_enum_entries },
+ { "default_icon_view_sort_order", default_icon_view_sort_order_enum_entries },
+ { "default_list_view_sort_order", default_list_view_sort_order_enum_entries },
+ { "default_zoom_level", default_zoom_level_enum_entries },
+ { "executable_text_activation", executable_text_activation_enum_entries },
+ { "file_size", file_size_enum_entries },
+ { "icon_captions", icon_captions_enum_entries },
+ { "search_bar_type", search_bar_type_enum_entries },
+ { "speed_tradeoff", speed_tradeoff_enum_entries },
+ { "standard_font_size", standard_font_size_entries },
{ NULL }
};
@@ -577,7 +590,14 @@ static const PreferenceDefault preference_defaults[] = {
NAUTILUS_USER_LEVEL_NOVICE,
{ NAUTILUS_USER_LEVEL_NOVICE, GINT_TO_POINTER (NAUTILUS_FILE_SORT_BY_NAME) },
{ USER_LEVEL_NONE },
- "default_sort_order"
+ "default_icon_view_sort_order"
+ },
+ { NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_SORT_ORDER_OR_MANUAL_LAYOUT,
+ PREFERENCE_INTEGER,
+ NAUTILUS_USER_LEVEL_NOVICE,
+ { NAUTILUS_USER_LEVEL_NOVICE, GINT_TO_POINTER (NAUTILUS_FILE_SORT_BY_NAME) },
+ { USER_LEVEL_NONE },
+ "default_icon_view_sort_order"
},
{ NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_SORT_IN_REVERSE_ORDER,
PREFERENCE_BOOLEAN,
@@ -591,6 +611,12 @@ static const PreferenceDefault preference_defaults[] = {
{ NAUTILUS_USER_LEVEL_NOVICE, GINT_TO_POINTER (FALSE) },
{ USER_LEVEL_NONE }
},
+ { NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_USE_MANUAL_LAYOUT,
+ PREFERENCE_BOOLEAN,
+ NAUTILUS_USER_LEVEL_NOVICE,
+ { NAUTILUS_USER_LEVEL_NOVICE, GINT_TO_POINTER (FALSE) },
+ { USER_LEVEL_NONE }
+ },
{ NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_ZOOM_LEVEL,
PREFERENCE_INTEGER,
NAUTILUS_USER_LEVEL_NOVICE,
@@ -618,7 +644,7 @@ static const PreferenceDefault preference_defaults[] = {
NAUTILUS_USER_LEVEL_NOVICE,
{ NAUTILUS_USER_LEVEL_NOVICE, GINT_TO_POINTER (NAUTILUS_FILE_SORT_BY_NAME) },
{ USER_LEVEL_NONE },
- "default_sort_order"
+ "default_list_view_sort_order"
},
{ NAUTILUS_PREFERENCES_LIST_VIEW_DEFAULT_SORT_IN_REVERSE_ORDER,
PREFERENCE_BOOLEAN,
@@ -1013,6 +1039,36 @@ nautilus_global_preferences_set_default_folder_viewer (const char *iid)
viewer_preference);
}
+/* The icon view uses 2 variables to store the sort order and
+ * whether to use manual layout. However, the UI for these
+ * preferences presensts them as single option menu. So we
+ * use the following preference as a proxy for the other two.
+ * In nautilus-global-preferences.c we install callbacks for
+ * the proxy preference and update the other 2 when it changes
+ */
+static void
+default_icon_view_sort_order_or_manual_layout_changed_callback (gpointer callback_data)
+{
+ int default_sort_order_or_manual_layout;
+ int default_sort_order;
+
+ default_sort_order_or_manual_layout =
+ nautilus_preferences_get_integer (NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_SORT_ORDER_OR_MANUAL_LAYOUT);
+
+ nautilus_preferences_set_boolean (NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_USE_MANUAL_LAYOUT,
+ default_sort_order_or_manual_layout == PREFERENCES_SORT_ORDER_MANUALLY);
+
+ if (default_sort_order_or_manual_layout != PREFERENCES_SORT_ORDER_MANUALLY) {
+ default_sort_order = default_sort_order_or_manual_layout;
+
+ g_return_if_fail (default_sort_order >= NAUTILUS_FILE_SORT_BY_NAME);
+ g_return_if_fail (default_sort_order <= NAUTILUS_FILE_SORT_BY_EMBLEMS);
+
+ nautilus_preferences_set_integer (NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_SORT_ORDER,
+ default_sort_order);
+ }
+}
+
void
nautilus_global_preferences_initialize (void)
{
@@ -1043,11 +1099,15 @@ nautilus_global_preferences_initialize (void)
nautilus_preferences_add_callback (NAUTILUS_PREFERENCES_SMOOTH_GRAPHICS_MODE,
smooth_graphics_mode_changed_callback,
NULL);
-
+
nautilus_preferences_add_callback (NAUTILUS_PREFERENCES_DEFAULT_FOLDER_VIEWER,
default_folder_viewer_changed_callback,
NULL);
+ nautilus_preferences_add_callback (NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_SORT_ORDER_OR_MANUAL_LAYOUT,
+ default_icon_view_sort_order_or_manual_layout_changed_callback,
+ NULL);
+
/* Keep track of smooth graphics mode changes in order to notify the smooth
* widget machinery.
*/
diff --git a/libnautilus-private/nautilus-global-preferences.h b/libnautilus-private/nautilus-global-preferences.h
index 4df0c47b5..1e9080ec5 100644
--- a/libnautilus-private/nautilus-global-preferences.h
+++ b/libnautilus-private/nautilus-global-preferences.h
@@ -118,9 +118,19 @@ enum
#define NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_USE_TIGHTER_LAYOUT "icon-view/default_use_tighter_layout"
#define NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_ZOOM_LEVEL "icon-view/default_zoom_level"
#define NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_ZOOM_LEVEL_FONT_SIZE "icon-view/default_zoom_level_font_size"
+#define NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_USE_MANUAL_LAYOUT "icon-view/default_use_manual_layout"
#define NAUTILUS_PREFERENCES_ICON_VIEW_FONT "icon-view/font"
#define NAUTILUS_PREFERENCES_ICON_VIEW_SMOOTH_FONT "icon-view/smooth_font"
+/* The icon view uses 2 variables to store the sort order and
+ * whether to use manual layout. However, the UI for these
+ * preferences presensts them as single option menu. So we
+ * use the following preference as a proxy for the other two.
+ * In nautilus-global-preferences.c we install callbacks for
+ * the proxy preference and update the other 2 when it changes
+ */
+#define NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_SORT_ORDER_OR_MANUAL_LAYOUT "icon-view/default_sort_order_or_manual_layout"
+
/* Which text attributes appear beneath icon names */
#define NAUTILUS_PREFERENCES_ICON_VIEW_CAPTIONS "icon-view/captions"
diff --git a/libnautilus-private/nautilus-preferences-item.c b/libnautilus-private/nautilus-preferences-item.c
index 45460efd7..7fb0b3fd0 100644
--- a/libnautilus-private/nautilus-preferences-item.c
+++ b/libnautilus-private/nautilus-preferences-item.c
@@ -42,9 +42,8 @@
#include <gtk/gtkmain.h>
#include <gtk/gtksignal.h>
-static const guint PREFERENCES_ITEM_TITLE_SPACING = 4;
-static const guint PREFERENCES_ITEM_FRAME_BORDER_WIDTH = 6;
-static const NautilusPreferencesItemType PREFERENCES_ITEM_UNDEFINED_ITEM = -1U;
+#define PREFERENCES_ITEM_UNDEFINED_ITEM -1U
+
static gboolean text_idle_handler = FALSE;
static gboolean integer_idle_handler = FALSE;
@@ -490,8 +489,12 @@ preferences_item_create_enumeration_list (NautilusPreferencesItem *item,
for (i = 0; i < eel_enumeration_id_get_length (enumeration_id); i++) {
enum_description = eel_enumeration_id_get_nth_description_translated (enumeration_id, i);
g_assert (enum_description != NULL);
-
- eel_string_picker_insert_string (EEL_STRING_PICKER (string_picker), enum_description);
+
+ if (enum_description[0] == '-') {
+ eel_string_picker_insert_separator (EEL_STRING_PICKER (string_picker));
+ } else {
+ eel_string_picker_insert_string (EEL_STRING_PICKER (string_picker), enum_description);
+ }
g_free (enum_description);
}
@@ -704,7 +707,11 @@ preferences_item_create_enumeration_menu (NautilusPreferencesItem *item)
description = eel_enumeration_id_get_nth_description_translated (enumeration_id, i);
g_assert (description != NULL);
- eel_string_picker_insert_string (EEL_STRING_PICKER (child), description);
+ if (description[0] == '-') {
+ eel_string_picker_insert_separator (EEL_STRING_PICKER (child));
+ } else {
+ eel_string_picker_insert_string (EEL_STRING_PICKER (child), description);
+ }
g_free (description);
}
diff --git a/src/file-manager/fm-icon-view.c b/src/file-manager/fm-icon-view.c
index 9711506dd..eff93bc69 100644
--- a/src/file-manager/fm-icon-view.c
+++ b/src/file-manager/fm-icon-view.c
@@ -152,6 +152,7 @@ static void update_layout_menus (
static void default_sort_in_reverse_order_changed_callback (gpointer callback_data);
static void default_sort_order_changed_callback (gpointer callback_data);
static void default_use_tighter_layout_changed_callback (gpointer callback_data);
+static void default_use_manual_layout_changed_callback (gpointer callback_data);
static void default_zoom_level_changed_callback (gpointer callback_data);
static void default_zoom_level_font_size_changed_callback (gpointer callback_data);
static void font_changed_callback (gpointer callback_data);
@@ -729,6 +730,21 @@ fm_icon_view_real_set_directory_sort_reversed (FMIconView *icon_view,
}
/* maintainence of auto layout boolean */
+static gboolean default_directory_manual_layout = FALSE;
+
+static gboolean
+get_default_directory_manual_layout (void)
+{
+ static gboolean auto_storaged_added = FALSE;
+
+ if (auto_storaged_added == FALSE) {
+ auto_storaged_added = TRUE;
+ nautilus_preferences_add_auto_boolean (NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_USE_MANUAL_LAYOUT,
+ &default_directory_manual_layout);
+ }
+
+ return default_directory_manual_layout;
+}
static gboolean
fm_icon_view_get_directory_auto_layout (FMIconView *icon_view,
@@ -743,12 +759,13 @@ fm_icon_view_get_directory_auto_layout (FMIconView *icon_view,
get_directory_auto_layout, (icon_view, file));
}
+
static gboolean
fm_icon_view_real_get_directory_auto_layout (FMIconView *icon_view,
NautilusFile *file)
{
return nautilus_file_get_boolean_metadata
- (file, NAUTILUS_METADATA_KEY_ICON_VIEW_AUTO_LAYOUT, TRUE);
+ (file, NAUTILUS_METADATA_KEY_ICON_VIEW_AUTO_LAYOUT, !get_default_directory_manual_layout ());
}
static void
@@ -770,7 +787,8 @@ fm_icon_view_real_set_directory_auto_layout (FMIconView *icon_view,
gboolean auto_layout)
{
nautilus_file_set_boolean_metadata
- (file, NAUTILUS_METADATA_KEY_ICON_VIEW_AUTO_LAYOUT, TRUE,
+ (file, NAUTILUS_METADATA_KEY_ICON_VIEW_AUTO_LAYOUT,
+ !get_default_directory_manual_layout (),
auto_layout);
}
/* maintainence of tighter layout boolean */
@@ -1425,12 +1443,16 @@ fm_icon_view_reset_to_defaults (FMDirectoryView *view)
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_sort (icon_container);
+
+ /* Switch to manual layout of the default calls for it.
+ * This needs to happen last for the sort order menus
+ * to be in sync.
*/
- nautilus_icon_container_set_auto_layout (icon_container, FALSE);
+ if (get_default_directory_manual_layout ()) {
+ switch_to_manual_layout (icon_view);
+ }
- nautilus_icon_container_sort (icon_container);
update_layout_menus (icon_view);
fm_icon_view_restore_default_zoom_level (view);
@@ -2171,6 +2193,28 @@ default_use_tighter_layout_changed_callback (gpointer callback_data)
}
static void
+default_use_manual_layout_changed_callback (gpointer callback_data)
+{
+ FMIconView *icon_view;
+ NautilusFile *file;
+ NautilusIconContainer *icon_container;
+
+ g_return_if_fail (FM_IS_ICON_VIEW (callback_data));
+
+ icon_view = FM_ICON_VIEW (callback_data);
+
+ file = fm_directory_view_get_directory_as_file (FM_DIRECTORY_VIEW (icon_view));
+ icon_container = get_icon_container (icon_view);
+ g_return_if_fail (NAUTILUS_IS_ICON_CONTAINER (icon_container));
+
+ nautilus_icon_container_set_auto_layout (
+ icon_container,
+ fm_icon_view_get_directory_auto_layout (icon_view, file));
+
+ nautilus_icon_container_request_update_all (icon_container);
+}
+
+static void
default_zoom_level_changed_callback (gpointer callback_data)
{
FMIconView *icon_view;
@@ -2299,6 +2343,10 @@ fm_icon_view_initialize (FMIconView *icon_view)
default_use_tighter_layout_changed_callback,
icon_view,
GTK_OBJECT (icon_view));
+ nautilus_preferences_add_callback_while_alive (NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_USE_MANUAL_LAYOUT,
+ default_use_manual_layout_changed_callback,
+ icon_view,
+ GTK_OBJECT (icon_view));
nautilus_preferences_add_callback_while_alive (NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_ZOOM_LEVEL,
default_zoom_level_changed_callback,
icon_view,
diff --git a/src/nautilus-preferences-dialog.c b/src/nautilus-preferences-dialog.c
index 2bb9c7a8d..cc13ac1f6 100644
--- a/src/nautilus-preferences-dialog.c
+++ b/src/nautilus-preferences-dialog.c
@@ -193,7 +193,7 @@ static NautilusPreferencesItemDescription view_preferences_items[] = {
/* Icon View Defaults */
{ N_("Icon View Defaults"),
- NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_SORT_ORDER,
+ NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_SORT_ORDER_OR_MANUAL_LAYOUT,
N_("Lay Out Items:"),
NAUTILUS_PREFERENCE_ITEM_ENUMERATION_MENU
},