Commit a2115675 authored by Matthias Clasen's avatar Matthias Clasen

portal: Fall back when the portal doesn't work

Show the fallback dialog in cases where we tried to call out to
portal, but it didn't work.
parent 9b8148da
......@@ -494,6 +494,13 @@ hide_dialog (GtkFileChooserNative *self)
gtk_widget_hide (self->dialog);
}
void
gtk_file_chooser_native_show_fallback (GtkFileChooserNative *self)
{
self->mode = MODE_FALLBACK;
show_dialog (self);
}
static gboolean
gtk_file_chooser_native_set_current_folder (GtkFileChooser *chooser,
GFile *file,
......
......@@ -224,6 +224,10 @@ open_file_msg_cb (GObject *source_object,
_gtk_native_dialog_emit_response (GTK_NATIVE_DIALOG (self), GTK_RESPONSE_DELETE_EVENT);
g_warning ("Can't open portal file chooser: %s\n", error->message);
filechooser_portal_data_free (data);
/* fall back manually */
gtk_file_chooser_native_show_fallback (GTK_FILE_CHOOSER_NATIVE (self));
return;
}
......
......@@ -51,6 +51,8 @@ void gtk_file_chooser_native_win32_hide (GtkFileChooserNative *self);
gboolean gtk_file_chooser_native_portal_show (GtkFileChooserNative *self);
void gtk_file_chooser_native_portal_hide (GtkFileChooserNative *self);
void gtk_file_chooser_native_show_fallback (GtkFileChooserNative *self);
G_END_DECLS
#endif /* __GTK_FILE_CHOOSER_NATIVE_PRIVATE_H__ */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment