summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarin Adler <darin@src.gnome.org>2000-10-24 20:24:35 +0000
committerDarin Adler <darin@src.gnome.org>2000-10-24 20:24:35 +0000
commit83cb6f4c4bd388dc4087acfe4ac757dd5a408fe6 (patch)
tree17426e93c486cd4839fe8a5ebd7ab8b0d0b1b8a1
parenta86b53488ef8a199047e93f2661587f7a045b558 (diff)
downloadnautilus-83cb6f4c4bd388dc4087acfe4ac757dd5a408fe6.tar.gz
Some work towards reducing load_directory calls.
Also fixed bug 3978 (Many Bonobo warnings/errors on quit). * libnautilus-extensions/nautilus-directory-async.c: (set_up_request_by_file_attributes), (update_file_info_in_list_if_needed), (dequeue_pending_idle_callback), (request_is_satisfied), (get_info_callback), (file_info_start): * libnautilus-extensions/nautilus-directory-private.h: * libnautilus-extensions/nautilus-file-attributes.h: * libnautilus-extensions/nautilus-file-private.h: * libnautilus-extensions/nautilus-file.c: (nautilus_file_new_from_info), (destroy), (nautilus_file_update_info), (nautilus_file_update_name), (nautilus_file_compare_by_type), (nautilus_file_get_string_attribute), (get_description), (update_description_for_link), (nautilus_file_get_type_as_string), (nautilus_file_get_mime_type), (nautilus_file_is_mime_type), (nautilus_file_check_if_ready): * libnautilus-extensions/nautilus-file.h: * libnautilus-extensions/nautilus-mime-actions.c: (nautilus_mime_actions_get_required_file_attributes), (nautilus_mime_get_default_action_type_for_file), (nautilus_mime_get_default_application_for_file_internal), (nautilus_mime_get_default_component_for_file_internal), (nautilus_mime_get_short_list_applications_for_file), (nautilus_mime_get_short_list_components_for_file), (nautilus_mime_get_short_list_methods_for_file), (nautilus_mime_get_all_applications_for_file), (nautilus_mime_get_all_components_for_file), (nautilus_mime_set_short_list_applications_for_file), (nautilus_mime_set_short_list_components_for_file): Get rid of the distinction between slow and default MIME type once again. We (Pavel, Maciej, John, and I) decided it's better not to have multiple opinions on the MIME type, despite our original idea that we needed the slow MIME type for some things, even on remote file systems. * libnautilus-extensions/nautilus-glib-extensions.h: Fixed the formatting in this file. * src/file-manager/fm-directory-view.c: (load_location_callback): Only force a reload if we are reloading the same directory. This is needed to take advantage of the loading already done for us by the framework. (load_directory): Take a NautilusDirectory instead of a URI string. Also take a boolean parameter to control if we force a reload. (finish_loading_uri): Respect the boolean parameter that tells us whether to force a reload. (filtering_changed_callback): Use the new load_directory. * src/nautilus-applicable-views.c: (nautilus_navigation_info_new), (nautilus_navigation_info_cancel), (nautilus_navigation_info_free): Monitor the directory while we are loading the component. We already need to load the directory to get the MIME types, so this does no additional harm, and it prepares us to consolidate the loading done for different reasons. * src/nautilus-main.c: (main): Use nautilus_setenv instead of putenv, since it's more portable. * src/nautilus-window-manage-views.c: Quick simplification pass on state machine. Got rid of the use of varargs and renamed a bunch of things. * src/nautilus-window-manage-views.h: * src/nautilus-window-private.h: Moved external functions from nautilus-window-manage-views.c to all be in nautilus-window-manager-views.h. This is one step in reducing the number of clients that need access to private stuff in NautilusWindow. * src/nautilus-window-service-ui.c: (detach_service_ui), (nautilus_window_install_service_ui): Detach the service UI on "destroy" rather that using set_data_full, because finalize time is too late. * src/nautilus-view-frame.c: (nautilus_view_frame_destroy): Got rid of extra unref that was messing things up here.
-rw-r--r--ChangeLog83
-rw-r--r--libnautilus-extensions/nautilus-directory-async.c59
-rw-r--r--libnautilus-extensions/nautilus-directory-private.h1
-rw-r--r--libnautilus-extensions/nautilus-file-attributes.h7
-rw-r--r--libnautilus-extensions/nautilus-file-private.h10
-rw-r--r--libnautilus-extensions/nautilus-file.c188
-rw-r--r--libnautilus-extensions/nautilus-file.h1
-rw-r--r--libnautilus-extensions/nautilus-glib-extensions.h124
-rw-r--r--libnautilus-extensions/nautilus-mime-actions.c22
-rw-r--r--libnautilus-private/nautilus-directory-async.c59
-rw-r--r--libnautilus-private/nautilus-directory-private.h1
-rw-r--r--libnautilus-private/nautilus-file-attributes.h7
-rw-r--r--libnautilus-private/nautilus-file-private.h10
-rw-r--r--libnautilus-private/nautilus-file.c188
-rw-r--r--libnautilus-private/nautilus-file.h1
-rw-r--r--libnautilus-private/nautilus-glib-extensions.h124
-rw-r--r--libnautilus-private/nautilus-mime-actions.c22
-rw-r--r--src/file-manager/fm-directory-view.c337
-rw-r--r--src/nautilus-applicable-views.c29
-rw-r--r--src/nautilus-main.c4
-rw-r--r--src/nautilus-view-frame.c3
-rw-r--r--src/nautilus-window-manage-views.c276
-rw-r--r--src/nautilus-window-manage-views.h26
-rw-r--r--src/nautilus-window-private.h20
-rw-r--r--src/nautilus-window-service-ui.c16
25 files changed, 717 insertions, 901 deletions
diff --git a/ChangeLog b/ChangeLog
index bead32783..4e0293ed8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,86 @@
+2000-10-24 Darin Adler <darin@eazel.com>
+
+ Some work towards reducing load_directory calls.
+
+ Also fixed bug 3978 (Many Bonobo warnings/errors on quit).
+
+ * libnautilus-extensions/nautilus-directory-async.c:
+ (set_up_request_by_file_attributes),
+ (update_file_info_in_list_if_needed),
+ (dequeue_pending_idle_callback), (request_is_satisfied),
+ (get_info_callback), (file_info_start):
+ * libnautilus-extensions/nautilus-directory-private.h:
+ * libnautilus-extensions/nautilus-file-attributes.h:
+ * libnautilus-extensions/nautilus-file-private.h:
+ * libnautilus-extensions/nautilus-file.c:
+ (nautilus_file_new_from_info), (destroy),
+ (nautilus_file_update_info), (nautilus_file_update_name),
+ (nautilus_file_compare_by_type),
+ (nautilus_file_get_string_attribute), (get_description),
+ (update_description_for_link), (nautilus_file_get_type_as_string),
+ (nautilus_file_get_mime_type), (nautilus_file_is_mime_type),
+ (nautilus_file_check_if_ready):
+ * libnautilus-extensions/nautilus-file.h:
+ * libnautilus-extensions/nautilus-mime-actions.c:
+ (nautilus_mime_actions_get_required_file_attributes),
+ (nautilus_mime_get_default_action_type_for_file),
+ (nautilus_mime_get_default_application_for_file_internal),
+ (nautilus_mime_get_default_component_for_file_internal),
+ (nautilus_mime_get_short_list_applications_for_file),
+ (nautilus_mime_get_short_list_components_for_file),
+ (nautilus_mime_get_short_list_methods_for_file),
+ (nautilus_mime_get_all_applications_for_file),
+ (nautilus_mime_get_all_components_for_file),
+ (nautilus_mime_set_short_list_applications_for_file),
+ (nautilus_mime_set_short_list_components_for_file):
+ Get rid of the distinction between slow and default MIME type once
+ again. We (Pavel, Maciej, John, and I) decided it's better not to
+ have multiple opinions on the MIME type, despite our original idea
+ that we needed the slow MIME type for some things, even on remote
+ file systems.
+
+ * libnautilus-extensions/nautilus-glib-extensions.h:
+ Fixed the formatting in this file.
+
+ * src/file-manager/fm-directory-view.c: (load_location_callback):
+ Only force a reload if we are reloading the same directory. This
+ is needed to take advantage of the loading already done for us by
+ the framework.
+ (load_directory): Take a NautilusDirectory instead of a URI string.
+ Also take a boolean parameter to control if we force a reload.
+ (finish_loading_uri): Respect the boolean parameter that tells us
+ whether to force a reload.
+ (filtering_changed_callback): Use the new load_directory.
+
+ * src/nautilus-applicable-views.c: (nautilus_navigation_info_new),
+ (nautilus_navigation_info_cancel), (nautilus_navigation_info_free):
+ Monitor the directory while we are loading the component. We
+ already need to load the directory to get the MIME types, so this
+ does no additional harm, and it prepares us to consolidate the
+ loading done for different reasons.
+
+ * src/nautilus-main.c: (main): Use nautilus_setenv instead of
+ putenv, since it's more portable.
+
+ * src/nautilus-window-manage-views.c: Quick simplification pass on
+ state machine. Got rid of the use of varargs and renamed a bunch
+ of things.
+
+ * src/nautilus-window-manage-views.h:
+ * src/nautilus-window-private.h:
+ Moved external functions from nautilus-window-manage-views.c to
+ all be in nautilus-window-manager-views.h. This is one step in
+ reducing the number of clients that need access to private stuff
+ in NautilusWindow.
+
+ * src/nautilus-window-service-ui.c: (detach_service_ui),
+ (nautilus_window_install_service_ui): Detach the service UI on
+ "destroy" rather that using set_data_full, because finalize time
+ is too late.
+
+ * src/nautilus-view-frame.c: (nautilus_view_frame_destroy):
+ Got rid of extra unref that was messing things up here.
+
2000-10-24 Ramiro Estrugo <ramiro@eazel.com>
* components/mozilla/nautilus-mozilla-content-view.c:
diff --git a/libnautilus-extensions/nautilus-directory-async.c b/libnautilus-extensions/nautilus-directory-async.c
index c7bdf3a40..7238e7521 100644
--- a/libnautilus-extensions/nautilus-directory-async.c
+++ b/libnautilus-extensions/nautilus-directory-async.c
@@ -83,7 +83,6 @@ typedef struct {
gboolean metafile;
gboolean file_list; /* always FALSE if file != NULL */
gboolean file_info;
- gboolean get_slow_mime_type; /* only relevant if file_info is "true" */
gboolean directory_count;
gboolean deep_count;
gboolean mime_list;
@@ -955,18 +954,11 @@ set_up_request_by_file_attributes (Request *request,
NAUTILUS_FILE_ATTRIBUTE_FILE_TYPE,
nautilus_str_compare) != NULL;
if (g_list_find_custom (file_attributes,
- NAUTILUS_FILE_ATTRIBUTE_SLOW_MIME_TYPE,
- nautilus_str_compare) != NULL) {
- request->file_info |= TRUE;
- request->get_slow_mime_type = TRUE;
- }
- if (g_list_find_custom (file_attributes,
NAUTILUS_FILE_ATTRIBUTE_ACTIVATION_URI,
nautilus_str_compare) != NULL) {
request->file_info = TRUE;
request->activation_uri = TRUE;
}
-
if (!request->metafile) {
request->metafile = g_list_find_custom
@@ -1082,7 +1074,7 @@ update_file_info_in_list_if_needed (GList *list,
}
/* the file is in the list already update the file info if needed */
- nautilus_file_update_info (NAUTILUS_FILE (list_entry->data), file_info, FALSE);
+ nautilus_file_update_info (NAUTILUS_FILE (list_entry->data), file_info);
return TRUE;
}
@@ -1146,7 +1138,7 @@ dequeue_pending_idle_callback (gpointer callback_data)
if (file != NULL) {
/* file already exists, check if it changed */
set_file_unconfirmed (file, FALSE);
- if (nautilus_file_update_info (file, file_info, FALSE)) {
+ if (nautilus_file_update_info (file, file_info)) {
/* File changed, notify about the change. */
nautilus_file_ref (file);
changed_files = g_list_prepend (changed_files, file);
@@ -1706,28 +1698,12 @@ lacks_info (NautilusFile *file)
}
static gboolean
-lacks_slow_mime_type (NautilusFile *file)
-{
- /* Don't try and get the the slow mime type
- if we couldn't get the file info in the first place */
- return file->details->slow_mime_type == NULL
- && !file->details->is_gone
- && !file->details->get_info_failed;
-}
-
-static gboolean
wants_info (const Request *request)
{
return request->file_info;
}
static gboolean
-wants_slow_mime_type (const Request *request)
-{
- return request->get_slow_mime_type;
-}
-
-static gboolean
lacks_deep_count (NautilusFile *file)
{
return nautilus_file_is_directory (file)
@@ -1812,12 +1788,6 @@ request_is_satisfied (NautilusDirectory *directory,
}
}
- if (request->get_slow_mime_type) {
- if (has_problem (directory, file, lacks_slow_mime_type)) {
- return FALSE;
- }
- }
-
if (request->deep_count) {
if (has_problem (directory, file, lacks_deep_count)) {
return FALSE;
@@ -2680,10 +2650,8 @@ get_info_callback (GnomeVFSAsyncHandle *handle,
NautilusDirectory *directory;
NautilusFile *get_info_file;
GnomeVFSGetFileInfoResult *result;
- gboolean got_slow_mime_type;
directory = NAUTILUS_DIRECTORY (callback_data);
- got_slow_mime_type = directory->details->get_slow_mime_type_for_file;
g_assert (handle == NULL || handle == directory->details->get_info_in_progress);
g_assert (nautilus_g_list_exactly_one_item (results));
get_info_file = directory->details->get_info_file;
@@ -2697,8 +2665,7 @@ get_info_callback (GnomeVFSAsyncHandle *handle,
get_info_file->details->get_info_failed = TRUE;
get_info_file->details->get_info_error = result->result;
} else {
- nautilus_file_update_info (get_info_file, result->file_info,
- got_slow_mime_type);
+ nautilus_file_update_info (get_info_file, result->file_info);
}
nautilus_file_changed (get_info_file);
@@ -2713,7 +2680,6 @@ file_info_start (NautilusDirectory *directory)
char *uri;
GnomeVFSURI *vfs_uri;
GList fake_list;
- gboolean get_slow_mime_type;
/* If there's already a file info fetch in progress, check to
* be sure it's still wanted.
@@ -2734,15 +2700,7 @@ file_info_start (NautilusDirectory *directory)
/* Figure out which file to get file info for. */
do {
- file = select_needy_file (directory, lacks_slow_mime_type, wants_slow_mime_type);
- if (file == NULL) {
- file = select_needy_file (directory, lacks_info, wants_info);
-
- get_slow_mime_type = FALSE;
- }
- else {
- get_slow_mime_type = TRUE;
- }
+ file = select_needy_file (directory, lacks_info, wants_info);
if (file == NULL) {
return;
}
@@ -2763,19 +2721,14 @@ file_info_start (NautilusDirectory *directory)
return;
}
directory->details->get_info_file = file;
- directory->details->get_slow_mime_type_for_file = get_slow_mime_type;
fake_list.data = vfs_uri;
fake_list.prev = NULL;
fake_list.next = NULL;
gnome_vfs_async_get_file_info
(&directory->details->get_info_in_progress,
&fake_list,
- get_slow_mime_type
- ? (GNOME_VFS_FILE_INFO_GET_MIME_TYPE
- | GNOME_VFS_FILE_INFO_FORCE_SLOW_MIME_TYPE
- | GNOME_VFS_FILE_INFO_FOLLOW_LINKS)
- : (GNOME_VFS_FILE_INFO_GET_MIME_TYPE
- | GNOME_VFS_FILE_INFO_FOLLOW_LINKS),
+ GNOME_VFS_FILE_INFO_GET_MIME_TYPE
+ | GNOME_VFS_FILE_INFO_FOLLOW_LINKS,
get_info_callback,
directory);
gnome_vfs_uri_unref (vfs_uri);
diff --git a/libnautilus-extensions/nautilus-directory-private.h b/libnautilus-extensions/nautilus-directory-private.h
index e8d4230f1..c7b42cd1c 100644
--- a/libnautilus-extensions/nautilus-directory-private.h
+++ b/libnautilus-extensions/nautilus-directory-private.h
@@ -95,7 +95,6 @@ struct NautilusDirectoryDetails
GnomeVFSAsyncHandle *get_info_in_progress;
NautilusFile *get_info_file;
- gboolean get_slow_mime_type_for_file;
TopLeftTextReadState *top_left_read_state;
ActivationURIReadState *activation_uri_read_state;
diff --git a/libnautilus-extensions/nautilus-file-attributes.h b/libnautilus-extensions/nautilus-file-attributes.h
index a165e0884..b73b8f0d3 100644
--- a/libnautilus-extensions/nautilus-file-attributes.h
+++ b/libnautilus-extensions/nautilus-file-attributes.h
@@ -25,8 +25,8 @@
#ifndef NAUTILUS_FILE_ATTRIBUTES_H
#define NAUTILUS_FILE_ATTRIBUTES_H
-/* Names for NautilusFile attributes. These are used when registering interest
- * in changes to the attributes.
+/* Names for NautilusFile attributes. These are used when registering
+ * interest in changes to the attributes or when waiting for them.
*/
#define NAUTILUS_FILE_ATTRIBUTE_ACTIVATION_URI "activation URI"
@@ -34,7 +34,6 @@
#define NAUTILUS_FILE_ATTRIBUTE_DEEP_COUNTS "deep counts"
#define NAUTILUS_FILE_ATTRIBUTE_DIRECTORY_ITEM_COUNT "directory item count"
#define NAUTILUS_FILE_ATTRIBUTE_MIME_TYPE "MIME type"
-#define NAUTILUS_FILE_ATTRIBUTE_SLOW_MIME_TYPE "MIME type"
#define NAUTILUS_FILE_ATTRIBUTE_TOP_LEFT_TEXT "top left text"
#define NAUTILUS_FILE_ATTRIBUTE_IS_DIRECTORY "is directory"
#define NAUTILUS_FILE_ATTRIBUTE_FILE_TYPE "file type"
@@ -42,5 +41,3 @@
#define NAUTILUS_FILE_ATTRIBUTE_METADATA "metadata"
#endif /* NAUTILUS_FILE_ATTRIBUTES_H */
-
-
diff --git a/libnautilus-extensions/nautilus-file-private.h b/libnautilus-extensions/nautilus-file-private.h
index 5e47c7329..e4a083d6c 100644
--- a/libnautilus-extensions/nautilus-file-private.h
+++ b/libnautilus-extensions/nautilus-file-private.h
@@ -37,13 +37,6 @@ struct NautilusFileDetails
gboolean get_info_failed;
GnomeVFSResult get_info_error;
- /* Since the file info doesn't remember what kind of mime type
- * it got, we'll just keep them here, where it is clear what
- * kind of mime type they are.
- */
- char *default_mime_type;
- char *slow_mime_type;
-
gboolean got_directory_count;
gboolean directory_count_failed;
guint directory_count;
@@ -92,8 +85,7 @@ gboolean nautilus_file_contains_text (NautilusFile *file);
* new state.
*/
gboolean nautilus_file_update_info (NautilusFile *file,
- GnomeVFSFileInfo *info,
- gboolean got_slow_mime_type);
+ GnomeVFSFileInfo *info);
gboolean nautilus_file_update_name (NautilusFile *file,
const char *name);
diff --git a/libnautilus-extensions/nautilus-file.c b/libnautilus-extensions/nautilus-file.c
index aef7fe678..85661a64b 100644
--- a/libnautilus-extensions/nautilus-file.c
+++ b/libnautilus-extensions/nautilus-file.c
@@ -247,10 +247,7 @@ nautilus_file_new_from_info (NautilusDirectory *directory,
nautilus_directory_ref (directory);
file->details->directory = directory;
- /* We don't know how the mime type in the file info has
- been gotten, so it's safest to assume it was the default
- mime type */
- nautilus_file_update_info (file, info, FALSE);
+ nautilus_file_update_info (file, info);
return file;
}
@@ -396,8 +393,6 @@ destroy (GtkObject *object)
} else {
gnome_vfs_file_info_unref (file->details->info);
}
- g_free (file->details->default_mime_type);
- g_free (file->details->slow_mime_type);
g_free (file->details->top_left_text);
g_free (file->details->activation_uri);
@@ -1088,8 +1083,7 @@ update_links_if_target (NautilusFile *target_file)
}
gboolean
-nautilus_file_update_info (NautilusFile *file, GnomeVFSFileInfo *info,
- gboolean got_slow_mime_type)
+nautilus_file_update_info (NautilusFile *file, GnomeVFSFileInfo *info)
{
GList *node;
@@ -1103,8 +1097,7 @@ nautilus_file_update_info (NautilusFile *file, GnomeVFSFileInfo *info,
}
if (file->details->info != NULL
- && gnome_vfs_file_info_matches (file->details->info, info)
- && !got_slow_mime_type) {
+ && gnome_vfs_file_info_matches (file->details->info, info)) {
return FALSE;
}
@@ -1119,13 +1112,6 @@ nautilus_file_update_info (NautilusFile *file, GnomeVFSFileInfo *info,
gnome_vfs_file_info_unref (file->details->info);
}
file->details->info = info;
- if (got_slow_mime_type) {
- g_free (file->details->slow_mime_type);
- file->details->slow_mime_type = g_strdup (info->mime_type);
- } else {
- g_free (file->details->default_mime_type);
- file->details->default_mime_type = g_strdup (info->mime_type);
- }
file->details->name = info->name;
nautilus_directory_end_file_name_change (file->details->directory,
file, node);
@@ -1166,10 +1152,7 @@ nautilus_file_update_name (NautilusFile *file, const char *name)
gnome_vfs_file_info_copy (info, file->details->info);
g_free (info->name);
info->name = g_strdup (name);
- /* FIXME: Perhaps we want to keep track of how we got
- the mime type the last time and pass that in here
- instead of FALSE */
- nautilus_file_update_info (file, info, FALSE);
+ nautilus_file_update_info (file, info);
gnome_vfs_file_info_unref (info);
}
@@ -1368,18 +1351,6 @@ nautilus_file_compare_by_emblems (NautilusFile *file_1, NautilusFile *file_2)
return compare_result;
}
-static const char *
-get_either_mime_type (NautilusFile *file)
-{
- /* Always prefer the non-slow type since that's updated more
- * often. This doesn't sound quite right, but I guess it's OK.
- */
- if (file->details->default_mime_type != NULL) {
- return file->details->default_mime_type;
- }
- return file->details->slow_mime_type;
-}
-
static int
nautilus_file_compare_by_type (NautilusFile *file_1, NautilusFile *file_2)
{
@@ -1411,8 +1382,8 @@ nautilus_file_compare_by_type (NautilusFile *file_1, NautilusFile *file_2)
if (file_1->details->info != NULL
&& file_2->details->info != NULL
- && nautilus_strcmp (get_either_mime_type (file_1),
- get_either_mime_type (file_2)) == 0) {
+ && nautilus_strcmp (file_1->details->info->mime_type,
+ file_2->details->info->mime_type) == 0) {
return 0;
}
@@ -3207,9 +3178,6 @@ nautilus_file_get_string_attribute (NautilusFile *file, const char *attribute_na
if (strcmp (attribute_name, "mime_type") == 0) {
return nautilus_file_get_mime_type (file);
}
- if (strcmp (attribute_name, "slow_mime_type") == 0) {
- return nautilus_file_get_slow_mime_type (file);
- }
if (strcmp (attribute_name, "size") == 0) {
return nautilus_file_get_size_as_string (file);
}
@@ -3333,21 +3301,6 @@ nautilus_file_get_string_attribute_with_default (NautilusFile *file, const char
return result;
}
-static char *
-type_as_string_considering_link (NautilusFile *file, const char *string)
-{
- if (nautilus_file_is_symbolic_link (file)) {
- g_assert (!nautilus_file_is_broken_symbolic_link (file));
- /* Note to localizers: convert file type string for file
- * (e.g. "folder", "plain text") to file type for symbolic link
- * to that kind of file (e.g. "link to folder").
- */
- return g_strdup_printf (_("link to %s"), string);
- }
-
- return g_strdup (string);
-}
-
/**
* nautilus_file_get_type_as_string:
*
@@ -3358,38 +3311,47 @@ type_as_string_considering_link (NautilusFile *file, const char *string)
* Returns: Newly allocated string ready to display to the user.
*
**/
-static char *
-nautilus_file_get_type_as_string (NautilusFile *file)
+
+static const char *
+get_description (NautilusFile *file)
{
- const char *mime_type;
- const char *description;
+ const char *mime_type, *description;
- if (file == NULL) {
- return NULL;
- }
+ g_assert (NAUTILUS_IS_FILE (file));
- if (nautilus_file_is_broken_symbolic_link (file)) {
- return g_strdup (_("link (broken)"));
+ if (file->details->info == NULL) {
+ mime_type = NULL;
+ } else {
+ mime_type = file->details->info->mime_type;
}
- mime_type = get_either_mime_type (file);
-
+ /* FIXME: When this code was originally written, unknown types
+ * were represented by NULL, but now they are represented by
+ * "application/octet-string". Perhaps we want to check for
+ * that here, so "program" will appear more often.
+ */
if (nautilus_strlen (mime_type) == 0) {
- /* No mime type, anything else interesting we can say about this? */
- /* if it's a directory, call it that before looking at executable */
+ /* No MIME type, anything else interesting we can say about this? */
+ /* FIXME: Maybe we should always return NULL when the
+ * MIME type is unknown.
+ */
+ /* If it's a directory, call it "folder" before
+ * looking at the executable bit, since the executable
+ * bit means something else for directories.
+ */
if (nautilus_file_is_directory (file)) {
- return type_as_string_considering_link (file, _("folder"));
+ return _("folder");
}
if (nautilus_file_is_executable (file)) {
- return type_as_string_considering_link (file, _("program"));
+ return _("program");
}
- return type_as_string_considering_link (file, NULL);
+ return NULL;
}
description = gnome_vfs_mime_get_description (mime_type);
if (nautilus_strlen (description) > 0) {
- return type_as_string_considering_link (file, description);
+ return description;
}
/* We want to update gnome-vfs/data/mime/gnome-vfs.keys to include
@@ -3401,10 +3363,42 @@ nautilus_file_get_type_as_string (NautilusFile *file)
"or isn't being found for some other reason.");
} else {
g_warning ("No description found for mime type \"%s\" (file is \"%s\"), tell sullivan@eazel.com",
- mime_type,
- file->details->name);
+ mime_type,
+ file->details->name);
+ }
+ return mime_type;
+}
+
+static char *
+update_description_for_link (NautilusFile *file, const char *string)
+{
+ if (nautilus_file_is_symbolic_link (file)) {
+ g_assert (!nautilus_file_is_broken_symbolic_link (file));
+ if (string == NULL) {
+ return g_strdup (_("link"));
+ }
+ /* Note to localizers: convert file type string for file
+ * (e.g. "folder", "plain text") to file type for symbolic link
+ * to that kind of file (e.g. "link to folder").
+ */
+ return g_strdup_printf (_("link to %s"), string);
+ }
+
+ return g_strdup (string);
+}
+
+static char *
+nautilus_file_get_type_as_string (NautilusFile *file)
+{
+ if (file == NULL) {
+ return NULL;
+ }
+
+ if (nautilus_file_is_broken_symbolic_link (file)) {
+ return g_strdup (_("link (broken)"));
}
- return type_as_string_considering_link (file, mime_type);
+
+ return update_description_for_link (file, get_description (file));
}
/**
@@ -3424,33 +3418,9 @@ nautilus_file_get_file_type (NautilusFile *file)
}
/**
- * nautilus_file_get_slow_mime_type
- *
- * Return this file's mime type, gotten by forcing a
- * slow mime check
- * @file: NautilusFile representing the file in question.
- *
- * Returns: The mime type.
- *
- **/
-char *
-nautilus_file_get_slow_mime_type (NautilusFile *file)
-{
- if (file != NULL) {
- g_return_val_if_fail (NAUTILUS_IS_FILE (file), NULL);
- if (file->details->slow_mime_type != NULL) {
- return g_strdup (file->details->slow_mime_type);
- }
- }
- return g_strdup ("application/octet-stream");
-}
-
-
-/**
* nautilus_file_get_mime_type
*
- * Return this file's default mime type, or the slow
- * mime type if that is all the information we have
+ * Return this file's default mime type.
* @file: NautilusFile representing the file in question.
*
* Returns: The mime type.
@@ -3459,19 +3429,16 @@ nautilus_file_get_slow_mime_type (NautilusFile *file)
char *
nautilus_file_get_mime_type (NautilusFile *file)
{
- const char *mime_type;
-
if (file != NULL) {
g_return_val_if_fail (NAUTILUS_IS_FILE (file), NULL);
- mime_type = get_either_mime_type (file);
- if (mime_type != NULL) {
- return g_strdup (mime_type);
+ if (file->details->info != NULL
+ && file->details->info->mime_type != NULL) {
+ return g_strdup (file->details->info->mime_type);
}
}
return g_strdup ("application/octet-stream");
}
-
/**
* nautilus_file_is_mime_type
*
@@ -3486,16 +3453,14 @@ nautilus_file_get_mime_type (NautilusFile *file)
gboolean
nautilus_file_is_mime_type (NautilusFile *file, const char *mime_type)
{
- const char *file_mime_type;
-
g_return_val_if_fail (NAUTILUS_IS_FILE (file), FALSE);
g_return_val_if_fail (mime_type != NULL, FALSE);
- file_mime_type = get_either_mime_type (file);
- if (file_mime_type != NULL) {
- return nautilus_strcasecmp (file_mime_type, mime_type) == 0;
+ if (file->details->info == NULL) {
+ return FALSE;
}
- return FALSE;
+ return nautilus_strcasecmp (file->details->info->mime_type,
+ mime_type) == 0;
}
/**
@@ -3666,7 +3631,6 @@ nautilus_file_is_nautilus_link (NautilusFile *file)
return nautilus_file_is_mime_type (file, "application/x-nautilus-link");
}
-
/**
* nautilus_file_is_directory
*
@@ -3697,7 +3661,6 @@ nautilus_file_is_directory (NautilusFile *file)
* Returns: TRUE if @file is in a trash.
*
**/
-
gboolean
nautilus_file_is_in_trash (NautilusFile *file)
{
@@ -3989,7 +3952,6 @@ nautilus_file_check_if_ready (NautilusFile *file,
file_attributes);
}
-
void
nautilus_file_call_when_ready (NautilusFile *file,
GList *file_attributes,
diff --git a/libnautilus-extensions/nautilus-file.h b/libnautilus-extensions/nautilus-file.h
index f22fb55e8..db9b31c4d 100644
--- a/libnautilus-extensions/nautilus-file.h
+++ b/libnautilus-extensions/nautilus-file.h
@@ -121,7 +121,6 @@ char * nautilus_file_get_parent_uri_for_display (NautilusFile
GnomeVFSFileSize nautilus_file_get_size (NautilusFile *file);
GnomeVFSFileType nautilus_file_get_file_type (NautilusFile *file);
char * nautilus_file_get_mime_type (NautilusFile *file);
-char * nautilus_file_get_slow_mime_type (NautilusFile *file);
gboolean nautilus_file_is_mime_type (NautilusFile *file,
const char *mime_type);
gboolean nautilus_file_is_symbolic_link (NautilusFile *file);
diff --git a/libnautilus-extensions/nautilus-glib-extensions.h b/libnautilus-extensions/nautilus-glib-extensions.h
index e2e525d03..14c4178da 100644
--- a/libnautilus-extensions/nautilus-glib-extensions.h
+++ b/libnautilus-extensions/nautilus-glib-extensions.h
@@ -52,92 +52,92 @@ typedef gboolean (* NautilusPredicateFunction) (gpointer data,
gpointer callback_data);
/* Date & time functions. */
-GDate * nautilus_g_date_new_tm (struct tm *time_pieces);
-char * nautilus_strdup_strftime (const char *format,
- struct tm *time_pieces);
+GDate * nautilus_g_date_new_tm (struct tm *time_pieces);
+char * nautilus_strdup_strftime (const char *format,
+ struct tm *time_pieces);
/* environment manipulation functions */
-int nautilus_setenv (const char *name,
- const char *value,
- gboolean overwrite);
-void nautilus_unsetenv (const char *name);
+int nautilus_setenv (const char *name,
+ const char *value,
+ gboolean overwrite);
+void nautilus_unsetenv (const char *name);
/* GList functions. */
-gboolean nautilus_g_list_exactly_one_item (GList *list);
-gboolean nautilus_g_list_more_than_one_item (GList *list);
-gboolean nautilus_g_list_equal (GList *list_a,
- GList *list_b);
-GList * nautilus_g_list_copy (GList *list);
-void nautilus_g_list_safe_for_each (GList *list,
- GFunc function,
- gpointer user_data);
-GList * nautilus_g_list_partition (GList *list,
- NautilusPredicateFunction predicate,
- gpointer user_data,
- GList **removed);
-void nautilus_g_list_free_deep_custom (GList *list,
- GFunc element_free_func,
- gpointer user_data);
+gboolean nautilus_g_list_exactly_one_item (GList *list);
+gboolean nautilus_g_list_more_than_one_item (GList *list);
+gboolean nautilus_g_list_equal (GList *list_a,
+ GList *list_b);
+GList * nautilus_g_list_copy (GList *list);
+void nautilus_g_list_safe_for_each (GList *list,
+ GFunc function,
+ gpointer user_data);
+GList * nautilus_g_list_partition (GList *list,
+ NautilusPredicateFunction predicate,
+ gpointer user_data,
+ GList **removed);
+void nautilus_g_list_free_deep_custom (GList *list,
+ GFunc element_free_func,
+ gpointer user_data);
/* List functions for lists of g_free'able objects. */
-void nautilus_g_list_free_deep (GList *list);
-void nautilus_g_slist_free_deep_custom (GSList *list,
- GFunc element_free_func,
- gpointer user_data);
+void nautilus_g_list_free_deep (GList *list);
+void nautilus_g_slist_free_deep_custom (GSList *list,
+ GFunc element_free_func,
+ gpointer user_data);
/* List functions for slists of g_free'able objects. */
-void nautilus_g_slist_free_deep (GSList *list);
+void nautilus_g_slist_free_deep (GSList *list);
/* List functions for lists of C strings. */
-gboolean nautilus_g_str_list_equal (GList *str_list_a,
- GList *str_list_b);
-GList * nautilus_g_str_list_copy (GList *str_list);
-GList * nautilus_g_str_list_sort (GList *str_list);
-GList * nautilus_g_str_list_sort_case_insensitive (GList *str_list);
+gboolean nautilus_g_str_list_equal (GList *str_list_a,
+ GList *str_list_b);
+GList * nautilus_g_str_list_copy (GList *str_list);
+GList * nautilus_g_str_list_sort (GList *str_list);
+GList * nautilus_g_str_list_sort_case_insensitive (GList *str_list);
/* GString functions */
-void nautilus_g_string_append_len (GString *string,
- const char *characters,
- int length);
+void nautilus_g_string_append_len (GString *string,
+ const char *characters,
+ int length);
/* GHashTable functions */
-GHashTable *nautilus_g_hash_table_new_free_at_exit (GHashFunc hash_function,
- GCompareFunc key_compare_function,
- const char *display_name);
-void nautilus_g_hash_table_safe_for_each (GHashTable *hash_table,
- GHFunc callback,
- gpointer callback_data);
-gboolean nautilus_g_hash_table_remove_deep_custom (GHashTable *hash_table,
- gconstpointer key,
- GFreeFunc key_free,
- GFreeFunc data_free);
-gboolean nautilus_g_hash_table_remove_deep (GHashTable *hash_table,
- gconstpointer key);
-void nautilus_g_hash_table_free_deep_custom (GHashTable *hash_table,
- GFreeFunc key_free,
- GFreeFunc data_free);
-void nautilus_g_hash_table_free_deep (GHashTable *hash_table);
+GHashTable *nautilus_g_hash_table_new_free_at_exit (GHashFunc hash_function,
+ GCompareFunc key_compare_function,
+ const char *display_name);
+void nautilus_g_hash_table_safe_for_each (GHashTable *hash_table,
+ GHFunc callback,
+ gpointer callback_data);
+gboolean nautilus_g_hash_table_remove_deep_custom (GHashTable *hash_table,
+ gconstpointer key,
+ GFreeFunc key_free,
+ GFreeFunc data_free);
+gboolean nautilus_g_hash_table_remove_deep (GHashTable *hash_table,
+ gconstpointer key);
+void nautilus_g_hash_table_free_deep_custom (GHashTable *hash_table,
+ GFreeFunc key_free,
+ GFreeFunc data_free);
+void nautilus_g_hash_table_free_deep (GHashTable *hash_table);
/* GPtrArray functions */
-GPtrArray * nautilus_g_ptr_array_new_from_list (GList *list);
-void nautilus_g_ptr_array_sort (GPtrArray *array,
- NautilusCompareFunction compare_callback,
- gpointer callback_data);
-int nautilus_g_ptr_array_search (GPtrArray *array,
- NautilusSearchFunction search_callback,
- gpointer callback_data,
- gboolean match_only);
+GPtrArray * nautilus_g_ptr_array_new_from_list (GList *list);
+void nautilus_g_ptr_array_sort (GPtrArray *array,
+ NautilusCompareFunction compare_callback,
+ gpointer callback_data);
+int nautilus_g_ptr_array_search (GPtrArray *array,
+ NautilusSearchFunction search_callback,
+ gpointer callback_data,
+ gboolean match_only);
/* NULL terminated string arrays (strv). */
-int nautilus_g_strv_find (char **strv,
- const char *find_me);
+int nautilus_g_strv_find (char **strv,
+ const char *find_me);
/* return the time in microseconds since the machine was started */
gint64 nautilus_get_system_time (void);
/* shell */
-char * nautilus_shell_quote (const char *string);
+char * nautilus_shell_quote (const char *string);
#endif /* NAUTILUS_GLIB_EXTENSIONS_H */
diff --git a/libnautilus-extensions/nautilus-mime-actions.c b/libnautilus-extensions/nautilus-mime-actions.c
index 983f2da21..375c5e0e1 100644
--- a/libnautilus-extensions/nautilus-mime-actions.c
+++ b/libnautilus-extensions/nautilus-mime-actions.c
@@ -119,7 +119,7 @@ nautilus_mime_actions_get_required_file_attributes ()
attributes = NULL;
attributes = g_list_prepend (attributes, NAUTILUS_FILE_ATTRIBUTE_METADATA);
- attributes = g_list_prepend (attributes, NAUTILUS_FILE_ATTRIBUTE_SLOW_MIME_TYPE);
+ attributes = g_list_prepend (attributes, NAUTILUS_FILE_ATTRIBUTE_MIME_TYPE);
attributes = g_list_prepend (attributes, NAUTILUS_FILE_ATTRIBUTE_DIRECTORY_ITEM_MIME_TYPES);
return attributes;
@@ -153,7 +153,7 @@ nautilus_mime_get_default_action_type_for_file (NautilusFile *file)
(file, NAUTILUS_METADATA_KEY_DEFAULT_ACTION_TYPE, NULL);
if (action_type_string == NULL) {
- mime_type = nautilus_file_get_slow_mime_type (file);
+ mime_type = nautilus_file_get_mime_type (file);
action_type = gnome_vfs_mime_get_default_action_type (mime_type);
g_free (mime_type);
return action_type;
@@ -226,7 +226,7 @@ nautilus_mime_get_default_application_for_file_internal (NautilusFile *file
(file, NAUTILUS_METADATA_KEY_DEFAULT_APPLICATION, NULL);
if (default_application_string == NULL) {
- mime_type = nautilus_file_get_slow_mime_type (file);
+ mime_type = nautilus_file_get_mime_type (file);
result = gnome_vfs_mime_get_default_application (mime_type);
g_free (mime_type);
used_user_chosen_info = FALSE;
@@ -295,7 +295,7 @@ nautilus_mime_get_default_component_for_file_internal (NautilusFile *file,
CORBA_exception_init (&ev);
- mime_type = nautilus_file_get_slow_mime_type (file);
+ mime_type = nautilus_file_get_mime_type (file);
uri_scheme = nautilus_file_get_uri_scheme (file);
@@ -462,7 +462,7 @@ nautilus_mime_get_short_list_applications_for_file (NautilusFile *file)
NAUTILUS_METADATA_KEY_SHORT_LIST_APPLICATION_REMOVE,
NAUTILUS_METADATA_SUBKEY_APPLICATION_ID);
- mime_type = nautilus_file_get_slow_mime_type (file);
+ mime_type = nautilus_file_get_mime_type (file);
result = gnome_vfs_mime_get_short_list_applications (mime_type);
g_free (mime_type);
@@ -529,7 +529,7 @@ nautilus_mime_get_short_list_components_for_file (NautilusFile *file)
NAUTILUS_METADATA_KEY_SHORT_LIST_COMPONENT_REMOVE,
NAUTILUS_METADATA_SUBKEY_COMPONENT_IID);
- mime_type = nautilus_file_get_slow_mime_type (file);
+ mime_type = nautilus_file_get_mime_type (file);
servers = gnome_vfs_mime_get_short_list_components (mime_type);
iids = NULL;
@@ -597,7 +597,7 @@ nautilus_mime_get_short_list_methods_for_file (NautilusFile *file)
g_return_val_if_fail (nautilus_mime_actions_check_if_required_attributes_ready (file),
NULL);
- mime_type = nautilus_file_get_slow_mime_type (file);
+ mime_type = nautilus_file_get_mime_type (file);
method = gnome_vfs_mime_get_value (mime_type, "vfs-method");
g_free (mime_type);
return g_strdup (method);
@@ -620,7 +620,7 @@ nautilus_mime_get_all_applications_for_file (NautilusFile *file)
NAUTILUS_METADATA_KEY_EXPLICIT_APPLICATION,
NAUTILUS_METADATA_SUBKEY_APPLICATION_ID);
- mime_type = nautilus_file_get_slow_mime_type (file);
+ mime_type = nautilus_file_get_mime_type (file);
result = gnome_vfs_mime_get_all_applications (mime_type);
@@ -670,7 +670,7 @@ nautilus_mime_get_all_components_for_file (NautilusFile *file)
uri_scheme = nautilus_file_get_uri_scheme (file);
- mime_type = nautilus_file_get_slow_mime_type (file);
+ mime_type = nautilus_file_get_mime_type (file);
explicit_iids = get_explicit_content_view_iids_from_metafile (file);
nautilus_file_get_directory_item_mime_types (file, &item_mime_types);
@@ -774,7 +774,7 @@ nautilus_mime_set_short_list_applications_for_file (NautilusFile *file,
/* get per-mime short list */
- mime_type = nautilus_file_get_slow_mime_type (file);
+ mime_type = nautilus_file_get_mime_type (file);
normal_short_list = gnome_vfs_mime_get_short_list_applications (mime_type);
g_free (mime_type);
@@ -821,7 +821,7 @@ nautilus_mime_set_short_list_components_for_file (NautilusFile *file,
GNOME_VFS_ERROR_GENERIC);
/* get per-mime short list */
- mime_type = nautilus_file_get_slow_mime_type (file);
+ mime_type = nautilus_file_get_mime_type (file);
normal_short_list = gnome_vfs_mime_get_short_list_components (mime_type);
g_free (mime_type);
diff --git a/libnautilus-private/nautilus-directory-async.c b/libnautilus-private/nautilus-directory-async.c
index c7bdf3a40..7238e7521 100644
--- a/libnautilus-private/nautilus-directory-async.c
+++ b/libnautilus-private/nautilus-directory-async.c
@@ -83,7 +83,6 @@ typedef struct {
gboolean metafile;
gboolean file_list; /* always FALSE if file != NULL */
gboolean file_info;
- gboolean get_slow_mime_type; /* only relevant if file_info is "true" */
gboolean directory_count;
gboolean deep_count;
gboolean mime_list;
@@ -955,18 +954,11 @@ set_up_request_by_file_attributes (Request *request,
NAUTILUS_FILE_ATTRIBUTE_FILE_TYPE,
nautilus_str_compare) != NULL;
if (g_list_find_custom (file_attributes,
- NAUTILUS_FILE_ATTRIBUTE_SLOW_MIME_TYPE,
- nautilus_str_compare) != NULL) {
- request->file_info |= TRUE;
- request->get_slow_mime_type = TRUE;
- }
- if (g_list_find_custom (file_attributes,
NAUTILUS_FILE_ATTRIBUTE_ACTIVATION_URI,
nautilus_str_compare) != NULL) {
request->file_info = TRUE;
request->activation_uri = TRUE;
}
-
if (!request->metafile) {
request->metafile = g_list_find_custom
@@ -1082,7 +1074,7 @@ update_file_info_in_list_if_needed (GList *list,
}
/* the file is in the list already update the file info if needed */
- nautilus_file_update_info (NAUTILUS_FILE (list_entry->data), file_info, FALSE);
+ nautilus_file_update_info (NAUTILUS_FILE (list_entry->data), file_info);
return TRUE;
}
@@ -1146,7 +1138,7 @@ dequeue_pending_idle_callback (gpointer callback_data)
if (file != NULL) {
/* file already exists, check if it changed */
set_file_unconfirmed (file, FALSE);
- if (nautilus_file_update_info (file, file_info, FALSE)) {
+ if (nautilus_file_update_info (file, file_info)) {
/* File changed, notify about the change. */
nautilus_file_ref (file);
changed_files = g_list_prepend (changed_files, file);
@@ -1706,28 +1698,12 @@ lacks_info (NautilusFile *file)
}
static gboolean
-lacks_slow_mime_type (NautilusFile *file)
-{
- /* Don't try and get the the slow mime type
- if we couldn't get the file info in the first place */
- return file->details->slow_mime_type == NULL
- && !file->details->is_gone
- && !file->details->get_info_failed;
-}
-
-static gboolean
wants_info (const Request *request)
{
return request->file_info;
}
static gboolean
-wants_slow_mime_type (const Request *request)
-{
- return request->get_slow_mime_type;
-}
-
-static gboolean
lacks_deep_count (NautilusFile *file)
{
return nautilus_file_is_directory (file)
@@ -1812,12 +1788,6 @@ request_is_satisfied (NautilusDirectory *directory,
}
}
- if (request->get_slow_mime_type) {
- if (has_problem (directory, file, lacks_slow_mime_type)) {
- return FALSE;
- }
- }
-
if (request->deep_count) {
if (has_problem (directory, file, lacks_deep_count)) {
return FALSE;
@@ -2680,10 +2650,8 @@ get_info_callback (GnomeVFSAsyncHandle *handle,
NautilusDirectory *directory;
NautilusFile *get_info_file;
GnomeVFSGetFileInfoResult *result;
- gboolean got_slow_mime_type;
directory = NAUTILUS_DIRECTORY (callback_data);
- got_slow_mime_type = directory->details->get_slow_mime_type_for_file;
g_assert (handle == NULL || handle == directory->details->get_info_in_progress);
g_assert (nautilus_g_list_exactly_one_item (results));
get_info_file = directory->details->get_info_file;
@@ -2697,8 +2665,7 @@ get_info_callback (GnomeVFSAsyncHandle *handle,
get_info_file->details->get_info_failed = TRUE;
get_info_file->details->get_info_error = result->result;
} else {
- nautilus_file_update_info (get_info_file, result->file_info,
- got_slow_mime_type);
+ nautilus_file_update_info (get_info_file, result->file_info);
}
nautilus_file_changed (get_info_file);
@@ -2713,7 +2680,6 @@ file_info_start (NautilusDirectory *directory)
char *uri;
GnomeVFSURI *vfs_uri;
GList fake_list;
- gboolean get_slow_mime_type;
/* If there's already a file info fetch in progress, check to
* be sure it's still wanted.
@@ -2734,15 +2700,7 @@ file_info_start (NautilusDirectory *directory)
/* Figure out which file to get file info for. */
do {
- file = select_needy_file (directory, lacks_slow_mime_type, wants_slow_mime_type);
- if (file == NULL) {
- file = select_needy_file (directory, lacks_info, wants_info);
-
- get_slow_mime_type = FALSE;
- }
- else {
- get_slow_mime_type = TRUE;
- }
+ file = select_needy_file (directory, lacks_info, wants_info);
if (file == NULL) {
return;
}
@@ -2763,19 +2721,14 @@ file_info_start (NautilusDirectory *directory)
return;
}
directory->details->get_info_file = file;
- directory->details->get_slow_mime_type_for_file = get_slow_mime_type;
fake_list.data = vfs_uri;
fake_list.prev = NULL;
fake_list.next = NULL;
gnome_vfs_async_get_file_info
(&directory->details->get_info_in_progress,
&fake_list,
- get_slow_mime_type
- ? (GNOME_VFS_FILE_INFO_GET_MIME_TYPE
- | GNOME_VFS_FILE_INFO_FORCE_SLOW_MIME_TYPE
- | GNOME_VFS_FILE_INFO_FOLLOW_LINKS)
- : (GNOME_VFS_FILE_INFO_GET_MIME_TYPE
- | GNOME_VFS_FILE_INFO_FOLLOW_LINKS),
+ GNOME_VFS_FILE_INFO_GET_MIME_TYPE
+ | GNOME_VFS_FILE_INFO_FOLLOW_LINKS,
get_info_callback,
directory);
gnome_vfs_uri_unref (vfs_uri);
diff --git a/libnautilus-private/nautilus-directory-private.h b/libnautilus-private/nautilus-directory-private.h
index e8d4230f1..c7b42cd1c 100644
--- a/libnautilus-private/nautilus-directory-private.h
+++ b/libnautilus-private/nautilus-directory-private.h
@@ -95,7 +95,6 @@ struct NautilusDirectoryDetails
GnomeVFSAsyncHandle *get_info_in_progress;
NautilusFile *get_info_file;
- gboolean get_slow_mime_type_for_file;
TopLeftTextReadState *top_left_read_state;
ActivationURIReadState *activation_uri_read_state;
diff --git a/libnautilus-private/nautilus-file-attributes.h b/libnautilus-private/nautilus-file-attributes.h
index a165e0884..b73b8f0d3 100644
--- a/libnautilus-private/nautilus-file-attributes.h
+++ b/libnautilus-private/nautilus-file-attributes.h
@@ -25,8 +25,8 @@
#ifndef NAUTILUS_FILE_ATTRIBUTES_H
#define NAUTILUS_FILE_ATTRIBUTES_H
-/* Names for NautilusFile attributes. These are used when registering interest
- * in changes to the attributes.
+/* Names for NautilusFile attributes. These are used when registering
+ * interest in changes to the attributes or when waiting for them.
*/
#define NAUTILUS_FILE_ATTRIBUTE_ACTIVATION_URI "activation URI"
@@ -34,7 +34,6 @@
#define NAUTILUS_FILE_ATTRIBUTE_DEEP_COUNTS "deep counts"
#define NAUTILUS_FILE_ATTRIBUTE_DIRECTORY_ITEM_COUNT "directory item count"
#define NAUTILUS_FILE_ATTRIBUTE_MIME_TYPE "MIME type"
-#define NAUTILUS_FILE_ATTRIBUTE_SLOW_MIME_TYPE "MIME type"
#define NAUTILUS_FILE_ATTRIBUTE_TOP_LEFT_TEXT "top left text"
#define NAUTILUS_FILE_ATTRIBUTE_IS_DIRECTORY "is directory"
#define NAUTILUS_FILE_ATTRIBUTE_FILE_TYPE "file type"
@@ -42,5 +41,3 @@
#define NAUTILUS_FILE_ATTRIBUTE_METADATA "metadata"
#endif /* NAUTILUS_FILE_ATTRIBUTES_H */
-
-
diff --git a/libnautilus-private/nautilus-file-private.h b/libnautilus-private/nautilus-file-private.h
index 5e47c7329..e4a083d6c 100644
--- a/libnautilus-private/nautilus-file-private.h
+++ b/libnautilus-private/nautilus-file-private.h
@@ -37,13 +37,6 @@ struct NautilusFileDetails
gboolean get_info_failed;
GnomeVFSResult get_info_error;
- /* Since the file info doesn't remember what kind of mime type
- * it got, we'll just keep them here, where it is clear what
- * kind of mime type they are.
- */
- char *default_mime_type;
- char *slow_mime_type;
-
gboolean got_directory_count;
gboolean directory_count_failed;
guint directory_count;
@@ -92,8 +85,7 @@ gboolean nautilus_file_contains_text (NautilusFile *file);
* new state.
*/
gboolean nautilus_file_update_info (NautilusFile *file,
- GnomeVFSFileInfo *info,
- gboolean got_slow_mime_type);
+ GnomeVFSFileInfo *info);
gboolean nautilus_file_update_name (NautilusFile *file,
const char *name);
diff --git a/libnautilus-private/nautilus-file.c b/libnautilus-private/nautilus-file.c
index aef7fe678..85661a64b 100644
--- a/libnautilus-private/nautilus-file.c
+++ b/libnautilus-private/nautilus-file.c
@@ -247,10 +247,7 @@ nautilus_file_new_from_info (NautilusDirectory *directory,
nautilus_directory_ref (directory);
file->details->directory = directory;
- /* We don't know how the mime type in the file info has
- been gotten, so it's safest to assume it was the default
- mime type */
- nautilus_file_update_info (file, info, FALSE);
+ nautilus_file_update_info (file, info);
return file;
}
@@ -396,8 +393,6 @@ destroy (GtkObject *object)
} else {
gnome_vfs_file_info_unref (file->details->info);
}
- g_free (file->details->default_mime_type);
- g_free (file->details->slow_mime_type);
g_free (file->details->top_left_text);
g_free (file->details->activation_uri);
@@ -1088,8 +1083,7 @@ update_links_if_target (NautilusFile *target_file)
}
gboolean
-nautilus_file_update_info (NautilusFile *file, GnomeVFSFileInfo *info,
- gboolean got_slow_mime_type)
+nautilus_file_update_info (NautilusFile *file, GnomeVFSFileInfo *info)
{
GList *node;
@@ -1103,8 +1097,7 @@ nautilus_file_update_info (NautilusFile *file, GnomeVFSFileInfo *info,
}
if (file->details->info != NULL
- && gnome_vfs_file_info_matches (file->details->info, info)
- && !got_slow_mime_type) {
+ && gnome_vfs_file_info_matches (file->details->info, info)) {
return FALSE;
}
@@ -1119,13 +1112,6 @@ nautilus_file_update_info (NautilusFile *file, GnomeVFSFileInfo *info,
gnome_vfs_file_info_unref (file->details->info);
}
file->details->info = info;
- if (got_slow_mime_type) {
- g_free (file->details->slow_mime_type);
- file->details->slow_mime_type = g_strdup (info->mime_type);
- } else {
- g_free (file->details->default_mime_type);
- file->details->default_mime_type = g_strdup (info->mime_type);
- }
file->details->name = info->name;
nautilus_directory_end_file_name_change (file->details->directory,
file, node);
@@ -1166,10 +1152,7 @@ nautilus_file_update_name (NautilusFile *file, const char *name)
gnome_vfs_file_info_copy (info, file->details->info);
g_free (info->name);
info->name = g_strdup (name);
- /* FIXME: Perhaps we want to keep track of how we got
- the mime type the last time and pass that in here
- instead of FALSE */
- nautilus_file_update_info (file, info, FALSE);
+ nautilus_file_update_info (file, info);
gnome_vfs_file_info_unref (info);
}
@@ -1368,18 +1351,6 @@ nautilus_file_compare_by_emblems (NautilusFile *file_1, NautilusFile *file_2)
return compare_result;
}
-static const char *
-get_either_mime_type (NautilusFile *file)
-{
- /* Always prefer the non-slow type since that's updated more
- * often. This doesn't sound quite right, but I guess it's OK.
- */
- if (file->details->default_mime_type != NULL) {
- return file->details->default_mime_type;
- }
- return file->details->slow_mime_type;
-}
-
static int
nautilus_file_compare_by_type (NautilusFile *file_1, NautilusFile *file_2)
{
@@ -1411,8 +1382,8 @@ nautilus_file_compare_by_type (NautilusFile *file_1, NautilusFile *file_2)
if (file_1->details->info != NULL
&& file_2->details->info != NULL
- && nautilus_strcmp (get_either_mime_type (file_1),
- get_either_mime_type (file_2)) == 0) {
+ && nautilus_strcmp (file_1->details->info->mime_type,
+ file_2->details->info->mime_type) == 0) {
return 0;
}
@@ -3207,9 +3178,6 @@ nautilus_file_get_string_attribute (NautilusFile *file, const char *attribute_na
if (strcmp (attribute_name, "mime_type") == 0) {
return nautilus_file_get_mime_type (file);
}
- if (strcmp (attribute_name, "slow_mime_type") == 0) {
- return nautilus_file_get_slow_mime_type (file);
- }
if (strcmp (attribute_name, "size") == 0) {
return nautilus_file_get_size_as_string (file);
}
@@ -3333,21 +3301,6 @@ nautilus_file_get_string_attribute_with_default (NautilusFile *file, const char
return result;
}
-static char *
-type_as_string_considering_link (NautilusFile *file, const char *string)
-{
- if (nautilus_file_is_symbolic_link (file)) {
- g_assert (!nautilus_file_is_broken_symbolic_link (file));
- /* Note to localizers: convert file type string for file
- * (e.g. "folder", "plain text") to file type for symbolic link
- * to that kind of file (e.g. "link to folder").
- */
- return g_strdup_printf (_("link to %s"), string);
- }
-
- return g_strdup (string);
-}
-
/**
* nautilus_file_get_type_as_string:
*
@@ -3358,38 +3311,47 @@ type_as_string_considering_link (NautilusFile *file, const char *string)
* Returns: Newly allocated string ready to display to the user.
*
**/
-static char *
-nautilus_file_get_type_as_string (NautilusFile *file)
+
+static const char *
+get_description (NautilusFile *file)
{
- const char *mime_type;
- const char *description;
+ const char *mime_type, *description;
- if (file == NULL) {
- return NULL;
- }
+ g_assert (NAUTILUS_IS_FILE (file));
- if (nautilus_file_is_broken_symbolic_link (file)) {
- return g_strdup (_("link (broken)"));
+ if (file->details->info == NULL) {
+ mime_type = NULL;
+ } else {
+ mime_type = file->details->info->mime_type;
}
- mime_type = get_either_mime_type (file);
-
+ /* FIXME: When this code was originally written, unknown types
+ * were represented by NULL, but now they are represented by
+ * "application/octet-string". Perhaps we want to check for
+ * that here, so "program" will appear more often.
+ */
if (nautilus_strlen (mime_type) == 0) {
- /* No mime type, anything else interesting we can say about this? */
- /* if it's a directory, call it that before looking at executable */
+ /* No MIME type, anything else interesting we can say about this? */
+ /* FIXME: Maybe we should always return NULL when the
+ * MIME type is unknown.
+ */
+ /* If it's a directory, call it "folder" before
+ * looking at the executable bit, since the executable
+ * bit means something else for directories.
+ */
if (nautilus_file_is_directory (file)) {
- return type_as_string_considering_link (file, _("folder"));
+ return _("folder");
}
if (nautilus_file_is_executable (file)) {
- return type_as_string_considering_link (file, _("program"));
+ return _("program");
}
- return type_as_string_considering_link (file, NULL);
+ return NULL;
}
description = gnome_vfs_mime_get_description (mime_type);
if (nautilus_strlen (description) > 0) {
- return type_as_string_considering_link (file, description);
+ return description;
}
/* We want to update gnome-vfs/data/mime/gnome-vfs.keys to include
@@ -3401,10 +3363,42 @@ nautilus_file_get_type_as_string (NautilusFile *file)
"or isn't being found for some other reason.");
} else {
g_warning ("No description found for mime type \"%s\" (file is \"%s\"), tell sullivan@eazel.com",
- mime_type,
- file->details->name);
+ mime_type,
+ file->details->name);
+ }
+ return mime_type;
+}
+
+static char *
+update_description_for_link (NautilusFile *file, const char *string)
+{
+ if (nautilus_file_is_symbolic_link (file)) {
+ g_assert (!nautilus_file_is_broken_symbolic_link (file));
+ if (string == NULL) {
+ return g_strdup (_("link"));
+ }
+ /* Note to localizers: convert file type string for file
+ * (e.g. "folder", "plain text") to file type for symbolic link
+ * to that kind of file (e.g. "link to folder").
+ */
+ return g_strdup_printf (_("link to %s"), string);
+ }
+
+ return g_strdup (string);
+}
+
+static char *
+nautilus_file_get_type_as_string (NautilusFile *file)
+{
+ if (file == NULL) {
+ return NULL;
+ }
+
+ if (nautilus_file_is_broken_symbolic_link (file)) {
+ return g_strdup (_("link (broken)"));
}
- return type_as_string_considering_link (file, mime_type);
+
+ return update_description_for_link (file, get_description (file));
}
/**
@@ -3424,33 +3418,9 @@ nautilus_file_get_file_type (NautilusFile *file)
}
/**
- * nautilus_file_get_slow_mime_type
- *
- * Return this file's mime type, gotten by forcing a
- * slow mime check
- * @file: NautilusFile representing the file in question.
- *
- * Returns: The mime type.
- *
- **/
-char *
-nautilus_file_get_slow_mime_type (NautilusFile *file)
-{
- if (file != NULL) {
- g_return_val_if_fail (NAUTILUS_IS_FILE (file), NULL);
- if (file->details->slow_mime_type != NULL) {
- return g_strdup (file->details->slow_mime_type);
- }
- }
- return g_strdup ("application/octet-stream");
-}
-
-
-/**
* nautilus_file_get_mime_type
*
- * Return this file's default mime type, or the slow
- * mime type if that is all the information we have
+ * Return this file's default mime type.
* @file: NautilusFile representing the file in question.
*
* Returns: The mime type.
@@ -3459,19 +3429,16 @@ nautilus_file_get_slow_mime_type (NautilusFile *file)
char *
nautilus_file_get_mime_type (NautilusFile *file)
{
- const char *mime_type;
-
if (file != NULL) {
g_return_val_if_fail (NAUTILUS_IS_FILE (file), NULL);
- mime_type = get_either_mime_type (file);
- if (mime_type != NULL) {
- return g_strdup (mime_type);
+ if (file->details->info != NULL
+ && file->details->info->mime_type != NULL) {
+ return g_strdup (file->details->info->mime_type);
}
}
return g_strdup ("application/octet-stream");
}
-
/**
* nautilus_file_is_mime_type
*
@@ -3486,16 +3453,14 @@ nautilus_file_get_mime_type (NautilusFile *file)
gboolean
nautilus_file_is_mime_type (NautilusFile *file, const char *mime_type)
{
- const char *file_mime_type;
-
g_return_val_if_fail (NAUTILUS_IS_FILE (file), FALSE);
g_return_val_if_fail (mime_type != NULL, FALSE);
- file_mime_type = get_either_mime_type (file);
- if (file_mime_type != NULL) {
- return nautilus_strcasecmp (file_mime_type, mime_type) == 0;
+ if (file->details->info == NULL) {
+ return FALSE;
}
- return FALSE;
+ return nautilus_strcasecmp (file->details->info->mime_type,
+ mime_type) == 0;
}
/**
@@ -3666,7 +3631,6 @@ nautilus_file_is_nautilus_link (NautilusFile *file)
return nautilus_file_is_mime_type (file, "application/x-nautilus-link");
}
-
/**
* nautilus_file_is_directory
*
@@ -3697,7 +3661,6 @@ nautilus_file_is_directory (NautilusFile *file)
* Returns: TRUE if @file is in a trash.
*
**/
-
gboolean
nautilus_file_is_in_trash (NautilusFile *file)
{
@@ -3989,7 +3952,6 @@ nautilus_file_check_if_ready (NautilusFile *file,
file_attributes);
}
-
void
nautilus_file_call_when_ready (NautilusFile *file,
GList *file_attributes,
diff --git a/libnautilus-private/nautilus-file.h b/libnautilus-private/nautilus-file.h
index f22fb55e8..db9b31c4d 100644
--- a/libnautilus-private/nautilus-file.h
+++ b/libnautilus-private/nautilus-file.h
@@ -121,7 +121,6 @@ char * nautilus_file_get_parent_uri_for_display (NautilusFile
GnomeVFSFileSize nautilus_file_get_size (NautilusFile *file);
GnomeVFSFileType nautilus_file_get_file_type (NautilusFile *file);
char * nautilus_file_get_mime_type (NautilusFile *file);
-char * nautilus_file_get_slow_mime_type (NautilusFile *file);
gboolean nautilus_file_is_mime_type (NautilusFile *file,
const char *mime_type);
gboolean nautilus_file_is_symbolic_link (NautilusFile *file);
diff --git a/libnautilus-private/nautilus-glib-extensions.h b/libnautilus-private/nautilus-glib-extensions.h
index e2e525d03..14c4178da 100644
--- a/libnautilus-private/nautilus-glib-extensions.h
+++ b/libnautilus-private/nautilus-glib-extensions.h
@@ -52,92 +52,92 @@ typedef gboolean (* NautilusPredicateFunction) (gpointer data,
gpointer callback_data);
/* Date & time functions. */
-GDate * nautilus_g_date_new_tm (struct tm *time_pieces);
-char * nautilus_strdup_strftime (const char *format,
- struct tm *time_pieces);
+GDate * nautilus_g_date_new_tm (struct tm *time_pieces);
+char * nautilus_strdup_strftime (const char *format,
+ struct tm *time_pieces);
/* environment manipulation functions */
-int nautilus_setenv (const char *name,
- const char *value,
- gboolean overwrite);
-void nautilus_unsetenv (const char *name);
+int nautilus_setenv (const char *name,
+ const char *value,
+ gboolean overwrite);
+void nautilus_unsetenv (const char *name);
/* GList functions. */
-gboolean nautilus_g_list_exactly_one_item (GList *list);
-gboolean nautilus_g_list_more_than_one_item (GList *list);
-gboolean nautilus_g_list_equal (GList *list_a,
- GList *list_b);
-GList * nautilus_g_list_copy (GList *list);
-void nautilus_g_list_safe_for_each (GList *list,
- GFunc function,
- gpointer user_data);
-GList * nautilus_g_list_partition (GList *list,
- NautilusPredicateFunction predicate,
- gpointer user_data,
- GList **removed);
-void nautilus_g_list_free_deep_custom (GList *list,
- GFunc element_free_func,
- gpointer user_data);
+gboolean nautilus_g_list_exactly_one_item (GList *list);
+gboolean nautilus_g_list_more_than_one_item (GList *list);
+gboolean nautilus_g_list_equal (GList *list_a,
+ GList *list_b);
+GList * nautilus_g_list_copy (GList *list);
+void nautilus_g_list_safe_for_each (GList *list,
+ GFunc function,
+ gpointer user_data);
+GList * nautilus_g_list_partition (GList *list,
+ NautilusPredicateFunction predicate,
+ gpointer user_data,
+ GList **removed);
+void nautilus_g_list_free_deep_custom (GList *list,
+ GFunc element_free_func,
+ gpointer user_data);
/* List functions for lists of g_free'able objects. */
-void nautilus_g_list_free_deep (GList *list);
-void nautilus_g_slist_free_deep_custom (GSList *list,
- GFunc element_free_func,
- gpointer user_data);
+void nautilus_g_list_free_deep (GList *list);
+void nautilus_g_slist_free_deep_custom (GSList *list,
+ GFunc element_free_func,
+ gpointer user_data);
/* List functions for slists of g_free'able objects. */
-void nautilus_g_slist_free_deep (GSList *list);
+void nautilus_g_slist_free_deep (GSList *list);
/* List functions for lists of C strings. */
-gboolean nautilus_g_str_list_equal (GList *str_list_a,
- GList *str_list_b);
-GList * nautilus_g_str_list_copy (GList *str_list);
-GList * nautilus_g_str_list_sort (GList *str_list);
-GList * nautilus_g_str_list_sort_case_insensitive (GList *str_list);
+gboolean nautilus_g_str_list_equal (GList *str_list_a,
+ GList *str_list_b);
+GList * nautilus_g_str_list_copy (GList *str_list);
+GList * nautilus_g_str_list_sort (GList *str_list);
+GList * nautilus_g_str_list_sort_case_insensitive (GList *str_list);
/* GString functions */
-void nautilus_g_string_append_len (GString *string,
- const char *characters,
- int length);
+void nautilus_g_string_append_len (GString *string,
+ const char *characters,
+ int length);
/* GHashTable functions */
-GHashTable *nautilus_g_hash_table_new_free_at_exit (GHashFunc hash_function,
- GCompareFunc key_compare_function,
- const char *display_name);
-void nautilus_g_hash_table_safe_for_each (GHashTable *hash_table,
- GHFunc callback,
- gpointer callback_data);
-gboolean nautilus_g_hash_table_remove_deep_custom (GHashTable *hash_table,
- gconstpointer key,
- GFreeFunc key_free,
- GFreeFunc data_free);
-gboolean nautilus_g_hash_table_remove_deep (GHashTable *hash_table,
- gconstpointer key);
-void nautilus_g_hash_table_free_deep_custom (GHashTable *hash_table,
- GFreeFunc key_free,
- GFreeFunc data_free);
-void nautilus_g_hash_table_free_deep (GHashTable *hash_table);
+GHashTable *nautilus_g_hash_table_new_free_at_exit (GHashFunc hash_function,
+ GCompareFunc key_compare_function,
+ const char *display_name);
+void nautilus_g_hash_table_safe_for_each (GHashTable *hash_table,
+ GHFunc callback,
+ gpointer callback_data);
+gboolean nautilus_g_hash_table_remove_deep_custom (GHashTable *hash_table,
+ gconstpointer key,
+ GFreeFunc key_free,
+ GFreeFunc data_free);
+gboolean nautilus_g_hash_table_remove_deep (GHashTable *hash_table,
+ gconstpointer key);
+void nautilus_g_hash_table_free_deep_custom (GHashTable *hash_table,
+ GFreeFunc key_free,
+ GFreeFunc data_free);
+void nautilus_g_hash_table_free_deep (GHashTable *hash_table);
/* GPtrArray functions */
-GPtrArray * nautilus_g_ptr_array_new_from_list (GList *list);
-void nautilus_g_ptr_array_sort (GPtrArray *array,
- NautilusCompareFunction compare_callback,
- gpointer callback_data);
-int nautilus_g_ptr_array_search (GPtrArray *array,
- NautilusSearchFunction search_callback,
- gpointer callback_data,
- gboolean match_only);
+GPtrArray * nautilus_g_ptr_array_new_from_list (GList *list);
+void nautilus_g_ptr_array_sort (GPtrArray *array,
+ NautilusCompareFunction compare_callback,
+ gpointer callback_data);
+int nautilus_g_ptr_array_search (GPtrArray *array,
+ NautilusSearchFunction search_callback,
+ gpointer callback_data,
+ gboolean match_only);
/* NULL terminated string arrays (strv). */
-int nautilus_g_strv_find (char **strv,
- const char *find_me);
+int nautilus_g_strv_find (char **strv,
+ const char *find_me);
/* return the time in microseconds since the machine was started */
gint64 nautilus_get_system_time (void);
/* shell */
-char * nautilus_shell_quote (const char *string);
+char * nautilus_shell_quote (const char *string);
#endif /* NAUTILUS_GLIB_EXTENSIONS_H */
diff --git a/libnautilus-private/nautilus-mime-actions.c b/libnautilus-private/nautilus-mime-actions.c
index 983f2da21..375c5e0e1 100644
--- a/libnautilus-private/nautilus-mime-actions.c
+++ b/libnautilus-private/nautilus-mime-actions.c
@@ -119,7 +119,7 @@ nautilus_mime_actions_get_required_file_attributes ()
attributes = NULL;
attributes = g_list_prepend (attributes, NAUTILUS_FILE_ATTRIBUTE_METADATA);
- attributes = g_list_prepend (attributes, NAUTILUS_FILE_ATTRIBUTE_SLOW_MIME_TYPE);
+ attributes = g_list_prepend (attributes, NAUTILUS_FILE_ATTRIBUTE_MIME_TYPE);
attributes = g_list_prepend (attributes, NAUTILUS_FILE_ATTRIBUTE_DIRECTORY_ITEM_MIME_TYPES);
return attributes;
@@ -153,7 +153,7 @@ nautilus_mime_get_default_action_type_for_file (NautilusFile *file)
(file, NAUTILUS_METADATA_KEY_DEFAULT_ACTION_TYPE, NULL);
if (action_type_string == NULL) {
- mime_type = nautilus_file_get_slow_mime_type (file);
+ mime_type = nautilus_file_get_mime_type (file);
action_type = gnome_vfs_mime_get_default_action_type (mime_type);
g_free (mime_type);
return action_type;
@@ -226,7 +226,7 @@ nautilus_mime_get_default_application_for_file_internal (NautilusFile *file
(file, NAUTILUS_METADATA_KEY_DEFAULT_APPLICATION, NULL);
if (default_application_string == NULL) {
- mime_type = nautilus_file_get_slow_mime_type (file);
+ mime_type = nautilus_file_get_mime_type (file);
result = gnome_vfs_mime_get_default_application (mime_type);
g_free (mime_type);
used_user_chosen_info = FALSE;
@@ -295,7 +295,7 @@ nautilus_mime_get_default_component_for_file_internal (NautilusFile *file,
CORBA_exception_init (&ev);
- mime_type = nautilus_file_get_slow_mime_type (file);
+ mime_type = nautilus_file_get_mime_type (file);
uri_scheme = nautilus_file_get_uri_scheme (file);
@@ -462,7 +462,7 @@ nautilus_mime_get_short_list_applications_for_file (NautilusFile *file)
NAUTILUS_METADATA_KEY_SHORT_LIST_APPLICATION_REMOVE,
NAUTILUS_METADATA_SUBKEY_APPLICATION_ID);
- mime_type = nautilus_file_get_slow_mime_type (file);
+ mime_type = nautilus_file_get_mime_type (file);
result = gnome_vfs_mime_get_short_list_applications (mime_type);
g_free (mime_type);
@@ -529,7 +529,7 @@ nautilus_mime_get_short_list_components_for_file (NautilusFile *file)
NAUTILUS_METADATA_KEY_SHORT_LIST_COMPONENT_REMOVE,
NAUTILUS_METADATA_SUBKEY_COMPONENT_IID);
- mime_type = nautilus_file_get_slow_mime_type (file);
+ mime_type = nautilus_file_get_mime_type (file);
servers = gnome_vfs_mime_get_short_list_components (mime_type);
iids = NULL;
@@ -597,7 +597,7 @@ nautilus_mime_get_short_list_methods_for_file (NautilusFile *file)
g_return_val_if_fail (nautilus_mime_actions_check_if_required_attributes_ready (file),
NULL);
- mime_type = nautilus_file_get_slow_mime_type (file);
+ mime_type = nautilus_file_get_mime_type (file);
method = gnome_vfs_mime_get_value (mime_type, "vfs-method");
g_free (mime_type);
return g_strdup (method);
@@ -620,7 +620,7 @@ nautilus_mime_get_all_applications_for_file (NautilusFile *file)
NAUTILUS_METADATA_KEY_EXPLICIT_APPLICATION,
NAUTILUS_METADATA_SUBKEY_APPLICATION_ID);
- mime_type = nautilus_file_get_slow_mime_type (file);
+ mime_type = nautilus_file_get_mime_type (file);
result = gnome_vfs_mime_get_all_applications (mime_type);
@@ -670,7 +670,7 @@ nautilus_mime_get_all_components_for_file (NautilusFile *file)
uri_scheme = nautilus_file_get_uri_scheme (file);
- mime_type = nautilus_file_get_slow_mime_type (file);
+ mime_type = nautilus_file_get_mime_type (file);
explicit_iids = get_explicit_content_view_iids_from_metafile (file);
nautilus_file_get_directory_item_mime_types (file, &item_mime_types);
@@ -774,7 +774,7 @@ nautilus_mime_set_short_list_applications_for_file (NautilusFile *file,
/* get per-mime short list */
- mime_type = nautilus_file_get_slow_mime_type (file);
+ mime_type = nautilus_file_get_mime_type (file);
normal_short_list = gnome_vfs_mime_get_short_list_applications (mime_type);
g_free (mime_type);
@@ -821,7 +821,7 @@ nautilus_mime_set_short_list_components_for_file (NautilusFile *file,
GNOME_VFS_ERROR_GENERIC);
/* get per-mime short list */
- mime_type = nautilus_file_get_slow_mime_type (file);
+ mime_type = nautilus_file_get_mime_type (file);
normal_short_list = gnome_vfs_mime_get_short_list_components (mime_type);
g_free (mime_type);
diff --git a/src/file-manager/fm-directory-view.c b/src/file-manager/fm-directory-view.c
index 53d801d8a..02b7de32f 100644
--- a/src/file-manager/fm-directory-view.c
+++ b/src/file-manager/fm-directory-view.c
@@ -130,6 +130,7 @@ struct FMDirectoryViewDetails
GList *pending_files_changed;
GList *pending_uris_selected;
+ gboolean force_reload;
gboolean loading;
gboolean menus_merged;
gboolean menu_states_untrustworthy;
@@ -143,81 +144,81 @@ struct FMDirectoryViewDetails
/* forward declarations */
-static int display_selection_info_idle_callback (gpointer data);
-static gboolean file_is_launchable (NautilusFile *file);
-static void fm_directory_view_initialize_class (FMDirectoryViewClass *klass);
-static void fm_directory_view_initialize (FMDirectoryView *view);
-static void fm_directory_view_duplicate_selection (FMDirectoryView *view,
- GList *files);
-static void fm_directory_view_create_links_for_files (FMDirectoryView *view,
- GList *files);
-static void fm_directory_view_trash_or_delete_files (FMDirectoryView *view,
- GList *files);
-static void fm_directory_view_destroy (GtkObject *object);
-static void fm_directory_view_activate_file (FMDirectoryView *view,
- NautilusFile *file,
- gboolean use_new_window);
-static void fm_directory_view_create_background_context_menu_items (FMDirectoryView *view,
- GtkMenu *menu);
-static void fm_directory_view_load_uri (FMDirectoryView *view,
- const char *uri);
-static void fm_directory_view_merge_menus (FMDirectoryView *view);
-static void fm_directory_view_real_create_background_context_menu_items (FMDirectoryView *view,
- GtkMenu *menu);
-static void fm_directory_view_real_create_selection_context_menu_items (FMDirectoryView *view,
- GtkMenu *menu,
- GList *files);
-static void fm_directory_view_real_merge_menus (FMDirectoryView *view);
-static void fm_directory_view_real_update_menus (FMDirectoryView *view);
-static gboolean fm_directory_view_real_is_read_only (FMDirectoryView *view);
-static gboolean fm_directory_view_real_supports_creating_files (FMDirectoryView *view);
-static gboolean fm_directory_view_real_accepts_dragged_files (FMDirectoryView *view);
-static gboolean fm_directory_view_real_supports_zooming (FMDirectoryView *view);
-static gboolean fm_directory_view_real_supports_properties (FMDirectoryView *view);
-static GtkMenu * create_selection_context_menu (FMDirectoryView *view);
-static GtkMenu * create_background_context_menu (FMDirectoryView *view);
-static BonoboControl *get_bonobo_control (FMDirectoryView *view);
-static void stop_loading_callback (NautilusView *nautilus_view,
- FMDirectoryView *directory_view);
-static void load_location_callback (NautilusView *nautilus_view,
- const char *location,
- FMDirectoryView *directory_view);
-static void selection_changed_callback (NautilusView *nautilus_view,
- GList *selection,
- FMDirectoryView *directory_view);
-static void open_one_in_new_window (gpointer data,
- gpointer callback_data);
-static void open_one_properties_window (gpointer data,
- gpointer callback_data);
-static void zoomable_set_zoom_level_callback (NautilusZoomable *zoomable,
- double level,
- FMDirectoryView *view);
-static void zoomable_zoom_in_callback (NautilusZoomable *zoomable,
- FMDirectoryView *directory_view);
-static void zoomable_zoom_out_callback (NautilusZoomable *zoomable,
- FMDirectoryView *directory_view);
-static void zoomable_zoom_to_fit_callback (NautilusZoomable *zoomable,
- FMDirectoryView *directory_view);
-static void schedule_update_menus (FMDirectoryView *view);
-static void schedule_update_menus_callback (gpointer callback_data);
-static void schedule_idle_display_of_pending_files (FMDirectoryView *view);
-static void unschedule_idle_display_of_pending_files (FMDirectoryView *view);
-static void schedule_timeout_display_of_pending_files (FMDirectoryView *view);
-static void unschedule_timeout_display_of_pending_files (FMDirectoryView *view);
-static void unschedule_display_of_pending_files (FMDirectoryView *view);
-static void disconnect_model_handlers (FMDirectoryView *view);
-static void filtering_changed_callback (gpointer callback_data);
-static NautilusStringList * real_get_emblem_names_to_exclude (FMDirectoryView *view);
-static void start_renaming_item (FMDirectoryView *view,
- const char *uri);
-static void metadata_ready_callback (NautilusFile *file,
- gpointer callback_data);
-static void fm_directory_view_trash_state_changed_callback (NautilusTrashMonitor *trash,
- gboolean state,
- gpointer callback_data);
-static void fm_directory_view_select_file (FMDirectoryView *view,
- NautilusFile *file);
-
+static int display_selection_info_idle_callback (gpointer data);
+static gboolean file_is_launchable (NautilusFile *file);
+static void fm_directory_view_initialize_class (FMDirectoryViewClass *klass);
+static void fm_directory_view_initialize (FMDirectoryView *view);
+static void fm_directory_view_duplicate_selection (FMDirectoryView *view,
+ GList *files);
+static void fm_directory_view_create_links_for_files (FMDirectoryView *view,
+ GList *files);
+static void fm_directory_view_trash_or_delete_files (FMDirectoryView *view,
+ GList *files);
+static void fm_directory_view_destroy (GtkObject *object);
+static void fm_directory_view_activate_file (FMDirectoryView *view,
+ NautilusFile *file,
+ gboolean use_new_window);
+static void fm_directory_view_create_background_context_menu_items (FMDirectoryView *view,
+ GtkMenu *menu);
+static void load_directory (FMDirectoryView *view,
+ NautilusDirectory *directory,
+ gboolean force_reload);
+static void fm_directory_view_merge_menus (FMDirectoryView *view);
+static void real_create_background_context_menu_items (FMDirectoryView *view,
+ GtkMenu *menu);
+static void real_create_selection_context_menu_items (FMDirectoryView *view,
+ GtkMenu *menu,
+ GList *files);
+static void real_merge_menus (FMDirectoryView *view);
+static void real_update_menus (FMDirectoryView *view);
+static gboolean real_is_read_only (FMDirectoryView *view);
+static gboolean real_supports_creating_files (FMDirectoryView *view);
+static gboolean real_accepts_dragged_files (FMDirectoryView *view);
+static gboolean real_supports_zooming (FMDirectoryView *view);
+static gboolean real_supports_properties (FMDirectoryView *view);
+static GtkMenu * create_selection_context_menu (FMDirectoryView *view);
+static GtkMenu * create_background_context_menu (FMDirectoryView *view);
+static BonoboControl * get_bonobo_control (FMDirectoryView *view);
+static void stop_loading_callback (NautilusView *nautilus_view,
+ FMDirectoryView *directory_view);
+static void load_location_callback (NautilusView *nautilus_view,
+ const char *location,
+ FMDirectoryView *directory_view);
+static void selection_changed_callback (NautilusView *nautilus_view,
+ GList *selection,
+ FMDirectoryView *directory_view);
+static void open_one_in_new_window (gpointer data,
+ gpointer callback_data);
+static void open_one_properties_window (gpointer data,
+ gpointer callback_data);
+static void zoomable_set_zoom_level_callback (NautilusZoomable *zoomable,
+ double level,
+ FMDirectoryView *view);
+static void zoomable_zoom_in_callback (NautilusZoomable *zoomable,
+ FMDirectoryView *directory_view);
+static void zoomable_zoom_out_callback (NautilusZoomable *zoomable,
+ FMDirectoryView *directory_view);
+static void zoomable_zoom_to_fit_callback (NautilusZoomable *zoomable,
+ FMDirectoryView *directory_view);
+static void schedule_update_menus (FMDirectoryView *view);
+static void schedule_update_menus_callback (gpointer callback_data);
+static void schedule_idle_display_of_pending_files (FMDirectoryView *view);
+static void unschedule_idle_display_of_pending_files (FMDirectoryView *view);
+static void schedule_timeout_display_of_pending_files (FMDirectoryView *view);
+static void unschedule_timeout_display_of_pending_files (FMDirectoryView *view);
+static void unschedule_display_of_pending_files (FMDirectoryView *view);
+static void disconnect_model_handlers (FMDirectoryView *view);
+static void filtering_changed_callback (gpointer callback_data);
+static NautilusStringList *real_get_emblem_names_to_exclude (FMDirectoryView *view);
+static void start_renaming_item (FMDirectoryView *view,
+ const char *uri);
+static void metadata_ready_callback (NautilusFile *file,
+ gpointer callback_data);
+static void fm_directory_view_trash_state_changed_callback (NautilusTrashMonitor *trash,
+ gboolean state,
+ gpointer callback_data);
+static void fm_directory_view_select_file (FMDirectoryView *view,
+ NautilusFile *file);
NAUTILUS_DEFINE_CLASS_BOILERPLATE (FMDirectoryView, fm_directory_view, GTK_TYPE_SCROLLED_WINDOW)
NAUTILUS_IMPLEMENT_MUST_OVERRIDE_SIGNAL (fm_directory_view, add_file)
@@ -300,17 +301,17 @@ fm_directory_view_initialize_class (FMDirectoryViewClass *klass)
gtk_marshal_NONE__BOXED,
GTK_TYPE_NONE, 1, GTK_TYPE_BOXED);
- klass->create_selection_context_menu_items = fm_directory_view_real_create_selection_context_menu_items;
- klass->create_background_context_menu_items = fm_directory_view_real_create_background_context_menu_items;
- klass->merge_menus = fm_directory_view_real_merge_menus;
- klass->update_menus = fm_directory_view_real_update_menus;
+ klass->create_selection_context_menu_items = real_create_selection_context_menu_items;
+ klass->create_background_context_menu_items = real_create_background_context_menu_items;
+ klass->merge_menus = real_merge_menus;
+ klass->update_menus = real_update_menus;
klass->get_emblem_names_to_exclude = real_get_emblem_names_to_exclude;
klass->start_renaming_item = start_renaming_item;
- klass->is_read_only = fm_directory_view_real_is_read_only;
- klass->supports_creating_files = fm_directory_view_real_supports_creating_files;
- klass->accepts_dragged_files = fm_directory_view_real_accepts_dragged_files;
- klass->supports_zooming = fm_directory_view_real_supports_zooming;
- klass->supports_properties = fm_directory_view_real_supports_properties;
+ klass->is_read_only = real_is_read_only;
+ klass->supports_creating_files = real_supports_creating_files;
+ klass->accepts_dragged_files = real_accepts_dragged_files;
+ klass->supports_zooming = real_supports_zooming;
+ klass->supports_properties = real_supports_properties;
klass->reveal_selection = NULL;
/* Function pointers that subclasses must override */
@@ -1297,7 +1298,16 @@ load_location_callback (NautilusView *nautilus_view,
const char *location,
FMDirectoryView *directory_view)
{
- fm_directory_view_load_uri (directory_view, location);
+ NautilusDirectory *directory;
+ gboolean force_reload;
+
+ directory = nautilus_directory_get (location);
+ /* An additional load of the same directory is how the
+ * framework tells us to reload.
+ */
+ force_reload = directory == directory_view->details->model;
+ load_directory (directory_view, directory, force_reload);
+ nautilus_directory_unref (directory);
}
static GList *
@@ -2992,7 +3002,7 @@ create_background_context_menu_zoom_items (FMDirectoryView *view,
}
static void
-fm_directory_view_real_create_background_context_menu_items (FMDirectoryView *view,
+real_create_background_context_menu_items (FMDirectoryView *view,
GtkMenu *menu)
{
@@ -3167,7 +3177,7 @@ create_open_with_gtk_menu (FMDirectoryView *view, GList *files)
}
static void
-fm_directory_view_real_create_selection_context_menu_items (FMDirectoryView *view,
+real_create_selection_context_menu_items (FMDirectoryView *view,
GtkMenu *menu,
GList *files)
{
@@ -3236,7 +3246,7 @@ bonobo_open_location_with_viewer_callback (BonoboUIComponent *component, gpointe
{
ViewerLaunchParameters *launch_parameters;
- launch_parameters = (ViewerLaunchParameters *)callback_data;
+ launch_parameters = (ViewerLaunchParameters *) callback_data;
switch_location_and_view (launch_parameters->identifier,
launch_parameters->uri,
@@ -3245,11 +3255,11 @@ bonobo_open_location_with_viewer_callback (BonoboUIComponent *component, gpointe
static void
add_open_with_app_bonobo_menu_item (BonoboUIComponent *ui,
- const char *label,
- int index,
- gpointer callback,
- gpointer callback_data,
- GDestroyNotify destroy_notify)
+ const char *label,
+ int index,
+ gpointer callback,
+ gpointer callback_data,
+ GDestroyNotify destroy_notify)
{
char *escaped_label, *verb_name;
char *item_id;
@@ -3271,11 +3281,11 @@ add_open_with_app_bonobo_menu_item (BonoboUIComponent *ui,
static void
add_open_with_viewer_bonobo_menu_item (BonoboUIComponent *ui,
- const char *label,
- int index,
- gpointer callback,
- gpointer callback_data,
- GDestroyNotify destroy_notify)
+ const char *label,
+ int index,
+ gpointer callback,
+ gpointer callback_data,
+ GDestroyNotify destroy_notify)
{
char *escaped_label, *verb_name, *item_id;
@@ -3306,11 +3316,11 @@ add_application_to_bonobo_menu (FMDirectoryView *directory_view,
(application, uri, directory_view);
add_open_with_app_bonobo_menu_item (directory_view->details->ui,
- application->name,
- index,
- bonobo_launch_application_callback,
- launch_parameters,
- (GDestroyNotify) application_launch_parameters_free);
+ application->name,
+ index,
+ bonobo_launch_application_callback,
+ launch_parameters,
+ (GDestroyNotify) application_launch_parameters_free);
}
static void
@@ -3331,11 +3341,11 @@ add_component_to_bonobo_menu (FMDirectoryView *directory_view,
launch_parameters->identifier->name);
add_open_with_viewer_bonobo_menu_item (directory_view->details->ui,
- label,
- index,
- bonobo_open_location_with_viewer_callback,
- launch_parameters,
- (GDestroyNotify) viewer_launch_parameters_free);
+ label,
+ index,
+ bonobo_open_location_with_viewer_callback,
+ launch_parameters,
+ (GDestroyNotify) viewer_launch_parameters_free);
g_free (label);
}
@@ -3348,11 +3358,12 @@ update_one_menu_item (FMDirectoryView *view,
{
char *label_string;
gboolean sensitive;
+
compute_menu_item_info (view, menu_path, selection, TRUE, &label_string, &sensitive);
nautilus_bonobo_set_sensitive (view->details->ui, verb_path, sensitive);
-
nautilus_bonobo_set_label (view->details->ui, menu_path, label_string);
+
g_free (label_string);
}
@@ -3372,9 +3383,9 @@ reset_bonobo_trash_delete_menu (FMDirectoryView *view, GList *selection)
_("Move all selected items to the Trash"));
nautilus_bonobo_set_accelerator (view->details->ui,
FM_DIRECTORY_VIEW_MENU_PATH_TRASH,
- "*Control*t");
+ _("*Control*t"));
}
-
+
update_one_menu_item (view, selection,
FM_DIRECTORY_VIEW_MENU_PATH_TRASH,
FM_DIRECTORY_VIEW_COMMAND_TRASH);
@@ -3397,23 +3408,19 @@ reset_bonobo_open_with_menu (FMDirectoryView *view, GList *selection)
/* This menu is only displayed when there's one selected item. */
if (nautilus_g_list_exactly_one_item (selection)) {
uri = nautilus_file_get_uri (NAUTILUS_FILE (selection->data));
-
+
nautilus_mime_actions_wait_for_required_file_attributes (NAUTILUS_FILE (selection->data));
-
+
applications = nautilus_mime_get_short_list_applications_for_file (NAUTILUS_FILE (selection->data));
-
for (node = applications, index = 0; node != NULL; node = node->next, index++) {
add_application_to_bonobo_menu (view, node->data, uri, index);
}
-
gnome_vfs_mime_application_list_free (applications);
-
+
components = nautilus_mime_get_short_list_components_for_file (NAUTILUS_FILE (selection->data));
-
for (node = components, index = 0; node != NULL; node = node->next, index++) {
add_component_to_bonobo_menu (view, node->data, uri, index);
}
-
gnome_vfs_mime_component_list_free (components);
g_free (uri);
@@ -3425,7 +3432,7 @@ reset_bonobo_open_with_menu (FMDirectoryView *view, GList *selection)
}
static void
-fm_directory_view_real_merge_menus (FMDirectoryView *view)
+real_merge_menus (FMDirectoryView *view)
{
BonoboUIVerb verbs [] = {
@@ -3462,7 +3469,7 @@ fm_directory_view_real_merge_menus (FMDirectoryView *view)
}
static void
-fm_directory_view_real_update_menus (FMDirectoryView *view)
+real_update_menus (FMDirectoryView *view)
{
GList *selection;
@@ -3479,7 +3486,6 @@ fm_directory_view_real_update_menus (FMDirectoryView *view)
FM_DIRECTORY_VIEW_COMMAND_OPEN_IN_NEW_WINDOW);
reset_bonobo_open_with_menu (view, selection);
-
reset_bonobo_trash_delete_menu (view, selection);
update_one_menu_item (view, selection,
@@ -3901,7 +3907,7 @@ fm_directory_view_activate_files (FMDirectoryView *view,
}
/**
- * fm_directory_view_load_uri:
+ * load_directory:
*
* Switch the displayed location to a new uri. If the uri is not valid,
* the location will not be switched; user feedback will be provided instead.
@@ -3910,15 +3916,16 @@ fm_directory_view_activate_files (FMDirectoryView *view,
*
**/
static void
-fm_directory_view_load_uri (FMDirectoryView *view,
- const char *uri)
+load_directory (FMDirectoryView *view,
+ NautilusDirectory *directory,
+ gboolean force_reload)
{
- NautilusDirectory *old_model;
+ NautilusDirectory *old_directory;
NautilusFile *old_file;
GList *attributes;
- g_return_if_fail (FM_IS_DIRECTORY_VIEW (view));
- g_return_if_fail (uri != NULL);
+ g_assert (FM_IS_DIRECTORY_VIEW (view));
+ g_assert (NAUTILUS_IS_DIRECTORY (directory));
fm_directory_view_stop (view);
fm_directory_view_clear (view);
@@ -3931,25 +3938,27 @@ fm_directory_view_load_uri (FMDirectoryView *view,
disconnect_model_handlers (view);
- old_model = view->details->model;
- view->details->model = nautilus_directory_get (uri);
- nautilus_directory_unref (old_model);
+ old_directory = view->details->model;
+ nautilus_directory_ref (directory);
+ view->details->model = directory;
+ nautilus_directory_unref (old_directory);
old_file = view->details->directory_as_file;
- view->details->directory_as_file = nautilus_directory_get_corresponding_file
- (fm_directory_view_get_model (view));
+ view->details->directory_as_file =
+ nautilus_directory_get_corresponding_file (directory);
nautilus_file_unref (old_file);
- attributes = g_list_append (NULL, NAUTILUS_FILE_ATTRIBUTE_METADATA);
-
- /* FIXME: we also need to monitor here, in case external
- forces change the directory's file metadata */
+ view->details->force_reload = force_reload;
+ /* FIXME: In theory, we also need to monitor here (as well as
+ * doing a call when ready), in case external forces change
+ * the directory's file metadata.
+ */
+ attributes = g_list_append (NULL, NAUTILUS_FILE_ATTRIBUTE_METADATA);
nautilus_file_call_when_ready
(view->details->directory_as_file,
attributes,
metadata_ready_callback, view);
-
g_list_free (attributes);
}
@@ -3970,6 +3979,18 @@ finish_loading_uri (FMDirectoryView *view)
/* Start loading. */
+ /* Connect handlers to see files as they are added. */
+ view->details->files_added_handler_id = gtk_signal_connect
+ (GTK_OBJECT (view->details->model),
+ "files_added",
+ files_added_callback,
+ view);
+ view->details->files_changed_handler_id = gtk_signal_connect
+ (GTK_OBJECT (view->details->model),
+ "files_changed",
+ files_changed_callback,
+ view);
+
/* Monitor the things needed to get the right
* icon. Also monitor a directory's item count because
* the "size" attribute is based on that, and the file's metadata.
@@ -3982,25 +4003,13 @@ finish_loading_uri (FMDirectoryView *view)
attributes = g_list_prepend (attributes,
NAUTILUS_FILE_ATTRIBUTE_MIME_TYPE);
- nautilus_directory_file_monitor_add (view->details->model, view,
- attributes, TRUE);
- g_list_free (attributes);
+ nautilus_directory_file_monitor_add (view->details->model,
+ view,
+ attributes,
+ view->details->force_reload);
+ view->details->force_reload = FALSE;
- /* Attach a handler to get any further files that show up as we
- * load and sychronize. We won't miss any files because this
- * signal is emitted from an idle routine and so we will be
- * connected before the next time it is emitted.
- */
- view->details->files_added_handler_id = gtk_signal_connect
- (GTK_OBJECT (view->details->model),
- "files_added",
- files_added_callback,
- view);
- view->details->files_changed_handler_id = gtk_signal_connect
- (GTK_OBJECT (view->details->model),
- "files_changed",
- files_changed_callback,
- view);
+ g_list_free (attributes);
}
static void
@@ -4176,7 +4185,7 @@ fm_directory_view_is_empty (FMDirectoryView *view)
}
static gboolean
-fm_directory_view_real_is_read_only (FMDirectoryView *view)
+real_is_read_only (FMDirectoryView *view)
{
return !nautilus_file_can_write (fm_directory_view_get_directory_as_file (view));
}
@@ -4208,7 +4217,7 @@ showing_trash_directory (FMDirectoryView *view)
}
static gboolean
-fm_directory_view_real_supports_creating_files (FMDirectoryView *view)
+real_supports_creating_files (FMDirectoryView *view)
{
g_return_val_if_fail (FM_IS_DIRECTORY_VIEW (view), FALSE);
@@ -4216,7 +4225,7 @@ fm_directory_view_real_supports_creating_files (FMDirectoryView *view)
}
static gboolean
-fm_directory_view_real_accepts_dragged_files (FMDirectoryView *view)
+real_accepts_dragged_files (FMDirectoryView *view)
{
g_return_val_if_fail (FM_IS_DIRECTORY_VIEW (view), FALSE);
@@ -4234,7 +4243,7 @@ fm_directory_view_supports_properties (FMDirectoryView *view)
}
static gboolean
-fm_directory_view_real_supports_properties (FMDirectoryView *view)
+real_supports_properties (FMDirectoryView *view)
{
g_return_val_if_fail (FM_IS_DIRECTORY_VIEW (view), FALSE);
@@ -4252,7 +4261,7 @@ fm_directory_view_supports_zooming (FMDirectoryView *view)
}
static gboolean
-fm_directory_view_real_supports_zooming (FMDirectoryView *view)
+real_supports_zooming (FMDirectoryView *view)
{
g_return_val_if_fail (FM_IS_DIRECTORY_VIEW (view), FALSE);
@@ -4287,7 +4296,6 @@ static void
filtering_changed_callback (gpointer callback_data)
{
FMDirectoryView *directory_view;
- char *same_uri;
directory_view = FM_DIRECTORY_VIEW (callback_data);
@@ -4306,10 +4314,9 @@ filtering_changed_callback (gpointer callback_data)
/* Reload the current uri so that the filtering changes take place. */
if (directory_view->details->model != NULL) {
- same_uri = nautilus_directory_get_uri (directory_view->details->model);
- g_assert (same_uri != NULL);
- fm_directory_view_load_uri (directory_view, same_uri);
- g_free (same_uri);
+ load_directory (directory_view,
+ directory_view->details->model,
+ FALSE);
}
}
diff --git a/src/nautilus-applicable-views.c b/src/nautilus-applicable-views.c
index fb1606fc0..1dd49e557 100644
--- a/src/nautilus-applicable-views.c
+++ b/src/nautilus-applicable-views.c
@@ -55,6 +55,7 @@ struct NautilusNavigationInfo {
NautilusNavigationCallback callback;
gpointer callback_data;
NautilusFile *file;
+ NautilusDirectory *directory;
NautilusViewIdentifier *initial_content_id;
GnomeVFSAsyncHandle *handle;
};
@@ -184,15 +185,21 @@ nautilus_navigation_info_new (const char *location,
info->callback_data = notify_data;
info->file = nautilus_file_get (location);
-
+ info->directory = nautilus_directory_get (location);
+
+ /* We start monitoring files here so we get a single load of
+ * the directory instead of multiple ones. The concept is that
+ * our load of the directory is shared both with the
+ * call_when_ready below and with other stuff needed by
+ * components.
+ */
+ nautilus_directory_file_monitor_add (info->directory, info,
+ NULL, FALSE);
+
/* Arrange for all the file attributes we will need. */
attributes = nautilus_mime_actions_get_required_file_attributes ();
-
- nautilus_file_call_when_ready
- (info->file,
- attributes,
- got_file_info_callback, info);
-
+ nautilus_file_call_when_ready (info->file, attributes,
+ got_file_info_callback, info);
g_list_free (attributes);
return info;
@@ -209,9 +216,10 @@ nautilus_navigation_info_cancel (NautilusNavigationInfo *info)
}
nautilus_file_cancel_call_when_ready
- (info->file,
- got_file_info_callback,
- info);
+ (info->file, got_file_info_callback, info);
+
+ nautilus_directory_file_monitor_remove
+ (info->directory, info);
}
void
@@ -222,6 +230,7 @@ nautilus_navigation_info_free (NautilusNavigationInfo *info)
nautilus_navigation_info_cancel (info);
nautilus_file_unref (info->file);
+ nautilus_directory_unref (info->directory);
nautilus_view_identifier_free (info->initial_content_id);
g_free (info);
diff --git a/src/nautilus-main.c b/src/nautilus-main.c
index 686d33608..dfdfb54d2 100644
--- a/src/nautilus-main.c
+++ b/src/nautilus-main.c
@@ -177,8 +177,8 @@ main (int argc, char *argv[])
bindtextdomain (PACKAGE, GNOMELOCALEDIR);
textdomain (PACKAGE);
#endif
- /* disable bug-buddy */
- putenv("GNOME_DISABLE_CRASH_DIALOG=1");
+ /* Disable bug-buddy for now. */
+ nautilus_setenv ("GNOME_DISABLE_CRASH_DIALOG", "1", TRUE);
/* Get parameters. */
kill_shell = FALSE;
diff --git a/src/nautilus-view-frame.c b/src/nautilus-view-frame.c
index 13a6d2ec8..4c18076cc 100644
--- a/src/nautilus-view-frame.c
+++ b/src/nautilus-view-frame.c
@@ -30,7 +30,6 @@
#include <config.h>
#include "nautilus-view-frame-private.h"
-
#include "nautilus-application.h"
#include "nautilus-component-adapter-factory.h"
#include "nautilus-history-frame.h"
@@ -256,11 +255,9 @@ nautilus_view_frame_destroy (GtkObject *object)
nautilus_view_frame_destroy_client (frame);
- bonobo_object_unref (BONOBO_OBJECT (frame->details->ui_container));
g_free (frame->details->title);
g_free (frame->details->label);
g_free (frame->details);
- frame->details = NULL;
NAUTILUS_CALL_PARENT_CLASS (GTK_OBJECT_CLASS, destroy, (object));
}
diff --git a/src/nautilus-window-manage-views.c b/src/nautilus-window-manage-views.c
index 2fd23765f..dc0fcfa19 100644
--- a/src/nautilus-window-manage-views.c
+++ b/src/nautilus-window-manage-views.c
@@ -54,7 +54,6 @@
#include <libnautilus-extensions/nautilus-search-uri.h>
#include <libnautilus-extensions/nautilus-stock-dialogs.h>
#include <libnautilus-extensions/nautilus-string.h>
-#include <stdarg.h>
/* FIXME bugzilla.eazel.com 1243:
* We should use inheritance instead of these special cases
@@ -62,37 +61,26 @@
*/
#include "nautilus-desktop-window.h"
-/*#define EXTREME_DEBUGGING*/
-
-#ifdef EXTREME_DEBUGGING
-#define x_message(parameters) g_message parameters
-#else
-#define x_message(parameters)
-#endif
-
-/* This number controls a maximum character count for a Nautilus window title
- * (not counting the prefix 'Nautilus:')
- *
- * Without limiting the window title, the window manager makes the window wide
- * enough to able to display the whole title. When this happens, the Nautilus
- * window in question becomes unusable.
- *
- * This is a very common thing to happen, especially with generated web content,
- * such as bugzilla queries, which generate very long urls.
- *
- * I found the number experimentally. To properly compute it, we would need
- * window manager support to access the character metrics for the window title.
+/* This number controls a maximum character count for a Nautilus
+ * window title. Without limiting the window title, most window
+ * managers make the window wide enough to able to display the whole
+ * title. When this happens, the Nautilus window in question becomes
+ * unusable. This is a very common thing to happen, especially with
+ * generated web content, such as bugzilla queries, which generate
+ * very long urls. I found the number experimentally. To properly
+ * compute it, we would need window manager support to access the
+ * character metrics for the window title.
*/
#define MAX_TITLE_LENGTH 180
-/* This number controls a maximum character count for a URL that is displayed
- * as part of a dialog. It's fairly arbitrary -- big enough to allow most
- * "normal" URIs to display in full, but small enough to prevent the dialog
- * from getting insanely wide.
+/* This number controls a maximum character count for a URL that is
+ * displayed as part of a dialog. It's fairly arbitrary -- big enough
+ * to allow most "normal" URIs to display in full, but small enough to
+ * prevent the dialog from getting insanely wide.
*/
#define MAX_URI_IN_DIALOG_LENGTH 60
-static void nautilus_window_set_state_info (NautilusWindow *window, ...);
+static void connect_view (NautilusWindow *window, NautilusViewFrame *view);
static void
change_selection (NautilusWindow *window,
@@ -249,7 +237,7 @@ update_title (NautilusWindow *window)
}
}
-/* nautilus_window_set_displayed_location:
+/* set_displayed_location:
*
* Update the non-NautilusViewFrame objects that use the location's user-displayable
* title in some way. Called when the location or title has changed.
@@ -257,7 +245,7 @@ update_title (NautilusWindow *window)
* @title: The new user-displayable title.
*/
static void
-nautilus_window_set_displayed_location (NautilusWindow *window, const char *uri)
+set_displayed_location (NautilusWindow *window, const char *uri)
{
char *bookmark_uri;
gboolean recreate;
@@ -384,7 +372,7 @@ handle_go_elsewhere (NautilusWindow *window, const char *location)
if (window->location != NULL) {
/* If we're returning to the same uri somehow, don't put this uri on back list.
- * This also avoids a problem where nautilus_window_set_displayed_location
+ * This also avoids a problem where set_displayed_location
* didn't update last_location_bookmark since the uri didn't change.
*/
if (!nautilus_uris_match (window->location, location)) {
@@ -431,7 +419,7 @@ viewed_file_changed_callback (NautilusWindow *window)
/* Handle the changes for the NautilusWindow itself. */
static void
-nautilus_window_update_for_new_location (NautilusWindow *window)
+update_for_new_location (NautilusWindow *window)
{
char *new_location;
@@ -506,18 +494,9 @@ update_view (NautilusViewFrame *view,
nautilus_view_frame_selection_changed (view, new_selection);
}
-void
-nautilus_window_view_failed (NautilusWindow *window, NautilusViewFrame *view)
-{
- nautilus_window_set_state_info
- (window,
- (NautilusWindowStateItem) VIEW_ERROR, view,
- (NautilusWindowStateItem) 0);
-}
-
/* This is called when we have decided we can actually change to the new view/location situation. */
static void
-nautilus_window_has_really_changed (NautilusWindow *window)
+location_has_really_changed (NautilusWindow *window)
{
/* Switch to the new content view. */
if (window->new_content_view != NULL) {
@@ -541,7 +520,7 @@ nautilus_window_has_really_changed (NautilusWindow *window)
/* Tell the window we are finished. */
if (window->pending_ni != NULL) {
- nautilus_window_update_for_new_location (window);
+ update_for_new_location (window);
nautilus_navigation_info_free (window->pending_ni);
if (window->pending_ni == window->cancel_tag) {
window->cancel_tag = NULL;
@@ -556,8 +535,6 @@ nautilus_window_has_really_changed (NautilusWindow *window)
static void
nautilus_window_free_load_info (NautilusWindow *window)
{
- x_message (("-> FREE_LOAD_INFO <-"));
-
if (window->pending_ni != NULL) {
nautilus_navigation_info_free (window->pending_ni);
window->pending_ni = NULL;
@@ -726,7 +703,7 @@ load_content_view (NautilusWindow *window,
new_view = nautilus_view_frame_new (window->details->ui_container,
window->application->undo_manager);
- nautilus_window_connect_view (window, new_view);
+ connect_view (window, new_view);
if (!nautilus_view_frame_load_client (new_view, iid)) {
gtk_widget_unref (GTK_WIDGET(new_view));
new_view = NULL;
@@ -818,7 +795,7 @@ cancel_location_change (NautilusWindow *window)
}
if (window->pending_ni != NULL) {
- nautilus_window_set_displayed_location
+ set_displayed_location
(window, window->location == NULL ? "" : window->location);
/* Tell previously-notified views to go back to the old page */
@@ -866,9 +843,7 @@ set_view_location_and_selection (NautilusWindow *window)
selection = window->selection;
}
- nautilus_window_set_displayed_location (window, location);
-
- x_message (("!!! Sending update_view"));
+ set_displayed_location (window, location);
if (window->new_content_view != NULL) {
update_view (window->new_content_view, location, selection);
@@ -888,7 +863,7 @@ set_view_location_and_selection (NautilusWindow *window)
}
static gboolean
-nautilus_window_update_state (gpointer data)
+update_state (gpointer data)
{
NautilusWindow *window;
GList *p;
@@ -897,25 +872,12 @@ nautilus_window_update_state (gpointer data)
window = data;
if (window->making_changes) {
- x_message (("In the middle of making changes %d - RETURNING",
- window->making_changes));
return FALSE;
}
made_changes = FALSE;
window->making_changes++;
-#ifdef EXTREME_DEBUGGING
- g_message (">>> nautilus_window_update_state:");
- g_print ("making_changes %d\n", window->making_changes);
- g_print ("location_change_type %d, views_shown %d, view_bombed_out %d, view_activation_complete %d\n",
- window->location_change_type, window->views_shown,
- window->view_bombed_out, window->view_activation_complete);
- g_print ("sent_update_view %d, cv_progress_initial %d, cv_progress_done %d, cv_progress_error %d, reset_to_idle %d\n",
- window->sent_update_view, window->cv_progress_initial, window->cv_progress_done, window->cv_progress_error,
- window->reset_to_idle);
-#endif
-
/* Now make any needed state changes based on available information */
if (window->view_bombed_out) {
@@ -942,8 +904,6 @@ nautilus_window_update_state (gpointer data)
}
if (window->reset_to_idle) {
- x_message (("Reset to idle!"));
-
window->reset_to_idle = FALSE;
cancel_location_change (window);
@@ -951,8 +911,6 @@ nautilus_window_update_state (gpointer data)
made_changes = TRUE;
}
- x_message (("Changes pending"));
-
if (window->pending_ni != NULL
&& window->new_content_view == NULL
&& !window->cv_progress_error
@@ -978,7 +936,7 @@ nautilus_window_update_state (gpointer data)
&& window->cv_progress_initial
&& !window->views_shown) {
- nautilus_window_has_really_changed (window);
+ location_has_really_changed (window);
window->views_shown = TRUE;
made_changes = TRUE;
@@ -992,98 +950,83 @@ nautilus_window_update_state (gpointer data)
window->making_changes--;
- x_message(("update_state done (making_changes is %d) <<<",
- window->making_changes));
-
return made_changes;
}
+typedef enum {
+ INITIAL_VIEW_SELECTED,
+ LOAD_DONE,
+ LOAD_UNDERWAY,
+ NEW_CONTENT_VIEW_READY,
+ STOP,
+ VIEW_FAILED,
+} Stimulus;
+
static void
-nautilus_window_set_state_info (NautilusWindow *window, ...)
+change_state (NautilusWindow *window,
+ Stimulus stimulus,
+ NautilusNavigationInfo *info,
+ NautilusViewFrame *new_view)
{
- va_list args;
- NautilusWindowStateItem item_type;
- NautilusViewFrame *new_view;
-
/* Ensure that changes happen in-order */
- while (nautilus_window_update_state (window)) {
- }
-
- va_start (args, window);
+ while (update_state (window)) { }
- while ((item_type = va_arg (args, NautilusWindowStateItem)) != 0) {
- switch (item_type) {
- case NAVINFO_RECEIVED: /* The information needed for a location change to continue has been received */
- x_message (("NAVINFO_RECEIVED"));
- window->pending_ni = va_arg(args, NautilusNavigationInfo *);
- window->cancel_tag = NULL;
- break;
-
- case VIEW_ERROR:
- new_view = va_arg (args, NautilusViewFrame*);
- x_message (("VIEW_ERROR on %p", new_view));
- g_warning ("A view failed. The UI will handle this with a dialog but this should be debugged.");
- window->view_bombed_out = TRUE;
- /* Get label now, since view frame may be destroyed later. */
- /* FIXME: We're only saving the name of the first error_view
- * here. The rest of this code is structured to handle multiple
- * error_views. I didn't go to the extra effort of saving a
- * name with teach error_view since (A) we only see one at a
- * time in practice, and (B) all this code is likely to be
- * rewritten soon.
- */
- if (window->details->dead_view_name == NULL) {
- window->details->dead_view_name = nautilus_view_frame_get_label (new_view);
- }
- gtk_object_ref (GTK_OBJECT (new_view));
- window->error_views = g_list_prepend (window->error_views, new_view);
- break;
-
- case NEW_CONTENT_VIEW_ACTIVATED:
- x_message (("NEW_CONTENT_VIEW_ACTIVATED"));
- g_return_if_fail (window->new_content_view == NULL);
- new_view = va_arg (args, NautilusViewFrame*);
- /* Don't ref here, reference is held by widget hierarchy. */
- window->new_content_view = new_view;
- /* We only come here in cases where the location does not change,
- * so the sidebar panels don't change either.
- */
- if (window->pending_ni == NULL) {
- window->view_activation_complete = TRUE;
- }
- window->views_shown = FALSE;
- break;
-
- case CV_PROGRESS_INITIAL: /* We have received an "I am loading" indication from the content view */
- x_message (("CV_PROGRESS_INITIAL"));
- window->cv_progress_initial = TRUE;
- break;
-
- case CV_PROGRESS_ERROR: /* We have received a load error from the content view */
- x_message (("CV_PROGRESS_ERROR"));
- window->cv_progress_error = TRUE;
- break;
-
- case CV_PROGRESS_DONE: /* The content view is done loading */
- x_message (("CV_PROGRESS_DONE"));
- window->cv_progress_initial = TRUE;
- window->cv_progress_done = TRUE;
- break;
-
- case RESET_TO_IDLE: /* Someone pressed the stop button or something */
- x_message (("RESET_TO_IDLE"));
- window->reset_to_idle = TRUE;
- break;
-
- default:
- break;
+ switch (stimulus) {
+ case INITIAL_VIEW_SELECTED: /* The information needed for a location change to continue has been received */
+ window->pending_ni = info;
+ window->cancel_tag = NULL;
+ break;
+
+ case VIEW_FAILED:
+ g_warning ("A view failed. The UI will handle this with a dialog but this should be debugged.");
+ window->view_bombed_out = TRUE;
+ /* Get label now, since view frame may be destroyed later. */
+ /* FIXME: We're only saving the name of the first error_view
+ * here. The rest of this code is structured to handle multiple
+ * error_views. I didn't go to the extra effort of saving a
+ * name with teach error_view since (A) we only see one at a
+ * time in practice, and (B) all this code is likely to be
+ * rewritten soon.
+ */
+ if (window->details->dead_view_name == NULL) {
+ window->details->dead_view_name = nautilus_view_frame_get_label (new_view);
+ }
+ gtk_object_ref (GTK_OBJECT (new_view));
+ window->error_views = g_list_prepend (window->error_views, new_view);
+ break;
+
+ case NEW_CONTENT_VIEW_READY:
+ g_return_if_fail (window->new_content_view == NULL);
+ /* Don't ref here, reference is held by widget hierarchy. */
+ window->new_content_view = new_view;
+ /* We only come here in cases where the location does not change,
+ * so the sidebar panels don't change either.
+ */
+ if (window->pending_ni == NULL) {
+ window->view_activation_complete = TRUE;
}
+ window->views_shown = FALSE;
+ break;
+
+ case LOAD_UNDERWAY: /* We have received an "I am loading" indication from the content view */
+ window->cv_progress_initial = TRUE;
+ break;
+
+ case LOAD_DONE: /* The content view is done loading */
+ window->cv_progress_initial = TRUE;
+ window->cv_progress_done = TRUE;
+ break;
+
+ case STOP: /* Someone pressed the stop button or something */
+ window->reset_to_idle = TRUE;
+ break;
+
+ default:
+ g_assert_not_reached ();
+ break;
}
- va_end (args);
-
- while (nautilus_window_update_state (window)) {
- }
+ while (update_state (window)) { }
}
static void
@@ -1159,10 +1102,7 @@ nautilus_window_end_location_change_callback (NautilusNavigationResult result_co
g_free (location);
}
- nautilus_window_set_state_info
- (window,
- (NautilusWindowStateItem) NAVINFO_RECEIVED, navigation_info,
- (NautilusWindowStateItem) 0);
+ change_state (window, INITIAL_VIEW_SELECTED, navigation_info, NULL);
return;
}
@@ -1337,10 +1277,7 @@ nautilus_window_begin_location_change (NautilusWindow *window,
|| type == NAUTILUS_LOCATION_CHANGE_FORWARD
|| distance == 0);
- nautilus_window_set_state_info
- (window,
- (NautilusWindowStateItem) RESET_TO_IDLE,
- (NautilusWindowStateItem) 0);
+ change_state (window, STOP, NULL, NULL);
window->location_change_type = type;
window->location_change_distance = distance;
@@ -1384,7 +1321,7 @@ nautilus_window_stop_loading (NautilusWindow *window)
stop_loading (window->content_view);
stop_loading (window->new_content_view);
g_list_foreach (window->sidebar_panels, stop_loading_cover, NULL);
- nautilus_window_set_state_info (window, RESET_TO_IDLE, 0);
+ change_state (window, STOP, NULL, NULL);
}
void
@@ -1405,10 +1342,7 @@ nautilus_window_set_content_view (NautilusWindow *window, NautilusViewIdentifier
nautilus_window_allow_stop (window, TRUE);
view = load_content_view (window, id);
- nautilus_window_set_state_info
- (window,
- (NautilusWindowStateItem) NEW_CONTENT_VIEW_ACTIVATED, view,
- (NautilusWindowStateItem) 0);
+ change_state (window, NEW_CONTENT_VIEW_READY, NULL, view);
}
static int
@@ -1468,7 +1402,7 @@ nautilus_window_set_sidebar_panels (NautilusWindow *window,
sidebar_panel = nautilus_view_frame_new (window->details->ui_container,
window->application->undo_manager);
nautilus_view_frame_set_label (sidebar_panel, identifier->name);
- nautilus_window_connect_view (window, sidebar_panel);
+ connect_view (window, sidebar_panel);
load_succeeded = nautilus_view_frame_load_client (sidebar_panel, identifier->iid);
/* If the load failed, tell the user. */
@@ -1590,7 +1524,7 @@ failed_callback (NautilusViewFrame *view,
{
g_assert (NAUTILUS_IS_WINDOW (window));
- nautilus_window_view_failed (window, view);
+ change_state (window, VIEW_FAILED, NULL, view);
}
static void
@@ -1603,10 +1537,7 @@ load_underway_callback (NautilusViewFrame *view,
/* FIXME bugzilla.eazel.com 2461: Is progress from either old or new really equally interesting? */
if (view == window->new_content_view
|| view == window->content_view) {
- nautilus_window_set_state_info
- (window,
- (NautilusWindowStateItem) CV_PROGRESS_INITIAL,
- (NautilusWindowStateItem) 0);
+ change_state (window, LOAD_UNDERWAY, NULL, NULL);
}
}
@@ -1620,10 +1551,7 @@ load_complete_callback (NautilusViewFrame *view,
/* FIXME bugzilla.eazel.com 2461: Is progress from either old or new really equally interesting? */
if (view == window->new_content_view
|| view == window->content_view) {
- nautilus_window_set_state_info
- (window,
- (NautilusWindowStateItem) CV_PROGRESS_DONE,
- (NautilusWindowStateItem) 0);
+ change_state (window, LOAD_DONE, NULL, NULL);
}
}
@@ -1669,8 +1597,8 @@ title_changed_callback (NautilusViewFrame *view,
macro (title_changed) \
macro (zoom_level_changed)
-void
-nautilus_window_connect_view (NautilusWindow *window, NautilusViewFrame *view)
+static void
+connect_view (NautilusWindow *window, NautilusViewFrame *view)
{
GtkObject *view_object;
diff --git a/src/nautilus-window-manage-views.h b/src/nautilus-window-manage-views.h
index 29effc3eb..7eddf02f1 100644
--- a/src/nautilus-window-manage-views.h
+++ b/src/nautilus-window-manage-views.h
@@ -29,15 +29,21 @@
#include "nautilus-window.h"
-void nautilus_window_open_location (NautilusWindow *window,
- const char *location);
-void nautilus_window_open_location_in_new_window (NautilusWindow *window,
- const char *location,
- GList *selection);
-void nautilus_window_stop_loading (NautilusWindow *window);
-void nautilus_window_set_content_view (NautilusWindow *window,
- NautilusViewIdentifier *id);
-void nautilus_window_set_sidebar_panels (NautilusWindow *window,
- GList *view_identifier_list);
+void nautilus_window_open_location (NautilusWindow *window,
+ const char *location);
+void nautilus_window_open_location_in_new_window (NautilusWindow *window,
+ const char *location,
+ GList *selection);
+void nautilus_window_stop_loading (NautilusWindow *window);
+void nautilus_window_set_content_view (NautilusWindow *window,
+ NautilusViewIdentifier *id);
+void nautilus_window_set_sidebar_panels (NautilusWindow *window,
+ GList *view_identifier_list);
+void nautilus_window_begin_location_change (NautilusWindow *window,
+ const char *location,
+ NautilusLocationChangeType type,
+ guint distance);
+void nautilus_window_disconnect_view (NautilusWindow *window,
+ NautilusViewFrame *view);
#endif /* NAUTILUS_WINDOW_MANAGE_VIEWS_H */
diff --git a/src/nautilus-window-private.h b/src/nautilus-window-private.h
index a92151a8b..521525a46 100644
--- a/src/nautilus-window-private.h
+++ b/src/nautilus-window-private.h
@@ -32,16 +32,6 @@
#include <bonobo/bonobo-ui-container.h>
#include <libnautilus-extensions/nautilus-undo-manager.h>
-typedef enum {
- CV_PROGRESS_INITIAL = 1,
- CV_PROGRESS_DONE,
- CV_PROGRESS_ERROR,
- VIEW_ERROR,
- RESET_TO_IDLE, /* Not a real item - a command */
- NAVINFO_RECEIVED,
- NEW_CONTENT_VIEW_ACTIVATED,
-} NautilusWindowStateItem;
-
/* FIXME bugzilla.eazel.com 2575: Need to migrate window fields into here. */
struct NautilusWindowDetails
{
@@ -95,12 +85,6 @@ void nautilus_window_back_or_forward (Nautilus
guint distance);
void nautilus_window_load_content_view_menu (NautilusWindow *window);
void nautilus_window_synch_content_view_menu (NautilusWindow *window);
-void nautilus_window_connect_view (NautilusWindow *window,
- NautilusViewFrame *view);
-void nautilus_window_disconnect_view (NautilusWindow *window,
- NautilusViewFrame *view);
-void nautilus_window_view_failed (NautilusWindow *window,
- NautilusViewFrame *view);
void nautilus_send_history_list_changed (void);
void nautilus_add_to_history_list (NautilusBookmark *bookmark);
GList * nautilus_get_history_list (void);
@@ -113,10 +97,6 @@ void nautilus_window_go_up (Nautilus
void nautilus_window_update_find_menu_item (NautilusWindow *window);
void nautilus_window_toolbar_remove_theme_callback (NautilusWindow *window);
NautilusUndoManager *nautilus_window_get_undo_manager (NautilusWindow *window);
-void nautilus_window_begin_location_change (NautilusWindow *window,
- const char *location,
- NautilusLocationChangeType type,
- guint distance);
void nautilus_window_remove_bookmarks_menu_callback (NautilusWindow *window);
void nautilus_window_remove_go_menu_callback (NautilusWindow *window);
void nautilus_window_remove_bookmarks_menu_items (NautilusWindow *window);
diff --git a/src/nautilus-window-service-ui.c b/src/nautilus-window-service-ui.c
index e1f6aee4e..2e897e40a 100644
--- a/src/nautilus-window-service-ui.c
+++ b/src/nautilus-window-service-ui.c
@@ -27,6 +27,7 @@
#include <bonobo/bonobo-ui-util.h>
#include "nautilus-window-private.h"
+#include <gtk/gtksignal.h>
static void
goto_services_summary (BonoboUIComponent *component,
@@ -56,11 +57,12 @@ goto_software_catalog (BonoboUIComponent *component,
}
static void
-detach_service_ui (gpointer data)
+detach_service_ui (GtkObject *object,
+ gpointer callback_data)
{
BonoboUIComponent *service_ui;
- service_ui = BONOBO_UI_COMPONENT (data);
+ service_ui = BONOBO_UI_COMPONENT (callback_data);
bonobo_ui_component_unset_container (service_ui);
bonobo_object_unref (BONOBO_OBJECT (service_ui));
}
@@ -90,9 +92,9 @@ nautilus_window_install_service_ui (NautilusWindow *window)
"nautilus");
bonobo_ui_component_thaw (service_ui, NULL);
- /* Attach the UI to the window. */
- gtk_object_set_data_full (GTK_OBJECT (window),
- "service UI",
- service_ui,
- detach_service_ui);
+ /* Get rid of the UI when the window goes away. */
+ gtk_signal_connect (GTK_OBJECT (window),
+ "destroy",
+ detach_service_ui,
+ service_ui);
}