summaryrefslogtreecommitdiff
path: root/libnautilus-private
diff options
context:
space:
mode:
authorAlex Larsson <alexl@redhat.com>2002-05-09 19:49:33 +0000
committerAlexander Larsson <alexl@src.gnome.org>2002-05-09 19:49:33 +0000
commit543620788251c77d8c9b58657018dfd94473089b (patch)
tree755a2e0ed55c1fd8155637232ddfe1f1e2495092 /libnautilus-private
parent0051a8bd57c3dee82475edbed60ecd9c59d99186 (diff)
downloadnautilus-543620788251c77d8c9b58657018dfd94473089b.tar.gz
Remove public metadata
2002-05-08 Alex Larsson <alexl@redhat.com> * libnautilus-private/apps_nautilus_preferences.schemas: * libnautilus-private/nautilus-file-utilities.c: * libnautilus-private/nautilus-file-utilities.h: * libnautilus-private/nautilus-file.c: * libnautilus-private/nautilus-file.h: * libnautilus-private/nautilus-global-preferences.c: * libnautilus-private/nautilus-global-preferences.h: * libnautilus-private/nautilus-metafile.c: * libnautilus-private/nautilus-metafile.h: * libnautilus-private/nautilus-thumbnails.c: * libnautilus-private/nautilus-vfs-directory.c: * src/nautilus-preferences-dialog.c: Remove public metadata
Diffstat (limited to 'libnautilus-private')
-rw-r--r--libnautilus-private/apps_nautilus_preferences.schemas29
-rw-r--r--libnautilus-private/nautilus-file-utilities.c8
-rw-r--r--libnautilus-private/nautilus-file-utilities.h1
-rw-r--r--libnautilus-private/nautilus-file.c7
-rw-r--r--libnautilus-private/nautilus-file.h1
-rw-r--r--libnautilus-private/nautilus-global-preferences.c6
-rw-r--r--libnautilus-private/nautilus-global-preferences.h1
-rw-r--r--libnautilus-private/nautilus-metafile.c255
-rw-r--r--libnautilus-private/nautilus-metafile.h3
-rw-r--r--libnautilus-private/nautilus-thumbnails.c22
-rw-r--r--libnautilus-private/nautilus-vfs-directory.c11
11 files changed, 12 insertions, 332 deletions
diff --git a/libnautilus-private/apps_nautilus_preferences.schemas b/libnautilus-private/apps_nautilus_preferences.schemas
index 27c747e35..e44cc55f1 100644
--- a/libnautilus-private/apps_nautilus_preferences.schemas
+++ b/libnautilus-private/apps_nautilus_preferences.schemas
@@ -219,35 +219,6 @@
</schema>
- <schema>
- <key>/schemas/apps/nautilus/preferences/use_public_metadata</key>
- <applyto>/apps/nautilus/preferences/use_public_metadata</applyto>
- <owner>nautilus</owner>
- <type>string</type>
- <default>local_only</default>
- <locale name="C">
- <short>Whether to store metadata in each directory, or in a single global location</short>
- <long>
- Nautilus records information about each directory you visit, such
- as its background color, emblems, zoom level, and so on.
- This information can be stored in one location in your home
- directory, or it can be stored in each directory in hidden files.
- The advantages of storing per-directory are that it's more robust
- (can't be deleted in one go) and that for folders used by
- multiple users, the metadata will be shared. So for example
- all users can see emblems applied to files.
-
- If this setting is "local_only", for local filesystems metadata
- will be stored per-directory, and for remote connections
- it will be stored in the user's home directory. If it's "never"
- then all metadata will go in the user's home directory; if it's
- "always" then all metadata will go in the directory being described.
- (However, for read-only directories, metadata always goes in the
- user's home directory.)
- </long>
- </locale>
- </schema>
-
<schema>
<key>/schemas/apps/nautilus/preferences/preview_sound</key>
<applyto>/apps/nautilus/preferences/preview_sound</applyto>
diff --git a/libnautilus-private/nautilus-file-utilities.c b/libnautilus-private/nautilus-file-utilities.c
index 1efa0a190..ab4207409 100644
--- a/libnautilus-private/nautilus-file-utilities.c
+++ b/libnautilus-private/nautilus-file-utilities.c
@@ -59,14 +59,6 @@ nautilus_file_name_matches_backup_pattern (const char *name_or_relative_uri)
return eel_str_has_suffix (name_or_relative_uri, "~");
}
-gboolean
-nautilus_file_name_matches_metafile_pattern (const char *name_or_relative_uri)
-{
- g_return_val_if_fail (name_or_relative_uri != NULL, FALSE);
-
- return eel_str_has_suffix (name_or_relative_uri, NAUTILUS_METAFILE_NAME_SUFFIX);
-}
-
/**
* nautilus_make_path:
*
diff --git a/libnautilus-private/nautilus-file-utilities.h b/libnautilus-private/nautilus-file-utilities.h
index ecb03c30f..2f8d32f06 100644
--- a/libnautilus-private/nautilus-file-utilities.h
+++ b/libnautilus-private/nautilus-file-utilities.h
@@ -30,7 +30,6 @@
/* Recognizing special file names. */
gboolean nautilus_file_name_matches_hidden_pattern (const char *name_or_relative_uri);
gboolean nautilus_file_name_matches_backup_pattern (const char *name_or_relative_uri);
-gboolean nautilus_file_name_matches_metafile_pattern (const char *name_or_relative_uri);
/* FIXME bugzilla.gnome.org 42424:
* This is the same as gnome-libs g_concat_dir_and_file except
diff --git a/libnautilus-private/nautilus-file.c b/libnautilus-private/nautilus-file.c
index 3e28f27c7..46a25de89 100644
--- a/libnautilus-private/nautilus-file.c
+++ b/libnautilus-private/nautilus-file.c
@@ -1945,13 +1945,6 @@ nautilus_file_is_backup_file (NautilusFile *file)
}
gboolean
-nautilus_file_is_metafile (NautilusFile *file)
-{
- return nautilus_file_name_matches_metafile_pattern
- (file->details->relative_uri);
-}
-
-gboolean
nautilus_file_should_show (NautilusFile *file,
gboolean show_hidden,
gboolean show_backup)
diff --git a/libnautilus-private/nautilus-file.h b/libnautilus-private/nautilus-file.h
index b622d3d95..b4ad72a0e 100644
--- a/libnautilus-private/nautilus-file.h
+++ b/libnautilus-private/nautilus-file.h
@@ -278,7 +278,6 @@ int nautilus_file_compare_display_name (Nautilu
/* filtering functions for use by various directory views */
gboolean nautilus_file_is_hidden_file (NautilusFile *file);
gboolean nautilus_file_is_backup_file (NautilusFile *file);
-gboolean nautilus_file_is_metafile (NautilusFile *file);
gboolean nautilus_file_should_show (NautilusFile *file,
gboolean show_hidden,
gboolean show_backup);
diff --git a/libnautilus-private/nautilus-global-preferences.c b/libnautilus-private/nautilus-global-preferences.c
index 4c9b257a2..36a3f2087 100644
--- a/libnautilus-private/nautilus-global-preferences.c
+++ b/libnautilus-private/nautilus-global-preferences.c
@@ -374,12 +374,6 @@ static const PreferenceDefault preference_defaults[] = {
NULL, NULL,
"file_size"
},
- { NAUTILUS_PREFERENCES_USE_PUBLIC_METADATA,
- PREFERENCE_STRING,
- "local_only",
- NULL, NULL,
- "speed_tradeoff"
- },
{ NAUTILUS_PREFERENCES_PREVIEW_SOUND,
PREFERENCE_STRING,
"local_only",
diff --git a/libnautilus-private/nautilus-global-preferences.h b/libnautilus-private/nautilus-global-preferences.h
index 8279a9232..c7311241c 100644
--- a/libnautilus-private/nautilus-global-preferences.h
+++ b/libnautilus-private/nautilus-global-preferences.h
@@ -156,7 +156,6 @@ typedef enum
#define NAUTILUS_PREFERENCES_SHOW_DIRECTORY_ITEM_COUNTS "preferences/show_directory_item_counts"
#define NAUTILUS_PREFERENCES_SHOW_IMAGE_FILE_THUMBNAILS "preferences/show_image_thumbnails"
#define NAUTILUS_PREFERENCES_IMAGE_FILE_THUMBNAIL_LIMIT "preferences/thumbnail_limit"
-#define NAUTILUS_PREFERENCES_USE_PUBLIC_METADATA "preferences/use_public_metadata"
#define NAUTILUS_PREFERENCES_PREVIEW_SOUND "preferences/preview_sound"
typedef enum
diff --git a/libnautilus-private/nautilus-metafile.c b/libnautilus-private/nautilus-metafile.c
index fda196d1f..5f37fefba 100644
--- a/libnautilus-private/nautilus-metafile.c
+++ b/libnautilus-private/nautilus-metafile.c
@@ -47,7 +47,7 @@
#include <unistd.h>
#define METAFILE_XML_VERSION "1.0"
-#define METAFILE_PERMISSIONS 0666
+#define METAFILE_PERMISSIONS 0600
#define METAFILES_DIRECTORY_NAME "metafiles"
static char *get_file_metadata (NautilusMetafile *metafile,
@@ -94,13 +94,11 @@ BONOBO_CLASS_BOILERPLATE_FULL (NautilusMetafile, nautilus_metafile,
BonoboObject, BONOBO_OBJECT_TYPE)
typedef struct MetafileReadState {
- gboolean use_public_metafile;
EelReadFileHandle *handle;
GnomeVFSAsyncHandle *get_file_info_handle;
} MetafileReadState;
typedef struct MetafileWriteState {
- gboolean use_public_metafile;
GnomeVFSAsyncHandle *handle;
xmlChar *buffer;
GnomeVFSFileSize size;
@@ -122,7 +120,6 @@ struct NautilusMetafileDetails {
GList *monitors;
char *private_uri;
- char *public_uri;
char *directory_uri;
GnomeVFSURI *directory_vfs_uri;
};
@@ -161,7 +158,6 @@ finalize (GObject *object)
g_assert (metafile->details->write_idle_id == 0);
g_free (metafile->details->private_uri);
- g_free (metafile->details->public_uri);
g_free (metafile->details->directory_uri);
g_free (metafile->details);
@@ -180,7 +176,7 @@ construct_private_metafile_uri (const char *uri)
user_directory = nautilus_get_user_directory ();
metafiles_directory = g_build_filename (user_directory, METAFILES_DIRECTORY_NAME, NULL);
g_free (user_directory);
- mkdir (metafiles_directory, 0777);
+ mkdir (metafiles_directory, 0700);
/* Construct a file name from the URI. */
escaped_uri = gnome_vfs_escape_slashes (uri);
@@ -213,14 +209,9 @@ nautilus_metafile_set_directory_uri (NautilusMetafile *metafile,
}
metafile->details->directory_vfs_uri = gnome_vfs_uri_new (directory_uri);
- g_free (metafile->details->public_uri);
- metafile->details->public_uri = g_build_filename
- (directory_uri, NAUTILUS_METAFILE_NAME_SUFFIX, NULL);
-
g_free (metafile->details->private_uri);
metafile->details->private_uri
= construct_private_metafile_uri (directory_uri);
-
}
static NautilusMetafile *
@@ -1554,33 +1545,6 @@ metafile_read_cancel (NautilusMetafile *metafile)
}
}
-static gboolean
-can_use_public_metafile (NautilusMetafile *metafile)
-{
- NautilusSpeedTradeoffValue preference_value;
-
- g_return_val_if_fail (NAUTILUS_IS_METAFILE (metafile), FALSE);
-
- if (metafile->details->public_uri == NULL) {
- return FALSE;
- }
-
- preference_value = eel_preferences_get_enum (NAUTILUS_PREFERENCES_USE_PUBLIC_METADATA);
-
- if (preference_value == NAUTILUS_SPEED_TRADEOFF_ALWAYS) {
- return TRUE;
- }
-
- if (preference_value == NAUTILUS_SPEED_TRADEOFF_NEVER) {
- return FALSE;
- }
-
- g_assert (preference_value == NAUTILUS_SPEED_TRADEOFF_LOCAL_ONLY);
-
- return metafile->details->directory_vfs_uri == NULL ||
- gnome_vfs_uri_is_local (metafile->details->directory_vfs_uri);
-}
-
static void
metafile_read_mark_done (NautilusMetafile *metafile)
{
@@ -1605,110 +1569,12 @@ metafile_read_done (NautilusMetafile *metafile)
}
static void
-metafile_read_try_public_metafile (NautilusMetafile *metafile)
-{
- metafile->details->read_state->use_public_metafile = TRUE;
- metafile_read_restart (metafile);
-}
-
-static void
-metafile_read_check_for_directory_callback (GnomeVFSAsyncHandle *handle,
- GList *results,
- gpointer callback_data)
-{
- NautilusMetafile *metafile;
- GnomeVFSGetFileInfoResult *result;
-
- metafile = NAUTILUS_METAFILE (callback_data);
-
- g_assert (metafile->details->read_state->get_file_info_handle == handle);
- g_assert (eel_g_list_exactly_one_item (results));
-
- metafile->details->read_state->get_file_info_handle = NULL;
-
- result = results->data;
-
- if (result->result == GNOME_VFS_OK
- && ((result->file_info->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_TYPE) != 0)
- && result->file_info->type == GNOME_VFS_FILE_TYPE_DIRECTORY) {
- /* Is a directory. */
- metafile_read_try_public_metafile (metafile);
- } else {
- /* Not a directory. */
- metafile_read_done (metafile);
- }
-}
-
-static void
-metafile_read_check_for_directory (NautilusMetafile *metafile)
-{
- GList fake_list;
-
- /* We only get here if the public metafile is in question,
- * which in turn only happens if the URI is one that gnome-vfs
- * can handle.
- */
- if (metafile->details->directory_vfs_uri == NULL) {
- metafile_read_done (metafile);
- return;
- }
-
- /* We have to do a get_info call to check if this a directory. */
- fake_list.data = metafile->details->directory_vfs_uri;
- fake_list.next = NULL;
- fake_list.prev = NULL;
- gnome_vfs_async_get_file_info
- (&metafile->details->read_state->get_file_info_handle,
- &fake_list,
- GNOME_VFS_FILE_INFO_FOLLOW_LINKS,
- GNOME_VFS_PRIORITY_DEFAULT,
- metafile_read_check_for_directory_callback,
- metafile);
-}
-
-static void
metafile_read_failed (NautilusMetafile *metafile)
{
- NautilusFile *file;
- gboolean need_directory_check, is_directory;
-
g_assert (NAUTILUS_IS_METAFILE (metafile));
metafile->details->read_state->handle = NULL;
- if (!metafile->details->read_state->use_public_metafile
- && can_use_public_metafile (metafile)) {
- /* The goal here is to read the real metafile, but
- * only if the directory is actually a directory.
- */
-
- /* First, check if we already know if it a directory. */
- file = nautilus_file_get (metafile->details->directory_uri);
- if (file == NULL || file->details->is_gone) {
- need_directory_check = FALSE;
- is_directory = FALSE;
- } else if (file->details->info == NULL) {
- need_directory_check = TRUE;
- is_directory = TRUE;
- } else {
- need_directory_check = FALSE;
- is_directory = nautilus_file_is_directory (file);
- }
- nautilus_file_unref (file);
-
- /* Do the directory check if we don't know. */
- if (need_directory_check) {
- metafile_read_check_for_directory (metafile);
- return;
- }
-
- /* Try for the public metafile if it is a directory. */
- if (is_directory) {
- metafile_read_try_public_metafile (metafile);
- return;
- }
- }
-
metafile_read_done (metafile);
}
@@ -1751,9 +1617,7 @@ static void
metafile_read_restart (NautilusMetafile *metafile)
{
metafile->details->read_state->handle = eel_read_entire_file_async
- (metafile->details->read_state->use_public_metafile
- ? metafile->details->public_uri
- : metafile->details->private_uri,
+ (metafile->details->private_uri,
GNOME_VFS_PRIORITY_DEFAULT,
metafile_read_done_callback, metafile);
}
@@ -1830,107 +1694,15 @@ metafile_write_done (NautilusMetafile *metafile)
static void
metafile_write_failed (NautilusMetafile *metafile)
{
- if (metafile->details->write_state->use_public_metafile) {
- metafile->details->write_state->use_public_metafile = FALSE;
- metafile_write_start (metafile);
- return;
- }
-
metafile_write_done (metafile);
}
static void
metafile_write_succeeded (NautilusMetafile *metafile)
{
-
- /* Now that we have finished writing, it is time to delete the
- * private file if we wrote the public one.
- */
- if (metafile->details->write_state->use_public_metafile) {
- /* A synchronous unlink is OK here because the private
- * metafiles are local, so an unlink is very fast.
- */
- gnome_vfs_unlink (metafile->details->private_uri);
- }
-
metafile_write_done (metafile);
}
-static void
-metafile_write_failure_close_callback (GnomeVFSAsyncHandle *handle,
- GnomeVFSResult result,
- gpointer callback_data)
-{
- NautilusMetafile *metafile;
-
- metafile = NAUTILUS_METAFILE (callback_data);
-
- metafile_write_failed (metafile);
-}
-
-static void
-metafile_write_success_close_callback (GnomeVFSAsyncHandle *handle,
- GnomeVFSResult result,
- gpointer callback_data)
-{
- NautilusMetafile *metafile;
-
- metafile = NAUTILUS_METAFILE (callback_data);
- g_assert (metafile->details->write_state->handle == NULL);
-
- if (result != GNOME_VFS_OK) {
- metafile_write_failed (metafile);
- } else {
- metafile_write_succeeded (metafile);
- }
-}
-
-static void
-metafile_write_callback (GnomeVFSAsyncHandle *handle,
- GnomeVFSResult result,
- gconstpointer buffer,
- GnomeVFSFileSize bytes_requested,
- GnomeVFSFileSize bytes_read,
- gpointer callback_data)
-{
- NautilusMetafile *metafile;
-
- metafile = NAUTILUS_METAFILE (callback_data);
- g_assert (metafile->details->write_state->handle == handle);
- g_assert (metafile->details->write_state->buffer == buffer);
- g_assert (metafile->details->write_state->size == bytes_requested);
-
- g_assert (metafile->details->write_state->handle != NULL);
- gnome_vfs_async_close (metafile->details->write_state->handle,
- result == GNOME_VFS_OK
- ? metafile_write_success_close_callback
- : metafile_write_failure_close_callback,
- metafile);
- metafile->details->write_state->handle = NULL;
-}
-
-static void
-metafile_write_create_callback (GnomeVFSAsyncHandle *handle,
- GnomeVFSResult result,
- gpointer callback_data)
-{
- NautilusMetafile *metafile;
-
- metafile = NAUTILUS_METAFILE (callback_data);
- g_assert (metafile->details->write_state->handle == handle);
-
- if (result != GNOME_VFS_OK) {
- metafile_write_failed (metafile);
- return;
- }
-
- gnome_vfs_async_write (metafile->details->write_state->handle,
- metafile->details->write_state->buffer,
- metafile->details->write_state->size,
- metafile_write_callback,
- metafile);
-}
-
static int
write_all (int fd, const char *buffer, int size)
{
@@ -2008,22 +1780,13 @@ metafile_write_start (NautilusMetafile *metafile)
metafile->details->write_state->write_again = FALSE;
- metafile_uri = metafile->details->write_state->use_public_metafile
- ? metafile->details->public_uri
- : metafile->details->private_uri;
+ metafile_uri = metafile->details->private_uri;
metafile_path = gnome_vfs_get_local_path_from_uri (metafile_uri);
- if (metafile_path == NULL) {
- gnome_vfs_async_create
- (&metafile->details->write_state->handle,
- metafile_uri,
- GNOME_VFS_OPEN_WRITE, FALSE, METAFILE_PERMISSIONS,
- GNOME_VFS_PRIORITY_DEFAULT,
- metafile_write_create_callback, metafile);
- } else {
- metafile_write_local (metafile, metafile_path);
- g_free (metafile_path);
- }
+ g_assert (metafile_path != NULL);
+
+ metafile_write_local (metafile, metafile_path);
+ g_free (metafile_path);
}
static void
@@ -2053,8 +1816,6 @@ metafile_write (NautilusMetafile *metafile)
/* Create the write state. */
metafile->details->write_state = g_new0 (MetafileWriteState, 1);
- metafile->details->write_state->use_public_metafile
- = can_use_public_metafile (metafile);
xmlDocDumpMemory (metafile->details->xml,
&metafile->details->write_state->buffer,
&xml_doc_size);
diff --git a/libnautilus-private/nautilus-metafile.h b/libnautilus-private/nautilus-metafile.h
index 2f3ddf0a9..df98c80f9 100644
--- a/libnautilus-private/nautilus-metafile.h
+++ b/libnautilus-private/nautilus-metafile.h
@@ -50,7 +50,4 @@ GtkType nautilus_metafile_get_type (void);
NautilusMetafile *nautilus_metafile_get (const char *directory_uri);
-/* Specifications for in-directory metafile. */
-#define NAUTILUS_METAFILE_NAME_SUFFIX ".nautilus-metafile.xml"
-
#endif /* NAUTILUS_METAFILE_H */
diff --git a/libnautilus-private/nautilus-thumbnails.c b/libnautilus-private/nautilus-thumbnails.c
index 161816559..16bbc46ca 100644
--- a/libnautilus-private/nautilus-thumbnails.c
+++ b/libnautilus-private/nautilus-thumbnails.c
@@ -104,25 +104,9 @@ uri_is_local (const char *uri)
static gboolean
prefer_global_thumbnails_location (const char *image_uri)
{
- static int public_metadata_preference;
- static gboolean public_metadata_preference_registered;
-
- if (!public_metadata_preference_registered) {
- eel_preferences_add_auto_enum (NAUTILUS_PREFERENCES_USE_PUBLIC_METADATA,
- &public_metadata_preference);
- public_metadata_preference_registered = TRUE;
- }
-
- if (public_metadata_preference == NAUTILUS_SPEED_TRADEOFF_NEVER) {
- return TRUE;
- }
-
- if (public_metadata_preference == NAUTILUS_SPEED_TRADEOFF_ALWAYS) {
- return FALSE;
- }
-
- g_assert (public_metadata_preference == NAUTILUS_SPEED_TRADEOFF_LOCAL_ONLY);
- return !uri_is_local (image_uri);
+ /* We always prefer global thumbnails since we removed public
+ metadata. */
+ return TRUE;
}
/* this functions looks for a password in a uri and changes it for 6 'x' */
diff --git a/libnautilus-private/nautilus-vfs-directory.c b/libnautilus-private/nautilus-vfs-directory.c
index b71eb7f0d..dabef3af2 100644
--- a/libnautilus-private/nautilus-vfs-directory.c
+++ b/libnautilus-private/nautilus-vfs-directory.c
@@ -163,19 +163,10 @@ vfs_are_all_files_seen (NautilusDirectory *directory)
static gboolean
vfs_is_not_empty (NautilusDirectory *directory)
{
- GList *node;
-
g_return_val_if_fail (NAUTILUS_IS_VFS_DIRECTORY (directory), FALSE);
g_return_val_if_fail (nautilus_directory_is_anyone_monitoring_file_list (directory), FALSE);
- for (node = directory->details->file_list; node != NULL; node = node->next) {
- if (!nautilus_file_is_metafile (NAUTILUS_FILE (node->data))) {
- /* Return TRUE if the directory contains anything besides a metafile. */
- return TRUE;
- }
- }
-
- return FALSE;
+ return directory->details->file_list != NULL;
}
static void