summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--AUTHORS1
-rw-r--r--ChangeLog35
-rw-r--r--libnautilus-extensions/nautilus-directory-private.h1
-rw-r--r--libnautilus-extensions/nautilus-directory.c42
-rw-r--r--libnautilus-extensions/nautilus-directory.h1
-rw-r--r--libnautilus-extensions/nautilus-file.c15
-rw-r--r--libnautilus-extensions/nautilus-trash-directory.c13
-rw-r--r--libnautilus-private/nautilus-directory-private.h1
-rw-r--r--libnautilus-private/nautilus-directory.c42
-rw-r--r--libnautilus-private/nautilus-directory.h1
-rw-r--r--libnautilus-private/nautilus-file.c15
-rw-r--r--libnautilus-private/nautilus-trash-directory.c13
-rw-r--r--src/nautilus-navigation-window-menus.c1
-rw-r--r--src/nautilus-window-manage-views.c36
-rw-r--r--src/nautilus-window-menus.c1
15 files changed, 163 insertions, 55 deletions
diff --git a/AUTHORS b/AUTHORS
index 493409eb2..3db6f1066 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -10,6 +10,7 @@ Gene Z. Ragan <gzr@eazel.com>
George Lebl <jirka@5z.com>
Ian McKellar <yakk@yakk.net.au>
John Sullivan <sullivan@eazel.com>
+Josh Barrow <linuxfan@ionet.net>
J Shane Culpepper <pepper@eazel.com>
Maciej Stachowiak <mjs@eazel.com>
Mathieu Lacage <mathieu@eazel.com>
diff --git a/ChangeLog b/ChangeLog
index 6b60dc5fd..abeaaf57c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,38 @@
+2000-09-18 John Sullivan <sullivan@eazel.com>
+
+ 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.
+
2000-09-18 Gene Z. Ragan <gzr@eazel.com>
Fixed bug 3017, should not be able to copy desktop items
diff --git a/libnautilus-extensions/nautilus-directory-private.h b/libnautilus-extensions/nautilus-directory-private.h
index bbf177e10..943277d10 100644
--- a/libnautilus-extensions/nautilus-directory-private.h
+++ b/libnautilus-extensions/nautilus-directory-private.h
@@ -148,6 +148,7 @@ void nautilus_directory_emit_change_signals_deep (NautilusDi
void nautilus_directory_emit_done_loading (NautilusDirectory *directory);
NautilusDirectory *nautilus_directory_get_internal (const char *uri,
gboolean create);
+char *nautilus_directory_get_name_for_self_as_new_file (NautilusDirectory *directory);
/* debugging functions */
int nautilus_directory_number_outstanding (void);
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)
{
diff --git a/libnautilus-extensions/nautilus-directory.h b/libnautilus-extensions/nautilus-directory.h
index 03c2dabd7..f379d7cdd 100644
--- a/libnautilus-extensions/nautilus-directory.h
+++ b/libnautilus-extensions/nautilus-directory.h
@@ -127,6 +127,7 @@ typedef struct
gconstpointer client);
gboolean (* are_all_files_seen) (NautilusDirectory *directory);
gboolean (* is_not_empty) (NautilusDirectory *directory);
+ char * (* get_name_for_self_as_new_file) (NautilusDirectory *directory);
} NautilusDirectoryClass;
/* Basic GtkObject requirements. */
diff --git a/libnautilus-extensions/nautilus-file.c b/libnautilus-extensions/nautilus-file.c
index b5a60a2ce..7e7221290 100644
--- a/libnautilus-extensions/nautilus-file.c
+++ b/libnautilus-extensions/nautilus-file.c
@@ -253,7 +253,7 @@ nautilus_file_get_internal (const char *uri, gboolean create)
GnomeVFSURI *vfs_uri, *directory_vfs_uri;
char *directory_uri;
NautilusDirectory *directory;
- char *file_name_escaped, *file_name, *colon;
+ char *file_name_escaped, *file_name;
NautilusFile *file;
g_return_val_if_fail (uri != NULL, NULL);
@@ -286,18 +286,7 @@ nautilus_file_get_internal (const char *uri, gboolean create)
if (directory == NULL) {
file_name = NULL;
} else {
- /* Name is URI (from directory in case it's
- * made canonical), but scheme part only if
- * it's there.
- */
- directory_uri = directory->details->uri;
- colon = strchr (directory_uri, ':');
- if (colon == NULL) {
- file_name = g_strdup (directory_uri);
- } else {
- file_name = g_strndup (directory_uri,
- colon - directory_uri);
- }
+ file_name = nautilus_directory_get_name_for_self_as_new_file (directory);
}
} else {
file_name_escaped = gnome_vfs_uri_extract_short_path_name (vfs_uri);
diff --git a/libnautilus-extensions/nautilus-trash-directory.c b/libnautilus-extensions/nautilus-trash-directory.c
index b997b0730..cfd7ca44d 100644
--- a/libnautilus-extensions/nautilus-trash-directory.c
+++ b/libnautilus-extensions/nautilus-trash-directory.c
@@ -32,6 +32,8 @@
#include "nautilus-gtk-macros.h"
#include "nautilus-volume-monitor.h"
#include <gtk/gtksignal.h>
+#include <libgnome/gnome-defs.h>
+#include <libgnome/gnome-i18n.h>
struct NautilusTrashDirectoryDetails {
GHashTable *volumes;
@@ -276,12 +278,23 @@ trash_destroy (GtkObject *object)
NAUTILUS_CALL_PARENT_CLASS (GTK_OBJECT_CLASS, destroy, (object));
}
+static char *
+trash_get_name_for_self_as_new_file (NautilusDirectory *directory)
+{
+ g_assert (NAUTILUS_IS_TRASH_DIRECTORY (directory));
+ return g_strdup (_("Trash"));
+}
+
static void
nautilus_trash_directory_initialize_class (gpointer klass)
{
GtkObjectClass *object_class;
+ NautilusDirectoryClass *directory_class;
object_class = GTK_OBJECT_CLASS (klass);
+ directory_class = NAUTILUS_DIRECTORY_CLASS (klass);
object_class->destroy = trash_destroy;
+
+ directory_class->get_name_for_self_as_new_file = trash_get_name_for_self_as_new_file;
}
diff --git a/libnautilus-private/nautilus-directory-private.h b/libnautilus-private/nautilus-directory-private.h
index bbf177e10..943277d10 100644
--- a/libnautilus-private/nautilus-directory-private.h
+++ b/libnautilus-private/nautilus-directory-private.h
@@ -148,6 +148,7 @@ void nautilus_directory_emit_change_signals_deep (NautilusDi
void nautilus_directory_emit_done_loading (NautilusDirectory *directory);
NautilusDirectory *nautilus_directory_get_internal (const char *uri,
gboolean create);
+char *nautilus_directory_get_name_for_self_as_new_file (NautilusDirectory *directory);
/* debugging functions */
int nautilus_directory_number_outstanding (void);
diff --git a/libnautilus-private/nautilus-directory.c b/libnautilus-private/nautilus-directory.c
index 2dd6c6610..f42bb8179 100644
--- a/libnautilus-private/nautilus-directory.c
+++ b/libnautilus-private/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)
{
diff --git a/libnautilus-private/nautilus-directory.h b/libnautilus-private/nautilus-directory.h
index 03c2dabd7..f379d7cdd 100644
--- a/libnautilus-private/nautilus-directory.h
+++ b/libnautilus-private/nautilus-directory.h
@@ -127,6 +127,7 @@ typedef struct
gconstpointer client);
gboolean (* are_all_files_seen) (NautilusDirectory *directory);
gboolean (* is_not_empty) (NautilusDirectory *directory);
+ char * (* get_name_for_self_as_new_file) (NautilusDirectory *directory);
} NautilusDirectoryClass;
/* Basic GtkObject requirements. */
diff --git a/libnautilus-private/nautilus-file.c b/libnautilus-private/nautilus-file.c
index b5a60a2ce..7e7221290 100644
--- a/libnautilus-private/nautilus-file.c
+++ b/libnautilus-private/nautilus-file.c
@@ -253,7 +253,7 @@ nautilus_file_get_internal (const char *uri, gboolean create)
GnomeVFSURI *vfs_uri, *directory_vfs_uri;
char *directory_uri;
NautilusDirectory *directory;
- char *file_name_escaped, *file_name, *colon;
+ char *file_name_escaped, *file_name;
NautilusFile *file;
g_return_val_if_fail (uri != NULL, NULL);
@@ -286,18 +286,7 @@ nautilus_file_get_internal (const char *uri, gboolean create)
if (directory == NULL) {
file_name = NULL;
} else {
- /* Name is URI (from directory in case it's
- * made canonical), but scheme part only if
- * it's there.
- */
- directory_uri = directory->details->uri;
- colon = strchr (directory_uri, ':');
- if (colon == NULL) {
- file_name = g_strdup (directory_uri);
- } else {
- file_name = g_strndup (directory_uri,
- colon - directory_uri);
- }
+ file_name = nautilus_directory_get_name_for_self_as_new_file (directory);
}
} else {
file_name_escaped = gnome_vfs_uri_extract_short_path_name (vfs_uri);
diff --git a/libnautilus-private/nautilus-trash-directory.c b/libnautilus-private/nautilus-trash-directory.c
index b997b0730..cfd7ca44d 100644
--- a/libnautilus-private/nautilus-trash-directory.c
+++ b/libnautilus-private/nautilus-trash-directory.c
@@ -32,6 +32,8 @@
#include "nautilus-gtk-macros.h"
#include "nautilus-volume-monitor.h"
#include <gtk/gtksignal.h>
+#include <libgnome/gnome-defs.h>
+#include <libgnome/gnome-i18n.h>
struct NautilusTrashDirectoryDetails {
GHashTable *volumes;
@@ -276,12 +278,23 @@ trash_destroy (GtkObject *object)
NAUTILUS_CALL_PARENT_CLASS (GTK_OBJECT_CLASS, destroy, (object));
}
+static char *
+trash_get_name_for_self_as_new_file (NautilusDirectory *directory)
+{
+ g_assert (NAUTILUS_IS_TRASH_DIRECTORY (directory));
+ return g_strdup (_("Trash"));
+}
+
static void
nautilus_trash_directory_initialize_class (gpointer klass)
{
GtkObjectClass *object_class;
+ NautilusDirectoryClass *directory_class;
object_class = GTK_OBJECT_CLASS (klass);
+ directory_class = NAUTILUS_DIRECTORY_CLASS (klass);
object_class->destroy = trash_destroy;
+
+ directory_class->get_name_for_self_as_new_file = trash_get_name_for_self_as_new_file;
}
diff --git a/src/nautilus-navigation-window-menus.c b/src/nautilus-navigation-window-menus.c
index c9a594ded..8756e928f 100644
--- a/src/nautilus-navigation-window-menus.c
+++ b/src/nautilus-navigation-window-menus.c
@@ -627,6 +627,7 @@ help_menu_about_nautilus_callback (BonoboUIHandler *ui_handler,
const char *authors[] = {
"Ali Abdin",
"Darin Adler",
+ "Josh Barrow",
"Pavel Císler",
"J Shane Culpepper",
"Mike Engber",
diff --git a/src/nautilus-window-manage-views.c b/src/nautilus-window-manage-views.c
index 968fb7e74..93fc8cc3f 100644
--- a/src/nautilus-window-manage-views.c
+++ b/src/nautilus-window-manage-views.c
@@ -180,32 +180,18 @@ nautilus_window_report_load_failed (NautilusWindow *window,
static char *
compute_default_title (const char *text_uri)
{
- GnomeVFSURI *vfs_uri;
- char *short_name, *colon_pos;
-
- if (text_uri != NULL) {
- vfs_uri = gnome_vfs_uri_new (text_uri);
- if (vfs_uri != NULL) {
- short_name = gnome_vfs_uri_extract_short_name (vfs_uri);
- gnome_vfs_uri_unref (vfs_uri);
- if (short_name == NULL) {
- short_name = g_strdup (_("(untitled)"));
- }
- return short_name;
- } else {
- colon_pos = strchr (text_uri, ':');
- if (colon_pos != NULL) {
- if (colon_pos[1] != '\0') {
- return g_strdup (colon_pos + 1);
- } else {
- return g_strndup (text_uri,
- colon_pos - text_uri);
- }
- }
- }
- }
+ NautilusFile *file;
+ char *title;
+
+ if (text_uri == NULL) {
+ title = g_strdup ("");
+ } else {
+ file = nautilus_file_get (text_uri);
+ title = nautilus_file_get_name (file);
+ nautilus_file_unref (file);
+ }
- return g_strdup ("");
+ return title;
}
/* nautilus_window_get_current_location_title:
diff --git a/src/nautilus-window-menus.c b/src/nautilus-window-menus.c
index c9a594ded..8756e928f 100644
--- a/src/nautilus-window-menus.c
+++ b/src/nautilus-window-menus.c
@@ -627,6 +627,7 @@ help_menu_about_nautilus_callback (BonoboUIHandler *ui_handler,
const char *authors[] = {
"Ali Abdin",
"Darin Adler",
+ "Josh Barrow",
"Pavel Císler",
"J Shane Culpepper",
"Mike Engber",