[gtk+/places-sidebar: 43/53] Replacement for nautilus_get_desktop_directory()
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/places-sidebar: 43/53] Replacement for nautilus_get_desktop_directory()
- Date: Tue, 4 Sep 2012 02:36:23 +0000 (UTC)
commit 9de31fc317458a41a42bd60873e78422b43e6d44
Author: Federico Mena Quintero <federico gnome org>
Date: Wed Oct 5 08:46:43 2011 -0500
Replacement for nautilus_get_desktop_directory()
Signed-off-by: Federico Mena Quintero <federico gnome org>
gtk/gtkplacessidebar.c | 22 ++++++++++++++++++----
1 files changed, 18 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtkplacessidebar.c b/gtk/gtkplacessidebar.c
index 78d58f6..6bb9d52 100644
--- a/gtk/gtkplacessidebar.c
+++ b/gtk/gtkplacessidebar.c
@@ -523,6 +523,22 @@ get_gicon_for_user_special_directory (GUserDirectory directory)
#undef ICON_CASE
}
+static const char *
+get_desktop_directory (void)
+{
+ const char *name;
+
+ name = g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP);
+ /* "To disable a directory, point it to the homedir."
+ * See http://freedesktop.org/wiki/Software/xdg-user-dirs
+ **/
+ if (!g_strcmp0 (name, g_get_home_dir ())) {
+ return NULL;
+ } else {
+ return name;
+ }
+}
+
static void
update_places (GtkPlacesSidebar *sidebar)
{
@@ -761,9 +777,9 @@ update_places (GtkPlacesSidebar *sidebar)
g_free (mount_uri);
}
- if (sidebar->show_desktop) {
+ desktop_path = get_desktop_directory ();
+ if (sidebar->show_desktop && desktop_path) {
/* desktop */
- desktop_path = nautilus_get_desktop_directory ();
mount_uri = g_filename_to_uri (desktop_path, NULL, NULL);
icon = g_themed_icon_new (ICON_NAME_DESKTOP);
last_iter = add_place (sidebar, PLACES_BUILT_IN,
@@ -776,10 +792,8 @@ update_places (GtkPlacesSidebar *sidebar)
sidebar->uri, mount_uri, last_uri,
&last_iter, &select_path);
g_free (mount_uri);
- g_free (desktop_path);
}
-
/* XDG directories */
for (index = 0; index < G_USER_N_DIRECTORIES; index++) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]