summaryrefslogtreecommitdiff
path: root/libcaja-private
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 /libcaja-private
parentd66d6c4b4f07b9a18a81b0ac369a779c74af6e39 (diff)
downloadcaja-12e085081592626b01721bebd07c22b69d1b4262.tar.bz2
caja-12e085081592626b01721bebd07c22b69d1b4262.tar.xz
convert icon-view preferences to gsettings
Diffstat (limited to 'libcaja-private')
-rw-r--r--libcaja-private/caja-file.c9
-rw-r--r--libcaja-private/caja-global-preferences.c72
-rw-r--r--libcaja-private/caja-global-preferences.h21
-rw-r--r--libcaja-private/caja-icon-container.c21
-rw-r--r--libcaja-private/caja-thumbnails.c5
5 files changed, 43 insertions, 85 deletions
diff --git a/libcaja-private/caja-file.c b/libcaja-private/caja-file.c
index 0a2d8833..2227ac2c 100644
--- a/libcaja-private/caja-file.c
+++ b/libcaja-private/caja-file.c
@@ -8174,7 +8174,7 @@ thumbnail_limit_changed_callback (gpointer user_data)
static void
thumbnail_size_changed_callback (gpointer user_data)
{
- cached_thumbnail_size = eel_preferences_get_integer (CAJA_PREFERENCES_ICON_VIEW_THUMBNAIL_SIZE);
+ cached_thumbnail_size = g_settings_get_int (caja_icon_view_preferences, CAJA_PREFERENCES_ICON_VIEW_THUMBNAIL_SIZE);
/* Tell the world that icons might have changed. We could invent a narrower-scope
* signal to mean only "thumbnails might have changed" if this ends up being slow
@@ -8288,9 +8288,10 @@ caja_file_class_init (CajaFileClass *class)
G_CALLBACK (thumbnail_limit_changed_callback),
NULL);
thumbnail_size_changed_callback (NULL);
- eel_preferences_add_callback (CAJA_PREFERENCES_ICON_VIEW_THUMBNAIL_SIZE,
- thumbnail_size_changed_callback,
- NULL);
+ g_signal_connect_swapped (caja_icon_view_preferences,
+ "changed::" CAJA_PREFERENCES_ICON_VIEW_THUMBNAIL_SIZE,
+ G_CALLBACK (thumbnail_size_changed_callback),
+ NULL);
show_thumbnails_changed_callback (NULL);
g_signal_connect_swapped (caja_preferences,
"changed::" CAJA_PREFERENCES_SHOW_IMAGE_FILE_THUMBNAILS,
diff --git a/libcaja-private/caja-global-preferences.c b/libcaja-private/caja-global-preferences.c
index 27e3a543..1111e9d3 100644
--- a/libcaja-private/caja-global-preferences.c
+++ b/libcaja-private/caja-global-preferences.c
@@ -180,67 +180,11 @@ typedef struct
static const PreferenceDefault preference_defaults[] =
{
{
- CAJA_PREFERENCES_ICON_VIEW_CAPTIONS,
- PREFERENCE_STRING_ARRAY,
- "size,date_modified,type",
- NULL, NULL,
- NULL
- },
- {
CAJA_PREFERENCES_TREE_SHOW_ONLY_DIRECTORIES,
PREFERENCE_BOOLEAN,
GINT_TO_POINTER (TRUE)
},
- /* Icon View Default Preferences */
- {
- CAJA_PREFERENCES_ICON_VIEW_DEFAULT_SORT_ORDER,
- PREFERENCE_STRING,
- "name",
- NULL, NULL,
- "default_icon_view_sort_order"
- },
- {
- CAJA_PREFERENCES_ICON_VIEW_DEFAULT_SORT_ORDER_OR_MANUAL_LAYOUT,
- PREFERENCE_STRING,
- "name",
- NULL, NULL,
- "default_icon_view_sort_order"
- },
- {
- CAJA_PREFERENCES_ICON_VIEW_DEFAULT_SORT_IN_REVERSE_ORDER,
- PREFERENCE_BOOLEAN,
- GINT_TO_POINTER (FALSE)
- },
- {
- CAJA_PREFERENCES_ICON_VIEW_DEFAULT_USE_TIGHTER_LAYOUT,
- PREFERENCE_BOOLEAN,
- GINT_TO_POINTER (FALSE)
- },
- {
- CAJA_PREFERENCES_ICON_VIEW_DEFAULT_USE_MANUAL_LAYOUT,
- PREFERENCE_BOOLEAN,
- GINT_TO_POINTER (FALSE)
- },
- {
- CAJA_PREFERENCES_ICON_VIEW_DEFAULT_ZOOM_LEVEL,
- PREFERENCE_STRING,
- "standard",
- NULL, NULL,
- "default_zoom_level"
- },
- {
- CAJA_PREFERENCES_ICON_VIEW_THUMBNAIL_SIZE,
- PREFERENCE_INTEGER,
- GINT_TO_POINTER (96)
- },
- {
- CAJA_PREFERENCES_ICON_VIEW_TEXT_ELLIPSIS_LIMIT,
- PREFERENCE_STRING_ARRAY,
- "3",
- NULL,NULL,
- NULL,
- },
/* Compact Icon View Default Preferences */
{
CAJA_PREFERENCES_COMPACT_VIEW_DEFAULT_ZOOM_LEVEL,
@@ -550,7 +494,8 @@ default_icon_view_sort_order_or_manual_layout_changed_callback (gpointer callbac
int default_sort_order;
default_sort_order_or_manual_layout =
- eel_preferences_get_enum (CAJA_PREFERENCES_ICON_VIEW_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);
@@ -562,8 +507,9 @@ default_icon_view_sort_order_or_manual_layout_changed_callback (gpointer callbac
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);
- eel_preferences_set_enum (CAJA_PREFERENCES_ICON_VIEW_DEFAULT_SORT_ORDER,
- default_sort_order);
+ g_settings_set_enum (caja_icon_view_preferences,
+ CAJA_PREFERENCES_ICON_VIEW_DEFAULT_SORT_ORDER,
+ default_sort_order);
}
}
@@ -596,11 +542,13 @@ caja_global_preferences_init (void)
caja_preferences = g_settings_new("org.mate.caja.preferences");
caja_media_preferences = g_settings_new("org.mate.media-handling");
caja_window_state = g_settings_new("org.mate.caja.window-state");
+ caja_icon_view_preferences = g_settings_new("org.mate.caja.icon-view");
/* Set up storage for values accessed in this file */
- eel_preferences_add_callback (CAJA_PREFERENCES_ICON_VIEW_DEFAULT_SORT_ORDER_OR_MANUAL_LAYOUT,
- default_icon_view_sort_order_or_manual_layout_changed_callback,
- NULL);
+ g_signal_connect_swapped (caja_icon_view_preferences,
+ "changed::" CAJA_PREFERENCES_ICON_VIEW_DEFAULT_SORT_ORDER_OR_MANUAL_LAYOUT,
+ G_CALLBACK (default_icon_view_sort_order_or_manual_layout_changed_callback),
+ NULL);
/* Preload everything in a big batch */
eel_mateconf_preload_cache ("/apps/caja/preferences",
diff --git a/libcaja-private/caja-global-preferences.h b/libcaja-private/caja-global-preferences.h
index fd15293e..6ad73d18 100644
--- a/libcaja-private/caja-global-preferences.h
+++ b/libcaja-private/caja-global-preferences.h
@@ -135,13 +135,13 @@ G_BEGIN_DECLS
/* Icon View */
-#define CAJA_PREFERENCES_ICON_VIEW_DEFAULT_SORT_IN_REVERSE_ORDER "icon_view/default_sort_in_reverse_order"
-#define CAJA_PREFERENCES_ICON_VIEW_DEFAULT_SORT_ORDER "icon_view/default_sort_order"
-#define CAJA_PREFERENCES_ICON_VIEW_DEFAULT_USE_TIGHTER_LAYOUT "icon_view/default_use_tighter_layout"
-#define CAJA_PREFERENCES_ICON_VIEW_DEFAULT_ZOOM_LEVEL "icon_view/default_zoom_level"
-#define CAJA_PREFERENCES_ICON_VIEW_DEFAULT_USE_MANUAL_LAYOUT "icon_view/default_use_manual_layout"
+#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 "icon_view/labels_beside_icons"
+#define CAJA_PREFERENCES_ICON_VIEW_LABELS_BESIDE_ICONS "labels-beside-icons"
/* The icon view uses 2 variables to store the sort order and
@@ -151,16 +151,16 @@ G_BEGIN_DECLS
* 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 "icon_view/default_sort_order_or_manual_layout"
+#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 "icon_view/captions"
+#define CAJA_PREFERENCES_ICON_VIEW_CAPTIONS "captions"
/* The default size for thumbnail icons */
-#define CAJA_PREFERENCES_ICON_VIEW_THUMBNAIL_SIZE "icon_view/thumbnail_size"
+#define CAJA_PREFERENCES_ICON_VIEW_THUMBNAIL_SIZE "thumbnail-size"
/* ellipsization preferences */
-#define CAJA_PREFERENCES_ICON_VIEW_TEXT_ELLIPSIS_LIMIT "icon_view/text_ellipsis_limit"
+#define CAJA_PREFERENCES_ICON_VIEW_TEXT_ELLIPSIS_LIMIT "text-ellipsis-limit"
#define CAJA_PREFERENCES_DESKTOP_TEXT_ELLIPSIS_LIMIT "desktop/text_ellipsis_limit"
/* Compact View */
@@ -229,6 +229,7 @@ char *caja_global_preferences_get_default_folder_viewer_preference_as_iid (void)
GSettings *caja_preferences;
GSettings *caja_media_preferences;
GSettings *caja_window_state;
+GSettings *caja_icon_view_preferences;
G_END_DECLS
diff --git a/libcaja-private/caja-icon-container.c b/libcaja-private/caja-icon-container.c
index 39aab446..fa9651b7 100644
--- a/libcaja-private/caja-icon-container.c
+++ b/libcaja-private/caja-icon-container.c
@@ -216,6 +216,7 @@ static void caja_icon_container_set_rtl_positions (CajaIconContainer *conta
static double get_mirror_x_position (CajaIconContainer *container,
CajaIcon *icon,
double x);
+static void text_ellipsis_limit_changed_container_callback (gpointer callback_data);
static int compare_icons_horizontal (CajaIconContainer *container,
CajaIcon *icon_a,
@@ -4452,6 +4453,10 @@ finalize (GObject *object)
details = CAJA_ICON_CONTAINER (object)->details;
+ g_signal_handlers_disconnect_by_func (caja_icon_view_preferences,
+ text_ellipsis_limit_changed_container_callback,
+ object);
+
g_hash_table_destroy (details->icon_set);
details->icon_set = NULL;
@@ -6203,9 +6208,10 @@ caja_icon_container_constructor (GType type,
}
else
{
- eel_preferences_add_callback_while_alive (CAJA_PREFERENCES_ICON_VIEW_TEXT_ELLIPSIS_LIMIT,
- text_ellipsis_limit_changed_container_callback,
- container, G_OBJECT (container));
+ g_signal_connect_swapped (caja_icon_view_preferences,
+ "changed::" CAJA_PREFERENCES_ICON_VIEW_TEXT_ELLIPSIS_LIMIT,
+ G_CALLBACK (text_ellipsis_limit_changed_container_callback),
+ container);
}
return object;
@@ -6815,7 +6821,7 @@ text_ellipsis_limit_changed_callback (gpointer callback_data)
const EelEnumeration *eenum;
const EelEnumerationEntry *entry;
- pref = eel_preferences_get_string_array (CAJA_PREFERENCES_ICON_VIEW_TEXT_ELLIPSIS_LIMIT);
+ pref = g_settings_get_strv (caja_icon_view_preferences, CAJA_PREFERENCES_ICON_VIEW_TEXT_ELLIPSIS_LIMIT);
/* set default */
get_text_ellipsis_limit_for_zoom (pref, NULL, &one_limit);
@@ -6890,9 +6896,10 @@ caja_icon_container_init (CajaIconContainer *container)
if (!setup_prefs)
{
- eel_preferences_add_callback (CAJA_PREFERENCES_ICON_VIEW_TEXT_ELLIPSIS_LIMIT,
- text_ellipsis_limit_changed_callback,
- NULL);
+ g_signal_connect_swapped (caja_icon_view_preferences,
+ "changed::" CAJA_PREFERENCES_ICON_VIEW_TEXT_ELLIPSIS_LIMIT,
+ G_CALLBACK (text_ellipsis_limit_changed_callback),
+ NULL);
text_ellipsis_limit_changed_callback (NULL);
eel_preferences_add_callback (CAJA_PREFERENCES_DESKTOP_TEXT_ELLIPSIS_LIMIT,
diff --git a/libcaja-private/caja-thumbnails.c b/libcaja-private/caja-thumbnails.c
index 7034fe34..d1c52561 100644
--- a/libcaja-private/caja-thumbnails.c
+++ b/libcaja-private/caja-thumbnails.c
@@ -455,8 +455,9 @@ get_pixbuf_from_data (const unsigned char *buffer,
if (thumbnail_icon_size == 0)
{
- eel_preferences_add_auto_integer (CAJA_PREFERENCES_ICON_VIEW_THUMBNAIL_SIZE,
- &thumbnail_icon_size);
+ eel_g_settings_add_auto_int (caja_icon_view_preferences,
+ CAJA_PREFERENCES_ICON_VIEW_THUMBNAIL_SIZE,
+ &thumbnail_icon_size);
}
loader = gdk_pixbuf_loader_new ();