diff options
author | Ramiro Estrugo <ramiro@src.gnome.org> | 2001-04-30 08:20:18 +0000 |
---|---|---|
committer | Ramiro Estrugo <ramiro@src.gnome.org> | 2001-04-30 08:20:18 +0000 |
commit | f0909799405f2b96d11f99e9a212883f56c6f53e (patch) | |
tree | 8f4e663ea9c1ac6850c0874a4c684e5faaa38ebc /libnautilus-extensions | |
parent | 2ffbdddee1202f7cc5b8392a42fe0b7a514ff16f (diff) | |
download | nautilus-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.
Diffstat (limited to 'libnautilus-extensions')
-rw-r--r-- | libnautilus-extensions/nautilus-global-preferences.c | 90 | ||||
-rw-r--r-- | libnautilus-extensions/nautilus-global-preferences.h | 10 | ||||
-rw-r--r-- | libnautilus-extensions/nautilus-preferences-item.c | 19 |
3 files changed, 98 insertions, 21 deletions
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); } |