diff options
author | Alexander Larsson <alexl@redhat.com> | 2010-07-23 10:58:56 +0200 |
---|---|---|
committer | Alexander Larsson <alexl@redhat.com> | 2010-07-23 12:22:56 +0200 |
commit | 36c238331d19b9a33f13fcbaf49928f35b78ff8c (patch) | |
tree | a99690da8bf82ed5fdca380dabcc2d6ff8c20fa3 /libnautilus-private | |
parent | 000b73a429932d9816aaf5e69cd521675b39b548 (diff) | |
download | nautilus-36c238331d19b9a33f13fcbaf49928f35b78ff8c.tar.gz |
Convert list-view preferences to gsettings
Also removes unused default-use-manual-layout setting, and
joins the sort order preferences of the list view and the icon
view.
Diffstat (limited to 'libnautilus-private')
-rw-r--r-- | libnautilus-private/nautilus-global-preferences.c | 57 | ||||
-rw-r--r-- | libnautilus-private/nautilus-global-preferences.h | 24 |
2 files changed, 7 insertions, 74 deletions
diff --git a/libnautilus-private/nautilus-global-preferences.c b/libnautilus-private/nautilus-global-preferences.c index da255e5e8..2a2da50d7 100644 --- a/libnautilus-private/nautilus-global-preferences.c +++ b/libnautilus-private/nautilus-global-preferences.c @@ -160,24 +160,6 @@ typedef struct */ static const PreferenceDefault preference_defaults[] = { - /* List View Default Preferences */ - { NAUTILUS_PREFERENCES_LIST_VIEW_DEFAULT_SORT_ORDER, - PREFERENCE_STRING, - "name", - NULL, NULL, - NULL, - }, - { NAUTILUS_PREFERENCES_LIST_VIEW_DEFAULT_SORT_IN_REVERSE_ORDER, - PREFERENCE_BOOLEAN, - GINT_TO_POINTER (FALSE) - }, - { NAUTILUS_PREFERENCES_LIST_VIEW_DEFAULT_ZOOM_LEVEL, - PREFERENCE_STRING, - "smaller", - NULL, NULL, - "default_zoom_level" - }, - { NAUTILUS_PREFERENCES_LOCKDOWN_COMMAND_LINE, PREFERENCE_BOOLEAN, GINT_TO_POINTER (FALSE) @@ -328,38 +310,6 @@ nautilus_global_preferences_get_default_folder_viewer_preference_as_iid (void) return g_strdup (viewer_iid); } -/* 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 = - g_settings_get_enum (nautilus_icon_view_preferences, - NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_SORT_ORDER_OR_MANUAL_LAYOUT); - - g_settings_set_boolean (nautilus_icon_view_preferences, 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_DISPLAY_NAME); - g_return_if_fail (default_sort_order <= NAUTILUS_FILE_SORT_BY_EMBLEMS); - - g_settings_set_enum (nautilus_icon_view_preferences, - NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_SORT_ORDER, - default_sort_order); - } -} - void nautilus_global_preferences_init (void) { @@ -388,16 +338,11 @@ nautilus_global_preferences_init (void) nautilus_media_preferences = g_settings_new("org.gnome.media-handling"); nautilus_window_state = g_settings_new("org.gnome.nautilus.window-state"); nautilus_icon_view_preferences = g_settings_new("org.gnome.nautilus.icon-view"); + nautilus_list_view_preferences = g_settings_new("org.gnome.nautilus.list-view"); nautilus_compact_view_preferences = g_settings_new("org.gnome.nautilus.compact-view"); nautilus_desktop_preferences = g_settings_new("org.gnome.nautilus.desktop"); nautilus_tree_sidebar_preferences = g_settings_new("org.gnome.nautilus.sidebar-panels.tree"); - /* Set up storage for values accessed in this file */ - g_signal_connect_swapped (nautilus_icon_view_preferences, - "changed::" NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_SORT_ORDER_OR_MANUAL_LAYOUT, - G_CALLBACK (default_icon_view_sort_order_or_manual_layout_changed_callback), - NULL); - /* Preload everything in a big batch */ eel_gconf_preload_cache ("/apps/nautilus/preferences", GCONF_CLIENT_PRELOAD_ONELEVEL); diff --git a/libnautilus-private/nautilus-global-preferences.h b/libnautilus-private/nautilus-global-preferences.h index 26c645338..4968857ea 100644 --- a/libnautilus-private/nautilus-global-preferences.h +++ b/libnautilus-private/nautilus-global-preferences.h @@ -116,6 +116,8 @@ typedef enum /* Sorting order */ #define NAUTILUS_PREFERENCES_SORT_DIRECTORIES_FIRST "sort-directories-first" +#define NAUTILUS_PREFERENCES_DEFAULT_SORT_ORDER "default-sort-order" +#define NAUTILUS_PREFERENCES_DEFAULT_SORT_IN_REVERSE_ORDER "default-sort-in-reverse-order" /* The default folder viewer - one of the two enums below */ #define NAUTILUS_PREFERENCES_DEFAULT_FOLDER_VIEWER "default-folder-viewer" @@ -135,24 +137,11 @@ enum /* Icon View */ -#define NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_SORT_IN_REVERSE_ORDER "default-sort-in-reverse-order" -#define NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_SORT_ORDER "default-sort-order" #define NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_USE_TIGHTER_LAYOUT "default-use-tighter-layout" #define NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_ZOOM_LEVEL "default-zoom-level" -#define NAUTILUS_PREFERENCES_ICON_VIEW_DEFAULT_USE_MANUAL_LAYOUT "default-use-manual-layout" #define NAUTILUS_PREFERENCES_ICON_VIEW_LABELS_BESIDE_ICONS "labels-beside-icons" - -/* 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 "default-sort-order-or-manual-layout" - /* Which text attributes appear beneath icon names */ #define NAUTILUS_PREFERENCES_ICON_VIEW_CAPTIONS "captions" @@ -168,11 +157,9 @@ enum #define NAUTILUS_PREFERENCES_COMPACT_VIEW_ALL_COLUMNS_SAME_WIDTH "all-columns-have-same-width" /* List View */ -#define NAUTILUS_PREFERENCES_LIST_VIEW_DEFAULT_SORT_IN_REVERSE_ORDER "list_view/default_sort_in_reverse_order" -#define NAUTILUS_PREFERENCES_LIST_VIEW_DEFAULT_SORT_ORDER "list_view/default_sort_order" -#define NAUTILUS_PREFERENCES_LIST_VIEW_DEFAULT_ZOOM_LEVEL "list_view/default_zoom_level" -#define NAUTILUS_PREFERENCES_LIST_VIEW_DEFAULT_VISIBLE_COLUMNS "list_view/default_visible_columns" -#define NAUTILUS_PREFERENCES_LIST_VIEW_DEFAULT_COLUMN_ORDER "list_view/default_column_order" +#define NAUTILUS_PREFERENCES_LIST_VIEW_DEFAULT_ZOOM_LEVEL "default-zoom-level" +#define NAUTILUS_PREFERENCES_LIST_VIEW_DEFAULT_VISIBLE_COLUMNS "default-visible-columns" +#define NAUTILUS_PREFERENCES_LIST_VIEW_DEFAULT_COLUMN_ORDER "default-column-order" enum { @@ -224,6 +211,7 @@ char *nautilus_global_preferences_get_default_folder_viewer_preference_as_iid (v GSettings *nautilus_preferences; GSettings *nautilus_icon_view_preferences; +GSettings *nautilus_list_view_preferences; GSettings *nautilus_compact_view_preferences; GSettings *nautilus_desktop_preferences; GSettings *nautilus_tree_sidebar_preferences; |