[nautilus] all: remove desktop-is-home-dir GSetting preference



commit 5ab3050f22da718264a35e61ada4be1a386a6e2d
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Thu Apr 26 15:15:56 2012 -0400

    all: remove desktop-is-home-dir GSetting preference
    
    These days, still having the desktop in Nautilus is alone questionable;
    having an additional option to make the desktop be the home directory is
    even weirder (and kind of redundant, since the user can control that
    with XDG dirs already).
    
    https://bugzilla.gnome.org/show_bug.cgi?id=469614

 libnautilus-private/nautilus-desktop-directory.c   |    4 --
 libnautilus-private/nautilus-file-utilities.c      |   47 ++++--------------
 libnautilus-private/nautilus-global-preferences.h  |    3 -
 libnautilus-private/nautilus.convert               |    1 -
 .../org.gnome.nautilus.gschema.xml.in              |    5 --
 src/nautilus-desktop-icon-view.c                   |   17 +------
 src/nautilus-desktop-window.c                      |   19 -------
 src/nautilus-pathbar.c                             |   53 +-------------------
 src/nautilus-places-sidebar.c                      |   11 +----
 src/nautilus-view.c                                |    3 +-
 10 files changed, 14 insertions(+), 149 deletions(-)
---
diff --git a/libnautilus-private/nautilus-desktop-directory.c b/libnautilus-private/nautilus-desktop-directory.c
index 623f645..625431e 100644
--- a/libnautilus-private/nautilus-desktop-directory.c
+++ b/libnautilus-private/nautilus-desktop-directory.c
@@ -506,10 +506,6 @@ nautilus_desktop_directory_init (NautilusDesktopDirectory *desktop)
 							    NULL, (GDestroyNotify)merged_monitor_destroy);
 
 	update_desktop_directory (NAUTILUS_DESKTOP_DIRECTORY (desktop));
-
-	g_signal_connect_swapped (nautilus_preferences, "changed::" NAUTILUS_PREFERENCES_DESKTOP_IS_HOME_DIR,
-				  G_CALLBACK(desktop_directory_changed_callback),
-				  desktop);
 }
 
 static void
diff --git a/libnautilus-private/nautilus-file-utilities.c b/libnautilus-private/nautilus-file-utilities.c
index c666f4f..e671b8b 100644
--- a/libnautilus-private/nautilus-file-utilities.c
+++ b/libnautilus-private/nautilus-file-utilities.c
@@ -415,11 +415,7 @@ nautilus_get_xdg_dir (const char *type)
 static char *
 get_desktop_path (void)
 {
-	if (g_settings_get_boolean (nautilus_preferences, NAUTILUS_PREFERENCES_DESKTOP_IS_HOME_DIR)) {
-		return g_strdup (g_get_home_dir());
-	} else {
-		return nautilus_get_xdg_dir ("DESKTOP");
-	}
+	return nautilus_get_xdg_dir ("DESKTOP");
 }
 
 /**
@@ -437,17 +433,15 @@ nautilus_get_desktop_directory (void)
 	desktop_directory = get_desktop_path ();
 
 	/* Don't try to create a home directory */
