diff options
author | Ernestas Kulik <ernestask@gnome.org> | 2018-02-01 16:32:54 +0200 |
---|---|---|
committer | Ernestas Kulik <ernestas.kulik@gmail.com> | 2018-02-13 12:44:57 +0000 |
commit | d1e1514df7a55a32035f5c8241a54e861cb3270a (patch) | |
tree | beaeae114d147eab981a38815358ab0af71d2787 /src/nautilus-operations-ui-manager.c | |
parent | ca8e5e1f3fca5f2d5a30fddd30b21e0dbed610fa (diff) | |
download | nautilus-d1e1514df7a55a32035f5c8241a54e861cb3270a.tar.gz |
operations-ui-manager: don’t launch default archive handler
If archive decompression fails due to missing support, Nautilus tries to
launch the default application for the file type, which results in an
infinite loop in cases where Nautilus is the default application. This
commit removes that code and makes an application chooser always appear
with a heading to inform the user.
https://gitlab.gnome.org/GNOME/nautilus/issues/51
Diffstat (limited to 'src/nautilus-operations-ui-manager.c')
-rw-r--r-- | src/nautilus-operations-ui-manager.c | 40 |
1 files changed, 19 insertions, 21 deletions
diff --git a/src/nautilus-operations-ui-manager.c b/src/nautilus-operations-ui-manager.c index 4356cc39d..f86e9e228 100644 --- a/src/nautilus-operations-ui-manager.c +++ b/src/nautilus-operations-ui-manager.c @@ -517,33 +517,31 @@ static gboolean open_file_in_application (gpointer user_data) { HandleUnsupportedFileData *data; + g_autofree gchar *mime_type = NULL; + GtkWidget *dialog; + const char *heading; g_autoptr (GAppInfo) application = NULL; data = user_data; - - application = nautilus_mime_get_default_application_for_file (data->file); - - if (!application) + mime_type = nautilus_file_get_mime_type (data->file); + dialog = gtk_app_chooser_dialog_new_for_content_type (data->parent_window, + GTK_DIALOG_MODAL | + GTK_DIALOG_DESTROY_WITH_PARENT | + GTK_DIALOG_USE_HEADER_BAR, + mime_type); + heading = _("Password-protected archives are not yet supported. " + "This list contains applications that can open the archive."); + + gtk_app_chooser_dialog_set_heading (GTK_APP_CHOOSER_DIALOG (dialog), heading); + + if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK) { - GtkWidget *dialog; - g_autofree gchar *mime_type = NULL; - - mime_type = nautilus_file_get_mime_type (data->file); - - dialog = gtk_app_chooser_dialog_new_for_content_type (data->parent_window, - GTK_DIALOG_MODAL | - GTK_DIALOG_DESTROY_WITH_PARENT | - GTK_DIALOG_USE_HEADER_BAR, - mime_type); - if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK) - { - application = gtk_app_chooser_get_app_info (GTK_APP_CHOOSER (dialog)); - } - - gtk_widget_destroy (dialog); + application = gtk_app_chooser_get_app_info (GTK_APP_CHOOSER (dialog)); } - if (application) + gtk_widget_destroy (dialog); + + if (application != NULL) { g_autoptr (GList) files = NULL; |