From 6f15dc7cc1be8b98bbc1f5edd963ff89076295ee Mon Sep 17 00:00:00 2001 From: Stefano Karapetsas Date: Wed, 5 Sep 2012 12:36:04 +0200 Subject: start migration to gsettings --- NEWS | 4 + configure.in | 18 +- libcaja-private/Makefile.am | 22 +- libcaja-private/caja-autorun.c | 22 +- libcaja-private/caja-desktop-directory-file.c | 2 +- libcaja-private/caja-desktop-directory.c | 17 +- libcaja-private/caja-desktop-icon-file.c | 2 +- libcaja-private/caja-directory-async.c | 39 +- libcaja-private/caja-directory-background.c | 89 ++-- libcaja-private/caja-directory-private.h | 1 - libcaja-private/caja-directory.c | 14 +- libcaja-private/caja-directory.h | 2 - libcaja-private/caja-file-operations.c | 36 +- libcaja-private/caja-file-private.h | 1 - libcaja-private/caja-file-utilities.c | 10 +- libcaja-private/caja-file-utilities.h | 4 - libcaja-private/caja-file.c | 34 +- libcaja-private/caja-file.h | 7 +- libcaja-private/caja-global-preferences.c | 85 +--- libcaja-private/caja-global-preferences.h | 59 ++- libcaja-private/caja-icon-container.c | 7 - libcaja-private/caja-merged-directory.c | 6 +- libcaja-private/caja-search-directory.c | 3 - libcaja-private/caja-vfs-directory.c | 2 - libcaja-private/caja-vfs-file.c | 2 +- libcaja-private/org.mate.caja.gschema.xml.in | 491 +++++++++++++++++++++ .../org.mate.media-handling.gschema.xml.in | 34 ++ src/caja-application.c | 23 +- src/caja-emblem-sidebar.h | 2 +- src/caja-file-management-properties-main.c | 2 + src/caja-file-management-properties.c | 61 ++- src/caja-history-sidebar.h | 2 +- src/caja-information-panel.c | 70 +-- src/caja-information-panel.h | 2 +- src/caja-main.c | 8 - src/caja-navigation-window.c | 25 +- src/caja-notes-viewer.h | 2 +- src/caja-pathbar.c | 10 +- src/caja-places-sidebar.c | 11 +- src/caja-places-sidebar.h | 2 +- src/caja-property-browser.c | 21 - src/caja-window-menus.c | 10 +- src/file-manager/Makefile.am | 2 - src/file-manager/fm-desktop-icon-view.c | 12 +- src/file-manager/fm-directory-view.c | 36 +- src/file-manager/fm-tree-model.c | 4 - src/file-manager/fm-tree-view.c | 22 +- src/file-manager/fm-tree-view.h | 2 +- test/test-caja-directory-async.c | 2 +- 49 files changed, 833 insertions(+), 511 deletions(-) create mode 100644 libcaja-private/org.mate.caja.gschema.xml.in create mode 100644 libcaja-private/org.mate.media-handling.gschema.xml.in diff --git a/NEWS b/NEWS index 0c235b9f..bcce0acb 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,7 @@ +Major changes in 1.5.0 are: +* Replace mateconf with gsettings +* "Show backup files" option merged in "Show hidden files" + Major changes in 1.3.0 are: * Restore toggle button for button and text-based location bar * Add the ability to open bookmarks in the places side pane via the enter and space keys diff --git a/configure.in b/configure.in index ab581dcd..c9512458 100644 --- a/configure.in +++ b/configure.in @@ -3,6 +3,7 @@ AC_PREREQ(2.54) dnl =========================================================================== m4_define(glib_minver, 2.25.9) +m4_define(gio_minver, 2.25.0) m4_define(mate_desktop_minver, 1.1.0) m4_define(pango_minver, 1.1.2) m4_define(gtk_minver, 2.22.0) @@ -19,7 +20,7 @@ dnl Interface break is not allowed. m4_define(caja_extension_current, 5) m4_define(caja_extension_revision, 0) -AC_INIT([caja], [1.4.0], [http://www.mate-desktop.org]) +AC_INIT([caja], [1.5.0], [http://www.mate-desktop.org]) dnl --------------------------------------------------------------------------- dnl GTK library version @@ -60,6 +61,7 @@ AM_MAINTAINER_MODE AC_SUBST([ACLOCAL_AMFLAGS], ["\${ACLOCAL_FLAGS}"]) AC_SUBST(GLIB_REQUIRED, [glib_minver]) +AC_SUBST(GIO_REQUIRED, [gio_minver]) AC_SUBST(MATE_DESKTOP_REQUIRED, [mate_desktop_minver]) AC_SUBST(PANGO_REQUIRED, [pango_minver]) AC_SUBST(GTK_REQUIRED, [$GTK_REQUIRED]) @@ -89,7 +91,7 @@ PKG_CHECK_MODULES(ALL, [ mate-desktop-2.0 >= mate_desktop_minver gthread-2.0 gio-unix-2.0 - gio-2.0 + gio-2.0 >= gio_minver pango >= pango_minver gtk+-$GTK_API_VERSION >= $GTK_REQUIRED libxml-2.0 >= xml_minver @@ -424,7 +426,7 @@ AC_SUBST(LIBCAJA_EXTENSION_LIBS) dnl core caja PKG_CHECK_MODULES(GMODULE, gmodule-2.0, [GMODULE_ADD="gmodule-2.0"],[GMODULE_ADD=""]) -CORE_MODULES="glib-2.0 $GMODULE_ADD mate-desktop-2.0 gthread-2.0 gio-2.0 gio-unix-2.0 gail mateconf-2.0 libxml-2.0 $EXTRA_CORE_MODULES gtk+-$GTK_API_VERSION" +CORE_MODULES="glib-2.0 $GMODULE_ADD mate-desktop-2.0 gthread-2.0 gio-2.0 mateconf-2.0 gio-unix-2.0 gail libxml-2.0 $EXTRA_CORE_MODULES gtk+-$GTK_API_VERSION" CORE_CFLAGS="`$PKG_CONFIG --cflags $CORE_MODULES` $x_cflags" AC_SUBST(CORE_CFLAGS) CORE_LIBS="`$PKG_CONFIG --libs $CORE_MODULES` $x_libs" @@ -437,16 +439,10 @@ dnl Multimedia keys AC_CHECK_HEADERS([X11/XF86keysym.h]) dnl ============================================== -dnl Special MateConf section +dnl Special GSettings section dnl ============================================== -AC_PATH_PROG(MATECONFTOOL, mateconftool-2, no) - -if test x"$MATECONFTOOL" = xno; then - AC_MSG_ERROR([mateconftool-2 executable not found in your path - should be installed with MateConf]) -fi - -AM_MATECONF_SOURCE_2 +GLIB_GSETTINGS ################################################## # Check for introspection diff --git a/libcaja-private/Makefile.am b/libcaja-private/Makefile.am index 7749f200..93d67834 100644 --- a/libcaja-private/Makefile.am +++ b/libcaja-private/Makefile.am @@ -214,26 +214,17 @@ caja-marshal-guts.c: caja-marshal.list $(GLIB_GENMARSHAL) $(libcaja_private_la_OBJECTS): $(marshal_sources) +gsettingsschema_in_files = org.mate.caja.gschema.xml.in org.mate.media-handling.gschema.xml.in +gsettings_SCHEMAS = $(gsettingsschema_in_files:.xml.in=.xml) +.PRECIOUS: $(gsettings_SCHEMAS) -schema_in_files = apps_caja_preferences.schemas.in -schemadir = $(MATECONF_SCHEMA_FILE_DIR) -schema_DATA = $(schema_in_files:.schemas.in=.schemas) +@INTLTOOL_XML_NOMERGE_RULE@ -@INTLTOOL_SCHEMAS_RULE@ - -# don't do this if we are building in eg. rpm -if MATECONF_SCHEMAS_INSTALL -install-data-local: - if test -z "$(DESTDIR)" ; then \ - for p in $(schema_DATA) ; do \ - MATECONF_CONFIG_SOURCE=$(MATECONF_SCHEMA_CONFIG_SOURCE) $(MATECONFTOOL) --makefile-install-rule $$p; \ - done \ - fi -endif +@GSETTINGS_RULES@ EXTRA_DIST = \ caja-marshal.list \ - $(schema_in_files) \ + $(gsettingsschema_in_files) \ $(BEAGLE_SOURCES) \ $(TRACKER_SOURCES) \ $(NULL) @@ -241,6 +232,7 @@ EXTRA_DIST = \ CLEANFILES = \ $(marshal_sources) \ $(schema_DATA) \ + $(gsettings_SCHEMAS) \ $(NULL) dist-hook: diff --git a/libcaja-private/caja-autorun.c b/libcaja-private/caja-autorun.c index 78340c5e..cf801b08 100644 --- a/libcaja-private/caja-autorun.c +++ b/libcaja-private/caja-autorun.c @@ -83,9 +83,9 @@ caja_autorun_get_preferences (const char *x_content_type, *pref_start_app = FALSE; *pref_ignore = FALSE; *pref_open_folder = FALSE; - x_content_start_app = eel_preferences_get_string_array (CAJA_PREFERENCES_MEDIA_AUTORUN_X_CONTENT_START_APP); - x_content_ignore = eel_preferences_get_string_array (CAJA_PREFERENCES_MEDIA_AUTORUN_X_CONTENT_IGNORE); - x_content_open_folder = eel_preferences_get_string_array (CAJA_PREFERENCES_MEDIA_AUTORUN_X_CONTENT_OPEN_FOLDER); + x_content_start_app = g_settings_get_strv (caja_media_preferences, CAJA_PREFERENCES_MEDIA_AUTORUN_X_CONTENT_START_APP); + x_content_ignore = g_settings_get_strv (caja_media_preferences, CAJA_PREFERENCES_MEDIA_AUTORUN_X_CONTENT_IGNORE); + x_content_open_folder = g_settings_get_strv (caja_media_preferences, CAJA_PREFERENCES_MEDIA_AUTORUN_X_CONTENT_OPEN_FOLDER); if (x_content_start_app != NULL) { *pref_start_app = eel_g_strv_find (x_content_start_app, x_content_type) != -1; @@ -156,30 +156,30 @@ caja_autorun_set_preferences (const char *x_content_type, g_assert (x_content_type != NULL); - x_content_start_app = eel_preferences_get_string_array (CAJA_PREFERENCES_MEDIA_AUTORUN_X_CONTENT_START_APP); - x_content_ignore = eel_preferences_get_string_array (CAJA_PREFERENCES_MEDIA_AUTORUN_X_CONTENT_IGNORE); - x_content_open_folder = eel_preferences_get_string_array (CAJA_PREFERENCES_MEDIA_AUTORUN_X_CONTENT_OPEN_FOLDER); + x_content_start_app = g_settings_get_strv (caja_media_preferences, CAJA_PREFERENCES_MEDIA_AUTORUN_X_CONTENT_START_APP); + x_content_ignore = g_settings_get_strv (caja_media_preferences, CAJA_PREFERENCES_MEDIA_AUTORUN_X_CONTENT_IGNORE); + x_content_open_folder = g_settings_get_strv (caja_media_preferences, CAJA_PREFERENCES_MEDIA_AUTORUN_X_CONTENT_OPEN_FOLDER); remove_elem_from_str_array (x_content_start_app, x_content_type); if (pref_start_app) { x_content_start_app = add_elem_to_str_array (x_content_start_app, x_content_type); } - eel_preferences_set_string_array (CAJA_PREFERENCES_MEDIA_AUTORUN_X_CONTENT_START_APP, x_content_start_app); + g_settings_set_strv (caja_media_preferences, CAJA_PREFERENCES_MEDIA_AUTORUN_X_CONTENT_START_APP, (const gchar * const*) x_content_start_app); remove_elem_from_str_array (x_content_ignore, x_content_type); if (pref_ignore) { x_content_ignore = add_elem_to_str_array (x_content_ignore, x_content_type); } - eel_preferences_set_string_array (CAJA_PREFERENCES_MEDIA_AUTORUN_X_CONTENT_IGNORE, x_content_ignore); + g_settings_set_strv (caja_media_preferences, CAJA_PREFERENCES_MEDIA_AUTORUN_X_CONTENT_IGNORE, (const gchar * const*) x_content_ignore); remove_elem_from_str_array (x_content_open_folder, x_content_type); if (pref_open_folder) { x_content_open_folder = add_elem_to_str_array (x_content_open_folder, x_content_type); } - eel_preferences_set_string_array (CAJA_PREFERENCES_MEDIA_AUTORUN_X_CONTENT_OPEN_FOLDER, x_content_open_folder); + g_settings_set_strv (caja_media_preferences, CAJA_PREFERENCES_MEDIA_AUTORUN_X_CONTENT_OPEN_FOLDER, (const gchar * const*) x_content_open_folder); g_strfreev (x_content_open_folder); g_strfreev (x_content_ignore); @@ -1217,7 +1217,7 @@ autorun_guessed_content_type_callback (GObject *source_object, } else { - if (eel_preferences_get_boolean (CAJA_PREFERENCES_MEDIA_AUTOMOUNT_OPEN)) + if (g_settings_get_boolean (caja_media_preferences, CAJA_PREFERENCES_MEDIA_AUTOMOUNT_OPEN)) open_folder = TRUE; } } @@ -1238,7 +1238,7 @@ caja_autorun (GMount *mount, CajaAutorunOpenWindow open_window_func, gpointer us AutorunData *data; if (!should_autorun_mount (mount) || - eel_preferences_get_boolean (CAJA_PREFERENCES_MEDIA_AUTORUN_NEVER)) + g_settings_get_boolean (caja_media_preferences, CAJA_PREFERENCES_MEDIA_AUTORUN_NEVER)) { return; } diff --git a/libcaja-private/caja-desktop-directory-file.c b/libcaja-private/caja-desktop-directory-file.c index 0adf239f..8cddf779 100644 --- a/libcaja-private/caja-desktop-directory-file.c +++ b/libcaja-private/caja-desktop-directory-file.c @@ -174,7 +174,7 @@ desktop_directory_file_monitor_add (CajaFile *file, /* Do the rest ourself */ caja_directory_monitor_add_internal (file->details->directory, file, - client, TRUE, TRUE, + client, TRUE, monitor->non_delegated_attributes, NULL, NULL); } diff --git a/libcaja-private/caja-desktop-directory.c b/libcaja-private/caja-desktop-directory.c index 1b334f1f..bb03f06a 100644 --- a/libcaja-private/caja-desktop-directory.c +++ b/libcaja-private/caja-desktop-directory.c @@ -62,7 +62,6 @@ typedef struct CajaDesktopDirectory *desktop_dir; gboolean monitor_hidden_files; - gboolean monitor_backup_files; CajaFileAttributes monitor_attributes; } MergedMonitor; @@ -296,7 +295,6 @@ static void desktop_monitor_add (CajaDirectory *directory, gconstpointer client, gboolean monitor_hidden_files, - gboolean monitor_backup_files, CajaFileAttributes file_attributes, CajaDirectoryCallback callback, gpointer callback_data) @@ -323,7 +321,6 @@ desktop_monitor_add (CajaDirectory *directory, (gpointer) client, monitor); } monitor->monitor_hidden_files = monitor_hidden_files; - monitor->monitor_backup_files = monitor_backup_files; monitor->monitor_attributes = file_attributes; /* Call through to the real directory add calls. */ @@ -332,7 +329,7 @@ desktop_monitor_add (CajaDirectory *directory, /* Call up to real dir */ caja_directory_file_monitor_add (desktop->details->real_directory, monitor, - monitor_hidden_files, monitor_backup_files, + monitor_hidden_files, file_attributes, build_merged_callback_list, &merged_callback_list); @@ -442,9 +439,9 @@ desktop_finalize (GObject *object) g_hash_table_destroy (desktop->details->monitors); g_free (desktop->details); - eel_preferences_remove_callback (CAJA_PREFERENCES_DESKTOP_IS_HOME_DIR, - desktop_directory_changed_callback, - desktop); + g_signal_handlers_disconnect_by_func (caja_preferences, + desktop_directory_changed_callback, + desktop); G_OBJECT_CLASS (caja_desktop_directory_parent_class)->finalize (object); } @@ -529,9 +526,9 @@ caja_desktop_directory_init (CajaDesktopDirectory *desktop) update_desktop_directory (CAJA_DESKTOP_DIRECTORY (desktop)); - eel_preferences_add_callback (CAJA_PREFERENCES_DESKTOP_IS_HOME_DIR, - desktop_directory_changed_callback, - desktop); + g_signal_connect_swapped (caja_preferences, "changed::" CAJA_PREFERENCES_DESKTOP_IS_HOME_DIR, + G_CALLBACK(desktop_directory_changed_callback), + desktop); } static void diff --git a/libcaja-private/caja-desktop-icon-file.c b/libcaja-private/caja-desktop-icon-file.c index fa5ad094..7e24f6dc 100644 --- a/libcaja-private/caja-desktop-icon-file.c +++ b/libcaja-private/caja-desktop-icon-file.c @@ -54,7 +54,7 @@ desktop_icon_file_monitor_add (CajaFile *file, { caja_directory_monitor_add_internal (file->details->directory, file, - client, TRUE, TRUE, attributes, NULL, NULL); + client, TRUE, attributes, NULL, NULL); } static void diff --git a/libcaja-private/caja-directory-async.c b/libcaja-private/caja-directory-async.c index 3baa3f75..17e16598 100644 --- a/libcaja-private/caja-directory-async.c +++ b/libcaja-private/caja-directory-async.c @@ -172,7 +172,6 @@ typedef struct { CajaFile *file; /* Which file, NULL means all. */ gboolean monitor_hidden_files; /* defines whether "all" includes hidden files */ - gboolean monitor_backup_files; /* defines whether "all" includes backup files */ gconstpointer client; Request request; } Monitor; @@ -809,7 +808,6 @@ caja_directory_monitor_add_internal (CajaDirectory *directory, CajaFile *file, gconstpointer client, gboolean monitor_hidden_files, - gboolean monitor_backup_files, CajaFileAttributes file_attributes, CajaDirectoryCallback callback, gpointer callback_data) @@ -826,7 +824,6 @@ caja_directory_monitor_add_internal (CajaDirectory *directory, monitor = g_new (Monitor, 1); monitor->file = file; monitor->monitor_hidden_files = monitor_hidden_files; - monitor->monitor_backup_files = monitor_backup_files; monitor->client = client; monitor->request = caja_directory_set_up_request (file_attributes); @@ -906,52 +903,34 @@ set_file_unconfirmed (CajaFile *file, gboolean unconfirmed) } static gboolean show_hidden_files = TRUE; -static gboolean show_backup_files = TRUE; static void show_hidden_files_changed_callback (gpointer callback_data) { - show_hidden_files = eel_preferences_get_boolean (CAJA_PREFERENCES_SHOW_HIDDEN_FILES); -} - -static void -show_backup_files_changed_callback (gpointer callback_data) -{ - show_backup_files = eel_preferences_get_boolean (CAJA_PREFERENCES_SHOW_BACKUP_FILES); + show_hidden_files = g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_SHOW_HIDDEN_FILES); } static gboolean should_skip_file (CajaDirectory *directory, GFileInfo *info) { static gboolean show_hidden_files_changed_callback_installed = FALSE; - static gboolean show_backup_files_changed_callback_installed = FALSE; /* Add the callback once for the life of our process */ if (!show_hidden_files_changed_callback_installed) { - eel_preferences_add_callback (CAJA_PREFERENCES_SHOW_HIDDEN_FILES, - show_hidden_files_changed_callback, - NULL); + g_signal_connect_swapped (caja_preferences, + "changed::" CAJA_PREFERENCES_SHOW_HIDDEN_FILES, + G_CALLBACK(show_hidden_files_changed_callback), + NULL); show_hidden_files_changed_callback_installed = TRUE; /* Peek for the first time */ show_hidden_files_changed_callback (NULL); } - /* Add the callback once for the life of our process */ - if (!show_backup_files_changed_callback_installed) - { - eel_preferences_add_callback (CAJA_PREFERENCES_SHOW_BACKUP_FILES, - show_backup_files_changed_callback, - NULL); - show_backup_files_changed_callback_installed = TRUE; - - /* Peek for the first time */ - show_backup_files_changed_callback (NULL); - } - if (!show_hidden_files && (g_file_info_get_is_hidden (info) || + g_file_info_get_is_backup (info) || (directory != NULL && directory->details->hidden_file_hash != NULL && g_hash_table_lookup (directory->details->hidden_file_hash, g_file_info_get_name (info)) != NULL))) @@ -959,11 +938,6 @@ should_skip_file (CajaDirectory *directory, GFileInfo *info) return TRUE; } - if (!show_backup_files && g_file_info_get_is_backup (info)) - { - return TRUE; - } - return FALSE; } @@ -2607,7 +2581,6 @@ monitor_includes_file (const Monitor *monitor, } return caja_file_should_show (file, monitor->monitor_hidden_files, - monitor->monitor_backup_files, TRUE); } diff --git a/libcaja-private/caja-directory-background.c b/libcaja-private/caja-directory-background.c index 69c792d6..38927b24 100644 --- a/libcaja-private/caja-directory-background.c +++ b/libcaja-private/caja-directory-background.c @@ -48,7 +48,9 @@ static void saved_settings_changed_callback (CajaFile *file, static void caja_file_background_receive_mateconf_changes (EelBackground *background); -static void caja_file_background_theme_changed (gpointer user_data); +static void caja_file_background_theme_changed (GSettings *settings, + const gchar *key, + gpointer user_data); void caja_connect_desktop_background_to_file_metadata (CajaIconContainer *icon_container, @@ -80,17 +82,16 @@ caja_file_background_get_default_settings (char **color, { gboolean background_set; - background_set = eel_preferences_get_boolean - (CAJA_PREFERENCES_BACKGROUND_SET); + background_set = g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_BACKGROUND_SET); if (background_set && color) { - *color = eel_preferences_get (CAJA_PREFERENCES_BACKGROUND_COLOR); + *color = g_settings_get_string (caja_preferences, CAJA_PREFERENCES_BACKGROUND_COLOR); } if (background_set && image) { - *image = eel_preferences_get (CAJA_PREFERENCES_BACKGROUND_FILENAME); + *image = g_settings_get_string (caja_preferences, CAJA_PREFERENCES_BACKGROUND_URI); } if (placement) @@ -449,12 +450,17 @@ background_changed_callback (EelBackground *background, NULL, NULL); - eel_preferences_set - (CAJA_PREFERENCES_BACKGROUND_COLOR, color ? color : ""); - eel_preferences_set - (CAJA_PREFERENCES_BACKGROUND_FILENAME, image ? image : ""); - eel_preferences_set_boolean - (CAJA_PREFERENCES_BACKGROUND_SET, TRUE); + g_signal_handlers_block_by_func (caja_preferences, G_CALLBACK (caja_file_background_theme_changed), background); + + g_settings_set_string (caja_preferences, + CAJA_PREFERENCES_BACKGROUND_COLOR, color ? color : ""); + g_settings_set_string (caja_preferences, + CAJA_PREFERENCES_BACKGROUND_URI, + image ? image : ""); + g_settings_set_boolean (caja_preferences, + CAJA_PREFERENCES_BACKGROUND_SET, TRUE); + + g_signal_handlers_unblock_by_func (caja_preferences, G_CALLBACK (caja_file_background_theme_changed), background); } else { @@ -545,7 +551,9 @@ saved_settings_changed_callback (CajaFile *file, /* handle the theme changing */ static void -caja_file_background_theme_changed (gpointer user_data) +caja_file_background_theme_changed (GSettings *settings, + const gchar *key, + gpointer user_data) { CajaFile *file; EelBackground *background; @@ -588,8 +596,11 @@ background_reset_callback (EelBackground *background, NULL); if (!color && !image) { - eel_preferences_set_boolean (CAJA_PREFERENCES_BACKGROUND_SET, - FALSE); + g_signal_handlers_block_by_func (caja_preferences, G_CALLBACK (caja_file_background_theme_changed), background); + g_settings_set_boolean (caja_preferences, + CAJA_PREFERENCES_BACKGROUND_SET, + FALSE); + g_signal_handlers_unblock_by_func (caja_preferences, G_CALLBACK (caja_file_background_theme_changed), background); } else { @@ -626,18 +637,9 @@ background_destroyed_callback (EelBackground *background, (file, G_CALLBACK (saved_settings_changed_callback), background); caja_file_monitor_remove (file, background); - eel_preferences_remove_callback (CAJA_PREFERENCES_THEME, - caja_file_background_theme_changed, - background); - eel_preferences_remove_callback (CAJA_PREFERENCES_BACKGROUND_SET, - caja_file_background_theme_changed, - background); - eel_preferences_remove_callback (CAJA_PREFERENCES_BACKGROUND_COLOR, - caja_file_background_theme_changed, - background); - eel_preferences_remove_callback (CAJA_PREFERENCES_BACKGROUND_FILENAME, - caja_file_background_theme_changed, - background); + g_signal_handlers_disconnect_by_func (caja_preferences, + caja_file_background_theme_changed, + background); } /* key routine that hooks up a background and location */ @@ -676,18 +678,9 @@ caja_connect_background_to_file_metadata (GtkWidget *widget, (old_file, G_CALLBACK (saved_settings_changed_callback), background); caja_file_monitor_remove (old_file, background); - eel_preferences_remove_callback (CAJA_PREFERENCES_THEME, - caja_file_background_theme_changed, - background); - eel_preferences_remove_callback (CAJA_PREFERENCES_BACKGROUND_SET, - caja_file_background_theme_changed, - background); - eel_preferences_remove_callback (CAJA_PREFERENCES_BACKGROUND_COLOR, - caja_file_background_theme_changed, - background); - eel_preferences_remove_callback (CAJA_PREFERENCES_BACKGROUND_FILENAME, - caja_file_background_theme_changed, - background); + g_signal_handlers_disconnect_by_func (caja_preferences, + caja_file_background_theme_changed, + background); } @@ -716,14 +709,18 @@ caja_connect_background_to_file_metadata (GtkWidget *widget, CAJA_FILE_ATTRIBUTE_INFO); /* arrange for notification when the theme changes */ - eel_preferences_add_callback (CAJA_PREFERENCES_THEME, - caja_file_background_theme_changed, background); - eel_preferences_add_callback (CAJA_PREFERENCES_BACKGROUND_SET, - caja_file_background_theme_changed, background); - eel_preferences_add_callback (CAJA_PREFERENCES_BACKGROUND_COLOR, - caja_file_background_theme_changed, background); - eel_preferences_add_callback (CAJA_PREFERENCES_BACKGROUND_FILENAME, - caja_file_background_theme_changed, background); + g_signal_connect (caja_preferences, + "changed::" CAJA_PREFERENCES_BACKGROUND_SET, + G_CALLBACK(caja_file_background_theme_changed), + background); + g_signal_connect (caja_preferences, + "changed::" CAJA_PREFERENCES_BACKGROUND_COLOR, + G_CALLBACK(caja_file_background_theme_changed), + background); + g_signal_connect (caja_preferences, + "changed::" CAJA_PREFERENCES_BACKGROUND_URI, + G_CALLBACK(caja_file_background_theme_changed), + background); } /* Update the background based on the file metadata. */ diff --git a/libcaja-private/caja-directory-private.h b/libcaja-private/caja-directory-private.h index e5c2d201..8f34d553 100644 --- a/libcaja-private/caja-directory-private.h +++ b/libcaja-private/caja-directory-private.h @@ -166,7 +166,6 @@ void caja_directory_monitor_add_internal (CajaDirectory CajaFile *file, gconstpointer client, gboolean monitor_hidden_files, - gboolean monitor_backup_files, CajaFileAttributes attributes, CajaDirectoryCallback callback, gpointer callback_data); diff --git a/libcaja-private/caja-directory.c b/libcaja-private/caja-directory.c index fb047567..a3bc7fc0 100644 --- a/libcaja-private/caja-directory.c +++ b/libcaja-private/caja-directory.c @@ -327,12 +327,10 @@ add_preferences_callbacks (void) { caja_global_preferences_init (); - eel_preferences_add_callback (CAJA_PREFERENCES_SHOW_HIDDEN_FILES, - filtering_changed_callback, - NULL); - eel_preferences_add_callback (CAJA_PREFERENCES_SHOW_BACKUP_FILES, - filtering_changed_callback, - NULL); + g_signal_connect_swapped (caja_preferences, + "changed::" CAJA_PREFERENCES_SHOW_HIDDEN_FILES, + G_CALLBACK(filtering_changed_callback), + NULL); eel_preferences_add_callback (CAJA_PREFERENCES_SHOW_TEXT_IN_ICONS, async_data_preference_changed_callback, NULL); @@ -1659,7 +1657,6 @@ void caja_directory_file_monitor_add (CajaDirectory *directory, gconstpointer client, gboolean monitor_hidden_files, - gboolean monitor_backup_files, CajaFileAttributes file_attributes, CajaDirectoryCallback callback, gpointer callback_data) @@ -1671,7 +1668,6 @@ caja_directory_file_monitor_add (CajaDirectory *directory, (CAJA_DIRECTORY_CLASS, directory, file_monitor_add, (directory, client, monitor_hidden_files, - monitor_backup_files, file_attributes, callback, callback_data)); } @@ -1926,7 +1922,7 @@ caja_self_check_directory (void) caja_directory_file_monitor_add (directory, &data_dummy, - TRUE, TRUE, 0, NULL, NULL); + TRUE, 0, NULL, NULL); /* FIXME: these need to be updated to the new metadata infrastructure * as make check doesn't pass. diff --git a/libcaja-private/caja-directory.h b/libcaja-private/caja-directory.h index 5beda869..7dfff85b 100644 --- a/libcaja-private/caja-directory.h +++ b/libcaja-private/caja-directory.h @@ -118,7 +118,6 @@ typedef struct void (* file_monitor_add) (CajaDirectory *directory, gconstpointer client, gboolean monitor_hidden_files, - gboolean monitor_backup_files, CajaFileAttributes monitor_attributes, CajaDirectoryCallback initial_files_callback, gpointer callback_data); @@ -195,7 +194,6 @@ void caja_directory_cancel_callback (CajaDirectory void caja_directory_file_monitor_add (CajaDirectory *directory, gconstpointer client, gboolean monitor_hidden_files, - gboolean monitor_backup_files, CajaFileAttributes attributes, CajaDirectoryCallback initial_files_callback, gpointer callback_data); diff --git a/libcaja-private/caja-file-operations.c b/libcaja-private/caja-file-operations.c index 6fc9ba8c..f89e00cc 100644 --- a/libcaja-private/caja-file-operations.c +++ b/libcaja-private/caja-file-operations.c @@ -70,8 +70,6 @@ #include "caja-file-conflict-dialog.h" #include "caja-undostack-manager.h" -static gboolean confirm_trash_auto_value; - /* TODO: TESTING!!! */ typedef struct { @@ -1018,17 +1016,6 @@ should_skip_readdir_error (CommonJob *common, return FALSE; } -static void -setup_autos (void) -{ - static gboolean setup_autos = FALSE; - if (!setup_autos) { - setup_autos = TRUE; - eel_preferences_add_auto_boolean (CAJA_PREFERENCES_CONFIRM_TRASH, - &confirm_trash_auto_value); - } -} - static gboolean can_delete_without_confirm (GFile *file) { @@ -1285,6 +1272,19 @@ abort_job (CommonJob *job) } +/* Since this happens on a thread we can't use the global prefs object */ +static gboolean +should_confirm_trash (void) +{ + GSettings *prefs; + gboolean confirm_trash; + + prefs = g_settings_new ("org.mate.caja.preferences"); + confirm_trash = g_settings_get_boolean (prefs, CAJA_PREFERENCES_CONFIRM_TRASH); + g_object_unref (prefs); + return confirm_trash; +} + static gboolean job_aborted (CommonJob *job) { @@ -1300,7 +1300,7 @@ confirm_delete_from_trash (CommonJob *job, int response; /* Just Say Yes if the preference says not to confirm. */ - if (!confirm_trash_auto_value) { + if (!should_confirm_trash ()) { return TRUE; } @@ -1337,7 +1337,7 @@ confirm_empty_trash (CommonJob *job) int response; /* Just Say Yes if the preference says not to confirm. */ - if (!confirm_trash_auto_value) { + if (!should_confirm_trash ()) { return TRUE; } @@ -1363,7 +1363,7 @@ confirm_delete_directly (CommonJob *job, int response; /* Just Say Yes if the preference says not to confirm. */ - if (!confirm_trash_auto_value) { + if (!should_confirm_trash ()) { return TRUE; } @@ -1964,8 +1964,6 @@ trash_or_delete_internal (GList *files, { DeleteJob *job; - setup_autos (); - /* TODO: special case desktop icon link files ... */ job = op_job_new (DeleteJob, parent_window); @@ -6310,8 +6308,6 @@ caja_file_operations_empty_trash (GtkWidget *parent_view) parent_window = (GtkWindow *)gtk_widget_get_ancestor (parent_view, GTK_TYPE_WINDOW); } - setup_autos (); - job = op_job_new (EmptyTrashJob, parent_window); job->trash_dirs = g_list_prepend (job->trash_dirs, g_file_new_for_uri ("trash:")); diff --git a/libcaja-private/caja-file-private.h b/libcaja-private/caja-file-private.h index 2c0c76c1..7e973e41 100644 --- a/libcaja-private/caja-file-private.h +++ b/libcaja-private/caja-file-private.h @@ -206,7 +206,6 @@ struct CajaFileDetails eel_boolean_bit is_symlink : 1; eel_boolean_bit is_mountpoint : 1; eel_boolean_bit is_hidden : 1; - eel_boolean_bit is_backup : 1; eel_boolean_bit has_permissions : 1; diff --git a/libcaja-private/caja-file-utilities.c b/libcaja-private/caja-file-utilities.c index 0748364a..7b0647a8 100644 --- a/libcaja-private/caja-file-utilities.c +++ b/libcaja-private/caja-file-utilities.c @@ -510,7 +510,7 @@ caja_get_xdg_dir (const char *type) static char * get_desktop_path (void) { - if (eel_preferences_get_boolean (CAJA_PREFERENCES_DESKTOP_IS_HOME_DIR)) + if (g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_DESKTOP_IS_HOME_DIR)) { return g_strdup (g_get_home_dir()); } @@ -535,7 +535,7 @@ caja_get_desktop_directory (void) desktop_directory = get_desktop_path (); /* Don't try to create a home directory */ - if (!eel_preferences_get_boolean (CAJA_PREFERENCES_DESKTOP_IS_HOME_DIR)) + if (!g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_DESKTOP_IS_HOME_DIR)) { if (!g_file_test (desktop_directory, G_FILE_TEST_EXISTS)) { @@ -765,9 +765,9 @@ caja_is_desktop_directory_file (GFile *dir, if (!desktop_dir_changed_callback_installed) { - eel_preferences_add_callback (CAJA_PREFERENCES_DESKTOP_IS_HOME_DIR, - desktop_dir_changed_callback, - NULL); + g_signal_connect_swapped (caja_preferences, "changed::" CAJA_PREFERENCES_DESKTOP_IS_HOME_DIR, + G_CALLBACK(desktop_dir_changed_callback), + NULL); desktop_dir_changed_callback_installed = TRUE; } diff --git a/libcaja-private/caja-file-utilities.h b/libcaja-private/caja-file-utilities.h index 81600ef8..3dd0e1a3 100644 --- a/libcaja-private/caja-file-utilities.h +++ b/libcaja-private/caja-file-utilities.h @@ -31,10 +31,6 @@ #define CAJA_SAVED_SEARCH_EXTENSION ".savedSearch" #define CAJA_SAVED_SEARCH_MIMETYPE "application/x-mate-saved-search" -/* Recognizing special file names. */ -gboolean caja_file_name_matches_hidden_pattern (const char *name_or_relative_uri); -gboolean caja_file_name_matches_backup_pattern (const char *name_or_relative_uri); - /* These functions all return something something that needs to be * freed with g_free, is not NULL, and is guaranteed to exist. */ diff --git a/libcaja-private/caja-file.c b/libcaja-private/caja-file.c index 839940fa..65bbaa38 100644 --- a/libcaja-private/caja-file.c +++ b/libcaja-private/caja-file.c @@ -99,7 +99,6 @@ typedef enum { SHOW_HIDDEN = 1 << 0, - SHOW_BACKUP = 1 << 1 } FilterOptions; typedef void (* ModifyListFunction) (GList **list, CajaFile *file); @@ -444,7 +443,6 @@ caja_file_clear_info (CajaFile *file) file->details->is_trusted_link = FALSE; file->details->is_symlink = FALSE; file->details->is_hidden = FALSE; - file->details->is_backup = FALSE; file->details->is_mountpoint = FALSE; file->details->uid = -1; file->details->gid = -1; @@ -2087,7 +2085,7 @@ update_info_internal (CajaFile *file, { GList *node; gboolean changed; - gboolean is_symlink, is_hidden, is_backup, is_mountpoint; + gboolean is_symlink, is_hidden, is_mountpoint; gboolean has_permissions; guint32 permissions; gboolean can_read, can_write, can_execute, can_delete, can_trash, can_rename, can_mount, can_unmount, can_eject; @@ -2177,18 +2175,12 @@ update_info_internal (CajaFile *file, } file->details->is_symlink = is_symlink; - is_hidden = g_file_info_get_is_hidden (info); + is_hidden = g_file_info_get_is_hidden (info) || g_file_info_get_is_backup (info); if (file->details->is_hidden != is_hidden) { changed = TRUE; } file->details->is_hidden = is_hidden; - is_backup = g_file_info_get_is_backup (info); - if (file->details->is_backup != is_backup) { - changed = TRUE; - } - file->details->is_backup = is_backup; - is_mountpoint = g_file_info_get_attribute_boolean (info, G_FILE_ATTRIBUTE_UNIX_IS_MOUNTPOINT); if (file->details->is_mountpoint != is_mountpoint) { changed = TRUE; @@ -3397,12 +3389,6 @@ caja_file_is_hidden_file (CajaFile *file) return file->details->is_hidden; } -gboolean -caja_file_is_backup_file (CajaFile *file) -{ - return file->details->is_backup; -} - static gboolean is_file_hidden (CajaFile *file) { @@ -3416,7 +3402,6 @@ is_file_hidden (CajaFile *file) * caja_file_should_show: * @file: the file to check. * @show_hidden: whether we want to show hidden files or not. - * @show_backup: whether we want to show backup files or not. * * Determines if a #CajaFile should be shown. Note that when browsing * a trash directory, this function will always return %TRUE. @@ -3426,7 +3411,6 @@ is_file_hidden (CajaFile *file) gboolean caja_file_should_show (CajaFile *file, gboolean show_hidden, - gboolean show_backup, gboolean show_foreign) { /* Never hide any files in trash. */ @@ -3434,7 +3418,6 @@ caja_file_should_show (CajaFile *file, return TRUE; } else { return (show_hidden || (!caja_file_is_hidden_file (file) && !is_file_hidden (file))) && - (show_backup || !caja_file_is_backup_file (file)) && (show_foreign || !(caja_file_is_in_desktop (file) && caja_file_is_foreign_link (file))); } } @@ -3464,7 +3447,7 @@ caja_file_is_in_desktop (CajaFile *file) } static gboolean -filter_hidden_and_backup_partition_callback (gpointer data, +filter_hidden_partition_callback (gpointer data, gpointer callback_data) { CajaFile *file; @@ -3475,14 +3458,12 @@ filter_hidden_and_backup_partition_callback (gpointer data, return caja_file_should_show (file, options & SHOW_HIDDEN, - options & SHOW_BACKUP, TRUE); } GList * -caja_file_list_filter_hidden_and_backup (GList *files, - gboolean show_hidden, - gboolean show_backup) +caja_file_list_filter_hidden (GList *files, + gboolean show_hidden) { GList *filtered_files; GList *removed_files; @@ -3493,9 +3474,8 @@ caja_file_list_filter_hidden_and_backup (GList *files, filtered_files = caja_file_list_copy (files); filtered_files = eel_g_list_partition (filtered_files, - filter_hidden_and_backup_partition_callback, - GINT_TO_POINTER ((show_hidden ? SHOW_HIDDEN : 0) | - (show_backup ? SHOW_BACKUP : 0)), + filter_hidden_partition_callback, + GINT_TO_POINTER ((show_hidden ? SHOW_HIDDEN : 0)), &removed_files); caja_file_list_free (removed_files); diff --git a/libcaja-private/caja-file.h b/libcaja-private/caja-file.h index f1b64643..8c66afe8 100644 --- a/libcaja-private/caja-file.h +++ b/libcaja-private/caja-file.h @@ -425,14 +425,11 @@ int caja_file_compare_location (CajaFile /* filtering functions for use by various directory views */ gboolean caja_file_is_hidden_file (CajaFile *file); -gboolean caja_file_is_backup_file (CajaFile *file); gboolean caja_file_should_show (CajaFile *file, gboolean show_hidden, - gboolean show_backup, gboolean show_foreign); -GList *caja_file_list_filter_hidden_and_backup (GList *files, - gboolean show_hidden, - gboolean show_backup); +GList *caja_file_list_filter_hidden (GList *files, + gboolean show_hidden); /* Get the URI that's used when activating the file. diff --git a/libcaja-private/caja-global-preferences.c b/libcaja-private/caja-global-preferences.c index 3097793f..88e8736a 100644 --- a/libcaja-private/caja-global-preferences.c +++ b/libcaja-private/caja-global-preferences.c @@ -49,7 +49,6 @@ static const char *EXTRA_MONITOR_PATHS[] = { "/desktop/mate/file_views", /* Forward declarations */ static void global_preferences_install_defaults (void); static void global_preferences_register_enumerations (void); -static gpointer default_font_callback (void); static gpointer default_home_link_name (void); static gpointer default_computer_link_name (void); static gpointer default_trash_link_name (void); @@ -261,26 +260,6 @@ static const PreferenceDefault preference_defaults[] = PREFERENCE_BOOLEAN, GINT_TO_POINTER (TRUE) }, - { - CAJA_PREFERENCES_SHOW_HIDDEN_FILES, - PREFERENCE_BOOLEAN, - GINT_TO_POINTER (FALSE) - }, - { - CAJA_PREFERENCES_SHOW_BACKUP_FILES, - PREFERENCE_BOOLEAN, - GINT_TO_POINTER (FALSE) - }, - { - CAJA_PREFERENCES_CONFIRM_TRASH, - PREFERENCE_BOOLEAN, - GINT_TO_POINTER (TRUE) - }, - { - CAJA_PREFERENCES_ENABLE_DELETE, - PREFERENCE_BOOLEAN, - GINT_TO_POINTER (FALSE) - }, { CAJA_PREFERENCES_SHOW_TEXT_IN_ICONS, PREFERENCE_STRING, @@ -319,11 +298,6 @@ static const PreferenceDefault preference_defaults[] = PREFERENCE_BOOLEAN, GINT_TO_POINTER (TRUE) }, - { - CAJA_PREFERENCES_THEME, - PREFERENCE_STRING, - "default" - }, { CAJA_PREFERENCES_SHOW_IMAGE_FILE_THUMBNAILS, PREFERENCE_STRING, @@ -355,16 +329,6 @@ static const PreferenceDefault preference_defaults[] = PREFERENCE_BOOLEAN, GINT_TO_POINTER (FALSE) }, - { - CAJA_PREFERENCES_SHOW_DESKTOP, - PREFERENCE_BOOLEAN, - GINT_TO_POINTER (TRUE) - }, - { - CAJA_PREFERENCES_DESKTOP_IS_HOME_DIR, - PREFERENCE_BOOLEAN, - GINT_TO_POINTER (FALSE) - }, { CAJA_PREFERENCES_SEARCH_BAR_TYPE, PREFERENCE_STRING, @@ -379,11 +343,6 @@ static const PreferenceDefault preference_defaults[] = NULL, NULL, NULL }, - { - CAJA_PREFERENCES_SIDEBAR_WIDTH, - PREFERENCE_INTEGER, - GINT_TO_POINTER (148) - }, { CAJA_PREFERENCES_ALWAYS_USE_BROWSER, PREFERENCE_BOOLEAN, @@ -450,11 +409,6 @@ static const PreferenceDefault preference_defaults[] = NULL, NULL, "default_folder_viewer" }, - { - CAJA_PREFERENCES_DESKTOP_FONT, - PREFERENCE_STRING, - NULL, default_font_callback, g_free - }, /* Icon View Default Preferences */ { @@ -594,36 +548,6 @@ static const PreferenceDefault preference_defaults[] = default_network_link_name, g_free, }, - { - CAJA_PREFERENCES_MEDIA_AUTOMOUNT, - PREFERENCE_BOOLEAN, - GINT_TO_POINTER (TRUE) - }, - { - CAJA_PREFERENCES_MEDIA_AUTOMOUNT_OPEN, - PREFERENCE_BOOLEAN, - GINT_TO_POINTER (TRUE) - }, - { - CAJA_PREFERENCES_MEDIA_AUTORUN_NEVER, - PREFERENCE_BOOLEAN, - GINT_TO_POINTER (FALSE) - }, - { - CAJA_PREFERENCES_MEDIA_AUTORUN_X_CONTENT_START_APP, - PREFERENCE_STRING_ARRAY, - "", NULL, NULL, NULL - }, - { - CAJA_PREFERENCES_MEDIA_AUTORUN_X_CONTENT_IGNORE, - PREFERENCE_STRING_ARRAY, - "", NULL, NULL, NULL - }, - { - CAJA_PREFERENCES_MEDIA_AUTORUN_X_CONTENT_OPEN_FOLDER, - PREFERENCE_STRING_ARRAY, - "", NULL, NULL, NULL - }, { CAJA_PREFERENCES_DESKTOP_TEXT_ELLIPSIS_LIMIT, PREFERENCE_INTEGER, @@ -838,12 +762,6 @@ global_preferences_install_defaults (void) } } -static gpointer -default_font_callback (void) -{ - return g_strdup ("sans 12"); -} - /* * Public functions */ @@ -928,6 +846,9 @@ caja_global_preferences_init (void) { eel_preferences_monitor_directory (EXTRA_MONITOR_PATHS[i]); } + + caja_preferences = g_settings_new("org.mate.caja.preferences"); + caja_media_preferences = g_settings_new("org.mate.media-handling"); /* Set up storage for values accessed in this file */ eel_preferences_add_callback (CAJA_PREFERENCES_ICON_VIEW_DEFAULT_SORT_ORDER_OR_MANUAL_LAYOUT, diff --git a/libcaja-private/caja-global-preferences.h b/libcaja-private/caja-global-preferences.h index 534f36a3..05dd797a 100644 --- a/libcaja-private/caja-global-preferences.h +++ b/libcaja-private/caja-global-preferences.h @@ -27,52 +27,47 @@ #define CAJA_GLOBAL_PREFERENCES_H #include +#include -#ifdef __cplusplus -extern "C" { -#endif +G_BEGIN_DECLS /* Whether exit when last window destroyed */ #define CAJA_PREFERENCES_EXIT_WITH_LAST_WINDOW "preferences/exit_with_last_window" - /* Which theme is active */ -#define CAJA_PREFERENCES_THEME "/desktop/mate/file_views/icon_theme" - /* Desktop Background options */ -#define CAJA_PREFERENCES_BACKGROUND_SET "preferences/background_set" -#define CAJA_PREFERENCES_BACKGROUND_COLOR "preferences/background_color" -#define CAJA_PREFERENCES_BACKGROUND_FILENAME "preferences/background_filename" +#define CAJA_PREFERENCES_BACKGROUND_SET "background-set" +#define CAJA_PREFERENCES_BACKGROUND_COLOR "background-color" +#define CAJA_PREFERENCES_BACKGROUND_URI "background-uri" /* Side Pane Background options */ -#define CAJA_PREFERENCES_SIDE_PANE_BACKGROUND_SET "preferences/side_pane_background_set" -#define CAJA_PREFERENCES_SIDE_PANE_BACKGROUND_COLOR "preferences/side_pane_background_color" -#define CAJA_PREFERENCES_SIDE_PANE_BACKGROUND_FILENAME "preferences/side_pane_background_filename" +#define CAJA_PREFERENCES_SIDE_PANE_BACKGROUND_SET "side-pane-background-set" +#define CAJA_PREFERENCES_SIDE_PANE_BACKGROUND_COLOR "side-pane-background-color" +#define CAJA_PREFERENCES_SIDE_PANE_BACKGROUND_URI "side-pane-background-uri" /* How wide the sidebar is (or how wide it will be when expanded) */ -#define CAJA_PREFERENCES_SIDEBAR_WIDTH "preferences/sidebar_width" +#define CAJA_PREFERENCES_SIDEBAR_WIDTH "sidebar-width" /* Automount options */ -#define CAJA_PREFERENCES_MEDIA_AUTOMOUNT "preferences/media_automount" -#define CAJA_PREFERENCES_MEDIA_AUTOMOUNT_OPEN "preferences/media_automount_open" +#define CAJA_PREFERENCES_MEDIA_AUTOMOUNT "media-automount" +#define CAJA_PREFERENCES_MEDIA_AUTOMOUNT_OPEN "media-automount-open" /* Autorun options */ -#define CAJA_PREFERENCES_MEDIA_AUTORUN_NEVER "preferences/media_autorun_never" -#define CAJA_PREFERENCES_MEDIA_AUTORUN_X_CONTENT_START_APP "preferences/media_autorun_x_content_start_app" -#define CAJA_PREFERENCES_MEDIA_AUTORUN_X_CONTENT_IGNORE "preferences/media_autorun_x_content_ignore" -#define CAJA_PREFERENCES_MEDIA_AUTORUN_X_CONTENT_OPEN_FOLDER "preferences/media_autorun_x_content_open_folder" +#define CAJA_PREFERENCES_MEDIA_AUTORUN_NEVER "media-autorun-never" +#define CAJA_PREFERENCES_MEDIA_AUTORUN_X_CONTENT_START_APP "media-autorun-x-content-start-app" +#define CAJA_PREFERENCES_MEDIA_AUTORUN_X_CONTENT_IGNORE "media-autorun-x-content-ignore" +#define CAJA_PREFERENCES_MEDIA_AUTORUN_X_CONTENT_OPEN_FOLDER "media-autorun-x-content-open-folder" /* Trash options */ -#define CAJA_PREFERENCES_CONFIRM_TRASH "preferences/confirm_trash" -#define CAJA_PREFERENCES_ENABLE_DELETE "preferences/enable_delete" +#define CAJA_PREFERENCES_CONFIRM_TRASH "confirm-trash" +#define CAJA_PREFERENCES_ENABLE_DELETE "enable-delete" /* Desktop options */ -#define CAJA_PREFERENCES_SHOW_DESKTOP "preferences/show_desktop" -#define CAJA_PREFERENCES_DESKTOP_IS_HOME_DIR "preferences/desktop_is_home_dir" -#define CAJA_PREFERENCES_DESKTOP_FONT "preferences/desktop_font" +#define CAJA_PREFERENCES_SHOW_DESKTOP "show-desktop" +#define CAJA_PREFERENCES_DESKTOP_IS_HOME_DIR "desktop-is-home-dir" +#define CAJA_PREFERENCES_DESKTOP_FONT "desktop-font" /* Display */ -#define CAJA_PREFERENCES_SHOW_HIDDEN_FILES "/desktop/mate/file_views/show_hidden_files" -#define CAJA_PREFERENCES_SHOW_BACKUP_FILES "/desktop/mate/file_views/show_backup_files" +#define CAJA_PREFERENCES_SHOW_HIDDEN_FILES "show-hidden-files" #define CAJA_PREFERENCES_SHOW_ADVANCED_PERMISSIONS "preferences/show_advanced_permissions" #define CAJA_PREFERENCES_DATE_FORMAT "preferences/date_format" @@ -233,10 +228,12 @@ extern "C" { /* Lockdown */ #define CAJA_PREFERENCES_LOCKDOWN_COMMAND_LINE "/desktop/mate/lockdown/disable_command_line" - void caja_global_preferences_init (void); - char *caja_global_preferences_get_default_folder_viewer_preference_as_iid (void); -#ifdef __cplusplus -} -#endif +void caja_global_preferences_init (void); +char *caja_global_preferences_get_default_folder_viewer_preference_as_iid (void); + +GSettings *caja_preferences; +GSettings *caja_media_preferences; + +G_END_DECLS #endif /* CAJA_GLOBAL_PREFERENCES_H */ diff --git a/libcaja-private/caja-icon-container.c b/libcaja-private/caja-icon-container.c index df56d0f1..39aab446 100644 --- a/libcaja-private/caja-icon-container.c +++ b/libcaja-private/caja-icon-container.c @@ -4452,10 +4452,6 @@ finalize (GObject *object) details = CAJA_ICON_CONTAINER (object)->details; - eel_preferences_remove_callback (CAJA_PREFERENCES_THEME, - caja_icon_container_theme_changed, - object); - g_hash_table_destroy (details->icon_set); details->icon_set = NULL; @@ -6891,9 +6887,6 @@ caja_icon_container_init (CajaIconContainer *container) /* read in theme-dependent data */ caja_icon_container_theme_changed (container); - eel_preferences_add_callback (CAJA_PREFERENCES_THEME, - caja_icon_container_theme_changed, - container); if (!setup_prefs) { diff --git a/libcaja-private/caja-merged-directory.c b/libcaja-private/caja-merged-directory.c index f3d4cf01..0dc1b10c 100644 --- a/libcaja-private/caja-merged-directory.c +++ b/libcaja-private/caja-merged-directory.c @@ -59,7 +59,6 @@ typedef struct CajaMergedDirectory *merged; gboolean monitor_hidden_files; - gboolean monitor_backup_files; CajaFileAttributes monitor_attributes; } MergedMonitor; @@ -268,7 +267,6 @@ static void merged_monitor_add (CajaDirectory *directory, gconstpointer client, gboolean monitor_hidden_files, - gboolean monitor_backup_files, CajaFileAttributes file_attributes, CajaDirectoryCallback callback, gpointer callback_data) @@ -296,7 +294,6 @@ merged_monitor_add (CajaDirectory *directory, (gpointer) client, monitor); } monitor->monitor_hidden_files = monitor_hidden_files; - monitor->monitor_backup_files = monitor_backup_files; monitor->monitor_attributes = file_attributes; /* Call through to the real directory add calls. */ @@ -305,7 +302,7 @@ merged_monitor_add (CajaDirectory *directory, { caja_directory_file_monitor_add (node->data, monitor, - monitor_hidden_files, monitor_backup_files, + monitor_hidden_files, file_attributes, build_merged_callback_list, &merged_callback_list); } @@ -488,7 +485,6 @@ monitor_add_directory (gpointer key, caja_directory_file_monitor_add (CAJA_DIRECTORY (callback_data), monitor, monitor->monitor_hidden_files, - monitor->monitor_backup_files, monitor->monitor_attributes, forward_files_added_cover, monitor->merged); } diff --git a/libcaja-private/caja-search-directory.c b/libcaja-private/caja-search-directory.c index 56cc4bec..ff010881 100644 --- a/libcaja-private/caja-search-directory.c +++ b/libcaja-private/caja-search-directory.c @@ -57,7 +57,6 @@ struct CajaSearchDirectoryDetails typedef struct { gboolean monitor_hidden_files; - gboolean monitor_backup_files; CajaFileAttributes monitor_attributes; gconstpointer client; @@ -181,7 +180,6 @@ static void search_monitor_add (CajaDirectory *directory, gconstpointer client, gboolean monitor_hidden_files, - gboolean monitor_backup_files, CajaFileAttributes file_attributes, CajaDirectoryCallback callback, gpointer callback_data) @@ -195,7 +193,6 @@ search_monitor_add (CajaDirectory *directory, monitor = g_new0 (SearchMonitor, 1); monitor->monitor_hidden_files = monitor_hidden_files; - monitor->monitor_backup_files = monitor_backup_files; monitor->monitor_attributes = file_attributes; monitor->client = client; diff --git a/libcaja-private/caja-vfs-directory.c b/libcaja-private/caja-vfs-directory.c index 9915889a..2475909e 100644 --- a/libcaja-private/caja-vfs-directory.c +++ b/libcaja-private/caja-vfs-directory.c @@ -94,7 +94,6 @@ static void vfs_file_monitor_add (CajaDirectory *directory, gconstpointer client, gboolean monitor_hidden_files, - gboolean monitor_backup_files, CajaFileAttributes file_attributes, CajaDirectoryCallback callback, gpointer callback_data) @@ -106,7 +105,6 @@ vfs_file_monitor_add (CajaDirectory *directory, (directory, NULL, client, monitor_hidden_files, - monitor_backup_files, file_attributes, callback, callback_data); } diff --git a/libcaja-private/caja-vfs-file.c b/libcaja-private/caja-vfs-file.c index 5959dfe8..0dec6da0 100644 --- a/libcaja-private/caja-vfs-file.c +++ b/libcaja-private/caja-vfs-file.c @@ -48,7 +48,7 @@ vfs_file_monitor_add (CajaFile *file, { caja_directory_monitor_add_internal (file->details->directory, file, - client, TRUE, TRUE, attributes, NULL, NULL); + client, TRUE, attributes, NULL, NULL); } static void diff --git a/libcaja-private/org.mate.caja.gschema.xml.in b/libcaja-private/org.mate.caja.gschema.xml.in new file mode 100644 index 00000000..35df20ec --- /dev/null +++ b/libcaja-private/org.mate.caja.gschema.xml.in @@ -0,0 +1,491 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 'after-current-tab' + <_summary>Where to position newly open tabs in browser windows. + <_description>If set to "after-current-tab", then new tabs are inserted after the current tab. If set to "end", then new tabs are appended to the end of the tab list. + + + false + <_summary>Caja will exit when last window destroyed. + <_description>If set to true, then Caja will exit when all windows are destroyed. This is the default setting. If set to false, it can be started without any window, so caja can serve as a daemon to monitor media automount, or similar tasks. + + + true + <_summary>Enables the classic Caja behavior, where all windows are browsers + <_description>If set to true, then all Caja windows will be browser windows. This is how Caja used to behave before version 2.6, and some people prefer this behavior. + + + false + <_summary>Always use the location entry, instead of the pathbar + <_description>If set to true, then Caja browser windows will always use a textual input entry for the location toolbar, instead of the pathbar. + + + true + <_summary>Whether to ask for confirmation when deleting files, or emptying Trash + <_description>If set to true, then Caja will ask for confirmation when you attempt to delete files, or empty the Trash. + + + false + <_summary>Whether to enable immediate deletion + <_description>If set to true, then Caja will have a feature allowing you to delete a file immediately and in-place, instead of moving it to the trash. This feature can be dangerous, so use caution. + + + + 'local-only' + <_summary>When to show preview text in icons + <_description>Speed tradeoff for when to show a preview of text file contents in the file's icon. If set to "always" then always show previews, even if the folder is on a remote server. If set to "local-only" then only show previews for local file systems. If set to "never" then never bother to read preview data. + + + + 'local-only' + <_summary>When to show number of items in a folder + <_description>Speed tradeoff for when to show the number of items in a folder. If set to "always" then always show item counts, even if the folder is on a remote server. If set to "local-only" then only show counts for local file systems. If set to "never" then never bother to compute item counts. + + + 'double' + <_summary>Type of click used to launch/open files + <_description>Possible values are "single" to launch files on a single click, or "double" to launch them on a double click. + + + 'ask' + <_summary>What to do with executable text files when activated + <_description>What to do with executable text files when they are activated (single or double clicked). Possible values are "launch" to launch them as programs, "ask" to ask what to do via a dialog, and "display" to display them as text files. + + + true + <_summary>Show the package installer for unknown mime types + <_description>Whether to show the user a package installer dialog in case an unknown mime type is opened, in order to search for an application to handle it. + + + true + <_summary>Use extra mouse button events in Caja' browser window + <_description>For users with mice that have "Forward" and "Back" buttons, this key will determine if any action is taken inside of Caja when either is pressed. + + + 9 + <_summary>Mouse button to activate the "Forward" command in browser window + <_description>For users with mice that have buttons for "Forward" and "Back", this key will set which button activates the "Forward" command in a browser window. Possible values range between 6 and 14. + + + 8 + <_summary>Mouse button to activate the "Back" command in browser window + <_description>For users with mice that have buttons for "Forward" and "Back", this key will set which button activates the "Back" command in a browser window. Possible values range between 6 and 14. + + + + 'local-only' + <_summary>When to show thumbnails of image files + <_description>Speed tradeoff for when to show an image file as a thumbnail. If set to "always" then always thumbnail, even if the folder is on a remote server. If set to "local-only" then only show thumbnails for local file systems. If set to "never" then never bother to thumbnail images, just use a generic icon. + + + 10485760 + <_summary>Maximum image size for thumbnailing + <_description>Images over this size (in bytes) won't be thumbnailed. The purpose of this setting is to avoid thumbnailing large images that may take a long time to load or use lots of memory. + + + + 'local-only' + <_summary>Whether to preview sounds when mousing over an icon + <_description>Speed tradeoff for when to preview a sound file when mousing over a files icon. If set to "always" then always plays the sound, even if the file is on a remote server. If set to "local-only" then only plays previews on local file systems. If set to "never" then it never previews sound. + + + false + <_summary>Show advanced permissions in the file property dialog + <_description>If set to true, then Caja lets you edit and display file permissions in a more unix-like way, accessing some more esoteric options. + + + true + <_summary>Show folders first in windows + <_description>If set to true, then Caja shows folders prior to showing files in the icon and list views. + + + true + <_summary>Caja handles drawing the desktop + <_description>If set to true, then Caja will draw the icons on the desktop. + + + '' + <_summary>Desktop font + <_description>The font _description used for the icons on the desktop. + + + false + <_summary>Caja uses the users home folder as the desktop + <_description>If set to true, then Caja will use the user's home folder as the desktop. If it is false, then it will use ~/Desktop as the desktop. + + + false + <_summary>Custom Background + <_description>Whether a custom default folder background has been set. + + + '#ffffff' + <_summary>Default Background Color + <_description>Color for the default folder background. Only used if background_set is true. + + + '' + <_summary>Default Background Filename + <_description>Uri of the default folder background. Only used if background_set is true. + + + false + <_summary>Custom Side Pane Background Set + <_description>Whether a custom default side pane background has been set. + + + '#ffffff' + <_summary>Default Side Pane Background Color + <_description>Filename for the default side pane background. Only used if side_pane_background_set is true. + + + "" + <_summary>Default Side Pane Background Filename + <_description>Uri of the default side pane background. Only used if side_pane_background_set is true. + + + + + + + + 'icon-view' + <_summary>Default folder viewer + <_description>When a folder is visited this viewer is used unless you have selected another view for that particular folder. Possible values are "list-view", "icon-view" and "compact-view". + + + 'locale' + <_summary>Date Format + <_description>The format of file dates. Possible values are "locale", "iso", and "informal". + + + false + <_summary>Whether to show hidden files + <_description>If set to true, then hidden files are shown by default in the file manager. Hidden files are either dotfiles, listed in the folder's .hidden file or backup files ending with a tilde (~). + + + + + + [ 'none', 'size', 'date_modified' ] + <_summary>List of possible captions on icons + <_description>A list of captions below an icon in the icon view and + the desktop. The actual number of captions shown depends on + the zoom level. Some possible values are: + "size", "type", "date_modified", "date_changed", "date_accessed", "owner", + "group", "permissions", "octal_permissions" and "mime_type". + + + + + + 'name' + <_summary>Default sort order + <_description>The default sort-order for items in the icon view. Possible values are "name", "size", "type", "mtime", and "emblems". + + + false + <_summary>Reverse sort order in new windows + <_description>If true, files in new windows will be sorted in reverse order. ie, if sorted by name, then instead of sorting the files from "a" to "z", they will be sorted from "z" to "a"; if sorted by size, instead of being incrementally they will be sorted decrementally. + + + false + <_summary>Use tighter layout in new windows + <_description>If true, icons will be laid out tighter by default in new windows. + + + false + <_summary>Put labels beside icons + <_description>If true, labels will be placed beside icons rather than underneath them. + + + false + <_summary>Use manual layout in new windows + <_description>If true, new windows will use manual layout by default. + + + 'standard' + <_summary>Default icon zoom level + <_description>Default zoom level used by the icon view. + + + 64 + <_summary>Default Thumbnail Icon Size + <_description>The default size of an icon for a thumbnail in the icon view. + + + [ '3' ] + <_summary>Text Ellipsis Limit + <_description>A string specifying how parts of overlong file names + should be replaced by ellipses, depending on the zoom + level. + Each of the list entries is of the form "Zoom Level:Integer". + For each specified zoom level, if the given integer is + larger than 0, the file name will not exceed the given number of lines. + If the integer is 0 or smaller, no limit is imposed on the specified zoom level. + A default entry of the form "Integer" without any specified zoom level + is also allowed. It defines the maximum number of lines for all other zoom levels. + Examples: + 0 - always display overlong file names; + 3 - shorten file names if they exceed three lines; + smallest:5,smaller:4,0 - shorten file names if they exceed five lines + for zoom level "smallest". Shorten file names if they exceed four lines + for zoom level "smaller". Do not shorten file names for other zoom levels. + + Available zoom levels: + smallest (33%), smaller (50%), small (66%), standard (100%), large (150%), + larger (200%), largest (400%) + + + + + + 'standard' + <_summary>Default compact view zoom level + <_description>Default zoom level used by the compact view. + + + true + <_summary>All columns have same width + <_description>If this preference is set, all columns in the compact view have the same width. Otherwise, the width of each column is determined seperately. + + + + + + + + + 'name' + <_summary>Default sort order + <_description>The default sort-order for the items in the list view. Possible values are "name", "size", "type", and "mtime". + + + false + <_summary>Reverse sort order in new windows + <_description>If true, files in new windows will be sorted in reverse order. ie, if sorted by name, then instead of sorting the files from "a" to "z", they will be sorted from "z" to "a". + + + 'smaller' + <_summary>Default list zoom level + <_description>Default zoom level used by the list view. + + + [ 'name', 'size', 'type', 'date_modified' ] + <_summary>Default list of columns visible in the list view + <_description>Default list of columns visible in the list view. + + + [ 'name', 'size', 'type', 'date_modified' ] + <_summary>Default column order in the list view + <_description>Default column order in the list view. + + + + + + + + + + true + <_summary>Only show folders in the tree side pane + <_description>If set to true, Caja will only show folders in the tree side pane. Otherwise it will show both folders and files. + + + + + + true + <_summary>Home icon visible on desktop + <_description>If this is set to true, an icon linking to the home folder will be put on the desktop. + + + true + <_summary>Computer icon visible on desktop + <_description>If this is set to true, an icon linking to the computer location will be put on the desktop. + + + true + <_summary>Trash icon visible on desktop + <_description>If this is set to true, an icon linking to the trash will be put on the desktop. + + + true + <_summary>Show mounted volumes on the desktop + <_description>If this is set to true, icons linking to mounted volumes will be put on the desktop. + + + false + <_summary>Network Servers icon visible on the desktop + <_description>If this is set to true, an icon linking to the Network Servers view will be put on the desktop. + + + '' + <_summary>Desktop computer icon name + <_description>This name can be set if you want a custom name for the computer icon on the desktop. + + + '' + <_summary>Desktop home icon name + <_description>This name can be set if you want a custom name for the home icon on the desktop. + + + '' + <_summary>Desktop trash icon name + <_description>This name can be set if you want a custom name for the trash icon on the desktop. + + + '' + <_summary>Network servers icon name + <_description>This name can be set if you want a custom name for the network servers icon on the desktop. + + + 3 + <_summary>Text Ellipsis Limit + <_description>An integer specifying how parts of overlong file names should be replaced by ellipses on the desktop. If the number is larger than 0, the file name will not exceed the given number of lines. If the number is 0 or smaller, no limit is imposed on the number of displayed lines. + + + + + + false + <_summary>Whether to show hidden files + <_description>If set to true, then hidden files are shown in the file manager. Hidden files are either dotfiles or are listed in the folder's .hidden file. + + + false + <_summary>Whether to show backup files + <_description>If set to true, then backup files such as those created by Emacs are displayed. Currently, only files ending in a tilde (~) are considered backup files. + + + + + + '' + <_summary>The geometry string for a navigation window. + <_description>A string containing the saved geometry and coordinates string for navigation windows. + + + false + <_summary>Whether the navigation window should be maximized. + <_description>Whether the navigation window should be maximized by default. + + + 148 + <_summary>Width of the side pane + <_description>The default width of the side pane in new windows. + + + true + <_summary>Show toolbar in new windows + <_description>If set to true, newly opened windows will have toolbars visible. + + + true + <_summary>Show location bar in new windows + <_description>If set to true, newly opened windows will have the location bar visible. + + + true + <_summary>Show status bar in new windows + <_description>If set to true, newly opened windows will have the status bar visible. + + + true + <_summary>Show side pane in new windows + <_description>If set to true, newly opened windows will have the side pane visible. + + + + + + + + + + + + + + + + + + + 'places' + <_summary>Side pane view + <_description>The side pane view to show in newly opened windows. + + + diff --git a/libcaja-private/org.mate.media-handling.gschema.xml.in b/libcaja-private/org.mate.media-handling.gschema.xml.in new file mode 100644 index 00000000..5482bc9a --- /dev/null +++ b/libcaja-private/org.mate.media-handling.gschema.xml.in @@ -0,0 +1,34 @@ + + + + true + <_summary>Whether to automatically mount media + <_description>If set to true, then Caja will automatically mount media such as user-visible hard disks and removable media on start-up and media insertion. + + + true + <_summary>Whether to automatically open a folder for automounted media + <_description>If set to true, then Caja will automatically open a folder when media is automounted. This only applies to media where no known x-content/* type was detected; for media where a known x-content type is detected, the user configurable action will be taken instead. + + + false + <_summary>Never prompt or autorun/autostart programs when media are inserted + <_description>If set to true, then Caja will never prompt nor autorun/autostart programs when a medium is inserted. + + + [ 'x-content/software' ] + <_summary>List of x-content/* types where the preferred application will be launched + <_description>List of x-content/* types for which the user have chosen to start an application in the preference capplet. The preferred application for the given type will be started on insertion on media matching these types. + + + [] + <_summary>List of x-content/* types set to "Do Nothing" + <_description>List of x-content/* types for which the user have chosen "Do Nothing" in the preference capplet. No prompt will be shown nor will any matching application be started on insertion of media matching these types. + + + [] + <_summary>List of x-content/* types set to "Open Folder" + <_description>List of x-content/* types for which the user have chosen "Open Folder" in the preferences capplet. A folder window will be opened on insertion of media matching these types. + + + diff --git a/src/caja-application.c b/src/caja-application.c index 50c28a25..54023ec9 100644 --- a/src/caja-application.c +++ b/src/caja-application.c @@ -234,7 +234,7 @@ automount_all_volumes (CajaApplication *application) GMount *mount; GVolume *volume; - if (eel_preferences_get_boolean (CAJA_PREFERENCES_MEDIA_AUTOMOUNT)) + if (g_settings_get_boolean (caja_media_preferences, CAJA_PREFERENCES_MEDIA_AUTOMOUNT)) { /* automount all mountable volumes at start-up */ volumes = g_volume_monitor_get_volumes (application->volume_monitor); @@ -974,7 +974,7 @@ caja_application_startup (CajaApplication *application, char *accel_map_filename; if (!no_desktop && - !eel_preferences_get_boolean (CAJA_PREFERENCES_SHOW_DESKTOP)) + !g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_SHOW_DESKTOP)) { no_desktop = TRUE; } @@ -999,18 +999,15 @@ caja_application_startup (CajaApplication *application, } /* Monitor the preference to show or hide the desktop */ - eel_preferences_add_callback_while_alive (CAJA_PREFERENCES_SHOW_DESKTOP, - desktop_changed_callback, - application, - G_OBJECT (application)); + g_signal_connect_swapped (caja_preferences, "changed::" CAJA_PREFERENCES_SHOW_DESKTOP, + G_CALLBACK(desktop_changed_callback), + G_OBJECT (application)); /* Monitor the preference to have the desktop */ /* point to the Unix home folder */ - eel_preferences_add_callback_while_alive (CAJA_PREFERENCES_DESKTOP_IS_HOME_DIR, - desktop_location_changed_callback, - NULL, - G_OBJECT (application)); - + g_signal_connect_swapped (caja_preferences, "changed::" CAJA_PREFERENCES_DESKTOP_IS_HOME_DIR, + G_CALLBACK(desktop_location_changed_callback), + G_OBJECT (application)); /* Create the other windows. */ if (urls != NULL || !no_default_window) { @@ -1613,7 +1610,7 @@ desktop_changed_callback (gpointer user_data) CajaApplication *application; application = CAJA_APPLICATION (user_data); - if ( eel_preferences_get_boolean (CAJA_PREFERENCES_SHOW_DESKTOP)) + if (g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_SHOW_DESKTOP)) { caja_application_open_desktop (application); } @@ -1639,7 +1636,7 @@ volume_added_callback (GVolumeMonitor *monitor, GVolume *volume, CajaApplication *application) { - if (eel_preferences_get_boolean (CAJA_PREFERENCES_MEDIA_AUTOMOUNT) && + if (g_settings_get_boolean (caja_media_preferences, CAJA_PREFERENCES_MEDIA_AUTOMOUNT) && g_volume_should_automount (volume) && g_volume_can_mount (volume)) { diff --git a/src/caja-emblem-sidebar.h b/src/caja-emblem-sidebar.h index 249484d1..19238a26 100644 --- a/src/caja-emblem-sidebar.h +++ b/src/caja-emblem-sidebar.h @@ -41,7 +41,7 @@ #define CAJA_EMBLEM_SIDEBAR_GET_CLASS(obj) \ (G_TYPE_INSTANCE_GET_CLASS ((obj), CAJA_TYPE_EMBLEM_SIDEBAR, CajaEmblemSidebarClass)) -#define CAJA_EMBLEM_SIDEBAR_ID "CajaEmblemSidebar" +#define CAJA_EMBLEM_SIDEBAR_ID "emblems" typedef struct CajaEmblemSidebarDetails CajaEmblemSidebarDetails; diff --git a/src/caja-file-management-properties-main.c b/src/caja-file-management-properties-main.c index ba5ee984..41bf34af 100644 --- a/src/caja-file-management-properties-main.c +++ b/src/caja-file-management-properties-main.c @@ -28,6 +28,7 @@ #include #include +#include #include @@ -53,6 +54,7 @@ main (int argc, char *argv[]) gtk_init (&argc, &argv); eel_preferences_init ("/apps/caja"); + caja_global_preferences_init (); caja_module_setup (); diff --git a/src/caja-file-management-properties.c b/src/caja-file-management-properties.c index ade5e081..ec187c1e 100644 --- a/src/caja-file-management-properties.c +++ b/src/caja-file-management-properties.c @@ -172,6 +172,8 @@ static const char * const icon_captions_components[] = NULL }; +static void caja_file_management_properties_dialog_update_media_sensitivity (GtkBuilder *builder); + static void caja_file_management_properties_size_group_create (GtkBuilder *builder, char *prefix, @@ -268,6 +270,9 @@ caja_file_management_properties_dialog_response_cb (GtkDialog *parent, eel_mateconf_monitor_remove ("/apps/caja/list_view"); eel_mateconf_monitor_remove ("/apps/caja/preferences"); eel_mateconf_monitor_remove ("/desktop/mate/file_views"); + g_signal_handlers_disconnect_by_func (caja_media_preferences, + caja_file_management_properties_dialog_update_media_sensitivity, + builder); } } @@ -551,7 +556,7 @@ static void caja_file_management_properties_dialog_update_media_sensitivity (GtkBuilder *builder) { gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (builder, "media_handling_vbox")), - ! eel_preferences_get_boolean (CAJA_PREFERENCES_MEDIA_AUTORUN_NEVER)); + ! g_settings_get_boolean (caja_media_preferences, CAJA_PREFERENCES_MEDIA_AUTORUN_NEVER)); } static void @@ -699,6 +704,17 @@ skip: caja_file_management_properties_dialog_update_media_sensitivity (builder); } +static void +bind_builder_bool (GtkBuilder *builder, + GSettings *settings, + const char *widget_name, + const char *prefs) +{ + g_settings_bind (settings, prefs, + gtk_builder_get_object (builder, widget_name), + "active", G_SETTINGS_BIND_DEFAULT); +} + static void caja_file_management_properties_dialog_setup (GtkBuilder *builder, GtkWindow *window) { @@ -745,25 +761,23 @@ caja_file_management_properties_dialog_setup (GtkBuilder *builder, GtkWindow *wi CAJA_FILE_MANAGEMENT_PROPERTIES_ALWAYS_USE_BROWSER_WIDGET, CAJA_PREFERENCES_ALWAYS_USE_BROWSER); - eel_preferences_builder_connect_bool (builder, - CAJA_FILE_MANAGEMENT_PROPERTIES_MEDIA_AUTOMOUNT_OPEN, - CAJA_PREFERENCES_MEDIA_AUTOMOUNT_OPEN); - eel_preferences_builder_connect_bool (builder, - CAJA_FILE_MANAGEMENT_PROPERTIES_MEDIA_AUTORUN_NEVER, - CAJA_PREFERENCES_MEDIA_AUTORUN_NEVER); - - eel_preferences_builder_connect_bool (builder, - CAJA_FILE_MANAGEMENT_PROPERTIES_TRASH_CONFIRM_WIDGET, - CAJA_PREFERENCES_CONFIRM_TRASH); - eel_preferences_builder_connect_bool (builder, - CAJA_FILE_MANAGEMENT_PROPERTIES_TRASH_DELETE_WIDGET, - CAJA_PREFERENCES_ENABLE_DELETE); - eel_preferences_builder_connect_bool (builder, - CAJA_FILE_MANAGEMENT_PROPERTIES_SHOW_HIDDEN_WIDGET, - CAJA_PREFERENCES_SHOW_HIDDEN_FILES); - eel_preferences_builder_connect_bool_slave (builder, - CAJA_FILE_MANAGEMENT_PROPERTIES_SHOW_HIDDEN_WIDGET, - CAJA_PREFERENCES_SHOW_BACKUP_FILES); + bind_builder_bool (builder, caja_media_preferences, + CAJA_FILE_MANAGEMENT_PROPERTIES_MEDIA_AUTOMOUNT_OPEN, + CAJA_PREFERENCES_MEDIA_AUTOMOUNT_OPEN); + bind_builder_bool (builder, caja_media_preferences, + CAJA_FILE_MANAGEMENT_PROPERTIES_MEDIA_AUTORUN_NEVER, + CAJA_PREFERENCES_MEDIA_AUTORUN_NEVER); + + bind_builder_bool (builder, caja_preferences, + CAJA_FILE_MANAGEMENT_PROPERTIES_TRASH_CONFIRM_WIDGET, + CAJA_PREFERENCES_CONFIRM_TRASH); + + bind_builder_bool (builder, caja_preferences, + CAJA_FILE_MANAGEMENT_PROPERTIES_TRASH_DELETE_WIDGET, + CAJA_PREFERENCES_ENABLE_DELETE); + bind_builder_bool (builder, caja_preferences, + CAJA_FILE_MANAGEMENT_PROPERTIES_SHOW_HIDDEN_WIDGET, + CAJA_PREFERENCES_SHOW_HIDDEN_FILES); eel_preferences_builder_connect_bool (builder, CAJA_FILE_MANAGEMENT_PROPERTIES_TREE_VIEW_FOLDERS_WIDGET, CAJA_PREFERENCES_TREE_SHOW_ONLY_DIRECTORIES); @@ -831,9 +845,10 @@ caja_file_management_properties_dialog_setup (GtkBuilder *builder, GtkWindow *wi caja_file_management_properties_dialog_setup_list_column_page (builder); caja_file_management_properties_dialog_setup_media_page (builder); - eel_preferences_add_callback (CAJA_PREFERENCES_MEDIA_AUTORUN_NEVER, - (EelPreferencesCallback ) caja_file_management_properties_dialog_update_media_sensitivity, - g_object_ref (builder)); + g_signal_connect_swapped (caja_media_preferences, + "changed::" CAJA_PREFERENCES_MEDIA_AUTORUN_NEVER, + G_CALLBACK(caja_file_management_properties_dialog_update_media_sensitivity), + builder); /* UI callbacks */ diff --git a/src/caja-history-sidebar.h b/src/caja-history-sidebar.h index b7e3cb40..45740e24 100644 --- a/src/caja-history-sidebar.h +++ b/src/caja-history-sidebar.h @@ -31,7 +31,7 @@ #include #include -#define CAJA_HISTORY_SIDEBAR_ID "CajaHistorySidebar" +#define CAJA_HISTORY_SIDEBAR_ID "history" #define CAJA_TYPE_HISTORY_SIDEBAR caja_history_sidebar_get_type() #define CAJA_HISTORY_SIDEBAR(obj) \ diff --git a/src/caja-information-panel.c b/src/caja-information-panel.c index a7a978fb..35df28ca 100644 --- a/src/caja-information-panel.c +++ b/src/caja-information-panel.c @@ -84,7 +84,9 @@ static void caja_information_panel_drag_data_received (GtkWidget static void caja_information_panel_read_defaults (CajaInformationPanel *information_panel); static void caja_information_panel_style_set (GtkWidget *widget, GtkStyle *previous_style); -static void caja_information_panel_theme_changed (gpointer user_data); +static void caja_information_panel_theme_changed (GSettings *settings, + const gchar *key, + gpointer user_data); static void caja_information_panel_update_appearance (CajaInformationPanel *information_panel); static void caja_information_panel_update_buttons (CajaInformationPanel *information_panel); static void background_metadata_changed_callback (CajaInformationPanel *information_panel); @@ -273,9 +275,18 @@ caja_information_panel_init (CajaInformationPanel *information_panel) make_button_box (information_panel); /* add a callback for when the theme changes */ - eel_preferences_add_callback (CAJA_PREFERENCES_SIDE_PANE_BACKGROUND_SET, caja_information_panel_theme_changed, information_panel); - eel_preferences_add_callback (CAJA_PREFERENCES_SIDE_PANE_BACKGROUND_COLOR, caja_information_panel_theme_changed, information_panel); - eel_preferences_add_callback (CAJA_PREFERENCES_SIDE_PANE_BACKGROUND_FILENAME, caja_information_panel_theme_changed, information_panel); + g_signal_connect (caja_preferences, + "changed::" CAJA_PREFERENCES_SIDE_PANE_BACKGROUND_SET, + G_CALLBACK(caja_information_panel_theme_changed), + information_panel); + g_signal_connect (caja_preferences, + "changed::" CAJA_PREFERENCES_SIDE_PANE_BACKGROUND_COLOR, + G_CALLBACK(caja_information_panel_theme_changed), + information_panel); + g_signal_connect (caja_preferences, + "changed::" CAJA_PREFERENCES_SIDE_PANE_BACKGROUND_URI, + G_CALLBACK(caja_information_panel_theme_changed), + information_panel); /* prepare ourselves to receive dropped objects */ gtk_drag_dest_set (GTK_WIDGET (information_panel), @@ -303,15 +314,9 @@ caja_information_panel_finalize (GObject *object) g_free (information_panel->details->current_background_image); g_free (information_panel->details); - eel_preferences_remove_callback (CAJA_PREFERENCES_SIDE_PANE_BACKGROUND_SET, - caja_information_panel_theme_changed, - information_panel); - eel_preferences_remove_callback (CAJA_PREFERENCES_SIDE_PANE_BACKGROUND_COLOR, - caja_information_panel_theme_changed, - information_panel); - eel_preferences_remove_callback (CAJA_PREFERENCES_SIDE_PANE_BACKGROUND_FILENAME, - caja_information_panel_theme_changed, - information_panel); + g_signal_handlers_disconnect_by_func (caja_preferences, + caja_information_panel_theme_changed, + information_panel); EEL_CALL_PARENT (G_OBJECT_CLASS, finalize, (object)); } @@ -375,14 +380,14 @@ caja_information_panel_read_defaults (CajaInformationPanel *information_panel) gboolean background_set; char *background_color, *background_image; - background_set = eel_preferences_get_boolean (CAJA_PREFERENCES_SIDE_PANE_BACKGROUND_SET); + background_set = g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_SIDE_PANE_BACKGROUND_SET); background_color = NULL; background_image = NULL; if (background_set) { - background_color = eel_preferences_get (CAJA_PREFERENCES_SIDE_PANE_BACKGROUND_COLOR); - background_image = eel_preferences_get (CAJA_PREFERENCES_SIDE_PANE_BACKGROUND_FILENAME); + background_color = g_settings_get_string (caja_preferences, CAJA_PREFERENCES_SIDE_PANE_BACKGROUND_COLOR); + background_image = g_settings_get_string (caja_preferences, CAJA_PREFERENCES_SIDE_PANE_BACKGROUND_URI); } g_free (information_panel->details->default_background_color); @@ -409,7 +414,9 @@ caja_information_panel_read_defaults (CajaInformationPanel *information_panel) /* handler for handling theme changes */ static void -caja_information_panel_theme_changed (gpointer user_data) +caja_information_panel_theme_changed (GSettings *settings, + const gchar *key, + gpointer user_data) { CajaInformationPanel *information_panel; @@ -737,12 +744,18 @@ background_settings_changed_callback (EelBackground *background, GdkDragAction a NULL, NULL); - eel_preferences_set - (CAJA_PREFERENCES_SIDE_PANE_BACKGROUND_COLOR, color ? color : ""); - eel_preferences_set - (CAJA_PREFERENCES_SIDE_PANE_BACKGROUND_FILENAME, image ? image : ""); - eel_preferences_set_boolean - (CAJA_PREFERENCES_SIDE_PANE_BACKGROUND_SET, TRUE); + g_signal_handlers_block_by_func (caja_preferences, + G_CALLBACK(caja_information_panel_theme_changed), + information_panel); + g_settings_set_string (caja_preferences, + CAJA_PREFERENCES_SIDE_PANE_BACKGROUND_COLOR, color ? color : ""); + g_settings_set_string (caja_preferences, + CAJA_PREFERENCES_SIDE_PANE_BACKGROUND_URI, image ? image : ""); + g_settings_set_boolean (caja_preferences, + CAJA_PREFERENCES_SIDE_PANE_BACKGROUND_SET, TRUE); + g_signal_handlers_unblock_by_func (caja_preferences, + G_CALLBACK(caja_information_panel_theme_changed), + information_panel); } else { @@ -819,7 +832,14 @@ background_reset_callback (EelBackground *background, CajaInformationPanel *info } else { - eel_preferences_set_boolean (CAJA_PREFERENCES_SIDE_PANE_BACKGROUND_SET, FALSE); + g_signal_handlers_block_by_func (caja_preferences, + G_CALLBACK(caja_information_panel_theme_changed), + information_panel); + g_settings_set_boolean (caja_preferences, + CAJA_PREFERENCES_SIDE_PANE_BACKGROUND_SET, FALSE); + g_signal_handlers_unblock_by_func (caja_preferences, + G_CALLBACK(caja_information_panel_theme_changed), + information_panel); } g_signal_handlers_unblock_by_func (information_panel->details->file, @@ -1149,7 +1169,7 @@ caja_information_panel_style_set (GtkWidget *widget, GtkStyle *previous_style) information_panel = CAJA_INFORMATION_PANEL (widget); - caja_information_panel_theme_changed (information_panel); + caja_information_panel_theme_changed (NULL, NULL, information_panel); } static void diff --git a/src/caja-information-panel.h b/src/caja-information-panel.h index b6df023d..75bcfcbb 100644 --- a/src/caja-information-panel.h +++ b/src/caja-information-panel.h @@ -44,7 +44,7 @@ typedef struct CajaInformationPanelDetails CajaInformationPanelDetails; -#define CAJA_INFORMATION_PANEL_ID "CajaInformationPanel" +#define CAJA_INFORMATION_PANEL_ID "information" typedef struct { diff --git a/src/caja-main.c b/src/caja-main.c index 4e6f27f1..52b208b9 100644 --- a/src/caja-main.c +++ b/src/caja-main.c @@ -496,14 +496,6 @@ main (int argc, char *argv[]) /* exit_with_last_window being FALSE, caja can run without window. */ exit_with_last_window = eel_preferences_get_boolean (CAJA_PREFERENCES_EXIT_WITH_LAST_WINDOW); - if (no_desktop) - { - eel_preferences_set_is_invisible - (CAJA_PREFERENCES_SHOW_DESKTOP, TRUE); - eel_preferences_set_is_invisible - (CAJA_PREFERENCES_DESKTOP_IS_HOME_DIR, TRUE); - } - application = NULL; /* Do either the self-check or the real work. */ diff --git a/src/caja-navigation-window.c b/src/caja-navigation-window.c index ee6de1c1..7043e2d7 100644 --- a/src/caja-navigation-window.c +++ b/src/caja-navigation-window.c @@ -89,7 +89,6 @@ enum ARG_APP }; -static int side_pane_width_auto_value = 0; /* Forward and back buttons on the mouse */ @@ -382,11 +381,11 @@ side_pane_size_allocate_callback (GtkWidget *widget, if (allocation->width != window->details->side_pane_width) { window->details->side_pane_width = allocation->width; - if (eel_preferences_key_is_writable (CAJA_PREFERENCES_SIDEBAR_WIDTH)) + if (g_settings_is_writable (caja_preferences, CAJA_PREFERENCES_SIDEBAR_WIDTH)) { - eel_preferences_set_integer - (CAJA_PREFERENCES_SIDEBAR_WIDTH, - allocation->width <= 1 ? 0 : allocation->width); + g_settings_set_int (caja_preferences, + CAJA_PREFERENCES_SIDEBAR_WIDTH, + allocation->width <= 1 ? 0 : allocation->width); } } } @@ -394,22 +393,14 @@ side_pane_size_allocate_callback (GtkWidget *widget, static void setup_side_pane_width (CajaNavigationWindow *window) { - static gboolean setup_auto_value= TRUE; - g_return_if_fail (window->sidebar != NULL); - if (setup_auto_value) - { - setup_auto_value = FALSE; - eel_preferences_add_auto_integer - (CAJA_PREFERENCES_SIDEBAR_WIDTH, - &side_pane_width_auto_value); - } - - window->details->side_pane_width = side_pane_width_auto_value; + window->details->side_pane_width = + g_settings_get_int (caja_preferences, + CAJA_PREFERENCES_SIDEBAR_WIDTH); gtk_paned_set_position (GTK_PANED (window->details->content_paned), - side_pane_width_auto_value); + window->details->side_pane_width); } static void diff --git a/src/caja-notes-viewer.h b/src/caja-notes-viewer.h index b5a4d7c7..ab5965f5 100644 --- a/src/caja-notes-viewer.h +++ b/src/caja-notes-viewer.h @@ -30,7 +30,7 @@ #include #include -#define CAJA_NOTES_SIDEBAR_ID "CajaNotesSidebar" +#define CAJA_NOTES_SIDEBAR_ID "notes" #define CAJA_TYPE_NOTES_VIEWER caja_notes_viewer_get_type() #define CAJA_NOTES_VIEWER(obj) \ diff --git a/src/caja-pathbar.c b/src/caja-pathbar.c index 1e43bd35..e3e2a1a8 100644 --- a/src/caja-pathbar.c +++ b/src/caja-pathbar.c @@ -317,10 +317,9 @@ caja_path_bar_init (CajaPathBar *path_bar) path_bar->root_path = g_file_new_for_path ("/"); desktop_is_home = g_file_equal (path_bar->home_path, path_bar->desktop_path); - eel_preferences_add_callback_while_alive (CAJA_PREFERENCES_DESKTOP_IS_HOME_DIR, - desktop_location_changed_callback, - path_bar, - G_OBJECT (path_bar)); + g_signal_connect_swapped (caja_preferences, "changed::" CAJA_PREFERENCES_DESKTOP_IS_HOME_DIR, + G_CALLBACK(desktop_location_changed_callback), + path_bar); g_signal_connect_swapped (path_bar->up_slider_button, "clicked", G_CALLBACK (caja_path_bar_scroll_up), path_bar); g_signal_connect_swapped (path_bar->down_slider_button, "clicked", G_CALLBACK (caja_path_bar_scroll_down), path_bar); @@ -444,6 +443,9 @@ caja_path_bar_finalize (GObject *object) g_signal_handlers_disconnect_by_func (caja_trash_monitor_get (), trash_state_changed_cb, path_bar); + g_signal_handlers_disconnect_by_func (caja_preferences, + desktop_location_changed_callback, + path_bar); G_OBJECT_CLASS (caja_path_bar_parent_class)->finalize (object); } diff --git a/src/caja-places-sidebar.c b/src/caja-places-sidebar.c index dff9618a..ae63fa25 100644 --- a/src/caja-places-sidebar.c +++ b/src/caja-places-sidebar.c @@ -2854,10 +2854,9 @@ caja_places_sidebar_init (CajaPlacesSidebar *sidebar) eel_gtk_tree_view_set_activate_on_single_click (sidebar->tree_view, TRUE); - eel_preferences_add_callback_while_alive (CAJA_PREFERENCES_DESKTOP_IS_HOME_DIR, - desktop_location_changed_callback, - sidebar, - G_OBJECT (sidebar)); + g_signal_connect_swapped (caja_preferences, "changed::" CAJA_PREFERENCES_DESKTOP_IS_HOME_DIR, + G_CALLBACK(desktop_location_changed_callback), + sidebar); g_signal_connect_object (caja_trash_monitor_get (), "trash_state_changed", @@ -2900,6 +2899,10 @@ caja_places_sidebar_dispose (GObject *object) eel_remove_weak_pointer (&(sidebar->go_to_after_mount_slot)); + g_signal_handlers_disconnect_by_func (caja_preferences, + desktop_location_changed_callback, + sidebar); + G_OBJECT_CLASS (caja_places_sidebar_parent_class)->dispose (object); } diff --git a/src/caja-places-sidebar.h b/src/caja-places-sidebar.h index 81527524..e4d36a9f 100644 --- a/src/caja-places-sidebar.h +++ b/src/caja-places-sidebar.h @@ -28,7 +28,7 @@ #include #include -#define CAJA_PLACES_SIDEBAR_ID "CajaPlacesSidebar" +#define CAJA_PLACES_SIDEBAR_ID "places" #define CAJA_TYPE_PLACES_SIDEBAR caja_places_sidebar_get_type() #define CAJA_PLACES_SIDEBAR(obj) \ diff --git a/src/caja-property-browser.c b/src/caja-property-browser.c index 5c5830d3..c74177d3 100644 --- a/src/caja-property-browser.c +++ b/src/caja-property-browser.c @@ -155,7 +155,6 @@ static void caja_property_browser_drag_data_get (GtkWidget GtkSelectionData *selection_data, guint info, guint32 time); -static void caja_property_browser_theme_changed (gpointer user_data); static void emit_emblems_changed_signal (void); static void emblems_changed_callback (GObject *signaller, CajaPropertyBrowser *property_browser); @@ -390,11 +389,6 @@ caja_property_browser_init (GtkObject *object) /* the actual contents are created when necessary */ property_browser->details->content_frame = NULL; - /* add a callback for when the theme changes */ - eel_preferences_add_callback (CAJA_PREFERENCES_THEME, - caja_property_browser_theme_changed, - property_browser); - g_signal_connect (property_browser, "delete_event", G_CALLBACK (caja_property_browser_delete_event_callback), NULL); g_signal_connect (property_browser, "hide", @@ -454,10 +448,6 @@ caja_property_browser_destroy (GtkObject *object) g_free (property_browser->details); - eel_preferences_remove_callback (CAJA_PREFERENCES_THEME, - caja_property_browser_theme_changed, - property_browser); - EEL_CALL_PARENT (GTK_OBJECT_CLASS, destroy, (object)); } @@ -2072,17 +2062,6 @@ make_properties_from_xml_node (CajaPropertyBrowser *property_browser, } } -/* handle theme changes by updating the browser contents */ - -static void -caja_property_browser_theme_changed (gpointer user_data) -{ - CajaPropertyBrowser *property_browser; - - property_browser = CAJA_PROPERTY_BROWSER(user_data); - caja_property_browser_update_contents (property_browser); -} - /* make_category generates widgets corresponding all of the objects in the passed in directory */ static void make_category(CajaPropertyBrowser *property_browser, const char* path, const char* mode, xmlNodePtr node, const char *description) diff --git a/src/caja-window-menus.c b/src/caja-window-menus.c index 01fd7291..06aa51ff 100644 --- a/src/caja-window-menus.c +++ b/src/caja-window-menus.c @@ -437,7 +437,7 @@ show_hidden_files_preference_callback (gpointer callback_data) /* update button */ g_signal_handlers_block_by_func (action, action_show_hidden_files_callback, window); gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), - eel_preferences_get_boolean (CAJA_PREFERENCES_SHOW_HIDDEN_FILES)); + g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_SHOW_HIDDEN_FILES)); g_signal_handlers_unblock_by_func (action, action_show_hidden_files_callback, window); /* inform views */ @@ -992,13 +992,13 @@ caja_window_initialize_menus (CajaWindow *window) action = gtk_action_group_get_action (action_group, CAJA_ACTION_SHOW_HIDDEN_FILES); g_signal_handlers_block_by_func (action, action_show_hidden_files_callback, window); gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), - eel_preferences_get_boolean (CAJA_PREFERENCES_SHOW_HIDDEN_FILES)); + g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_SHOW_HIDDEN_FILES)); g_signal_handlers_unblock_by_func (action, action_show_hidden_files_callback, window); - eel_preferences_add_callback_while_alive (CAJA_PREFERENCES_SHOW_HIDDEN_FILES, - show_hidden_files_preference_callback, - window, G_OBJECT (window)); + g_signal_connect_swapped (caja_preferences, "changed::" CAJA_PREFERENCES_SHOW_HIDDEN_FILES, + G_CALLBACK(show_hidden_files_preference_callback), + window); window->details->ui_manager = gtk_ui_manager_new (); ui_manager = window->details->ui_manager; diff --git a/src/file-manager/Makefile.am b/src/file-manager/Makefile.am index 4090fc91..e73afbed 100644 --- a/src/file-manager/Makefile.am +++ b/src/file-manager/Makefile.am @@ -12,8 +12,6 @@ INCLUDES = \ $(DISABLE_DEPRECATED_CFLAGS) \ $(NULL) - - libcaja_file_manager_la_SOURCES = \ fm-actions.h \ fm-desktop-icon-view.c \ diff --git a/src/file-manager/fm-desktop-icon-view.c b/src/file-manager/fm-desktop-icon-view.c index 65ee3e12..86d1cce6 100644 --- a/src/file-manager/fm-desktop-icon-view.c +++ b/src/file-manager/fm-desktop-icon-view.c @@ -308,6 +308,10 @@ fm_desktop_icon_view_finalize (GObject *object) lockdown_disable_command_line_changed_callback, icon_view); + g_signal_handlers_disconnect_by_func (caja_preferences, + desktop_directory_changed_callback, + NULL); + g_free (icon_view->details); G_OBJECT_CLASS (parent_class)->finalize (object); @@ -531,7 +535,7 @@ fm_desktop_icon_view_update_icon_container_fonts (FMDesktopIconView *icon_view) icon_container = get_icon_container (icon_view); g_assert (icon_container != NULL); - font = eel_preferences_get (CAJA_PREFERENCES_DESKTOP_FONT); + font = g_settings_get_string (caja_preferences, CAJA_PREFERENCES_DESKTOP_FONT); caja_icon_container_set_font (icon_container, font); @@ -547,9 +551,9 @@ fm_desktop_icon_view_init (FMDesktopIconView *desktop_icon_view) if (desktop_directory == NULL) { - eel_preferences_add_callback (CAJA_PREFERENCES_DESKTOP_IS_HOME_DIR, - desktop_directory_changed_callback, - NULL); + g_signal_connect_swapped (caja_preferences, "changed::" CAJA_PREFERENCES_DESKTOP_IS_HOME_DIR, + G_CALLBACK(desktop_directory_changed_callback), + NULL); desktop_directory_changed_callback (NULL); } diff --git a/src/file-manager/fm-directory-view.c b/src/file-manager/fm-directory-view.c index a6598e2e..5b304f13 100644 --- a/src/file-manager/fm-directory-view.c +++ b/src/file-manager/fm-directory-view.c @@ -152,9 +152,6 @@ static guint signals[LAST_SIGNAL]; static GdkAtom copied_files_atom; -static gboolean show_delete_command_auto_value; -static gboolean confirm_trash_auto_value; - static char *scripts_directory_uri; static int scripts_directory_uri_length; @@ -235,7 +232,6 @@ struct FMDirectoryViewDetails gboolean show_foreign_files; gboolean show_hidden_files; - gboolean show_backup_files; gboolean ignore_hidden_file_preferences; gboolean batching_selection_level; @@ -1766,7 +1762,7 @@ add_directory_to_directory_list (FMDirectoryView *view, CAJA_FILE_ATTRIBUTE_DIRECTORY_ITEM_COUNT; caja_directory_file_monitor_add (directory, directory_list, - FALSE, FALSE, attributes, + FALSE, attributes, (CajaDirectoryCallback)changed_callback, view); g_signal_connect_object (directory, "files_added", @@ -1987,19 +1983,10 @@ fm_directory_view_init_view_iface (CajaViewIface *iface) static void fm_directory_view_init (FMDirectoryView *view) { - static gboolean setup_autos = FALSE; CajaDirectory *scripts_directory; CajaDirectory *templates_directory; char *templates_uri; - if (!setup_autos) { - setup_autos = TRUE; - eel_preferences_add_auto_boolean (CAJA_PREFERENCES_CONFIRM_TRASH, - &confirm_trash_auto_value); - eel_preferences_add_auto_boolean (CAJA_PREFERENCES_ENABLE_DELETE, - &show_delete_command_auto_value); - } - view->details = g_new0 (FMDirectoryViewDetails, 1); /* Default to true; desktop-icon-view sets to false */ @@ -2052,8 +2039,6 @@ fm_directory_view_init (FMDirectoryView *view) gtk_widget_show (GTK_WIDGET (view)); - eel_preferences_add_callback (CAJA_PREFERENCES_CONFIRM_TRASH, - schedule_update_menus_callback, view); eel_preferences_add_callback (CAJA_PREFERENCES_ENABLE_DELETE, schedule_update_menus_callback, view); eel_preferences_add_callback (CAJA_PREFERENCES_ICON_VIEW_CAPTIONS, @@ -2183,8 +2168,6 @@ fm_directory_view_finalize (GObject *object) view = FM_DIRECTORY_VIEW (object); - eel_preferences_remove_callback (CAJA_PREFERENCES_CONFIRM_TRASH, - schedule_update_menus_callback, view); eel_preferences_remove_callback (CAJA_PREFERENCES_ENABLE_DELETE, schedule_update_menus_callback, view); eel_preferences_remove_callback (CAJA_PREFERENCES_ICON_VIEW_CAPTIONS, @@ -3421,7 +3404,6 @@ fm_directory_view_add_subdirectory (FMDirectoryView *view, caja_directory_file_monitor_add (directory, &view->details->model, view->details->show_hidden_files, - view->details->show_backup_files, attributes, files_added_callback, view); @@ -5521,7 +5503,7 @@ update_directory_in_scripts_menu (FMDirectoryView *view, CajaDirectory *director g_free (escaped_path); file_list = caja_directory_get_file_list (directory); - filtered = caja_file_list_filter_hidden_and_backup (file_list, FALSE, FALSE); + filtered = caja_file_list_filter_hidden (file_list, FALSE); caja_file_list_free (file_list); file_list = caja_file_list_sort_by_display_name (filtered); @@ -5775,7 +5757,7 @@ update_directory_in_templates_menu (FMDirectoryView *view, g_free (escaped_path); file_list = caja_directory_get_file_list (directory); - filtered = caja_file_list_filter_hidden_and_backup (file_list, FALSE, FALSE); + filtered = caja_file_list_filter_hidden (file_list, FALSE); caja_file_list_free (file_list); file_list = caja_file_list_sort_by_display_name (filtered); @@ -7197,21 +7179,18 @@ fm_directory_view_init_show_hidden_files (FMDirectoryView *view) mode = caja_window_info_get_hidden_files_mode (view->details->window); if (mode == CAJA_WINDOW_SHOW_HIDDEN_FILES_DEFAULT) { - show_hidden_default_setting = eel_preferences_get_boolean (CAJA_PREFERENCES_SHOW_HIDDEN_FILES); + show_hidden_default_setting = g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_SHOW_HIDDEN_FILES); if (show_hidden_default_setting != view->details->show_hidden_files) { view->details->show_hidden_files = show_hidden_default_setting; - view->details->show_backup_files = show_hidden_default_setting; show_hidden_changed = TRUE; } } else { if (mode == CAJA_WINDOW_SHOW_HIDDEN_FILES_ENABLE) { show_hidden_changed = !view->details->show_hidden_files; view->details->show_hidden_files = TRUE; - view->details->show_backup_files = TRUE; } else { show_hidden_changed = view->details->show_hidden_files; view->details->show_hidden_files = FALSE; - view->details->show_backup_files = FALSE; } } @@ -8566,7 +8545,7 @@ real_update_location_menu (FMDirectoryView *view) } else { label = _("Mo_ve to Trash"); tip = _("Move the open folder to the Trash"); - show_separate_delete_command = show_delete_command_auto_value; + show_separate_delete_command = g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_ENABLE_DELETE); } action = gtk_action_group_get_action (view->details->dir_action_group, @@ -8891,7 +8870,7 @@ real_update_menus (FMDirectoryView *view) } else { label = _("Mo_ve to Trash"); tip = _("Move each selected item to the Trash"); - show_separate_delete_command = show_delete_command_auto_value; + show_separate_delete_command = g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_ENABLE_DELETE); } action = gtk_action_group_get_action (view->details->dir_action_group, @@ -9552,7 +9531,6 @@ finish_loading (FMDirectoryView *view) caja_directory_file_monitor_add (view->details->model, &view->details->model, view->details->show_hidden_files, - view->details->show_backup_files, attributes, files_added_callback, view); @@ -9948,7 +9926,6 @@ fm_directory_view_should_show_file (FMDirectoryView *view, CajaFile *file) { return caja_file_should_show (file, view->details->show_hidden_files, - view->details->show_backup_files, view->details->show_foreign_files); } @@ -10061,7 +10038,6 @@ fm_directory_view_ignore_hidden_file_preferences (FMDirectoryView *view) } view->details->show_hidden_files = FALSE; - view->details->show_backup_files = FALSE; view->details->ignore_hidden_file_preferences = TRUE; } diff --git a/src/file-manager/fm-tree-model.c b/src/file-manager/fm-tree-model.c index bbcdbb42..15071b8c 100644 --- a/src/file-manager/fm-tree-model.c +++ b/src/file-manager/fm-tree-model.c @@ -101,7 +101,6 @@ struct FMTreeModelDetails guint monitoring_update_idle_id; gboolean show_hidden_files; - gboolean show_backup_files; gboolean show_only_directories; GList *highlighted_files; @@ -989,7 +988,6 @@ should_show_file (FMTreeModel *model, CajaFile *file) should = caja_file_should_show (file, model->details->show_hidden_files, - model->details->show_backup_files, TRUE); if (should @@ -1226,7 +1224,6 @@ start_monitoring_directory (FMTreeModel *model, TreeNode *node) attributes = get_tree_monitor_attributes (); caja_directory_file_monitor_add (directory, model, model->details->show_hidden_files, - model->details->show_backup_files, attributes, files_changed_callback, node->root); } @@ -1890,7 +1887,6 @@ fm_tree_model_set_show_hidden_files (FMTreeModel *model, return; } model->details->show_hidden_files = show_hidden_files; - model->details->show_backup_files = show_hidden_files; stop_monitoring (model); if (!show_hidden_files) { diff --git a/src/file-manager/fm-tree-view.c b/src/file-manager/fm-tree-view.c index 53b1f85a..d56f5a6e 100644 --- a/src/file-manager/fm-tree-view.c +++ b/src/file-manager/fm-tree-view.c @@ -118,7 +118,6 @@ typedef struct } PrependURIParameters; static GdkAtom copied_files_atom; -static gboolean show_delete_command_auto_value; static void fm_tree_view_iface_init (CajaSidebarIface *iface); static void sidebar_provider_iface_init (CajaSidebarProviderIface *iface); @@ -811,7 +810,7 @@ button_pressed_callback (GtkTreeView *treeview, GdkEventButton *event, can_move_file_to_trash = caja_file_can_trash (view->details->popup_file); gtk_widget_set_sensitive (view->details->popup_trash, can_move_file_to_trash); - if (show_delete_command_auto_value) + if (g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_ENABLE_DELETE)) { parent_file_is_writable = is_parent_writable (view->details->popup_file); file_is_home_or_desktop = caja_file_is_home (view->details->popup_file) @@ -1137,7 +1136,7 @@ fm_tree_view_delete_cb (GtkWidget *menu_item, { GList *location_list; - if (!show_delete_command_auto_value) + if (!g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_ENABLE_DELETE)) { return; } @@ -1533,7 +1532,7 @@ update_filtering_from_preferences (FMTreeView *view) { fm_tree_model_set_show_hidden_files (view->details->child_model, - eel_preferences_get_boolean (CAJA_PREFERENCES_SHOW_HIDDEN_FILES)); + g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_SHOW_HIDDEN_FILES)); } else { @@ -1600,10 +1599,10 @@ fm_tree_view_init (FMTreeView *view) view->details->selecting = FALSE; - eel_preferences_add_callback_while_alive (CAJA_PREFERENCES_SHOW_HIDDEN_FILES, - filtering_changed_callback, view, G_OBJECT (view)); - eel_preferences_add_callback_while_alive (CAJA_PREFERENCES_SHOW_BACKUP_FILES, - filtering_changed_callback, view, G_OBJECT (view)); + g_signal_connect_swapped (caja_preferences, + "changed::" CAJA_PREFERENCES_SHOW_HIDDEN_FILES, + G_CALLBACK(filtering_changed_callback), + view); eel_preferences_add_callback_while_alive (CAJA_PREFERENCES_TREE_SHOW_ONLY_DIRECTORIES, filtering_changed_callback, view, G_OBJECT (view)); @@ -1679,6 +1678,10 @@ fm_tree_view_dispose (GObject *object) view->details->volume_monitor = NULL; } + g_signal_handlers_disconnect_by_func (caja_preferences, + G_CALLBACK(filtering_changed_callback), + view); + view->details->window = NULL; G_OBJECT_CLASS (parent_class)->dispose (object); @@ -1703,9 +1706,6 @@ fm_tree_view_class_init (FMTreeViewClass *class) G_OBJECT_CLASS (class)->finalize = fm_tree_view_finalize; copied_files_atom = gdk_atom_intern ("x-special/mate-copied-files", FALSE); - - eel_preferences_add_auto_boolean (CAJA_PREFERENCES_ENABLE_DELETE, - &show_delete_command_auto_value); } static const char * diff --git a/src/file-manager/fm-tree-view.h b/src/file-manager/fm-tree-view.h index d78d85e3..c79057b8 100644 --- a/src/file-manager/fm-tree-view.h +++ b/src/file-manager/fm-tree-view.h @@ -43,7 +43,7 @@ #define FM_TREE_VIEW_GET_CLASS(obj) \ (G_TYPE_INSTANCE_GET_CLASS ((obj), FM_TYPE_TREE_VIEW, FMTreeViewClass)) -#define TREE_SIDEBAR_ID "CajaTreeSidebar" +#define TREE_SIDEBAR_ID "tree" typedef struct FMTreeViewDetails FMTreeViewDetails; diff --git a/test/test-caja-directory-async.c b/test/test-caja-directory-async.c index e581abb5..e6a0c52e 100644 --- a/test/test-caja-directory-async.c +++ b/test/test-caja-directory-async.c @@ -94,7 +94,7 @@ main (int argc, char **argv) g_signal_connect (directory, "files-added", G_CALLBACK (files_added), NULL); g_signal_connect (directory, "files-changed", G_CALLBACK (files_changed), NULL); g_signal_connect (directory, "done-loading", G_CALLBACK (done_loading), NULL); - caja_directory_file_monitor_add (directory, client1, TRUE, TRUE, + caja_directory_file_monitor_add (directory, client1, TRUE, CAJA_FILE_ATTRIBUTE_INFO, NULL, NULL); -- cgit v1.2.1