mirror of
https://gitlab.gnome.org/GNOME/nautilus
synced 2024-09-13 04:51:15 +00:00
Add slow_mime_type file attribute. Allow call_when_ready to take a NULL
2004-01-14 Alexander Larsson <alexl@redhat.com> * libnautilus-private/nautilus-directory-async.c: * libnautilus-private/nautilus-directory-private.h: * libnautilus-private/nautilus-file-attributes.h: * libnautilus-private/nautilus-file-private.h: * libnautilus-private/nautilus-file.c: * libnautilus-private/nautilus-file.h: Add slow_mime_type file attribute. Allow call_when_ready to take a NULL callback, and allow these monitors to be duplicated. (Used for fire-and-forget attribute reading) * libnautilus-private/nautilus-mime-actions.c: (nautilus_mime_actions_get_minimum_file_attributes): Add slow mime type here * src/file-manager/fm-directory-view.c: Get slow mime type on selection * src/file-manager/fm-properties-window.c: Get slow mime type for properties dialog. Don't use the same pointer twice for the same monitor.
This commit is contained in:
parent
2c30eb9d9b
commit
190ad63f92
25
ChangeLog
25
ChangeLog
|
@ -1,3 +1,28 @@
|
|||
2004-01-14 Alexander Larsson <alexl@redhat.com>
|
||||
|
||||
* libnautilus-private/nautilus-directory-async.c:
|
||||
* libnautilus-private/nautilus-directory-private.h:
|
||||
* libnautilus-private/nautilus-file-attributes.h:
|
||||
* libnautilus-private/nautilus-file-private.h:
|
||||
* libnautilus-private/nautilus-file.c:
|
||||
* libnautilus-private/nautilus-file.h:
|
||||
Add slow_mime_type file attribute.
|
||||
Allow call_when_ready to take a NULL callback, and
|
||||
allow these monitors to be duplicated. (Used for
|
||||
fire-and-forget attribute reading)
|
||||
|
||||
* libnautilus-private/nautilus-mime-actions.c:
|
||||
(nautilus_mime_actions_get_minimum_file_attributes):
|
||||
Add slow mime type here
|
||||
|
||||
* src/file-manager/fm-directory-view.c:
|
||||
Get slow mime type on selection
|
||||
|
||||
* src/file-manager/fm-properties-window.c:
|
||||
Get slow mime type for properties dialog.
|
||||
Don't use the same pointer twice for the
|
||||
same monitor.
|
||||
|
||||
2004-01-13 Alexander Larsson <alexl@redhat.com>
|
||||
|
||||
* src/file-manager/Makefile.am (ui_DATA):
|
||||
|
|
|
@ -541,6 +541,7 @@ nautilus_directory_set_up_request (Request *request,
|
|||
NAUTILUS_FILE_ATTRIBUTE_DIRECTORY_ITEM_MIME_TYPES) != FALSE;
|
||||
request->file_info = (file_attributes &
|
||||
(NAUTILUS_FILE_ATTRIBUTE_MIME_TYPE |
|
||||
NAUTILUS_FILE_ATTRIBUTE_SLOW_MIME_TYPE |
|
||||
NAUTILUS_FILE_ATTRIBUTE_IS_DIRECTORY |
|
||||
NAUTILUS_FILE_ATTRIBUTE_CAPABILITIES |
|
||||
NAUTILUS_FILE_ATTRIBUTE_FILE_TYPE)) != FALSE;
|
||||
|
@ -583,7 +584,9 @@ nautilus_directory_set_up_request (Request *request,
|
|||
|
||||
request->metafile |= (file_attributes &
|
||||
NAUTILUS_FILE_ATTRIBUTE_METADATA) != FALSE;
|
||||
|
||||
|
||||
request->slow_mime_type = (file_attributes & NAUTILUS_FILE_ATTRIBUTE_SLOW_MIME_TYPE) != FALSE;
|
||||
|
||||
request->extension_info = (file_attributes & NAUTILUS_FILE_ATTRIBUTE_EXTENSION_INFO) != FALSE;
|
||||
}
|
||||
|
||||
|
@ -602,6 +605,7 @@ mime_db_changed_callback (GnomeVFSMIMEMonitor *ignore, NautilusDirectory *dir)
|
|||
NAUTILUS_FILE_ATTRIBUTE_CAPABILITIES |
|
||||
NAUTILUS_FILE_ATTRIBUTE_CUSTOM_ICON |
|
||||
NAUTILUS_FILE_ATTRIBUTE_MIME_TYPE |
|
||||
NAUTILUS_FILE_ATTRIBUTE_SLOW_MIME_TYPE |
|
||||
NAUTILUS_FILE_ATTRIBUTE_METADATA |
|
||||
NAUTILUS_FILE_ATTRIBUTE_FILE_TYPE |
|
||||
NAUTILUS_FILE_ATTRIBUTE_DIRECTORY_ITEM_MIME_TYPES;
|
||||
|
@ -894,7 +898,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)) {
|
||||
if (nautilus_file_update_info (file, file_info, FALSE)) {
|
||||
/* File changed, notify about the change. */
|
||||
nautilus_file_ref (file);
|
||||
changed_files = g_list_prepend (changed_files, file);
|
||||
|
@ -1277,9 +1281,11 @@ ready_callback_call (NautilusDirectory *directory,
|
|||
|
||||
/* Call the callback. */
|
||||
if (callback->file != NULL) {
|
||||
(* callback->callback.file) (callback->file,
|
||||
callback->callback_data);
|
||||
} else {
|
||||
if (callback->callback.file) {
|
||||
(* callback->callback.file) (callback->file,
|
||||
callback->callback_data);
|
||||
}
|
||||
} else if (callback->callback.directory != NULL) {
|
||||
if (directory == NULL || !callback->request.file_list) {
|
||||
file_list = NULL;
|
||||
} else {
|
||||
|
@ -1309,7 +1315,6 @@ nautilus_directory_call_when_ready_internal (NautilusDirectory *directory,
|
|||
g_assert (directory == NULL || NAUTILUS_IS_DIRECTORY (directory));
|
||||
g_assert (file == NULL || NAUTILUS_IS_FILE (file));
|
||||
g_assert (file != NULL || directory_callback != NULL);
|
||||
g_assert (file == NULL || file_callback != NULL);
|
||||
|
||||
/* Construct a callback object. */
|
||||
callback.file = file;
|
||||
|
@ -1321,7 +1326,7 @@ nautilus_directory_call_when_ready_internal (NautilusDirectory *directory,
|
|||
callback.callback_data = callback_data;
|
||||
nautilus_directory_set_up_request (&callback.request, file_attributes);
|
||||
callback.request.file_list = wait_for_file_list;
|
||||
|
||||
|
||||
/* Handle the NULL case. */
|
||||
if (directory == NULL) {
|
||||
ready_callback_call (NULL, &callback);
|
||||
|
@ -1332,7 +1337,10 @@ nautilus_directory_call_when_ready_internal (NautilusDirectory *directory,
|
|||
if (g_list_find_custom (directory->details->call_when_ready_list,
|
||||
&callback,
|
||||
ready_callback_key_compare) != NULL) {
|
||||
g_warning ("tried to add a new callback while an old one was pending");
|
||||
if (file_callback != NULL && directory_callback != NULL) {
|
||||
g_warning ("tried to add a new callback while an old one was pending");
|
||||
}
|
||||
/* NULL callback means, just read it. Conflicts are ok. */
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1669,6 +1677,26 @@ wants_info (const Request *request)
|
|||
return request->file_info;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
always_lacks (NautilusFile *file)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
lacks_slow_mime_type (NautilusFile *file)
|
||||
{
|
||||
return !file->details->got_slow_mime_type
|
||||
&& !file->details->is_gone;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
wants_slow_mime_type (const Request *request)
|
||||
{
|
||||
return request->slow_mime_type;
|
||||
}
|
||||
|
||||
|
||||
static gboolean
|
||||
lacks_deep_count (NautilusFile *file)
|
||||
{
|
||||
|
@ -1818,6 +1846,12 @@ request_is_satisfied (NautilusDirectory *directory,
|
|||
}
|
||||
}
|
||||
|
||||
if (request->slow_mime_type) {
|
||||
if (has_problem (directory, file, lacks_slow_mime_type)) {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (request->top_left_text) {
|
||||
if (has_problem (directory, file, lacks_top_left)) {
|
||||
return FALSE;
|
||||
|
@ -2097,7 +2131,7 @@ start_monitoring_file_list (NautilusDirectory *directory)
|
|||
|
||||
#ifdef DEBUG_LOAD_DIRECTORY
|
||||
g_message ("load_directory called to monitor file list of %s", directory->details->uri);
|
||||
#endif
|
||||
#endif
|
||||
gnome_vfs_async_load_directory
|
||||
(&directory->details->directory_load_in_progress, /* handle */
|
||||
directory->details->uri, /* uri */
|
||||
|
@ -2791,6 +2825,7 @@ get_info_callback (GnomeVFSAsyncHandle *handle,
|
|||
NautilusDirectory *directory;
|
||||
NautilusFile *get_info_file;
|
||||
GnomeVFSGetFileInfoResult *result;
|
||||
gboolean has_slow_mime_type;
|
||||
|
||||
directory = NAUTILUS_DIRECTORY (callback_data);
|
||||
g_assert (handle == NULL || handle == directory->details->get_info_in_progress);
|
||||
|
@ -2799,10 +2834,13 @@ get_info_callback (GnomeVFSAsyncHandle *handle,
|
|||
g_assert (NAUTILUS_IS_FILE (get_info_file));
|
||||
|
||||
nautilus_directory_ref (directory);
|
||||
|
||||
has_slow_mime_type = directory->details->get_info_has_slow_mime_type;
|
||||
|
||||
directory->details->get_info_file = NULL;
|
||||
directory->details->get_info_in_progress = NULL;
|
||||
|
||||
directory->details->get_info_has_slow_mime_type = FALSE;
|
||||
|
||||
/* ref here because we might be removing the last ref when we
|
||||
* mark the file gone below, but we need to keep a ref at
|
||||
* least long enough to send the change notification.
|
||||
|
@ -2828,7 +2866,7 @@ get_info_callback (GnomeVFSAsyncHandle *handle,
|
|||
}
|
||||
}
|
||||
} else {
|
||||
nautilus_file_update_info (get_info_file, result->file_info);
|
||||
nautilus_file_update_info (get_info_file, result->file_info, has_slow_mime_type);
|
||||
}
|
||||
|
||||
nautilus_file_changed (get_info_file);
|
||||
|
@ -2850,7 +2888,8 @@ file_info_stop (NautilusDirectory *directory)
|
|||
if (file != NULL) {
|
||||
g_assert (NAUTILUS_IS_FILE (file));
|
||||
g_assert (file->details->directory == directory);
|
||||
if (is_needy (file, lacks_info, wants_info)) {
|
||||
if (is_needy (file, lacks_info, wants_info) ||
|
||||
is_needy (file, lacks_slow_mime_type, wants_slow_mime_type)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -2867,16 +2906,20 @@ file_info_start (NautilusDirectory *directory,
|
|||
char *uri;
|
||||
GnomeVFSURI *vfs_uri;
|
||||
GList fake_list;
|
||||
|
||||
gboolean need_slow_mime;
|
||||
GnomeVFSFileInfoOptions options;
|
||||
|
||||
file_info_stop (directory);
|
||||
|
||||
if (directory->details->get_info_in_progress != NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!is_needy (file, lacks_info, wants_info)) {
|
||||
if (!is_needy (file, lacks_info, wants_info) &&
|
||||
!is_needy (file, lacks_slow_mime_type, wants_slow_mime_type)) {
|
||||
return;
|
||||
}
|
||||
need_slow_mime = is_needy (file, always_lacks, wants_slow_mime_type);
|
||||
|
||||
uri = nautilus_file_get_uri (file);
|
||||
vfs_uri = gnome_vfs_uri_new (uri);
|
||||
|
@ -2889,6 +2932,7 @@ file_info_start (NautilusDirectory *directory,
|
|||
file->details->file_info_is_up_to_date = TRUE;
|
||||
file->details->get_info_failed = TRUE;
|
||||
file->details->get_info_error = GNOME_VFS_ERROR_INVALID_URI;
|
||||
file->details->got_slow_mime_type = need_slow_mime;
|
||||
|
||||
nautilus_directory_async_state_changed (directory);
|
||||
return;
|
||||
|
@ -2902,18 +2946,23 @@ file_info_start (NautilusDirectory *directory,
|
|||
fake_list.data = vfs_uri;
|
||||
fake_list.prev = NULL;
|
||||
fake_list.next = NULL;
|
||||
|
||||
options = GNOME_VFS_FILE_INFO_GET_MIME_TYPE
|
||||
| GNOME_VFS_FILE_INFO_FOLLOW_LINKS;
|
||||
if (need_slow_mime) {
|
||||
options |= GNOME_VFS_FILE_INFO_FORCE_SLOW_MIME_TYPE;
|
||||
}
|
||||
directory->details->get_info_has_slow_mime_type = need_slow_mime;
|
||||
gnome_vfs_async_get_file_info
|
||||
(&directory->details->get_info_in_progress,
|
||||
&fake_list,
|
||||
GNOME_VFS_FILE_INFO_GET_MIME_TYPE
|
||||
| GNOME_VFS_FILE_INFO_FOLLOW_LINKS,
|
||||
options,
|
||||
GNOME_VFS_PRIORITY_DEFAULT,
|
||||
get_info_callback,
|
||||
directory);
|
||||
gnome_vfs_uri_unref (vfs_uri);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
link_info_done (NautilusDirectory *directory,
|
||||
NautilusFile *file,
|
||||
|
@ -3344,6 +3393,7 @@ start_or_stop_io (NautilusDirectory *directory)
|
|||
|
||||
if (file_needs_low_priority_work_done (directory, file)) {
|
||||
/* Start getting attributes if possible */
|
||||
file_info_start (directory, file); /* for slow mime type */
|
||||
directory_count_start (directory, file);
|
||||
deep_count_start (directory, file);
|
||||
mime_list_start (directory, file);
|
||||
|
@ -3591,6 +3641,10 @@ file_needs_low_priority_work_done (NautilusDirectory *directory,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
if (is_needy (file, lacks_slow_mime_type, wants_slow_mime_type)) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (is_needy (file, lacks_top_left, wants_top_left)) {
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -101,6 +101,10 @@ struct NautilusDirectoryDetails
|
|||
|
||||
NautilusFile *get_info_file;
|
||||
GnomeVFSAsyncHandle *get_info_in_progress;
|
||||
gboolean get_info_has_slow_mime_type;
|
||||
|
||||
NautilusFile *slow_mime_type_file;
|
||||
GnomeVFSAsyncHandle *slow_mime_type_in_progress;
|
||||
|
||||
NautilusFile *extension_info_file;
|
||||
NautilusInfoProvider *extension_info_provider;
|
||||
|
@ -126,6 +130,7 @@ typedef struct {
|
|||
gboolean mime_list;
|
||||
gboolean top_left_text;
|
||||
gboolean extension_info;
|
||||
gboolean slow_mime_type;
|
||||
} Request;
|
||||
|
||||
NautilusDirectory *nautilus_directory_get_existing (const char *uri);
|
||||
|
|
|
@ -44,6 +44,7 @@ typedef enum {
|
|||
NAUTILUS_FILE_ATTRIBUTE_DISPLAY_NAME = 1 << 11,
|
||||
NAUTILUS_FILE_ATTRIBUTE_VOLUMES = 1 << 12,
|
||||
NAUTILUS_FILE_ATTRIBUTE_EXTENSION_INFO = 1 << 13,
|
||||
NAUTILUS_FILE_ATTRIBUTE_SLOW_MIME_TYPE = 1 << 14,
|
||||
} NautilusFileAttributes;
|
||||
|
||||
#endif /* NAUTILUS_FILE_ATTRIBUTES_H */
|
||||
|
|
|
@ -117,6 +117,8 @@ struct NautilusFileDetails
|
|||
/* got_info known from info field being non-NULL */
|
||||
eel_boolean_bit get_info_failed : 1;
|
||||
eel_boolean_bit file_info_is_up_to_date : 1;
|
||||
|
||||
eel_boolean_bit got_slow_mime_type : 1;
|
||||
|
||||
eel_boolean_bit got_directory_count : 1;
|
||||
eel_boolean_bit directory_count_failed : 1;
|
||||
|
@ -168,7 +170,8 @@ void nautilus_file_clear_cached_display_name (NautilusFile
|
|||
* no change, update file and return TRUE if the file info contains
|
||||
* new state. */
|
||||
gboolean nautilus_file_update_info (NautilusFile *file,
|
||||
GnomeVFSFileInfo *info);
|
||||
GnomeVFSFileInfo *info,
|
||||
gboolean info_has_slow_mime);
|
||||
gboolean nautilus_file_update_name (NautilusFile *file,
|
||||
const char *name);
|
||||
|
||||
|
|
|
@ -100,6 +100,7 @@ typedef struct {
|
|||
NautilusFileOperationCallback callback;
|
||||
gpointer callback_data;
|
||||
gboolean is_rename;
|
||||
gboolean use_slow_mime;
|
||||
} Operation;
|
||||
|
||||
typedef GList * (* ModifyListFunction) (GList *list, NautilusFile *file);
|
||||
|
@ -123,7 +124,8 @@ static char * nautilus_file_get_owner_as_string (NautilusFile
|
|||
gboolean include_real_name);
|
||||
static char * nautilus_file_get_type_as_string (NautilusFile *file);
|
||||
static gboolean update_info_and_name (NautilusFile *file,
|
||||
GnomeVFSFileInfo *info);
|
||||
GnomeVFSFileInfo *info,
|
||||
gboolean info_has_slow_mime);
|
||||
static char * nautilus_file_get_display_name_nocopy (NautilusFile *file);
|
||||
static char * nautilus_file_get_display_name_collation_key (NautilusFile *file);
|
||||
|
||||
|
@ -310,7 +312,7 @@ nautilus_file_new_from_info (NautilusDirectory *directory,
|
|||
nautilus_directory_ref (directory);
|
||||
file->details->directory = directory;
|
||||
|
||||
update_info_and_name (file, info);
|
||||
update_info_and_name (file, info, FALSE);
|
||||
return file;
|
||||
}
|
||||
|
||||
|
@ -1059,7 +1061,7 @@ rename_callback (GnomeVFSAsyncHandle *handle,
|
|||
old_uri = nautilus_file_get_uri (op->file);
|
||||
old_relative_uri = g_strdup (op->file->details->relative_uri);
|
||||
|
||||
update_info_and_name (op->file, new_info);
|
||||
update_info_and_name (op->file, new_info, op->use_slow_mime);
|
||||
|
||||
/* Self-owned files store their metadata under the
|
||||
* hard-code name "." so there's no need to rename
|
||||
|
@ -1114,7 +1116,8 @@ rename_guts (NautilusFile *file,
|
|||
char *uri, *old_name;
|
||||
gboolean success;
|
||||
gboolean is_local_desktop_file;
|
||||
|
||||
GnomeVFSFileInfoOptions options;
|
||||
|
||||
g_return_if_fail (NAUTILUS_IS_FILE (file));
|
||||
g_return_if_fail (new_name != NULL);
|
||||
g_return_if_fail (callback != NULL);
|
||||
|
@ -1221,6 +1224,13 @@ rename_guts (NautilusFile *file,
|
|||
/* Set up a renaming operation. */
|
||||
op = operation_new (file, callback, callback_data);
|
||||
op->is_rename = TRUE;
|
||||
op->use_slow_mime = file->details->got_slow_mime_type;
|
||||
|
||||
options = GNOME_VFS_FILE_INFO_GET_MIME_TYPE
|
||||
| GNOME_VFS_FILE_INFO_FOLLOW_LINKS;
|
||||
if (op->use_slow_mime) {
|
||||
options |= GNOME_VFS_FILE_INFO_FORCE_SLOW_MIME_TYPE;
|
||||
}
|
||||
|
||||
/* Do the renaming. */
|
||||
partial_file_info = gnome_vfs_file_info_new ();
|
||||
|
@ -1229,8 +1239,7 @@ rename_guts (NautilusFile *file,
|
|||
gnome_vfs_async_set_file_info (&op->handle,
|
||||
vfs_uri, partial_file_info,
|
||||
GNOME_VFS_SET_FILE_INFO_NAME,
|
||||
(GNOME_VFS_FILE_INFO_GET_MIME_TYPE
|
||||
| GNOME_VFS_FILE_INFO_FOLLOW_LINKS),
|
||||
options,
|
||||
GNOME_VFS_PRIORITY_DEFAULT,
|
||||
rename_callback, op);
|
||||
gnome_vfs_file_info_unref (partial_file_info);
|
||||
|
@ -1393,7 +1402,8 @@ update_links_if_target (NautilusFile *target_file)
|
|||
static gboolean
|
||||
update_info_internal (NautilusFile *file,
|
||||
GnomeVFSFileInfo *info,
|
||||
gboolean update_name)
|
||||
gboolean update_name,
|
||||
gboolean info_has_slow_mime)
|
||||
{
|
||||
GList *node;
|
||||
GnomeVFSFileInfo *info_copy;
|
||||
|
@ -1409,12 +1419,13 @@ update_info_internal (NautilusFile *file,
|
|||
}
|
||||
|
||||
file->details->file_info_is_up_to_date = TRUE;
|
||||
|
||||
file->details->got_slow_mime_type = info_has_slow_mime;
|
||||
if (file->details->info != NULL
|
||||
&& gnome_vfs_file_info_matches (file->details->info, info)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/* FIXME bugzilla.gnome.org 42044: Need to let links that
|
||||
* point to the old name know that the file has been renamed.
|
||||
*/
|
||||
|
@ -1452,16 +1463,18 @@ update_info_internal (NautilusFile *file,
|
|||
|
||||
static gboolean
|
||||
update_info_and_name (NautilusFile *file,
|
||||
GnomeVFSFileInfo *info)
|
||||
GnomeVFSFileInfo *info,
|
||||
gboolean info_has_slow_mime)
|
||||
{
|
||||
return update_info_internal (file, info, TRUE);
|
||||
return update_info_internal (file, info, TRUE, info_has_slow_mime);
|
||||
}
|
||||
|
||||
gboolean
|
||||
nautilus_file_update_info (NautilusFile *file,
|
||||
GnomeVFSFileInfo *info)
|
||||
GnomeVFSFileInfo *info,
|
||||
gboolean info_has_slow_mime)
|
||||
{
|
||||
return update_info_internal (file, info, FALSE);
|
||||
return update_info_internal (file, info, FALSE, info_has_slow_mime);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@ -3403,7 +3416,7 @@ set_permissions_callback (GnomeVFSAsyncHandle *handle,
|
|||
g_assert (handle == op->handle);
|
||||
|
||||
if (result == GNOME_VFS_OK && new_info != NULL) {
|
||||
nautilus_file_update_info (op->file, new_info);
|
||||
nautilus_file_update_info (op->file, new_info, op->use_slow_mime);
|
||||
}
|
||||
operation_complete (op, result);
|
||||
}
|
||||
|
@ -3427,6 +3440,7 @@ nautilus_file_set_permissions (NautilusFile *file,
|
|||
Operation *op;
|
||||
GnomeVFSURI *vfs_uri;
|
||||
GnomeVFSFileInfo *partial_file_info;
|
||||
GnomeVFSFileInfoOptions options;
|
||||
|
||||
if (!nautilus_file_can_set_permissions (file)) {
|
||||
/* Claim that something changed even if the permission change failed.
|
||||
|
@ -3449,7 +3463,13 @@ nautilus_file_set_permissions (NautilusFile *file,
|
|||
|
||||
/* Set up a permission change operation. */
|
||||
op = operation_new (file, callback, callback_data);
|
||||
op->use_slow_mime = file->details->got_slow_mime_type;
|
||||
|
||||
options = GNOME_VFS_FILE_INFO_GET_MIME_TYPE
|
||||
| GNOME_VFS_FILE_INFO_FOLLOW_LINKS;
|
||||
if (op->use_slow_mime) {
|
||||
options |= GNOME_VFS_FILE_INFO_FORCE_SLOW_MIME_TYPE;
|
||||
}
|
||||
/* Change the file-on-disk permissions. */
|
||||
partial_file_info = gnome_vfs_file_info_new ();
|
||||
partial_file_info->permissions = new_permissions;
|
||||
|
@ -3457,8 +3477,7 @@ nautilus_file_set_permissions (NautilusFile *file,
|
|||
gnome_vfs_async_set_file_info (&op->handle,
|
||||
vfs_uri, partial_file_info,
|
||||
GNOME_VFS_SET_FILE_INFO_PERMISSIONS,
|
||||
(GNOME_VFS_FILE_INFO_GET_MIME_TYPE
|
||||
| GNOME_VFS_FILE_INFO_FOLLOW_LINKS),
|
||||
options,
|
||||
GNOME_VFS_PRIORITY_DEFAULT,
|
||||
set_permissions_callback, op);
|
||||
gnome_vfs_file_info_unref (partial_file_info);
|
||||
|
@ -3701,7 +3720,7 @@ set_owner_and_group_callback (GnomeVFSAsyncHandle *handle,
|
|||
g_assert (handle == op->handle);
|
||||
|
||||
if (result == GNOME_VFS_OK && new_info != NULL) {
|
||||
nautilus_file_update_info (op->file, new_info);
|
||||
nautilus_file_update_info (op->file, new_info, op->use_slow_mime);
|
||||
}
|
||||
operation_complete (op, result);
|
||||
}
|
||||
|
@ -3716,9 +3735,17 @@ set_owner_and_group (NautilusFile *file,
|
|||
Operation *op;
|
||||
GnomeVFSURI *uri;
|
||||
GnomeVFSFileInfo *partial_file_info;
|
||||
GnomeVFSFileInfoOptions options;
|
||||
|
||||
/* Set up a owner-change operation. */
|
||||
op = operation_new (file, callback, callback_data);
|
||||
op->use_slow_mime = file->details->got_slow_mime_type;
|
||||
|
||||
options = GNOME_VFS_FILE_INFO_GET_MIME_TYPE
|
||||
| GNOME_VFS_FILE_INFO_FOLLOW_LINKS;
|
||||
if (op->use_slow_mime) {
|
||||
options |= GNOME_VFS_FILE_INFO_FORCE_SLOW_MIME_TYPE;
|
||||
}
|
||||
|
||||
/* Change the file-on-disk owner. */
|
||||
partial_file_info = gnome_vfs_file_info_new ();
|
||||
|
@ -3729,8 +3756,7 @@ set_owner_and_group (NautilusFile *file,
|
|||
gnome_vfs_async_set_file_info (&op->handle,
|
||||
uri, partial_file_info,
|
||||
GNOME_VFS_SET_FILE_INFO_OWNER,
|
||||
(GNOME_VFS_FILE_INFO_GET_MIME_TYPE
|
||||
| GNOME_VFS_FILE_INFO_FOLLOW_LINKS),
|
||||
options,
|
||||
GNOME_VFS_PRIORITY_DEFAULT,
|
||||
set_owner_and_group_callback, op);
|
||||
gnome_vfs_file_info_unref (partial_file_info);
|
||||
|
@ -4702,6 +4728,13 @@ nautilus_file_get_file_type (NautilusFile *file)
|
|||
return ((NautilusFileClass*)G_OBJECT_GET_CLASS (file))->get_file_type (file);
|
||||
}
|
||||
|
||||
gboolean
|
||||
nautilus_file_needs_slow_mime_type (NautilusFile *file)
|
||||
{
|
||||
return !file->details->got_slow_mime_type &&
|
||||
has_local_path (file);
|
||||
}
|
||||
|
||||
/**
|
||||
* nautilus_file_get_mime_type
|
||||
*
|
||||
|
@ -5367,8 +5400,6 @@ nautilus_file_call_when_ready (NautilusFile *file,
|
|||
gpointer callback_data)
|
||||
|
||||
{
|
||||
g_return_if_fail (callback != NULL);
|
||||
|
||||
if (file == NULL) {
|
||||
(* callback) (file, callback_data);
|
||||
return;
|
||||
|
@ -5430,6 +5461,12 @@ invalidate_file_info (NautilusFile *file)
|
|||
file->details->file_info_is_up_to_date = FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
invalidate_slow_mime_type (NautilusFile *file)
|
||||
{
|
||||
file->details->file_info_is_up_to_date = FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
invalidate_link_info (NautilusFile *file)
|
||||
{
|
||||
|
@ -5481,6 +5518,9 @@ nautilus_file_invalidate_attributes_internal (NautilusFile *file,
|
|||
if (request.file_info) {
|
||||
invalidate_file_info (file);
|
||||
}
|
||||
if (request.slow_mime_type) {
|
||||
invalidate_slow_mime_type (file);
|
||||
}
|
||||
if (request.top_left_text) {
|
||||
invalidate_top_left_text (file);
|
||||
}
|
||||
|
@ -5572,6 +5612,7 @@ nautilus_file_get_all_attributes (void)
|
|||
NAUTILUS_FILE_ATTRIBUTE_MIME_TYPE |
|
||||
NAUTILUS_FILE_ATTRIBUTE_TOP_LEFT_TEXT |
|
||||
NAUTILUS_FILE_ATTRIBUTE_DISPLAY_NAME |
|
||||
NAUTILUS_FILE_ATTRIBUTE_SLOW_MIME_TYPE |
|
||||
NAUTILUS_FILE_ATTRIBUTE_VOLUMES;
|
||||
}
|
||||
|
||||
|
|
|
@ -138,6 +138,7 @@ GnomeVFSFileType nautilus_file_get_file_type (Nautilu
|
|||
char * nautilus_file_get_mime_type (NautilusFile *file);
|
||||
gboolean nautilus_file_is_mime_type (NautilusFile *file,
|
||||
const char *mime_type);
|
||||
gboolean nautilus_file_needs_slow_mime_type (NautilusFile *file);
|
||||
gboolean nautilus_file_is_symbolic_link (NautilusFile *file);
|
||||
char * nautilus_file_get_volume_free_space (NautilusFile *file);
|
||||
char * nautilus_file_get_volume_name (NautilusFile *file);
|
||||
|
|
|
@ -98,7 +98,8 @@ nautilus_mime_actions_get_minimum_file_attributes (void)
|
|||
return NAUTILUS_FILE_ATTRIBUTE_VOLUMES |
|
||||
NAUTILUS_FILE_ATTRIBUTE_ACTIVATION_URI |
|
||||
NAUTILUS_FILE_ATTRIBUTE_METADATA |
|
||||
NAUTILUS_FILE_ATTRIBUTE_MIME_TYPE;
|
||||
NAUTILUS_FILE_ATTRIBUTE_MIME_TYPE |
|
||||
NAUTILUS_FILE_ATTRIBUTE_SLOW_MIME_TYPE;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -5597,7 +5597,6 @@ schedule_update_status (FMDirectoryView *view)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* fm_directory_view_notify_selection_changed:
|
||||
*
|
||||
|
@ -5609,6 +5608,9 @@ schedule_update_status (FMDirectoryView *view)
|
|||
void
|
||||
fm_directory_view_notify_selection_changed (FMDirectoryView *view)
|
||||
{
|
||||
NautilusFile *file;
|
||||
GList *selection, *p;
|
||||
|
||||
g_return_if_fail (FM_IS_DIRECTORY_VIEW (view));
|
||||
|
||||
if (!view->details->selection_change_is_due_to_shell) {
|
||||
|
@ -5633,6 +5635,20 @@ fm_directory_view_notify_selection_changed (FMDirectoryView *view)
|
|||
|
||||
/* Schedule an update of menu item states to match selection */
|
||||
schedule_update_menus (view);
|
||||
|
||||
selection = fm_directory_view_get_selection (view);
|
||||
for (p = selection; p != NULL; p = p->next) {
|
||||
file = p->data;
|
||||
|
||||
if (nautilus_file_needs_slow_mime_type (file)) {
|
||||
nautilus_file_call_when_ready
|
||||
(file,
|
||||
NAUTILUS_FILE_ATTRIBUTE_SLOW_MIME_TYPE,
|
||||
NULL,
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
nautilus_file_list_free (selection);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5942,7 +5958,7 @@ activate_activation_uri_ready_callback (NautilusFile *file, gpointer callback_da
|
|||
|
||||
parameters->file = actual_file;
|
||||
parameters->callback = activate_callback;
|
||||
|
||||
|
||||
nautilus_file_call_when_ready
|
||||
(actual_file, attributes, activate_callback, parameters);
|
||||
}
|
||||
|
|
|
@ -993,8 +993,8 @@ remove_from_dialog (FMPropertiesWindow *window,
|
|||
G_CALLBACK (properties_window_update),
|
||||
window);
|
||||
|
||||
nautilus_file_monitor_remove (original_file, window);
|
||||
nautilus_file_monitor_remove (target_file, window);
|
||||
nautilus_file_monitor_remove (original_file, &window->details->original_files);
|
||||
nautilus_file_monitor_remove (target_file, &window->details->target_files);
|
||||
|
||||
nautilus_file_unref (original_file);
|
||||
nautilus_file_unref (target_file);
|
||||
|
@ -3224,10 +3224,11 @@ create_properties_window (StartupData *startup_data)
|
|||
file = NAUTILUS_FILE (l->data);
|
||||
|
||||
attributes = nautilus_icon_factory_get_required_file_attributes ();
|
||||
attributes |= NAUTILUS_FILE_ATTRIBUTE_DISPLAY_NAME;
|
||||
attributes |= NAUTILUS_FILE_ATTRIBUTE_DISPLAY_NAME
|
||||
| NAUTILUS_FILE_ATTRIBUTE_SLOW_MIME_TYPE;
|
||||
|
||||
nautilus_file_monitor_add (NAUTILUS_FILE (l->data),
|
||||
window,
|
||||
&window->details->original_files,
|
||||
attributes);
|
||||
}
|
||||
|
||||
|
@ -3243,7 +3244,7 @@ create_properties_window (StartupData *startup_data)
|
|||
}
|
||||
|
||||
attributes |= NAUTILUS_FILE_ATTRIBUTE_METADATA;
|
||||
nautilus_file_monitor_add (file, window, attributes);
|
||||
nautilus_file_monitor_add (file, &window->details->target_files, attributes);
|
||||
}
|
||||
|
||||
for (l = window->details->target_files; l != NULL; l = l->next) {
|
||||
|
@ -3545,13 +3546,13 @@ real_destroy (GtkObject *object)
|
|||
remove_window (window);
|
||||
|
||||
for (l = window->details->original_files; l != NULL; l = l->next) {
|
||||
nautilus_file_monitor_remove (NAUTILUS_FILE (l->data), window);
|
||||
nautilus_file_monitor_remove (NAUTILUS_FILE (l->data), &window->details->original_files);
|
||||
}
|
||||
nautilus_file_list_free (window->details->original_files);
|
||||
window->details->original_files = NULL;
|
||||
|
||||
for (l = window->details->target_files; l != NULL; l = l->next) {
|
||||
nautilus_file_monitor_remove (NAUTILUS_FILE (l->data), window);
|
||||
nautilus_file_monitor_remove (NAUTILUS_FILE (l->data), &window->details->target_files);
|
||||
}
|
||||
nautilus_file_list_free (window->details->target_files);
|
||||
window->details->target_files = NULL;
|
||||
|
|
Loading…
Reference in a new issue