[gtk+/places-sidebar] Replacement for nautilus_get_home_directory_uri()
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/places-sidebar] Replacement for nautilus_get_home_directory_uri()
- Date: Mon, 3 Oct 2011 21:51:40 +0000 (UTC)
commit 2827b7475e76540adeaaf120e1752b647806861b
Author: Federico Mena Quintero <federico gnome org>
Date: Mon Oct 3 11:08:25 2011 -0500
Replacement for nautilus_get_home_directory_uri()
Signed-off-by: Federico Mena Quintero <federico gnome org>
gtk/gtkplacessidebar.c | 38 ++++++++++++++++++++++++++------------
1 files changed, 26 insertions(+), 12 deletions(-)
---
diff --git a/gtk/gtkplacessidebar.c b/gtk/gtkplacessidebar.c
index 0aa05e4..f930fea 100644
--- a/gtk/gtkplacessidebar.c
+++ b/gtk/gtkplacessidebar.c
@@ -411,6 +411,18 @@ compare_for_selection (GtkPlacesSidebar *sidebar,
}
}
+static char *
+get_home_directory_uri (void)
+{
+ const char *home;
+
+ home = g_get_home_dir ();
+ if (!home)
+ return NULL;
+
+ return g_strconcat ("file://", home, NULL);
+}
+
static void
update_places (GtkPlacesSidebar *sidebar)
{
@@ -638,18 +650,20 @@ update_places (GtkPlacesSidebar *sidebar)
/* add built in bookmarks */
/* home folder */
- mount_uri = nautilus_get_home_directory_uri ();
- icon = g_themed_icon_new (NAUTILUS_ICON_HOME);
- last_iter = add_place (sidebar, PLACES_BUILT_IN,
- SECTION_COMPUTER,
- _("Home"), icon,
- mount_uri, NULL, NULL, NULL, 0,
- _("Open your personal folder"));
- g_object_unref (icon);
- compare_for_selection (sidebar,
- location, mount_uri, last_uri,
- &last_iter, &select_path);
- g_free (mount_uri);
+ mount_uri = get_home_directory_uri ();
+ if (mount_uri) {
+ icon = g_themed_icon_new ("user-home");
+ last_iter = add_place (sidebar, PLACES_BUILT_IN,
+ SECTION_COMPUTER,
+ _("Home"), icon,
+ mount_uri, NULL, NULL, NULL, 0,
+ _("Open your personal folder"));
+ g_object_unref (icon);
+ compare_for_selection (sidebar,
+ location, mount_uri, last_uri,
+ &last_iter, &select_path);
+ g_free (mount_uri);
+ }
if (g_settings_get_boolean (gnome_background_preferences, NAUTILUS_PREFERENCES_SHOW_DESKTOP) &&
!g_settings_get_boolean (nautilus_preferences, NAUTILUS_PREFERENCES_DESKTOP_IS_HOME_DIR)) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]