summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCosimo Cecchi <cosimoc@gnome.org>2011-01-10 10:15:18 +0100
committerCosimo Cecchi <cosimoc@gnome.org>2011-01-10 10:17:48 +0100
commit120797cec00929dac58ac4ac838719dc67e9cae0 (patch)
treebb2a75fc96d7f55d6612ee2f120e01653dc4dbca
parent50e0c03f67072e374f8202ba7a25221fa7f88b99 (diff)
downloadnautilus-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>
-rw-r--r--libnautilus-private/nautilus-bookmark.c42
-rw-r--r--libnautilus-private/nautilus-desktop-link.c10
-rw-r--r--src/file-manager/fm-directory-view.c4
-rw-r--r--src/nautilus-places-sidebar.c10
-rw-r--r--src/nautilus-tree-sidebar.c2
-rw-r--r--src/nautilus-window-menus.c2
-rw-r--r--src/nautilus-window-slot.c4
7 files changed, 41 insertions, 33 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;
}
diff --git a/libnautilus-private/nautilus-desktop-link.c b/libnautilus-private/nautilus-desktop-link.c
index 220401d28..b34f5f862 100644
--- a/libnautilus-private/nautilus-desktop-link.c
+++ b/libnautilus-private/nautilus-desktop-link.c
@@ -117,15 +117,7 @@ home_name_changed (gpointer callback_data)
NAUTILUS_PREFERENCES_DESKTOP_HOME_NAME);
if (link->details->display_name[0] == 0) {
g_free (link->details->display_name);
- /* Note to translators: If it's hard to compose a good home
- * icon name from the user name, you can use a string without
- * an "%s" here, in which case the home icon name will not
- * include the user's name, which should be fine. To avoid a
- * warning, put "%.0s" somewhere in the string, which will
- * match the user name string passed by the C code, but not
- * put the user name in the final string.
- */
- link->details->display_name = g_strdup_printf (_("%s's Home"), g_get_user_name ());
+ link->details->display_name = g_strdup (_("Home"));
}
nautilus_desktop_link_changed (link);
diff --git a/src/file-manager/fm-directory-view.c b/src/file-manager/fm-directory-view.c
index 0ac2d1855..db31c7a48 100644
--- a/src/file-manager/fm-directory-view.c
+++ b/src/file-manager/fm-directory-view.c
@@ -7312,11 +7312,11 @@ static const GtkActionEntry directory_view_entries[] = {
NULL, N_("Move the current selection to the other pane in the window"),
G_CALLBACK (action_move_to_next_pane_callback) },
/* name, stock id, label */ {FM_ACTION_COPY_TO_HOME, NAUTILUS_ICON_HOME,
- N_("_Home Folder"), NULL,
+ N_("_Home"), NULL,
N_("Copy the current selection to the home folder"),
G_CALLBACK (action_copy_to_home_callback) },
/* name, stock id, label */ {FM_ACTION_MOVE_TO_HOME, NAUTILUS_ICON_HOME,
- N_("_Home Folder"), NULL,
+ N_("_Home"), NULL,
N_("Move the current selection to the home folder"),
G_CALLBACK (action_move_to_home_callback) },
/* name, stock id, label */ {FM_ACTION_COPY_TO_DESKTOP, NAUTILUS_ICON_DESKTOP,
diff --git a/src/nautilus-places-sidebar.c b/src/nautilus-places-sidebar.c
index 30af74094..1e6b65ba2 100644
--- a/src/nautilus-places-sidebar.c
+++ b/src/nautilus-places-sidebar.c
@@ -242,6 +242,10 @@ is_built_in_bookmark (NautilusFile *file)
gboolean built_in;
gint idx;
+ if (nautilus_file_is_home (file)) {
+ return TRUE;
+ }
+
built_in = FALSE;
for (idx = 0; idx < G_USER_N_DIRECTORIES; idx++) {
@@ -631,18 +635,14 @@ update_places (NautilusPlacesSidebar *sidebar)
/* home folder */
if (strcmp (g_get_home_dir(), desktop_path) != 0) {
- char *display_name;
-
mount_uri = nautilus_get_home_directory_uri ();
- display_name = g_filename_display_basename (g_get_home_dir ());
icon = g_themed_icon_new (NAUTILUS_ICON_HOME);
last_iter = add_place (sidebar, PLACES_BUILT_IN,
SECTION_COMPUTER,
- display_name, icon,
+ _("Home"), icon,
mount_uri, NULL, NULL, NULL, 0,
_("Open your personal folder"));
g_object_unref (icon);
- g_free (display_name);
compare_for_selection (sidebar,
location, mount_uri, last_uri,
&last_iter, &select_path);
diff --git a/src/nautilus-tree-sidebar.c b/src/nautilus-tree-sidebar.c
index 9a4cc812f..fedb18eca 100644
--- a/src/nautilus-tree-sidebar.c
+++ b/src/nautilus-tree-sidebar.c
@@ -1313,7 +1313,7 @@ create_tree (FMTreeView *view)
view, G_CONNECT_AFTER);
home_uri = nautilus_get_home_directory_uri ();
icon = g_themed_icon_new (NAUTILUS_ICON_HOME);
- fm_tree_model_add_root_uri (view->details->child_model, home_uri, _("Home Folder"), icon, NULL);
+ fm_tree_model_add_root_uri (view->details->child_model, home_uri, _("Home"), icon, NULL);
g_object_unref (icon);
g_free (home_uri);
icon = g_themed_icon_new (NAUTILUS_ICON_FILESYSTEM);
diff --git a/src/nautilus-window-menus.c b/src/nautilus-window-menus.c
index 046759b44..f78f3f101 100644
--- a/src/nautilus-window-menus.c
+++ b/src/nautilus-window-menus.c
@@ -820,7 +820,7 @@ static const GtkActionEntry main_entries[] = {
/* tooltip */ N_("Connect to a remote computer or shared disk"),
G_CALLBACK (action_connect_to_server_callback) },
/* name, stock id */ { "Home", NAUTILUS_ICON_HOME,
- /* label, accelerator */ N_("_Home Folder"), "<alt>Home",
+ /* label, accelerator */ N_("_Home"), "<alt>Home",
/* tooltip */ N_("Open your personal folder"),
G_CALLBACK (action_home_callback) },
/* name, stock id */ { "Go to Computer", NAUTILUS_ICON_COMPUTER,
diff --git a/src/nautilus-window-slot.c b/src/nautilus-window-slot.c
index d7313c0d2..8be9a2da4 100644
--- a/src/nautilus-window-slot.c
+++ b/src/nautilus-window-slot.c
@@ -308,9 +308,7 @@ nautilus_window_slot_set_title (NautilusWindowSlot *slot,
slot->title = g_strdup (title);
}
- if (eel_strlen (slot->title) > 0 && slot->current_location_bookmark &&
- nautilus_bookmark_set_name (slot->current_location_bookmark,
- slot->title)) {
+ if (eel_strlen (slot->title) > 0 && slot->current_location_bookmark) {
changed = TRUE;
/* Name of item in history list changed, tell listeners. */