void nautilus_launch_application_for_mount (GAppInfo *app_info, GMount *mount, GtkWindow *parent_window) { GFile *root; NautilusFile *file; GList *files; root = g_mount_get_root (mount); file = nautilus_file_get (root); g_object_unref (root); files = g_list_append (NULL, file); nautilus_launch_application (app_info, files, parent_window); g_list_free_full (files, (GDestroyNotify) nautilus_file_unref); }
static gboolean open_file_in_application (gpointer user_data) { HandleUnsupportedFileData *data; g_autoptr (GAppInfo) application = NULL; data = user_data; application = nautilus_mime_get_default_application_for_file (data->file); if (!application) { 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); } if (application) { g_autoptr (GList) files = NULL; files = g_list_append (NULL, data->file); nautilus_launch_application (application, files, data->parent_window); } return G_SOURCE_REMOVE; }