summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2004-12-15 17:10:49 +0000
committerAlexander Larsson <alexl@src.gnome.org>2004-12-15 17:10:49 +0000
commita35db3f52883df8bd9e6648ae28e6bded1f32d5a (patch)
tree93e042667c015e12a0ac79b6dd24ef62cac97a9d
parentb647dd9da219330ecd1c26dc90cf6c421298f600 (diff)
downloadnautilus-a35db3f52883df8bd9e6648ae28e6bded1f32d5a.tar.gz
Require glib 2.6.0
2004-12-15 Alexander Larsson <alexl@redhat.com> * configure.in: Require glib 2.6.0 * libnautilus-private/nautilus-file-utilities.c: (nautilus_get_uri_shortname_for_display): * libnautilus-private/nautilus-file.c: (nautilus_file_get_display_name_nocopy): Use g_filename_display_basename() for display names
-rw-r--r--ChangeLog11
-rw-r--r--configure.in2
-rw-r--r--libnautilus-private/nautilus-file-utilities.c35
-rw-r--r--libnautilus-private/nautilus-file.c36
4 files changed, 27 insertions, 57 deletions
diff --git a/ChangeLog b/ChangeLog
index 768d97837..5c0778ed8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
2004-12-15 Alexander Larsson <alexl@redhat.com>
+ * configure.in:
+ Require glib 2.6.0
+
+ * libnautilus-private/nautilus-file-utilities.c:
+ (nautilus_get_uri_shortname_for_display):
+ * libnautilus-private/nautilus-file.c:
+ (nautilus_file_get_display_name_nocopy):
+ Use g_filename_display_basename() for display names
+
+2004-12-15 Alexander Larsson <alexl@redhat.com>
+
* src/file-manager/fm-list-view.c: (cell_renderer_edited),
(fm_list_view_start_renaming_file):
* src/file-manager/fm-properties-window.c:
diff --git a/configure.in b/configure.in
index cc6be2639..7145b5b44 100644
--- a/configure.in
+++ b/configure.in
@@ -7,7 +7,7 @@ BONOBO_ACTIVATION_REQUIRED=2.1.0
BONOBO_REQUIRED=2.1.0
EEL_REQUIRED=2.9.1
ESOUND_REQUIRED=0.2.27
-GLIB_REQUIRED=2.3.0
+GLIB_REQUIRED=2.6.0
GNOME_DESKTOP_REQUIRED=2.1.0
GNOME_REQUIRED=2.1.1
GNOME_UI_REQUIRED=2.6.0
diff --git a/libnautilus-private/nautilus-file-utilities.c b/libnautilus-private/nautilus-file-utilities.c
index 578eaf8ce..ae21d95e4 100644
--- a/libnautilus-private/nautilus-file-utilities.c
+++ b/libnautilus-private/nautilus-file-utilities.c
@@ -410,9 +410,8 @@ nautilus_get_vfs_method_display_name (char *method)
char *
nautilus_get_uri_shortname_for_display (GnomeVFSURI *uri)
{
- gboolean utf8_filenames;
- const char *filename_charset;
char *utf8_name, *name, *tmp;
+ char *text_uri, *local_file;
gboolean validated;
const char *method;
@@ -422,32 +421,12 @@ nautilus_get_uri_shortname_for_display (GnomeVFSURI *uri)
if (name == NULL) {
name = gnome_vfs_uri_to_string (uri, GNOME_VFS_URI_HIDE_PASSWORD);
} else if (g_ascii_strcasecmp (uri->method_string, "file") == 0) {
- utf8_filenames = eel_get_filename_charset (&filename_charset);
- if (utf8_filenames) {
- /* If not valid utf8, and filenames are utf8, test if converting
- from the locale works */
- if (!g_utf8_validate (name, -1, NULL)) {
- utf8_name = g_locale_to_utf8 (name, -1, NULL, NULL, NULL);
- if (utf8_name != NULL) {
- g_free (name);
- name = utf8_name;
- /* Guaranteed to be correct utf8 here */
- validated = TRUE;
- }
- } else {
- /* name was valid, no need to re-validate */
- validated = TRUE;
- }
- } else {
- /* Try to convert from filename charset to utf8 */
- utf8_name = g_convert (name, -1, "UTF-8", filename_charset, NULL, NULL, NULL);
- if (utf8_name != NULL) {
- g_free (name);
- name = utf8_name;
- /* Guaranteed to be correct utf8 here */
- validated = TRUE;
- }
- }
+ text_uri = gnome_vfs_uri_to_string (uri, GNOME_VFS_URI_HIDE_PASSWORD);
+ local_file = gnome_vfs_get_local_path_from_uri (text_uri);
+ name = g_filename_display_basename (local_file);
+ g_free (local_file);
+ g_free (text_uri);
+ validated = TRUE;
} else if (!gnome_vfs_uri_has_parent (uri)) {
/* Special-case the display name for roots that are not local files */
method = nautilus_get_vfs_method_display_name (uri->method_string);
diff --git a/libnautilus-private/nautilus-file.c b/libnautilus-private/nautilus-file.c
index 5bbf8fcec..62ff249cc 100644
--- a/libnautilus-private/nautilus-file.c
+++ b/libnautilus-private/nautilus-file.c
@@ -60,6 +60,7 @@
#include <libgnomevfs/gnome-vfs-volume.h>
#include <libgnomevfs/gnome-vfs-volume-monitor.h>
#include <libgnomevfs/gnome-vfs-drive.h>
+#include <glib/gfileutils.h>
#include <libnautilus-extension/nautilus-file-info.h>
#include <libxml/parser.h>
#include <pwd.h>
@@ -2679,8 +2680,7 @@ nautilus_file_get_display_name_nocopy (NautilusFile *file)
gboolean validated;
GnomeVFSURI *vfs_uri;
const char *method;
- gboolean utf8_filenames;
- const char *filename_charset;
+ char *uri, *local_file;
if (file == NULL) {
return NULL;
@@ -2711,32 +2711,12 @@ nautilus_file_get_display_name_nocopy (NautilusFile *file)
*/
/* Keep in sync with nautilus_get_uri_shortname_for_display */
if (has_local_path (file)) {
- utf8_filenames = eel_get_filename_charset (&filename_charset);
- if (utf8_filenames) {
- /* If not valid utf8, and filenames are utf8, test if converting
- from the locale works */
- if (!g_utf8_validate (name, -1, NULL)) {
- utf8_name = g_locale_to_utf8 (name, -1, NULL, NULL, NULL);
- if (utf8_name != NULL) {
- g_free (name);
- name = utf8_name;
- /* Guaranteed to be correct utf8 here */
- validated = TRUE;
- }
- } else {
- /* name was valid, no need to re-validate */
- validated = TRUE;
- }
- } else {
- /* Try to convert from filename charset to utf8 */
- utf8_name = g_convert (name, -1, "UTF-8", filename_charset, NULL, NULL, NULL);
- if (utf8_name != NULL) {
- g_free (name);
- name = utf8_name;
- /* Guaranteed to be correct utf8 here */
- validated = TRUE;
- }
- }
+ uri = nautilus_file_get_uri (file);
+ local_file = gnome_vfs_get_local_path_from_uri (uri);
+ name = g_filename_display_basename (local_file);
+ g_free (local_file);
+ g_free (uri);
+ validated = TRUE;
} else if (strcmp (name, "/") == 0) {
/* Special-case the display name for roots that are not local files */
g_free (name);