diff options
author | Cosimo Cecchi <cosimoc@gnome.org> | 2011-01-10 10:15:18 +0100 |
---|---|---|
committer | Cosimo Cecchi <cosimoc@gnome.org> | 2011-01-10 10:17:48 +0100 |
commit | 120797cec00929dac58ac4ac838719dc67e9cae0 (patch) | |
tree | bb2a75fc96d7f55d6612ee2f120e01653dc4dbca /libnautilus-private/nautilus-bookmark.c | |
parent | 50e0c03f67072e374f8202ba7a25221fa7f88b99 (diff) | |
download | nautilus-120797cec00929dac58ac4ac838719dc67e9cae0.tar.gz |
Use a consistent name for the Home folder (#341894)
Based on a patchset by Marcus Husar
<marcus.husar@rose.uni-heidelberg.de>
Diffstat (limited to 'libnautilus-private/nautilus-bookmark.c')
-rw-r--r-- | libnautilus-private/nautilus-bookmark.c | 42 |
1 files changed, 30 insertions, 12 deletions
diff --git a/libnautilus-private/nautilus-bookmark.c b/libnautilus-private/nautilus-bookmark.c index 94009caab..36dba9fe7 100644 --- a/libnautilus-private/nautilus-bookmark.c +++ b/libnautilus-private/nautilus-bookmark.c @@ -31,8 +31,9 @@ #include <eel/eel-gtk-macros.h> #include <eel/eel-string.h> #include <eel/eel-vfs-extensions.h> -#include <gtk/gtk.h> #include <gio/gio.h> +#include <glib/gi18n.h> +#include <gtk/gtk.h> #include <libnautilus-private/nautilus-file.h> #include <libnautilus-private/nautilus-icon-names.h> @@ -195,7 +196,7 @@ nautilus_bookmark_copy (NautilusBookmark *bookmark) char * nautilus_bookmark_get_name (NautilusBookmark *bookmark) { - g_return_val_if_fail(NAUTILUS_IS_BOOKMARK (bookmark), NULL); + g_return_val_if_fail (NAUTILUS_IS_BOOKMARK (bookmark), NULL); return g_strdup (bookmark->details->name); } @@ -413,9 +414,15 @@ bookmark_file_changed_callback (NautilusFile *file, NautilusBookmark *bookmark) if (!bookmark->details->has_custom_name) { display_name = nautilus_file_get_display_name (file); + + if (nautilus_file_is_home (file)) { + g_free (bookmark->details->name); + g_free (display_name); - if (strcmp (bookmark->details->name, display_name) != 0) { + bookmark->details->name = g_strdup (_("Home")); + } else if (strcmp (bookmark->details->name, display_name) != 0) { g_free (bookmark->details->name); + bookmark->details->name = display_name; should_emit_appearance_changed_signal = TRUE; } else { @@ -516,13 +523,20 @@ nautilus_bookmark_connect_file (NautilusBookmark *bookmark) if (!bookmark->details->has_custom_name && bookmark->details->file && nautilus_file_check_if_ready (bookmark->details->file, NAUTILUS_FILE_ATTRIBUTE_INFO)) { - display_name = nautilus_file_get_display_name (bookmark->details->file); - if (strcmp (bookmark->details->name, display_name) != 0) { - g_free (bookmark->details->name); - bookmark->details->name = display_name; - } else { - g_free (display_name); - } + display_name = nautilus_file_get_display_name (bookmark->details->file); + + if (nautilus_file_is_home (bookmark->details->file)) { + g_free (bookmark->details->name); + g_free (display_name); + + bookmark->details->name = g_strdup (_("Home")); + } else if (strcmp (bookmark->details->name, display_name) != 0) { + g_free (bookmark->details->name); + + bookmark->details->name = display_name; + } else { + g_free (display_name); + } } } @@ -577,8 +591,10 @@ nautilus_bookmark_menu_item_new (NautilusBookmark *bookmark) GtkWidget *menu_item; GtkWidget *image_widget; GtkLabel *label; - - menu_item = gtk_image_menu_item_new_with_label (bookmark->details->name); + char *name; + + name = nautilus_bookmark_get_name (bookmark); + menu_item = gtk_image_menu_item_new_with_label (name); label = GTK_LABEL (gtk_bin_get_child (GTK_BIN (menu_item))); gtk_label_set_use_underline (label, FALSE); gtk_label_set_ellipsize (label, PANGO_ELLIPSIZE_END); @@ -591,6 +607,8 @@ nautilus_bookmark_menu_item_new (NautilusBookmark *bookmark) image_widget); } + g_free (name); + return menu_item; } |