[gtk/wip/hadess/portal-fixes: 5/5] filechoosernativeportal: Fall back if portal is too old
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/hadess/portal-fixes: 5/5] filechoosernativeportal: Fall back if portal is too old
- Date: Mon, 30 Mar 2020 16:32:28 +0000 (UTC)
commit 8cf41c1b6651dac252e193534bc4b4f31586ecca
Author: Bastien Nocera <hadess hadess net>
Date: Mon Mar 30 14:18:11 2020 +0200
filechoosernativeportal: Fall back if portal is too old
Add portal version checking as originally implemented for the GTK 3.x
branch.
See: 35fec1c6b298e0e294530e1ffc8615b5bd261531
gtk/gtkfilechoosernativeportal.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkfilechoosernativeportal.c b/gtk/gtkfilechoosernativeportal.c
index 2e3c49a887..8d58dc253d 100644
--- a/gtk/gtkfilechoosernativeportal.c
+++ b/gtk/gtkfilechoosernativeportal.c
@@ -423,11 +423,19 @@ gtk_file_chooser_native_portal_show (GtkFileChooserNative *self,
action = gtk_file_chooser_get_action (GTK_FILE_CHOOSER (self));
- if (action == GTK_FILE_CHOOSER_ACTION_OPEN ||
- action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
+ if (action == GTK_FILE_CHOOSER_ACTION_OPEN)
method_name = "OpenFile";
else if (action == GTK_FILE_CHOOSER_ACTION_SAVE)
method_name = "SaveFile";
+ else if (action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
+ {
+ if (gtk_get_portal_interface_version (connection, "org.freedesktop.portal.FileChooser") < 3)
+ {
+ g_warning ("GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER is not supported by GtkFileChooserNativePortal
because portal is too old");
+ return FALSE;
+ }
+ method_name = "OpenFile";
+ }
else
{
g_warning ("GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER is not supported by GtkFileChooserNativePortal");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]