-	if (!g_settings_get_boolean (nautilus_preferences, NAUTILUS_PREFERENCES_DESKTOP_IS_HOME_DIR)) {
-		if (!g_file_test (desktop_directory, G_FILE_TEST_EXISTS)) {
-			g_mkdir (desktop_directory, DEFAULT_DESKTOP_DIRECTORY_MODE);
-			/* FIXME bugzilla.gnome.org 41286: 
-			 * How should we handle the case where this mkdir fails? 
-			 * Note that nautilus_application_startup will refuse to launch if this 
-			 * directory doesn't get created, so that case is OK. But the directory 
-			 * could be deleted after Nautilus was launched, and perhaps
-			 * there is some bad side-effect of not handling that case.
-			 */
-		}
+	if (!g_file_test (desktop_directory, G_FILE_TEST_EXISTS)) {
+		g_mkdir (desktop_directory, DEFAULT_DESKTOP_DIRECTORY_MODE);
+		/* FIXME bugzilla.gnome.org 41286: 
+		 * How should we handle the case where this mkdir fails? 
+		 * Note that nautilus_application_startup will refuse to launch if this 
+		 * directory doesn't get created, so that case is OK. But the directory 
+		 * could be deleted after Nautilus was launched, and perhaps
+		 * there is some bad side-effect of not handling that case.
+		 */
 	}
 
 	return desktop_directory;
@@ -555,7 +549,6 @@ nautilus_get_searches_directory (void)
 static GFile *desktop_dir = NULL;
 static GFile *desktop_dir_dir = NULL;
 static char *desktop_dir_filename = NULL;
-static gboolean desktop_dir_changed_callback_installed = FALSE;
 
 
 static void
@@ -574,12 +567,6 @@ desktop_dir_changed (void)
 }
 
 static void
