summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gtk/gtkfilechoosernativeportal.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/gtk/gtkfilechoosernativeportal.c b/gtk/gtkfilechoosernativeportal.c
index 6ee6f276b6..2e3c49a887 100644
--- a/gtk/gtkfilechoosernativeportal.c
+++ b/gtk/gtkfilechoosernativeportal.c
@@ -296,6 +296,7 @@ show_portal_file_chooser (GtkFileChooserNative *self,
GDBusMessage *message;
GVariantBuilder opt_builder;
gboolean multiple;
+ gboolean directory;
const char *title;
char *token;
@@ -317,6 +318,7 @@ show_portal_file_chooser (GtkFileChooserNative *self,
self, NULL);
multiple = gtk_file_chooser_get_select_multiple (GTK_FILE_CHOOSER (self));
+ directory = gtk_file_chooser_get_action (GTK_FILE_CHOOSER (self)) == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER;
g_variant_builder_init (&opt_builder, G_VARIANT_TYPE_VARDICT);
g_variant_builder_add (&opt_builder, "{sv}", "handle_token",
@@ -325,6 +327,8 @@ show_portal_file_chooser (GtkFileChooserNative *self,
g_variant_builder_add (&opt_builder, "{sv}", "multiple",
g_variant_new_boolean (multiple));
+ g_variant_builder_add (&opt_builder, "{sv}", "directory",
+ g_variant_new_boolean (directory));
if (self->accept_label)
g_variant_builder_add (&opt_builder, "{sv}", "accept_label",
g_variant_new_string (self->accept_label));
@@ -419,13 +423,14 @@ 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)
+ if (action == GTK_FILE_CHOOSER_ACTION_OPEN ||
+ action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
method_name = "OpenFile";
else if (action == GTK_FILE_CHOOSER_ACTION_SAVE)
method_name = "SaveFile";
else
{
- g_warning ("GTK_FILE_CHOOSER_ACTION_%s is not supported by GtkFileChooserNativePortal", action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER ? "SELECT_FOLDER" : "CREATE_FOLDER");
+ g_warning ("GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER is not supported by GtkFileChooserNativePortal");
return FALSE;
}