chained uris browsing
- From: Christophe Fergeau <teuf users sourceforge net>
- To: Nautilus <nautilus-list gnome org>
- Subject: chained uris browsing
- Date: 02 Feb 2003 13:30:33 +0100
Hi,
Currently, in Nautilus if you try to open an uri like
file:///file.zip#zip:/somedir/, it works, but Nautilus refuses to open
file:///file.zip#zip:/
After investigating a little, I found out that this is due to Nautilus
expecting gnome_vfs_uri_get_parent to always return a dir, which is true
in the first case, but in the second case it returns file:///file.zip
which is not a dir, and then Nautilus gets confused.
I added a eel_vfs_uri_get_parent function which handles chained uris
better, but it still sucks :) Indeed, in nautilus-file, I had to tell
nautilus that the parent of file:///file.zip#zip:/ is NULL (ie it
behaves as a root directory) to get the location displayed in the
location bar right, but in nautilus-window, I had to tell it the parent
of file:///file.zip#zip:/ is file:/// to get the up button to work.
I'm sending these patches even if they aren't really good in the hope
that someone will be able to guide me toward better ways of fixing that
bug :)
Christophe
(the attached patches are for nautilus, eel and gnome-vfs)
? eel.diff
? nautilus.diff
? test/test-eel-editable-label
Index: eel/eel-vfs-extensions.c
===================================================================
RCS file: /cvs/gnome/eel/eel/eel-vfs-extensions.c,v
retrieving revision 1.16
diff -u -d -b -u -r1.16 eel-vfs-extensions.c
--- eel/eel-vfs-extensions.c 25 Nov 2002 18:11:39 -0000 1.16
+++ eel/eel-vfs-extensions.c 2 Feb 2003 11:56:09 -0000
@@ -1680,6 +1680,24 @@
return ret;
}
+GnomeVFSURI *
+eel_vfs_get_parent_directory (const GnomeVFSURI *uri)
+{
+ GnomeVFSURI *parent_uri;
+
+ parent_uri = gnome_vfs_uri_get_parent (uri);
+ g_print ("====>%s %s %s %u %u\n", G_GNUC_FUNCTION, gnome_vfs_uri_to_string (uri, 0), gnome_vfs_uri_to_string (parent_uri, 0), gnome_vfs_uri_is_toplevel (uri), gnome_vfs_uri_is_toplevel (parent_uri));
+
+ if (gnome_vfs_uri_is_toplevel (uri) ||
+ (!gnome_vfs_uri_is_toplevel (parent_uri))) {
+ return parent_uri;
+ } else {
+ // return gnome_vfs_uri_dup (uri);
+ return NULL;
+ }
+}
+
+
#if !defined (EEL_OMIT_SELF_CHECK)
void
Index: eel/eel-vfs-extensions.h
===================================================================
RCS file: /cvs/gnome/eel/eel/eel-vfs-extensions.h,v
retrieving revision 1.11
diff -u -d -b -u -r1.11 eel-vfs-extensions.h
--- eel/eel-vfs-extensions.h 28 Jun 2002 02:36:52 -0000 1.11
+++ eel/eel-vfs-extensions.h 2 Feb 2003 11:56:09 -0000
@@ -105,6 +105,8 @@
gboolean eel_vfs_has_capability_uri (GnomeVFSURI *uri,
EelVfsCapability capability);
+GnomeVFSURI * eel_vfs_get_parent_directory (const GnomeVFSURI *uri);
+
G_END_DECLS
#endif /* EEL_VFS_EXTENSIONS_H */
? autom4te.cache
? nautilus-file-management-properties.desktop
? nautilus.diff
? nautilus_authn.diff
? components/emblem/Makefile
? components/emblem/Makefile.in
? components/emblem/Nautilus_View_emblem.server
? components/emblem/Nautilus_View_emblem.server.in
? cut-n-paste-code/libegg/Makefile
? cut-n-paste-code/libegg/Makefile.in
? src/authentication-manager.c
? src/authentication-manager.h
? src/gnome-authn-manager.c
? src/gnome-authn-manager.h
? src/gnome-caption-table.c
? src/gnome-caption-table.h
? src/gnome-password-dialog.c
? src/gnome-password-dialog.h
? src/nautilus-file-management-properties
? src/nautilus-server-connect
? src/nautilus-server-connect.desktop
? src/network-scheme.desktop
? src/test-authentication-dialog.c
Index: libnautilus-private/nautilus-file.c
===================================================================
RCS file: /cvs/gnome/nautilus/libnautilus-private/nautilus-file.c,v
retrieving revision 1.309
diff -u -d -b -u -r1.309 nautilus-file.c
--- libnautilus-private/nautilus-file.c 20 Jan 2003 10:13:52 -0000 1.309
+++ libnautilus-private/nautilus-file.c 2 Feb 2003 11:53:54 -0000
@@ -50,6 +50,7 @@
#include <libgnome/gnome-macros.h>
#include <libgnomevfs/gnome-vfs-file-info.h>
#include <libgnomevfs/gnome-vfs-mime-handlers.h>
+#include <libgnomevfs/gnome-vfs-ops.h>
#include <libgnomevfs/gnome-vfs-utils.h>
#include <libxml/parser.h>
#include <pwd.h>
@@ -309,11 +310,12 @@
if (vfs_uri == NULL) {
directory_vfs_uri = NULL;
} else {
- directory_vfs_uri = gnome_vfs_uri_get_parent (vfs_uri);
+ directory_vfs_uri = eel_vfs_get_parent_directory (vfs_uri);
gnome_vfs_uri_unref (vfs_uri);
}
self_owned = directory_vfs_uri == NULL;
+
if (self_owned) {
/* Use the item itself if we have no parent. */
directory_uri = g_strdup (canonical_uri);
Index: src/nautilus-window.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/nautilus-window.c,v
retrieving revision 1.404
diff -u -d -b -u -r1.404 nautilus-window.c
--- src/nautilus-window.c 14 Jan 2003 18:29:44 -0000 1.404
+++ src/nautilus-window.c 2 Feb 2003 11:53:57 -0000
@@ -42,6 +42,7 @@
#include <bonobo/bonobo-property-bag-client.h>
#include <bonobo/bonobo-ui-util.h>
#include <eel/eel-debug.h>
+#include <eel/eel-vfs-extensions.h>
#include <eel/eel-gdk-extensions.h>
#include <eel/eel-gdk-pixbuf-extensions.h>
#include <eel/eel-generous-bin.h>
@@ -1559,6 +1560,7 @@
{
GnomeVFSURI *current_uri;
GnomeVFSURI *parent_uri;
+ GnomeVFSURI *parent_uri2;
GList *selection;
char *parent_uri_string;
@@ -1567,7 +1569,17 @@
}
current_uri = gnome_vfs_uri_new (window->details->location);
+ parent_uri2 = eel_vfs_get_parent_directory (current_uri);
parent_uri = gnome_vfs_uri_get_parent (current_uri);
+ if (parent_uri2 == NULL) {
+ GnomeVFSURI *tmp_uri;
+ tmp_uri = parent_uri;
+ parent_uri = gnome_vfs_uri_get_parent (tmp_uri);
+ gnome_vfs_uri_unref (tmp_uri);
+ }
+ gnome_vfs_uri_unref (parent_uri2);
+
gnome_vfs_uri_unref (current_uri);
if (parent_uri == NULL) {
? eel.diff
? vfs.diff
? doc/xml
? doc/tmpl/gnome-vfs-unused.sgml
? doc/tmpl/gnome-vfs.sgml
? libgnomevfs/messages.mo
? test/test-resolv
? test/test-subdir
? test/test.zip
? test/titi.zip
? test/toto.tar
? test/toto.zip
Index: libgnomevfs/gnome-vfs-uri.c
===================================================================
RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/gnome-vfs-uri.c,v
retrieving revision 1.110
diff -u -d -b -u -r1.110 gnome-vfs-uri.c
--- libgnomevfs/gnome-vfs-uri.c 7 Jan 2003 15:11:20 -0000 1.110
+++ libgnomevfs/gnome-vfs-uri.c 2 Feb 2003 11:56:47 -0000
@@ -1258,6 +1258,20 @@
}
/**
+ * gnome_vfs_uri_is_toplevel
+ * @uri: A GnomeVFSURI.
+ *
+ * Indicates whether uri is a GnomeVFSToplevelURI
+ *
+ * Return value: true if uri is a toplevel uri
+ **/
+gboolean
+gnome_vfs_uri_is_toplevel (const GnomeVFSURI *uri)
+{
+ return (uri->parent == NULL);
+}
+
+/**
* gnome_vfs_uri_get_host_name:
* @uri: A GnomeVFSURI.
*
Index: libgnomevfs/gnome-vfs-uri.h
===================================================================
RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/gnome-vfs-uri.h,v
retrieving revision 1.32
diff -u -d -b -u -r1.32 gnome-vfs-uri.h
--- libgnomevfs/gnome-vfs-uri.h 26 Jun 2002 19:26:44 -0000 1.32
+++ libgnomevfs/gnome-vfs-uri.h 2 Feb 2003 11:56:48 -0000
@@ -154,6 +154,9 @@
GnomeVFSToplevelURI *gnome_vfs_uri_get_toplevel (const GnomeVFSURI *uri);
+gboolean gnome_vfs_uri_is_toplevel (const GnomeVFSURI *uri);
+
const gchar *gnome_vfs_uri_get_host_name (const GnomeVFSURI *uri);
const gchar *gnome_vfs_uri_get_scheme (const GnomeVFSURI *uri);
guint gnome_vfs_uri_get_host_port (const GnomeVFSURI *uri);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]