-desktop_dir_changed_callback (gpointer callback_data)
-{
-	desktop_dir_changed ();
-}
-
-static void
 update_desktop_dir (void)
 {
 	char *path;
@@ -644,13 +631,6 @@ nautilus_is_desktop_directory_file (GFile *dir,
 				    const char *file)
 {
 
-	if (!desktop_dir_changed_callback_installed) {
-		g_signal_connect_swapped (nautilus_preferences, "changed::" NAUTILUS_PREFERENCES_DESKTOP_IS_HOME_DIR,
-					  G_CALLBACK(desktop_dir_changed_callback),
-					  NULL);
-		desktop_dir_changed_callback_installed = TRUE;
-	}
-
 	if (desktop_dir == NULL) {
 		update_desktop_dir ();
 	}
@@ -663,13 +643,6 @@ gboolean
 nautilus_is_desktop_directory (GFile *dir)
 {
 
-	if (!desktop_dir_changed_callback_installed) {
-		g_signal_connect_swapped (nautilus_preferences, "changed::" NAUTILUS_PREFERENCES_DESKTOP_IS_HOME_DIR,
-					  G_CALLBACK(desktop_dir_changed_callback),
-					  NULL);
-		desktop_dir_changed_callback_installed = TRUE;
-	}
-
 	if (desktop_dir == NULL) {
 		update_desktop_dir ();
 	}
diff --git a/libnautilus-private/nautilus-global-preferences.h b/libnautilus-private/nautilus-global-preferences.h
index 89cd8ed..89a569f 100644
--- a/libnautilus-private/nautilus-global-preferences.h
+++ b/libnautilus-private/nautilus-global-preferences.h
@@ -35,9 +35,6 @@ G_BEGIN_DECLS
 #define NAUTILUS_PREFERENCES_CONFIRM_TRASH			"confirm-trash"
 #define NAUTILUS_PREFERENCES_ENABLE_DELETE			"enable-delete"
 
-/* Desktop options */
-#define NAUTILUS_PREFERENCES_DESKTOP_IS_HOME_DIR                "desktop-is-home-dir"
-
 /* Display  */
 #define NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES			"show-hidden-files"
 #define NAUTILUS_PREFERENCES_SHOW_ADVANCED_PERMISSIONS		"show-advanced-permissions"
diff --git a/libnautilus-private/nautilus.convert b/libnautilus-private/nautilus.convert
index af11103..a8fff15 100644
--- a/libnautilus-private/nautilus.convert
+++ b/libnautilus-private/nautilus.convert
@@ -18,7 +18,6 @@ show-advanced-permissions = /apps/nautilus/preferences/show_advanced_permissions
 sort-directories-first = /apps/nautilus/preferences/sort_directories_first
 default-sort-order = /apps/nautilus/icon_view/default_sort_order
 default-sort-in-reverse-order = /apps/nautilus/icon_view/default_sort_in_reverse_order
-desktop-is-home-dir = /apps/nautilus/preferences/desktop_is_home_dir
 default-folder-viewer = /apps/nautilus/preferences/default_folder_viewer
 date-format = /apps/nautilus/preferences/date_format
 show-hidden-files = /desktop/gnome/file_views/show_hidden_files
diff --git a/libnautilus-private/org.gnome.nautilus.gschema.xml.in b/libnautilus-private/org.gnome.nautilus.gschema.xml.in
index 592565c..7419e26 100644
--- a/libnautilus-private/org.gnome.nautilus.gschema.xml.in
+++ b/libnautilus-private/org.gnome.nautilus.gschema.xml.in
@@ -168,11 +168,6 @@
       <_summary>Reverse sort order in new windows</_summary>
       <_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.</_description>
     </key>
-    <key name="desktop-is-home-dir" type="b">
-      <default>false</default>
-      <_summary>Nautilus uses the users home folder as the desktop</_summary>
-      <_description>If set to true, then Nautilus will use the user's home folder as the desktop.  If it is false, then it will use ~/Desktop as the desktop.</_description>
-    </key>
     <key name="default-folder-viewer" enum="org.gnome.nautilus.FolderView">
       <aliases>
         <alias value='icon_view' target='icon-view'/>
diff --git a/src/nautilus-desktop-icon-view.c b/src/nautilus-desktop-icon-view.c
index 805a149..6e5aac9 100644
--- a/src/nautilus-desktop-icon-view.c
+++ b/src/nautilus-desktop-icon-view.c
@@ -94,13 +94,6 @@ static time_t desktop_dir_modify_time;
 #define get_icon_container(w) nautilus_icon_view_get_icon_container(NAUTILUS_ICON_VIEW (w))
 
 static void
-desktop_directory_changed_callback (gpointer callback_data)
-{
-	g_free (desktop_directory);
-	desktop_directory = nautilus_get_desktop_directory ();
-}
-
-static void
 icon_container_set_workarea (NautilusIconContainer *icon_container,
 			     GdkScreen             *screen,
 			     long                  *workareas,
@@ -288,11 +281,6 @@ nautilus_desktop_icon_view_dispose (GObject *object)
 	g_signal_handlers_disconnect_by_func (nautilus_preferences,
 					      font_changed_callback,
 					      icon_view);
-
-	g_signal_handlers_disconnect_by_func (nautilus_preferences,
-					      desktop_directory_changed_callback,
-					      NULL);
-
 	g_signal_handlers_disconnect_by_func (gnome_lockdown_preferences,
 					      nautilus_view_update_menus,
 					      icon_view);
@@ -566,10 +554,7 @@ nautilus_desktop_icon_view_init (NautilusDesktopIconView *desktop_icon_view)
 								  NautilusDesktopIconViewDetails);
 
 	if (desktop_directory == NULL) {
-		g_signal_connect_swapped (nautilus_preferences, "changed::" NAUTILUS_PREFERENCES_DESKTOP_IS_HOME_DIR,
-					  G_CALLBACK(desktop_directory_changed_callback),
-					  NULL);
-		desktop_directory_changed_callback (NULL);
+		desktop_directory = nautilus_get_desktop_directory ();
 	}
 
 	nautilus_icon_view_filter_by_screen (NAUTILUS_ICON_VIEW (desktop_icon_view), TRUE);
diff --git a/src/nautilus-desktop-window.c b/src/nautilus-desktop-window.c
index ad01588..abead5f 100644
--- a/src/nautilus-desktop-window.c
+++ b/src/nautilus-desktop-window.c
@@ -63,18 +63,6 @@ nautilus_desktop_window_update_directory (NautilusDesktopWindow *window)
 }
 
 static void
-nautilus_desktop_window_dispose (GObject *obj)
-{
-	NautilusDesktopWindow *window = NAUTILUS_DESKTOP_WINDOW (obj);
-
-	g_signal_handlers_disconnect_by_func (nautilus_preferences,
-					      nautilus_desktop_window_update_directory,
-					      window);
-
-	G_OBJECT_CLASS (nautilus_desktop_window_parent_class)->dispose (obj);
-}
-
-static void
 nautilus_desktop_window_constructed (GObject *obj)
 {
 	GtkActionGroup *action_group;
@@ -106,12 +94,6 @@ nautilus_desktop_window_constructed (GObject *obj)
 	if (accessible) {
 		atk_object_set_name (accessible, _("Desktop"));
 	}
-
-	/* Monitor the preference to have the desktop */
-	/* point to the Unix home folder */
-	g_signal_connect_swapped (nautilus_preferences, "changed::" NAUTILUS_PREFERENCES_DESKTOP_IS_HOME_DIR,
-				  G_CALLBACK (nautilus_desktop_window_update_directory),
-				  window);
 }
 
 static void
@@ -306,7 +288,6 @@ nautilus_desktop_window_class_init (NautilusDesktopWindowClass *klass)
 	GObjectClass *oclass = G_OBJECT_CLASS (klass);
 
 	oclass->constructed = nautilus_desktop_window_constructed;
-	oclass->dispose = nautilus_desktop_window_dispose;
 
 	wclass->realize = realize;
 	wclass->unrealize = unrealize;
diff --git a/src/nautilus-pathbar.c b/src/nautilus-pathbar.c
index 36fe6a3..c0317bb 100644
--- a/src/nautilus-pathbar.c
+++ b/src/nautilus-pathbar.c
@@ -61,8 +61,6 @@ typedef enum {
 
 static guint path_bar_signals [LAST_SIGNAL] = { 0 };
 
-static gboolean desktop_is_home;
-
 #define NAUTILUS_PATH_BAR_ICON_SIZE 16
 
 typedef struct _ButtonData ButtonData;
@@ -130,43 +128,6 @@ get_slider_button (NautilusPathBar  *path_bar,
 }
 
 static void
-update_button_types (NautilusPathBar *path_bar)
-{
-	GList *list;
-	GFile *path = NULL;
-
-	for (list = path_bar->button_list; list; list = list->next) {
-		ButtonData *button_data;
-		button_data = BUTTON_DATA (list->data);
-		if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button_data->button))) {
-			path = g_object_ref (button_data->path);
-			break;
-		}
-        }
-	if (path != NULL) {
-		nautilus_path_bar_update_path (path_bar, path, TRUE);
-		g_object_unref (path);
-	}
-}
-
-
-static void
-desktop_location_changed_callback (gpointer user_data)
-{
-	NautilusPathBar *path_bar;
-	
-	path_bar = NAUTILUS_PATH_BAR (user_data);
-	
-	g_object_unref (path_bar->desktop_path);
-	g_object_unref (path_bar->home_path);
-	path_bar->desktop_path = nautilus_get_desktop_location ();
-	path_bar->home_path = g_file_new_for_path (g_get_home_dir ());
-	desktop_is_home = g_file_equal (path_bar->home_path, path_bar->desktop_path);
-	
-	update_button_types (path_bar);
-}
-
-static void
 trash_state_changed_cb (NautilusTrashMonitor *monitor,
                         gboolean state,
                         NautilusPathBar *path_bar)
