diff options
author | Maciej Stachowiak <mstachow@src.gnome.org> | 2000-10-12 16:16:15 +0000 |
---|---|---|
committer | Maciej Stachowiak <mstachow@src.gnome.org> | 2000-10-12 16:16:15 +0000 |
commit | 36e750319cd7124dd7ec84d37211caba84492244 (patch) | |
tree | 10b5a70e249916959ec30bf69cf026fcbe17f6ca /libnautilus-private/nautilus-mime-actions.c | |
parent | 109fb545c66e3897a55b9bd8697e42ce6ba4fcfd (diff) | |
download | nautilus-36e750319cd7124dd7ec84d37211caba84492244.tar.gz |
Bye bye to directory metadata. (set_metadata_string_in_metafile): don't
* libnautilus-extensions/nautilus-directory-metafile.h,
libnautilus-extensions/nautilus-directory-metafile.c
(nautilus_directory_get_metadata, nautilus_directory_set_metadata,
nautilus_directory_get_metadata_list,
nautilus_directory_set_metadata_list,
nautilus_directory_get_boolean_metadata,
nautilus_directory_set_boolean_metadata,
nautilus_directory_get_integer_metadata,
nautilus_directory_set_integer__metadata): Bye bye to directory
metadata.
(set_metadata_string_in_metafile): don't worry about the directory
metadata case any more.
(nautilus_directory_get_boolean_file_metadata,
nautilus_directory_set_boolean_file_metadata,
nautilus_directory_get_integer_file_metadata,
nautilus_directory_set_integer_file_metadata): Helper functions
for implementing NautilusFile metadata convenience wrappers.
* libnautilus-extensions/nautilus-file.h,
libnautilus-extensions/nautilus-file.c:
(nautilus_file_get_boolean_metadata,
nautilus_file_get_integer_metadata,
nautilus_file_set_boolean_metadata,
nautilus_file_set_integer_metadata): Convenience wrappers for
boolean or integer file metadata.
* libnautilus-extensions/nautilus-directory.h,
libnautilus-extensions/nautilus-directory.c
(nautilus_directory_initialize_class,
nautilus_directory_emit_metadata_changed): removed
"metadata_changed" signal.
(got_metadata_callback): Don't assert the file list is NULL.
(nautilus_self_check_directory): Use file metadata API.
* libnautilus-extensions/nautilus-metadata.h: No more
per-directory metadata, it's all per file now.
* libnautilus-extensions/nautilus-directory-background.h,
libnautilus-extensions/nautilus-directory-background.c
(nautilus_file_background_set_desktop,
nautilus_file_background_is_desktop,
nautilus_file_background_peek_theme_source,
nautilus_file_background_get_default_settings,
nautilus_file_background_read_desktop_settings,
nautilus_file_background_write_desktop_settings,
nautilus_file_background_write_desktop_default_settings,
call_settings_changed, nautilus_file_background_event_filter,
desktop_background_destroyed_callback,
nautilus_file_background_receive_root_window_changes,
nautilus_file_update_root_window, nautilus_file_background_is_set,
background_changed_callback, saved_settings_changed_callback,
nautilus_file_background_theme_changed, background_reset_callback,
background_destroyed_callback,
nautilus_connect_background_to_file_metadata,
nautilus_connect_desktop_background_to_file_metadata,
nautilus_connect_background_to_file_metadata_by_uri): Work off of
file metadata, not directory metadata, and thus take a
NautilusFile not a NautilusDirectory.
* libnautilus-extensions/nautilus-mime-actions.c:
(nautilus_file_wait_for_metadata,
nautilus_mime_get_default_action_type_for_uri,
nautilus_mime_get_default_application_for_uri_internal,
nautilus_mime_get_default_component_for_uri_internal,
nautilus_mime_get_short_list_applications_for_uri,
nautilus_mime_get_short_list_components_for_uri,
nautilus_mime_get_all_applications_for_uri,
nautilus_mime_get_all_components_for_uri,
nautilus_mime_set_default_action_type_for_uri,
nautilus_mime_set_default_application_for_uri,
nautilus_mime_set_default_component_for_uri,
nautilus_mime_set_short_list_applications_for_uri,
nautilus_mime_set_short_list_components_for_uri,
nautilus_mime_extend_all_applications_for_uri,
nautilus_mime_remove_from_all_applications_for_uri,
get_explicit_content_view_iids_from_metafile): Use file metadata,
not directory metadata.
* src/file-manager/fm-directory-view.h,
src/file-manager/fm-directory-view.c
(fm_directory_view_get_directory_as_file): Function to access the
NautilusFile we now keep around that represents the directory
itself.
(fm_directory_view_initialize_class, files_have_any_custom_images,
compute_menu_item_info, fm_directory_view_activate_file,
fm_directory_view_load_uri, metadata_ready_callback,
disconnect_model_handlers, fm_directory_view_real_is_read_only,
showing_trash_directory): Use file metadata, not directory
metadata, and use the new `directory_as_file' field where
appropriate.
(finish_loading_uri): Monitor more files attributes (the ones
needed to get an icon, plus ones we might actually display in a
directory view.
* src/file-manager/fm-desktop-icon-view.c
(fm_desktop_icon_view_create_background_context_menu_items): Use
file metadata not directory metadata.
* src/file-manager/fm-icon-view.h,
src/file-manager/fm-icon-view.c: (set_sort_criterion,
tighter_layout_callback, fm_icon_view_get_directory_sort_by,
fm_icon_view_real_get_directory_sort_by,
fm_icon_view_set_directory_sort_by,
fm_icon_view_real_set_directory_sort_by,
fm_icon_view_get_directory_sort_reversed,
fm_icon_view_real_get_directory_sort_reversed,
fm_icon_view_set_directory_sort_reversed,
fm_icon_view_real_set_directory_sort_reversed,
fm_icon_view_get_directory_auto_layout,
fm_icon_view_real_get_directory_auto_layout,
fm_icon_view_set_directory_auto_layout,
fm_icon_view_real_set_directory_auto_layout,
fm_icon_view_get_directory_tighter_layout,
fm_icon_view_real_get_directory_tighter_layout,
fm_icon_view_set_directory_tighter_layout,
fm_icon_view_real_set_directory_tighter_layout, set_sort_reversed,
fm_icon_view_begin_loading, fm_icon_view_set_zoom_level,
sort_direction_callback, layout_changed_callback,
icon_container_preview_callback, icon_position_changed_callback):
Use file metadata not directory metadata.
* src/file-manager/fm-list-view.c: (fm_list_view_begin_loading,
fm_list_view_set_zoom_level, fm_list_view_sort_items): Use file
metadata not directory metadata.
* src/file-manager/fm-search-list-view.c (real_adding_file): Tweak
the code that monitors file attributes.
* components/music/nautilus-music-view.c
(nautilus_music_view_update_from_uri): Use the new
nautilus_file_background API.
Diffstat (limited to 'libnautilus-private/nautilus-mime-actions.c')
-rw-r--r-- | libnautilus-private/nautilus-mime-actions.c | 140 |
1 files changed, 71 insertions, 69 deletions
diff --git a/libnautilus-private/nautilus-mime-actions.c b/libnautilus-private/nautilus-mime-actions.c index 60fe4b3f3..2533a9ac1 100644 --- a/libnautilus-private/nautilus-mime-actions.c +++ b/libnautilus-private/nautilus-mime-actions.c @@ -53,7 +53,7 @@ static char *extract_prefix_add_suffix (const char const char *suffix); static char *mime_type_get_supertype (const char *mime_type); static char *uri_string_get_scheme (const char *uri_string); -static GList *get_explicit_content_view_iids_from_metafile (NautilusDirectory *directory); +static GList *get_explicit_content_view_iids_from_metafile (NautilusFile *file); static char *make_oaf_query_for_explicit_content_view_iids (GList *view_iids); static char *make_oaf_query_with_known_mime_type (const char *mime_type, const char *uri_scheme, @@ -99,9 +99,8 @@ is_known_mime_type (const char *mime_type) } static void -nautilus_directory_wait_for_metadata (NautilusDirectory *directory) +nautilus_file_wait_for_metadata (NautilusFile *file) { - GList *file_list; GList *attributes; /* When nautilus_directory_wait_until_ready is called this way, it @@ -111,9 +110,8 @@ nautilus_directory_wait_for_metadata (NautilusDirectory *directory) */ attributes = g_list_append (NULL, NAUTILUS_FILE_ATTRIBUTE_METADATA); - file_list = nautilus_directory_wait_until_ready (directory, attributes); + nautilus_file_wait_until_ready (file, attributes); g_list_free (attributes); - nautilus_file_list_free (file_list); } GnomeVFSMimeActionType @@ -124,9 +122,10 @@ nautilus_mime_get_default_action_type_for_uri (NautilusDirectory *directory, char *action_type_string; GnomeVFSMimeActionType action_type; - nautilus_directory_wait_for_metadata (directory); - action_type_string = nautilus_directory_get_metadata - (directory, NAUTILUS_METADATA_KEY_DEFAULT_ACTION_TYPE, NULL); + nautilus_file_wait_for_metadata (file); + + action_type_string = nautilus_file_get_metadata + (file, NAUTILUS_METADATA_KEY_DEFAULT_ACTION_TYPE, NULL); if (action_type_string == NULL) { mime_type = get_mime_type_from_file (file); @@ -194,9 +193,9 @@ nautilus_mime_get_default_application_for_uri_internal (NautilusDirectory *direc used_user_chosen_info = TRUE; - nautilus_directory_wait_for_metadata (directory); - default_application_string = nautilus_directory_get_metadata - (directory, NAUTILUS_METADATA_KEY_DEFAULT_APPLICATION, NULL); + nautilus_file_wait_for_metadata (file); + default_application_string = nautilus_file_get_metadata + (file, NAUTILUS_METADATA_KEY_DEFAULT_APPLICATION, NULL); if (default_application_string == NULL) { mime_type = get_mime_type_from_file (file); @@ -278,17 +277,18 @@ nautilus_mime_get_default_component_for_uri_internal (NautilusDirectory *directo g_free (uri); + nautilus_file_wait_for_metadata (file); + explicit_iids = get_explicit_content_view_iids_from_metafile (file); + /* Arrange for all the file attributes we will need. */ attributes = NULL; attributes = g_list_prepend (attributes, NAUTILUS_FILE_ATTRIBUTE_MIME_TYPE); - attributes = g_list_append (NULL, NAUTILUS_FILE_ATTRIBUTE_METADATA); - files = nautilus_directory_wait_until_ready (directory, attributes); - default_component_string = nautilus_directory_get_metadata - (directory, NAUTILUS_METADATA_KEY_DEFAULT_COMPONENT, NULL); - explicit_iids = get_explicit_content_view_iids_from_metafile (directory); g_list_free (attributes); + default_component_string = nautilus_file_get_metadata + (file, NAUTILUS_METADATA_KEY_DEFAULT_COMPONENT, NULL); + if (default_component_string == NULL && is_known_mime_type (mime_type)) { mime_default = gnome_vfs_mime_get_default_component (mime_type); if (mime_default != NULL) { @@ -438,13 +438,13 @@ nautilus_mime_get_short_list_applications_for_uri (NautilusDirectory *directory, CORBA_exception_init (&ev); - nautilus_directory_wait_for_metadata (directory); - metadata_application_add_ids = nautilus_directory_get_metadata_list - (directory, + nautilus_file_wait_for_metadata (file); + metadata_application_add_ids = nautilus_file_get_metadata_list + (file, NAUTILUS_METADATA_KEY_SHORT_LIST_APPLICATION_ADD, NAUTILUS_METADATA_SUBKEY_APPLICATION_ID); - metadata_application_remove_ids = nautilus_directory_get_metadata_list - (directory, + metadata_application_remove_ids = nautilus_file_get_metadata_list + (file, NAUTILUS_METADATA_KEY_SHORT_LIST_APPLICATION_REMOVE, NAUTILUS_METADATA_SUBKEY_APPLICATION_ID); @@ -507,21 +507,22 @@ nautilus_mime_get_short_list_components_for_uri (NautilusDirectory *directory, g_free (uri); + nautilus_file_wait_for_metadata (file); + explicit_iids = get_explicit_content_view_iids_from_metafile (file); + /* Arrange for all the file attributes we will need. */ attributes = NULL; attributes = g_list_prepend (attributes, NAUTILUS_FILE_ATTRIBUTE_MIME_TYPE); - attributes = g_list_append (NULL, NAUTILUS_FILE_ATTRIBUTE_METADATA); - files = nautilus_directory_wait_until_ready (directory, attributes); - explicit_iids = get_explicit_content_view_iids_from_metafile (directory); g_list_free (attributes); - metadata_component_add_ids = nautilus_directory_get_metadata_list - (directory, + + metadata_component_add_ids = nautilus_file_get_metadata_list + (file, NAUTILUS_METADATA_KEY_SHORT_LIST_COMPONENT_ADD, NAUTILUS_METADATA_SUBKEY_COMPONENT_IID); - metadata_component_remove_ids = nautilus_directory_get_metadata_list - (directory, + metadata_component_remove_ids = nautilus_file_get_metadata_list + (file, NAUTILUS_METADATA_KEY_SHORT_LIST_COMPONENT_REMOVE, NAUTILUS_METADATA_SUBKEY_COMPONENT_IID); @@ -608,9 +609,9 @@ nautilus_mime_get_all_applications_for_uri (NautilusDirectory *directory, GList *p; GnomeVFSMimeApplication *application; - nautilus_directory_wait_for_metadata (directory); - metadata_application_ids = nautilus_directory_get_metadata_list - (directory, + nautilus_file_wait_for_metadata (file); + metadata_application_ids = nautilus_file_get_metadata_list + (file, NAUTILUS_METADATA_KEY_EXPLICIT_APPLICATION, NAUTILUS_METADATA_SUBKEY_APPLICATION_ID); @@ -668,14 +669,15 @@ nautilus_mime_get_all_components_for_uri (NautilusDirectory *directory, uri = nautilus_file_get_uri (file); uri_scheme = uri_string_get_scheme (uri); g_free (uri); + + nautilus_file_wait_for_metadata (file); + explicit_iids = get_explicit_content_view_iids_from_metafile (file); /* Arrange for all the file attributes we will need. */ attributes = NULL; attributes = g_list_prepend (attributes, NAUTILUS_FILE_ATTRIBUTE_MIME_TYPE); - attributes = g_list_append (NULL, NAUTILUS_FILE_ATTRIBUTE_METADATA); files = nautilus_directory_wait_until_ready (directory, attributes); - explicit_iids = get_explicit_content_view_iids_from_metafile (directory); g_list_free (attributes); info_list = nautilus_do_component_query (mime_type, uri_scheme, files, explicit_iids, NULL, NULL, &ev); @@ -721,9 +723,9 @@ nautilus_mime_set_default_action_type_for_uri (NautilusDirectory *directory action_string = "none"; } - nautilus_directory_wait_for_metadata (directory); - nautilus_directory_set_metadata - (directory, NAUTILUS_METADATA_KEY_DEFAULT_ACTION_TYPE, NULL, action_string); + nautilus_file_wait_for_metadata (file); + nautilus_file_set_metadata + (file, NAUTILUS_METADATA_KEY_DEFAULT_ACTION_TYPE, NULL, action_string); return GNOME_VFS_OK; } @@ -733,9 +735,9 @@ nautilus_mime_set_default_application_for_uri (NautilusDirectory *directory, NautilusFile *file, const char *application_id) { - nautilus_directory_wait_for_metadata (directory); - nautilus_directory_set_metadata - (directory, NAUTILUS_METADATA_KEY_DEFAULT_APPLICATION, NULL, application_id); + nautilus_file_wait_for_metadata (file); + nautilus_file_set_metadata + (file, NAUTILUS_METADATA_KEY_DEFAULT_APPLICATION, NULL, application_id); /* If there's no default action type, set it to match this. */ if (application_id != NULL && @@ -751,9 +753,9 @@ nautilus_mime_set_default_component_for_uri (NautilusDirectory *directory, NautilusFile *file, const char *component_iid) { - nautilus_directory_wait_for_metadata (directory); - nautilus_directory_set_metadata - (directory, NAUTILUS_METADATA_KEY_DEFAULT_COMPONENT, NULL, component_iid); + nautilus_file_wait_for_metadata (file); + nautilus_file_set_metadata + (file, NAUTILUS_METADATA_KEY_DEFAULT_COMPONENT, NULL, component_iid); /* If there's no default action type, set it to match this. */ if (component_iid != NULL && @@ -792,14 +794,14 @@ nautilus_mime_set_short_list_applications_for_uri (NautilusDirectory *directory, add_list = str_list_difference (applications, normal_short_list_ids); remove_list = str_list_difference (normal_short_list_ids, applications); - nautilus_directory_wait_for_metadata (directory); - nautilus_directory_set_metadata_list - (directory, + nautilus_file_wait_for_metadata (file); + nautilus_file_set_metadata_list + (file, NAUTILUS_METADATA_KEY_SHORT_LIST_APPLICATION_ADD, NAUTILUS_METADATA_SUBKEY_APPLICATION_ID, add_list); - nautilus_directory_set_metadata_list - (directory, + nautilus_file_set_metadata_list + (file, NAUTILUS_METADATA_KEY_SHORT_LIST_APPLICATION_REMOVE, NAUTILUS_METADATA_SUBKEY_APPLICATION_ID, remove_list); @@ -839,14 +841,14 @@ nautilus_mime_set_short_list_components_for_uri (NautilusDirectory *directory, add_list = str_list_difference (components, normal_short_list_ids); remove_list = str_list_difference (normal_short_list_ids, components); - nautilus_directory_wait_for_metadata (directory); - nautilus_directory_set_metadata_list - (directory, + nautilus_file_wait_for_metadata (file); + nautilus_file_set_metadata_list + (file, NAUTILUS_METADATA_KEY_SHORT_LIST_COMPONENT_ADD, NAUTILUS_METADATA_SUBKEY_COMPONENT_IID, add_list); - nautilus_directory_set_metadata_list - (directory, + nautilus_file_set_metadata_list + (file, NAUTILUS_METADATA_KEY_SHORT_LIST_COMPONENT_REMOVE, NAUTILUS_METADATA_SUBKEY_COMPONENT_IID, remove_list); @@ -967,10 +969,10 @@ nautilus_mime_extend_all_applications_for_uri (NautilusDirectory *directory, GList *extras; GList *final_applications; - nautilus_directory_wait_for_metadata (directory); + nautilus_file_wait_for_metadata (file); - metadata_application_ids = nautilus_directory_get_metadata_list - (directory, + metadata_application_ids = nautilus_file_get_metadata_list + (file, NAUTILUS_METADATA_KEY_EXPLICIT_APPLICATION, NAUTILUS_METADATA_SUBKEY_APPLICATION_ID); @@ -978,8 +980,8 @@ nautilus_mime_extend_all_applications_for_uri (NautilusDirectory *directory, final_applications = g_list_concat (g_list_copy (metadata_application_ids), extras); - nautilus_directory_set_metadata_list - (directory, + nautilus_file_set_metadata_list + (file, NAUTILUS_METADATA_KEY_EXPLICIT_APPLICATION, NAUTILUS_METADATA_SUBKEY_APPLICATION_ID, final_applications); @@ -995,21 +997,21 @@ nautilus_mime_remove_from_all_applications_for_uri (NautilusDirectory *directory GList *metadata_application_ids; GList *final_applications; - nautilus_directory_wait_for_metadata (directory); + nautilus_file_wait_for_metadata (file); - metadata_application_ids = nautilus_directory_get_metadata_list - (directory, + metadata_application_ids = nautilus_file_get_metadata_list + (file, NAUTILUS_METADATA_KEY_EXPLICIT_APPLICATION, NAUTILUS_METADATA_SUBKEY_APPLICATION_ID); - + final_applications = str_list_difference (metadata_application_ids, applications); - - nautilus_directory_set_metadata_list - (directory, + + nautilus_file_set_metadata_list + (file, NAUTILUS_METADATA_KEY_EXPLICIT_APPLICATION, NAUTILUS_METADATA_SUBKEY_APPLICATION_ID, final_applications); - + return GNOME_VFS_OK; } @@ -1091,11 +1093,11 @@ uri_string_get_scheme (const char *uri_string) */ static GList * -get_explicit_content_view_iids_from_metafile (NautilusDirectory *directory) +get_explicit_content_view_iids_from_metafile (NautilusFile *file) { - if (directory != NULL) { - return nautilus_directory_get_metadata_list - (directory, + if (file != NULL) { + return nautilus_file_get_metadata_list + (file, NAUTILUS_METADATA_KEY_EXPLICIT_COMPONENT, NAUTILUS_METADATA_SUBKEY_COMPONENT_IID); } else { |