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.
This commit is contained in:
@@ -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__ */
|
||||
|
||||
Reference in New Issue
Block a user