Share "show hidden" option with GTK file chooser

https://bugzilla.gnome.org/show_bug.cgi?id=143599
This commit is contained in:
Timothy Arceri 2012-12-04 07:45:48 +11:00 committed by Federico Mena Quintero
parent ace6d2c217
commit 85524e01c3
7 changed files with 12 additions and 8 deletions

View file

@ -827,7 +827,7 @@ static gboolean show_hidden_files = TRUE;
static void
show_hidden_files_changed_callback (gpointer callback_data)
{
show_hidden_files = g_settings_get_boolean (nautilus_preferences, NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES);
show_hidden_files = g_settings_get_boolean (gtk_filechooser_preferences, NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES);
}
static gboolean
@ -837,7 +837,7 @@ should_skip_file (NautilusDirectory *directory, GFileInfo *info)
/* Add the callback once for the life of our process */
if (!show_hidden_files_changed_callback_installed) {
g_signal_connect_swapped (nautilus_preferences,
g_signal_connect_swapped (gtk_filechooser_preferences,
"changed::" NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES,
G_CALLBACK(show_hidden_files_changed_callback),
NULL);

View file

@ -350,7 +350,7 @@ add_preferences_callbacks (void)
{
nautilus_global_preferences_init ();
g_signal_connect_swapped (nautilus_preferences,
g_signal_connect_swapped (gtk_filechooser_preferences,
"changed::" NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES,
G_CALLBACK(filtering_changed_callback),
NULL);

View file

@ -71,6 +71,9 @@ nautilus_global_preferences_init (void)
nautilus_icon_view_preferences = g_settings_new("org.gnome.nautilus.icon-view");
nautilus_list_view_preferences = g_settings_new("org.gnome.nautilus.list-view");
nautilus_desktop_preferences = g_settings_new("org.gnome.nautilus.desktop");
/* Some settings such as show hidden files are shared between Nautilus and GTK file chooser */
gtk_filechooser_preferences = g_settings_new_with_path ("org.gtk.Settings.FileChooser",
"/org/gtk/settings/file-chooser/");
gnome_lockdown_preferences = g_settings_new("org.gnome.desktop.lockdown");
gnome_background_preferences = g_settings_new("org.gnome.desktop.background");
gnome_interface_preferences = g_settings_new ("org.gnome.desktop.interface");

View file

@ -36,7 +36,7 @@ G_BEGIN_DECLS
#define NAUTILUS_PREFERENCES_ENABLE_DELETE "enable-delete"
/* Display */
#define NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES "show-hidden-files"
#define NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES "show-hidden"
/* Mouse */
#define NAUTILUS_PREFERENCES_MOUSE_USE_EXTRA_BUTTONS "mouse-use-extra-buttons"
@ -165,6 +165,7 @@ GSettings *nautilus_icon_view_preferences;
GSettings *nautilus_list_view_preferences;
GSettings *nautilus_desktop_preferences;
GSettings *nautilus_window_state;
GSettings *gtk_filechooser_preferences;
GSettings *gnome_lockdown_preferences;
GSettings *gnome_background_preferences;
GSettings *gnome_interface_preferences;

View file

@ -157,7 +157,7 @@
<key name="show-hidden-files" type="b">
<default>false</default>
<_summary>Whether to show hidden files</_summary>
<_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 (~).</_description>
<_description>This key is deprecated and ignored. The "show-hidden" key from "org.gtk.Settings.FileChooser" is now used instead.</_description>
</key>
<key name="bulk-rename-tool" type="ay">
<default>[]</default>

View file

@ -683,7 +683,7 @@ nautilus_file_management_properties_dialog_setup (GtkBuilder *builder, GtkWindow
bind_builder_bool (builder, nautilus_preferences,
NAUTILUS_FILE_MANAGEMENT_PROPERTIES_TRASH_DELETE_WIDGET,
NAUTILUS_PREFERENCES_ENABLE_DELETE);
bind_builder_bool (builder, nautilus_preferences,
bind_builder_bool (builder, gtk_filechooser_preferences,
NAUTILUS_FILE_MANAGEMENT_PROPERTIES_SHOW_HIDDEN_WIDGET,
NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES);

View file

@ -470,7 +470,7 @@ nautilus_view_reset_to_defaults (NautilusView *view)
action = gtk_action_group_get_action (view->details->dir_action_group,
NAUTILUS_ACTION_SHOW_HIDDEN_FILES);
gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
g_settings_get_boolean (nautilus_preferences, NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES));
g_settings_get_boolean (gtk_filechooser_preferences, NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES));
}
static gboolean
@ -2646,7 +2646,7 @@ nautilus_view_init (NautilusView *view)
view->details->sort_directories_first =
g_settings_get_boolean (nautilus_preferences, NAUTILUS_PREFERENCES_SORT_DIRECTORIES_FIRST);
view->details->show_hidden_files =
g_settings_get_boolean (nautilus_preferences, NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES);
g_settings_get_boolean (gtk_filechooser_preferences, NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES);
g_signal_connect_object (nautilus_trash_monitor_get (), "trash_state_changed",
G_CALLBACK (nautilus_view_trash_state_changed_callback), view, 0);