diff options
author | John Sullivan <sullivan@src.gnome.org> | 2000-09-18 19:04:06 +0000 |
---|---|---|
committer | John Sullivan <sullivan@src.gnome.org> | 2000-09-18 19:04:06 +0000 |
commit | 5d1ba62516557ae9f15f5ee10baa60e711701a91 (patch) | |
tree | 591b8c30495f08e1bb6342c3cfb8533104f372ef /libnautilus-extensions/nautilus-directory.c | |
parent | 14bc29ad391917e9baa2cc54fe585a69299cebe7 (diff) | |
download | nautilus-5d1ba62516557ae9f15f5ee10baa60e711701a91.tar.gz |
Fixed bug 2243 (trash window name should be "Trash"
with a capital T, localized)
* libnautilus-extensions/nautilus-directory-private.h:
Added prototype for nautilus_directory_get_
name_for_self_as_new_file
* libnautilus-extensions/nautilus-directory.h,
* libnautilus-extensions/nautilus-directory.c:
(nautilus_directory_initialize_class),
(nautilus_directory_get_name_for_self_as_new_file),
(real_get_name_for_self_as_new_file): wired up new
overridable function pointer "get_name_for_self_as_new_file"
that's used to get the name from directories that aren't
vfs directories. Default implementation returns the scheme.
* libnautilus-extensions/nautilus-file.c:
(nautilus_file_get_internal): Use nautilus_directory_
get_name_for_self_as_new_file instead of hardwiring
scheme-getting logic here.
* libnautilus-extensions/nautilus-trash-directory.c:
(trash_get_name_for_self_as_new_file),
(nautilus_trash_directory_initialize_class):
Override get_name_for_self_as_new_file to return _("Trash").
* src/nautilus-window-manage-views.c:
(compute_default_title): Use NautilusFile to get the
default window title. Formerly it was using some similar
but slightly different logic to what nautilus_file uses
to get a name to display.
* src/nautilus-window-menus.c: (help_menu_about_nautilus_callback):
* AUTHORS: Gave credit where credit was due.
Diffstat (limited to 'libnautilus-extensions/nautilus-directory.c')
-rw-r--r-- | libnautilus-extensions/nautilus-directory.c | 42 |
1 files changed, 40 insertions, 2 deletions
diff --git a/libnautilus-extensions/nautilus-directory.c b/libnautilus-extensions/nautilus-directory.c index 2dd6c6610..f42bb8179 100644 --- a/libnautilus-extensions/nautilus-directory.c +++ b/libnautilus-extensions/nautilus-directory.c @@ -66,15 +66,17 @@ static GHashTable *directories; static void nautilus_directory_destroy (GtkObject *object); static void nautilus_directory_initialize (gpointer object, gpointer klass); -static void nautilus_directory_initialize_class (gpointer klass); +static void nautilus_directory_initialize_class (NautilusDirectoryClass *klass); static GnomeVFSResult nautilus_make_directory_and_parents (GnomeVFSURI *uri, guint permissions); static NautilusDirectory *nautilus_directory_new (const char *uri); +static char *real_get_name_for_self_as_new_file (NautilusDirectory *directory); + NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusDirectory, nautilus_directory, GTK_TYPE_OBJECT) static void -nautilus_directory_initialize_class (gpointer klass) +nautilus_directory_initialize_class (NautilusDirectoryClass *klass) { GtkObjectClass *object_class; @@ -112,6 +114,8 @@ nautilus_directory_initialize_class (gpointer klass) GTK_TYPE_NONE, 0); gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL); + + klass->get_name_for_self_as_new_file = real_get_name_for_self_as_new_file; } static void @@ -297,6 +301,40 @@ nautilus_directory_get_existing (const char *uri) return nautilus_directory_get_internal (uri, FALSE); } +/* nautilus_directory_get_name_for_self_as_new_file: + * + * Get a name to display for the file representing this + * directory. This is called only when there's no VFS + * directory for this NautilusDirectory. + */ +char * +nautilus_directory_get_name_for_self_as_new_file (NautilusDirectory *directory) +{ + g_return_val_if_fail (NAUTILUS_IS_DIRECTORY (directory), NULL); + + return NAUTILUS_CALL_VIRTUAL + (NAUTILUS_DIRECTORY_CLASS, directory, + get_name_for_self_as_new_file, (directory)); +} + +static char * +real_get_name_for_self_as_new_file (NautilusDirectory *directory) +{ + const char *directory_uri; + char *name, *colon; + + directory_uri = directory->details->uri; + + colon = strchr (directory_uri, ':'); + if (colon == NULL) { + name = g_strdup (directory_uri); + } else { + name = g_strndup (directory_uri, colon - directory_uri); + } + + return name; +} + char * nautilus_directory_get_uri (NautilusDirectory *directory) { |