diff options
author | Stefano Karapetsas <[email protected]> | 2012-09-05 19:08:00 +0200 |
---|---|---|
committer | Stefano Karapetsas <[email protected]> | 2012-09-05 19:08:00 +0200 |
commit | 12e085081592626b01721bebd07c22b69d1b4262 (patch) | |
tree | ce0a6cd7d3fc368807b12121381ca095171ff3be /src/file-manager | |
parent | d66d6c4b4f07b9a18a81b0ac369a779c74af6e39 (diff) | |
download | caja-12e085081592626b01721bebd07c22b69d1b4262.tar.bz2 caja-12e085081592626b01721bebd07c22b69d1b4262.tar.xz |
convert icon-view preferences to gsettings
Diffstat (limited to 'src/file-manager')
-rw-r--r-- | src/file-manager/fm-desktop-icon-view.c | 18 | ||||
-rw-r--r-- | src/file-manager/fm-directory-view.c | 10 | ||||
-rw-r--r-- | src/file-manager/fm-icon-container.c | 6 | ||||
-rw-r--r-- | src/file-manager/fm-icon-view.c | 95 |
4 files changed, 85 insertions, 44 deletions
diff --git a/src/file-manager/fm-desktop-icon-view.c b/src/file-manager/fm-desktop-icon-view.c index 86d1cce6..ca9de561 100644 --- a/src/file-manager/fm-desktop-icon-view.c +++ b/src/file-manager/fm-desktop-icon-view.c @@ -300,9 +300,9 @@ fm_desktop_icon_view_finalize (GObject *object) icon_view = FM_DESKTOP_ICON_VIEW (object); - eel_preferences_remove_callback (CAJA_PREFERENCES_ICON_VIEW_DEFAULT_ZOOM_LEVEL, - default_zoom_level_changed, - icon_view); + g_signal_handlers_disconnect_by_func (caja_icon_view_preferences, + default_zoom_level_changed, + icon_view); eel_preferences_remove_callback (CAJA_PREFERENCES_LOCKDOWN_COMMAND_LINE, lockdown_disable_command_line_changed_callback, @@ -432,8 +432,9 @@ get_default_zoom_level (void) if (!auto_storage_added) { auto_storage_added = TRUE; - eel_preferences_add_auto_enum (CAJA_PREFERENCES_ICON_VIEW_DEFAULT_ZOOM_LEVEL, - (int *) &default_zoom_level); + eel_g_settings_add_auto_enum (caja_icon_view_preferences, + CAJA_PREFERENCES_ICON_VIEW_DEFAULT_ZOOM_LEVEL, + (int *) &default_zoom_level); } return CLAMP (default_zoom_level, CAJA_ZOOM_LEVEL_SMALLEST, CAJA_ZOOM_LEVEL_LARGEST); @@ -615,9 +616,10 @@ fm_desktop_icon_view_init (FMDesktopIconView *desktop_icon_view) g_signal_connect_object (desktop_icon_view, "unrealize", G_CALLBACK (unrealized_callback), desktop_icon_view, 0); - eel_preferences_add_callback (CAJA_PREFERENCES_ICON_VIEW_DEFAULT_ZOOM_LEVEL, - default_zoom_level_changed, - desktop_icon_view); + g_signal_connect_swapped (caja_icon_view_preferences, + "changed::" CAJA_PREFERENCES_ICON_VIEW_DEFAULT_ZOOM_LEVEL, + G_CALLBACK (default_zoom_level_changed), + desktop_icon_view); eel_preferences_add_callback_while_alive (CAJA_PREFERENCES_DESKTOP_FONT, font_changed_callback, diff --git a/src/file-manager/fm-directory-view.c b/src/file-manager/fm-directory-view.c index a678ec88..19245973 100644 --- a/src/file-manager/fm-directory-view.c +++ b/src/file-manager/fm-directory-view.c @@ -2041,8 +2041,10 @@ fm_directory_view_init (FMDirectoryView *view) eel_preferences_add_callback (CAJA_PREFERENCES_ENABLE_DELETE, schedule_update_menus_callback, view); - eel_preferences_add_callback (CAJA_PREFERENCES_ICON_VIEW_CAPTIONS, - text_attribute_names_changed_callback, view); + g_signal_connect_swapped (caja_icon_view_preferences, + "changed::" CAJA_PREFERENCES_ICON_VIEW_CAPTIONS, + G_CALLBACK(text_attribute_names_changed_callback), + view); g_signal_connect_swapped (caja_preferences, "changed::" CAJA_PREFERENCES_SHOW_IMAGE_FILE_THUMBNAILS, G_CALLBACK (image_display_policy_changed_callback), @@ -2176,8 +2178,8 @@ fm_directory_view_finalize (GObject *object) eel_preferences_remove_callback (CAJA_PREFERENCES_ENABLE_DELETE, schedule_update_menus_callback, view); - eel_preferences_remove_callback (CAJA_PREFERENCES_ICON_VIEW_CAPTIONS, - text_attribute_names_changed_callback, view); + g_signal_handlers_disconnect_by_func (caja_icon_view_preferences, + text_attribute_names_changed_callback, view); g_signal_handlers_disconnect_by_func (caja_preferences, image_display_policy_changed_callback, view); g_signal_handlers_disconnect_by_func (caja_preferences, diff --git a/src/file-manager/fm-icon-container.c b/src/file-manager/fm-icon-container.c index 8cd3d357..0ecc0180 100644 --- a/src/file-manager/fm-icon-container.c +++ b/src/file-manager/fm-icon-container.c @@ -26,6 +26,7 @@ #include <string.h> #include <glib/gi18n.h> #include <gio/gio.h> +#include <eel/eel-glib-extensions.h> #include <libcaja-private/caja-global-preferences.h> #include <libcaja-private/caja-file-attributes.h> #include <libcaja-private/caja-thumbnails.h> @@ -208,8 +209,9 @@ fm_icon_container_get_icon_text_attributes_from_preferences (void) if (attributes == NULL) { - eel_preferences_add_auto_string_array_as_quarks (CAJA_PREFERENCES_ICON_VIEW_CAPTIONS, - &attributes); + eel_g_settings_add_auto_strv_as_quarks (caja_icon_view_preferences, + CAJA_PREFERENCES_ICON_VIEW_CAPTIONS, + &attributes); } /* We don't need to sanity check the attributes list even though it came diff --git a/src/file-manager/fm-icon-view.c b/src/file-manager/fm-icon-view.c index d5ab000e..3c70b2da 100644 --- a/src/file-manager/fm-icon-view.c +++ b/src/file-manager/fm-icon-view.c @@ -195,6 +195,12 @@ static void update_layout_menus (FMIconVie static CajaFileSortType get_default_sort_order (CajaFile *file, gboolean *reversed); +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 fm_icon_view_iface_init (CajaViewIface *iface); @@ -244,6 +250,25 @@ fm_icon_view_finalize (GObject *object) g_free (icon_view->details); + g_signal_handlers_disconnect_by_func (caja_icon_view_preferences, + default_sort_order_changed_callback, + icon_view); + g_signal_handlers_disconnect_by_func (caja_icon_view_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, + labels_beside_icons_changed_callback, + icon_view); + G_OBJECT_CLASS (fm_icon_view_parent_class)->finalize (object); } @@ -799,11 +824,12 @@ get_default_sort_order (CajaFile *file, gboolean *reversed) if (auto_storaged_added == FALSE) { auto_storaged_added = TRUE; - eel_preferences_add_auto_enum (CAJA_PREFERENCES_ICON_VIEW_DEFAULT_SORT_ORDER, - (int *) &default_sort_order); - eel_preferences_add_auto_boolean (CAJA_PREFERENCES_ICON_VIEW_DEFAULT_SORT_IN_REVERSE_ORDER, - &default_sort_in_reverse_order); - + eel_g_settings_add_auto_enum (caja_icon_view_preferences, + CAJA_PREFERENCES_ICON_VIEW_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, + &default_sort_in_reverse_order); } retval = caja_file_get_default_sort_type (file, reversed); @@ -969,8 +995,9 @@ get_default_directory_manual_layout (void) if (auto_storaged_added == FALSE) { auto_storaged_added = TRUE; - eel_preferences_add_auto_boolean (CAJA_PREFERENCES_ICON_VIEW_DEFAULT_USE_MANUAL_LAYOUT, - &default_directory_manual_layout); + 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; @@ -1056,8 +1083,9 @@ get_default_directory_tighter_layout (void) if (auto_storaged_added == FALSE) { auto_storaged_added = TRUE; - eel_preferences_add_auto_boolean (CAJA_PREFERENCES_ICON_VIEW_DEFAULT_USE_TIGHTER_LAYOUT, - &default_directory_tighter_layout); + eel_g_settings_add_auto_boolean (caja_icon_view_preferences, + CAJA_PREFERENCES_ICON_VIEW_DEFAULT_USE_TIGHTER_LAYOUT, + &default_directory_tighter_layout); } return default_directory_tighter_layout; @@ -1206,8 +1234,9 @@ get_default_zoom_level (FMIconView *icon_view) if (!auto_storage_added) { auto_storage_added = TRUE; - eel_preferences_add_auto_enum (CAJA_PREFERENCES_ICON_VIEW_DEFAULT_ZOOM_LEVEL, - (int *) &default_zoom_level); + eel_g_settings_add_auto_enum (caja_icon_view_preferences, + CAJA_PREFERENCES_ICON_VIEW_DEFAULT_ZOOM_LEVEL, + (int *) &default_zoom_level); eel_preferences_add_auto_enum (CAJA_PREFERENCES_COMPACT_VIEW_DEFAULT_ZOOM_LEVEL, (int *) &default_compact_zoom_level); } @@ -1223,7 +1252,7 @@ set_labels_beside_icons (FMIconView *icon_view) if (fm_icon_view_supports_labels_beside_icons (icon_view)) { labels_beside = fm_icon_view_is_compact (icon_view) || - eel_preferences_get_boolean (CAJA_PREFERENCES_ICON_VIEW_LABELS_BESIDE_ICONS); + g_settings_get_boolean (caja_icon_view_preferences, CAJA_PREFERENCES_ICON_VIEW_LABELS_BESIDE_ICONS); if (labels_beside) { @@ -3290,24 +3319,30 @@ fm_icon_view_init (FMIconView *icon_view) setup_sound_preview = TRUE; } - eel_preferences_add_callback_while_alive (CAJA_PREFERENCES_ICON_VIEW_DEFAULT_SORT_ORDER, - default_sort_order_changed_callback, - icon_view, G_OBJECT (icon_view)); - eel_preferences_add_callback_while_alive (CAJA_PREFERENCES_ICON_VIEW_DEFAULT_SORT_IN_REVERSE_ORDER, - default_sort_in_reverse_order_changed_callback, - icon_view, G_OBJECT (icon_view)); - eel_preferences_add_callback_while_alive (CAJA_PREFERENCES_ICON_VIEW_DEFAULT_USE_TIGHTER_LAYOUT, - default_use_tighter_layout_changed_callback, - icon_view, G_OBJECT (icon_view)); - eel_preferences_add_callback_while_alive (CAJA_PREFERENCES_ICON_VIEW_DEFAULT_USE_MANUAL_LAYOUT, - default_use_manual_layout_changed_callback, - icon_view, G_OBJECT (icon_view)); - eel_preferences_add_callback_while_alive (CAJA_PREFERENCES_ICON_VIEW_DEFAULT_ZOOM_LEVEL, - default_zoom_level_changed_callback, - icon_view, G_OBJECT (icon_view)); - eel_preferences_add_callback_while_alive (CAJA_PREFERENCES_ICON_VIEW_LABELS_BESIDE_ICONS, - labels_beside_icons_changed_callback, - icon_view, G_OBJECT (icon_view)); + g_signal_connect_swapped (caja_icon_view_preferences, + "changed::" CAJA_PREFERENCES_ICON_VIEW_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_CALLBACK (default_sort_in_reverse_order_changed_callback), + icon_view); + g_signal_connect_swapped (caja_icon_view_preferences, + "changed::" CAJA_PREFERENCES_ICON_VIEW_DEFAULT_USE_TIGHTER_LAYOUT, + 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); + g_signal_connect_swapped (caja_icon_view_preferences, + "changed::" CAJA_PREFERENCES_ICON_VIEW_LABELS_BESIDE_ICONS, + G_CALLBACK (labels_beside_icons_changed_callback), + icon_view); eel_preferences_add_callback_while_alive (CAJA_PREFERENCES_COMPACT_VIEW_DEFAULT_ZOOM_LEVEL, default_zoom_level_changed_callback, |