[nautilus] places-sidebar: follow the remember-recent-files GSetting



commit b4ad42af54234124fffc6cf0a736409be8614cc8
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Wed Feb 13 11:12:48 2013 -0500

    places-sidebar: follow the remember-recent-files GSetting
    
    https://bugzilla.gnome.org/show_bug.cgi?id=693705

 libnautilus-private/nautilus-global-preferences.c |    1 +
 libnautilus-private/nautilus-global-preferences.h |    4 +++
 src/nautilus-places-sidebar.c                     |   29 ++++++++++++--------
 3 files changed, 22 insertions(+), 12 deletions(-)
---
diff --git a/libnautilus-private/nautilus-global-preferences.c b/libnautilus-private/nautilus-global-preferences.c
index c4f5443..f259e6c 100644
--- a/libnautilus-private/nautilus-global-preferences.c
+++ b/libnautilus-private/nautilus-global-preferences.c
@@ -77,4 +77,5 @@ nautilus_global_preferences_init (void)
 	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");
+	gnome_privacy_preferences = g_settings_new ("org.gnome.desktop.privacy");
 }
diff --git a/libnautilus-private/nautilus-global-preferences.h b/libnautilus-private/nautilus-global-preferences.h
index af7d4e8..d6791b3 100644
--- a/libnautilus-private/nautilus-global-preferences.h
+++ b/libnautilus-private/nautilus-global-preferences.h
@@ -157,6 +157,9 @@ typedef enum
 /* Desktop background */
 #define NAUTILUS_PREFERENCES_SHOW_DESKTOP		   "show-desktop-icons"
 
+/* Recent files */
+#define NAUTILUS_PREFERENCES_RECENT_FILES_ENABLED          "remember-recent-files"
+
 
 void nautilus_global_preferences_init                      (void);
 char *nautilus_global_preferences_get_default_folder_viewer_preference_as_iid (void);
@@ -170,6 +173,7 @@ GSettings *gtk_filechooser_preferences;
 GSettings *gnome_lockdown_preferences;
 GSettings *gnome_background_preferences;
 GSettings *gnome_interface_preferences;
+GSettings *gnome_privacy_preferences;
 
 G_END_DECLS
 
diff --git a/src/nautilus-places-sidebar.c b/src/nautilus-places-sidebar.c
index ffba811..32dbc28 100644
--- a/src/nautilus-places-sidebar.c
+++ b/src/nautilus-places-sidebar.c
@@ -360,8 +360,16 @@ static gboolean
 recent_is_supported (void)
 {
 	const char * const *supported;
+	gboolean enabled;
 	int i;
 
+	enabled = g_settings_get_boolean (gnome_privacy_preferences,
+					  NAUTILUS_PREFERENCES_RECENT_FILES_ENABLED);
+
+	if (!enabled) {
+		return FALSE;
+	}
+
 	supported = g_vfs_get_supported_uri_schemes (g_vfs_get_default ());
 	if (!supported) {
 		return FALSE;
@@ -996,16 +1004,6 @@ clicked_eject_button (NautilusPlacesSidebar *sidebar,
 }
 
 static void
-desktop_setting_changed_callback (gpointer user_data)
-{
-	NautilusPlacesSidebar *sidebar;
-
-	sidebar = NAUTILUS_PLACES_SIDEBAR (user_data);
-
-	update_places (sidebar);
-}
-
-static void
 update_current_uri (NautilusPlacesSidebar *sidebar)
 {
 	GtkTreeSelection *selection;
@@ -3388,7 +3386,10 @@ nautilus_places_sidebar_init (NautilusPlacesSidebar *sidebar)
 	gtk_tree_view_set_activate_on_single_click (sidebar->tree_view, TRUE);
 
 	g_signal_connect_swapped (gnome_background_preferences, "changed::" NAUTILUS_PREFERENCES_SHOW_DESKTOP,
-				  G_CALLBACK(desktop_setting_changed_callback),
+				  G_CALLBACK (update_places),
+				  sidebar);
+	g_signal_connect_swapped (gnome_privacy_preferences, "changed::" NAUTILUS_PREFERENCES_RECENT_FILES_ENABLED,
+				  G_CALLBACK (update_places),
 				  sidebar);
 
 	sidebar->hostname = g_strdup (_("Computer"));
@@ -3443,7 +3444,11 @@ nautilus_places_sidebar_dispose (GObject *object)
 					      sidebar);
 
 	g_signal_handlers_disconnect_by_func (gnome_background_preferences,
-					      desktop_setting_changed_callback,
+					      update_places,
+					      sidebar);
+
+	g_signal_handlers_disconnect_by_func (gnome_privacy_preferences,
+					      update_places,
 					      sidebar);
 
 	if (sidebar->volume_monitor != NULL) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]