mirror of
https://gitlab.gnome.org/GNOME/nautilus
synced 2024-08-25 02:36:07 +00:00
Rename NAUTILUS_FILE_ATTRIBUTE_FAST_MIME_TYPE to
* libnautilus-extensions/nautilus-file-attributes.h: Rename NAUTILUS_FILE_ATTRIBUTE_FAST_MIME_TYPE to NAUTILUS_FILE_ATTRIBUTE_MIME_TYPE; add NAUTILUS_FILE_ATTRIBUTE_SLOW_MIME_TYPE, for now just a synonym for NAUTILUS_FILE_ATTRIBUTE_MIME_TYPE. * libnautilus-extensions/nautilus-directory-async.c: (set_up_request_by_file_attributes): Handle the new file attributes. * libnautilus-extensions/nautilus-directory.h: move nautilus_directory_wait_until_ready call to nautilus-wait-until-ready.h * libnautilus-extensions/nautilus-directory.c: (nautilus_self_check_directory): Include nautilus-wait-until-ready.h, use new attributes. * libnautilus-extensions/nautilus-wait-until-ready.h: New header for the deprecated wait_until_ready calls. * libnautilus-extensions/nautilus-file.c: (nautilus_file_wait_until_ready): file equivalent of nautilus_directory_wait_until_ready; temporary to help me refactor. (file_wait_until_ready_callback): helper function. * libnautilus-extensions/Makefile.am: Add nautilus-wait-until-ready.h * libnautilus-extensions/nautilus-icon-factory.c: (nautilus_icon_factory_get_required_file_attributes): Use new attribute for mime type. * libnautilus-extensions/nautilus-mime-actions.h, libnautilus-extensions/nautilus-mime-actions.c: (nautilus_mime_get_default_action_type_for_uri), (nautilus_mime_get_default_action_for_uri), (nautilus_mime_get_default_application_for_uri_internal), (nautilus_mime_get_default_application_for_uri), (nautilus_mime_is_default_application_for_uri_user_chosen), (nautilus_mime_get_default_component_for_uri_internal), (nautilus_mime_get_default_component_for_uri), (nautilus_mime_is_default_component_for_uri_user_chosen), (nautilus_mime_get_short_list_applications_for_uri), (nautilus_mime_get_short_list_components_for_uri), (nautilus_mime_get_short_list_methods_for_uri), (nautilus_mime_get_all_applications_for_uri), (nautilus_mime_has_any_applications_for_uri), (nautilus_mime_get_all_components_for_uri), (nautilus_mime_has_any_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_add_application_to_short_list_for_uri), (nautilus_mime_remove_application_from_short_list_for_uri), (nautilus_mime_add_component_to_short_list_for_uri), (nautilus_mime_remove_component_from_short_list_for_uri), (nautilus_mime_extend_all_applications_for_uri), (nautilus_mime_remove_from_all_applications_for_uri): All these functions now take a NautilusDirectory and a NautilusFile, rather than a URI. (gnome_vfs_mime_application_has_id), (gnome_vfs_mime_id_matches_application), (gnome_vfs_mime_application_has_id_not_in_list), (string_not_in_list), (extract_prefix_add_suffix), (make_oaf_query_with_known_mime_type), (make_oaf_query_with_uri_scheme_only), (free_key), (server_matches_content_requirements), (nautilus_do_component_query), (str_list_difference), (strv_concat): Reformatted. (get_mime_type_from_file): Changed from get_mime_type_from_uri; uses nautilus_file_wait_until_ready instead of synchronous I/O. * libnautilus-extensions/nautilus-program-chooser.c: (repopulate_program_list), (is_application_default_for_uri), (is_component_default_for_uri), (is_component_in_short_list_for_uri), (is_application_in_short_list_for_uri), (program_file_pair_is_default_for_file), (add_to_short_list_for_file), (remove_from_short_list_for_file), (remove_default_for_item), (set_default_for_item): * libnautilus-extensions/nautilus-program-choosing.c: (any_programs_available_for_file): * libnautilus-extensions/nautilus-wait-until-ready.h: * src/file-manager/fm-directory-view.c: (switch_location_and_view), (create_open_with_gtk_menu), (reset_bonobo_open_with_menu), (activate_callback): * src/nautilus-applicable-views.c: (got_file_info_callback), (nautilus_navigation_info_new), (nautilus_navigation_info_free): * src/nautilus-applicable-views.h: * src/nautilus-sidebar.c: (nautilus_sidebar_update_buttons): * src/nautilus-theme-selector.c: (add_theme_to_icons): * src/nautilus-window.c: (nautilus_window_switch_views), (nautilus_window_load_content_view_menu): * test/test-nautilus-mime-actions-set.c: (main): * test/test-nautilus-mime-actions.c: (main): Deal with above API changes.
This commit is contained in:
parent
7c137cffa9
commit
63abb313ef
102
ChangeLog
102
ChangeLog
|
@ -1,3 +1,105 @@
|
|||
2000-09-27 Maciej Stachowiak <mjs@eazel.com>
|
||||
|
||||
* libnautilus-extensions/nautilus-file-attributes.h: Rename
|
||||
NAUTILUS_FILE_ATTRIBUTE_FAST_MIME_TYPE to
|
||||
NAUTILUS_FILE_ATTRIBUTE_MIME_TYPE; add
|
||||
NAUTILUS_FILE_ATTRIBUTE_SLOW_MIME_TYPE, for now just a synonym for
|
||||
NAUTILUS_FILE_ATTRIBUTE_MIME_TYPE.
|
||||
* libnautilus-extensions/nautilus-directory-async.c:
|
||||
(set_up_request_by_file_attributes): Handle the new file
|
||||
attributes.
|
||||
* libnautilus-extensions/nautilus-directory.h: move
|
||||
nautilus_directory_wait_until_ready call to
|
||||
nautilus-wait-until-ready.h
|
||||
|
||||
* libnautilus-extensions/nautilus-directory.c:
|
||||
(nautilus_self_check_directory): Include
|
||||
nautilus-wait-until-ready.h, use new attributes.
|
||||
|
||||
* libnautilus-extensions/nautilus-wait-until-ready.h: New header
|
||||
for the deprecated wait_until_ready calls.
|
||||
|
||||
* libnautilus-extensions/nautilus-file.c:
|
||||
(nautilus_file_wait_until_ready): file equivalent of
|
||||
nautilus_directory_wait_until_ready; temporary to help me
|
||||
refactor.
|
||||
(file_wait_until_ready_callback): helper function.
|
||||
|
||||
* libnautilus-extensions/Makefile.am: Add
|
||||
nautilus-wait-until-ready.h
|
||||
|
||||
* libnautilus-extensions/nautilus-icon-factory.c:
|
||||
(nautilus_icon_factory_get_required_file_attributes): Use new
|
||||
attribute for mime type.
|
||||
|
||||
* libnautilus-extensions/nautilus-mime-actions.h,
|
||||
libnautilus-extensions/nautilus-mime-actions.c:
|
||||
(nautilus_mime_get_default_action_type_for_uri),
|
||||
(nautilus_mime_get_default_action_for_uri),
|
||||
(nautilus_mime_get_default_application_for_uri_internal),
|
||||
(nautilus_mime_get_default_application_for_uri),
|
||||
(nautilus_mime_is_default_application_for_uri_user_chosen),
|
||||
(nautilus_mime_get_default_component_for_uri_internal),
|
||||
(nautilus_mime_get_default_component_for_uri),
|
||||
(nautilus_mime_is_default_component_for_uri_user_chosen),
|
||||
(nautilus_mime_get_short_list_applications_for_uri),
|
||||
(nautilus_mime_get_short_list_components_for_uri),
|
||||
(nautilus_mime_get_short_list_methods_for_uri),
|
||||
(nautilus_mime_get_all_applications_for_uri),
|
||||
(nautilus_mime_has_any_applications_for_uri),
|
||||
(nautilus_mime_get_all_components_for_uri),
|
||||
(nautilus_mime_has_any_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_add_application_to_short_list_for_uri),
|
||||
(nautilus_mime_remove_application_from_short_list_for_uri),
|
||||
(nautilus_mime_add_component_to_short_list_for_uri),
|
||||
(nautilus_mime_remove_component_from_short_list_for_uri),
|
||||
(nautilus_mime_extend_all_applications_for_uri),
|
||||
(nautilus_mime_remove_from_all_applications_for_uri): All these
|
||||
functions now take a NautilusDirectory and a NautilusFile, rather
|
||||
than a URI.
|
||||
|
||||
(gnome_vfs_mime_application_has_id),
|
||||
(gnome_vfs_mime_id_matches_application),
|
||||
(gnome_vfs_mime_application_has_id_not_in_list),
|
||||
(string_not_in_list), (extract_prefix_add_suffix),
|
||||
(make_oaf_query_with_known_mime_type),
|
||||
(make_oaf_query_with_uri_scheme_only), (free_key),
|
||||
(server_matches_content_requirements),
|
||||
(nautilus_do_component_query), (str_list_difference),
|
||||
(strv_concat): Reformatted.
|
||||
|
||||
(get_mime_type_from_file): Changed from get_mime_type_from_uri;
|
||||
uses nautilus_file_wait_until_ready instead of synchronous I/O.
|
||||
|
||||
* libnautilus-extensions/nautilus-program-chooser.c:
|
||||
(repopulate_program_list), (is_application_default_for_uri),
|
||||
(is_component_default_for_uri),
|
||||
(is_component_in_short_list_for_uri),
|
||||
(is_application_in_short_list_for_uri),
|
||||
(program_file_pair_is_default_for_file),
|
||||
(add_to_short_list_for_file), (remove_from_short_list_for_file),
|
||||
(remove_default_for_item), (set_default_for_item):
|
||||
* libnautilus-extensions/nautilus-program-choosing.c:
|
||||
(any_programs_available_for_file):
|
||||
* libnautilus-extensions/nautilus-wait-until-ready.h:
|
||||
* src/file-manager/fm-directory-view.c: (switch_location_and_view),
|
||||
(create_open_with_gtk_menu), (reset_bonobo_open_with_menu),
|
||||
(activate_callback):
|
||||
* src/nautilus-applicable-views.c: (got_file_info_callback),
|
||||
(nautilus_navigation_info_new), (nautilus_navigation_info_free):
|
||||
* src/nautilus-applicable-views.h:
|
||||
* src/nautilus-sidebar.c: (nautilus_sidebar_update_buttons):
|
||||
* src/nautilus-theme-selector.c: (add_theme_to_icons):
|
||||
* src/nautilus-window.c: (nautilus_window_switch_views),
|
||||
(nautilus_window_load_content_view_menu):
|
||||
* test/test-nautilus-mime-actions-set.c: (main):
|
||||
* test/test-nautilus-mime-actions.c: (main): Deal with above API changes.
|
||||
|
||||
2000-09-27 Ramiro Estrugo <ramiro@eazel.com>
|
||||
|
||||
* librsvg/Makefile.am:
|
||||
|
|
|
@ -225,6 +225,7 @@ noinst_HEADERS = \
|
|||
nautilus-vfs-directory.h \
|
||||
nautilus-view-identifier.h \
|
||||
nautilus-volume-monitor.h \
|
||||
nautilus-wait-until-ready.h \
|
||||
nautilus-xml-extensions.h \
|
||||
$(NULL)
|
||||
|
||||
|
|
|
@ -733,7 +733,11 @@ set_up_request_by_file_attributes (Request *request,
|
|||
nautilus_str_compare) != NULL;
|
||||
request->file_info = g_list_find_custom
|
||||
(file_attributes,
|
||||
NAUTILUS_FILE_ATTRIBUTE_FAST_MIME_TYPE,
|
||||
NAUTILUS_FILE_ATTRIBUTE_MIME_TYPE,
|
||||
nautilus_str_compare) != NULL;
|
||||
request->file_info |= g_list_find_custom
|
||||
(file_attributes,
|
||||
NAUTILUS_FILE_ATTRIBUTE_SLOW_MIME_TYPE,
|
||||
nautilus_str_compare) != NULL;
|
||||
request->file_info |= g_list_find_custom
|
||||
(file_attributes,
|
||||
|
|
|
@ -37,10 +37,12 @@
|
|||
#include "nautilus-string.h"
|
||||
#include "nautilus-trash-directory.h"
|
||||
#include "nautilus-vfs-directory.h"
|
||||
#include "nautilus-wait-until-ready.h"
|
||||
#include <ctype.h>
|
||||
#include <gtk/gtkmain.h>
|
||||
#include <gtk/gtksignal.h>
|
||||
|
||||
|
||||
enum {
|
||||
FILES_ADDED,
|
||||
FILES_CHANGED,
|
||||
|
@ -1342,7 +1344,7 @@ nautilus_self_check_directory (void)
|
|||
|
||||
got_files_flag = FALSE;
|
||||
|
||||
attributes = g_list_prepend (NULL, NAUTILUS_FILE_ATTRIBUTE_FAST_MIME_TYPE);
|
||||
attributes = g_list_prepend (NULL, NAUTILUS_FILE_ATTRIBUTE_MIME_TYPE);
|
||||
attributes = g_list_prepend (attributes, NAUTILUS_FILE_ATTRIBUTE_DEEP_COUNTS);
|
||||
nautilus_directory_call_when_ready (directory, attributes, FALSE,
|
||||
got_files_callback, &data_dummy);
|
||||
|
|
|
@ -165,9 +165,6 @@ void nautilus_directory_call_when_ready (NautilusDirectory
|
|||
gboolean wait_for_metadata,
|
||||
NautilusDirectoryCallback callback,
|
||||
gpointer callback_data);
|
||||
GList * nautilus_directory_wait_until_ready (NautilusDirectory *directory,
|
||||
GList *file_attributes,
|
||||
gboolean wait_for_metadata);
|
||||
void nautilus_directory_cancel_callback (NautilusDirectory *directory,
|
||||
NautilusDirectoryCallback callback,
|
||||
gpointer callback_data);
|
||||
|
|
|
@ -33,7 +33,8 @@
|
|||
#define NAUTILUS_FILE_ATTRIBUTE_CUSTOM_ICON "custom icon"
|
||||
#define NAUTILUS_FILE_ATTRIBUTE_DEEP_COUNTS "deep counts"
|
||||
#define NAUTILUS_FILE_ATTRIBUTE_DIRECTORY_ITEM_COUNT "directory item count"
|
||||
#define NAUTILUS_FILE_ATTRIBUTE_FAST_MIME_TYPE "MIME type"
|
||||
#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"
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include "nautilus-lib-self-check-functions.h"
|
||||
#include "nautilus-link.h"
|
||||
#include "nautilus-string.h"
|
||||
#include "nautilus-wait-until-ready.h"
|
||||
#include <ctype.h>
|
||||
#include <grp.h>
|
||||
#include <gtk/gtksignal.h>
|
||||
|
@ -3985,6 +3986,42 @@ nautilus_extract_top_left_text (const char *text,
|
|||
return g_strdup (buffer);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
static void
|
||||
file_wait_until_ready_callback (NautilusFile *file,
|
||||
gpointer callback_data)
|
||||
{
|
||||
gboolean *data;
|
||||
|
||||
data = callback_data;
|
||||
*data = TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
nautilus_file_wait_until_ready (NautilusFile *file,
|
||||
GList *file_attributes,
|
||||
gboolean wait_for_metadata)
|
||||
{
|
||||
gboolean callback_done;
|
||||
|
||||
callback_done = FALSE;
|
||||
|
||||
nautilus_file_call_when_ready
|
||||
(file, file_attributes, wait_for_metadata,
|
||||
file_wait_until_ready_callback, &callback_done);
|
||||
while (!callback_done) {
|
||||
gtk_main_iteration ();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#if !defined (NAUTILUS_OMIT_SELF_CHECK)
|
||||
|
||||
void
|
||||
|
@ -4063,3 +4100,6 @@ nautilus_self_check_file (void)
|
|||
}
|
||||
|
||||
#endif /* !NAUTILUS_OMIT_SELF_CHECK */
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1308,7 +1308,7 @@ nautilus_icon_factory_get_required_file_attributes (void)
|
|||
|
||||
attributes = g_list_prepend (NULL, NAUTILUS_FILE_ATTRIBUTE_CUSTOM_ICON);
|
||||
attributes = g_list_prepend (attributes,
|
||||
NAUTILUS_FILE_ATTRIBUTE_FAST_MIME_TYPE);
|
||||
NAUTILUS_FILE_ATTRIBUTE_MIME_TYPE);
|
||||
attributes = g_list_prepend (attributes,
|
||||
NAUTILUS_FILE_ATTRIBUTE_TOP_LEFT_TEXT);
|
||||
|
||||
|
|
|
@ -35,41 +35,54 @@
|
|||
#include "nautilus-file-attributes.h"
|
||||
#include "nautilus-glib-extensions.h"
|
||||
#include "nautilus-metadata.h"
|
||||
#include "nautilus-wait-until-ready.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
static gint gnome_vfs_mime_application_has_id (GnomeVFSMimeApplication *application, const char *id);
|
||||
static gint gnome_vfs_mime_id_matches_application (const char *id, GnomeVFSMimeApplication *application);
|
||||
static gboolean gnome_vfs_mime_application_has_id_not_in_list (GnomeVFSMimeApplication *application, GList *ids);
|
||||
static gboolean string_not_in_list (const char *str, GList *list);
|
||||
static char *extract_prefix_add_suffix (const char *string, const char *separator, 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 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, GList *explicit_iids, const char *extra_requirements);
|
||||
static char *make_oaf_query_with_uri_scheme_only (const char *uri_scheme, GList *explicit_iids, const char *extra_requirements);
|
||||
static GHashTable *file_list_to_mime_type_hash_table (GList *files);
|
||||
static void free_key (gpointer key, gpointer value, gpointer user_data);
|
||||
static void mime_type_hash_table_destroy (GHashTable *table);
|
||||
static gboolean server_matches_content_requirements (OAF_ServerInfo *server,
|
||||
GHashTable *type_table,
|
||||
GList *explicit_iids);
|
||||
static GList *nautilus_do_component_query (const char *mime_type,
|
||||
const char *uri_scheme,
|
||||
GList *files,
|
||||
GList *explicit_iids,
|
||||
char **extra_sort_criteria,
|
||||
char *extra_requirements,
|
||||
CORBA_Environment *ev);
|
||||
static GList *str_list_difference (GList *a,
|
||||
GList *b);
|
||||
static char *get_mime_type_from_uri (const char
|
||||
*text_uri);
|
||||
|
||||
static int strv_length (char **a);
|
||||
static char **strv_concat (char **a, char **b);
|
||||
static gint gnome_vfs_mime_application_has_id (GnomeVFSMimeApplication *application,
|
||||
const char *id);
|
||||
static gint gnome_vfs_mime_id_matches_application (const char *id,
|
||||
GnomeVFSMimeApplication *application);
|
||||
static gboolean gnome_vfs_mime_application_has_id_not_in_list (GnomeVFSMimeApplication *application,
|
||||
GList *ids);
|
||||
static gboolean string_not_in_list (const char *str,
|
||||
GList *list);
|
||||
static char *extract_prefix_add_suffix (const char *string,
|
||||
const char *separator,
|
||||
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 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,
|
||||
GList *explicit_iids,
|
||||
const char *extra_requirements);
|
||||
static char *make_oaf_query_with_uri_scheme_only (const char *uri_scheme,
|
||||
GList *explicit_iids,
|
||||
const char *extra_requirements);
|
||||
static GHashTable *file_list_to_mime_type_hash_table (GList *files);
|
||||
static void free_key (gpointer key,
|
||||
gpointer value,
|
||||
gpointer user_data);
|
||||
static void mime_type_hash_table_destroy (GHashTable *table);
|
||||
static gboolean server_matches_content_requirements (OAF_ServerInfo *server,
|
||||
GHashTable *type_table,
|
||||
GList *explicit_iids);
|
||||
static GList *nautilus_do_component_query (const char *mime_type,
|
||||
const char *uri_scheme,
|
||||
GList *files,
|
||||
GList *explicit_iids,
|
||||
char **extra_sort_criteria,
|
||||
char *extra_requirements,
|
||||
CORBA_Environment *ev);
|
||||
static GList *str_list_difference (GList *a,
|
||||
GList *b);
|
||||
static char *get_mime_type_from_file (NautilusFile *file);
|
||||
static int strv_length (char **a);
|
||||
static char **strv_concat (char **a,
|
||||
char **b);
|
||||
|
||||
static gboolean
|
||||
is_known_mime_type (const char *mime_type)
|
||||
|
@ -100,28 +113,19 @@ nautilus_directory_wait_for_metadata (NautilusDirectory *directory)
|
|||
}
|
||||
|
||||
GnomeVFSMimeActionType
|
||||
nautilus_mime_get_default_action_type_for_uri (const char *uri)
|
||||
nautilus_mime_get_default_action_type_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file)
|
||||
{
|
||||
char *mime_type;
|
||||
NautilusDirectory *directory;
|
||||
char *action_type_string;
|
||||
GnomeVFSMimeActionType action_type;
|
||||
|
||||
directory = nautilus_directory_get (uri);
|
||||
nautilus_directory_wait_for_metadata (directory);
|
||||
action_type_string = nautilus_directory_get_metadata
|
||||
(directory, NAUTILUS_METADATA_KEY_DEFAULT_ACTION_TYPE, NULL);
|
||||
nautilus_directory_unref (directory);
|
||||
|
||||
if (action_type_string == NULL) {
|
||||
/* FIXME bugzilla.eazel.com 1263:
|
||||
need NautilusDirectory cover for getting
|
||||
mime type, and need to tie it into the
|
||||
call_when_ready interface. Would want to use it
|
||||
here. That way we won't be computing the mime type
|
||||
over and over in the process of finding info on a
|
||||
target URI. */
|
||||
mime_type = get_mime_type_from_uri (uri);
|
||||
mime_type = get_mime_type_from_file (file);
|
||||
action_type = gnome_vfs_mime_get_default_action_type (mime_type);
|
||||
g_free (mime_type);
|
||||
return action_type;
|
||||
|
@ -137,18 +141,19 @@ nautilus_mime_get_default_action_type_for_uri (const char *uri)
|
|||
}
|
||||
|
||||
GnomeVFSMimeAction *
|
||||
nautilus_mime_get_default_action_for_uri (const char *uri)
|
||||
nautilus_mime_get_default_action_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file)
|
||||
{
|
||||
GnomeVFSMimeAction *action;
|
||||
|
||||
action = g_new0 (GnomeVFSMimeAction, 1);
|
||||
|
||||
action->action_type = nautilus_mime_get_default_action_type_for_uri (uri);
|
||||
action->action_type = nautilus_mime_get_default_action_type_for_uri (directory, file);
|
||||
|
||||
switch (action->action_type) {
|
||||
case GNOME_VFS_MIME_ACTION_TYPE_APPLICATION:
|
||||
action->action.application =
|
||||
nautilus_mime_get_default_application_for_uri (uri);
|
||||
nautilus_mime_get_default_application_for_uri (directory, file);
|
||||
if (action->action.application == NULL) {
|
||||
g_free (action);
|
||||
action = NULL;
|
||||
|
@ -156,7 +161,7 @@ nautilus_mime_get_default_action_for_uri (const char *uri)
|
|||
break;
|
||||
case GNOME_VFS_MIME_ACTION_TYPE_COMPONENT:
|
||||
action->action.component =
|
||||
nautilus_mime_get_default_component_for_uri (uri);
|
||||
nautilus_mime_get_default_component_for_uri (directory, file);
|
||||
if (action->action.component == NULL) {
|
||||
g_free (action);
|
||||
action = NULL;
|
||||
|
@ -174,32 +179,23 @@ nautilus_mime_get_default_action_for_uri (const char *uri)
|
|||
|
||||
|
||||
static GnomeVFSMimeApplication *
|
||||
nautilus_mime_get_default_application_for_uri_internal (const char *uri, gboolean *user_chosen)
|
||||
nautilus_mime_get_default_application_for_uri_internal (NautilusDirectory *directory,
|
||||
NautilusFile *file,
|
||||
gboolean *user_chosen)
|
||||
{
|
||||
char *mime_type;
|
||||
GnomeVFSMimeApplication *result;
|
||||
NautilusDirectory *directory;
|
||||
char *default_application_string;
|
||||
gboolean used_user_chosen_info;
|
||||
|
||||
used_user_chosen_info = TRUE;
|
||||
|
||||
directory = nautilus_directory_get (uri);
|
||||
|
||||
nautilus_directory_wait_for_metadata (directory);
|
||||
default_application_string = nautilus_directory_get_metadata
|
||||
(directory, NAUTILUS_METADATA_KEY_DEFAULT_APPLICATION, NULL);
|
||||
nautilus_directory_unref (directory);
|
||||
|
||||
if (default_application_string == NULL) {
|
||||
/* FIXME bugzilla.eazel.com 1263:
|
||||
need NautilusDirectory cover for getting
|
||||
mime type, and need to tie it into the
|
||||
call_when_ready interface. Would want to use it
|
||||
here. That way we won't be computing the mime type
|
||||
over and over in the process of finding info on a
|
||||
target URI. */
|
||||
mime_type = get_mime_type_from_uri (uri);
|
||||
mime_type = get_mime_type_from_file (file);
|
||||
result = gnome_vfs_mime_get_default_application (mime_type);
|
||||
g_free (mime_type);
|
||||
used_user_chosen_info = FALSE;
|
||||
|
@ -215,18 +211,20 @@ nautilus_mime_get_default_application_for_uri_internal (const char *uri, gboolea
|
|||
}
|
||||
|
||||
GnomeVFSMimeApplication *
|
||||
nautilus_mime_get_default_application_for_uri (const char *uri)
|
||||
nautilus_mime_get_default_application_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file)
|
||||
{
|
||||
return nautilus_mime_get_default_application_for_uri_internal (uri, NULL);
|
||||
return nautilus_mime_get_default_application_for_uri_internal (directory, file, NULL);
|
||||
}
|
||||
|
||||
gboolean
|
||||
nautilus_mime_is_default_application_for_uri_user_chosen (const char *uri)
|
||||
nautilus_mime_is_default_application_for_uri_user_chosen (NautilusDirectory *directory,
|
||||
NautilusFile *file)
|
||||
{
|
||||
GnomeVFSMimeApplication *application;
|
||||
gboolean user_chosen;
|
||||
|
||||
application = nautilus_mime_get_default_application_for_uri_internal (uri, &user_chosen);
|
||||
application = nautilus_mime_get_default_application_for_uri_internal (directory, file, &user_chosen);
|
||||
|
||||
/* Doesn't count as user chosen if the user-specified data is bogus and doesn't
|
||||
* result in an actual application.
|
||||
|
@ -242,12 +240,14 @@ nautilus_mime_is_default_application_for_uri_user_chosen (const char *uri)
|
|||
|
||||
|
||||
static OAF_ServerInfo *
|
||||
nautilus_mime_get_default_component_for_uri_internal (const char *uri, gboolean *user_chosen)
|
||||
nautilus_mime_get_default_component_for_uri_internal (NautilusDirectory *directory,
|
||||
NautilusFile *file,
|
||||
gboolean *user_chosen)
|
||||
{
|
||||
GList *info_list;
|
||||
OAF_ServerInfo *mime_default;
|
||||
NautilusDirectory *directory;
|
||||
char *default_component_string;
|
||||
char *uri;
|
||||
char *mime_type;
|
||||
char *uri_scheme;
|
||||
GList *files;
|
||||
|
@ -266,21 +266,23 @@ nautilus_mime_get_default_component_for_uri_internal (const char *uri, gboolean
|
|||
|
||||
CORBA_exception_init (&ev);
|
||||
|
||||
mime_type = get_mime_type_from_uri (uri);
|
||||
mime_type = get_mime_type_from_file (file);
|
||||
|
||||
uri = nautilus_file_get_uri (file);
|
||||
|
||||
uri_scheme = uri_string_get_scheme (uri);
|
||||
|
||||
directory = nautilus_directory_get (uri);
|
||||
g_free (uri);
|
||||
|
||||
/* Arrange for all the file attributes we will need. */
|
||||
attributes = NULL;
|
||||
attributes = g_list_prepend (attributes, NAUTILUS_FILE_ATTRIBUTE_FAST_MIME_TYPE);
|
||||
attributes = g_list_prepend (attributes, NAUTILUS_FILE_ATTRIBUTE_MIME_TYPE);
|
||||
|
||||
files = nautilus_directory_wait_until_ready (directory, attributes, TRUE);
|
||||
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);
|
||||
nautilus_directory_unref (directory);
|
||||
|
||||
if (default_component_string == NULL && is_known_mime_type (mime_type)) {
|
||||
mime_default = gnome_vfs_mime_get_default_component (mime_type);
|
||||
|
@ -311,7 +313,7 @@ nautilus_mime_get_default_component_for_uri_internal (const char *uri, gboolean
|
|||
|
||||
/* Prefer something from the short list */
|
||||
|
||||
short_list = nautilus_mime_get_short_list_components_for_uri (uri);
|
||||
short_list = nautilus_mime_get_short_list_components_for_uri (directory, file);
|
||||
|
||||
if (short_list != NULL) {
|
||||
sort_conditions[1] = g_strdup ("has (['");
|
||||
|
@ -388,18 +390,20 @@ nautilus_mime_get_default_component_for_uri_internal (const char *uri, gboolean
|
|||
|
||||
|
||||
OAF_ServerInfo *
|
||||
nautilus_mime_get_default_component_for_uri (const char *uri)
|
||||
nautilus_mime_get_default_component_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file)
|
||||
{
|
||||
return nautilus_mime_get_default_component_for_uri_internal (uri, NULL);
|
||||
return nautilus_mime_get_default_component_for_uri_internal (directory, file, NULL);
|
||||
}
|
||||
|
||||
gboolean
|
||||
nautilus_mime_is_default_component_for_uri_user_chosen (const char *uri)
|
||||
nautilus_mime_is_default_component_for_uri_user_chosen (NautilusDirectory *directory,
|
||||
NautilusFile *file)
|
||||
{
|
||||
OAF_ServerInfo *component;
|
||||
gboolean user_chosen;
|
||||
|
||||
component = nautilus_mime_get_default_component_for_uri_internal (uri, &user_chosen);
|
||||
component = nautilus_mime_get_default_component_for_uri_internal (directory, file, &user_chosen);
|
||||
|
||||
/* Doesn't count as user chosen if the user-specified data is bogus and doesn't
|
||||
* result in an actual component.
|
||||
|
@ -415,12 +419,12 @@ nautilus_mime_is_default_component_for_uri_user_chosen (const char *uri)
|
|||
|
||||
|
||||
GList *
|
||||
nautilus_mime_get_short_list_applications_for_uri (const char *uri)
|
||||
nautilus_mime_get_short_list_applications_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file)
|
||||
{
|
||||
char *mime_type;
|
||||
GList *result;
|
||||
GList *removed;
|
||||
NautilusDirectory *directory;
|
||||
GList *metadata_application_add_ids;
|
||||
GList *metadata_application_remove_ids;
|
||||
GList *p;
|
||||
|
@ -429,8 +433,6 @@ nautilus_mime_get_short_list_applications_for_uri (const char *uri)
|
|||
|
||||
CORBA_exception_init (&ev);
|
||||
|
||||
directory = nautilus_directory_get (uri);
|
||||
|
||||
nautilus_directory_wait_for_metadata (directory);
|
||||
metadata_application_add_ids = nautilus_directory_get_metadata_list
|
||||
(directory,
|
||||
|
@ -440,9 +442,8 @@ nautilus_mime_get_short_list_applications_for_uri (const char *uri)
|
|||
(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);
|
||||
mime_type = get_mime_type_from_file (file);
|
||||
result = gnome_vfs_mime_get_short_list_applications (mime_type);
|
||||
g_free (mime_type);
|
||||
|
||||
|
@ -472,15 +473,16 @@ nautilus_mime_get_short_list_applications_for_uri (const char *uri)
|
|||
}
|
||||
|
||||
GList *
|
||||
nautilus_mime_get_short_list_components_for_uri (const char *uri)
|
||||
nautilus_mime_get_short_list_components_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file)
|
||||
{
|
||||
char *uri;
|
||||
char *mime_type;
|
||||
char *uri_scheme;
|
||||
GList *servers;
|
||||
GList *iids;
|
||||
GList *result;
|
||||
GList *removed;
|
||||
NautilusDirectory *directory;
|
||||
GList *metadata_component_add_ids;
|
||||
GList *metadata_component_remove_ids;
|
||||
GList *p;
|
||||
|
@ -494,13 +496,15 @@ nautilus_mime_get_short_list_components_for_uri (const char *uri)
|
|||
|
||||
CORBA_exception_init (&ev);
|
||||
|
||||
uri = nautilus_file_get_uri (file);
|
||||
|
||||
uri_scheme = uri_string_get_scheme (uri);
|
||||
|
||||
directory = nautilus_directory_get (uri);
|
||||
g_free (uri);
|
||||
|
||||
/* Arrange for all the file attributes we will need. */
|
||||
attributes = NULL;
|
||||
attributes = g_list_prepend (attributes, NAUTILUS_FILE_ATTRIBUTE_FAST_MIME_TYPE);
|
||||
attributes = g_list_prepend (attributes, NAUTILUS_FILE_ATTRIBUTE_MIME_TYPE);
|
||||
|
||||
files = nautilus_directory_wait_until_ready (directory, attributes, TRUE);
|
||||
explicit_iids = get_explicit_content_view_iids_from_metafile (directory);
|
||||
|
@ -514,9 +518,8 @@ nautilus_mime_get_short_list_components_for_uri (const char *uri)
|
|||
(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);
|
||||
mime_type = get_mime_type_from_file (file);
|
||||
servers = gnome_vfs_mime_get_short_list_components (mime_type);
|
||||
iids = NULL;
|
||||
|
||||
|
@ -574,38 +577,38 @@ nautilus_mime_get_short_list_components_for_uri (const char *uri)
|
|||
return result;
|
||||
}
|
||||
|
||||
/* FIXME: we should disable this for 1.0 I think */
|
||||
|
||||
char *
|
||||
nautilus_mime_get_short_list_methods_for_uri (const char *uri)
|
||||
nautilus_mime_get_short_list_methods_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file)
|
||||
{
|
||||
char *mime_type;
|
||||
const char *method;
|
||||
|
||||
mime_type = get_mime_type_from_uri (uri);
|
||||
mime_type = get_mime_type_from_file (file);
|
||||
method = gnome_vfs_mime_get_value (mime_type, "vfs-method");
|
||||
g_free (mime_type);
|
||||
return g_strdup (method);
|
||||
}
|
||||
|
||||
GList *
|
||||
nautilus_mime_get_all_applications_for_uri (const char *uri)
|
||||
nautilus_mime_get_all_applications_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file)
|
||||
{
|
||||
char *mime_type;
|
||||
GList *result;
|
||||
NautilusDirectory *directory;
|
||||
GList *metadata_application_ids;
|
||||
GList *p;
|
||||
GnomeVFSMimeApplication *application;
|
||||
|
||||
directory = nautilus_directory_get (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);
|
||||
nautilus_directory_unref (directory);
|
||||
|
||||
mime_type = get_mime_type_from_uri (uri);
|
||||
mime_type = get_mime_type_from_file (file);
|
||||
|
||||
result = gnome_vfs_mime_get_all_applications (mime_type);
|
||||
|
||||
|
@ -626,12 +629,13 @@ nautilus_mime_get_all_applications_for_uri (const char *uri)
|
|||
}
|
||||
|
||||
gboolean
|
||||
nautilus_mime_has_any_applications_for_uri (const char *uri)
|
||||
nautilus_mime_has_any_applications_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file)
|
||||
{
|
||||
GList *list;
|
||||
gboolean result;
|
||||
|
||||
list = nautilus_mime_get_all_applications_for_uri (uri);
|
||||
list = nautilus_mime_get_all_applications_for_uri (directory, file);
|
||||
result = list != NULL;
|
||||
gnome_vfs_mime_application_list_free (list);
|
||||
|
||||
|
@ -639,27 +643,29 @@ nautilus_mime_has_any_applications_for_uri (const char *uri)
|
|||
}
|
||||
|
||||
GList *
|
||||
nautilus_mime_get_all_components_for_uri (const char *uri)
|
||||
nautilus_mime_get_all_components_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file)
|
||||
{
|
||||
char *uri;
|
||||
char *mime_type;
|
||||
char *uri_scheme;
|
||||
GList *files;
|
||||
GList *attributes;
|
||||
GList *info_list;
|
||||
NautilusDirectory *directory;
|
||||
GList *explicit_iids;
|
||||
CORBA_Environment ev;
|
||||
|
||||
CORBA_exception_init (&ev);
|
||||
|
||||
mime_type = get_mime_type_from_uri (uri);
|
||||
mime_type = get_mime_type_from_file (file);
|
||||
|
||||
uri = nautilus_file_get_uri (file);
|
||||
uri_scheme = uri_string_get_scheme (uri);
|
||||
|
||||
directory = nautilus_directory_get (uri);
|
||||
|
||||
g_free (uri);
|
||||
|
||||
/* Arrange for all the file attributes we will need. */
|
||||
attributes = NULL;
|
||||
attributes = g_list_prepend (attributes, NAUTILUS_FILE_ATTRIBUTE_FAST_MIME_TYPE);
|
||||
attributes = g_list_prepend (attributes, NAUTILUS_FILE_ATTRIBUTE_MIME_TYPE);
|
||||
|
||||
files = nautilus_directory_wait_until_ready (directory, attributes, TRUE);
|
||||
explicit_iids = get_explicit_content_view_iids_from_metafile (directory);
|
||||
|
@ -676,12 +682,13 @@ nautilus_mime_get_all_components_for_uri (const char *uri)
|
|||
}
|
||||
|
||||
gboolean
|
||||
nautilus_mime_has_any_components_for_uri (const char *uri)
|
||||
nautilus_mime_has_any_components_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file)
|
||||
{
|
||||
GList *list;
|
||||
gboolean result;
|
||||
|
||||
list = nautilus_mime_get_all_components_for_uri (uri);
|
||||
list = nautilus_mime_get_all_components_for_uri (directory, file);
|
||||
result = list != NULL;
|
||||
gnome_vfs_mime_component_list_free (list);
|
||||
|
||||
|
@ -689,10 +696,10 @@ nautilus_mime_has_any_components_for_uri (const char *uri)
|
|||
}
|
||||
|
||||
GnomeVFSResult
|
||||
nautilus_mime_set_default_action_type_for_uri (const char *uri,
|
||||
nautilus_mime_set_default_action_type_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file,
|
||||
GnomeVFSMimeActionType action_type)
|
||||
{
|
||||
NautilusDirectory *directory;
|
||||
const char *action_string;
|
||||
|
||||
switch (action_type) {
|
||||
|
@ -707,65 +714,54 @@ nautilus_mime_set_default_action_type_for_uri (const char *uri,
|
|||
action_string = "none";
|
||||
}
|
||||
|
||||
directory = nautilus_directory_get (uri);
|
||||
|
||||
nautilus_directory_wait_for_metadata (directory);
|
||||
nautilus_directory_set_metadata
|
||||
(directory, NAUTILUS_METADATA_KEY_DEFAULT_ACTION_TYPE, NULL, action_string);
|
||||
nautilus_directory_unref (directory);
|
||||
|
||||
return GNOME_VFS_OK;
|
||||
}
|
||||
|
||||
GnomeVFSResult
|
||||
nautilus_mime_set_default_application_for_uri (const char *uri,
|
||||
const char *application_id)
|
||||
nautilus_mime_set_default_application_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file,
|
||||
const char *application_id)
|
||||
{
|
||||
NautilusDirectory *directory;
|
||||
|
||||
directory = nautilus_directory_get (uri);
|
||||
|
||||
nautilus_directory_wait_for_metadata (directory);
|
||||
nautilus_directory_set_metadata
|
||||
(directory, NAUTILUS_METADATA_KEY_DEFAULT_APPLICATION, NULL, application_id);
|
||||
nautilus_directory_unref (directory);
|
||||
|
||||
/* If there's no default action type, set it to match this. */
|
||||
if (application_id != NULL &&
|
||||
nautilus_mime_get_default_action_type_for_uri (uri) == GNOME_VFS_MIME_ACTION_TYPE_NONE) {
|
||||
return nautilus_mime_set_default_action_type_for_uri (uri, GNOME_VFS_MIME_ACTION_TYPE_APPLICATION);
|
||||
nautilus_mime_get_default_action_type_for_uri (directory, file) == GNOME_VFS_MIME_ACTION_TYPE_NONE) {
|
||||
return nautilus_mime_set_default_action_type_for_uri (directory, file, GNOME_VFS_MIME_ACTION_TYPE_APPLICATION);
|
||||
}
|
||||
|
||||
return GNOME_VFS_OK;
|
||||
}
|
||||
|
||||
GnomeVFSResult
|
||||
nautilus_mime_set_default_component_for_uri (const char *uri,
|
||||
const char *component_iid)
|
||||
nautilus_mime_set_default_component_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file,
|
||||
const char *component_iid)
|
||||
{
|
||||
NautilusDirectory *directory;
|
||||
|
||||
directory = nautilus_directory_get (uri);
|
||||
|
||||
nautilus_directory_wait_for_metadata (directory);
|
||||
nautilus_directory_set_metadata
|
||||
(directory, NAUTILUS_METADATA_KEY_DEFAULT_COMPONENT, NULL, component_iid);
|
||||
nautilus_directory_unref (directory);
|
||||
|
||||
/* If there's no default action type, set it to match this. */
|
||||
if (component_iid != NULL &&
|
||||
nautilus_mime_get_default_action_type_for_uri (uri) == GNOME_VFS_MIME_ACTION_TYPE_NONE) {
|
||||
return nautilus_mime_set_default_action_type_for_uri (uri, GNOME_VFS_MIME_ACTION_TYPE_COMPONENT);
|
||||
nautilus_mime_get_default_action_type_for_uri (directory, file) == GNOME_VFS_MIME_ACTION_TYPE_NONE) {
|
||||
return nautilus_mime_set_default_action_type_for_uri (directory, file, GNOME_VFS_MIME_ACTION_TYPE_COMPONENT);
|
||||
}
|
||||
|
||||
return GNOME_VFS_OK;
|
||||
}
|
||||
|
||||
GnomeVFSResult
|
||||
nautilus_mime_set_short_list_applications_for_uri (const char *uri,
|
||||
GList *applications)
|
||||
nautilus_mime_set_short_list_applications_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file,
|
||||
GList *applications)
|
||||
{
|
||||
NautilusDirectory *directory;
|
||||
GList *add_list;
|
||||
GList *remove_list;
|
||||
GList *normal_short_list;
|
||||
|
@ -775,7 +771,7 @@ nautilus_mime_set_short_list_applications_for_uri (const char *uri,
|
|||
|
||||
/* get per-mime short list */
|
||||
|
||||
mime_type = get_mime_type_from_uri (uri);
|
||||
mime_type = get_mime_type_from_file (file);
|
||||
normal_short_list = gnome_vfs_mime_get_short_list_applications (mime_type);
|
||||
g_free (mime_type);
|
||||
|
||||
|
@ -789,8 +785,6 @@ nautilus_mime_set_short_list_applications_for_uri (const char *uri,
|
|||
add_list = str_list_difference (applications, normal_short_list_ids);
|
||||
remove_list = str_list_difference (normal_short_list_ids, applications);
|
||||
|
||||
directory = nautilus_directory_get (uri);
|
||||
|
||||
nautilus_directory_wait_for_metadata (directory);
|
||||
nautilus_directory_set_metadata_list
|
||||
(directory,
|
||||
|
@ -802,7 +796,6 @@ nautilus_mime_set_short_list_applications_for_uri (const char *uri,
|
|||
NAUTILUS_METADATA_KEY_SHORT_LIST_APPLICATION_REMOVE,
|
||||
NAUTILUS_METADATA_SUBKEY_APPLICATION_ID,
|
||||
remove_list);
|
||||
nautilus_directory_unref (directory);
|
||||
|
||||
/* FIXME bugzilla.eazel.com 1269:
|
||||
* need to free normal_short_list, normal_short_list_ids, add_list, remove_list
|
||||
|
@ -812,10 +805,10 @@ nautilus_mime_set_short_list_applications_for_uri (const char *uri,
|
|||
}
|
||||
|
||||
GnomeVFSResult
|
||||
nautilus_mime_set_short_list_components_for_uri (const char *uri,
|
||||
GList *components)
|
||||
nautilus_mime_set_short_list_components_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file,
|
||||
GList *components)
|
||||
{
|
||||
NautilusDirectory *directory;
|
||||
GList *add_list;
|
||||
GList *remove_list;
|
||||
GList *normal_short_list;
|
||||
|
@ -825,7 +818,7 @@ nautilus_mime_set_short_list_components_for_uri (const char *uri,
|
|||
|
||||
/* get per-mime short list */
|
||||
|
||||
mime_type = get_mime_type_from_uri (uri);
|
||||
mime_type = get_mime_type_from_file (file);
|
||||
normal_short_list = gnome_vfs_mime_get_short_list_components (mime_type);
|
||||
g_free (mime_type);
|
||||
|
||||
|
@ -839,8 +832,6 @@ nautilus_mime_set_short_list_components_for_uri (const char *uri,
|
|||
add_list = str_list_difference (components, normal_short_list_ids);
|
||||
remove_list = str_list_difference (normal_short_list_ids, components);
|
||||
|
||||
directory = nautilus_directory_get (uri);
|
||||
|
||||
nautilus_directory_wait_for_metadata (directory);
|
||||
nautilus_directory_set_metadata_list
|
||||
(directory,
|
||||
|
@ -852,7 +843,6 @@ nautilus_mime_set_short_list_components_for_uri (const char *uri,
|
|||
NAUTILUS_METADATA_KEY_SHORT_LIST_COMPONENT_REMOVE,
|
||||
NAUTILUS_METADATA_SUBKEY_COMPONENT_IID,
|
||||
remove_list);
|
||||
nautilus_directory_unref (directory);
|
||||
|
||||
/* FIXME bugzilla.eazel.com 1269:
|
||||
* need to free normal_short_list, normal_short_list_ids, add_list, remove_list
|
||||
|
@ -862,20 +852,21 @@ nautilus_mime_set_short_list_components_for_uri (const char *uri,
|
|||
}
|
||||
|
||||
GnomeVFSResult
|
||||
nautilus_mime_add_application_to_short_list_for_uri (const char *uri,
|
||||
const char *application_id)
|
||||
nautilus_mime_add_application_to_short_list_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file,
|
||||
const char *application_id)
|
||||
{
|
||||
GList *old_list, *new_list;
|
||||
GnomeVFSResult result;
|
||||
|
||||
result = GNOME_VFS_OK;
|
||||
|
||||
old_list = nautilus_mime_get_short_list_applications_for_uri (uri);
|
||||
old_list = nautilus_mime_get_short_list_applications_for_uri (directory, file);
|
||||
|
||||
if (!gnome_vfs_mime_id_in_application_list (application_id, old_list)) {
|
||||
new_list = g_list_append (gnome_vfs_mime_id_list_from_application_list (old_list),
|
||||
g_strdup (application_id));
|
||||
result = nautilus_mime_set_short_list_applications_for_uri (uri, new_list);
|
||||
result = nautilus_mime_set_short_list_applications_for_uri (directory, file, new_list);
|
||||
nautilus_g_list_free_deep (new_list);
|
||||
}
|
||||
|
||||
|
@ -885,14 +876,15 @@ nautilus_mime_add_application_to_short_list_for_uri (const char *uri,
|
|||
}
|
||||
|
||||
GnomeVFSResult
|
||||
nautilus_mime_remove_application_from_short_list_for_uri (const char *uri,
|
||||
const char *application_id)
|
||||
nautilus_mime_remove_application_from_short_list_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file,
|
||||
const char *application_id)
|
||||
{
|
||||
GList *old_list, *new_list;
|
||||
gboolean was_in_list;
|
||||
GnomeVFSResult result;
|
||||
|
||||
old_list = nautilus_mime_get_short_list_applications_for_uri (uri);
|
||||
old_list = nautilus_mime_get_short_list_applications_for_uri (directory, file);
|
||||
old_list = gnome_vfs_mime_remove_application_from_list
|
||||
(old_list, application_id, &was_in_list);
|
||||
|
||||
|
@ -900,7 +892,7 @@ nautilus_mime_remove_application_from_short_list_for_uri (const char *uri,
|
|||
result = GNOME_VFS_OK;
|
||||
} else {
|
||||
new_list = gnome_vfs_mime_id_list_from_application_list (old_list);
|
||||
result = nautilus_mime_set_short_list_applications_for_uri (uri, new_list);
|
||||
result = nautilus_mime_set_short_list_applications_for_uri (directory, file, new_list);
|
||||
nautilus_g_list_free_deep (new_list);
|
||||
}
|
||||
|
||||
|
@ -910,20 +902,21 @@ nautilus_mime_remove_application_from_short_list_for_uri (const char *uri,
|
|||
}
|
||||
|
||||
GnomeVFSResult
|
||||
nautilus_mime_add_component_to_short_list_for_uri (const char *uri,
|
||||
const char *iid)
|
||||
nautilus_mime_add_component_to_short_list_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file,
|
||||
const char *iid)
|
||||
{
|
||||
GList *old_list, *new_list;
|
||||
GnomeVFSResult result;
|
||||
|
||||
old_list = nautilus_mime_get_short_list_components_for_uri (uri);
|
||||
old_list = nautilus_mime_get_short_list_components_for_uri (directory, file);
|
||||
|
||||
if (gnome_vfs_mime_id_in_component_list (iid, old_list)) {
|
||||
result = GNOME_VFS_OK;
|
||||
} else {
|
||||
new_list = g_list_append (gnome_vfs_mime_id_list_from_component_list (old_list),
|
||||
g_strdup (iid));
|
||||
result = nautilus_mime_set_short_list_components_for_uri (uri, new_list);
|
||||
result = nautilus_mime_set_short_list_components_for_uri (directory, file, new_list);
|
||||
nautilus_g_list_free_deep (new_list);
|
||||
}
|
||||
|
||||
|
@ -933,14 +926,15 @@ nautilus_mime_add_component_to_short_list_for_uri (const char *uri,
|
|||
}
|
||||
|
||||
GnomeVFSResult
|
||||
nautilus_mime_remove_component_from_short_list_for_uri (const char *uri,
|
||||
const char *iid)
|
||||
nautilus_mime_remove_component_from_short_list_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file,
|
||||
const char *iid)
|
||||
{
|
||||
GList *old_list, *new_list;
|
||||
gboolean was_in_list;
|
||||
GnomeVFSResult result;
|
||||
|
||||
old_list = nautilus_mime_get_short_list_components_for_uri (uri);
|
||||
old_list = nautilus_mime_get_short_list_components_for_uri (directory, file);
|
||||
old_list = gnome_vfs_mime_remove_component_from_list
|
||||
(old_list, iid, &was_in_list);
|
||||
|
||||
|
@ -948,7 +942,7 @@ nautilus_mime_remove_component_from_short_list_for_uri (const char *uri,
|
|||
result = GNOME_VFS_OK;
|
||||
} else {
|
||||
new_list = gnome_vfs_mime_id_list_from_component_list (old_list);
|
||||
result = nautilus_mime_set_short_list_components_for_uri (uri, new_list);
|
||||
result = nautilus_mime_set_short_list_components_for_uri (directory, file, new_list);
|
||||
nautilus_g_list_free_deep (new_list);
|
||||
}
|
||||
|
||||
|
@ -958,15 +952,14 @@ nautilus_mime_remove_component_from_short_list_for_uri (const char *uri,
|
|||
}
|
||||
|
||||
GnomeVFSResult
|
||||
nautilus_mime_extend_all_applications_for_uri (const char *uri,
|
||||
GList *applications)
|
||||
nautilus_mime_extend_all_applications_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file,
|
||||
GList *applications)
|
||||
{
|
||||
NautilusDirectory *directory;
|
||||
GList *metadata_application_ids;
|
||||
GList *extras;
|
||||
GList *final_applications;
|
||||
|
||||
directory = nautilus_directory_get (uri);
|
||||
nautilus_directory_wait_for_metadata (directory);
|
||||
|
||||
metadata_application_ids = nautilus_directory_get_metadata_list
|
||||
|
@ -984,20 +977,17 @@ nautilus_mime_extend_all_applications_for_uri (const char *uri,
|
|||
NAUTILUS_METADATA_SUBKEY_APPLICATION_ID,
|
||||
final_applications);
|
||||
|
||||
nautilus_directory_unref (directory);
|
||||
|
||||
return GNOME_VFS_OK;
|
||||
}
|
||||
|
||||
GnomeVFSResult
|
||||
nautilus_mime_remove_from_all_applications_for_uri (const char *uri,
|
||||
GList *applications)
|
||||
nautilus_mime_remove_from_all_applications_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file,
|
||||
GList *applications)
|
||||
{
|
||||
NautilusDirectory *directory;
|
||||
GList *metadata_application_ids;
|
||||
GList *final_applications;
|
||||
|
||||
directory = nautilus_directory_get (uri);
|
||||
nautilus_directory_wait_for_metadata (directory);
|
||||
|
||||
metadata_application_ids = nautilus_directory_get_metadata_list
|
||||
|
@ -1012,37 +1002,43 @@ nautilus_mime_remove_from_all_applications_for_uri (const char *uri,
|
|||
NAUTILUS_METADATA_KEY_EXPLICIT_APPLICATION,
|
||||
NAUTILUS_METADATA_SUBKEY_APPLICATION_ID,
|
||||
final_applications);
|
||||
nautilus_directory_unref (directory);
|
||||
|
||||
return GNOME_VFS_OK;
|
||||
}
|
||||
|
||||
static gint
|
||||
gnome_vfs_mime_application_has_id (GnomeVFSMimeApplication *application, const char *id)
|
||||
gnome_vfs_mime_application_has_id (GnomeVFSMimeApplication *application,
|
||||
const char *id)
|
||||
{
|
||||
return strcmp (application->id, id);
|
||||
}
|
||||
|
||||
static gint
|
||||
gnome_vfs_mime_id_matches_application (const char *id, GnomeVFSMimeApplication *application)
|
||||
gnome_vfs_mime_id_matches_application (const char *id,
|
||||
GnomeVFSMimeApplication *application)
|
||||
{
|
||||
return gnome_vfs_mime_application_has_id (application, id);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gnome_vfs_mime_application_has_id_not_in_list (GnomeVFSMimeApplication *application, GList *ids)
|
||||
gnome_vfs_mime_application_has_id_not_in_list (GnomeVFSMimeApplication *application,
|
||||
GList *ids)
|
||||
{
|
||||
return g_list_find_custom (ids, application, (GCompareFunc) gnome_vfs_mime_id_matches_application) == NULL;
|
||||
return g_list_find_custom (ids, application,
|
||||
(GCompareFunc) gnome_vfs_mime_id_matches_application) == NULL;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
string_not_in_list (const char *str, GList *list)
|
||||
string_not_in_list (const char *str,
|
||||
GList *list)
|
||||
{
|
||||
return g_list_find_custom (list, (gpointer) str, (GCompareFunc) strcmp) == NULL;
|
||||
}
|
||||
|
||||
static char *
|
||||
extract_prefix_add_suffix (const char *string, const char *separator, const char *suffix)
|
||||
extract_prefix_add_suffix (const char *string,
|
||||
const char *separator,
|
||||
const char *suffix)
|
||||
{
|
||||
const char *separator_position;
|
||||
int prefix_length;
|
||||
|
@ -1138,7 +1134,10 @@ 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, GList *explicit_iids, const char *extra_requirements)
|
||||
make_oaf_query_with_known_mime_type (const char *mime_type,
|
||||
const char *uri_scheme,
|
||||
GList *explicit_iids,
|
||||
const char *extra_requirements)
|
||||
{
|
||||
char *mime_supertype;
|
||||
char *result;
|
||||
|
@ -1237,7 +1236,9 @@ make_oaf_query_with_known_mime_type (const char *mime_type, const char *uri_sche
|
|||
}
|
||||
|
||||
static char *
|
||||
make_oaf_query_with_uri_scheme_only (const char *uri_scheme, GList *explicit_iids, const char *extra_requirements)
|
||||
make_oaf_query_with_uri_scheme_only (const char *uri_scheme,
|
||||
GList *explicit_iids,
|
||||
const char *extra_requirements)
|
||||
{
|
||||
char *result;
|
||||
char *explicit_iid_query;
|
||||
|
@ -1335,7 +1336,9 @@ file_list_to_mime_type_hash_table (GList *files)
|
|||
}
|
||||
|
||||
static void
|
||||
free_key (gpointer key, gpointer value, gpointer user_data)
|
||||
free_key (gpointer key,
|
||||
gpointer value,
|
||||
gpointer user_data)
|
||||
{
|
||||
g_free (key);
|
||||
}
|
||||
|
@ -1348,7 +1351,9 @@ mime_type_hash_table_destroy (GHashTable *table)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
server_matches_content_requirements (OAF_ServerInfo *server, GHashTable *type_table, GList *explicit_iids)
|
||||
server_matches_content_requirements (OAF_ServerInfo *server,
|
||||
GHashTable *type_table,
|
||||
GList *explicit_iids)
|
||||
{
|
||||
OAF_Property *prop;
|
||||
GNOME_stringlist types;
|
||||
|
@ -1399,12 +1404,12 @@ static char *nautilus_sort_criteria[] = {
|
|||
|
||||
|
||||
static GList *
|
||||
nautilus_do_component_query (const char *mime_type,
|
||||
const char *uri_scheme,
|
||||
GList *files,
|
||||
GList *explicit_iids,
|
||||
char **extra_sort_criteria,
|
||||
char *extra_requirements,
|
||||
nautilus_do_component_query (const char *mime_type,
|
||||
const char *uri_scheme,
|
||||
GList *files,
|
||||
GList *explicit_iids,
|
||||
char **extra_sort_criteria,
|
||||
char *extra_requirements,
|
||||
CORBA_Environment *ev)
|
||||
{
|
||||
OAF_ServerInfoList *oaf_result;
|
||||
|
@ -1462,7 +1467,8 @@ nautilus_do_component_query (const char *mime_type,
|
|||
|
||||
|
||||
static GList *
|
||||
str_list_difference (GList *a, GList *b)
|
||||
str_list_difference (GList *a,
|
||||
GList *b)
|
||||
{
|
||||
GList *p;
|
||||
GList *retval;
|
||||
|
@ -1481,36 +1487,29 @@ str_list_difference (GList *a, GList *b)
|
|||
|
||||
|
||||
static char *
|
||||
get_mime_type_from_uri (const char *text_uri)
|
||||
get_mime_type_from_file (NautilusFile *file)
|
||||
{
|
||||
GnomeVFSURI *vfs_uri;
|
||||
GnomeVFSFileInfo *file_info;
|
||||
GnomeVFSResult result;
|
||||
char *type;
|
||||
|
||||
GList *file_attributes;
|
||||
|
||||
type = NULL;
|
||||
|
||||
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. */
|
||||
/* 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. */
|
||||
|
||||
if (file != NULL) {
|
||||
file_attributes = g_list_append (NULL, NAUTILUS_FILE_ATTRIBUTE_SLOW_MIME_TYPE);
|
||||
|
||||
vfs_uri = gnome_vfs_uri_new (text_uri);
|
||||
nautilus_file_wait_until_ready (file,
|
||||
file_attributes,
|
||||
FALSE);
|
||||
|
||||
if (vfs_uri != NULL) {
|
||||
file_info = gnome_vfs_file_info_new ();
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
g_list_free (file_attributes);
|
||||
|
||||
type = nautilus_file_get_mime_type (file);
|
||||
}
|
||||
|
||||
return type == NULL ? g_strdup ("application/octet-stream") : type;
|
||||
|
@ -1528,7 +1527,8 @@ strv_length (char **a)
|
|||
}
|
||||
|
||||
static char **
|
||||
strv_concat (char **a, char **b)
|
||||
strv_concat (char **a,
|
||||
char **b)
|
||||
{
|
||||
int a_length;
|
||||
int b_length;
|
||||
|
|
|
@ -27,44 +27,76 @@
|
|||
|
||||
#include <libgnomevfs/gnome-vfs-mime-handlers.h>
|
||||
|
||||
GnomeVFSMimeActionType nautilus_mime_get_default_action_type_for_uri (const char *uri);
|
||||
GnomeVFSMimeAction * nautilus_mime_get_default_action_for_uri (const char *uri);
|
||||
GnomeVFSMimeApplication *nautilus_mime_get_default_application_for_uri (const char *uri);
|
||||
gboolean nautilus_mime_is_default_application_for_uri_user_chosen (const char *uri);
|
||||
OAF_ServerInfo * nautilus_mime_get_default_component_for_uri (const char *uri);
|
||||
gboolean nautilus_mime_is_default_component_for_uri_user_chosen (const char *uri);
|
||||
GList * nautilus_mime_get_short_list_applications_for_uri (const char *uri);
|
||||
GList * nautilus_mime_get_short_list_components_for_uri (const char *uri);
|
||||
gchar * nautilus_mime_get_short_list_methods_for_uri (const char *uri);
|
||||
GList * nautilus_mime_get_all_applications_for_uri (const char *uri);
|
||||
GList * nautilus_mime_get_all_components_for_uri (const char *uri);
|
||||
gboolean nautilus_mime_has_any_components_for_uri (const char *uri);
|
||||
gboolean nautilus_mime_has_any_applications_for_uri (const char *uri);
|
||||
GnomeVFSResult nautilus_mime_set_default_action_type_for_uri (const char *uri,
|
||||
#include <libnautilus-extensions/nautilus-directory.h>
|
||||
#include <libnautilus-extensions/nautilus-file.h>
|
||||
|
||||
/* FIXME: This API requires passing both a NautilusDirectory and a
|
||||
NautilusFile for the same URI, because it requires both the mime type
|
||||
and the metadata for the location. */
|
||||
|
||||
|
||||
GnomeVFSMimeActionType nautilus_mime_get_default_action_type_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file);
|
||||
GnomeVFSMimeAction * nautilus_mime_get_default_action_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file);
|
||||
GnomeVFSMimeApplication *nautilus_mime_get_default_application_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file);
|
||||
gboolean nautilus_mime_is_default_application_for_uri_user_chosen (NautilusDirectory *directory,
|
||||
NautilusFile *file);
|
||||
OAF_ServerInfo * nautilus_mime_get_default_component_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file);
|
||||
gboolean nautilus_mime_is_default_component_for_uri_user_chosen (NautilusDirectory *directory,
|
||||
NautilusFile *file);
|
||||
GList * nautilus_mime_get_short_list_applications_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file);
|
||||
GList * nautilus_mime_get_short_list_components_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file);
|
||||
gchar * nautilus_mime_get_short_list_methods_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file);
|
||||
GList * nautilus_mime_get_all_applications_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file);
|
||||
GList * nautilus_mime_get_all_components_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file);
|
||||
gboolean nautilus_mime_has_any_components_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file);
|
||||
gboolean nautilus_mime_has_any_applications_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file);
|
||||
GnomeVFSResult nautilus_mime_set_default_action_type_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file,
|
||||
GnomeVFSMimeActionType action_type);
|
||||
GnomeVFSResult nautilus_mime_set_default_application_for_uri (const char *uri,
|
||||
GnomeVFSResult nautilus_mime_set_default_application_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file,
|
||||
const char *application_id);
|
||||
GnomeVFSResult nautilus_mime_set_default_component_for_uri (const char *uri,
|
||||
GnomeVFSResult nautilus_mime_set_default_component_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file,
|
||||
const char *component_iid);
|
||||
/* Stored as delta to current user level */
|
||||
GnomeVFSResult nautilus_mime_set_short_list_applications_for_uri (const char *uri,
|
||||
GnomeVFSResult nautilus_mime_set_short_list_applications_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file,
|
||||
GList *applications);
|
||||
GnomeVFSResult nautilus_mime_set_short_list_components_for_uri (const char *uri,
|
||||
GnomeVFSResult nautilus_mime_set_short_list_components_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file,
|
||||
GList *components);
|
||||
GnomeVFSResult nautilus_mime_add_application_to_short_list_for_uri (const char *uri,
|
||||
GnomeVFSResult nautilus_mime_add_application_to_short_list_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file,
|
||||
const char *application_id);
|
||||
GnomeVFSResult nautilus_mime_remove_application_from_short_list_for_uri (const char *uri,
|
||||
GnomeVFSResult nautilus_mime_remove_application_from_short_list_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file,
|
||||
const char *application_id);
|
||||
GnomeVFSResult nautilus_mime_add_component_to_short_list_for_uri (const char *uri,
|
||||
GnomeVFSResult nautilus_mime_add_component_to_short_list_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file,
|
||||
const char *iid);
|
||||
GnomeVFSResult nautilus_mime_remove_component_from_short_list_for_uri (const char *uri,
|
||||
GnomeVFSResult nautilus_mime_remove_component_from_short_list_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file,
|
||||
const char *iid);
|
||||
|
||||
/* No way to override system list; can only add. */
|
||||
GnomeVFSResult nautilus_mime_extend_all_applications_for_uri (const char *uri,
|
||||
GnomeVFSResult nautilus_mime_extend_all_applications_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file,
|
||||
GList *applications);
|
||||
/* Only "user" entries may be removed. */
|
||||
GnomeVFSResult nautilus_mime_remove_from_all_applications_for_uri (const char *uri,
|
||||
GnomeVFSResult nautilus_mime_remove_from_all_applications_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file,
|
||||
GList *applications);
|
||||
|
||||
/* No way to add to all components; oafinfo database assumed trusted in this regard. */
|
||||
|
|
|
@ -311,6 +311,7 @@ repopulate_program_list (GnomeDialog *program_chooser,
|
|||
{
|
||||
char **text;
|
||||
char *uri;
|
||||
NautilusDirectory *directory;
|
||||
GList *programs, *program;
|
||||
ProgramFilePair *pair;
|
||||
int new_row;
|
||||
|
@ -322,11 +323,14 @@ repopulate_program_list (GnomeDialog *program_chooser,
|
|||
|| type == GNOME_VFS_MIME_ACTION_TYPE_APPLICATION);
|
||||
|
||||
uri = nautilus_file_get_uri (file);
|
||||
programs = type == GNOME_VFS_MIME_ACTION_TYPE_COMPONENT
|
||||
? nautilus_mime_get_all_components_for_uri (uri)
|
||||
: nautilus_mime_get_all_applications_for_uri (uri);
|
||||
directory = nautilus_directory_get (uri);
|
||||
g_free (uri);
|
||||
|
||||
programs = type == GNOME_VFS_MIME_ACTION_TYPE_COMPONENT
|
||||
? nautilus_mime_get_all_components_for_uri (directory, file)
|
||||
: nautilus_mime_get_all_applications_for_uri (directory, file);
|
||||
nautilus_directory_unref (directory);
|
||||
|
||||
gtk_clist_clear (clist);
|
||||
|
||||
for (program = programs; program != NULL; program = program->next) {
|
||||
|
@ -484,11 +488,18 @@ is_application_default_for_uri (GnomeVFSMimeApplication *application, const char
|
|||
{
|
||||
GnomeVFSMimeApplication *default_application;
|
||||
gboolean result;
|
||||
NautilusFile *file;
|
||||
NautilusDirectory *directory;
|
||||
|
||||
g_assert (application != NULL);
|
||||
|
||||
default_application = nautilus_mime_get_default_application_for_uri (uri);
|
||||
file = nautilus_file_get (uri);
|
||||
directory = nautilus_directory_get (uri);
|
||||
|
||||
default_application = nautilus_mime_get_default_application_for_uri (directory, file);
|
||||
result = (default_application != NULL && strcmp (default_application->id, application->id) == 0);
|
||||
nautilus_directory_unref (directory);
|
||||
nautilus_file_unref (file);
|
||||
|
||||
gnome_vfs_mime_application_free (default_application);
|
||||
|
||||
|
@ -500,12 +511,20 @@ is_component_default_for_uri (NautilusViewIdentifier *identifier, const char *ur
|
|||
{
|
||||
OAF_ServerInfo *default_component;
|
||||
gboolean result;
|
||||
NautilusDirectory *directory;
|
||||
NautilusFile *file;
|
||||
|
||||
g_assert (identifier != NULL);
|
||||
|
||||
default_component = nautilus_mime_get_default_component_for_uri (uri);
|
||||
directory = nautilus_directory_get (uri);
|
||||
file = nautilus_file_get (uri);
|
||||
|
||||
default_component = nautilus_mime_get_default_component_for_uri (directory, file);
|
||||
result = (default_component != NULL && strcmp (default_component->iid, identifier->iid) == 0);
|
||||
|
||||
nautilus_directory_unref (directory);
|
||||
nautilus_file_unref (file);
|
||||
|
||||
CORBA_free (default_component);
|
||||
|
||||
return result;
|
||||
|
@ -532,14 +551,22 @@ is_component_in_short_list_for_uri (NautilusViewIdentifier *identifier, const ch
|
|||
{
|
||||
GList *list;
|
||||
gboolean result;
|
||||
NautilusDirectory *directory;
|
||||
NautilusFile *file;
|
||||
|
||||
list = nautilus_mime_get_short_list_components_for_uri (uri);
|
||||
directory = nautilus_directory_get (uri);
|
||||
file = nautilus_file_get (uri);
|
||||
|
||||
list = nautilus_mime_get_short_list_components_for_uri (directory, file);
|
||||
result = g_list_find_custom (list,
|
||||
identifier,
|
||||
(GCompareFunc)compare_component_with_view)
|
||||
!= NULL;
|
||||
gnome_vfs_mime_component_list_free (list);
|
||||
|
||||
nautilus_file_unref (file);
|
||||
nautilus_directory_unref (directory);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -564,14 +591,24 @@ is_application_in_short_list_for_uri (GnomeVFSMimeApplication *application, cons
|
|||
{
|
||||
GList *list;
|
||||
gboolean result;
|
||||
NautilusDirectory *directory;
|
||||
NautilusFile *file;
|
||||
|
||||
list = nautilus_mime_get_short_list_applications_for_uri (uri);
|
||||
directory = nautilus_directory_get (uri);
|
||||
file = nautilus_file_get (uri);
|
||||
|
||||
|
||||
list = nautilus_mime_get_short_list_applications_for_uri (directory, file);
|
||||
result = g_list_find_custom (list,
|
||||
application,
|
||||
(GCompareFunc)compare_mime_applications)
|
||||
!= NULL;
|
||||
gnome_vfs_mime_application_list_free (list);
|
||||
|
||||
|
||||
nautilus_directory_unref (directory);
|
||||
nautilus_file_unref (file);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -606,16 +643,20 @@ program_file_pair_is_default_for_file (ProgramFilePair *pair)
|
|||
{
|
||||
char *uri;
|
||||
gboolean result;
|
||||
|
||||
NautilusDirectory *directory;
|
||||
|
||||
g_assert (pair != NULL);
|
||||
g_assert (NAUTILUS_IS_FILE (pair->file));
|
||||
|
||||
uri = nautilus_file_get_uri (pair->file);
|
||||
directory = nautilus_directory_get (uri);
|
||||
|
||||
if (pair->action_type != nautilus_mime_get_default_action_type_for_uri (uri)) {
|
||||
if (pair->action_type != nautilus_mime_get_default_action_type_for_uri (directory, pair->file)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
nautilus_directory_unref (directory);
|
||||
|
||||
if (pair->action_type == GNOME_VFS_MIME_ACTION_TYPE_COMPONENT) {
|
||||
result = is_component_default_for_uri (pair->view_identifier, uri);
|
||||
} else {
|
||||
|
@ -778,15 +819,18 @@ static void
|
|||
add_to_short_list_for_file (ProgramFilePair *pair)
|
||||
{
|
||||
char *uri;
|
||||
NautilusDirectory *directory;
|
||||
|
||||
uri = nautilus_file_get_uri (pair->file);
|
||||
|
||||
if (pair->action_type == GNOME_VFS_MIME_ACTION_TYPE_APPLICATION) {
|
||||
nautilus_mime_add_application_to_short_list_for_uri (uri, pair->application->id);
|
||||
} else {
|
||||
nautilus_mime_add_component_to_short_list_for_uri (uri, pair->view_identifier->iid);
|
||||
}
|
||||
directory = nautilus_directory_get (uri);
|
||||
|
||||
if (pair->action_type == GNOME_VFS_MIME_ACTION_TYPE_APPLICATION) {
|
||||
nautilus_mime_add_application_to_short_list_for_uri (directory, pair->file, pair->application->id);
|
||||
} else {
|
||||
nautilus_mime_add_component_to_short_list_for_uri (directory, pair->file, pair->view_identifier->iid);
|
||||
}
|
||||
|
||||
nautilus_directory_unref (directory);
|
||||
g_free (uri);
|
||||
}
|
||||
|
||||
|
@ -794,15 +838,18 @@ static void
|
|||
remove_from_short_list_for_file (ProgramFilePair *pair)
|
||||
{
|
||||
char *uri;
|
||||
NautilusDirectory *directory;
|
||||
|
||||
uri = nautilus_file_get_uri (pair->file);
|
||||
|
||||
directory = nautilus_directory_get (uri);
|
||||
|
||||
if (pair->action_type == GNOME_VFS_MIME_ACTION_TYPE_APPLICATION) {
|
||||
nautilus_mime_remove_application_from_short_list_for_uri (uri, pair->application->id);
|
||||
nautilus_mime_remove_application_from_short_list_for_uri (directory, pair->file, pair->application->id);
|
||||
} else {
|
||||
nautilus_mime_remove_component_from_short_list_for_uri (uri, pair->view_identifier->iid);
|
||||
nautilus_mime_remove_component_from_short_list_for_uri (directory, pair->file, pair->view_identifier->iid);
|
||||
}
|
||||
|
||||
nautilus_directory_unref (directory);
|
||||
g_free (uri);
|
||||
}
|
||||
|
||||
|
@ -862,29 +909,32 @@ static void
|
|||
remove_default_for_item (ProgramFilePair *pair)
|
||||
{
|
||||
char *uri;
|
||||
NautilusDirectory *directory;
|
||||
|
||||
uri = nautilus_file_get_uri (pair->file);
|
||||
directory = nautilus_directory_get (uri);
|
||||
|
||||
if (pair->action_type == GNOME_VFS_MIME_ACTION_TYPE_APPLICATION) {
|
||||
/* If the default is just falling through to the default for this type,
|
||||
* don't do anything here.
|
||||
*/
|
||||
if (nautilus_mime_is_default_application_for_uri_user_chosen (uri)) {
|
||||
if (nautilus_mime_is_default_application_for_uri_user_chosen (directory, pair->file)) {
|
||||
if (is_application_default_for_uri (pair->application, uri)) {
|
||||
nautilus_mime_set_default_application_for_uri (uri, NULL);
|
||||
nautilus_mime_set_default_application_for_uri (directory, pair->file, NULL);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* If the default is just falling through to the default for this type,
|
||||
* don't do anything here.
|
||||
*/
|
||||
if (nautilus_mime_is_default_component_for_uri_user_chosen (uri)) {
|
||||
if (nautilus_mime_is_default_component_for_uri_user_chosen (directory, pair->file)) {
|
||||
if (is_component_default_for_uri (pair->view_identifier, uri)) {
|
||||
nautilus_mime_set_default_component_for_uri (uri, NULL);
|
||||
nautilus_mime_set_default_component_for_uri (directory, pair->file, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nautilus_directory_unref (directory);
|
||||
g_free (uri);
|
||||
}
|
||||
|
||||
|
@ -910,17 +960,22 @@ static void
|
|||
set_default_for_item (ProgramFilePair *pair)
|
||||
{
|
||||
char *uri;
|
||||
NautilusDirectory *directory;
|
||||
|
||||
uri = nautilus_file_get_uri (pair->file);
|
||||
directory = nautilus_directory_get (uri);
|
||||
|
||||
uri = nautilus_file_get_uri (pair->file);
|
||||
|
||||
if (pair->action_type == GNOME_VFS_MIME_ACTION_TYPE_APPLICATION) {
|
||||
nautilus_mime_set_default_application_for_uri (uri, pair->application->id);
|
||||
nautilus_mime_set_default_application_for_uri (directory, pair->file, pair->application->id);
|
||||
} else {
|
||||
nautilus_mime_set_default_component_for_uri (uri, pair->view_identifier->iid);
|
||||
nautilus_mime_set_default_component_for_uri (directory, pair->file, pair->view_identifier->iid);
|
||||
}
|
||||
|
||||
nautilus_mime_set_default_action_type_for_uri (uri, pair->action_type);
|
||||
|
||||
nautilus_mime_set_default_action_type_for_uri (directory, pair->file, pair->action_type);
|
||||
|
||||
nautilus_directory_unref (directory);
|
||||
g_free (uri);
|
||||
}
|
||||
|
||||
|
|
|
@ -41,16 +41,19 @@ any_programs_available_for_file (GnomeVFSMimeActionType action_type, NautilusFil
|
|||
{
|
||||
gboolean result;
|
||||
char *uri;
|
||||
NautilusDirectory *directory;
|
||||
|
||||
uri = nautilus_file_get_uri (file);
|
||||
directory = nautilus_directory_get (uri);
|
||||
|
||||
if (action_type == GNOME_VFS_MIME_ACTION_TYPE_COMPONENT) {
|
||||
result = nautilus_mime_has_any_components_for_uri (uri);
|
||||
result = nautilus_mime_has_any_components_for_uri (directory, file);
|
||||
} else {
|
||||
g_assert (action_type == GNOME_VFS_MIME_ACTION_TYPE_APPLICATION);
|
||||
result = nautilus_mime_has_any_applications_for_uri (uri);
|
||||
result = nautilus_mime_has_any_applications_for_uri (directory, file);
|
||||
}
|
||||
|
||||
nautilus_directory_unref (directory);
|
||||
g_free (uri);
|
||||
|
||||
return result;
|
||||
|
|
38
libnautilus-extensions/nautilus-wait-until-ready.h
Normal file
38
libnautilus-extensions/nautilus-wait-until-ready.h
Normal file
|
@ -0,0 +1,38 @@
|
|||
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
|
||||
|
||||
/*
|
||||
* Nautilus
|
||||
*
|
||||
* Copyright (C) 2000 Red Hat, Inc.
|
||||
*
|
||||
* Nautilus is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* Nautilus is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this program; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* Authors: Maciej Stachowiak
|
||||
*/
|
||||
|
||||
/* nautilus-wait-until-ready.h: I'm adding this file as a temporary
|
||||
* measure in the process of eliminating the wait_until_ready calls. It
|
||||
* is deprecated! Do not use these calls in new code!
|
||||
*/
|
||||
|
||||
GList * nautilus_directory_wait_until_ready (NautilusDirectory *directory,
|
||||
GList *file_attributes,
|
||||
gboolean wait_for_metadata);
|
||||
|
||||
|
||||
void nautilus_file_wait_until_ready (NautilusFile *file,
|
||||
GList *attributes,
|
||||
gboolean wait_for_metadata);
|
|
@ -225,6 +225,7 @@ noinst_HEADERS = \
|
|||
nautilus-vfs-directory.h \
|
||||
nautilus-view-identifier.h \
|
||||
nautilus-volume-monitor.h \
|
||||
nautilus-wait-until-ready.h \
|
||||
nautilus-xml-extensions.h \
|
||||
$(NULL)
|
||||
|
||||
|
|
|
@ -733,7 +733,11 @@ set_up_request_by_file_attributes (Request *request,
|
|||
nautilus_str_compare) != NULL;
|
||||
request->file_info = g_list_find_custom
|
||||
(file_attributes,
|
||||
NAUTILUS_FILE_ATTRIBUTE_FAST_MIME_TYPE,
|
||||
NAUTILUS_FILE_ATTRIBUTE_MIME_TYPE,
|
||||
nautilus_str_compare) != NULL;
|
||||
request->file_info |= g_list_find_custom
|
||||
(file_attributes,
|
||||
NAUTILUS_FILE_ATTRIBUTE_SLOW_MIME_TYPE,
|
||||
nautilus_str_compare) != NULL;
|
||||
request->file_info |= g_list_find_custom
|
||||
(file_attributes,
|
||||
|
|
|
@ -37,10 +37,12 @@
|
|||
#include "nautilus-string.h"
|
||||
#include "nautilus-trash-directory.h"
|
||||
#include "nautilus-vfs-directory.h"
|
||||
#include "nautilus-wait-until-ready.h"
|
||||
#include <ctype.h>
|
||||
#include <gtk/gtkmain.h>
|
||||
#include <gtk/gtksignal.h>
|
||||
|
||||
|
||||
enum {
|
||||
FILES_ADDED,
|
||||
FILES_CHANGED,
|
||||
|
@ -1342,7 +1344,7 @@ nautilus_self_check_directory (void)
|
|||
|
||||
got_files_flag = FALSE;
|
||||
|
||||
attributes = g_list_prepend (NULL, NAUTILUS_FILE_ATTRIBUTE_FAST_MIME_TYPE);
|
||||
attributes = g_list_prepend (NULL, NAUTILUS_FILE_ATTRIBUTE_MIME_TYPE);
|
||||
attributes = g_list_prepend (attributes, NAUTILUS_FILE_ATTRIBUTE_DEEP_COUNTS);
|
||||
nautilus_directory_call_when_ready (directory, attributes, FALSE,
|
||||
got_files_callback, &data_dummy);
|
||||
|
|
|
@ -165,9 +165,6 @@ void nautilus_directory_call_when_ready (NautilusDirectory
|
|||
gboolean wait_for_metadata,
|
||||
NautilusDirectoryCallback callback,
|
||||
gpointer callback_data);
|
||||
GList * nautilus_directory_wait_until_ready (NautilusDirectory *directory,
|
||||
GList *file_attributes,
|
||||
gboolean wait_for_metadata);
|
||||
void nautilus_directory_cancel_callback (NautilusDirectory *directory,
|
||||
NautilusDirectoryCallback callback,
|
||||
gpointer callback_data);
|
||||
|
|
|
@ -33,7 +33,8 @@
|
|||
#define NAUTILUS_FILE_ATTRIBUTE_CUSTOM_ICON "custom icon"
|
||||
#define NAUTILUS_FILE_ATTRIBUTE_DEEP_COUNTS "deep counts"
|
||||
#define NAUTILUS_FILE_ATTRIBUTE_DIRECTORY_ITEM_COUNT "directory item count"
|
||||
#define NAUTILUS_FILE_ATTRIBUTE_FAST_MIME_TYPE "MIME type"
|
||||
#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"
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include "nautilus-lib-self-check-functions.h"
|
||||
#include "nautilus-link.h"
|
||||
#include "nautilus-string.h"
|
||||
#include "nautilus-wait-until-ready.h"
|
||||
#include <ctype.h>
|
||||
#include <grp.h>
|
||||
#include <gtk/gtksignal.h>
|
||||
|
@ -3985,6 +3986,42 @@ nautilus_extract_top_left_text (const char *text,
|
|||
return g_strdup (buffer);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
static void
|
||||
file_wait_until_ready_callback (NautilusFile *file,
|
||||
gpointer callback_data)
|
||||
{
|
||||
gboolean *data;
|
||||
|
||||
data = callback_data;
|
||||
*data = TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
nautilus_file_wait_until_ready (NautilusFile *file,
|
||||
GList *file_attributes,
|
||||
gboolean wait_for_metadata)
|
||||
{
|
||||
gboolean callback_done;
|
||||
|
||||
callback_done = FALSE;
|
||||
|
||||
nautilus_file_call_when_ready
|
||||
(file, file_attributes, wait_for_metadata,
|
||||
file_wait_until_ready_callback, &callback_done);
|
||||
while (!callback_done) {
|
||||
gtk_main_iteration ();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#if !defined (NAUTILUS_OMIT_SELF_CHECK)
|
||||
|
||||
void
|
||||
|
@ -4063,3 +4100,6 @@ nautilus_self_check_file (void)
|
|||
}
|
||||
|
||||
#endif /* !NAUTILUS_OMIT_SELF_CHECK */
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1308,7 +1308,7 @@ nautilus_icon_factory_get_required_file_attributes (void)
|
|||
|
||||
attributes = g_list_prepend (NULL, NAUTILUS_FILE_ATTRIBUTE_CUSTOM_ICON);
|
||||
attributes = g_list_prepend (attributes,
|
||||
NAUTILUS_FILE_ATTRIBUTE_FAST_MIME_TYPE);
|
||||
NAUTILUS_FILE_ATTRIBUTE_MIME_TYPE);
|
||||
attributes = g_list_prepend (attributes,
|
||||
NAUTILUS_FILE_ATTRIBUTE_TOP_LEFT_TEXT);
|
||||
|
||||
|
|
|
@ -35,41 +35,54 @@
|
|||
#include "nautilus-file-attributes.h"
|
||||
#include "nautilus-glib-extensions.h"
|
||||
#include "nautilus-metadata.h"
|
||||
#include "nautilus-wait-until-ready.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
static gint gnome_vfs_mime_application_has_id (GnomeVFSMimeApplication *application, const char *id);
|
||||
static gint gnome_vfs_mime_id_matches_application (const char *id, GnomeVFSMimeApplication *application);
|
||||
static gboolean gnome_vfs_mime_application_has_id_not_in_list (GnomeVFSMimeApplication *application, GList *ids);
|
||||
static gboolean string_not_in_list (const char *str, GList *list);
|
||||
static char *extract_prefix_add_suffix (const char *string, const char *separator, 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 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, GList *explicit_iids, const char *extra_requirements);
|
||||
static char *make_oaf_query_with_uri_scheme_only (const char *uri_scheme, GList *explicit_iids, const char *extra_requirements);
|
||||
static GHashTable *file_list_to_mime_type_hash_table (GList *files);
|
||||
static void free_key (gpointer key, gpointer value, gpointer user_data);
|
||||
static void mime_type_hash_table_destroy (GHashTable *table);
|
||||
static gboolean server_matches_content_requirements (OAF_ServerInfo *server,
|
||||
GHashTable *type_table,
|
||||
GList *explicit_iids);
|
||||
static GList *nautilus_do_component_query (const char *mime_type,
|
||||
const char *uri_scheme,
|
||||
GList *files,
|
||||
GList *explicit_iids,
|
||||
char **extra_sort_criteria,
|
||||
char *extra_requirements,
|
||||
CORBA_Environment *ev);
|
||||
static GList *str_list_difference (GList *a,
|
||||
GList *b);
|
||||
static char *get_mime_type_from_uri (const char
|
||||
*text_uri);
|
||||
|
||||
static int strv_length (char **a);
|
||||
static char **strv_concat (char **a, char **b);
|
||||
static gint gnome_vfs_mime_application_has_id (GnomeVFSMimeApplication *application,
|
||||
const char *id);
|
||||
static gint gnome_vfs_mime_id_matches_application (const char *id,
|
||||
GnomeVFSMimeApplication *application);
|
||||
static gboolean gnome_vfs_mime_application_has_id_not_in_list (GnomeVFSMimeApplication *application,
|
||||
GList *ids);
|
||||
static gboolean string_not_in_list (const char *str,
|
||||
GList *list);
|
||||
static char *extract_prefix_add_suffix (const char *string,
|
||||
const char *separator,
|
||||
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 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,
|
||||
GList *explicit_iids,
|
||||
const char *extra_requirements);
|
||||
static char *make_oaf_query_with_uri_scheme_only (const char *uri_scheme,
|
||||
GList *explicit_iids,
|
||||
const char *extra_requirements);
|
||||
static GHashTable *file_list_to_mime_type_hash_table (GList *files);
|
||||
static void free_key (gpointer key,
|
||||
gpointer value,
|
||||
gpointer user_data);
|
||||
static void mime_type_hash_table_destroy (GHashTable *table);
|
||||
static gboolean server_matches_content_requirements (OAF_ServerInfo *server,
|
||||
GHashTable *type_table,
|
||||
GList *explicit_iids);
|
||||
static GList *nautilus_do_component_query (const char *mime_type,
|
||||
const char *uri_scheme,
|
||||
GList *files,
|
||||
GList *explicit_iids,
|
||||
char **extra_sort_criteria,
|
||||
char *extra_requirements,
|
||||
CORBA_Environment *ev);
|
||||
static GList *str_list_difference (GList *a,
|
||||
GList *b);
|
||||
static char *get_mime_type_from_file (NautilusFile *file);
|
||||
static int strv_length (char **a);
|
||||
static char **strv_concat (char **a,
|
||||
char **b);
|
||||
|
||||
static gboolean
|
||||
is_known_mime_type (const char *mime_type)
|
||||
|
@ -100,28 +113,19 @@ nautilus_directory_wait_for_metadata (NautilusDirectory *directory)
|
|||
}
|
||||
|
||||
GnomeVFSMimeActionType
|
||||
nautilus_mime_get_default_action_type_for_uri (const char *uri)
|
||||
nautilus_mime_get_default_action_type_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file)
|
||||
{
|
||||
char *mime_type;
|
||||
NautilusDirectory *directory;
|
||||
char *action_type_string;
|
||||
GnomeVFSMimeActionType action_type;
|
||||
|
||||
directory = nautilus_directory_get (uri);
|
||||
nautilus_directory_wait_for_metadata (directory);
|
||||
action_type_string = nautilus_directory_get_metadata
|
||||
(directory, NAUTILUS_METADATA_KEY_DEFAULT_ACTION_TYPE, NULL);
|
||||
nautilus_directory_unref (directory);
|
||||
|
||||
if (action_type_string == NULL) {
|
||||
/* FIXME bugzilla.eazel.com 1263:
|
||||
need NautilusDirectory cover for getting
|
||||
mime type, and need to tie it into the
|
||||
call_when_ready interface. Would want to use it
|
||||
here. That way we won't be computing the mime type
|
||||
over and over in the process of finding info on a
|
||||
target URI. */
|
||||
mime_type = get_mime_type_from_uri (uri);
|
||||
mime_type = get_mime_type_from_file (file);
|
||||
action_type = gnome_vfs_mime_get_default_action_type (mime_type);
|
||||
g_free (mime_type);
|
||||
return action_type;
|
||||
|
@ -137,18 +141,19 @@ nautilus_mime_get_default_action_type_for_uri (const char *uri)
|
|||
}
|
||||
|
||||
GnomeVFSMimeAction *
|
||||
nautilus_mime_get_default_action_for_uri (const char *uri)
|
||||
nautilus_mime_get_default_action_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file)
|
||||
{
|
||||
GnomeVFSMimeAction *action;
|
||||
|
||||
action = g_new0 (GnomeVFSMimeAction, 1);
|
||||
|
||||
action->action_type = nautilus_mime_get_default_action_type_for_uri (uri);
|
||||
action->action_type = nautilus_mime_get_default_action_type_for_uri (directory, file);
|
||||
|
||||
switch (action->action_type) {
|
||||
case GNOME_VFS_MIME_ACTION_TYPE_APPLICATION:
|
||||
action->action.application =
|
||||
nautilus_mime_get_default_application_for_uri (uri);
|
||||
nautilus_mime_get_default_application_for_uri (directory, file);
|
||||
if (action->action.application == NULL) {
|
||||
g_free (action);
|
||||
action = NULL;
|
||||
|
@ -156,7 +161,7 @@ nautilus_mime_get_default_action_for_uri (const char *uri)
|
|||
break;
|
||||
case GNOME_VFS_MIME_ACTION_TYPE_COMPONENT:
|
||||
action->action.component =
|
||||
nautilus_mime_get_default_component_for_uri (uri);
|
||||
nautilus_mime_get_default_component_for_uri (directory, file);
|
||||
if (action->action.component == NULL) {
|
||||
g_free (action);
|
||||
action = NULL;
|
||||
|
@ -174,32 +179,23 @@ nautilus_mime_get_default_action_for_uri (const char *uri)
|
|||
|
||||
|
||||
static GnomeVFSMimeApplication *
|
||||
nautilus_mime_get_default_application_for_uri_internal (const char *uri, gboolean *user_chosen)
|
||||
nautilus_mime_get_default_application_for_uri_internal (NautilusDirectory *directory,
|
||||
NautilusFile *file,
|
||||
gboolean *user_chosen)
|
||||
{
|
||||
char *mime_type;
|
||||
GnomeVFSMimeApplication *result;
|
||||
NautilusDirectory *directory;
|
||||
char *default_application_string;
|
||||
gboolean used_user_chosen_info;
|
||||
|
||||
used_user_chosen_info = TRUE;
|
||||
|
||||
directory = nautilus_directory_get (uri);
|
||||
|
||||
nautilus_directory_wait_for_metadata (directory);
|
||||
default_application_string = nautilus_directory_get_metadata
|
||||
(directory, NAUTILUS_METADATA_KEY_DEFAULT_APPLICATION, NULL);
|
||||
nautilus_directory_unref (directory);
|
||||
|
||||
if (default_application_string == NULL) {
|
||||
/* FIXME bugzilla.eazel.com 1263:
|
||||
need NautilusDirectory cover for getting
|
||||
mime type, and need to tie it into the
|
||||
call_when_ready interface. Would want to use it
|
||||
here. That way we won't be computing the mime type
|
||||
over and over in the process of finding info on a
|
||||
target URI. */
|
||||
mime_type = get_mime_type_from_uri (uri);
|
||||
mime_type = get_mime_type_from_file (file);
|
||||
result = gnome_vfs_mime_get_default_application (mime_type);
|
||||
g_free (mime_type);
|
||||
used_user_chosen_info = FALSE;
|
||||
|
@ -215,18 +211,20 @@ nautilus_mime_get_default_application_for_uri_internal (const char *uri, gboolea
|
|||
}
|
||||
|
||||
GnomeVFSMimeApplication *
|
||||
nautilus_mime_get_default_application_for_uri (const char *uri)
|
||||
nautilus_mime_get_default_application_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file)
|
||||
{
|
||||
return nautilus_mime_get_default_application_for_uri_internal (uri, NULL);
|
||||
return nautilus_mime_get_default_application_for_uri_internal (directory, file, NULL);
|
||||
}
|
||||
|
||||
gboolean
|
||||
nautilus_mime_is_default_application_for_uri_user_chosen (const char *uri)
|
||||
nautilus_mime_is_default_application_for_uri_user_chosen (NautilusDirectory *directory,
|
||||
NautilusFile *file)
|
||||
{
|
||||
GnomeVFSMimeApplication *application;
|
||||
gboolean user_chosen;
|
||||
|
||||
application = nautilus_mime_get_default_application_for_uri_internal (uri, &user_chosen);
|
||||
application = nautilus_mime_get_default_application_for_uri_internal (directory, file, &user_chosen);
|
||||
|
||||
/* Doesn't count as user chosen if the user-specified data is bogus and doesn't
|
||||
* result in an actual application.
|
||||
|
@ -242,12 +240,14 @@ nautilus_mime_is_default_application_for_uri_user_chosen (const char *uri)
|
|||
|
||||
|
||||
static OAF_ServerInfo *
|
||||
nautilus_mime_get_default_component_for_uri_internal (const char *uri, gboolean *user_chosen)
|
||||
nautilus_mime_get_default_component_for_uri_internal (NautilusDirectory *directory,
|
||||
NautilusFile *file,
|
||||
gboolean *user_chosen)
|
||||
{
|
||||
GList *info_list;
|
||||
OAF_ServerInfo *mime_default;
|
||||
NautilusDirectory *directory;
|
||||
char *default_component_string;
|
||||
char *uri;
|
||||
char *mime_type;
|
||||
char *uri_scheme;
|
||||
GList *files;
|
||||
|
@ -266,21 +266,23 @@ nautilus_mime_get_default_component_for_uri_internal (const char *uri, gboolean
|
|||
|
||||
CORBA_exception_init (&ev);
|
||||
|
||||
mime_type = get_mime_type_from_uri (uri);
|
||||
mime_type = get_mime_type_from_file (file);
|
||||
|
||||
uri = nautilus_file_get_uri (file);
|
||||
|
||||
uri_scheme = uri_string_get_scheme (uri);
|
||||
|
||||
directory = nautilus_directory_get (uri);
|
||||
g_free (uri);
|
||||
|
||||
/* Arrange for all the file attributes we will need. */
|
||||
attributes = NULL;
|
||||
attributes = g_list_prepend (attributes, NAUTILUS_FILE_ATTRIBUTE_FAST_MIME_TYPE);
|
||||
attributes = g_list_prepend (attributes, NAUTILUS_FILE_ATTRIBUTE_MIME_TYPE);
|
||||
|
||||
files = nautilus_directory_wait_until_ready (directory, attributes, TRUE);
|
||||
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);
|
||||
nautilus_directory_unref (directory);
|
||||
|
||||
if (default_component_string == NULL && is_known_mime_type (mime_type)) {
|
||||
mime_default = gnome_vfs_mime_get_default_component (mime_type);
|
||||
|
@ -311,7 +313,7 @@ nautilus_mime_get_default_component_for_uri_internal (const char *uri, gboolean
|
|||
|
||||
/* Prefer something from the short list */
|
||||
|
||||
short_list = nautilus_mime_get_short_list_components_for_uri (uri);
|
||||
short_list = nautilus_mime_get_short_list_components_for_uri (directory, file);
|
||||
|
||||
if (short_list != NULL) {
|
||||
sort_conditions[1] = g_strdup ("has (['");
|
||||
|
@ -388,18 +390,20 @@ nautilus_mime_get_default_component_for_uri_internal (const char *uri, gboolean
|
|||
|
||||
|
||||
OAF_ServerInfo *
|
||||
nautilus_mime_get_default_component_for_uri (const char *uri)
|
||||
nautilus_mime_get_default_component_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file)
|
||||
{
|
||||
return nautilus_mime_get_default_component_for_uri_internal (uri, NULL);
|
||||
return nautilus_mime_get_default_component_for_uri_internal (directory, file, NULL);
|
||||
}
|
||||
|
||||
gboolean
|
||||
nautilus_mime_is_default_component_for_uri_user_chosen (const char *uri)
|
||||
nautilus_mime_is_default_component_for_uri_user_chosen (NautilusDirectory *directory,
|
||||
NautilusFile *file)
|
||||
{
|
||||
OAF_ServerInfo *component;
|
||||
gboolean user_chosen;
|
||||
|
||||
component = nautilus_mime_get_default_component_for_uri_internal (uri, &user_chosen);
|
||||
component = nautilus_mime_get_default_component_for_uri_internal (directory, file, &user_chosen);
|
||||
|
||||
/* Doesn't count as user chosen if the user-specified data is bogus and doesn't
|
||||
* result in an actual component.
|
||||
|
@ -415,12 +419,12 @@ nautilus_mime_is_default_component_for_uri_user_chosen (const char *uri)
|
|||
|
||||
|
||||
GList *
|
||||
nautilus_mime_get_short_list_applications_for_uri (const char *uri)
|
||||
nautilus_mime_get_short_list_applications_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file)
|
||||
{
|
||||
char *mime_type;
|
||||
GList *result;
|
||||
GList *removed;
|
||||
NautilusDirectory *directory;
|
||||
GList *metadata_application_add_ids;
|
||||
GList *metadata_application_remove_ids;
|
||||
GList *p;
|
||||
|
@ -429,8 +433,6 @@ nautilus_mime_get_short_list_applications_for_uri (const char *uri)
|
|||
|
||||
CORBA_exception_init (&ev);
|
||||
|
||||
directory = nautilus_directory_get (uri);
|
||||
|
||||
nautilus_directory_wait_for_metadata (directory);
|
||||
metadata_application_add_ids = nautilus_directory_get_metadata_list
|
||||
(directory,
|
||||
|
@ -440,9 +442,8 @@ nautilus_mime_get_short_list_applications_for_uri (const char *uri)
|
|||
(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);
|
||||
mime_type = get_mime_type_from_file (file);
|
||||
result = gnome_vfs_mime_get_short_list_applications (mime_type);
|
||||
g_free (mime_type);
|
||||
|
||||
|
@ -472,15 +473,16 @@ nautilus_mime_get_short_list_applications_for_uri (const char *uri)
|
|||
}
|
||||
|
||||
GList *
|
||||
nautilus_mime_get_short_list_components_for_uri (const char *uri)
|
||||
nautilus_mime_get_short_list_components_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file)
|
||||
{
|
||||
char *uri;
|
||||
char *mime_type;
|
||||
char *uri_scheme;
|
||||
GList *servers;
|
||||
GList *iids;
|
||||
GList *result;
|
||||
GList *removed;
|
||||
NautilusDirectory *directory;
|
||||
GList *metadata_component_add_ids;
|
||||
GList *metadata_component_remove_ids;
|
||||
GList *p;
|
||||
|
@ -494,13 +496,15 @@ nautilus_mime_get_short_list_components_for_uri (const char *uri)
|
|||
|
||||
CORBA_exception_init (&ev);
|
||||
|
||||
uri = nautilus_file_get_uri (file);
|
||||
|
||||
uri_scheme = uri_string_get_scheme (uri);
|
||||
|
||||
directory = nautilus_directory_get (uri);
|
||||
g_free (uri);
|
||||
|
||||
/* Arrange for all the file attributes we will need. */
|
||||
attributes = NULL;
|
||||
attributes = g_list_prepend (attributes, NAUTILUS_FILE_ATTRIBUTE_FAST_MIME_TYPE);
|
||||
attributes = g_list_prepend (attributes, NAUTILUS_FILE_ATTRIBUTE_MIME_TYPE);
|
||||
|
||||
files = nautilus_directory_wait_until_ready (directory, attributes, TRUE);
|
||||
explicit_iids = get_explicit_content_view_iids_from_metafile (directory);
|
||||
|
@ -514,9 +518,8 @@ nautilus_mime_get_short_list_components_for_uri (const char *uri)
|
|||
(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);
|
||||
mime_type = get_mime_type_from_file (file);
|
||||
servers = gnome_vfs_mime_get_short_list_components (mime_type);
|
||||
iids = NULL;
|
||||
|
||||
|
@ -574,38 +577,38 @@ nautilus_mime_get_short_list_components_for_uri (const char *uri)
|
|||
return result;
|
||||
}
|
||||
|
||||
/* FIXME: we should disable this for 1.0 I think */
|
||||
|
||||
char *
|
||||
nautilus_mime_get_short_list_methods_for_uri (const char *uri)
|
||||
nautilus_mime_get_short_list_methods_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file)
|
||||
{
|
||||
char *mime_type;
|
||||
const char *method;
|
||||
|
||||
mime_type = get_mime_type_from_uri (uri);
|
||||
mime_type = get_mime_type_from_file (file);
|
||||
method = gnome_vfs_mime_get_value (mime_type, "vfs-method");
|
||||
g_free (mime_type);
|
||||
return g_strdup (method);
|
||||
}
|
||||
|
||||
GList *
|
||||
nautilus_mime_get_all_applications_for_uri (const char *uri)
|
||||
nautilus_mime_get_all_applications_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file)
|
||||
{
|
||||
char *mime_type;
|
||||
GList *result;
|
||||
NautilusDirectory *directory;
|
||||
GList *metadata_application_ids;
|
||||
GList *p;
|
||||
GnomeVFSMimeApplication *application;
|
||||
|
||||
directory = nautilus_directory_get (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);
|
||||
nautilus_directory_unref (directory);
|
||||
|
||||
mime_type = get_mime_type_from_uri (uri);
|
||||
mime_type = get_mime_type_from_file (file);
|
||||
|
||||
result = gnome_vfs_mime_get_all_applications (mime_type);
|
||||
|
||||
|
@ -626,12 +629,13 @@ nautilus_mime_get_all_applications_for_uri (const char *uri)
|
|||
}
|
||||
|
||||
gboolean
|
||||
nautilus_mime_has_any_applications_for_uri (const char *uri)
|
||||
nautilus_mime_has_any_applications_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file)
|
||||
{
|
||||
GList *list;
|
||||
gboolean result;
|
||||
|
||||
list = nautilus_mime_get_all_applications_for_uri (uri);
|
||||
list = nautilus_mime_get_all_applications_for_uri (directory, file);
|
||||
result = list != NULL;
|
||||
gnome_vfs_mime_application_list_free (list);
|
||||
|
||||
|
@ -639,27 +643,29 @@ nautilus_mime_has_any_applications_for_uri (const char *uri)
|
|||
}
|
||||
|
||||
GList *
|
||||
nautilus_mime_get_all_components_for_uri (const char *uri)
|
||||
nautilus_mime_get_all_components_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file)
|
||||
{
|
||||
char *uri;
|
||||
char *mime_type;
|
||||
char *uri_scheme;
|
||||
GList *files;
|
||||
GList *attributes;
|
||||
GList *info_list;
|
||||
NautilusDirectory *directory;
|
||||
GList *explicit_iids;
|
||||
CORBA_Environment ev;
|
||||
|
||||
CORBA_exception_init (&ev);
|
||||
|
||||
mime_type = get_mime_type_from_uri (uri);
|
||||
mime_type = get_mime_type_from_file (file);
|
||||
|
||||
uri = nautilus_file_get_uri (file);
|
||||
uri_scheme = uri_string_get_scheme (uri);
|
||||
|
||||
directory = nautilus_directory_get (uri);
|
||||
|
||||
g_free (uri);
|
||||
|
||||
/* Arrange for all the file attributes we will need. */
|
||||
attributes = NULL;
|
||||
attributes = g_list_prepend (attributes, NAUTILUS_FILE_ATTRIBUTE_FAST_MIME_TYPE);
|
||||
attributes = g_list_prepend (attributes, NAUTILUS_FILE_ATTRIBUTE_MIME_TYPE);
|
||||
|
||||
files = nautilus_directory_wait_until_ready (directory, attributes, TRUE);
|
||||
explicit_iids = get_explicit_content_view_iids_from_metafile (directory);
|
||||
|
@ -676,12 +682,13 @@ nautilus_mime_get_all_components_for_uri (const char *uri)
|
|||
}
|
||||
|
||||
gboolean
|
||||
nautilus_mime_has_any_components_for_uri (const char *uri)
|
||||
nautilus_mime_has_any_components_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file)
|
||||
{
|
||||
GList *list;
|
||||
gboolean result;
|
||||
|
||||
list = nautilus_mime_get_all_components_for_uri (uri);
|
||||
list = nautilus_mime_get_all_components_for_uri (directory, file);
|
||||
result = list != NULL;
|
||||
gnome_vfs_mime_component_list_free (list);
|
||||
|
||||
|
@ -689,10 +696,10 @@ nautilus_mime_has_any_components_for_uri (const char *uri)
|
|||
}
|
||||
|
||||
GnomeVFSResult
|
||||
nautilus_mime_set_default_action_type_for_uri (const char *uri,
|
||||
nautilus_mime_set_default_action_type_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file,
|
||||
GnomeVFSMimeActionType action_type)
|
||||
{
|
||||
NautilusDirectory *directory;
|
||||
const char *action_string;
|
||||
|
||||
switch (action_type) {
|
||||
|
@ -707,65 +714,54 @@ nautilus_mime_set_default_action_type_for_uri (const char *uri,
|
|||
action_string = "none";
|
||||
}
|
||||
|
||||
directory = nautilus_directory_get (uri);
|
||||
|
||||
nautilus_directory_wait_for_metadata (directory);
|
||||
nautilus_directory_set_metadata
|
||||
(directory, NAUTILUS_METADATA_KEY_DEFAULT_ACTION_TYPE, NULL, action_string);
|
||||
nautilus_directory_unref (directory);
|
||||
|
||||
return GNOME_VFS_OK;
|
||||
}
|
||||
|
||||
GnomeVFSResult
|
||||
nautilus_mime_set_default_application_for_uri (const char *uri,
|
||||
const char *application_id)
|
||||
nautilus_mime_set_default_application_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file,
|
||||
const char *application_id)
|
||||
{
|
||||
NautilusDirectory *directory;
|
||||
|
||||
directory = nautilus_directory_get (uri);
|
||||
|
||||
nautilus_directory_wait_for_metadata (directory);
|
||||
nautilus_directory_set_metadata
|
||||
(directory, NAUTILUS_METADATA_KEY_DEFAULT_APPLICATION, NULL, application_id);
|
||||
nautilus_directory_unref (directory);
|
||||
|
||||
/* If there's no default action type, set it to match this. */
|
||||
if (application_id != NULL &&
|
||||
nautilus_mime_get_default_action_type_for_uri (uri) == GNOME_VFS_MIME_ACTION_TYPE_NONE) {
|
||||
return nautilus_mime_set_default_action_type_for_uri (uri, GNOME_VFS_MIME_ACTION_TYPE_APPLICATION);
|
||||
nautilus_mime_get_default_action_type_for_uri (directory, file) == GNOME_VFS_MIME_ACTION_TYPE_NONE) {
|
||||
return nautilus_mime_set_default_action_type_for_uri (directory, file, GNOME_VFS_MIME_ACTION_TYPE_APPLICATION);
|
||||
}
|
||||
|
||||
return GNOME_VFS_OK;
|
||||
}
|
||||
|
||||
GnomeVFSResult
|
||||
nautilus_mime_set_default_component_for_uri (const char *uri,
|
||||
const char *component_iid)
|
||||
nautilus_mime_set_default_component_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file,
|
||||
const char *component_iid)
|
||||
{
|
||||
NautilusDirectory *directory;
|
||||
|
||||
directory = nautilus_directory_get (uri);
|
||||
|
||||
nautilus_directory_wait_for_metadata (directory);
|
||||
nautilus_directory_set_metadata
|
||||
(directory, NAUTILUS_METADATA_KEY_DEFAULT_COMPONENT, NULL, component_iid);
|
||||
nautilus_directory_unref (directory);
|
||||
|
||||
/* If there's no default action type, set it to match this. */
|
||||
if (component_iid != NULL &&
|
||||
nautilus_mime_get_default_action_type_for_uri (uri) == GNOME_VFS_MIME_ACTION_TYPE_NONE) {
|
||||
return nautilus_mime_set_default_action_type_for_uri (uri, GNOME_VFS_MIME_ACTION_TYPE_COMPONENT);
|
||||
nautilus_mime_get_default_action_type_for_uri (directory, file) == GNOME_VFS_MIME_ACTION_TYPE_NONE) {
|
||||
return nautilus_mime_set_default_action_type_for_uri (directory, file, GNOME_VFS_MIME_ACTION_TYPE_COMPONENT);
|
||||
}
|
||||
|
||||
return GNOME_VFS_OK;
|
||||
}
|
||||
|
||||
GnomeVFSResult
|
||||
nautilus_mime_set_short_list_applications_for_uri (const char *uri,
|
||||
GList *applications)
|
||||
nautilus_mime_set_short_list_applications_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file,
|
||||
GList *applications)
|
||||
{
|
||||
NautilusDirectory *directory;
|
||||
GList *add_list;
|
||||
GList *remove_list;
|
||||
GList *normal_short_list;
|
||||
|
@ -775,7 +771,7 @@ nautilus_mime_set_short_list_applications_for_uri (const char *uri,
|
|||
|
||||
/* get per-mime short list */
|
||||
|
||||
mime_type = get_mime_type_from_uri (uri);
|
||||
mime_type = get_mime_type_from_file (file);
|
||||
normal_short_list = gnome_vfs_mime_get_short_list_applications (mime_type);
|
||||
g_free (mime_type);
|
||||
|
||||
|
@ -789,8 +785,6 @@ nautilus_mime_set_short_list_applications_for_uri (const char *uri,
|
|||
add_list = str_list_difference (applications, normal_short_list_ids);
|
||||
remove_list = str_list_difference (normal_short_list_ids, applications);
|
||||
|
||||
directory = nautilus_directory_get (uri);
|
||||
|
||||
nautilus_directory_wait_for_metadata (directory);
|
||||
nautilus_directory_set_metadata_list
|
||||
(directory,
|
||||
|
@ -802,7 +796,6 @@ nautilus_mime_set_short_list_applications_for_uri (const char *uri,
|
|||
NAUTILUS_METADATA_KEY_SHORT_LIST_APPLICATION_REMOVE,
|
||||
NAUTILUS_METADATA_SUBKEY_APPLICATION_ID,
|
||||
remove_list);
|
||||
nautilus_directory_unref (directory);
|
||||
|
||||
/* FIXME bugzilla.eazel.com 1269:
|
||||
* need to free normal_short_list, normal_short_list_ids, add_list, remove_list
|
||||
|
@ -812,10 +805,10 @@ nautilus_mime_set_short_list_applications_for_uri (const char *uri,
|
|||
}
|
||||
|
||||
GnomeVFSResult
|
||||
nautilus_mime_set_short_list_components_for_uri (const char *uri,
|
||||
GList *components)
|
||||
nautilus_mime_set_short_list_components_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file,
|
||||
GList *components)
|
||||
{
|
||||
NautilusDirectory *directory;
|
||||
GList *add_list;
|
||||
GList *remove_list;
|
||||
GList *normal_short_list;
|
||||
|
@ -825,7 +818,7 @@ nautilus_mime_set_short_list_components_for_uri (const char *uri,
|
|||
|
||||
/* get per-mime short list */
|
||||
|
||||
mime_type = get_mime_type_from_uri (uri);
|
||||
mime_type = get_mime_type_from_file (file);
|
||||
normal_short_list = gnome_vfs_mime_get_short_list_components (mime_type);
|
||||
g_free (mime_type);
|
||||
|
||||
|
@ -839,8 +832,6 @@ nautilus_mime_set_short_list_components_for_uri (const char *uri,
|
|||
add_list = str_list_difference (components, normal_short_list_ids);
|
||||
remove_list = str_list_difference (normal_short_list_ids, components);
|
||||
|
||||
directory = nautilus_directory_get (uri);
|
||||
|
||||
nautilus_directory_wait_for_metadata (directory);
|
||||
nautilus_directory_set_metadata_list
|
||||
(directory,
|
||||
|
@ -852,7 +843,6 @@ nautilus_mime_set_short_list_components_for_uri (const char *uri,
|
|||
NAUTILUS_METADATA_KEY_SHORT_LIST_COMPONENT_REMOVE,
|
||||
NAUTILUS_METADATA_SUBKEY_COMPONENT_IID,
|
||||
remove_list);
|
||||
nautilus_directory_unref (directory);
|
||||
|
||||
/* FIXME bugzilla.eazel.com 1269:
|
||||
* need to free normal_short_list, normal_short_list_ids, add_list, remove_list
|
||||
|
@ -862,20 +852,21 @@ nautilus_mime_set_short_list_components_for_uri (const char *uri,
|
|||
}
|
||||
|
||||
GnomeVFSResult
|
||||
nautilus_mime_add_application_to_short_list_for_uri (const char *uri,
|
||||
const char *application_id)
|
||||
nautilus_mime_add_application_to_short_list_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file,
|
||||
const char *application_id)
|
||||
{
|
||||
GList *old_list, *new_list;
|
||||
GnomeVFSResult result;
|
||||
|
||||
result = GNOME_VFS_OK;
|
||||
|
||||
old_list = nautilus_mime_get_short_list_applications_for_uri (uri);
|
||||
old_list = nautilus_mime_get_short_list_applications_for_uri (directory, file);
|
||||
|
||||
if (!gnome_vfs_mime_id_in_application_list (application_id, old_list)) {
|
||||
new_list = g_list_append (gnome_vfs_mime_id_list_from_application_list (old_list),
|
||||
g_strdup (application_id));
|
||||
result = nautilus_mime_set_short_list_applications_for_uri (uri, new_list);
|
||||
result = nautilus_mime_set_short_list_applications_for_uri (directory, file, new_list);
|
||||
nautilus_g_list_free_deep (new_list);
|
||||
}
|
||||
|
||||
|
@ -885,14 +876,15 @@ nautilus_mime_add_application_to_short_list_for_uri (const char *uri,
|
|||
}
|
||||
|
||||
GnomeVFSResult
|
||||
nautilus_mime_remove_application_from_short_list_for_uri (const char *uri,
|
||||
const char *application_id)
|
||||
nautilus_mime_remove_application_from_short_list_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file,
|
||||
const char *application_id)
|
||||
{
|
||||
GList *old_list, *new_list;
|
||||
gboolean was_in_list;
|
||||
GnomeVFSResult result;
|
||||
|
||||
old_list = nautilus_mime_get_short_list_applications_for_uri (uri);
|
||||
old_list = nautilus_mime_get_short_list_applications_for_uri (directory, file);
|
||||
old_list = gnome_vfs_mime_remove_application_from_list
|
||||
(old_list, application_id, &was_in_list);
|
||||
|
||||
|
@ -900,7 +892,7 @@ nautilus_mime_remove_application_from_short_list_for_uri (const char *uri,
|
|||
result = GNOME_VFS_OK;
|
||||
} else {
|
||||
new_list = gnome_vfs_mime_id_list_from_application_list (old_list);
|
||||
result = nautilus_mime_set_short_list_applications_for_uri (uri, new_list);
|
||||
result = nautilus_mime_set_short_list_applications_for_uri (directory, file, new_list);
|
||||
nautilus_g_list_free_deep (new_list);
|
||||
}
|
||||
|
||||
|
@ -910,20 +902,21 @@ nautilus_mime_remove_application_from_short_list_for_uri (const char *uri,
|
|||
}
|
||||
|
||||
GnomeVFSResult
|
||||
nautilus_mime_add_component_to_short_list_for_uri (const char *uri,
|
||||
const char *iid)
|
||||
nautilus_mime_add_component_to_short_list_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file,
|
||||
const char *iid)
|
||||
{
|
||||
GList *old_list, *new_list;
|
||||
GnomeVFSResult result;
|
||||
|
||||
old_list = nautilus_mime_get_short_list_components_for_uri (uri);
|
||||
old_list = nautilus_mime_get_short_list_components_for_uri (directory, file);
|
||||
|
||||
if (gnome_vfs_mime_id_in_component_list (iid, old_list)) {
|
||||
result = GNOME_VFS_OK;
|
||||
} else {
|
||||
new_list = g_list_append (gnome_vfs_mime_id_list_from_component_list (old_list),
|
||||
g_strdup (iid));
|
||||
result = nautilus_mime_set_short_list_components_for_uri (uri, new_list);
|
||||
result = nautilus_mime_set_short_list_components_for_uri (directory, file, new_list);
|
||||
nautilus_g_list_free_deep (new_list);
|
||||
}
|
||||
|
||||
|
@ -933,14 +926,15 @@ nautilus_mime_add_component_to_short_list_for_uri (const char *uri,
|
|||
}
|
||||
|
||||
GnomeVFSResult
|
||||
nautilus_mime_remove_component_from_short_list_for_uri (const char *uri,
|
||||
const char *iid)
|
||||
nautilus_mime_remove_component_from_short_list_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file,
|
||||
const char *iid)
|
||||
{
|
||||
GList *old_list, *new_list;
|
||||
gboolean was_in_list;
|
||||
GnomeVFSResult result;
|
||||
|
||||
old_list = nautilus_mime_get_short_list_components_for_uri (uri);
|
||||
old_list = nautilus_mime_get_short_list_components_for_uri (directory, file);
|
||||
old_list = gnome_vfs_mime_remove_component_from_list
|
||||
(old_list, iid, &was_in_list);
|
||||
|
||||
|
@ -948,7 +942,7 @@ nautilus_mime_remove_component_from_short_list_for_uri (const char *uri,
|
|||
result = GNOME_VFS_OK;
|
||||
} else {
|
||||
new_list = gnome_vfs_mime_id_list_from_component_list (old_list);
|
||||
result = nautilus_mime_set_short_list_components_for_uri (uri, new_list);
|
||||
result = nautilus_mime_set_short_list_components_for_uri (directory, file, new_list);
|
||||
nautilus_g_list_free_deep (new_list);
|
||||
}
|
||||
|
||||
|
@ -958,15 +952,14 @@ nautilus_mime_remove_component_from_short_list_for_uri (const char *uri,
|
|||
}
|
||||
|
||||
GnomeVFSResult
|
||||
nautilus_mime_extend_all_applications_for_uri (const char *uri,
|
||||
GList *applications)
|
||||
nautilus_mime_extend_all_applications_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file,
|
||||
GList *applications)
|
||||
{
|
||||
NautilusDirectory *directory;
|
||||
GList *metadata_application_ids;
|
||||
GList *extras;
|
||||
GList *final_applications;
|
||||
|
||||
directory = nautilus_directory_get (uri);
|
||||
nautilus_directory_wait_for_metadata (directory);
|
||||
|
||||
metadata_application_ids = nautilus_directory_get_metadata_list
|
||||
|
@ -984,20 +977,17 @@ nautilus_mime_extend_all_applications_for_uri (const char *uri,
|
|||
NAUTILUS_METADATA_SUBKEY_APPLICATION_ID,
|
||||
final_applications);
|
||||
|
||||
nautilus_directory_unref (directory);
|
||||
|
||||
return GNOME_VFS_OK;
|
||||
}
|
||||
|
||||
GnomeVFSResult
|
||||
nautilus_mime_remove_from_all_applications_for_uri (const char *uri,
|
||||
GList *applications)
|
||||
nautilus_mime_remove_from_all_applications_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file,
|
||||
GList *applications)
|
||||
{
|
||||
NautilusDirectory *directory;
|
||||
GList *metadata_application_ids;
|
||||
GList *final_applications;
|
||||
|
||||
directory = nautilus_directory_get (uri);
|
||||
nautilus_directory_wait_for_metadata (directory);
|
||||
|
||||
metadata_application_ids = nautilus_directory_get_metadata_list
|
||||
|
@ -1012,37 +1002,43 @@ nautilus_mime_remove_from_all_applications_for_uri (const char *uri,
|
|||
NAUTILUS_METADATA_KEY_EXPLICIT_APPLICATION,
|
||||
NAUTILUS_METADATA_SUBKEY_APPLICATION_ID,
|
||||
final_applications);
|
||||
nautilus_directory_unref (directory);
|
||||
|
||||
return GNOME_VFS_OK;
|
||||
}
|
||||
|
||||
static gint
|
||||
gnome_vfs_mime_application_has_id (GnomeVFSMimeApplication *application, const char *id)
|
||||
gnome_vfs_mime_application_has_id (GnomeVFSMimeApplication *application,
|
||||
const char *id)
|
||||
{
|
||||
return strcmp (application->id, id);
|
||||
}
|
||||
|
||||
static gint
|
||||
gnome_vfs_mime_id_matches_application (const char *id, GnomeVFSMimeApplication *application)
|
||||
gnome_vfs_mime_id_matches_application (const char *id,
|
||||
GnomeVFSMimeApplication *application)
|
||||
{
|
||||
return gnome_vfs_mime_application_has_id (application, id);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gnome_vfs_mime_application_has_id_not_in_list (GnomeVFSMimeApplication *application, GList *ids)
|
||||
gnome_vfs_mime_application_has_id_not_in_list (GnomeVFSMimeApplication *application,
|
||||
GList *ids)
|
||||
{
|
||||
return g_list_find_custom (ids, application, (GCompareFunc) gnome_vfs_mime_id_matches_application) == NULL;
|
||||
return g_list_find_custom (ids, application,
|
||||
(GCompareFunc) gnome_vfs_mime_id_matches_application) == NULL;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
string_not_in_list (const char *str, GList *list)
|
||||
string_not_in_list (const char *str,
|
||||
GList *list)
|
||||
{
|
||||
return g_list_find_custom (list, (gpointer) str, (GCompareFunc) strcmp) == NULL;
|
||||
}
|
||||
|
||||
static char *
|
||||
extract_prefix_add_suffix (const char *string, const char *separator, const char *suffix)
|
||||
extract_prefix_add_suffix (const char *string,
|
||||
const char *separator,
|
||||
const char *suffix)
|
||||
{
|
||||
const char *separator_position;
|
||||
int prefix_length;
|
||||
|
@ -1138,7 +1134,10 @@ 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, GList *explicit_iids, const char *extra_requirements)
|
||||
make_oaf_query_with_known_mime_type (const char *mime_type,
|
||||
const char *uri_scheme,
|
||||
GList *explicit_iids,
|
||||
const char *extra_requirements)
|
||||
{
|
||||
char *mime_supertype;
|
||||
char *result;
|
||||
|
@ -1237,7 +1236,9 @@ make_oaf_query_with_known_mime_type (const char *mime_type, const char *uri_sche
|
|||
}
|
||||
|
||||
static char *
|
||||
make_oaf_query_with_uri_scheme_only (const char *uri_scheme, GList *explicit_iids, const char *extra_requirements)
|
||||
make_oaf_query_with_uri_scheme_only (const char *uri_scheme,
|
||||
GList *explicit_iids,
|
||||
const char *extra_requirements)
|
||||
{
|
||||
char *result;
|
||||
char *explicit_iid_query;
|
||||
|
@ -1335,7 +1336,9 @@ file_list_to_mime_type_hash_table (GList *files)
|
|||
}
|
||||
|
||||
static void
|
||||
free_key (gpointer key, gpointer value, gpointer user_data)
|
||||
free_key (gpointer key,
|
||||
gpointer value,
|
||||
gpointer user_data)
|
||||
{
|
||||
g_free (key);
|
||||
}
|
||||
|
@ -1348,7 +1351,9 @@ mime_type_hash_table_destroy (GHashTable *table)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
server_matches_content_requirements (OAF_ServerInfo *server, GHashTable *type_table, GList *explicit_iids)
|
||||
server_matches_content_requirements (OAF_ServerInfo *server,
|
||||
GHashTable *type_table,
|
||||
GList *explicit_iids)
|
||||
{
|
||||
OAF_Property *prop;
|
||||
GNOME_stringlist types;
|
||||
|
@ -1399,12 +1404,12 @@ static char *nautilus_sort_criteria[] = {
|
|||
|
||||
|
||||
static GList *
|
||||
nautilus_do_component_query (const char *mime_type,
|
||||
const char *uri_scheme,
|
||||
GList *files,
|
||||
GList *explicit_iids,
|
||||
char **extra_sort_criteria,
|
||||
char *extra_requirements,
|
||||
nautilus_do_component_query (const char *mime_type,
|
||||
const char *uri_scheme,
|
||||
GList *files,
|
||||
GList *explicit_iids,
|
||||
char **extra_sort_criteria,
|
||||
char *extra_requirements,
|
||||
CORBA_Environment *ev)
|
||||
{
|
||||
OAF_ServerInfoList *oaf_result;
|
||||
|
@ -1462,7 +1467,8 @@ nautilus_do_component_query (const char *mime_type,
|
|||
|
||||
|
||||
static GList *
|
||||
str_list_difference (GList *a, GList *b)
|
||||
str_list_difference (GList *a,
|
||||
GList *b)
|
||||
{
|
||||
GList *p;
|
||||
GList *retval;
|
||||
|
@ -1481,36 +1487,29 @@ str_list_difference (GList *a, GList *b)
|
|||
|
||||
|
||||
static char *
|
||||
get_mime_type_from_uri (const char *text_uri)
|
||||
get_mime_type_from_file (NautilusFile *file)
|
||||
{
|
||||
GnomeVFSURI *vfs_uri;
|
||||
GnomeVFSFileInfo *file_info;
|
||||
GnomeVFSResult result;
|
||||
char *type;
|
||||
|
||||
GList *file_attributes;
|
||||
|
||||
type = NULL;
|
||||
|
||||
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. */
|
||||
/* 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. */
|
||||
|
||||
if (file != NULL) {
|
||||
file_attributes = g_list_append (NULL, NAUTILUS_FILE_ATTRIBUTE_SLOW_MIME_TYPE);
|
||||
|
||||
vfs_uri = gnome_vfs_uri_new (text_uri);
|
||||
nautilus_file_wait_until_ready (file,
|
||||
file_attributes,
|
||||
FALSE);
|
||||
|
||||
if (vfs_uri != NULL) {
|
||||
file_info = gnome_vfs_file_info_new ();
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
g_list_free (file_attributes);
|
||||
|
||||
type = nautilus_file_get_mime_type (file);
|
||||
}
|
||||
|
||||
return type == NULL ? g_strdup ("application/octet-stream") : type;
|
||||
|
@ -1528,7 +1527,8 @@ strv_length (char **a)
|
|||
}
|
||||
|
||||
static char **
|
||||
strv_concat (char **a, char **b)
|
||||
strv_concat (char **a,
|
||||
char **b)
|
||||
{
|
||||
int a_length;
|
||||
int b_length;
|
||||
|
|
|
@ -27,44 +27,76 @@
|
|||
|
||||
#include <libgnomevfs/gnome-vfs-mime-handlers.h>
|
||||
|
||||
GnomeVFSMimeActionType nautilus_mime_get_default_action_type_for_uri (const char *uri);
|
||||
GnomeVFSMimeAction * nautilus_mime_get_default_action_for_uri (const char *uri);
|
||||
GnomeVFSMimeApplication *nautilus_mime_get_default_application_for_uri (const char *uri);
|
||||
gboolean nautilus_mime_is_default_application_for_uri_user_chosen (const char *uri);
|
||||
OAF_ServerInfo * nautilus_mime_get_default_component_for_uri (const char *uri);
|
||||
gboolean nautilus_mime_is_default_component_for_uri_user_chosen (const char *uri);
|
||||
GList * nautilus_mime_get_short_list_applications_for_uri (const char *uri);
|
||||
GList * nautilus_mime_get_short_list_components_for_uri (const char *uri);
|
||||
gchar * nautilus_mime_get_short_list_methods_for_uri (const char *uri);
|
||||
GList * nautilus_mime_get_all_applications_for_uri (const char *uri);
|
||||
GList * nautilus_mime_get_all_components_for_uri (const char *uri);
|
||||
gboolean nautilus_mime_has_any_components_for_uri (const char *uri);
|
||||
gboolean nautilus_mime_has_any_applications_for_uri (const char *uri);
|
||||
GnomeVFSResult nautilus_mime_set_default_action_type_for_uri (const char *uri,
|
||||
#include <libnautilus-extensions/nautilus-directory.h>
|
||||
#include <libnautilus-extensions/nautilus-file.h>
|
||||
|
||||
/* FIXME: This API requires passing both a NautilusDirectory and a
|
||||
NautilusFile for the same URI, because it requires both the mime type
|
||||
and the metadata for the location. */
|
||||
|
||||
|
||||
GnomeVFSMimeActionType nautilus_mime_get_default_action_type_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file);
|
||||
GnomeVFSMimeAction * nautilus_mime_get_default_action_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file);
|
||||
GnomeVFSMimeApplication *nautilus_mime_get_default_application_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file);
|
||||
gboolean nautilus_mime_is_default_application_for_uri_user_chosen (NautilusDirectory *directory,
|
||||
NautilusFile *file);
|
||||
OAF_ServerInfo * nautilus_mime_get_default_component_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file);
|
||||
gboolean nautilus_mime_is_default_component_for_uri_user_chosen (NautilusDirectory *directory,
|
||||
NautilusFile *file);
|
||||
GList * nautilus_mime_get_short_list_applications_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file);
|
||||
GList * nautilus_mime_get_short_list_components_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file);
|
||||
gchar * nautilus_mime_get_short_list_methods_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file);
|
||||
GList * nautilus_mime_get_all_applications_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file);
|
||||
GList * nautilus_mime_get_all_components_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file);
|
||||
gboolean nautilus_mime_has_any_components_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file);
|
||||
gboolean nautilus_mime_has_any_applications_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file);
|
||||
GnomeVFSResult nautilus_mime_set_default_action_type_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file,
|
||||
GnomeVFSMimeActionType action_type);
|
||||
GnomeVFSResult nautilus_mime_set_default_application_for_uri (const char *uri,
|
||||
GnomeVFSResult nautilus_mime_set_default_application_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file,
|
||||
const char *application_id);
|
||||
GnomeVFSResult nautilus_mime_set_default_component_for_uri (const char *uri,
|
||||
GnomeVFSResult nautilus_mime_set_default_component_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file,
|
||||
const char *component_iid);
|
||||
/* Stored as delta to current user level */
|
||||
GnomeVFSResult nautilus_mime_set_short_list_applications_for_uri (const char *uri,
|
||||
GnomeVFSResult nautilus_mime_set_short_list_applications_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file,
|
||||
GList *applications);
|
||||
GnomeVFSResult nautilus_mime_set_short_list_components_for_uri (const char *uri,
|
||||
GnomeVFSResult nautilus_mime_set_short_list_components_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file,
|
||||
GList *components);
|
||||
GnomeVFSResult nautilus_mime_add_application_to_short_list_for_uri (const char *uri,
|
||||
GnomeVFSResult nautilus_mime_add_application_to_short_list_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file,
|
||||
const char *application_id);
|
||||
GnomeVFSResult nautilus_mime_remove_application_from_short_list_for_uri (const char *uri,
|
||||
GnomeVFSResult nautilus_mime_remove_application_from_short_list_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file,
|
||||
const char *application_id);
|
||||
GnomeVFSResult nautilus_mime_add_component_to_short_list_for_uri (const char *uri,
|
||||
GnomeVFSResult nautilus_mime_add_component_to_short_list_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file,
|
||||
const char *iid);
|
||||
GnomeVFSResult nautilus_mime_remove_component_from_short_list_for_uri (const char *uri,
|
||||
GnomeVFSResult nautilus_mime_remove_component_from_short_list_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file,
|
||||
const char *iid);
|
||||
|
||||
/* No way to override system list; can only add. */
|
||||
GnomeVFSResult nautilus_mime_extend_all_applications_for_uri (const char *uri,
|
||||
GnomeVFSResult nautilus_mime_extend_all_applications_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file,
|
||||
GList *applications);
|
||||
/* Only "user" entries may be removed. */
|
||||
GnomeVFSResult nautilus_mime_remove_from_all_applications_for_uri (const char *uri,
|
||||
GnomeVFSResult nautilus_mime_remove_from_all_applications_for_uri (NautilusDirectory *directory,
|
||||
NautilusFile *file,
|
||||
GList *applications);
|
||||
|
||||
/* No way to add to all components; oafinfo database assumed trusted in this regard. */
|
||||
|
|
|
@ -311,6 +311,7 @@ repopulate_program_list (GnomeDialog *program_chooser,
|
|||
{
|
||||
char **text;
|
||||
char *uri;
|
||||
NautilusDirectory *directory;
|
||||
GList *programs, *program;
|
||||
ProgramFilePair *pair;
|
||||
int new_row;
|
||||
|
@ -322,11 +323,14 @@ repopulate_program_list (GnomeDialog *program_chooser,
|
|||
|| type == GNOME_VFS_MIME_ACTION_TYPE_APPLICATION);
|
||||
|
||||
uri = nautilus_file_get_uri (file);
|
||||
programs = type == GNOME_VFS_MIME_ACTION_TYPE_COMPONENT
|
||||
? nautilus_mime_get_all_components_for_uri (uri)
|
||||
: nautilus_mime_get_all_applications_for_uri (uri);
|
||||
directory = nautilus_directory_get (uri);
|
||||
g_free (uri);
|
||||
|
||||
programs = type == GNOME_VFS_MIME_ACTION_TYPE_COMPONENT
|
||||
? nautilus_mime_get_all_components_for_uri (directory, file)
|
||||
: nautilus_mime_get_all_applications_for_uri (directory, file);
|
||||
nautilus_directory_unref (directory);
|
||||
|
||||
gtk_clist_clear (clist);
|
||||
|
||||
for (program = programs; program != NULL; program = program->next) {
|
||||
|
@ -484,11 +488,18 @@ is_application_default_for_uri (GnomeVFSMimeApplication *application, const char
|
|||
{
|
||||
GnomeVFSMimeApplication *default_application;
|
||||
gboolean result;
|
||||
NautilusFile *file;
|
||||
NautilusDirectory *directory;
|
||||
|
||||
g_assert (application != NULL);
|
||||
|
||||
default_application = nautilus_mime_get_default_application_for_uri (uri);
|
||||
file = nautilus_file_get (uri);
|
||||
directory = nautilus_directory_get (uri);
|
||||
|
||||
default_application = nautilus_mime_get_default_application_for_uri (directory, file);
|
||||
result = (default_application != NULL && strcmp (default_application->id, application->id) == 0);
|
||||
nautilus_directory_unref (directory);
|
||||
nautilus_file_unref (file);
|
||||
|
||||
gnome_vfs_mime_application_free (default_application);
|
||||
|
||||
|
@ -500,12 +511,20 @@ is_component_default_for_uri (NautilusViewIdentifier *identifier, const char *ur
|
|||
{
|
||||
OAF_ServerInfo *default_component;
|
||||
gboolean result;
|
||||
NautilusDirectory *directory;
|
||||
NautilusFile *file;
|
||||
|
||||
g_assert (identifier != NULL);
|
||||
|
||||
default_component = nautilus_mime_get_default_component_for_uri (uri);
|
||||
directory = nautilus_directory_get (uri);
|
||||
file = nautilus_file_get (uri);
|
||||
|
||||
default_component = nautilus_mime_get_default_component_for_uri (directory, file);
|
||||
result = (default_component != NULL && strcmp (default_component->iid, identifier->iid) == 0);
|
||||
|
||||
nautilus_directory_unref (directory);
|
||||
nautilus_file_unref (file);
|
||||
|
||||
CORBA_free (default_component);
|
||||
|
||||
return result;
|
||||
|
@ -532,14 +551,22 @@ is_component_in_short_list_for_uri (NautilusViewIdentifier *identifier, const ch
|
|||
{
|
||||
GList *list;
|
||||
gboolean result;
|
||||
NautilusDirectory *directory;
|
||||
NautilusFile *file;
|
||||
|
||||
list = nautilus_mime_get_short_list_components_for_uri (uri);
|
||||
directory = nautilus_directory_get (uri);
|
||||
file = nautilus_file_get (uri);
|
||||
|
||||
list = nautilus_mime_get_short_list_components_for_uri (directory, file);
|
||||
result = g_list_find_custom (list,
|
||||
identifier,
|
||||
(GCompareFunc)compare_component_with_view)
|
||||
!= NULL;
|
||||
gnome_vfs_mime_component_list_free (list);
|
||||
|
||||
nautilus_file_unref (file);
|
||||
nautilus_directory_unref (directory);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -564,14 +591,24 @@ is_application_in_short_list_for_uri (GnomeVFSMimeApplication *application, cons
|
|||
{
|
||||
GList *list;
|
||||
gboolean result;
|
||||
NautilusDirectory *directory;
|
||||
NautilusFile *file;
|
||||
|
||||
list = nautilus_mime_get_short_list_applications_for_uri (uri);
|
||||
directory = nautilus_directory_get (uri);
|
||||
file = nautilus_file_get (uri);
|
||||
|
||||
|
||||
list = nautilus_mime_get_short_list_applications_for_uri (directory, file);
|
||||
result = g_list_find_custom (list,
|
||||
application,
|
||||
(GCompareFunc)compare_mime_applications)
|
||||
!= NULL;
|
||||
gnome_vfs_mime_application_list_free (list);
|
||||
|
||||
|
||||
nautilus_directory_unref (directory);
|
||||
nautilus_file_unref (file);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -606,16 +643,20 @@ program_file_pair_is_default_for_file (ProgramFilePair *pair)
|
|||
{
|
||||
char *uri;
|
||||
gboolean result;
|
||||
|
||||
NautilusDirectory *directory;
|
||||
|
||||
g_assert (pair != NULL);
|
||||
g_assert (NAUTILUS_IS_FILE (pair->file));
|
||||
|
||||
uri = nautilus_file_get_uri (pair->file);
|
||||
directory = nautilus_directory_get (uri);
|
||||
|
||||
if (pair->action_type != nautilus_mime_get_default_action_type_for_uri (uri)) {
|
||||
if (pair->action_type != nautilus_mime_get_default_action_type_for_uri (directory, pair->file)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
nautilus_directory_unref (directory);
|
||||
|
||||
if (pair->action_type == GNOME_VFS_MIME_ACTION_TYPE_COMPONENT) {
|
||||
result = is_component_default_for_uri (pair->view_identifier, uri);
|
||||
} else {
|
||||
|
@ -778,15 +819,18 @@ static void
|
|||
add_to_short_list_for_file (ProgramFilePair *pair)
|
||||
{
|
||||
char *uri;
|
||||
NautilusDirectory *directory;
|
||||
|
||||
uri = nautilus_file_get_uri (pair->file);
|
||||
|
||||
if (pair->action_type == GNOME_VFS_MIME_ACTION_TYPE_APPLICATION) {
|
||||
nautilus_mime_add_application_to_short_list_for_uri (uri, pair->application->id);
|
||||
} else {
|
||||
nautilus_mime_add_component_to_short_list_for_uri (uri, pair->view_identifier->iid);
|
||||
}
|
||||
directory = nautilus_directory_get (uri);
|
||||
|
||||
if (pair->action_type == GNOME_VFS_MIME_ACTION_TYPE_APPLICATION) {
|
||||
nautilus_mime_add_application_to_short_list_for_uri (directory, pair->file, pair->application->id);
|
||||
} else {
|
||||
nautilus_mime_add_component_to_short_list_for_uri (directory, pair->file, pair->view_identifier->iid);
|
||||
}
|
||||
|
||||
nautilus_directory_unref (directory);
|
||||
g_free (uri);
|
||||
}
|
||||
|
||||
|
@ -794,15 +838,18 @@ static void
|
|||
remove_from_short_list_for_file (ProgramFilePair *pair)
|
||||
{
|
||||
char *uri;
|
||||
NautilusDirectory *directory;
|
||||
|
||||
uri = nautilus_file_get_uri (pair->file);
|
||||
|
||||
directory = nautilus_directory_get (uri);
|
||||
|
||||
if (pair->action_type == GNOME_VFS_MIME_ACTION_TYPE_APPLICATION) {
|
||||
nautilus_mime_remove_application_from_short_list_for_uri (uri, pair->application->id);
|
||||
nautilus_mime_remove_application_from_short_list_for_uri (directory, pair->file, pair->application->id);
|
||||
} else {
|
||||
nautilus_mime_remove_component_from_short_list_for_uri (uri, pair->view_identifier->iid);
|
||||
nautilus_mime_remove_component_from_short_list_for_uri (directory, pair->file, pair->view_identifier->iid);
|
||||
}
|
||||
|
||||
nautilus_directory_unref (directory);
|
||||
g_free (uri);
|
||||
}
|
||||
|
||||
|
@ -862,29 +909,32 @@ static void
|
|||
remove_default_for_item (ProgramFilePair *pair)
|
||||
{
|
||||
char *uri;
|
||||
NautilusDirectory *directory;
|
||||
|
||||
uri = nautilus_file_get_uri (pair->file);
|
||||
directory = nautilus_directory_get (uri);
|
||||
|
||||
if (pair->action_type == GNOME_VFS_MIME_ACTION_TYPE_APPLICATION) {
|
||||
/* If the default is just falling through to the default for this type,
|
||||
* don't do anything here.
|
||||
*/
|
||||
if (nautilus_mime_is_default_application_for_uri_user_chosen (uri)) {
|
||||
if (nautilus_mime_is_default_application_for_uri_user_chosen (directory, pair->file)) {
|
||||
if (is_application_default_for_uri (pair->application, uri)) {
|
||||
nautilus_mime_set_default_application_for_uri (uri, NULL);
|
||||
nautilus_mime_set_default_application_for_uri (directory, pair->file, NULL);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* If the default is just falling through to the default for this type,
|
||||
* don't do anything here.
|
||||
*/
|
||||
if (nautilus_mime_is_default_component_for_uri_user_chosen (uri)) {
|
||||
if (nautilus_mime_is_default_component_for_uri_user_chosen (directory, pair->file)) {
|
||||
if (is_component_default_for_uri (pair->view_identifier, uri)) {
|
||||
nautilus_mime_set_default_component_for_uri (uri, NULL);
|
||||
nautilus_mime_set_default_component_for_uri (directory, pair->file, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nautilus_directory_unref (directory);
|
||||
g_free (uri);
|
||||
}
|
||||
|
||||
|
@ -910,17 +960,22 @@ static void
|
|||
set_default_for_item (ProgramFilePair *pair)
|
||||
{
|
||||
char *uri;
|
||||
NautilusDirectory *directory;
|
||||
|
||||
uri = nautilus_file_get_uri (pair->file);
|
||||
directory = nautilus_directory_get (uri);
|
||||
|
||||
uri = nautilus_file_get_uri (pair->file);
|
||||
|
||||
if (pair->action_type == GNOME_VFS_MIME_ACTION_TYPE_APPLICATION) {
|
||||
nautilus_mime_set_default_application_for_uri (uri, pair->application->id);
|
||||
nautilus_mime_set_default_application_for_uri (directory, pair->file, pair->application->id);
|
||||
} else {
|
||||
nautilus_mime_set_default_component_for_uri (uri, pair->view_identifier->iid);
|
||||
nautilus_mime_set_default_component_for_uri (directory, pair->file, pair->view_identifier->iid);
|
||||
}
|
||||
|
||||
nautilus_mime_set_default_action_type_for_uri (uri, pair->action_type);
|
||||
|
||||
nautilus_mime_set_default_action_type_for_uri (directory, pair->file, pair->action_type);
|
||||
|
||||
nautilus_directory_unref (directory);
|
||||
g_free (uri);
|
||||
}
|
||||
|
||||
|
|
|
@ -41,16 +41,19 @@ any_programs_available_for_file (GnomeVFSMimeActionType action_type, NautilusFil
|
|||
{
|
||||
gboolean result;
|
||||
char *uri;
|
||||
NautilusDirectory *directory;
|
||||
|
||||
uri = nautilus_file_get_uri (file);
|
||||
directory = nautilus_directory_get (uri);
|
||||
|
||||
if (action_type == GNOME_VFS_MIME_ACTION_TYPE_COMPONENT) {
|
||||
result = nautilus_mime_has_any_components_for_uri (uri);
|
||||
result = nautilus_mime_has_any_components_for_uri (directory, file);
|
||||
} else {
|
||||
g_assert (action_type == GNOME_VFS_MIME_ACTION_TYPE_APPLICATION);
|
||||
result = nautilus_mime_has_any_applications_for_uri (uri);
|
||||
result = nautilus_mime_has_any_applications_for_uri (directory, file);
|
||||
}
|
||||
|
||||
nautilus_directory_unref (directory);
|
||||
g_free (uri);
|
||||
|
||||
return result;
|
||||
|
|
38
libnautilus-private/nautilus-wait-until-ready.h
Normal file
38
libnautilus-private/nautilus-wait-until-ready.h
Normal file
|
@ -0,0 +1,38 @@
|
|||
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
|
||||
|
||||
/*
|
||||
* Nautilus
|
||||
*
|
||||
* Copyright (C) 2000 Red Hat, Inc.
|
||||
*
|
||||
* Nautilus is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* Nautilus is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this program; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* Authors: Maciej Stachowiak
|
||||
*/
|
||||
|
||||
/* nautilus-wait-until-ready.h: I'm adding this file as a temporary
|
||||
* measure in the process of eliminating the wait_until_ready calls. It
|
||||
* is deprecated! Do not use these calls in new code!
|
||||
*/
|
||||
|
||||
GList * nautilus_directory_wait_until_ready (NautilusDirectory *directory,
|
||||
GList *file_attributes,
|
||||
gboolean wait_for_metadata);
|
||||
|
||||
|
||||
void nautilus_file_wait_until_ready (NautilusFile *file,
|
||||
GList *attributes,
|
||||
gboolean wait_for_metadata);
|
|
@ -553,10 +553,16 @@ switch_location_and_view (NautilusViewIdentifier *identifier,
|
|||
const char *new_uri,
|
||||
FMDirectoryView *directory_view)
|
||||
{
|
||||
NautilusDirectory *directory;
|
||||
NautilusFile *file;
|
||||
|
||||
g_assert (FM_IS_DIRECTORY_VIEW (directory_view));
|
||||
g_assert (identifier != NULL);
|
||||
g_assert (new_uri != NULL);
|
||||
|
||||
directory = nautilus_directory_get (new_uri);
|
||||
file = nautilus_file_get (new_uri);
|
||||
|
||||
/* User has explicitly chosen a viewer other than the default, so
|
||||
* make it the default and then switch locations.
|
||||
*/
|
||||
|
@ -564,7 +570,10 @@ switch_location_and_view (NautilusViewIdentifier *identifier,
|
|||
* for switching location and viewer together, so we don't have to
|
||||
* rely on metadata for holding the default location.
|
||||
*/
|
||||
nautilus_mime_set_default_component_for_uri (new_uri, identifier->iid);
|
||||
nautilus_mime_set_default_component_for_uri (directory, file, identifier->iid);
|
||||
|
||||
nautilus_directory_unref (directory);
|
||||
nautilus_file_unref (file);
|
||||
|
||||
fm_directory_view_switch_location
|
||||
(directory_view, new_uri,
|
||||
|
@ -2902,6 +2911,7 @@ create_open_with_gtk_menu (FMDirectoryView *view, GList *files)
|
|||
GList *applications, *components;
|
||||
GList *node;
|
||||
char *uri;
|
||||
NautilusDirectory *directory;
|
||||
|
||||
open_with_menu = GTK_MENU (gtk_menu_new ());
|
||||
gtk_widget_show (GTK_WIDGET (open_with_menu));
|
||||
|
@ -2910,7 +2920,9 @@ create_open_with_gtk_menu (FMDirectoryView *view, GList *files)
|
|||
if (nautilus_g_list_exactly_one_item (files)) {
|
||||
uri = nautilus_file_get_uri (NAUTILUS_FILE (files->data));
|
||||
|
||||
applications = nautilus_mime_get_short_list_applications_for_uri (uri);
|
||||
directory = nautilus_directory_get (uri);
|
||||
|
||||
applications = nautilus_mime_get_short_list_applications_for_uri (directory, NAUTILUS_FILE (files->data));
|
||||
for (node = applications; node != NULL; node = node->next) {
|
||||
add_application_to_gtk_menu (view, open_with_menu, node->data, uri);
|
||||
}
|
||||
|
@ -2924,12 +2936,14 @@ create_open_with_gtk_menu (FMDirectoryView *view, GList *files)
|
|||
|
||||
nautilus_gtk_menu_append_separator (open_with_menu);
|
||||
|
||||
components = nautilus_mime_get_short_list_components_for_uri (uri);
|
||||
components = nautilus_mime_get_short_list_components_for_uri (directory, NAUTILUS_FILE (files->data));
|
||||
for (node = components; node != NULL; node = node->next) {
|
||||
add_component_to_gtk_menu (view, open_with_menu, node->data, uri);
|
||||
}
|
||||
gnome_vfs_mime_component_list_free (components);
|
||||
|
||||
|
||||
nautilus_directory_unref (directory);
|
||||
g_free (uri);
|
||||
|
||||
append_gtk_menu_item (view,
|
||||
|
@ -3187,6 +3201,7 @@ reset_bonobo_open_with_menu (FMDirectoryView *view, BonoboUIHandler *ui_handler,
|
|||
GList *applications, *components;
|
||||
GList *node;
|
||||
char *uri;
|
||||
NautilusDirectory *directory;
|
||||
|
||||
/* Remove old copy of this menu (if any) */
|
||||
bonobo_ui_handler_menu_remove
|
||||
|
@ -3203,8 +3218,9 @@ reset_bonobo_open_with_menu (FMDirectoryView *view, BonoboUIHandler *ui_handler,
|
|||
/* 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));
|
||||
directory = nautilus_directory_get (uri);
|
||||
|
||||
applications = nautilus_mime_get_short_list_applications_for_uri (uri);
|
||||
applications = nautilus_mime_get_short_list_applications_for_uri (directory, NAUTILUS_FILE (selection->data));
|
||||
|
||||
for (node = applications; node != NULL; node = node->next) {
|
||||
add_application_to_bonobo_menu (ui_handler, node->data, uri, view);
|
||||
|
@ -3226,7 +3242,7 @@ reset_bonobo_open_with_menu (FMDirectoryView *view, BonoboUIHandler *ui_handler,
|
|||
FM_DIRECTORY_VIEW_MENU_PATH_SEPARATOR_BEFORE_VIEWERS,
|
||||
-1);
|
||||
|
||||
components = nautilus_mime_get_short_list_components_for_uri (uri);
|
||||
components = nautilus_mime_get_short_list_components_for_uri (directory, NAUTILUS_FILE (selection->data));
|
||||
|
||||
for (node = components; node != NULL; node = node->next) {
|
||||
add_component_to_bonobo_menu (ui_handler, node->data, uri, view);
|
||||
|
@ -3243,6 +3259,8 @@ reset_bonobo_open_with_menu (FMDirectoryView *view, BonoboUIHandler *ui_handler,
|
|||
0, 0,
|
||||
(BonoboUIHandlerCallback) other_viewer_callback, view);
|
||||
|
||||
nautilus_directory_unref (directory);
|
||||
|
||||
g_free (uri);
|
||||
}
|
||||
}
|
||||
|
@ -3630,6 +3648,7 @@ activate_callback (NautilusFile *file, gpointer callback_data)
|
|||
GnomeVFSMimeActionType action_type;
|
||||
GnomeVFSMimeApplication *application;
|
||||
gboolean performed_special_handling;
|
||||
NautilusDirectory *directory;
|
||||
|
||||
parameters = callback_data;
|
||||
|
||||
|
@ -3677,8 +3696,10 @@ activate_callback (NautilusFile *file, gpointer callback_data)
|
|||
}
|
||||
|
||||
if (!performed_special_handling) {
|
||||
action_type = nautilus_mime_get_default_action_type_for_uri (uri);
|
||||
application = nautilus_mime_get_default_application_for_uri (uri);
|
||||
directory = nautilus_directory_get (uri);
|
||||
|
||||
action_type = nautilus_mime_get_default_action_type_for_uri (directory, file);
|
||||
application = nautilus_mime_get_default_application_for_uri (directory, file);
|
||||
|
||||
/* We need to check for the case of having
|
||||
* GNOME_VFS_MIME_ACTION_TYPE_APPLICATION as the
|
||||
|
@ -3707,6 +3728,8 @@ activate_callback (NautilusFile *file, gpointer callback_data)
|
|||
if (application != NULL) {
|
||||
gnome_vfs_mime_application_free (application);
|
||||
}
|
||||
|
||||
nautilus_directory_unref (directory);
|
||||
}
|
||||
|
||||
g_free (uri);
|
||||
|
|
|
@ -131,7 +131,7 @@ got_file_info_callback (GnomeVFSAsyncHandle *ah,
|
|||
goto out;
|
||||
}
|
||||
|
||||
default_component = nautilus_mime_get_default_component_for_uri (navinfo->location);
|
||||
default_component = nautilus_mime_get_default_component_for_uri (navinfo->directory, navinfo->file);
|
||||
if (default_component != NULL) {
|
||||
default_id = nautilus_view_identifier_new_from_content_view (default_component);
|
||||
CORBA_free (default_component);
|
||||
|
@ -149,7 +149,7 @@ got_file_info_callback (GnomeVFSAsyncHandle *ah,
|
|||
/* Map GnomeVFSResult to one of the types that Nautilus knows how to handle. */
|
||||
if (vfs_result_code == GNOME_VFS_OK && default_id == NULL) {
|
||||
/* If the complete list is non-empty, the default shouldn't have been NULL */
|
||||
g_assert (!nautilus_mime_has_any_components_for_uri (navinfo->location));
|
||||
g_assert (!nautilus_mime_has_any_components_for_uri (navinfo->directory, navinfo->file));
|
||||
result_code = NAUTILUS_NAVIGATION_RESULT_NO_HANDLER_FOR_TYPE;
|
||||
}
|
||||
|
||||
|
@ -208,10 +208,11 @@ nautilus_navigation_info_new (const char *location,
|
|||
info->location = g_strdup (location);
|
||||
|
||||
info->directory = nautilus_directory_get (location);
|
||||
info->file = nautilus_file_get (location);
|
||||
|
||||
/* Arrange for all the file attributes we will need. */
|
||||
attributes = NULL;
|
||||
attributes = g_list_prepend (attributes, NAUTILUS_FILE_ATTRIBUTE_FAST_MIME_TYPE);
|
||||
attributes = g_list_prepend (attributes, NAUTILUS_FILE_ATTRIBUTE_MIME_TYPE);
|
||||
|
||||
nautilus_directory_call_when_ready
|
||||
(info->directory,
|
||||
|
@ -253,6 +254,7 @@ nautilus_navigation_info_free (NautilusNavigationInfo *info)
|
|||
g_free (info->location);
|
||||
|
||||
nautilus_directory_unref (info->directory);
|
||||
nautilus_file_unref (info->file);
|
||||
nautilus_file_list_free (info->files);
|
||||
|
||||
g_free (info);
|
||||
|
|
|
@ -72,6 +72,7 @@ struct NautilusNavigationInfo {
|
|||
gpointer callback_data;
|
||||
GnomeVFSAsyncHandle *ah;
|
||||
NautilusDirectory *directory;
|
||||
NautilusFile *file;
|
||||
};
|
||||
|
||||
NautilusNavigationInfo *nautilus_navigation_info_new (const char *location,
|
||||
|
|
|
@ -1287,6 +1287,8 @@ nautilus_sidebar_update_buttons (NautilusSidebar *sidebar)
|
|||
{
|
||||
char *button_data;
|
||||
GList *short_application_list;
|
||||
NautilusDirectory *directory;
|
||||
NautilusFile *file;
|
||||
|
||||
/* dispose of any existing buttons */
|
||||
if (sidebar->details->has_buttons) {
|
||||
|
@ -1304,13 +1306,16 @@ nautilus_sidebar_update_buttons (NautilusSidebar *sidebar)
|
|||
add_buttons_from_metadata(sidebar, button_data);
|
||||
g_free(button_data);
|
||||
}
|
||||
|
||||
directory = nautilus_directory_get (sidebar->details->uri);
|
||||
file = nautilus_file_get (sidebar->details->uri);
|
||||
|
||||
/* Make buttons for each item in short list + "Open with..." catchall,
|
||||
* unless there aren't any applications at all in complete list.
|
||||
*/
|
||||
if (nautilus_mime_has_any_applications_for_uri (sidebar->details->uri)) {
|
||||
if (nautilus_mime_has_any_applications_for_uri (directory, file)) {
|
||||
short_application_list =
|
||||
nautilus_mime_get_short_list_applications_for_uri (sidebar->details->uri);
|
||||
nautilus_mime_get_short_list_applications_for_uri (directory, file);
|
||||
add_command_buttons (sidebar, short_application_list);
|
||||
gnome_vfs_mime_application_list_free (short_application_list);
|
||||
|
||||
|
@ -1322,6 +1327,9 @@ nautilus_sidebar_update_buttons (NautilusSidebar *sidebar)
|
|||
gtk_widget_show (GTK_WIDGET (sidebar->details->button_box_centerer));
|
||||
}
|
||||
}
|
||||
|
||||
nautilus_directory_unref (directory);
|
||||
nautilus_file_unref (file);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -685,6 +685,7 @@ static void
|
|||
nautilus_window_switch_views (NautilusWindow *window, NautilusViewIdentifier *id)
|
||||
{
|
||||
NautilusDirectory *directory;
|
||||
NautilusFile *file;
|
||||
NautilusViewFrame *view;
|
||||
|
||||
g_return_if_fail (NAUTILUS_IS_WINDOW (window));
|
||||
|
@ -692,10 +693,12 @@ nautilus_window_switch_views (NautilusWindow *window, NautilusViewIdentifier *id
|
|||
g_return_if_fail (id != NULL);
|
||||
|
||||
directory = nautilus_directory_get (window->location);
|
||||
g_assert (directory != NULL);
|
||||
file = nautilus_file_get (window->location);
|
||||
g_assert (directory != NULL);
|
||||
nautilus_mime_set_default_component_for_uri
|
||||
(window->location, id->iid);
|
||||
(directory, file, id->iid);
|
||||
nautilus_directory_unref (directory);
|
||||
nautilus_file_unref (file);
|
||||
|
||||
nautilus_window_allow_stop (window, TRUE);
|
||||
|
||||
|
@ -932,14 +935,18 @@ nautilus_window_load_content_view_menu (NautilusWindow *window)
|
|||
GtkWidget *new_menu;
|
||||
GtkWidget *menu_item;
|
||||
char *label;
|
||||
NautilusDirectory *directory;
|
||||
NautilusFile *file;
|
||||
|
||||
g_return_if_fail (NAUTILUS_IS_WINDOW (window));
|
||||
g_return_if_fail (GTK_IS_OPTION_MENU (window->view_as_option_menu));
|
||||
|
||||
new_menu = gtk_menu_new ();
|
||||
|
||||
file = nautilus_file_get (window->location);
|
||||
directory = nautilus_directory_get (window->location);
|
||||
/* Add a menu item for each view in the preferred list for this location. */
|
||||
components = nautilus_mime_get_short_list_components_for_uri (window->location);
|
||||
components = nautilus_mime_get_short_list_components_for_uri (directory, file);
|
||||
for (p = components; p != NULL; p = p->next) {
|
||||
menu_item = create_content_view_menu_item
|
||||
(window, nautilus_view_identifier_new_from_content_view (p->data));
|
||||
|
@ -952,7 +959,7 @@ nautilus_window_load_content_view_menu (NautilusWindow *window)
|
|||
* one way trip if you choose one of these view menu items, but
|
||||
* it's better than nothing.
|
||||
*/
|
||||
method = nautilus_mime_get_short_list_methods_for_uri (window->location);
|
||||
method = nautilus_mime_get_short_list_methods_for_uri (directory, file);
|
||||
/* FIXME bugzilla.eazel.com 2466: Name of the function is plural, but it returns only
|
||||
* one item. That must be fixed.
|
||||
*/
|
||||
|
@ -994,6 +1001,10 @@ nautilus_window_load_content_view_menu (NautilusWindow *window)
|
|||
gtk_option_menu_set_menu (GTK_OPTION_MENU (window->view_as_option_menu),
|
||||
new_menu);
|
||||
|
||||
|
||||
nautilus_directory_unref (directory);
|
||||
nautilus_file_unref (file);
|
||||
|
||||
nautilus_window_synch_content_view_menu (window);
|
||||
}
|
||||
|
||||
|
|
|
@ -685,6 +685,7 @@ static void
|
|||
nautilus_window_switch_views (NautilusWindow *window, NautilusViewIdentifier *id)
|
||||
{
|
||||
NautilusDirectory *directory;
|
||||
NautilusFile *file;
|
||||
NautilusViewFrame *view;
|
||||
|
||||
g_return_if_fail (NAUTILUS_IS_WINDOW (window));
|
||||
|
@ -692,10 +693,12 @@ nautilus_window_switch_views (NautilusWindow *window, NautilusViewIdentifier *id
|
|||
g_return_if_fail (id != NULL);
|
||||
|
||||
directory = nautilus_directory_get (window->location);
|
||||
g_assert (directory != NULL);
|
||||
file = nautilus_file_get (window->location);
|
||||
g_assert (directory != NULL);
|
||||
nautilus_mime_set_default_component_for_uri
|
||||
(window->location, id->iid);
|
||||
(directory, file, id->iid);
|
||||
nautilus_directory_unref (directory);
|
||||
nautilus_file_unref (file);
|
||||
|
||||
nautilus_window_allow_stop (window, TRUE);
|
||||
|
||||
|
@ -932,14 +935,18 @@ nautilus_window_load_content_view_menu (NautilusWindow *window)
|
|||
GtkWidget *new_menu;
|
||||
GtkWidget *menu_item;
|
||||
char *label;
|
||||
NautilusDirectory *directory;
|
||||
NautilusFile *file;
|
||||
|
||||
g_return_if_fail (NAUTILUS_IS_WINDOW (window));
|
||||
g_return_if_fail (GTK_IS_OPTION_MENU (window->view_as_option_menu));
|
||||
|
||||
new_menu = gtk_menu_new ();
|
||||
|
||||
file = nautilus_file_get (window->location);
|
||||
directory = nautilus_directory_get (window->location);
|
||||
/* Add a menu item for each view in the preferred list for this location. */
|
||||
components = nautilus_mime_get_short_list_components_for_uri (window->location);
|
||||
components = nautilus_mime_get_short_list_components_for_uri (directory, file);
|
||||
for (p = components; p != NULL; p = p->next) {
|
||||
menu_item = create_content_view_menu_item
|
||||
(window, nautilus_view_identifier_new_from_content_view (p->data));
|
||||
|
@ -952,7 +959,7 @@ nautilus_window_load_content_view_menu (NautilusWindow *window)
|
|||
* one way trip if you choose one of these view menu items, but
|
||||
* it's better than nothing.
|
||||
*/
|
||||
method = nautilus_mime_get_short_list_methods_for_uri (window->location);
|
||||
method = nautilus_mime_get_short_list_methods_for_uri (directory, file);
|
||||
/* FIXME bugzilla.eazel.com 2466: Name of the function is plural, but it returns only
|
||||
* one item. That must be fixed.
|
||||
*/
|
||||
|
@ -994,6 +1001,10 @@ nautilus_window_load_content_view_menu (NautilusWindow *window)
|
|||
gtk_option_menu_set_menu (GTK_OPTION_MENU (window->view_as_option_menu),
|
||||
new_menu);
|
||||
|
||||
|
||||
nautilus_directory_unref (directory);
|
||||
nautilus_file_unref (file);
|
||||
|
||||
nautilus_window_synch_content_view_menu (window);
|
||||
}
|
||||
|
||||
|
|
|
@ -1287,6 +1287,8 @@ nautilus_sidebar_update_buttons (NautilusSidebar *sidebar)
|
|||
{
|
||||
char *button_data;
|
||||
GList *short_application_list;
|
||||
NautilusDirectory *directory;
|
||||
NautilusFile *file;
|
||||
|
||||
/* dispose of any existing buttons */
|
||||
if (sidebar->details->has_buttons) {
|
||||
|
@ -1304,13 +1306,16 @@ nautilus_sidebar_update_buttons (NautilusSidebar *sidebar)
|
|||
add_buttons_from_metadata(sidebar, button_data);
|
||||
g_free(button_data);
|
||||
}
|
||||
|
||||
directory = nautilus_directory_get (sidebar->details->uri);
|
||||
file = nautilus_file_get (sidebar->details->uri);
|
||||
|
||||
/* Make buttons for each item in short list + "Open with..." catchall,
|
||||
* unless there aren't any applications at all in complete list.
|
||||
*/
|
||||
if (nautilus_mime_has_any_applications_for_uri (sidebar->details->uri)) {
|
||||
if (nautilus_mime_has_any_applications_for_uri (directory, file)) {
|
||||
short_application_list =
|
||||
nautilus_mime_get_short_list_applications_for_uri (sidebar->details->uri);
|
||||
nautilus_mime_get_short_list_applications_for_uri (directory, file);
|
||||
add_command_buttons (sidebar, short_application_list);
|
||||
gnome_vfs_mime_application_list_free (short_application_list);
|
||||
|
||||
|
@ -1322,6 +1327,9 @@ nautilus_sidebar_update_buttons (NautilusSidebar *sidebar)
|
|||
gtk_widget_show (GTK_WIDGET (sidebar->details->button_box_centerer));
|
||||
}
|
||||
}
|
||||
|
||||
nautilus_directory_unref (directory);
|
||||
nautilus_file_unref (file);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -685,6 +685,7 @@ static void
|
|||
nautilus_window_switch_views (NautilusWindow *window, NautilusViewIdentifier *id)
|
||||
{
|
||||
NautilusDirectory *directory;
|
||||
NautilusFile *file;
|
||||
NautilusViewFrame *view;
|
||||
|
||||
g_return_if_fail (NAUTILUS_IS_WINDOW (window));
|
||||
|
@ -692,10 +693,12 @@ nautilus_window_switch_views (NautilusWindow *window, NautilusViewIdentifier *id
|
|||
g_return_if_fail (id != NULL);
|
||||
|
||||
directory = nautilus_directory_get (window->location);
|
||||
g_assert (directory != NULL);
|
||||
file = nautilus_file_get (window->location);
|
||||
g_assert (directory != NULL);
|
||||
nautilus_mime_set_default_component_for_uri
|
||||
(window->location, id->iid);
|
||||
(directory, file, id->iid);
|
||||
nautilus_directory_unref (directory);
|
||||
nautilus_file_unref (file);
|
||||
|
||||
nautilus_window_allow_stop (window, TRUE);
|
||||
|
||||
|
@ -932,14 +935,18 @@ nautilus_window_load_content_view_menu (NautilusWindow *window)
|
|||
GtkWidget *new_menu;
|
||||
GtkWidget *menu_item;
|
||||
char *label;
|
||||
NautilusDirectory *directory;
|
||||
NautilusFile *file;
|
||||
|
||||
g_return_if_fail (NAUTILUS_IS_WINDOW (window));
|
||||
g_return_if_fail (GTK_IS_OPTION_MENU (window->view_as_option_menu));
|
||||
|
||||
new_menu = gtk_menu_new ();
|
||||
|
||||
file = nautilus_file_get (window->location);
|
||||
directory = nautilus_directory_get (window->location);
|
||||
/* Add a menu item for each view in the preferred list for this location. */
|
||||
components = nautilus_mime_get_short_list_components_for_uri (window->location);
|
||||
components = nautilus_mime_get_short_list_components_for_uri (directory, file);
|
||||
for (p = components; p != NULL; p = p->next) {
|
||||
menu_item = create_content_view_menu_item
|
||||
(window, nautilus_view_identifier_new_from_content_view (p->data));
|
||||
|
@ -952,7 +959,7 @@ nautilus_window_load_content_view_menu (NautilusWindow *window)
|
|||
* one way trip if you choose one of these view menu items, but
|
||||
* it's better than nothing.
|
||||
*/
|
||||
method = nautilus_mime_get_short_list_methods_for_uri (window->location);
|
||||
method = nautilus_mime_get_short_list_methods_for_uri (directory, file);
|
||||
/* FIXME bugzilla.eazel.com 2466: Name of the function is plural, but it returns only
|
||||
* one item. That must be fixed.
|
||||
*/
|
||||
|
@ -994,6 +1001,10 @@ nautilus_window_load_content_view_menu (NautilusWindow *window)
|
|||
gtk_option_menu_set_menu (GTK_OPTION_MENU (window->view_as_option_menu),
|
||||
new_menu);
|
||||
|
||||
|
||||
nautilus_directory_unref (directory);
|
||||
nautilus_file_unref (file);
|
||||
|
||||
nautilus_window_synch_content_view_menu (window);
|
||||
}
|
||||
|
||||
|
|
|
@ -365,6 +365,8 @@ add_theme_to_icons (GtkWidget *widget, gpointer *data)
|
|||
NautilusThemeSelector *theme_selector;
|
||||
GnomeVFSResult result;
|
||||
|
||||
result = GNOME_VFS_OK;
|
||||
|
||||
theme_selector = NAUTILUS_THEME_SELECTOR (data);
|
||||
theme_path = g_strdup (gtk_file_selection_get_filename (GTK_FILE_SELECTION (theme_selector->details->dialog)));
|
||||
|
||||
|
|
|
@ -685,6 +685,7 @@ static void
|
|||
nautilus_window_switch_views (NautilusWindow *window, NautilusViewIdentifier *id)
|
||||
{
|
||||
NautilusDirectory *directory;
|
||||
NautilusFile *file;
|
||||
NautilusViewFrame *view;
|
||||
|
||||
g_return_if_fail (NAUTILUS_IS_WINDOW (window));
|
||||
|
@ -692,10 +693,12 @@ nautilus_window_switch_views (NautilusWindow *window, NautilusViewIdentifier *id
|
|||
g_return_if_fail (id != NULL);
|
||||
|
||||
directory = nautilus_directory_get (window->location);
|
||||
g_assert (directory != NULL);
|
||||
file = nautilus_file_get (window->location);
|
||||
g_assert (directory != NULL);
|
||||
nautilus_mime_set_default_component_for_uri
|
||||
(window->location, id->iid);
|
||||
(directory, file, id->iid);
|
||||
nautilus_directory_unref (directory);
|
||||
nautilus_file_unref (file);
|
||||
|
||||
nautilus_window_allow_stop (window, TRUE);
|
||||
|
||||
|
@ -932,14 +935,18 @@ nautilus_window_load_content_view_menu (NautilusWindow *window)
|
|||
GtkWidget *new_menu;
|
||||
GtkWidget *menu_item;
|
||||
char *label;
|
||||
NautilusDirectory *directory;
|
||||
NautilusFile *file;
|
||||
|
||||
g_return_if_fail (NAUTILUS_IS_WINDOW (window));
|
||||
g_return_if_fail (GTK_IS_OPTION_MENU (window->view_as_option_menu));
|
||||
|
||||
new_menu = gtk_menu_new ();
|
||||
|
||||
file = nautilus_file_get (window->location);
|
||||
directory = nautilus_directory_get (window->location);
|
||||
/* Add a menu item for each view in the preferred list for this location. */
|
||||
components = nautilus_mime_get_short_list_components_for_uri (window->location);
|
||||
components = nautilus_mime_get_short_list_components_for_uri (directory, file);
|
||||
for (p = components; p != NULL; p = p->next) {
|
||||
menu_item = create_content_view_menu_item
|
||||
(window, nautilus_view_identifier_new_from_content_view (p->data));
|
||||
|
@ -952,7 +959,7 @@ nautilus_window_load_content_view_menu (NautilusWindow *window)
|
|||
* one way trip if you choose one of these view menu items, but
|
||||
* it's better than nothing.
|
||||
*/
|
||||
method = nautilus_mime_get_short_list_methods_for_uri (window->location);
|
||||
method = nautilus_mime_get_short_list_methods_for_uri (directory, file);
|
||||
/* FIXME bugzilla.eazel.com 2466: Name of the function is plural, but it returns only
|
||||
* one item. That must be fixed.
|
||||
*/
|
||||
|
@ -994,6 +1001,10 @@ nautilus_window_load_content_view_menu (NautilusWindow *window)
|
|||
gtk_option_menu_set_menu (GTK_OPTION_MENU (window->view_as_option_menu),
|
||||
new_menu);
|
||||
|
||||
|
||||
nautilus_directory_unref (directory);
|
||||
nautilus_file_unref (file);
|
||||
|
||||
nautilus_window_synch_content_view_menu (window);
|
||||
}
|
||||
|
||||
|
|
|
@ -101,6 +101,8 @@ main (int argc, char **argv)
|
|||
const char *uri;
|
||||
const char *field;
|
||||
const char *value;
|
||||
NautilusDirectory *directory;
|
||||
NautilusFile *file;
|
||||
|
||||
g_thread_init (NULL);
|
||||
oaf_init (argc, argv);
|
||||
|
@ -116,31 +118,34 @@ main (int argc, char **argv)
|
|||
field = argv[2];
|
||||
value = argv[3];
|
||||
|
||||
directory = nautilus_directory_get (uri);
|
||||
file = nautilus_file_get (uri);
|
||||
|
||||
if (strcmp (field, "default_action_type") == 0) {
|
||||
puts ("default_action_type");
|
||||
nautilus_mime_set_default_action_type_for_uri (uri, str_to_action_type (value));
|
||||
nautilus_mime_set_default_action_type_for_uri (directory, file, str_to_action_type (value));
|
||||
} else if (strcmp (field, "default_application") == 0) {
|
||||
puts ("default_application");
|
||||
nautilus_mime_set_default_application_for_uri (uri, value);
|
||||
nautilus_mime_set_default_application_for_uri (directory, file, value);
|
||||
} else if (strcmp (field, "default_component") == 0) {
|
||||
puts ("default_component");
|
||||
nautilus_mime_set_default_component_for_uri (uri, value);
|
||||
nautilus_mime_set_default_component_for_uri (directory, file, value);
|
||||
} else if (strcmp (field, "short_list_applicationss") == 0) {
|
||||
puts ("short_list_applications");
|
||||
nautilus_mime_set_short_list_applications_for_uri
|
||||
(uri, comma_separated_str_to_str_list (value));
|
||||
(directory, file, comma_separated_str_to_str_list (value));
|
||||
} else if (strcmp (field, "short_list_components") == 0) {
|
||||
puts ("short_list_components");
|
||||
nautilus_mime_set_short_list_components_for_uri
|
||||
(uri, comma_separated_str_to_str_list (value));
|
||||
(directory, file, comma_separated_str_to_str_list (value));
|
||||
} else if (strcmp (field, "add_to_all_applicationss") == 0) {
|
||||
puts ("add_to_all_applications");
|
||||
nautilus_mime_extend_all_applications_for_uri
|
||||
(uri, comma_separated_str_to_str_list (value));
|
||||
(directory, file, comma_separated_str_to_str_list (value));
|
||||
} else if (strcmp (field, "remove_from_all_applications") == 0) {
|
||||
puts ("remove_from_all_applications");
|
||||
nautilus_mime_remove_from_all_applications_for_uri
|
||||
(uri, comma_separated_str_to_str_list (value));
|
||||
(directory, file, comma_separated_str_to_str_list (value));
|
||||
|
||||
} else {
|
||||
usage (argv[0]);
|
||||
|
|
|
@ -115,6 +115,8 @@ main (int argc, char **argv)
|
|||
GList *all_applications;
|
||||
GList *short_list_components;
|
||||
GList *short_list_applications;
|
||||
NautilusFile *file;
|
||||
NautilusDirectory *directory;
|
||||
|
||||
g_thread_init (NULL);
|
||||
oaf_init (argc, argv);
|
||||
|
@ -128,38 +130,40 @@ main (int argc, char **argv)
|
|||
}
|
||||
|
||||
uri = argv[1];
|
||||
file = nautilus_file_get (uri);
|
||||
directory = nautilus_directory_get (uri);
|
||||
|
||||
default_action = nautilus_mime_get_default_action_for_uri (uri);
|
||||
default_action = nautilus_mime_get_default_action_for_uri (directory, file);
|
||||
puts ("Default Action");
|
||||
print_action (default_action);
|
||||
puts ("");
|
||||
|
||||
default_application = nautilus_mime_get_default_application_for_uri (uri);
|
||||
default_application = nautilus_mime_get_default_application_for_uri (directory, file);
|
||||
puts("Default Application");
|
||||
print_application (default_application);
|
||||
puts ("");
|
||||
|
||||
default_component = nautilus_mime_get_default_component_for_uri (uri);
|
||||
default_component = nautilus_mime_get_default_component_for_uri (directory, file);
|
||||
puts("Default Component");
|
||||
print_component (default_component);
|
||||
puts ("");
|
||||
|
||||
short_list_applications = nautilus_mime_get_short_list_applications_for_uri (uri);
|
||||
short_list_applications = nautilus_mime_get_short_list_applications_for_uri (directory, file);
|
||||
puts("Short List Applications");
|
||||
print_application_list (short_list_applications);
|
||||
puts ("");
|
||||
|
||||
short_list_components = nautilus_mime_get_short_list_components_for_uri (uri);
|
||||
short_list_components = nautilus_mime_get_short_list_components_for_uri (directory, file);
|
||||
puts("Short List Components");
|
||||
print_component_list (short_list_components);
|
||||
puts ("");
|
||||
|
||||
all_applications = nautilus_mime_get_all_applications_for_uri (uri);
|
||||
all_applications = nautilus_mime_get_all_applications_for_uri (directory, file);
|
||||
puts("All Applications");
|
||||
print_application_list (all_applications);
|
||||
puts ("");
|
||||
|
||||
all_components = nautilus_mime_get_all_components_for_uri (uri);
|
||||
all_components = nautilus_mime_get_all_components_for_uri (directory, file);
|
||||
puts("All Components");
|
||||
print_component_list (all_components);
|
||||
puts ("");
|
||||
|
|
Loading…
Reference in a new issue