From e13142565949e577ae589c0e93527b6698614281 Mon Sep 17 00:00:00 2001 From: Stefano Karapetsas Date: Wed, 5 Sep 2012 20:43:59 +0200 Subject: convert list-view preferences to gsettings also move the sort order prefs from view-specific to common prefs we already only have one UI setting that controls both, so it makes no sense to have two settings. (from nautilus 3.0) --- libcaja-private/caja-global-preferences.c | 55 +--------------------------- libcaja-private/caja-global-preferences.h | 24 ++++-------- libcaja-private/org.mate.caja.gschema.xml.in | 44 +++++++--------------- 3 files changed, 21 insertions(+), 102 deletions(-) (limited to 'libcaja-private') diff --git a/libcaja-private/caja-global-preferences.c b/libcaja-private/caja-global-preferences.c index 4331b858..64e47ee2 100644 --- a/libcaja-private/caja-global-preferences.c +++ b/libcaja-private/caja-global-preferences.c @@ -164,27 +164,6 @@ typedef struct */ static const PreferenceDefault preference_defaults[] = { - /* List View Default Preferences */ - { - CAJA_PREFERENCES_LIST_VIEW_DEFAULT_SORT_ORDER, - PREFERENCE_STRING, - "name", - NULL, NULL, - NULL, - }, - { - CAJA_PREFERENCES_LIST_VIEW_DEFAULT_SORT_IN_REVERSE_ORDER, - PREFERENCE_BOOLEAN, - GINT_TO_POINTER (FALSE) - }, - { - CAJA_PREFERENCES_LIST_VIEW_DEFAULT_ZOOM_LEVEL, - PREFERENCE_STRING, - "smaller", - NULL, NULL, - "default_zoom_level" - }, - { CAJA_PREFERENCES_LOCKDOWN_COMMAND_LINE, PREFERENCE_BOOLEAN, @@ -350,39 +329,6 @@ caja_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 caja-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 (caja_icon_view_preferences, - CAJA_PREFERENCES_ICON_VIEW_DEFAULT_SORT_ORDER_OR_MANUAL_LAYOUT); - - eel_preferences_set_boolean (CAJA_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 >= CAJA_FILE_SORT_BY_DISPLAY_NAME); - g_return_if_fail (default_sort_order <= CAJA_FILE_SORT_BY_EMBLEMS); - - g_settings_set_enum (caja_icon_view_preferences, - CAJA_PREFERENCES_ICON_VIEW_DEFAULT_SORT_ORDER, - default_sort_order); - } -} - void caja_global_preferences_init (void) { @@ -416,6 +362,7 @@ caja_global_preferences_init (void) caja_compact_view_preferences = g_settings_new("org.mate.caja.compact-view"); caja_desktop_preferences = g_settings_new("org.mate.caja.desktop"); caja_tree_sidebar_preferences = g_settings_new("org.mate.caja.sidebar-panels.tree"); + caja_list_view_preferences = g_settings_new("org.mate.caja.list-view"); /* Set up storage for values accessed in this file */ g_signal_connect_swapped (caja_icon_view_preferences, diff --git a/libcaja-private/caja-global-preferences.h b/libcaja-private/caja-global-preferences.h index 7c001457..a05bc049 100644 --- a/libcaja-private/caja-global-preferences.h +++ b/libcaja-private/caja-global-preferences.h @@ -115,7 +115,9 @@ G_BEGIN_DECLS #define CAJA_WINDOW_STATE_SIDEBAR_WIDTH "sidebar-width" /* Sorting order */ -#define CAJA_PREFERENCES_SORT_DIRECTORIES_FIRST "sort-directories-first" +#define CAJA_PREFERENCES_SORT_DIRECTORIES_FIRST "sort-directories-first" +#define CAJA_PREFERENCES_DEFAULT_SORT_ORDER "default-sort-order" +#define CAJA_PREFERENCES_DEFAULT_SORT_IN_REVERSE_ORDER "default-sort-in-reverse-order" /* The default folder viewer - one of the two enums below */ #define CAJA_PREFERENCES_DEFAULT_FOLDER_VIEWER "default-folder-viewer" @@ -135,23 +137,12 @@ G_BEGIN_DECLS /* Icon View */ -#define CAJA_PREFERENCES_ICON_VIEW_DEFAULT_SORT_IN_REVERSE_ORDER "default-sort-in-reverse-order" -#define CAJA_PREFERENCES_ICON_VIEW_DEFAULT_SORT_ORDER "default-sort-order" #define CAJA_PREFERENCES_ICON_VIEW_DEFAULT_USE_TIGHTER_LAYOUT "default-use-tighter-layout" #define CAJA_PREFERENCES_ICON_VIEW_DEFAULT_ZOOM_LEVEL "default-zoom-level" -#define CAJA_PREFERENCES_ICON_VIEW_DEFAULT_USE_MANUAL_LAYOUT "default-use-manual-layout" #define CAJA_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 caja-global-preferences.c we install callbacks for - * the proxy preference and update the other 2 when it changes - */ -#define CAJA_PREFERENCES_ICON_VIEW_DEFAULT_SORT_ORDER_OR_MANUAL_LAYOUT "default-sort-order-or-manual-layout" /* Which text attributes appear beneath icon names */ #define CAJA_PREFERENCES_ICON_VIEW_CAPTIONS "captions" @@ -168,11 +159,9 @@ G_BEGIN_DECLS #define CAJA_PREFERENCES_COMPACT_VIEW_ALL_COLUMNS_SAME_WIDTH "all-columns-have-same-width" /* List View */ -#define CAJA_PREFERENCES_LIST_VIEW_DEFAULT_SORT_IN_REVERSE_ORDER "list_view/default_sort_in_reverse_order" -#define CAJA_PREFERENCES_LIST_VIEW_DEFAULT_SORT_ORDER "list_view/default_sort_order" -#define CAJA_PREFERENCES_LIST_VIEW_DEFAULT_ZOOM_LEVEL "list_view/default_zoom_level" -#define CAJA_PREFERENCES_LIST_VIEW_DEFAULT_VISIBLE_COLUMNS "list_view/default_visible_columns" -#define CAJA_PREFERENCES_LIST_VIEW_DEFAULT_COLUMN_ORDER "list_view/default_column_order" +#define CAJA_PREFERENCES_LIST_VIEW_DEFAULT_ZOOM_LEVEL "default-zoom-level" +#define CAJA_PREFERENCES_LIST_VIEW_DEFAULT_VISIBLE_COLUMNS "default-visible-columns" +#define CAJA_PREFERENCES_LIST_VIEW_DEFAULT_COLUMN_ORDER "default-column-order" enum { @@ -229,6 +218,7 @@ GSettings *caja_icon_view_preferences; GSettings *caja_desktop_preferences; GSettings *caja_tree_sidebar_preferences; GSettings *caja_compact_view_preferences; +GSettings *caja_list_view_preferences; G_END_DECLS diff --git a/libcaja-private/org.mate.caja.gschema.xml.in b/libcaja-private/org.mate.caja.gschema.xml.in index a7f608e5..f0357242 100644 --- a/libcaja-private/org.mate.caja.gschema.xml.in +++ b/libcaja-private/org.mate.caja.gschema.xml.in @@ -168,6 +168,19 @@ <_summary>Show folders first in windows <_description>If set to true, then Caja shows folders prior to showing files in the icon and list views. + + + + + 'name' + <_summary>Default sort order + <_description>The default sort-order for items in the icon view. Possible values are "name", "size", "type", "mtime", and "emblems". + + + false + <_summary>Reverse sort order in new windows + <_description>If true, files in new windows will be sorted in reverse order. ie, if sorted by name, then instead of sorting the files from "a" to "z", they will be sorted from "z" to "a"; if sorted by size, instead of being incrementally they will be sorted decrementally. + true <_summary>Caja handles drawing the desktop @@ -245,19 +258,6 @@ "size", "type", "date_modified", "date_changed", "date_accessed", "owner", "group", "permissions", "octal_permissions" and "mime_type". - - - - - 'name' - <_summary>Default sort order - <_description>The default sort-order for items in the icon view. Possible values are "name", "size", "type", "mtime", and "emblems". - - - false - <_summary>Reverse sort order in new windows - <_description>If true, files in new windows will be sorted in reverse order. ie, if sorted by name, then instead of sorting the files from "a" to "z", they will be sorted from "z" to "a"; if sorted by size, instead of being incrementally they will be sorted decrementally. - false <_summary>Use tighter layout in new windows @@ -268,11 +268,6 @@ <_summary>Put labels beside icons <_description>If true, labels will be placed beside icons rather than underneath them. - - false - <_summary>Use manual layout in new windows - <_description>If true, new windows will use manual layout by default. - 'standard' <_summary>Default icon zoom level @@ -322,19 +317,6 @@ - - - - - 'name' - <_summary>Default sort order - <_description>The default sort-order for the items in the list view. Possible values are "name", "size", "type", and "mtime". - - - false - <_summary>Reverse sort order in new windows - <_description>If true, files in new windows will be sorted in reverse order. ie, if sorted by name, then instead of sorting the files from "a" to "z", they will be sorted from "z" to "a". - 'smaller' <_summary>Default list zoom level -- cgit v1.2.1