summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefano Karapetsas <[email protected]>2012-09-05 20:18:19 +0200
committerStefano Karapetsas <[email protected]>2012-09-05 20:18:19 +0200
commit617f5c6f7115357f4c5f92175c9ff4c9be99359c (patch)
treed1fb458cf6fbbed05e1c7a7ee0e685e4f1e5c91e
parentc042e64ccabe8da21f2251301bc0536922d44560 (diff)
downloadcaja-617f5c6f7115357f4c5f92175c9ff4c9be99359c.tar.bz2
caja-617f5c6f7115357f4c5f92175c9ff4c9be99359c.tar.xz
convert compact view prefs to gsettings
-rw-r--r--libcaja-private/caja-global-preferences.c10
-rw-r--r--libcaja-private/caja-global-preferences.h5
-rw-r--r--src/caja-file-management-properties.c14
-rw-r--r--src/file-manager/fm-icon-view.c29
4 files changed, 30 insertions, 28 deletions
diff --git a/libcaja-private/caja-global-preferences.c b/libcaja-private/caja-global-preferences.c
index b0a7e765..4331b858 100644
--- a/libcaja-private/caja-global-preferences.c
+++ b/libcaja-private/caja-global-preferences.c
@@ -164,15 +164,6 @@ typedef struct
*/
static const PreferenceDefault preference_defaults[] =
{
- /* Compact Icon View Default Preferences */
- {
- CAJA_PREFERENCES_COMPACT_VIEW_DEFAULT_ZOOM_LEVEL,
- PREFERENCE_STRING,
- "standard",
- NULL, NULL,
- "default_zoom_level"
- },
-
/* List View Default Preferences */
{
CAJA_PREFERENCES_LIST_VIEW_DEFAULT_SORT_ORDER,
@@ -422,6 +413,7 @@ caja_global_preferences_init (void)
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");
+ caja_compact_view_preferences = g_settings_new("org.mate.caja.compact-view");
caja_desktop_preferences = g_settings_new("org.mate.caja.desktop");
caja_tree_sidebar_preferences = g_settings_new("org.mate.caja.sidebar-panels.tree");
diff --git a/libcaja-private/caja-global-preferences.h b/libcaja-private/caja-global-preferences.h
index e0c9d566..a8bfa6da 100644
--- a/libcaja-private/caja-global-preferences.h
+++ b/libcaja-private/caja-global-preferences.h
@@ -164,8 +164,8 @@ G_BEGIN_DECLS
#define CAJA_PREFERENCES_DESKTOP_TEXT_ELLIPSIS_LIMIT "text-ellipsis-limit"
/* Compact View */
-#define CAJA_PREFERENCES_COMPACT_VIEW_DEFAULT_ZOOM_LEVEL "compact_view/default_zoom_level"
-#define CAJA_PREFERENCES_COMPACT_VIEW_ALL_COLUMNS_SAME_WIDTH "compact_view/all_columns_have_same_width"
+#define CAJA_PREFERENCES_COMPACT_VIEW_DEFAULT_ZOOM_LEVEL "default-zoom-level"
+#define CAJA_PREFERENCES_COMPACT_VIEW_ALL_COLUMNS_SAME_WIDTH "all-columns-have-same-width"
/* List View */
#define CAJA_PREFERENCES_LIST_VIEW_DEFAULT_SORT_IN_REVERSE_ORDER "list_view/default_sort_in_reverse_order"
@@ -232,6 +232,7 @@ GSettings *caja_window_state;
GSettings *caja_icon_view_preferences;
GSettings *caja_desktop_preferences;
GSettings *caja_tree_sidebar_preferences;
+GSettings *caja_compact_view_preferences;
G_END_DECLS
diff --git a/src/caja-file-management-properties.c b/src/caja-file-management-properties.c
index a63ea744..4ac3121d 100644
--- a/src/caja-file-management-properties.c
+++ b/src/caja-file-management-properties.c
@@ -966,9 +966,9 @@ caja_file_management_properties_dialog_setup (GtkBuilder *builder, GtkWindow *wi
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);
+ bind_builder_bool (builder, caja_compact_view_preferences,
+ CAJA_FILE_MANAGEMENT_PROPERTIES_ALL_COLUMNS_SAME_WIDTH,
+ CAJA_PREFERENCES_COMPACT_VIEW_ALL_COLUMNS_SAME_WIDTH);
bind_builder_bool (builder, caja_preferences,
CAJA_FILE_MANAGEMENT_PROPERTIES_FOLDERS_FIRST_WIDGET,
CAJA_PREFERENCES_SORT_DIRECTORIES_FIRST);
@@ -1005,10 +1005,10 @@ caja_file_management_properties_dialog_setup (GtkBuilder *builder, GtkWindow *wi
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,
- (const char **) zoom_values);
+ bind_builder_enum (builder, caja_compact_view_preferences,
+ 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,
diff --git a/src/file-manager/fm-icon-view.c b/src/file-manager/fm-icon-view.c
index 3c70b2da..1e643bb2 100644
--- a/src/file-manager/fm-icon-view.c
+++ b/src/file-manager/fm-icon-view.c
@@ -201,6 +201,7 @@ static void default_use_tighter_layout_changed_callback (gpointer callback_da
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);
static void fm_icon_view_iface_init (CajaViewIface *iface);
@@ -268,7 +269,12 @@ fm_icon_view_finalize (GObject *object)
g_signal_handlers_disconnect_by_func (caja_icon_view_preferences,
labels_beside_icons_changed_callback,
icon_view);
-
+ g_signal_handlers_disconnect_by_func (caja_compact_view_preferences,
+ default_zoom_level_changed_callback,
+ icon_view);
+ g_signal_handlers_disconnect_by_func (caja_compact_view_preferences,
+ all_columns_same_width_changed_callback,
+ icon_view);
G_OBJECT_CLASS (fm_icon_view_parent_class)->finalize (object);
}
@@ -1237,8 +1243,9 @@ get_default_zoom_level (FMIconView *icon_view)
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);
+ eel_g_settings_add_auto_enum (caja_compact_view_preferences,
+ CAJA_PREFERENCES_COMPACT_VIEW_DEFAULT_ZOOM_LEVEL,
+ (int *) &default_compact_zoom_level);
}
return CLAMP (DEFAULT_ZOOM_LEVEL(icon_view), CAJA_ZOOM_LEVEL_SMALLEST, CAJA_ZOOM_LEVEL_LARGEST);
@@ -1276,7 +1283,7 @@ set_columns_same_width (FMIconView *icon_view)
if (fm_icon_view_is_compact (icon_view))
{
- all_columns_same_width = eel_preferences_get_boolean (CAJA_PREFERENCES_COMPACT_VIEW_ALL_COLUMNS_SAME_WIDTH);
+ all_columns_same_width = g_settings_get_boolean (caja_compact_view_preferences, CAJA_PREFERENCES_COMPACT_VIEW_ALL_COLUMNS_SAME_WIDTH);
caja_icon_container_set_all_columns_same_width (get_icon_container (icon_view), all_columns_same_width);
}
}
@@ -3344,12 +3351,14 @@ fm_icon_view_init (FMIconView *icon_view)
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,
- icon_view, G_OBJECT (icon_view));
- eel_preferences_add_callback_while_alive (CAJA_PREFERENCES_COMPACT_VIEW_ALL_COLUMNS_SAME_WIDTH,
- all_columns_same_width_changed_callback,
- icon_view, G_OBJECT (icon_view));
+ g_signal_connect_swapped (caja_compact_view_preferences,
+ "changed::" CAJA_PREFERENCES_COMPACT_VIEW_DEFAULT_ZOOM_LEVEL,
+ G_CALLBACK (default_zoom_level_changed_callback),
+ icon_view);
+ g_signal_connect_swapped (caja_compact_view_preferences,
+ "changed::" CAJA_PREFERENCES_COMPACT_VIEW_ALL_COLUMNS_SAME_WIDTH,
+ G_CALLBACK (all_columns_same_width_changed_callback),
+ icon_view);
g_signal_connect_object (get_icon_container (icon_view), "handle_netscape_url",
G_CALLBACK (icon_view_handle_netscape_url), icon_view, 0);