summaryrefslogtreecommitdiff
path: root/src/file-manager
diff options
context:
space:
mode:
authorStefano Karapetsas <[email protected]>2012-09-05 12:36:04 +0200
committerStefano Karapetsas <[email protected]>2012-09-05 12:36:04 +0200
commit6f15dc7cc1be8b98bbc1f5edd963ff89076295ee (patch)
tree04a0b2971e10ce57880360f63147b2d137b84b2a /src/file-manager
parent373da58a33a4242f3d91771fd304ba8bb3d55e61 (diff)
downloadcaja-6f15dc7cc1be8b98bbc1f5edd963ff89076295ee.tar.bz2
caja-6f15dc7cc1be8b98bbc1f5edd963ff89076295ee.tar.xz
start migration to gsettings
Diffstat (limited to 'src/file-manager')
-rw-r--r--src/file-manager/Makefile.am2
-rw-r--r--src/file-manager/fm-desktop-icon-view.c12
-rw-r--r--src/file-manager/fm-directory-view.c36
-rw-r--r--src/file-manager/fm-tree-model.c4
-rw-r--r--src/file-manager/fm-tree-view.c22
-rw-r--r--src/file-manager/fm-tree-view.h2
6 files changed, 26 insertions, 52 deletions
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;