From f8d3fe9e7c3087f74b9ab39acfb21dd57d0c8d92 Mon Sep 17 00:00:00 2001 From: Jody Goldberg Date: Wed, 26 Jun 2002 23:36:59 +0000 Subject: [PATCH] do not trust gnome_vfs_mime_get_default_application. It silently removes 2002-06-26 Jody Goldberg * mime-type-info.c (mime_type_info_load_all) : do not trust gnome_vfs_mime_get_default_application. It silently removes applications that do not exist on the current system. That makes it look like they are not being assigned. * mime-edit-dialog.c (validate_data) : relax the restriction here. By supplying a reasonable default to the new info it was appearing in our internal data structures. That was a useful test before we were instant apply, but is no longer helpful. --- capplets/file-types/ChangeLog | 12 ++++++++++++ capplets/file-types/mime-edit-dialog.c | 3 +-- capplets/file-types/mime-type-info.c | 14 ++++++++++++-- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/capplets/file-types/ChangeLog b/capplets/file-types/ChangeLog index dc914f9c2..cd8d5a640 100644 --- a/capplets/file-types/ChangeLog +++ b/capplets/file-types/ChangeLog @@ -1,3 +1,15 @@ +2002-06-26 Jody Goldberg + + * mime-type-info.c (mime_type_info_load_all) : do not trust + gnome_vfs_mime_get_default_application. It silently removes + applications that do not exist on the current system. That makes it + look like they are not being assigned. + + * mime-edit-dialog.c (validate_data) : relax the restriction here. By + supplying a reasonable default to the new info it was appearing in + our internal data structures. That was a useful test before we were + instant apply, but is no longer helpful. + 2002-06-26 Jody Goldberg * file-types-capplet.c (main) : blah, test things _before_ I commit. diff --git a/capplets/file-types/mime-edit-dialog.c b/capplets/file-types/mime-edit-dialog.c index e7535dcec..44e92a173 100644 --- a/capplets/file-types/mime-edit-dialog.c +++ b/capplets/file-types/mime-edit-dialog.c @@ -824,8 +824,7 @@ validate_data (MimeEditDialog *dialog) GTK_BUTTONS_CANCEL, _("Please enter a valid MIME type. It should be of the form " "class/type and may not contain any spaces.")); - } else if (dialog->p->is_add && (gnome_vfs_mime_type_is_known (mime_type) || - get_mime_type_info (mime_type) != NULL)) { + } else if (dialog->p->is_add && gnome_vfs_mime_type_is_known (mime_type)) { err_dialog = gtk_message_dialog_new ( GTK_WINDOW (dialog->p->dialog_win), GTK_DIALOG_MODAL, GTK_MESSAGE_QUESTION, diff --git a/capplets/file-types/mime-type-info.c b/capplets/file-types/mime-type-info.c index 8417f4b7c..17efdb456 100644 --- a/capplets/file-types/mime-type-info.c +++ b/capplets/file-types/mime-type-info.c @@ -108,8 +108,18 @@ mime_type_info_load_all (MimeTypeInfo *info) if (info->icon_pixbuf == NULL) get_icon_pixbuf (info, info->icon_name, TRUE); - if (info->default_action == NULL) - info->default_action = gnome_vfs_mime_get_default_application (info->mime_type); + if (info->default_action == NULL && info->mime_type != NULL) { + /* DO NOT USE gnome_vfs_mime_get_default_application + * it will silently remove non-existant applications + * which will make them seem to disappear on systems that + * are configured differently */ + char const *app_id = gnome_vfs_mime_get_value ( + info->mime_type, "default_application_id"); + + if (app_id != NULL && app_id[0] != '\0') + info->default_action = + gnome_vfs_application_registry_get_mime_application (app_id); + } if (info->default_action == NULL) info->default_action = g_new0 (GnomeVFSMimeApplication, 1);