Commit 67920785 authored by Darin Adler's avatar Darin Adler

First cut at only reading the metafile if the directory is really a

	* libnautilus-extensions/nautilus-directory-async.c:
	(metafile_read_failed): First cut at only reading the metafile if the
	directory is really a directory. This might be making things worse
	for now, because I'm not sure if the file info is available at this
	point. I'll check in something better soon.

	* libnautilus-extensions/nautilus-directory.c:
	(nautilus_directory_is_search_directory): Fixed backwards test that
	would return TRUE for many non-search directories. Then I put that
	code inside #if 0 and added a version of the function that just
	checks the scheme of the URI for now. Also added FIXMEs.

	* libnautilus-extensions/nautilus-file.c:
	(nautilus_file_get_real_name): Simplfied the code a bit. Also added
	a FIXME.
parent 4232317b
2000-07-26 Darin Adler <darin@eazel.com>
* libnautilus-extensions/nautilus-directory-async.c:
(metafile_read_failed): First cut at only reading the metafile if the
directory is really a directory. This might be making things worse
for now, because I'm not sure if the file info is available at this
point. I'll check in something better soon.
* libnautilus-extensions/nautilus-directory.c:
(nautilus_directory_is_search_directory): Fixed backwards test that
would return TRUE for many non-search directories. Then I put that
code inside #if 0 and added a version of the function that just
checks the scheme of the URI for now. Also added FIXMEs.
* libnautilus-extensions/nautilus-file.c:
(nautilus_file_get_real_name): Simplfied the code a bit. Also added
a FIXME.
2000-07-26 Ramiro Estrugo <ramiro@eazel.com>
* Makefile.am:
......@@ -36,8 +54,7 @@
2000-07-26 Robey Pointer <robey@eazel.com>
*
components/services/install/command-line/eazel-alt-install-corba.c:
* components/services/install/command-line/eazel-alt-install-corba.c:
(eazel_download_progress_signal), (eazel_install_progress_signal):
* components/services/install/lib/eazel-install-rpm-glue.c:
(install_all_packages),
......
......@@ -206,13 +206,28 @@ metafile_read_done (NautilusDirectory *directory)
static void
metafile_read_failed (NautilusDirectory *directory)
{
NautilusFile *as_file;
gboolean try_public_metafile;
g_assert (NAUTILUS_IS_DIRECTORY (directory));
g_assert (directory->details->metafile == NULL);
if (directory->details->use_alternate_metafile) {
directory->details->use_alternate_metafile = FALSE;
metafile_read_start (directory);
return;
/* The goal here is to read the real metafile, but
* only if the directory is actually a directory.
*/
as_file = nautilus_file_get (directory->details->uri_text);
if (as_file == NULL) {
try_public_metafile = FALSE;
} else {
try_public_metafile = nautilus_file_is_directory (as_file);
nautilus_file_unref (as_file);
}
if (try_public_metafile) {
directory->details->use_alternate_metafile = FALSE;
metafile_read_start (directory);
return;
}
}
metafile_read_done (directory);
......
......@@ -452,42 +452,53 @@ nautilus_directory_is_local (NautilusDirectory *directory)
return gnome_vfs_uri_is_local (directory->details->uri);
}
/* FIXME: I think this should be named _is_virtual_directory. */
gboolean
nautilus_directory_is_search_directory (NautilusDirectory *directory)
{
GnomeVFSFileInfo *info;
gboolean is_search_directory;
GnomeVFSResult result;
if (directory == NULL) {
return FALSE;
}
if (directory->details->uri == NULL) {
return FALSE;
}
g_return_val_if_fail (NAUTILUS_IS_DIRECTORY (directory), FALSE);
/* 3 hard-coded schemes for now. */
/* FIXME: Later we gnome-vfs will tell us somehow that this is
* a virtual directory.
*/
return nautilus_istr_has_prefix (directory->details->uri_text, "search:")
|| nautilus_istr_has_prefix (directory->details->uri_text, "gnome-search:")
|| nautilus_istr_has_prefix (directory->details->uri_text, "gnome-trash:");
#if 0
GnomeVFSFileInfo *info;
gboolean is_search_directory;
GnomeVFSResult result;
info = gnome_vfs_file_info_new ();
g_return_val_if_fail (NAUTILUS_IS_DIRECTORY (directory), FALSE);
/* FIXME: should make use of some sort of NautilusDirectory
cover for getting the mime type. */
/* FIXME bugzilla.eazel.com 1263: We can't just do sync. I/O
* here! The model is that get_ functions in
* NautilusDirectory/File are supposed to do no I/O. The
* aforementioned bug talks about this a bit.
*/
/* FIXME bugzilla.eazel.com 1263: Should make use of some sort
* of NautilusDirectory cover for getting the mime type.
*/
result = gnome_vfs_get_file_info_uri (directory->details->uri,
info,
GNOME_VFS_FILE_INFO_GET_MIME_TYPE);
is_search_directory = result == GNOME_VFS_OK &&
nautilus_strcasecmp (info->mime_type, "x-special/virtual-directory");
nautilus_strcasecmp (info->mime_type, "x-special/virtual-directory") == 0;
gnome_vfs_file_info_unref (info);
return is_search_directory;
#endif
}
gboolean
nautilus_directory_are_all_files_seen (NautilusDirectory *directory)
{
......
......@@ -3282,26 +3282,28 @@ nautilus_file_is_search_result (NautilusFile *file)
char *
nautilus_file_get_real_name (NautilusFile *file)
{
char *uri;
GnomeVFSURI *vfs_uri;
char *name;
GnomeVFSURI *vfs_uri;
if (file == NULL) {
return NULL;
}
g_return_val_if_fail (NAUTILUS_IS_FILE (file), NULL);
name = nautilus_file_get_name (file);
if (nautilus_file_is_search_result (file)) {
uri = nautilus_file_get_name (file);
vfs_uri = gnome_vfs_uri_new (uri);
g_free (uri);
vfs_uri = gnome_vfs_uri_new (name);
/* FIXME: This can be NULL if the search result URI is bad.
* I think a core dump is a bit too much here, so we might
* have to add a bit more checking.
*/
g_free (name);
name = gnome_vfs_uri_extract_short_path_name (vfs_uri);
gnome_vfs_uri_unref (vfs_uri);
return name;
} else {
return nautilus_file_get_name (file);
gnome_vfs_uri_unref (vfs_uri);
}
return name;
}
......
......@@ -206,13 +206,28 @@ metafile_read_done (NautilusDirectory *directory)
static void
metafile_read_failed (NautilusDirectory *directory)
{
NautilusFile *as_file;
gboolean try_public_metafile;
g_assert (NAUTILUS_IS_DIRECTORY (directory));
g_assert (directory->details->metafile == NULL);
if (directory->details->use_alternate_metafile) {
directory->details->use_alternate_metafile = FALSE;
metafile_read_start (directory);
return;
/* The goal here is to read the real metafile, but
* only if the directory is actually a directory.
*/
as_file = nautilus_file_get (directory->details->uri_text);
if (as_file == NULL) {
try_public_metafile = FALSE;
} else {
try_public_metafile = nautilus_file_is_directory (as_file);
nautilus_file_unref (as_file);
}
if (try_public_metafile) {
directory->details->use_alternate_metafile = FALSE;
metafile_read_start (directory);
return;
}
}
metafile_read_done (directory);
......
......@@ -452,42 +452,53 @@ nautilus_directory_is_local (NautilusDirectory *directory)
return gnome_vfs_uri_is_local (directory->details->uri);
}
/* FIXME: I think this should be named _is_virtual_directory. */
gboolean
nautilus_directory_is_search_directory (NautilusDirectory *directory)
{
GnomeVFSFileInfo *info;
gboolean is_search_directory;
GnomeVFSResult result;
if (directory == NULL) {
return FALSE;
}
if (directory->details->uri == NULL) {
return FALSE;
}
g_return_val_if_fail (NAUTILUS_IS_DIRECTORY (directory), FALSE);
/* 3 hard-coded schemes for now. */
/* FIXME: Later we gnome-vfs will tell us somehow that this is
* a virtual directory.
*/
return nautilus_istr_has_prefix (directory->details->uri_text, "search:")
|| nautilus_istr_has_prefix (directory->details->uri_text, "gnome-search:")
|| nautilus_istr_has_prefix (directory->details->uri_text, "gnome-trash:");
#if 0
GnomeVFSFileInfo *info;
gboolean is_search_directory;
GnomeVFSResult result;
info = gnome_vfs_file_info_new ();
g_return_val_if_fail (NAUTILUS_IS_DIRECTORY (directory), FALSE);
/* FIXME: should make use of some sort of NautilusDirectory
cover for getting the mime type. */
/* FIXME bugzilla.eazel.com 1263: We can't just do sync. I/O
* here! The model is that get_ functions in
* NautilusDirectory/File are supposed to do no I/O. The
* aforementioned bug talks about this a bit.
*/
/* FIXME bugzilla.eazel.com 1263: Should make use of some sort
* of NautilusDirectory cover for getting the mime type.
*/
result = gnome_vfs_get_file_info_uri (directory->details->uri,
info,
GNOME_VFS_FILE_INFO_GET_MIME_TYPE);
is_search_directory = result == GNOME_VFS_OK &&
nautilus_strcasecmp (info->mime_type, "x-special/virtual-directory");
nautilus_strcasecmp (info->mime_type, "x-special/virtual-directory") == 0;
gnome_vfs_file_info_unref (info);
return is_search_directory;
#endif
}
gboolean
nautilus_directory_are_all_files_seen (NautilusDirectory *directory)
{
......
......@@ -3282,26 +3282,28 @@ nautilus_file_is_search_result (NautilusFile *file)
char *
nautilus_file_get_real_name (NautilusFile *file)
{
char *uri;
GnomeVFSURI *vfs_uri;
char *name;
GnomeVFSURI *vfs_uri;
if (file == NULL) {
return NULL;
}
g_return_val_if_fail (NAUTILUS_IS_FILE (file), NULL);
name = nautilus_file_get_name (file);
if (nautilus_file_is_search_result (file)) {
uri = nautilus_file_get_name (file);
vfs_uri = gnome_vfs_uri_new (uri);
g_free (uri);
vfs_uri = gnome_vfs_uri_new (name);
/* FIXME: This can be NULL if the search result URI is bad.
* I think a core dump is a bit too much here, so we might
* have to add a bit more checking.
*/
g_free (name);
name = gnome_vfs_uri_extract_short_path_name (vfs_uri);
gnome_vfs_uri_unref (vfs_uri);
return name;
} else {
return nautilus_file_get_name (file);
gnome_vfs_uri_unref (vfs_uri);
}
return name;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment