diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/caja-file-management-properties.c | 41 | ||||
-rw-r--r-- | src/file-manager/fm-icon-view.c | 82 | ||||
-rw-r--r-- | src/file-manager/fm-list-view.c | 91 |
3 files changed, 98 insertions, 116 deletions
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)); |