summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorStefano Karapetsas <[email protected]>2012-09-05 19:08:00 +0200
committerStefano Karapetsas <[email protected]>2012-09-05 19:08:00 +0200
commit12e085081592626b01721bebd07c22b69d1b4262 (patch)
treece0a6cd7d3fc368807b12121381ca095171ff3be /src
parentd66d6c4b4f07b9a18a81b0ac369a779c74af6e39 (diff)
downloadcaja-12e085081592626b01721bebd07c22b69d1b4262.tar.bz2
caja-12e085081592626b01721bebd07c22b69d1b4262.tar.xz
convert icon-view preferences to gsettings
Diffstat (limited to 'src')
-rw-r--r--src/caja-file-management-properties.c37
-rw-r--r--src/file-manager/fm-desktop-icon-view.c18
-rw-r--r--src/file-manager/fm-directory-view.c10
-rw-r--r--src/file-manager/fm-icon-container.c6
-rw-r--r--src/file-manager/fm-icon-view.c95
5 files changed, 104 insertions, 62 deletions
diff --git a/src/caja-file-management-properties.c b/src/caja-file-management-properties.c
index 2fa8f9bb..1e2b91db 100644
--- a/src/caja-file-management-properties.c
+++ b/src/caja-file-management-properties.c
@@ -375,8 +375,9 @@ icon_captions_changed_callback (GtkComboBox *combo_box,
}
g_ptr_array_add (captions, NULL);
- eel_preferences_set_string_array (CAJA_PREFERENCES_ICON_VIEW_CAPTIONS,
- (char **)captions->pdata);
+ g_settings_set_strv (caja_icon_view_preferences,
+ CAJA_PREFERENCES_ICON_VIEW_CAPTIONS,
+ (const char **)captions->pdata);
g_ptr_array_free (captions, TRUE);
}
@@ -420,7 +421,7 @@ update_icon_captions_from_mateconf (GtkBuilder *builder)
char **captions;
int i, j;
- captions = eel_preferences_get_string_array (CAJA_PREFERENCES_ICON_VIEW_CAPTIONS);
+ captions = g_settings_get_strv (caja_icon_view_preferences, CAJA_PREFERENCES_ICON_VIEW_CAPTIONS);
if (captions == NULL)
return;
@@ -455,7 +456,7 @@ caja_file_management_properties_dialog_setup_icon_caption_page (GtkBuilder *buil
int i;
gboolean writable;
- writable = eel_preferences_key_is_writable (CAJA_PREFERENCES_ICON_VIEW_CAPTIONS);
+ writable = g_settings_is_writable (caja_icon_view_preferences, CAJA_PREFERENCES_ICON_VIEW_CAPTIONS);
columns = caja_get_common_columns ();
@@ -955,12 +956,12 @@ caja_file_management_properties_dialog_setup (GtkBuilder *builder, GtkWindow *wi
create_date_format_menu (builder);
/* setup preferences */
- eel_preferences_builder_connect_bool (builder,
- CAJA_FILE_MANAGEMENT_PROPERTIES_COMPACT_LAYOUT_WIDGET,
- CAJA_PREFERENCES_ICON_VIEW_DEFAULT_USE_TIGHTER_LAYOUT);
- eel_preferences_builder_connect_bool (builder,
- CAJA_FILE_MANAGEMENT_PROPERTIES_LABELS_BESIDE_ICONS_WIDGET,
- CAJA_PREFERENCES_ICON_VIEW_LABELS_BESIDE_ICONS);
+ bind_builder_bool (builder, caja_icon_view_preferences,
+ CAJA_FILE_MANAGEMENT_PROPERTIES_COMPACT_LAYOUT_WIDGET,
+ CAJA_PREFERENCES_ICON_VIEW_DEFAULT_USE_TIGHTER_LAYOUT);
+ bind_builder_bool (builder, caja_icon_view_preferences,
+ CAJA_FILE_MANAGEMENT_PROPERTIES_LABELS_BESIDE_ICONS_WIDGET,
+ CAJA_PREFERENCES_ICON_VIEW_LABELS_BESIDE_ICONS);
eel_preferences_builder_connect_bool (builder,
CAJA_FILE_MANAGEMENT_PROPERTIES_ALL_COLUMNS_SAME_WIDTH,
CAJA_PREFERENCES_COMPACT_VIEW_ALL_COLUMNS_SAME_WIDTH);
@@ -996,10 +997,10 @@ caja_file_management_properties_dialog_setup (GtkBuilder *builder, GtkWindow *wi
CAJA_FILE_MANAGEMENT_PROPERTIES_DEFAULT_VIEW_WIDGET,
CAJA_PREFERENCES_DEFAULT_FOLDER_VIEWER,
(const char **) default_view_values);
- eel_preferences_builder_connect_string_enum_combo_box (builder,
- CAJA_FILE_MANAGEMENT_PROPERTIES_ICON_VIEW_ZOOM_WIDGET,
- CAJA_PREFERENCES_ICON_VIEW_DEFAULT_ZOOM_LEVEL,
- (const char **) zoom_values);
+ bind_builder_enum (builder, caja_icon_view_preferences,
+ CAJA_FILE_MANAGEMENT_PROPERTIES_ICON_VIEW_ZOOM_WIDGET,
+ CAJA_PREFERENCES_ICON_VIEW_DEFAULT_ZOOM_LEVEL,
+ (const char **) zoom_values);
eel_preferences_builder_connect_string_enum_combo_box (builder,
CAJA_FILE_MANAGEMENT_PROPERTIES_COMPACT_VIEW_ZOOM_WIDGET,
CAJA_PREFERENCES_COMPACT_VIEW_DEFAULT_ZOOM_LEVEL,
@@ -1008,10 +1009,10 @@ caja_file_management_properties_dialog_setup (GtkBuilder *builder, GtkWindow *wi
CAJA_FILE_MANAGEMENT_PROPERTIES_LIST_VIEW_ZOOM_WIDGET,
CAJA_PREFERENCES_LIST_VIEW_DEFAULT_ZOOM_LEVEL,
(const char **) zoom_values);
- eel_preferences_builder_connect_string_enum_combo_box (builder,
- CAJA_FILE_MANAGEMENT_PROPERTIES_SORT_ORDER_WIDGET,
- CAJA_PREFERENCES_ICON_VIEW_DEFAULT_SORT_ORDER,
- (const char **) sort_order_values);
+ bind_builder_enum (builder, caja_icon_view_preferences,
+ CAJA_FILE_MANAGEMENT_PROPERTIES_SORT_ORDER_WIDGET,
+ CAJA_PREFERENCES_ICON_VIEW_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);
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,