[xdg-desktop-portal-gnome/wip/sophie-h/open-file-current-folder] filechooser: Support current_folder with OpenFile




commit 490eb498e1183429551e619c3e4375ec5c1dc845
Author: Sophie Herold <sophie hemio de>
Date:   Tue Aug 30 01:45:15 2022 +0200

    filechooser: Support current_folder with OpenFile
    
    https://github.com/flatpak/xdg-desktop-portal/pull/874

 src/filechooser.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
---
diff --git a/src/filechooser.c b/src/filechooser.c
index b4e89e1..f982d50 100644
--- a/src/filechooser.c
+++ b/src/filechooser.c
@@ -564,7 +564,15 @@ handle_open (XdpImplFileChooser    *object,
     }
   g_slist_free_full (filters, g_object_unref);
 
-  if (strcmp (method_name, "SaveFile") == 0)
+  if (strcmp (method_name, "OpenFile") == 0)
+    {
+      if (g_variant_lookup (arg_options, "current_folder", "^&ay", &path))
+        {
+          g_autoptr(GFile) file = g_file_new_for_path (path);
+          gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), file, NULL);
+        }
+    }
+  else if (strcmp (method_name, "SaveFile") == 0)
     {
       /* TODO: is this useful ?
        * In a sandboxed situation, the current folder and current file


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]