summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarin Adler <darin@src.gnome.org>2000-12-29 21:01:44 +0000
committerDarin Adler <darin@src.gnome.org>2000-12-29 21:01:44 +0000
commit47a828d5502a1b3abf7d92f01c2e69c78c52bcea (patch)
tree3a692b16214cbc74a505001ce385497e2fcef246
parent7c3b04d2ac14263b50c339897dc315dc2b155500 (diff)
downloadnautilus-47a828d5502a1b3abf7d92f01c2e69c78c52bcea.tar.gz
reviewed by: Gene Ragan <gzr@eazel.com>
Fixed bug 5067 (Moving a file doesn't update the directory in the link hash table). Fixed bug 5366 (error when passing two directories on the command line). * libnautilus-extensions/nautilus-directory.c: (nautilus_directory_remove_file): Change code that was doing "== FALSE" which is not such good style. (nautilus_directory_notify_files_moved): Change to properly update file names in all cases and to update the directory with a new nautilus_file_set_directory function. * libnautilus-extensions/nautilus-file-private.h: Moved the Knowledge enum up here. I was going to make a change that required it, and now I don't feel like moving it back. * libnautilus-extensions/nautilus-file.h: Add nautilus_file_set_directory (and reformat). * libnautilus-extensions/nautilus-file.c: (is_self_owned), (destroy): Moved is_self_owned so the destroy function can use it. (update_info_internal): Call the update_links functions before (nautilus_file_set_directory): New function that changes the parent directory and updates everything appropriately. (nautilus_file_mark_gone): Added a check that the file is not already marked gone. * src/nautilus-main.c: (main): Sort the command-line options, add some single-character versions, add code to initialize the "geometry" variable for the case where the option is not passed, removed some unused code that sets start_desktop twice.
-rw-r--r--ChangeLog39
-rw-r--r--libnautilus-extensions/nautilus-directory.c53
-rw-r--r--libnautilus-extensions/nautilus-file-private.h52
-rw-r--r--libnautilus-extensions/nautilus-file.c73
-rw-r--r--libnautilus-extensions/nautilus-file.h297
-rw-r--r--libnautilus-private/nautilus-directory.c53
-rw-r--r--libnautilus-private/nautilus-file-private.h52
-rw-r--r--libnautilus-private/nautilus-file.c73
-rw-r--r--libnautilus-private/nautilus-file.h297
-rw-r--r--src/nautilus-main.c16
10 files changed, 538 insertions, 467 deletions
diff --git a/ChangeLog b/ChangeLog
index b602ee1f2..eab74b5ab 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,40 @@
+2000-12-29 Darin Adler <darin@eazel.com>
+
+ reviewed by: Gene Ragan <gzr@eazel.com>
+
+ Fixed bug 5067 (Moving a file doesn't update the directory in the
+ link hash table).
+
+ Fixed bug 5366 (error when passing two directories on the command
+ line).
+
+ * libnautilus-extensions/nautilus-directory.c:
+ (nautilus_directory_remove_file): Change code that was doing "==
+ FALSE" which is not such good style.
+ (nautilus_directory_notify_files_moved): Change to properly update
+ file names in all cases and to update the directory with a new
+ nautilus_file_set_directory function.
+
+ * libnautilus-extensions/nautilus-file-private.h: Moved the
+ Knowledge enum up here. I was going to make a change that required
+ it, and now I don't feel like moving it back.
+
+ * libnautilus-extensions/nautilus-file.h: Add
+ nautilus_file_set_directory (and reformat).
+
+ * libnautilus-extensions/nautilus-file.c: (is_self_owned),
+ (destroy): Moved is_self_owned so the destroy function can use it.
+ (update_info_internal): Call the update_links functions before
+ (nautilus_file_set_directory): New function that changes the
+ parent directory and updates everything appropriately.
+ (nautilus_file_mark_gone): Added a check that the file is not
+ already marked gone.
+
+ * src/nautilus-main.c: (main): Sort the command-line options, add
+ some single-character versions, add code to initialize the
+ "geometry" variable for the case where the option is not passed,
+ removed some unused code that sets start_desktop twice.
+
2000-12-28 Pavel Cisler <pavel@eazel.com>
Fixed bug 4952 (Move or copy or large number of items fails).
@@ -36,7 +73,7 @@
reviewed by: Maciej Stachowiak <mjs@eazel.com>
- Fixed bug 2802 (copy all metadata, not just certain items). There
+ Fixed bug 2808 (copy all metadata, not just certain items). There
are still a few loose ends but it's basically there.
Fixed bug 5296 (Hardware overview should be localized).
diff --git a/libnautilus-extensions/nautilus-directory.c b/libnautilus-extensions/nautilus-directory.c
index 816cb5c84..aeddeb230 100644
--- a/libnautilus-extensions/nautilus-directory.c
+++ b/libnautilus-extensions/nautilus-directory.c
@@ -580,7 +580,7 @@ nautilus_directory_remove_file (NautilusDirectory *directory, NautilusFile *file
(directory->details->file_list, node);
g_list_free_1 (node);
- if (file->details->unconfirmed == FALSE) {
+ if (!file->details->unconfirmed) {
directory->details->confirmed_file_count--;
}
@@ -1168,52 +1168,29 @@ nautilus_directory_notify_files_moved (GList *uri_pairs)
} else {
/* Handle notification in the old directory. */
old_directory = file->details->directory;
- hash_table_list_prepend (changed_lists,
- old_directory,
- file);
-
collect_parent_directories (parent_directories, old_directory);
/* Locate the new directory. */
new_directory = get_parent_directory (pair->to_uri);
- g_assert (new_directory != NULL);
-
collect_parent_directories (parent_directories, new_directory);
- /* If the file is moving between directories,
- * there is more to do.
- */
- if (new_directory != old_directory) {
- /* Update the name. */
- name = nautilus_uri_get_basename (pair->to_uri);
- nautilus_file_update_name (file, name);
- g_free (name);
-
- /* Remove from old directory. */
- nautilus_directory_remove_file (old_directory, file);
-
- /* Point the file at the new
- * directory. We already have a ref to
- * it from the get_parent_directory
- * function so we don't have to ref.
- */
- /* FIXME bugzilla.eazel.com 5067: This
- * needs to update the link hash
- * table.
- */
- file->details->directory = new_directory;
-
- /* Add to new directory. */
- nautilus_directory_add_file (new_directory, file);
-
- /* Handle notification in the new directory. */
- hash_table_list_prepend (added_lists,
- new_directory,
- file);
+ /* Update the file's name. */
+ name = nautilus_uri_get_basename (pair->to_uri);
+ nautilus_file_update_name (file, name);
+ g_free (name);
+
+ /* Update the file's directory. */
+ nautilus_file_set_directory (file, new_directory);
+
+ hash_table_list_prepend
+ (changed_lists, old_directory, file);
+ if (old_directory != new_directory) {
+ hash_table_list_prepend
+ (added_lists, new_directory, file);
}
- /* Done with the old directory. */
nautilus_directory_unref (old_directory);
+ nautilus_directory_unref (new_directory);
/* Unref each file once to balance out nautilus_file_get. */
unref_list = g_list_prepend (unref_list, file);
diff --git a/libnautilus-extensions/nautilus-file-private.h b/libnautilus-extensions/nautilus-file-private.h
index feeae674a..cf43c78d2 100644
--- a/libnautilus-extensions/nautilus-file-private.h
+++ b/libnautilus-extensions/nautilus-file-private.h
@@ -26,6 +26,19 @@
#include "nautilus-directory.h"
#include "nautilus-glib-extensions.h"
+#define NAUTILUS_FILE_TOP_LEFT_TEXT_MAXIMUM_CHARACTERS_PER_LINE 80
+#define NAUTILUS_FILE_TOP_LEFT_TEXT_MAXIMUM_LINES 24
+#define NAUTILUS_FILE_TOP_LEFT_TEXT_MAXIMUM_BYTES 10000
+
+/* These are in the typical sort order. Known things come first, then
+ * things where we can't know, finally things where we don't yet know.
+ */
+typedef enum {
+ KNOWN,
+ UNKNOWABLE,
+ UNKNOWN
+} Knowledge;
+
struct NautilusFileDetails
{
NautilusDirectory *directory;
@@ -45,7 +58,7 @@ struct NautilusFileDetails
guint deep_unreadable_count;
GnomeVFSFileSize deep_size;
- GList *mime_list; /* If this is a directory, the list of MIME types in it. */
+ GList *mime_list; /* If this is a directory, the list of MIME types in it. */
char *top_left_text;
char *activation_uri;
@@ -86,35 +99,32 @@ struct NautilusFileDetails
nautilus_boolean_bit activation_uri_is_up_to_date : 1;
};
-#define NAUTILUS_FILE_TOP_LEFT_TEXT_MAXIMUM_CHARACTERS_PER_LINE 80
-#define NAUTILUS_FILE_TOP_LEFT_TEXT_MAXIMUM_LINES 24
-#define NAUTILUS_FILE_TOP_LEFT_TEXT_MAXIMUM_BYTES 10000
-
-NautilusFile *nautilus_file_new_from_info (NautilusDirectory *directory,
- GnomeVFSFileInfo *info);
-NautilusFile *nautilus_file_get_existing (const char *uri);
-void nautilus_file_emit_changed (NautilusFile *file);
-void nautilus_file_mark_gone (NautilusFile *file);
-char * nautilus_extract_top_left_text (const char *text,
- int length);
-gboolean nautilus_file_contains_text (NautilusFile *file);
+NautilusFile *nautilus_file_new_from_info (NautilusDirectory *directory,
+ GnomeVFSFileInfo *info);
+NautilusFile *nautilus_file_get_existing (const char *uri);
+void nautilus_file_emit_changed (NautilusFile *file);
+void nautilus_file_mark_gone (NautilusFile *file);
+char * nautilus_extract_top_left_text (const char *text,
+ int length);
+gboolean nautilus_file_contains_text (NautilusFile *file);
+void nautilus_file_set_directory (NautilusFile *file,
+ NautilusDirectory *directory);
/* Compare file's state with a fresh file info struct, return FALSE if
* no change, update file and return TRUE if the file info contains
* new state. */
-gboolean nautilus_file_update_info (NautilusFile *file,
- GnomeVFSFileInfo *info);
-gboolean nautilus_file_update_name (NautilusFile *file,
- const char *name);
+gboolean nautilus_file_update_info (NautilusFile *file,
+ GnomeVFSFileInfo *info);
+gboolean nautilus_file_update_name (NautilusFile *file,
+ const char *name);
/* Return true if the top lefts of files in this directory should be
* fetched, according to the preference settings.
*/
-gboolean nautilus_file_should_get_top_left_text (NautilusFile *file);
+gboolean nautilus_file_should_get_top_left_text (NautilusFile *file);
/* Mark specified attributes for this file out of date without canceling current
* I/O or kicking off new I/O.
*/
-void nautilus_file_invalidate_attributes_internal (NautilusFile *file,
- GList *file_attributes);
-
+void nautilus_file_invalidate_attributes_internal (NautilusFile *file,
+ GList *file_attributes);
diff --git a/libnautilus-extensions/nautilus-file.c b/libnautilus-extensions/nautilus-file.c
index 232bb9aaa..48e446bf0 100644
--- a/libnautilus-extensions/nautilus-file.c
+++ b/libnautilus-extensions/nautilus-file.c
@@ -80,15 +80,6 @@ typedef struct {
gpointer callback_data;
} Operation;
-/* These are in sort order. Known things come first, then things
- * where we can't know, finally things where we don't yet know.
- */
-typedef enum {
- KNOWN,
- UNKNOWABLE,
- UNKNOWN
-} Knowledge;
-
typedef GList * (* ModifyListFunction) (GList *list, NautilusFile *file);
enum {
@@ -157,8 +148,8 @@ nautilus_file_new_from_relative_uri (NautilusDirectory *directory,
#endif
nautilus_directory_ref (directory);
-
file->details->directory = directory;
+
file->details->relative_uri = g_strdup (relative_uri);
return file;
@@ -390,6 +381,12 @@ nautilus_file_get (const char *uri)
return nautilus_file_get_internal (uri, TRUE);
}
+static gboolean
+is_self_owned (NautilusFile *file)
+{
+ return file->details->directory->details->as_file == file;
+}
+
static void
destroy (GtkObject *object)
{
@@ -406,7 +403,7 @@ destroy (GtkObject *object)
directory = file->details->directory;
- if (directory->details->as_file == file) {
+ if (is_self_owned (file)) {
directory->details->as_file = NULL;
} else {
if (!file->details->is_gone) {
@@ -464,12 +461,6 @@ nautilus_file_unref (NautilusFile *file)
gtk_object_unref (GTK_OBJECT (file));
}
-static gboolean
-is_self_owned (NautilusFile *file)
-{
- return file->details->directory->details->as_file == file;
-}
-
/**
* nautilus_file_get_parent_uri_for_display:
*
@@ -1112,7 +1103,7 @@ static void
update_links_if_target (NautilusFile *target_file)
{
GList *link_files, *p;
-
+
link_files = get_link_files (target_file);
for (p = link_files; p != NULL; p = p->next) {
update_link (NAUTILUS_FILE (p->data), target_file);
@@ -1229,6 +1220,46 @@ nautilus_file_update_name (NautilusFile *file, const char *name)
return TRUE;
}
+void
+nautilus_file_set_directory (NautilusFile *file,
+ NautilusDirectory *new_directory)
+{
+ NautilusDirectory *old_directory;
+
+ g_return_if_fail (NAUTILUS_IS_FILE (file));
+ g_return_if_fail (NAUTILUS_IS_DIRECTORY (file->details->directory));
+ g_return_if_fail (!file->details->is_gone);
+ g_return_if_fail (!is_self_owned (file));
+ g_return_if_fail (NAUTILUS_IS_DIRECTORY (new_directory));
+
+ old_directory = file->details->directory;
+ if (old_directory == new_directory) {
+ return;
+ }
+
+ nautilus_file_ref (file);
+
+ /* FIXME bugzilla.eazel.com 2044: Need to let links that
+ * point to the old name know that the file has been moved.
+ */
+
+ remove_from_link_hash_table (file);
+
+ nautilus_directory_remove_file (old_directory, file);
+
+ nautilus_directory_ref (new_directory);
+ file->details->directory = new_directory;
+ nautilus_directory_unref (old_directory);
+
+ nautilus_directory_add_file (new_directory, file);
+
+ add_to_link_hash_table (file);
+
+ update_links_if_target (file);
+
+ nautilus_file_unref (file);
+}
+
static Knowledge
get_item_count (NautilusFile *file,
guint *count)
@@ -4131,6 +4162,8 @@ nautilus_file_mark_gone (NautilusFile *file)
{
NautilusDirectory *directory;
+ g_return_if_fail (!file->details->is_gone);
+
file->details->is_gone = TRUE;
update_links_if_target (file);
@@ -4381,13 +4414,13 @@ nautilus_file_invalidate_attributes_internal (NautilusFile *file,
void
nautilus_file_invalidate_attributes (NautilusFile *file,
- GList *file_attributes)
+ GList *file_attributes)
{
/* Cancel possible in-progress loads of any of these attributes */
nautilus_directory_cancel_loading_file_attributes (file->details->directory,
file,
file_attributes);
-
+
/* Actually invalidate the values */
nautilus_file_invalidate_attributes_internal (file, file_attributes);
diff --git a/libnautilus-extensions/nautilus-file.h b/libnautilus-extensions/nautilus-file.h
index aa76ffc29..b7e9f9e0d 100644
--- a/libnautilus-extensions/nautilus-file.h
+++ b/libnautilus-extensions/nautilus-file.h
@@ -79,216 +79,213 @@ typedef void (*NautilusFileOperationCallback) (NautilusFile *file,
gpointer callback_data);
/* GtkObject requirements. */
-GtkType nautilus_file_get_type (void);
+GtkType nautilus_file_get_type (void);
/* Getting at a single file. */
-NautilusFile * nautilus_file_get (const char *uri);
+NautilusFile * nautilus_file_get (const char *uri);
/* Covers for gtk_object_ref and gtk_object_unref that provide two conveniences:
* 1) You don't have to cast to GtkObject *, so using these is type safe.
* 2) You are allowed to call these with NULL,
*/
-NautilusFile * nautilus_file_ref (NautilusFile *file);
-void nautilus_file_unref (NautilusFile *file);
+NautilusFile * nautilus_file_ref (NautilusFile *file);
+void nautilus_file_unref (NautilusFile *file);
/* Monitor the file. */
-void nautilus_file_monitor_add (NautilusFile *file,
- gconstpointer client,
- GList *attributes);
-void nautilus_file_monitor_remove (NautilusFile *file,
- gconstpointer client);
+void nautilus_file_monitor_add (NautilusFile *file,
+ gconstpointer client,
+ GList *attributes);
+void nautilus_file_monitor_remove (NautilusFile *file,
+ gconstpointer client);
/* Waiting for data that's read asynchronously.
* This interface currently works only for metadata, but could be expanded
* to other attributes as well.
*/
-void nautilus_file_call_when_ready (NautilusFile *file,
- GList *attributes,
- NautilusFileCallback callback,
- gpointer callback_data);
-void nautilus_file_cancel_call_when_ready (NautilusFile *file,
- NautilusFileCallback callback,
- gpointer callback_data);
-gboolean nautilus_file_check_if_ready (NautilusFile *file,
- GList *attributes);
-void nautilus_file_invalidate_attributes (NautilusFile *file,
- GList *file_attributes);
-void nautilus_file_invalidate_all_attributes (NautilusFile *file);
+void nautilus_file_call_when_ready (NautilusFile *file,
+ GList *attributes,
+ NautilusFileCallback callback,
+ gpointer callback_data);
+void nautilus_file_cancel_call_when_ready (NautilusFile *file,
+ NautilusFileCallback callback,
+ gpointer callback_data);
+gboolean nautilus_file_check_if_ready (NautilusFile *file,
+ GList *attributes);
+void nautilus_file_invalidate_attributes (NautilusFile *file,
+ GList *file_attributes);
+void nautilus_file_invalidate_all_attributes (NautilusFile *file);
/* Basic attributes for file objects. */
-char * nautilus_file_get_name (NautilusFile *file);
-char * nautilus_file_get_uri (NautilusFile *file);
-char * nautilus_file_get_uri_scheme (NautilusFile *file);
-char * nautilus_file_get_parent_uri (NautilusFile *file);
-char * nautilus_file_get_parent_uri_for_display (NautilusFile *file);
-GnomeVFSFileSize nautilus_file_get_size (NautilusFile *file);
-GnomeVFSFileType nautilus_file_get_file_type (NautilusFile *file);
-char * nautilus_file_get_mime_type (NautilusFile *file);
-gboolean nautilus_file_is_mime_type (NautilusFile *file,
- const char *mime_type);
-gboolean nautilus_file_is_symbolic_link (NautilusFile *file);
+char * nautilus_file_get_name (NautilusFile *file);
+char * nautilus_file_get_uri (NautilusFile *file);
+char * nautilus_file_get_uri_scheme (NautilusFile *file);
+char * nautilus_file_get_parent_uri (NautilusFile *file);
+char * nautilus_file_get_parent_uri_for_display (NautilusFile *file);
+GnomeVFSFileSize nautilus_file_get_size (NautilusFile *file);
+GnomeVFSFileType nautilus_file_get_file_type (NautilusFile *file);
+char * nautilus_file_get_mime_type (NautilusFile *file);
+gboolean nautilus_file_is_mime_type (NautilusFile *file,
+ const char *mime_type);
+gboolean nautilus_file_is_symbolic_link (NautilusFile *file);
char * nautilus_file_get_symbolic_link_target_path
- (NautilusFile *file);
-gboolean nautilus_file_is_broken_symbolic_link (NautilusFile *file);
-gboolean nautilus_file_is_nautilus_link (NautilusFile *file);
-gboolean nautilus_file_is_executable (NautilusFile *file);
-gboolean nautilus_file_is_directory (NautilusFile *file);
-gboolean nautilus_file_is_in_trash (NautilusFile *file);
-GnomeVFSResult nautilus_file_get_file_info_result (NautilusFile *file);
-gboolean nautilus_file_get_directory_item_count (NautilusFile *file,
- guint *count,
- gboolean *count_unreadable);
-void nautilus_file_recompute_deep_counts (NautilusFile *file);
-NautilusRequestStatus nautilus_file_get_deep_counts (NautilusFile *file,
- guint *directory_count,
- guint *file_count,
- guint *unreadable_directory_count,
- GnomeVFSFileSize *total_size);
-GList * nautilus_file_get_keywords (NautilusFile *file);
-void nautilus_file_set_keywords (NautilusFile *file,
- GList *keywords);
-GList * nautilus_file_get_emblem_names (NautilusFile *file);
-char * nautilus_file_get_top_left_text (NautilusFile *file);
-gboolean nautilus_file_get_directory_item_mime_types (NautilusFile *file,
+(NautilusFile *file);
+gboolean nautilus_file_is_broken_symbolic_link (NautilusFile *file);
+gboolean nautilus_file_is_nautilus_link (NautilusFile *file);
+gboolean nautilus_file_is_executable (NautilusFile *file);
+gboolean nautilus_file_is_directory (NautilusFile *file);
+gboolean nautilus_file_is_in_trash (NautilusFile *file);
+GnomeVFSResult nautilus_file_get_file_info_result (NautilusFile *file);
+gboolean nautilus_file_get_directory_item_count (NautilusFile *file,
+ guint *count,
+ gboolean *count_unreadable);
+void nautilus_file_recompute_deep_counts (NautilusFile *file);
+NautilusRequestStatus nautilus_file_get_deep_counts (NautilusFile *file,
+ guint *directory_count,
+ guint *file_count,
+ guint *unreadable_directory_count,
+ GnomeVFSFileSize *total_size);
+GList * nautilus_file_get_keywords (NautilusFile *file);
+void nautilus_file_set_keywords (NautilusFile *file,
+ GList *keywords);
+GList * nautilus_file_get_emblem_names (NautilusFile *file);
+char * nautilus_file_get_top_left_text (NautilusFile *file);
+gboolean nautilus_file_get_directory_item_mime_types (NautilusFile *file,
GList **mime_list);
/* Permissions. */
-gboolean nautilus_file_can_get_permissions (NautilusFile *file);
-gboolean nautilus_file_can_set_permissions (NautilusFile *file);
-GnomeVFSFilePermissions nautilus_file_get_permissions (NautilusFile *file);
-
-gboolean nautilus_file_can_get_owner (NautilusFile *file);
-gboolean nautilus_file_can_set_owner (NautilusFile *file);
-gboolean nautilus_file_can_get_group (NautilusFile *file);
-gboolean nautilus_file_can_set_group (NautilusFile *file);
-char * nautilus_file_get_owner_name (NautilusFile *file);
-char * nautilus_file_get_group_name (NautilusFile *file);
-GList * nautilus_get_user_names (void);
-GList * nautilus_get_group_names (void);
-GList * nautilus_file_get_settable_group_names (NautilusFile *file);
+gboolean nautilus_file_can_get_permissions (NautilusFile *file);
+gboolean nautilus_file_can_set_permissions (NautilusFile *file);
+GnomeVFSFilePermissions nautilus_file_get_permissions (NautilusFile *file);
+gboolean nautilus_file_can_get_owner (NautilusFile *file);
+gboolean nautilus_file_can_set_owner (NautilusFile *file);
+gboolean nautilus_file_can_get_group (NautilusFile *file);
+gboolean nautilus_file_can_set_group (NautilusFile *file);
+char * nautilus_file_get_owner_name (NautilusFile *file);
+char * nautilus_file_get_group_name (NautilusFile *file);
+GList * nautilus_get_user_names (void);
+GList * nautilus_get_group_names (void);
+GList * nautilus_file_get_settable_group_names (NautilusFile *file);
/* "Capabilities". */
-gboolean nautilus_file_can_read (NautilusFile *file);
-gboolean nautilus_file_can_write (NautilusFile *file);
-gboolean nautilus_file_can_execute (NautilusFile *file);
-gboolean nautilus_file_can_rename (NautilusFile *file);
+gboolean nautilus_file_can_read (NautilusFile *file);
+gboolean nautilus_file_can_write (NautilusFile *file);
+gboolean nautilus_file_can_execute (NautilusFile *file);
+gboolean nautilus_file_can_rename (NautilusFile *file);
/* Basic operations for file objects. */
-void nautilus_file_set_owner (NautilusFile *file,
- const char *user_name_or_id,
- NautilusFileOperationCallback callback,
- gpointer callback_data);
-void nautilus_file_set_group (NautilusFile *file,
- const char *group_name_or_id,
- NautilusFileOperationCallback callback,
- gpointer callback_data);
-void nautilus_file_set_permissions (NautilusFile *file,
- GnomeVFSFilePermissions permissions,
- NautilusFileOperationCallback callback,
- gpointer callback_data);
-void nautilus_file_rename (NautilusFile *file,
- const char *new_name,
- NautilusFileOperationCallback callback,
- gpointer callback_data);
-void nautilus_file_cancel (NautilusFile *file,
- NautilusFileOperationCallback callback,
- gpointer callback_data);
+void nautilus_file_set_owner (NautilusFile *file,
+ const char *user_name_or_id,
+ NautilusFileOperationCallback callback,
+ gpointer callback_data);
+void nautilus_file_set_group (NautilusFile *file,
+ const char *group_name_or_id,
+ NautilusFileOperationCallback callback,
+ gpointer callback_data);
+void nautilus_file_set_permissions (NautilusFile *file,
+ GnomeVFSFilePermissions permissions,
+ NautilusFileOperationCallback callback,
+ gpointer callback_data);
+void nautilus_file_rename (NautilusFile *file,
+ const char *new_name,
+ NautilusFileOperationCallback callback,
+ gpointer callback_data);
+void nautilus_file_cancel (NautilusFile *file,
+ NautilusFileOperationCallback callback,
+ gpointer callback_data);
/* Return true if this file has already been deleted.
* This object will be unref'd after sending the files_removed signal,
* but it could hang around longer if someone ref'd it.
*/
-gboolean nautilus_file_is_gone (NautilusFile *file);
+gboolean nautilus_file_is_gone (NautilusFile *file);
/* Simple getting and setting top-level metadata. */
-char * nautilus_file_get_metadata (NautilusFile *file,
- const char *key,
- const char *default_metadata);
-GList * nautilus_file_get_metadata_list (NautilusFile *file,
- const char *list_key,
- const char *list_subkey);
-void nautilus_file_set_metadata (NautilusFile *file,
- const char *key,
- const char *default_metadata,
- const char *metadata);
-void nautilus_file_set_metadata_list (NautilusFile *file,
- const char *list_key,
- const char *list_subkey,
- GList *list);
+char * nautilus_file_get_metadata (NautilusFile *file,
+ const char *key,
+ const char *default_metadata);
+GList * nautilus_file_get_metadata_list (NautilusFile *file,
+ const char *list_key,
+ const char *list_subkey);
+void nautilus_file_set_metadata (NautilusFile *file,
+ const char *key,
+ const char *default_metadata,
+ const char *metadata);
+void nautilus_file_set_metadata_list (NautilusFile *file,
+ const char *list_key,
+ const char *list_subkey,
+ GList *list);
/* Covers for common data types. */
-gboolean nautilus_file_get_boolean_metadata (NautilusFile *file,
- const char *key,
- gboolean default_metadata);
-void nautilus_file_set_boolean_metadata (NautilusFile *file,
- const char *key,
- gboolean default_metadata,
- gboolean metadata);
-int nautilus_file_get_integer_metadata (NautilusFile *file,
- const char *key,
- int default_metadata);
-void nautilus_file_set_integer_metadata (NautilusFile *file,
- const char *key,
- int default_metadata,
- int metadata);
+gboolean nautilus_file_get_boolean_metadata (NautilusFile *file,
+ const char *key,
+ gboolean default_metadata);
+void nautilus_file_set_boolean_metadata (NautilusFile *file,
+ const char *key,
+ gboolean default_metadata,
+ gboolean metadata);
+int nautilus_file_get_integer_metadata (NautilusFile *file,
+ const char *key,
+ int default_metadata);
+void nautilus_file_set_integer_metadata (NautilusFile *file,
+ const char *key,
+ int default_metadata,
+ int metadata);
/* Attributes for file objects as user-displayable strings. */
-char * nautilus_file_get_string_attribute (NautilusFile *file,
- const char *attribute_name);
+char * nautilus_file_get_string_attribute (NautilusFile *file,
+ const char *attribute_name);
char * nautilus_file_get_string_attribute_with_default
- (NautilusFile *file,
- const char *attribute_name);
+(NautilusFile *file,
+ const char *attribute_name);
/* Matching with another URI. */
-gboolean nautilus_file_matches_uri (NautilusFile *file,
- const char *uri);
+gboolean nautilus_file_matches_uri (NautilusFile *file,
+ const char *uri);
/* Is the file local? */
-gboolean nautilus_file_is_local (NautilusFile *file);
+gboolean nautilus_file_is_local (NautilusFile *file);
/* Comparing two file objects for sorting */
-int nautilus_file_compare_for_sort (NautilusFile *file_1,
- NautilusFile *file_2,
- NautilusFileSortType sort_type);
-int nautilus_file_compare_for_sort_reversed (NautilusFile *file_1,
- NautilusFile *file_2,
- NautilusFileSortType sort_type);
-int nautilus_file_compare_name (NautilusFile *file_1,
- const char *pattern);
+int nautilus_file_compare_for_sort (NautilusFile *file_1,
+ NautilusFile *file_2,
+ NautilusFileSortType sort_type);
+int nautilus_file_compare_for_sort_reversed (NautilusFile *file_1,
+ NautilusFile *file_2,
+ NautilusFileSortType sort_type);
+int nautilus_file_compare_name (NautilusFile *file_1,
+ const char *pattern);
/* 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_should_show (NautilusFile *file,
- gboolean show_hidden,
- gboolean show_backup);
-
-GList *nautilus_file_list_filter_hidden_and_backup (GList *files,
- gboolean show_hidden,
- gboolean show_backup);
+gboolean nautilus_file_is_hidden_file (NautilusFile *file);
+gboolean nautilus_file_is_backup_file (NautilusFile *file);
+gboolean nautilus_file_should_show (NautilusFile *file,
+ gboolean show_hidden,
+ gboolean show_backup);
+GList *nautilus_file_list_filter_hidden_and_backup (GList *files,
+ gboolean show_hidden,
+ gboolean show_backup);
/* Get the URI that's used when activating the file.
* Getting this can require reading the contents of the file.
*/
-char * nautilus_file_get_activation_uri (NautilusFile *file);
+char * nautilus_file_get_activation_uri (NautilusFile *file);
/* Convenience functions for dealing with a list of NautilusFile objects that each have a ref.
* These are just convenient names for functions that work on lists of GtkObject *.
*/
-GList * nautilus_file_list_ref (GList *file_list);
-void nautilus_file_list_unref (GList *file_list);
-void nautilus_file_list_free (GList *file_list);
-GList * nautilus_file_list_copy (GList *file_list);
+GList * nautilus_file_list_ref (GList *file_list);
+void nautilus_file_list_unref (GList *file_list);
+void nautilus_file_list_free (GList *file_list);
+GList * nautilus_file_list_copy (GList *file_list);
/* Debugging */
-void nautilus_file_dump (NautilusFile *file);
+void nautilus_file_dump (NautilusFile *file);
typedef struct NautilusFileDetails NautilusFileDetails;
diff --git a/libnautilus-private/nautilus-directory.c b/libnautilus-private/nautilus-directory.c
index 816cb5c84..aeddeb230 100644
--- a/libnautilus-private/nautilus-directory.c
+++ b/libnautilus-private/nautilus-directory.c
@@ -580,7 +580,7 @@ nautilus_directory_remove_file (NautilusDirectory *directory, NautilusFile *file
(directory->details->file_list, node);
g_list_free_1 (node);
- if (file->details->unconfirmed == FALSE) {
+ if (!file->details->unconfirmed) {
directory->details->confirmed_file_count--;
}
@@ -1168,52 +1168,29 @@ nautilus_directory_notify_files_moved (GList *uri_pairs)
} else {
/* Handle notification in the old directory. */
old_directory = file->details->directory;
- hash_table_list_prepend (changed_lists,
- old_directory,
- file);
-
collect_parent_directories (parent_directories, old_directory);
/* Locate the new directory. */
new_directory = get_parent_directory (pair->to_uri);
- g_assert (new_directory != NULL);
-
collect_parent_directories (parent_directories, new_directory);
- /* If the file is moving between directories,
- * there is more to do.
- */
- if (new_directory != old_directory) {
- /* Update the name. */
- name = nautilus_uri_get_basename (pair->to_uri);
- nautilus_file_update_name (file, name);
- g_free (name);
-
- /* Remove from old directory. */
- nautilus_directory_remove_file (old_directory, file);
-
- /* Point the file at the new
- * directory. We already have a ref to
- * it from the get_parent_directory
- * function so we don't have to ref.
- */
- /* FIXME bugzilla.eazel.com 5067: This
- * needs to update the link hash
- * table.
- */
- file->details->directory = new_directory;
-
- /* Add to new directory. */
- nautilus_directory_add_file (new_directory, file);
-
- /* Handle notification in the new directory. */
- hash_table_list_prepend (added_lists,
- new_directory,
- file);
+ /* Update the file's name. */
+ name = nautilus_uri_get_basename (pair->to_uri);
+ nautilus_file_update_name (file, name);
+ g_free (name);
+
+ /* Update the file's directory. */
+ nautilus_file_set_directory (file, new_directory);
+
+ hash_table_list_prepend
+ (changed_lists, old_directory, file);
+ if (old_directory != new_directory) {
+ hash_table_list_prepend
+ (added_lists, new_directory, file);
}
- /* Done with the old directory. */
nautilus_directory_unref (old_directory);
+ nautilus_directory_unref (new_directory);
/* Unref each file once to balance out nautilus_file_get. */
unref_list = g_list_prepend (unref_list, file);
diff --git a/libnautilus-private/nautilus-file-private.h b/libnautilus-private/nautilus-file-private.h
index feeae674a..cf43c78d2 100644
--- a/libnautilus-private/nautilus-file-private.h
+++ b/libnautilus-private/nautilus-file-private.h
@@ -26,6 +26,19 @@
#include "nautilus-directory.h"
#include "nautilus-glib-extensions.h"
+#define NAUTILUS_FILE_TOP_LEFT_TEXT_MAXIMUM_CHARACTERS_PER_LINE 80
+#define NAUTILUS_FILE_TOP_LEFT_TEXT_MAXIMUM_LINES 24
+#define NAUTILUS_FILE_TOP_LEFT_TEXT_MAXIMUM_BYTES 10000
+
+/* These are in the typical sort order. Known things come first, then
+ * things where we can't know, finally things where we don't yet know.
+ */
+typedef enum {
+ KNOWN,
+ UNKNOWABLE,
+ UNKNOWN
+} Knowledge;
+
struct NautilusFileDetails
{
NautilusDirectory *directory;
@@ -45,7 +58,7 @@ struct NautilusFileDetails
guint deep_unreadable_count;
GnomeVFSFileSize deep_size;
- GList *mime_list; /* If this is a directory, the list of MIME types in it. */
+ GList *mime_list; /* If this is a directory, the list of MIME types in it. */
char *top_left_text;
char *activation_uri;
@@ -86,35 +99,32 @@ struct NautilusFileDetails
nautilus_boolean_bit activation_uri_is_up_to_date : 1;
};
-#define NAUTILUS_FILE_TOP_LEFT_TEXT_MAXIMUM_CHARACTERS_PER_LINE 80
-#define NAUTILUS_FILE_TOP_LEFT_TEXT_MAXIMUM_LINES 24
-#define NAUTILUS_FILE_TOP_LEFT_TEXT_MAXIMUM_BYTES 10000
-
-NautilusFile *nautilus_file_new_from_info (NautilusDirectory *directory,
- GnomeVFSFileInfo *info);
-NautilusFile *nautilus_file_get_existing (const char *uri);
-void nautilus_file_emit_changed (NautilusFile *file);
-void nautilus_file_mark_gone (NautilusFile *file);
-char * nautilus_extract_top_left_text (const char *text,
- int length);
-gboolean nautilus_file_contains_text (NautilusFile *file);
+NautilusFile *nautilus_file_new_from_info (NautilusDirectory *directory,
+ GnomeVFSFileInfo *info);
+NautilusFile *nautilus_file_get_existing (const char *uri);
+void nautilus_file_emit_changed (NautilusFile *file);
+void nautilus_file_mark_gone (NautilusFile *file);
+char * nautilus_extract_top_left_text (const char *text,
+ int length);
+gboolean nautilus_file_contains_text (NautilusFile *file);
+void nautilus_file_set_directory (NautilusFile *file,
+ NautilusDirectory *directory);
/* Compare file's state with a fresh file info struct, return FALSE if
* no change, update file and return TRUE if the file info contains
* new state. */
-gboolean nautilus_file_update_info (NautilusFile *file,
- GnomeVFSFileInfo *info);
-gboolean nautilus_file_update_name (NautilusFile *file,
- const char *name);
+gboolean nautilus_file_update_info (NautilusFile *file,
+ GnomeVFSFileInfo *info);
+gboolean nautilus_file_update_name (NautilusFile *file,
+ const char *name);
/* Return true if the top lefts of files in this directory should be
* fetched, according to the preference settings.
*/
-gboolean nautilus_file_should_get_top_left_text (NautilusFile *file);
+gboolean nautilus_file_should_get_top_left_text (NautilusFile *file);
/* Mark specified attributes for this file out of date without canceling current
* I/O or kicking off new I/O.
*/
-void nautilus_file_invalidate_attributes_internal (NautilusFile *file,
- GList *file_attributes);
-
+void nautilus_file_invalidate_attributes_internal (NautilusFile *file,
+ GList *file_attributes);
diff --git a/libnautilus-private/nautilus-file.c b/libnautilus-private/nautilus-file.c
index 232bb9aaa..48e446bf0 100644
--- a/libnautilus-private/nautilus-file.c
+++ b/libnautilus-private/nautilus-file.c
@@ -80,15 +80,6 @@ typedef struct {
gpointer callback_data;
} Operation;
-/* These are in sort order. Known things come first, then things
- * where we can't know, finally things where we don't yet know.
- */
-typedef enum {
- KNOWN,
- UNKNOWABLE,
- UNKNOWN
-} Knowledge;
-
typedef GList * (* ModifyListFunction) (GList *list, NautilusFile *file);
enum {
@@ -157,8 +148,8 @@ nautilus_file_new_from_relative_uri (NautilusDirectory *directory,
#endif
nautilus_directory_ref (directory);
-
file->details->directory = directory;
+
file->details->relative_uri = g_strdup (relative_uri);
return file;
@@ -390,6 +381,12 @@ nautilus_file_get (const char *uri)
return nautilus_file_get_internal (uri, TRUE);
}
+static gboolean
+is_self_owned (NautilusFile *file)
+{
+ return file->details->directory->details->as_file == file;
+}
+
static void
destroy (GtkObject *object)
{
@@ -406,7 +403,7 @@ destroy (GtkObject *object)
directory = file->details->directory;
- if (directory->details->as_file == file) {
+ if (is_self_owned (file)) {
directory->details->as_file = NULL;
} else {
if (!file->details->is_gone) {
@@ -464,12 +461,6 @@ nautilus_file_unref (NautilusFile *file)
gtk_object_unref (GTK_OBJECT (file));
}
-static gboolean
-is_self_owned (NautilusFile *file)
-{
- return file->details->directory->details->as_file == file;
-}
-
/**
* nautilus_file_get_parent_uri_for_display:
*
@@ -1112,7 +1103,7 @@ static void
update_links_if_target (NautilusFile *target_file)
{
GList *link_files, *p;
-
+
link_files = get_link_files (target_file);
for (p = link_files; p != NULL; p = p->next) {
update_link (NAUTILUS_FILE (p->data), target_file);
@@ -1229,6 +1220,46 @@ nautilus_file_update_name (NautilusFile *file, const char *name)
return TRUE;
}
+void
+nautilus_file_set_directory (NautilusFile *file,
+ NautilusDirectory *new_directory)
+{
+ NautilusDirectory *old_directory;
+
+ g_return_if_fail (NAUTILUS_IS_FILE (file));
+ g_return_if_fail (NAUTILUS_IS_DIRECTORY (file->details->directory));
+ g_return_if_fail (!file->details->is_gone);
+ g_return_if_fail (!is_self_owned (file));
+ g_return_if_fail (NAUTILUS_IS_DIRECTORY (new_directory));
+
+ old_directory = file->details->directory;
+ if (old_directory == new_directory) {
+ return;
+ }
+
+ nautilus_file_ref (file);
+
+ /* FIXME bugzilla.eazel.com 2044: Need to let links that
+ * point to the old name know that the file has been moved.
+ */
+
+ remove_from_link_hash_table (file);
+
+ nautilus_directory_remove_file (old_directory, file);
+
+ nautilus_directory_ref (new_directory);
+ file->details->directory = new_directory;
+ nautilus_directory_unref (old_directory);
+
+ nautilus_directory_add_file (new_directory, file);
+
+ add_to_link_hash_table (file);
+
+ update_links_if_target (file);
+
+ nautilus_file_unref (file);
+}
+
static Knowledge
get_item_count (NautilusFile *file,
guint *count)
@@ -4131,6 +4162,8 @@ nautilus_file_mark_gone (NautilusFile *file)
{
NautilusDirectory *directory;
+ g_return_if_fail (!file->details->is_gone);
+
file->details->is_gone = TRUE;
update_links_if_target (file);
@@ -4381,13 +4414,13 @@ nautilus_file_invalidate_attributes_internal (NautilusFile *file,
void
nautilus_file_invalidate_attributes (NautilusFile *file,
- GList *file_attributes)
+ GList *file_attributes)
{
/* Cancel possible in-progress loads of any of these attributes */
nautilus_directory_cancel_loading_file_attributes (file->details->directory,
file,
file_attributes);
-
+
/* Actually invalidate the values */
nautilus_file_invalidate_attributes_internal (file, file_attributes);
diff --git a/libnautilus-private/nautilus-file.h b/libnautilus-private/nautilus-file.h
index aa76ffc29..b7e9f9e0d 100644
--- a/libnautilus-private/nautilus-file.h
+++ b/libnautilus-private/nautilus-file.h
@@ -79,216 +79,213 @@ typedef void (*NautilusFileOperationCallback) (NautilusFile *file,
gpointer callback_data);
/* GtkObject requirements. */
-GtkType nautilus_file_get_type (void);
+GtkType nautilus_file_get_type (void);
/* Getting at a single file. */
-NautilusFile * nautilus_file_get (const char *uri);
+NautilusFile * nautilus_file_get (const char *uri);
/* Covers for gtk_object_ref and gtk_object_unref that provide two conveniences:
* 1) You don't have to cast to GtkObject *, so using these is type safe.
* 2) You are allowed to call these with NULL,
*/
-NautilusFile * nautilus_file_ref (NautilusFile *file);
-void nautilus_file_unref (NautilusFile *file);
+NautilusFile * nautilus_file_ref (NautilusFile *file);
+void nautilus_file_unref (NautilusFile *file);
/* Monitor the file. */
-void nautilus_file_monitor_add (NautilusFile *file,
- gconstpointer client,
- GList *attributes);
-void nautilus_file_monitor_remove (NautilusFile *file,
- gconstpointer client);
+void nautilus_file_monitor_add (NautilusFile *file,
+ gconstpointer client,
+ GList *attributes);
+void nautilus_file_monitor_remove (NautilusFile *file,
+ gconstpointer client);
/* Waiting for data that's read asynchronously.
* This interface currently works only for metadata, but could be expanded
* to other attributes as well.
*/
-void nautilus_file_call_when_ready (NautilusFile *file,
- GList *attributes,
- NautilusFileCallback callback,
- gpointer callback_data);
-void nautilus_file_cancel_call_when_ready (NautilusFile *file,
- NautilusFileCallback callback,
- gpointer callback_data);
-gboolean nautilus_file_check_if_ready (NautilusFile *file,
- GList *attributes);
-void nautilus_file_invalidate_attributes (NautilusFile *file,
- GList *file_attributes);
-void nautilus_file_invalidate_all_attributes (NautilusFile *file);
+void nautilus_file_call_when_ready (NautilusFile *file,
+ GList *attributes,
+ NautilusFileCallback callback,
+ gpointer callback_data);
+void nautilus_file_cancel_call_when_ready (NautilusFile *file,
+ NautilusFileCallback callback,
+ gpointer callback_data);
+gboolean nautilus_file_check_if_ready (NautilusFile *file,
+ GList *attributes);
+void nautilus_file_invalidate_attributes (NautilusFile *file,
+ GList *file_attributes);
+void nautilus_file_invalidate_all_attributes (NautilusFile *file);
/* Basic attributes for file objects. */
-char * nautilus_file_get_name (NautilusFile *file);
-char * nautilus_file_get_uri (NautilusFile *file);
-char * nautilus_file_get_uri_scheme (NautilusFile *file);
-char * nautilus_file_get_parent_uri (NautilusFile *file);
-char * nautilus_file_get_parent_uri_for_display (NautilusFile *file);
-GnomeVFSFileSize nautilus_file_get_size (NautilusFile *file);
-GnomeVFSFileType nautilus_file_get_file_type (NautilusFile *file);
-char * nautilus_file_get_mime_type (NautilusFile *file);
-gboolean nautilus_file_is_mime_type (NautilusFile *file,
- const char *mime_type);
-gboolean nautilus_file_is_symbolic_link (NautilusFile *file);
+char * nautilus_file_get_name (NautilusFile *file);
+char * nautilus_file_get_uri (NautilusFile *file);
+char * nautilus_file_get_uri_scheme (NautilusFile *file);
+char * nautilus_file_get_parent_uri (NautilusFile *file);
+char * nautilus_file_get_parent_uri_for_display (NautilusFile *file);
+GnomeVFSFileSize nautilus_file_get_size (NautilusFile *file);
+GnomeVFSFileType nautilus_file_get_file_type (NautilusFile *file);
+char * nautilus_file_get_mime_type (NautilusFile *file);
+gboolean nautilus_file_is_mime_type (NautilusFile *file,
+ const char *mime_type);
+gboolean nautilus_file_is_symbolic_link (NautilusFile *file);
char * nautilus_file_get_symbolic_link_target_path
- (NautilusFile *file);
-gboolean nautilus_file_is_broken_symbolic_link (NautilusFile *file);
-gboolean nautilus_file_is_nautilus_link (NautilusFile *file);
-gboolean nautilus_file_is_executable (NautilusFile *file);
-gboolean nautilus_file_is_directory (NautilusFile *file);
-gboolean nautilus_file_is_in_trash (NautilusFile *file);
-GnomeVFSResult nautilus_file_get_file_info_result (NautilusFile *file);
-gboolean nautilus_file_get_directory_item_count (NautilusFile *file,
- guint *count,
- gboolean *count_unreadable);
-void nautilus_file_recompute_deep_counts (NautilusFile *file);
-NautilusRequestStatus nautilus_file_get_deep_counts (NautilusFile *file,
- guint *directory_count,
- guint *file_count,
- guint *unreadable_directory_count,
- GnomeVFSFileSize *total_size);
-GList * nautilus_file_get_keywords (NautilusFile *file);
-void nautilus_file_set_keywords (NautilusFile *file,
- GList *keywords);
-GList * nautilus_file_get_emblem_names (NautilusFile *file);
-char * nautilus_file_get_top_left_text (NautilusFile *file);
-gboolean nautilus_file_get_directory_item_mime_types (NautilusFile *file,
+(NautilusFile *file);
+gboolean nautilus_file_is_broken_symbolic_link (NautilusFile *file);
+gboolean nautilus_file_is_nautilus_link (NautilusFile *file);
+gboolean nautilus_file_is_executable (NautilusFile *file);
+gboolean nautilus_file_is_directory (NautilusFile *file);
+gboolean nautilus_file_is_in_trash (NautilusFile *file);
+GnomeVFSResult nautilus_file_get_file_info_result (NautilusFile *file);
+gboolean nautilus_file_get_directory_item_count (NautilusFile *file,
+ guint *count,
+ gboolean *count_unreadable);
+void nautilus_file_recompute_deep_counts (NautilusFile *file);
+NautilusRequestStatus nautilus_file_get_deep_counts (NautilusFile *file,
+ guint *directory_count,
+ guint *file_count,
+ guint *unreadable_directory_count,
+ GnomeVFSFileSize *total_size);
+GList * nautilus_file_get_keywords (NautilusFile *file);
+void nautilus_file_set_keywords (NautilusFile *file,
+ GList *keywords);
+GList * nautilus_file_get_emblem_names (NautilusFile *file);
+char * nautilus_file_get_top_left_text (NautilusFile *file);
+gboolean nautilus_file_get_directory_item_mime_types (NautilusFile *file,
GList **mime_list);
/* Permissions. */
-gboolean nautilus_file_can_get_permissions (NautilusFile *file);
-gboolean nautilus_file_can_set_permissions (NautilusFile *file);
-GnomeVFSFilePermissions nautilus_file_get_permissions (NautilusFile *file);
-
-gboolean nautilus_file_can_get_owner (NautilusFile *file);
-gboolean nautilus_file_can_set_owner (NautilusFile *file);
-gboolean nautilus_file_can_get_group (NautilusFile *file);
-gboolean nautilus_file_can_set_group (NautilusFile *file);
-char * nautilus_file_get_owner_name (NautilusFile *file);
-char * nautilus_file_get_group_name (NautilusFile *file);
-GList * nautilus_get_user_names (void);
-GList * nautilus_get_group_names (void);
-GList * nautilus_file_get_settable_group_names (NautilusFile *file);
+gboolean nautilus_file_can_get_permissions (NautilusFile *file);
+gboolean nautilus_file_can_set_permissions (NautilusFile *file);
+GnomeVFSFilePermissions nautilus_file_get_permissions (NautilusFile *file);
+gboolean nautilus_file_can_get_owner (NautilusFile *file);
+gboolean nautilus_file_can_set_owner (NautilusFile *file);
+gboolean nautilus_file_can_get_group (NautilusFile *file);
+gboolean nautilus_file_can_set_group (NautilusFile *file);
+char * nautilus_file_get_owner_name (NautilusFile *file);
+char * nautilus_file_get_group_name (NautilusFile *file);
+GList * nautilus_get_user_names (void);
+GList * nautilus_get_group_names (void);
+GList * nautilus_file_get_settable_group_names (NautilusFile *file);
/* "Capabilities". */
-gboolean nautilus_file_can_read (NautilusFile *file);
-gboolean nautilus_file_can_write (NautilusFile *file);
-gboolean nautilus_file_can_execute (NautilusFile *file);
-gboolean nautilus_file_can_rename (NautilusFile *file);
+gboolean nautilus_file_can_read (NautilusFile *file);
+gboolean nautilus_file_can_write (NautilusFile *file);
+gboolean nautilus_file_can_execute (NautilusFile *file);
+gboolean nautilus_file_can_rename (NautilusFile *file);
/* Basic operations for file objects. */
-void nautilus_file_set_owner (NautilusFile *file,
- const char *user_name_or_id,
- NautilusFileOperationCallback callback,
- gpointer callback_data);
-void nautilus_file_set_group (NautilusFile *file,
- const char *group_name_or_id,
- NautilusFileOperationCallback callback,
- gpointer callback_data);
-void nautilus_file_set_permissions (NautilusFile *file,
- GnomeVFSFilePermissions permissions,
- NautilusFileOperationCallback callback,
- gpointer callback_data);
-void nautilus_file_rename (NautilusFile *file,
- const char *new_name,
- NautilusFileOperationCallback callback,
- gpointer callback_data);
-void nautilus_file_cancel (NautilusFile *file,
- NautilusFileOperationCallback callback,
- gpointer callback_data);
+void nautilus_file_set_owner (NautilusFile *file,
+ const char *user_name_or_id,
+ NautilusFileOperationCallback callback,
+ gpointer callback_data);
+void nautilus_file_set_group (NautilusFile *file,
+ const char *group_name_or_id,
+ NautilusFileOperationCallback callback,
+ gpointer callback_data);
+void nautilus_file_set_permissions (NautilusFile *file,
+ GnomeVFSFilePermissions permissions,
+ NautilusFileOperationCallback callback,
+ gpointer callback_data);
+void nautilus_file_rename (NautilusFile *file,
+ const char *new_name,
+ NautilusFileOperationCallback callback,
+ gpointer callback_data);
+void nautilus_file_cancel (NautilusFile *file,
+ NautilusFileOperationCallback callback,
+ gpointer callback_data);
/* Return true if this file has already been deleted.
* This object will be unref'd after sending the files_removed signal,
* but it could hang around longer if someone ref'd it.
*/
-gboolean nautilus_file_is_gone (NautilusFile *file);
+gboolean nautilus_file_is_gone (NautilusFile *file);
/* Simple getting and setting top-level metadata. */
-char * nautilus_file_get_metadata (NautilusFile *file,
- const char *key,
- const char *default_metadata);
-GList * nautilus_file_get_metadata_list (NautilusFile *file,
- const char *list_key,
- const char *list_subkey);
-void nautilus_file_set_metadata (NautilusFile *file,
- const char *key,
- const char *default_metadata,
- const char *metadata);
-void nautilus_file_set_metadata_list (NautilusFile *file,
- const char *list_key,
- const char *list_subkey,
- GList *list);
+char * nautilus_file_get_metadata (NautilusFile *file,
+ const char *key,
+ const char *default_metadata);
+GList * nautilus_file_get_metadata_list (NautilusFile *file,
+ const char *list_key,
+ const char *list_subkey);
+void nautilus_file_set_metadata (NautilusFile *file,
+ const char *key,
+ const char *default_metadata,
+ const char *metadata);
+void nautilus_file_set_metadata_list (NautilusFile *file,
+ const char *list_key,
+ const char *list_subkey,
+ GList *list);
/* Covers for common data types. */
-gboolean nautilus_file_get_boolean_metadata (NautilusFile *file,
- const char *key,
- gboolean default_metadata);
-void nautilus_file_set_boolean_metadata (NautilusFile *file,
- const char *key,
- gboolean default_metadata,
- gboolean metadata);
-int nautilus_file_get_integer_metadata (NautilusFile *file,
- const char *key,
- int default_metadata);
-void nautilus_file_set_integer_metadata (NautilusFile *file,
- const char *key,
- int default_metadata,
- int metadata);
+gboolean nautilus_file_get_boolean_metadata (NautilusFile *file,
+ const char *key,
+ gboolean default_metadata);
+void nautilus_file_set_boolean_metadata (NautilusFile *file,
+ const char *key,
+ gboolean default_metadata,
+ gboolean metadata);
+int nautilus_file_get_integer_metadata (NautilusFile *file,
+ const char *key,
+ int default_metadata);
+void nautilus_file_set_integer_metadata (NautilusFile *file,
+ const char *key,
+ int default_metadata,
+ int metadata);
/* Attributes for file objects as user-displayable strings. */
-char * nautilus_file_get_string_attribute (NautilusFile *file,
- const char *attribute_name);
+char * nautilus_file_get_string_attribute (NautilusFile *file,
+ const char *attribute_name);
char * nautilus_file_get_string_attribute_with_default
- (NautilusFile *file,
- const char *attribute_name);
+(NautilusFile *file,
+ const char *attribute_name);
/* Matching with another URI. */
-gboolean nautilus_file_matches_uri (NautilusFile *file,
- const char *uri);
+gboolean nautilus_file_matches_uri (NautilusFile *file,
+ const char *uri);
/* Is the file local? */
-gboolean nautilus_file_is_local (NautilusFile *file);
+gboolean nautilus_file_is_local (NautilusFile *file);
/* Comparing two file objects for sorting */
-int nautilus_file_compare_for_sort (NautilusFile *file_1,
- NautilusFile *file_2,
- NautilusFileSortType sort_type);
-int nautilus_file_compare_for_sort_reversed (NautilusFile *file_1,
- NautilusFile *file_2,
- NautilusFileSortType sort_type);
-int nautilus_file_compare_name (NautilusFile *file_1,
- const char *pattern);
+int nautilus_file_compare_for_sort (NautilusFile *file_1,
+ NautilusFile *file_2,
+ NautilusFileSortType sort_type);
+int nautilus_file_compare_for_sort_reversed (NautilusFile *file_1,
+ NautilusFile *file_2,
+ NautilusFileSortType sort_type);
+int nautilus_file_compare_name (NautilusFile *file_1,
+ const char *pattern);
/* 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_should_show (NautilusFile *file,
- gboolean show_hidden,
- gboolean show_backup);
-
-GList *nautilus_file_list_filter_hidden_and_backup (GList *files,
- gboolean show_hidden,
- gboolean show_backup);
+gboolean nautilus_file_is_hidden_file (NautilusFile *file);
+gboolean nautilus_file_is_backup_file (NautilusFile *file);
+gboolean nautilus_file_should_show (NautilusFile *file,
+ gboolean show_hidden,
+ gboolean show_backup);
+GList *nautilus_file_list_filter_hidden_and_backup (GList *files,
+ gboolean show_hidden,
+ gboolean show_backup);
/* Get the URI that's used when activating the file.
* Getting this can require reading the contents of the file.
*/
-char * nautilus_file_get_activation_uri (NautilusFile *file);
+char * nautilus_file_get_activation_uri (NautilusFile *file);
/* Convenience functions for dealing with a list of NautilusFile objects that each have a ref.
* These are just convenient names for functions that work on lists of GtkObject *.
*/
-GList * nautilus_file_list_ref (GList *file_list);
-void nautilus_file_list_unref (GList *file_list);
-void nautilus_file_list_free (GList *file_list);
-GList * nautilus_file_list_copy (GList *file_list);
+GList * nautilus_file_list_ref (GList *file_list);
+void nautilus_file_list_unref (GList *file_list);
+void nautilus_file_list_free (GList *file_list);
+GList * nautilus_file_list_copy (GList *file_list);
/* Debugging */
-void nautilus_file_dump (NautilusFile *file);
+void nautilus_file_dump (NautilusFile *file);
typedef struct NautilusFileDetails NautilusFileDetails;
diff --git a/src/nautilus-main.c b/src/nautilus-main.c
index ac7de316f..1c753844f 100644
--- a/src/nautilus-main.c
+++ b/src/nautilus-main.c
@@ -138,12 +138,12 @@ main (int argc, char *argv[])
struct poptOption options[] = {
#ifndef NAUTILUS_OMIT_SELF_CHECK
- { "check", '\0', POPT_ARG_NONE, &perform_self_check, 0, N_("Perform high-speed self-check tests."), NULL },
+ { "check", 'c', POPT_ARG_NONE, &perform_self_check, 0, N_("Perform a quick set of self-check tests."), NULL },
#endif
- { "quit", '\0', POPT_ARG_NONE, &kill_shell, 0, N_("Quit Nautilus."), NULL },
- { "restart", '\0', POPT_ARG_NONE, &restart_shell, 0, N_("Restart Nautilus."), NULL },
- { "no-default-window", '\0', POPT_ARG_NONE, &no_default_window, 0, N_("Only create Nautilus windows for explicity specified URIs."), NULL },
- { "geometry", '\0', POPT_ARG_STRING, &geometry, 0, N_("Create the initial window with the given geometry."), N_("GEOMETRY") },
+ { "geometry", 'g', POPT_ARG_STRING, &geometry, 0, N_("Create the initial window with the given geometry."), N_("GEOMETRY") },
+ { "no-default-window", 'n', POPT_ARG_NONE, &no_default_window, 0, N_("Only create Nautilus windows for explicitly specified URIs."), NULL },
+ { "quit", 'q', POPT_ARG_NONE, &kill_shell, 0, N_("Quit Nautilus."), NULL },
+ { "restart", '\0', POPT_ARG_NONE | POPT_ARGFLAG_DOC_HIDDEN, &restart_shell, 0, N_("Restart Nautilus."), NULL },
{ NULL, '\0', POPT_ARG_INCLUDE_TABLE, &oaf_popt_options, 0, NULL, NULL },
POPT_AUTOHELP
{ NULL, '\0', 0, NULL, 0, NULL, NULL }
@@ -182,11 +182,11 @@ main (int argc, char *argv[])
nautilus_setenv ("GNOME_DISABLE_CRASH_DIALOG", "1", TRUE);
/* Get parameters. */
+ geometry = NULL;
kill_shell = FALSE;
- restart_shell = FALSE;
- start_desktop = FALSE;
no_default_window = FALSE;
perform_self_check = FALSE;
+ restart_shell = FALSE;
gnome_init_with_popt_table ("nautilus", VERSION,
argc, argv, options, 0,
&popt_context);
@@ -197,7 +197,7 @@ main (int argc, char *argv[])
fprintf (stderr, _("nautilus: --check cannot be used with URIs.\n"));
return EXIT_FAILURE;
}
- if (perform_self_check && (kill_shell || restart_shell || start_desktop || no_default_window)) {
+ if (perform_self_check && (kill_shell || restart_shell)) {
fprintf (stderr, _("nautilus: --check cannot be used with other options.\n"));
return EXIT_FAILURE;
}