@@ -274,11 +235,6 @@ nautilus_path_bar_init (NautilusPathBar *path_bar)
 	g_free (p);
 	path_bar->home_path = g_file_new_for_path (g_get_home_dir ());
 	path_bar->root_path = g_file_new_for_path ("/");
-	desktop_is_home = g_file_equal (path_bar->home_path, path_bar->desktop_path);
-
-	g_signal_connect_swapped (nautilus_preferences, "changed::" NAUTILUS_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 (nautilus_path_bar_scroll_up), path_bar);
         g_signal_connect_swapped (path_bar->down_slider_button, "clicked", G_CALLBACK (nautilus_path_bar_scroll_down), path_bar);
@@ -339,9 +295,6 @@ nautilus_path_bar_finalize (GObject *object)
 
 	g_signal_handlers_disconnect_by_func (nautilus_trash_monitor_get (),
 					      trash_state_changed_cb, path_bar);
-	g_signal_handlers_disconnect_by_func (nautilus_preferences,
-					      desktop_location_changed_callback,
-					      path_bar);
 
         G_OBJECT_CLASS (nautilus_path_bar_parent_class)->finalize (object);
 }
@@ -1455,11 +1408,7 @@ setup_button_type (ButtonData       *button_data,
 		button_data->type = HOME_BUTTON;
 		button_data->fake_root = TRUE;
 	} else if (path_bar->desktop_path != NULL && g_file_equal (location, path_bar->desktop_path)) {
-		if (!desktop_is_home) {
-			button_data->type = DESKTOP_BUTTON;
-		} else {
-			button_data->type = NORMAL_BUTTON;
-		}
+		button_data->type = DESKTOP_BUTTON;
 	} else if (setup_file_path_mounted_mount (location, button_data)) {
 		/* already setup */
 	} else {
diff --git a/src/nautilus-places-sidebar.c b/src/nautilus-places-sidebar.c
index a5b366e..bd5ccbf 100644
--- a/src/nautilus-places-sidebar.c
+++ b/src/nautilus-places-sidebar.c
@@ -261,8 +261,7 @@ get_eject_icon (NautilusPlacesSidebar *sidebar,
 static gboolean
 should_show_desktop (void)
 {
-	return g_settings_get_boolean (gnome_background_preferences, NAUTILUS_PREFERENCES_SHOW_DESKTOP) &&
-	       !g_settings_get_boolean (nautilus_preferences, NAUTILUS_PREFERENCES_DESKTOP_IS_HOME_DIR);
+	return g_settings_get_boolean (gnome_background_preferences, NAUTILUS_PREFERENCES_SHOW_DESKTOP);
 }
 
 static gboolean
@@ -3401,10 +3400,6 @@ nautilus_places_sidebar_init (NautilusPlacesSidebar *sidebar)
 	eel_gtk_tree_view_set_activate_on_single_click (sidebar->tree_view,
 							TRUE);
 
-	g_signal_connect_swapped (nautilus_preferences, "changed::" NAUTILUS_PREFERENCES_DESKTOP_IS_HOME_DIR,
-				  G_CALLBACK(desktop_setting_changed_callback),
-				  sidebar);
-
 	g_signal_connect_swapped (gnome_background_preferences, "changed::" NAUTILUS_PREFERENCES_SHOW_DESKTOP,
 				  G_CALLBACK(desktop_setting_changed_callback),
 				  sidebar);
@@ -3451,10 +3446,6 @@ nautilus_places_sidebar_dispose (GObject *object)
 	}
 
 	g_signal_handlers_disconnect_by_func (nautilus_preferences,
-					      desktop_setting_changed_callback,
-					      sidebar);
-
-	g_signal_handlers_disconnect_by_func (nautilus_preferences,
 					      bookmarks_popup_menu_detach_cb,
 					      sidebar);
 
diff --git a/src/nautilus-view.c b/src/nautilus-view.c
index 374466f..fcc310b 100644
--- a/src/nautilus-view.c
+++ b/src/nautilus-view.c
@@ -8668,8 +8668,7 @@ real_update_menus (NautilusView *view)
 
 
 	show_desktop_target =
-		g_settings_get_boolean (gnome_background_preferences, NAUTILUS_PREFERENCES_SHOW_DESKTOP) &&
-		!g_settings_get_boolean (nautilus_preferences, NAUTILUS_PREFERENCES_DESKTOP_IS_HOME_DIR);
+		g_settings_get_boolean (gnome_background_preferences, NAUTILUS_PREFERENCES_SHOW_DESKTOP);
 
 	action = gtk_action_group_get_action (view->details->dir_action_group,
 					      NAUTILUS_ACTION_COPY_TO_HOME);



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