summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefano Karapetsas <[email protected]>2012-09-05 20:43:59 +0200
committerStefano Karapetsas <[email protected]>2012-09-05 20:43:59 +0200
commite13142565949e577ae589c0e93527b6698614281 (patch)
treee0901b68fe0de61118f9aa605d945b794a8ce39e
parentdb145cb919be1242260d06095660405f415774d6 (diff)
downloadcaja-e13142565949e577ae589c0e93527b6698614281.tar.bz2
caja-e13142565949e577ae589c0e93527b6698614281.tar.xz
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)
-rw-r--r--libcaja-private/caja-global-preferences.c55
-rw-r--r--libcaja-private/caja-global-preferences.h24
-rw-r--r--libcaja-private/org.mate.caja.gschema.xml.in44
-rw-r--r--src/caja-file-management-properties.c41
-rw-r--r--src/file-manager/fm-icon-view.c82
-rw-r--r--src/file-manager/fm-list-view.c91
6 files changed, 119 insertions, 218 deletions
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</_summary>
<_description>If set to true, then Caja shows folders prior to showing files in the icon and list views.</_description>
</key>
+ <key name="default-sort-order" enum="org.gnome.nautilus.SortOrder">
+ <aliases>
+ <alias value='modification_date' target='mtime'/>
+ </aliases>
+ <default>'name'</default>
+ <_summary>Default sort order</_summary>
+ <_description>The default sort-order for items in the icon view. Possible values are "name", "size", "type", "mtime", and "emblems".</_description>
+ </key>
+ <key name="default-sort-in-reverse-order" type="b">
+ <default>false</default>
+ <_summary>Reverse sort order in new windows</_summary>
+ <_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.</_description>
+ </key>
<key name="show-desktop" type="b">
<default>true</default>
<_summary>Caja handles drawing the desktop</_summary>
@@ -245,19 +258,6 @@
"size", "type", "date_modified", "date_changed", "date_accessed", "owner",
"group", "permissions", "octal_permissions" and "mime_type".</_description>
</key>
- <key name="default-sort-order" enum="org.mate.caja.SortOrder">
- <aliases>
- <alias value='modification_date' target='mtime'/>
- </aliases>
- <default>'name'</default>
- <_summary>Default sort order</_summary>
- <_description>The default sort-order for items in the icon view. Possible values are "name", "size", "type", "mtime", and "emblems".</_description>
- </key>
- <key name="default-sort-in-reverse-order" type="b">
- <default>false</default>
- <_summary>Reverse sort order in new windows</_summary>
- <_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.</_description>
- </key>
<key name="default-use-tighter-layout" type="b">
<default>false</default>
<_summary>Use tighter layout in new windows</_summary>
@@ -268,11 +268,6 @@
<_summary>Put labels beside icons</_summary>
<_description>If true, labels will be placed beside icons rather than underneath them.</_description>
</key>
- <key name="default-use-manual-layout" type="b">
- <default>false</default>
- <_summary>Use manual layout in new windows</_summary>
- <_description>If true, new windows will use manual layout by default.</_description>
- </key>
<key name="default-zoom-level" enum="org.mate.caja.ZoomLevel">
<default>'standard'</default>
<_summary>Default icon zoom level</_summary>
@@ -322,19 +317,6 @@
</schema>
<schema id="org.mate.caja.list-view" path="/apps/caja/list-view/" gettext-domain="caja">
- <key name="default-sort-order" enum="org.mate.caja.SortOrder">
- <aliases>
- <alias value='modification_date' target='mtime'/>
- </aliases>
- <default>'name'</default>
- <_summary>Default sort order</_summary>
- <_description>The default sort-order for the items in the list view. Possible values are "name", "size", "type", and "mtime".</_description>
- </key>
- <key name="default-sort-in-reverse-order" type="b">
- <default>false</default>
- <_summary>Reverse sort order in new windows</_summary>
- <_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".</_description>
- </key>
<key name="default-zoom-level" enum="org.mate.caja.ZoomLevel">
<default>'smaller'</default>
<_summary>Default list zoom level</_summary>
diff --git a/src/caja-file-management-properties.c b/src/caja-file-management-properties.c
index 4ac3121d..0caed348 100644
--- a/src/caja-file-management-properties.c
+++ b/src/caja-file-management-properties.c
@@ -291,8 +291,12 @@ columns_changed_callback (CajaColumnChooser *chooser,
&visible_columns,
&column_order);
- eel_preferences_set_string_array (CAJA_PREFERENCES_LIST_VIEW_DEFAULT_VISIBLE_COLUMNS, visible_columns);
- eel_preferences_set_string_array (CAJA_PREFERENCES_LIST_VIEW_DEFAULT_COLUMN_ORDER, column_order);
+ g_settings_set_strv (caja_list_view_preferences,
+ CAJA_PREFERENCES_LIST_VIEW_DEFAULT_VISIBLE_COLUMNS,
+ (const char * const *)visible_columns);
+ g_settings_set_strv (caja_list_view_preferences,
+ CAJA_PREFERENCES_LIST_VIEW_DEFAULT_COLUMN_ORDER,
+ (const char * const *)column_order);
g_strfreev (visible_columns);
g_strfreev (column_order);
@@ -512,13 +516,15 @@ create_date_format_menu (GtkBuilder *builder)
}
static void
-set_columns_from_mateconf (CajaColumnChooser *chooser)
+set_columns_from_settings (CajaColumnChooser *chooser)
{
char **visible_columns;
char **column_order;
- visible_columns = eel_preferences_get_string_array (CAJA_PREFERENCES_LIST_VIEW_DEFAULT_VISIBLE_COLUMNS);
- column_order = eel_preferences_get_string_array (CAJA_PREFERENCES_LIST_VIEW_DEFAULT_COLUMN_ORDER);
+ visible_columns = g_settings_get_strv (caja_list_view_preferences,
+ CAJA_PREFERENCES_LIST_VIEW_DEFAULT_VISIBLE_COLUMNS);
+ column_order = g_settings_get_strv (caja_list_view_preferences,
+ CAJA_PREFERENCES_LIST_VIEW_DEFAULT_COLUMN_ORDER);
caja_column_chooser_set_settings (CAJA_COLUMN_CHOOSER (chooser),
visible_columns,
@@ -532,9 +538,11 @@ static void
use_default_callback (CajaColumnChooser *chooser,
gpointer user_data)
{
- eel_preferences_unset (CAJA_PREFERENCES_LIST_VIEW_DEFAULT_VISIBLE_COLUMNS);
- eel_preferences_unset (CAJA_PREFERENCES_LIST_VIEW_DEFAULT_COLUMN_ORDER);
- set_columns_from_mateconf (chooser);
+ g_settings_reset (caja_list_view_preferences,
+ CAJA_PREFERENCES_LIST_VIEW_DEFAULT_VISIBLE_COLUMNS);
+ g_settings_reset (caja_list_view_preferences,
+ CAJA_PREFERENCES_LIST_VIEW_DEFAULT_COLUMN_ORDER);
+ set_columns_from_settings (chooser);
}
static void
@@ -549,7 +557,7 @@ caja_file_management_properties_dialog_setup_list_column_page (GtkBuilder *build
g_signal_connect (chooser, "use_default",
G_CALLBACK (use_default_callback), chooser);
- set_columns_from_mateconf (CAJA_COLUMN_CHOOSER (chooser));
+ set_columns_from_settings (CAJA_COLUMN_CHOOSER (chooser));
gtk_widget_show (chooser);
box = GTK_WIDGET (gtk_builder_get_object (builder, "list_columns_vbox"));
@@ -1009,17 +1017,14 @@ caja_file_management_properties_dialog_setup (GtkBuilder *builder, GtkWindow *wi
CAJA_FILE_MANAGEMENT_PROPERTIES_COMPACT_VIEW_ZOOM_WIDGET,
CAJA_PREFERENCES_COMPACT_VIEW_DEFAULT_ZOOM_LEVEL,
(const char **) zoom_values);
- eel_preferences_builder_connect_string_enum_combo_box (builder,
- CAJA_FILE_MANAGEMENT_PROPERTIES_LIST_VIEW_ZOOM_WIDGET,
- CAJA_PREFERENCES_LIST_VIEW_DEFAULT_ZOOM_LEVEL,
- (const char **) zoom_values);
- bind_builder_enum (builder, caja_icon_view_preferences,
+ bind_builder_enum (builder, caja_list_view_preferences,
+ CAJA_FILE_MANAGEMENT_PROPERTIES_LIST_VIEW_ZOOM_WIDGET,
+ CAJA_PREFERENCES_LIST_VIEW_DEFAULT_ZOOM_LEVEL,
+ (const char **) zoom_values);
+ bind_builder_enum (builder, caja_preferences,
CAJA_FILE_MANAGEMENT_PROPERTIES_SORT_ORDER_WIDGET,
- CAJA_PREFERENCES_ICON_VIEW_DEFAULT_SORT_ORDER,
+ CAJA_PREFERENCES_DEFAULT_SORT_ORDER,
(const char **) sort_order_values);
- eel_preferences_builder_connect_string_enum_combo_box_slave (builder,
- CAJA_FILE_MANAGEMENT_PROPERTIES_SORT_ORDER_WIDGET,
- CAJA_PREFERENCES_LIST_VIEW_DEFAULT_SORT_ORDER);
bind_builder_enum (builder, caja_preferences,
CAJA_FILE_MANAGEMENT_PROPERTIES_PREVIEW_TEXT_WIDGET,
CAJA_PREFERENCES_SHOW_TEXT_IN_ICONS,
diff --git a/src/file-manager/fm-icon-view.c b/src/file-manager/fm-icon-view.c
index 1e643bb2..eee45185 100644
--- a/src/file-manager/fm-icon-view.c
+++ b/src/file-manager/fm-icon-view.c
@@ -198,7 +198,6 @@ static CajaFileSortType get_default_sort_order (CajaFile
static void default_sort_order_changed_callback (gpointer callback_data);
static void default_sort_in_reverse_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 labels_beside_icons_changed_callback (gpointer callback_data);
static void all_columns_same_width_changed_callback (gpointer callback_data);
@@ -251,19 +250,16 @@ fm_icon_view_finalize (GObject *object)
g_free (icon_view->details);
- g_signal_handlers_disconnect_by_func (caja_icon_view_preferences,
+ g_signal_handlers_disconnect_by_func (caja_preferences,
default_sort_order_changed_callback,
icon_view);
- g_signal_handlers_disconnect_by_func (caja_icon_view_preferences,
+ g_signal_handlers_disconnect_by_func (caja_preferences,
default_sort_in_reverse_order_changed_callback,
icon_view);
g_signal_handlers_disconnect_by_func (caja_icon_view_preferences,
default_use_tighter_layout_changed_callback,
icon_view);
g_signal_handlers_disconnect_by_func (caja_icon_view_preferences,
- default_use_manual_layout_changed_callback,
- icon_view);
- g_signal_handlers_disconnect_by_func (caja_icon_view_preferences,
default_zoom_level_changed_callback,
icon_view);
g_signal_handlers_disconnect_by_func (caja_icon_view_preferences,
@@ -830,11 +826,11 @@ get_default_sort_order (CajaFile *file, gboolean *reversed)
if (auto_storaged_added == FALSE)
{
auto_storaged_added = TRUE;
- eel_g_settings_add_auto_enum (caja_icon_view_preferences,
- CAJA_PREFERENCES_ICON_VIEW_DEFAULT_SORT_ORDER,
+ eel_g_settings_add_auto_enum (caja_preferences,
+ CAJA_PREFERENCES_DEFAULT_SORT_ORDER,
(int *) &default_sort_order);
- eel_g_settings_add_auto_boolean (caja_icon_view_preferences,
- CAJA_PREFERENCES_ICON_VIEW_DEFAULT_SORT_IN_REVERSE_ORDER,
+ eel_g_settings_add_auto_boolean (caja_preferences,
+ CAJA_PREFERENCES_DEFAULT_SORT_IN_REVERSE_ORDER,
&default_sort_in_reverse_order);
}
@@ -990,25 +986,6 @@ fm_icon_view_set_directory_keep_aligned (FMIconView *icon_view,
keep_aligned);
}
-/* 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;
- eel_g_settings_add_auto_boolean (caja_icon_view_preferences,
- CAJA_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,
CajaFile *file)
@@ -1035,7 +1012,7 @@ fm_icon_view_real_get_directory_auto_layout (FMIconView *icon_view,
return caja_file_get_boolean_metadata
- (file, CAJA_METADATA_KEY_ICON_VIEW_AUTO_LAYOUT, !get_default_directory_manual_layout ());
+ (file, CAJA_METADATA_KEY_ICON_VIEW_AUTO_LAYOUT, TRUE);
}
static void
@@ -1065,7 +1042,7 @@ fm_icon_view_real_set_directory_auto_layout (FMIconView *icon_view,
caja_file_set_boolean_metadata
(file, CAJA_METADATA_KEY_ICON_VIEW_AUTO_LAYOUT,
- !get_default_directory_manual_layout (),
+ TRUE,
auto_layout);
}
/* maintainence of tighter layout boolean */
@@ -1970,15 +1947,6 @@ fm_icon_view_reset_to_defaults (FMDirectoryView *view)
caja_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.
- */
- if (get_default_directory_manual_layout ())
- {
- switch_to_manual_layout (icon_view);
- }
-
update_layout_menus (icon_view);
fm_icon_view_restore_default_zoom_level (view);
@@ -2792,28 +2760,6 @@ default_use_tighter_layout_changed_callback (gpointer callback_data)
}
static void
-default_use_manual_layout_changed_callback (gpointer callback_data)
-{
- FMIconView *icon_view;
- CajaFile *file;
- CajaIconContainer *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 (CAJA_IS_ICON_CONTAINER (icon_container));
-
- caja_icon_container_set_auto_layout (
- icon_container,
- fm_icon_view_get_directory_auto_layout (icon_view, file));
-
- caja_icon_container_request_update_all (icon_container);
-}
-
-static void
default_zoom_level_changed_callback (gpointer callback_data)
{
FMIconView *icon_view;
@@ -3326,12 +3272,12 @@ fm_icon_view_init (FMIconView *icon_view)
setup_sound_preview = TRUE;
}
- g_signal_connect_swapped (caja_icon_view_preferences,
- "changed::" CAJA_PREFERENCES_ICON_VIEW_DEFAULT_SORT_ORDER,
+ g_signal_connect_swapped (caja_preferences,
+ "changed::" CAJA_PREFERENCES_DEFAULT_SORT_ORDER,
G_CALLBACK (default_sort_order_changed_callback),
icon_view);
- g_signal_connect_swapped (caja_icon_view_preferences,
- "changed::" CAJA_PREFERENCES_ICON_VIEW_DEFAULT_SORT_IN_REVERSE_ORDER,
+ g_signal_connect_swapped (caja_preferences,
+ "changed::" CAJA_PREFERENCES_DEFAULT_SORT_IN_REVERSE_ORDER,
G_CALLBACK (default_sort_in_reverse_order_changed_callback),
icon_view);
g_signal_connect_swapped (caja_icon_view_preferences,
@@ -3339,10 +3285,6 @@ fm_icon_view_init (FMIconView *icon_view)
G_CALLBACK (default_use_tighter_layout_changed_callback),
icon_view);
g_signal_connect_swapped (caja_icon_view_preferences,
- "changed::" CAJA_PREFERENCES_ICON_VIEW_DEFAULT_USE_MANUAL_LAYOUT,
- G_CALLBACK (default_use_manual_layout_changed_callback),
- icon_view);
- g_signal_connect_swapped (caja_icon_view_preferences,
"changed::" CAJA_PREFERENCES_ICON_VIEW_DEFAULT_ZOOM_LEVEL,
G_CALLBACK (default_zoom_level_changed_callback),
icon_view);
diff --git a/src/file-manager/fm-list-view.c b/src/file-manager/fm-list-view.c
index 2a0aa693..e8eb16a8 100644
--- a/src/file-manager/fm-list-view.c
+++ b/src/file-manager/fm-list-view.c
@@ -133,7 +133,7 @@ struct SelectionForeachData
#define WAIT_FOR_RENAME_ON_ACTIVATE 200
static int click_policy_auto_value;
-static char * default_sort_order_auto_value;
+static CajaFileSortType default_sort_order_auto_value;
static gboolean default_sort_reversed_auto_value;
static CajaZoomLevel default_zoom_level_auto_value;
static char ** default_visible_columns_auto_value;
@@ -179,12 +179,24 @@ static const gchar*
get_default_sort_order (CajaFile *file, gboolean *reversed)
{
const gchar *retval;
+ const char *attributes[] = {
+ "name", /* is really "manually" which doesn't apply to lists */
+ "name",
+ "uri",
+ "size",
+ "type",
+ "date_modified",
+ "date_accessed",
+ "emblems",
+ "trashed_on",
+ NULL
+ };
retval = caja_file_get_default_sort_attribute (file, reversed);
if (retval == NULL)
{
- retval = default_sort_order_auto_value;
+ retval = attributes[default_sort_order_auto_value];
*reversed = default_sort_reversed_auto_value;
}
@@ -1264,7 +1276,7 @@ sort_column_changed_callback (GtkTreeSortable *sortable,
if (sort_attr == default_sort_attr)
{
/* use value from preferences */
- reversed = eel_preferences_get_boolean (CAJA_PREFERENCES_LIST_VIEW_DEFAULT_SORT_IN_REVERSE_ORDER);
+ reversed = g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_DEFAULT_SORT_IN_REVERSE_ORDER);
}
else
{
@@ -3092,6 +3104,19 @@ fm_list_view_finalize (GObject *object)
g_free (list_view->details);
+ g_signal_handlers_disconnect_by_func (caja_preferences,
+ default_sort_order_changed_callback,
+ list_view);
+ g_signal_handlers_disconnect_by_func (caja_list_view_preferences,
+ default_zoom_level_changed_callback,
+ list_view);
+ g_signal_handlers_disconnect_by_func (caja_list_view_preferences,
+ default_visible_columns_changed_callback,
+ list_view);
+ g_signal_handlers_disconnect_by_func (caja_list_view_preferences,
+ default_column_order_changed_callback,
+ list_view);
+
G_OBJECT_CLASS (parent_class)->finalize (object);
}
@@ -3291,16 +3316,21 @@ fm_list_view_class_init (FMListViewClass *class)
eel_g_settings_add_auto_enum (caja_preferences,
CAJA_PREFERENCES_CLICK_POLICY,
&click_policy_auto_value);
- eel_preferences_add_auto_string (CAJA_PREFERENCES_LIST_VIEW_DEFAULT_SORT_ORDER,
- (const char **) &default_sort_order_auto_value);
- eel_preferences_add_auto_boolean (CAJA_PREFERENCES_LIST_VIEW_DEFAULT_SORT_IN_REVERSE_ORDER,
- &default_sort_reversed_auto_value);
- eel_preferences_add_auto_enum (CAJA_PREFERENCES_LIST_VIEW_DEFAULT_ZOOM_LEVEL,
- (int *) &default_zoom_level_auto_value);
- eel_preferences_add_auto_string_array (CAJA_PREFERENCES_LIST_VIEW_DEFAULT_VISIBLE_COLUMNS,
- &default_visible_columns_auto_value);
- eel_preferences_add_auto_string_array (CAJA_PREFERENCES_LIST_VIEW_DEFAULT_COLUMN_ORDER,
- &default_column_order_auto_value);
+ eel_g_settings_add_auto_enum (caja_preferences,
+ CAJA_PREFERENCES_DEFAULT_SORT_ORDER,
+ (int *) &default_sort_order_auto_value);
+ eel_g_settings_add_auto_boolean (caja_preferences,
+ CAJA_PREFERENCES_DEFAULT_SORT_IN_REVERSE_ORDER,
+ &default_sort_reversed_auto_value);
+ eel_g_settings_add_auto_enum (caja_list_view_preferences,
+ CAJA_PREFERENCES_LIST_VIEW_DEFAULT_ZOOM_LEVEL,
+ (int *) &default_zoom_level_auto_value);
+ eel_g_settings_add_auto_strv (caja_list_view_preferences,
+ CAJA_PREFERENCES_LIST_VIEW_DEFAULT_VISIBLE_COLUMNS,
+ &default_visible_columns_auto_value);
+ eel_g_settings_add_auto_strv (caja_list_view_preferences,
+ CAJA_PREFERENCES_LIST_VIEW_DEFAULT_COLUMN_ORDER,
+ &default_column_order_auto_value);
}
static const char *
@@ -3329,21 +3359,26 @@ fm_list_view_init (FMListView *list_view)
create_and_set_up_tree_view (list_view);
- eel_preferences_add_callback_while_alive (CAJA_PREFERENCES_LIST_VIEW_DEFAULT_SORT_ORDER,
- default_sort_order_changed_callback,
- list_view, G_OBJECT (list_view));
- eel_preferences_add_callback_while_alive (CAJA_PREFERENCES_LIST_VIEW_DEFAULT_SORT_IN_REVERSE_ORDER,
- default_sort_order_changed_callback,
- list_view, G_OBJECT (list_view));
- eel_preferences_add_callback_while_alive (CAJA_PREFERENCES_LIST_VIEW_DEFAULT_ZOOM_LEVEL,
- default_zoom_level_changed_callback,
- list_view, G_OBJECT (list_view));
- eel_preferences_add_callback_while_alive (CAJA_PREFERENCES_LIST_VIEW_DEFAULT_VISIBLE_COLUMNS,
- default_visible_columns_changed_callback,
- list_view, G_OBJECT (list_view));
- eel_preferences_add_callback_while_alive (CAJA_PREFERENCES_LIST_VIEW_DEFAULT_COLUMN_ORDER,
- default_column_order_changed_callback,
- list_view, G_OBJECT (list_view));
+ g_signal_connect_swapped (caja_preferences,
+ "changed::" CAJA_PREFERENCES_DEFAULT_SORT_ORDER,
+ G_CALLBACK (default_sort_order_changed_callback),
+ list_view);
+ g_signal_connect_swapped (caja_preferences,
+ "changed::" CAJA_PREFERENCES_DEFAULT_SORT_IN_REVERSE_ORDER,
+ G_CALLBACK (default_sort_order_changed_callback),
+ list_view);
+ g_signal_connect_swapped (caja_list_view_preferences,
+ "changed::" CAJA_PREFERENCES_LIST_VIEW_DEFAULT_ZOOM_LEVEL,
+ G_CALLBACK (default_zoom_level_changed_callback),
+ list_view);
+ g_signal_connect_swapped (caja_list_view_preferences,
+ "changed::" CAJA_PREFERENCES_LIST_VIEW_DEFAULT_VISIBLE_COLUMNS,
+ G_CALLBACK (default_visible_columns_changed_callback),
+ list_view);
+ g_signal_connect_swapped (caja_list_view_preferences,
+ "changed::" CAJA_PREFERENCES_LIST_VIEW_DEFAULT_COLUMN_ORDER,
+ G_CALLBACK (default_column_order_changed_callback),
+ list_view);
fm_list_view_click_policy_changed (FM_DIRECTORY_VIEW (list_view));