summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libcaja-private/caja-file.c22
-rw-r--r--libcaja-private/caja-global-preferences.c32
-rw-r--r--libcaja-private/caja-global-preferences.h8
-rw-r--r--src/caja-file-management-properties.c85
-rw-r--r--src/file-manager/fm-directory-view.c10
-rw-r--r--src/file-manager/fm-icon-view.c5
6 files changed, 97 insertions, 65 deletions
diff --git a/libcaja-private/caja-file.c b/libcaja-private/caja-file.c
index 52bfaa50..0a2d8833 100644
--- a/libcaja-private/caja-file.c
+++ b/libcaja-private/caja-file.c
@@ -4041,7 +4041,7 @@ get_custom_icon (CajaFile *file)
}
-static guint cached_thumbnail_limit;
+static guint64 cached_thumbnail_limit;
int cached_thumbnail_size;
static int show_image_thumbs;
@@ -8160,7 +8160,9 @@ caja_extract_top_left_text (const char *text,
static void
thumbnail_limit_changed_callback (gpointer user_data)
{
- cached_thumbnail_limit = eel_preferences_get_uint (CAJA_PREFERENCES_IMAGE_FILE_THUMBNAIL_LIMIT);
+ g_settings_get (caja_preferences,
+ CAJA_PREFERENCES_IMAGE_FILE_THUMBNAIL_LIMIT,
+ "t", &cached_thumbnail_limit);
/* 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
@@ -8184,7 +8186,7 @@ thumbnail_size_changed_callback (gpointer user_data)
static void
show_thumbnails_changed_callback (gpointer user_data)
{
- show_image_thumbs = eel_preferences_get_enum (CAJA_PREFERENCES_SHOW_IMAGE_FILE_THUMBNAILS);
+ show_image_thumbs = g_settings_get_enum (caja_preferences, CAJA_PREFERENCES_SHOW_IMAGE_FILE_THUMBNAILS);
/* 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
@@ -8281,17 +8283,19 @@ caja_file_class_init (CajaFileClass *class)
&date_format_pref);
thumbnail_limit_changed_callback (NULL);
- eel_preferences_add_callback (CAJA_PREFERENCES_IMAGE_FILE_THUMBNAIL_LIMIT,
- thumbnail_limit_changed_callback,
- NULL);
+ g_signal_connect_swapped (caja_preferences,
+ "changed::" CAJA_PREFERENCES_IMAGE_FILE_THUMBNAIL_LIMIT,
+ 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);
show_thumbnails_changed_callback (NULL);
- eel_preferences_add_callback (CAJA_PREFERENCES_SHOW_IMAGE_FILE_THUMBNAILS,
- show_thumbnails_changed_callback,
- NULL);
+ g_signal_connect_swapped (caja_preferences,
+ "changed::" CAJA_PREFERENCES_SHOW_IMAGE_FILE_THUMBNAILS,
+ G_CALLBACK (show_thumbnails_changed_callback),
+ NULL);
icon_theme = gtk_icon_theme_get_default ();
g_signal_connect_object (icon_theme,
diff --git a/libcaja-private/caja-global-preferences.c b/libcaja-private/caja-global-preferences.c
index 490a8d4d..27e3a543 100644
--- a/libcaja-private/caja-global-preferences.c
+++ b/libcaja-private/caja-global-preferences.c
@@ -64,14 +64,6 @@ typedef enum
PREFERENCE_STRING_ARRAY
} PreferenceType;
-/* Enumerations used to qualify some INTEGER preferences */
-static EelEnumerationEntry speed_tradeoff_enum_entries[] =
-{
- { "always", N_("_Always"), CAJA_SPEED_TRADEOFF_ALWAYS },
- { "local_only", N_("_Local File Only"), CAJA_SPEED_TRADEOFF_LOCAL_ONLY },
- { "never", N_("_Never"), CAJA_SPEED_TRADEOFF_NEVER }
-};
-
static EelEnumerationEntry default_zoom_level_enum_entries[] =
{
/* xgettext:no-c-format */
@@ -188,27 +180,6 @@ typedef struct
static const PreferenceDefault preference_defaults[] =
{
{
- CAJA_PREFERENCES_SHOW_IMAGE_FILE_THUMBNAILS,
- PREFERENCE_STRING,
- "local_only",
- NULL, NULL,
- "speed_tradeoff"
- },
- {
- CAJA_PREFERENCES_IMAGE_FILE_THUMBNAIL_LIMIT,
- PREFERENCE_INTEGER,
- GINT_TO_POINTER(10485760),
- NULL, NULL,
- "file_size"
- },
- {
- CAJA_PREFERENCES_PREVIEW_SOUND,
- PREFERENCE_STRING,
- "local_only",
- NULL, NULL,
- "speed_tradeoff"
- },
- {
CAJA_PREFERENCES_ICON_VIEW_CAPTIONS,
PREFERENCE_STRING_ARRAY,
"size,date_modified,type",
@@ -434,9 +405,6 @@ global_preferences_register_enumerations (void)
eel_enumeration_register ("file_size",
file_size_enum_entries,
G_N_ELEMENTS (file_size_enum_entries));
- eel_enumeration_register ("speed_tradeoff",
- speed_tradeoff_enum_entries,
- G_N_ELEMENTS (speed_tradeoff_enum_entries));
eel_enumeration_register ("standard_font_size",
standard_font_size_entries,
G_N_ELEMENTS (standard_font_size_entries));
diff --git a/libcaja-private/caja-global-preferences.h b/libcaja-private/caja-global-preferences.h
index 9f722214..fd15293e 100644
--- a/libcaja-private/caja-global-preferences.h
+++ b/libcaja-private/caja-global-preferences.h
@@ -198,11 +198,11 @@ G_BEGIN_DECLS
CAJA_SPEED_TRADEOFF_NEVER
} CajaSpeedTradeoffValue;
-#define CAJA_PREFERENCES_SHOW_TEXT_IN_ICONS "show-icon-text"
+#define CAJA_PREFERENCES_SHOW_TEXT_IN_ICONS "show-icon-text"
#define CAJA_PREFERENCES_SHOW_DIRECTORY_ITEM_COUNTS "show-directory-item-counts"
-#define CAJA_PREFERENCES_SHOW_IMAGE_FILE_THUMBNAILS "preferences/show_image_thumbnails"
-#define CAJA_PREFERENCES_IMAGE_FILE_THUMBNAIL_LIMIT "preferences/thumbnail_limit"
-#define CAJA_PREFERENCES_PREVIEW_SOUND "preferences/preview_sound"
+#define CAJA_PREFERENCES_SHOW_IMAGE_FILE_THUMBNAILS "show-image-thumbnails"
+#define CAJA_PREFERENCES_IMAGE_FILE_THUMBNAIL_LIMIT "thumbnail-limit"
+#define CAJA_PREFERENCES_PREVIEW_SOUND "preview-sound"
typedef enum
{
diff --git a/src/caja-file-management-properties.c b/src/caja-file-management-properties.c
index 2b57f7a6..2fa8f9bb 100644
--- a/src/caja-file-management-properties.c
+++ b/src/caja-file-management-properties.c
@@ -150,7 +150,7 @@ static const char * const executable_text_values[] =
NULL
};
-static const guint thumbnail_limit_values[] =
+static const guint64 thumbnail_limit_values[] =
{
102400,
512000,
@@ -792,6 +792,63 @@ bind_builder_enum (GtkBuilder *builder,
}
typedef struct {
+ const guint64 *values;
+ int n_values;
+} UIntEnumBinding;
+
+static gboolean
+uint_enum_get_mapping (GValue *value,
+ GVariant *variant,
+ gpointer user_data)
+{
+ UIntEnumBinding *binding = user_data;
+ guint64 v;
+ int i;
+
+ v = g_variant_get_uint64 (variant);
+ for (i = 0; i < binding->n_values; i++) {
+ if (binding->values[i] >= v) {
+ g_value_set_int (value, i);
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
+static GVariant *
+uint_enum_set_mapping (const GValue *value,
+ const GVariantType *expected_type,
+ gpointer user_data)
+{
+ UIntEnumBinding *binding = user_data;
+
+ return g_variant_new_uint64 (binding->values[g_value_get_int (value)]);
+}
+
+static void
+bind_builder_uint_enum (GtkBuilder *builder,
+ GSettings *settings,
+ const char *widget_name,
+ const char *prefs,
+ const guint64 *values,
+ int n_values)
+{
+ UIntEnumBinding *binding;
+
+ binding = g_new (UIntEnumBinding, 1);
+ binding->values = values;
+ binding->n_values = n_values;
+
+ g_settings_bind_with_mapping (settings, prefs,
+ gtk_builder_get_object (builder, widget_name),
+ "active", G_SETTINGS_BIND_DEFAULT,
+ uint_enum_get_mapping,
+ uint_enum_set_mapping,
+ binding, g_free);
+}
+
+typedef struct {
GtkWidget *button;
const char *value;
const char *key;
@@ -962,14 +1019,14 @@ caja_file_management_properties_dialog_setup (GtkBuilder *builder, GtkWindow *wi
CAJA_FILE_MANAGEMENT_PROPERTIES_PREVIEW_TEXT_WIDGET,
CAJA_PREFERENCES_SHOW_TEXT_IN_ICONS,
(const char **) preview_values);
- eel_preferences_builder_connect_string_enum_combo_box (builder,
- CAJA_FILE_MANAGEMENT_PROPERTIES_PREVIEW_IMAGE_WIDGET,
- CAJA_PREFERENCES_SHOW_IMAGE_FILE_THUMBNAILS,
- (const char **) preview_values);
- eel_preferences_builder_connect_string_enum_combo_box (builder,
- CAJA_FILE_MANAGEMENT_PROPERTIES_PREVIEW_SOUND_WIDGET,
- CAJA_PREFERENCES_PREVIEW_SOUND,
- (const char **) preview_values);
+ bind_builder_enum (builder, caja_preferences,
+ CAJA_FILE_MANAGEMENT_PROPERTIES_PREVIEW_IMAGE_WIDGET,
+ CAJA_PREFERENCES_SHOW_IMAGE_FILE_THUMBNAILS,
+ (const char **) preview_values);
+ bind_builder_enum (builder, caja_preferences,
+ CAJA_FILE_MANAGEMENT_PROPERTIES_PREVIEW_SOUND_WIDGET,
+ CAJA_PREFERENCES_PREVIEW_SOUND,
+ (const char **) preview_values);
bind_builder_enum (builder, caja_preferences,
CAJA_FILE_MANAGEMENT_PROPERTIES_PREVIEW_FOLDER_WIDGET,
CAJA_PREFERENCES_SHOW_DIRECTORY_ITEM_COUNTS,
@@ -988,11 +1045,11 @@ caja_file_management_properties_dialog_setup (GtkBuilder *builder, GtkWindow *wi
CAJA_PREFERENCES_EXECUTABLE_TEXT_ACTIVATION,
(const char **) executable_text_values);
- eel_preferences_builder_connect_uint_enum (builder,
- CAJA_FILE_MANAGEMENT_PROPERTIES_THUMBNAIL_LIMIT_WIDGET,
- CAJA_PREFERENCES_IMAGE_FILE_THUMBNAIL_LIMIT,
- (const guint *) thumbnail_limit_values,
- G_N_ELEMENTS (thumbnail_limit_values));
+ bind_builder_uint_enum (builder, caja_preferences,
+ CAJA_FILE_MANAGEMENT_PROPERTIES_THUMBNAIL_LIMIT_WIDGET,
+ CAJA_PREFERENCES_IMAGE_FILE_THUMBNAIL_LIMIT,
+ thumbnail_limit_values,
+ G_N_ELEMENTS (thumbnail_limit_values));
caja_file_management_properties_dialog_setup_icon_caption_page (builder);
caja_file_management_properties_dialog_setup_list_column_page (builder);
diff --git a/src/file-manager/fm-directory-view.c b/src/file-manager/fm-directory-view.c
index c12cb3aa..a678ec88 100644
--- a/src/file-manager/fm-directory-view.c
+++ b/src/file-manager/fm-directory-view.c
@@ -2043,8 +2043,10 @@ fm_directory_view_init (FMDirectoryView *view)
schedule_update_menus_callback, view);
eel_preferences_add_callback (CAJA_PREFERENCES_ICON_VIEW_CAPTIONS,
text_attribute_names_changed_callback, view);
- eel_preferences_add_callback (CAJA_PREFERENCES_SHOW_IMAGE_FILE_THUMBNAILS,
- image_display_policy_changed_callback, view);
+ g_signal_connect_swapped (caja_preferences,
+ "changed::" CAJA_PREFERENCES_SHOW_IMAGE_FILE_THUMBNAILS,
+ G_CALLBACK (image_display_policy_changed_callback),
+ view);
g_signal_connect_swapped (caja_preferences,
"changed::" CAJA_PREFERENCES_CLICK_POLICY,
G_CALLBACK(click_policy_changed_callback),
@@ -2176,8 +2178,8 @@ fm_directory_view_finalize (GObject *object)
schedule_update_menus_callback, view);
eel_preferences_remove_callback (CAJA_PREFERENCES_ICON_VIEW_CAPTIONS,
text_attribute_names_changed_callback, view);
- eel_preferences_remove_callback (CAJA_PREFERENCES_SHOW_IMAGE_FILE_THUMBNAILS,
- image_display_policy_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,
click_policy_changed_callback, view);
g_signal_handlers_disconnect_by_func (caja_preferences,
diff --git a/src/file-manager/fm-icon-view.c b/src/file-manager/fm-icon-view.c
index 5ecf6e8c..d5ab000e 100644
--- a/src/file-manager/fm-icon-view.c
+++ b/src/file-manager/fm-icon-view.c
@@ -3283,8 +3283,9 @@ fm_icon_view_init (FMIconView *icon_view)
if (!setup_sound_preview)
{
- eel_preferences_add_auto_enum (CAJA_PREFERENCES_PREVIEW_SOUND,
- &preview_sound_auto_value);
+ eel_g_settings_add_auto_enum (caja_preferences,
+ CAJA_PREFERENCES_PREVIEW_SOUND,
+ &preview_sound_auto_value);
setup_sound_preview = TRUE;
}