diff options
author | Darin Adler <darin@src.gnome.org> | 2000-08-14 23:45:21 +0000 |
---|---|---|
committer | Darin Adler <darin@src.gnome.org> | 2000-08-14 23:45:21 +0000 |
commit | 5baaa578051f2f1249a518c256d84d04f221011a (patch) | |
tree | 3139949fb03b25f6575af40503e931ad763913fe /libnautilus-extensions/nautilus-mime-actions.c | |
parent | 925ddd403d4a4f4ed4042b4e1171ddefc9aa5257 (diff) | |
download | nautilus-5baaa578051f2f1249a518c256d84d04f221011a.tar.gz |
More prep work for the trash directory.
* libnautilus-extensions/Makefile.am:
* libnautilus-extensions/nautilus-trash-directory.c:
(nautilus_trash_directory_initialize_class),
(nautilus_trash_directory_initialize),
(nautilus_trash_directory_destroy):
* libnautilus-extensions/nautilus-trash-directory.h:
* libnautilus-extensions/nautilus-vfs-directory.c:
(nautilus_vfs_directory_initialize_class),
(nautilus_vfs_directory_initialize),
(nautilus_vfs_directory_destroy):
* libnautilus-extensions/nautilus-vfs-directory.h:
Add subclasses for the trash and for general VFS directories.
Using refactoring techniques to move code down into these
subclasses. This is not intended to be a general framework,
but should be good enough to handle both these cases.
* libnautilus-extensions/nautilus-directory-async.c:
(can_use_public_metafile), (metafile_read_check_for_directory),
(metafile_read_failed), (metafile_read_start), (allow_metafile),
(metafile_write_success_close_callback),
(nautilus_metafile_write_start), (start_monitoring_file_list),
(get_corresponding_file), (start_getting_file_info):
* libnautilus-extensions/nautilus-directory-private.h:
* libnautilus-extensions/nautilus-directory.c:
(nautilus_directory_destroy), (make_uri_canonical),
(nautilus_directory_get_internal), (nautilus_directory_get_uri),
(construct_private_metafile_uri), (nautilus_directory_new),
(nautilus_directory_is_local), (nautilus_directory_is_not_empty),
(nautilus_self_check_directory):
* libnautilus-extensions/nautilus-directory.h:
* libnautilus-extensions/nautilus-file.c:
(nautilus_file_get_internal), (nautilus_file_rename),
(nautilus_file_get_gnome_vfs_uri), (nautilus_file_matches_uri),
(nautilus_file_compare_by_name),
(nautilus_file_compare_by_directory_name),
(nautilus_file_compare_for_sort), (nautilus_file_get_uri),
(nautilus_file_set_permissions),
(nautilus_file_get_string_attribute),
(nautilus_file_get_mime_type), (nautilus_file_is_in_trash),
(nautilus_file_contains_text), (nautilus_file_get_directory_name),
(nautilus_file_mark_gone), (nautilus_file_changed):
* libnautilus-extensions/nautilus-file.h:
Add code to handle case of directory that can't be handled by
gnome-vfs. Mostly some NULL checks. Also renamed fields to make
it clear that the text URI is the "real" one. Added code to
handle the "gnome-trash:" and "trash:" schemes specially in the
code to make URIs canonical.
* libnautilus-extensions/nautilus-mime-actions.c:
(get_mime_type_from_uri): Return "application/octet-stream"
instead of NULL for unknown MIME type.
* src/file-manager/fm-directory-view.c:
(fm_directory_view_display_selection_info): Eliminated the
nautilus_file_get_real_name call.
* src/nautilus-switchable-navigation-bar.c:
(nautilus_switchable_navigation_bar_set_location): Eliminated
the nautilus_directory_is_search_directory call.
* src/file-manager/fm-search-list-view.c: (real_adding_file):
Fixed formatting mistake.
* src/nautilus-view-frame.c: (set_up_for_new_location): Emit
the title_changed signal for each change in location.
Diffstat (limited to 'libnautilus-extensions/nautilus-mime-actions.c')
-rw-r--r-- | libnautilus-extensions/nautilus-mime-actions.c | 90 |
1 files changed, 53 insertions, 37 deletions
diff --git a/libnautilus-extensions/nautilus-mime-actions.c b/libnautilus-extensions/nautilus-mime-actions.c index 2731a4e27..da20596e3 100644 --- a/libnautilus-extensions/nautilus-mime-actions.c +++ b/libnautilus-extensions/nautilus-mime-actions.c @@ -424,9 +424,13 @@ nautilus_mime_get_short_list_applications_for_uri (const char *uri) nautilus_directory_wait_for_metadata (directory); metadata_application_add_ids = nautilus_directory_get_metadata_list - (directory, NAUTILUS_METADATA_KEY_SHORT_LIST_APPLICATION_ADD, NAUTILUS_METADATA_SUBKEY_APPLICATION_ID); + (directory, + NAUTILUS_METADATA_KEY_SHORT_LIST_APPLICATION_ADD, + NAUTILUS_METADATA_SUBKEY_APPLICATION_ID); metadata_application_remove_ids = nautilus_directory_get_metadata_list - (directory, NAUTILUS_METADATA_KEY_SHORT_LIST_APPLICATION_REMOVE, NAUTILUS_METADATA_SUBKEY_APPLICATION_ID); + (directory, + NAUTILUS_METADATA_KEY_SHORT_LIST_APPLICATION_REMOVE, + NAUTILUS_METADATA_SUBKEY_APPLICATION_ID); nautilus_directory_unref (directory); mime_type = get_mime_type_from_uri (uri); @@ -495,9 +499,13 @@ nautilus_mime_get_short_list_components_for_uri (const char *uri) g_list_free (attributes); metadata_component_add_ids = nautilus_directory_get_metadata_list - (directory, NAUTILUS_METADATA_KEY_SHORT_LIST_COMPONENT_ADD, NAUTILUS_METADATA_SUBKEY_COMPONENT_IID); + (directory, + NAUTILUS_METADATA_KEY_SHORT_LIST_COMPONENT_ADD, + NAUTILUS_METADATA_SUBKEY_COMPONENT_IID); metadata_component_remove_ids = nautilus_directory_get_metadata_list - (directory, NAUTILUS_METADATA_KEY_SHORT_LIST_COMPONENT_REMOVE, NAUTILUS_METADATA_SUBKEY_COMPONENT_IID); + (directory, + NAUTILUS_METADATA_KEY_SHORT_LIST_COMPONENT_REMOVE, + NAUTILUS_METADATA_SUBKEY_COMPONENT_IID); nautilus_directory_unref (directory); mime_type = get_mime_type_from_uri (uri); @@ -586,7 +594,9 @@ nautilus_mime_get_all_applications_for_uri (const char *uri) nautilus_directory_wait_for_metadata (directory); metadata_application_ids = nautilus_directory_get_metadata_list - (directory, NAUTILUS_METADATA_KEY_EXPLICIT_APPLICATION, NAUTILUS_METADATA_SUBKEY_APPLICATION_ID); + (directory, + NAUTILUS_METADATA_KEY_EXPLICIT_APPLICATION, + NAUTILUS_METADATA_SUBKEY_APPLICATION_ID); nautilus_directory_unref (directory); mime_type = get_mime_type_from_uri (uri); @@ -779,9 +789,15 @@ nautilus_mime_set_short_list_applications_for_uri (const char *uri, nautilus_directory_wait_for_metadata (directory); nautilus_directory_set_metadata_list - (directory, NAUTILUS_METADATA_KEY_SHORT_LIST_APPLICATION_ADD, NAUTILUS_METADATA_SUBKEY_APPLICATION_ID, add_list); + (directory, + NAUTILUS_METADATA_KEY_SHORT_LIST_APPLICATION_ADD, + NAUTILUS_METADATA_SUBKEY_APPLICATION_ID, + add_list); nautilus_directory_set_metadata_list - (directory, NAUTILUS_METADATA_KEY_SHORT_LIST_APPLICATION_REMOVE, NAUTILUS_METADATA_SUBKEY_APPLICATION_ID, remove_list); + (directory, + NAUTILUS_METADATA_KEY_SHORT_LIST_APPLICATION_REMOVE, + NAUTILUS_METADATA_SUBKEY_APPLICATION_ID, + remove_list); nautilus_directory_unref (directory); /* FIXME bugzilla.eazel.com 1269: @@ -823,9 +839,15 @@ nautilus_mime_set_short_list_components_for_uri (const char *uri, nautilus_directory_wait_for_metadata (directory); nautilus_directory_set_metadata_list - (directory, NAUTILUS_METADATA_KEY_SHORT_LIST_COMPONENT_ADD, NAUTILUS_METADATA_SUBKEY_COMPONENT_IID, add_list); + (directory, + NAUTILUS_METADATA_KEY_SHORT_LIST_COMPONENT_ADD, + NAUTILUS_METADATA_SUBKEY_COMPONENT_IID, + add_list); nautilus_directory_set_metadata_list - (directory, NAUTILUS_METADATA_KEY_SHORT_LIST_COMPONENT_REMOVE, NAUTILUS_METADATA_SUBKEY_COMPONENT_IID, remove_list); + (directory, + NAUTILUS_METADATA_KEY_SHORT_LIST_COMPONENT_REMOVE, + NAUTILUS_METADATA_SUBKEY_COMPONENT_IID, + remove_list); nautilus_directory_unref (directory); /* FIXME bugzilla.eazel.com 1269: @@ -1064,7 +1086,9 @@ get_explicit_content_view_iids_from_metafile (NautilusDirectory *directory) { if (directory != NULL) { return nautilus_directory_get_metadata_list - (directory, NAUTILUS_METADATA_KEY_EXPLICIT_COMPONENT, NAUTILUS_METADATA_SUBKEY_COMPONENT_IID); + (directory, + NAUTILUS_METADATA_KEY_EXPLICIT_COMPONENT, + NAUTILUS_METADATA_SUBKEY_COMPONENT_IID); } else { return NULL; } @@ -1457,42 +1481,34 @@ get_mime_type_from_uri (const char *text_uri) GnomeVFSURI *vfs_uri; GnomeVFSFileInfo *file_info; GnomeVFSResult result; - const char *ctype; char *type; - if (text_uri == NULL) { - return NULL; - } - type = NULL; - /* FIXME bugzilla.eazel.com 1263: - A better way would be to get this info using - NautilusFile or NautilusDirectory or something, having - previously ensured that the info has been computed - async. */ - - vfs_uri = gnome_vfs_uri_new (text_uri); - - if (vfs_uri != NULL) { - file_info = gnome_vfs_file_info_new (); + if (text_uri != NULL) { + /* FIXME bugzilla.eazel.com 1263: + A better way would be to get this info using + NautilusFile or NautilusDirectory or something, having + previously ensured that the info has been computed + async. */ - result = gnome_vfs_get_file_info_uri (vfs_uri, file_info, - GNOME_VFS_FILE_INFO_GET_MIME_TYPE - | GNOME_VFS_FILE_INFO_FOLLOW_LINKS); - if (result == GNOME_VFS_OK) { - ctype = gnome_vfs_file_info_get_mime_type (file_info); + vfs_uri = gnome_vfs_uri_new (text_uri); + + if (vfs_uri != NULL) { + file_info = gnome_vfs_file_info_new (); - if (ctype != NULL) { - type = g_strdup (ctype); + result = gnome_vfs_get_file_info_uri (vfs_uri, file_info, + GNOME_VFS_FILE_INFO_GET_MIME_TYPE + | GNOME_VFS_FILE_INFO_FOLLOW_LINKS); + if (result == GNOME_VFS_OK) { + type = g_strdup (gnome_vfs_file_info_get_mime_type (file_info)); + gnome_vfs_file_info_unref (file_info); + gnome_vfs_uri_unref (vfs_uri); } - - gnome_vfs_file_info_unref (file_info); - gnome_vfs_uri_unref (vfs_uri); - } + } } - return type; + return type == NULL ? g_strdup ("application/octet-stream") : type; } static int |