#1 [DOES NOT WORK] F37: Qt apps *Save As* file dialog no longer says "The folder contents could not be displayed"
Closed 2 years ago by amigadave. Opened 2 years ago by churchyard.
rpms/ churchyard/xdg-desktop-portal-gnome qt-save-as  into  rawhide

file added
+55
@@ -0,0 +1,55 @@ 

+ From fffa8902db44209fdd47657a43a56c96f6db86d8 Mon Sep 17 00:00:00 2001

+ From: Georges Basile Stavracas Neto <georges.stavracas@gmail.com>

+ Date: Tue, 19 Apr 2022 19:45:32 -0300

+ Subject: [PATCH] filechooser: Make current file override name and folder

+ 

+ In the SaveFile call, apps can pass all 3 options (current name, file,

+ and folder), but that's not really how the API is expected to be used.

+ 

+ When current file is passed, ignore current name and folder.

+ 

+ Fixes https://gitlab.gnome.org/GNOME/xdg-desktop-portal-gnome/-/issues/29

+ ---

+  src/filechooser.c | 17 ++++++++++-------

+  1 file changed, 10 insertions(+), 7 deletions(-)

+ 

+ diff --git a/src/filechooser.c b/src/filechooser.c

+ index c76169b..b4e89e1 100644

+ --- a/src/filechooser.c

+ +++ b/src/filechooser.c

+ @@ -566,22 +566,25 @@ handle_open (XdpImplFileChooser    *object,

+  

+    if (strcmp (method_name, "SaveFile") == 0)

+      {

+ -      if (g_variant_lookup (arg_options, "current_name", "&s", &current_name))

+ -        gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dialog), current_name);

+        /* TODO: is this useful ?

+         * In a sandboxed situation, the current folder and current file

+         * are likely in the fuse filesystem

+         */

+ -      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);

+ -        }

+        if (g_variant_lookup (arg_options, "current_file", "^&ay", &path))

+          {

+            g_autoptr(GFile) file = g_file_new_for_path (path);

+            gtk_file_chooser_set_file (GTK_FILE_CHOOSER (dialog), file, NULL);

+          }

+ +      else

+ +        {

+ +          if (g_variant_lookup (arg_options, "current_name", "&s", &current_name))

+ +            gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dialog), current_name);

+ +          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, "SaveFiles") == 0)

+      {

+ -- 

+ GitLab

+ 

@@ -12,6 +12,11 @@ 

  URL:            https://gitlab.gnome.org/GNOME/%{name}

  Source0:        https://download.gnome.org/sources/%{name}/42/%{name}-%{tarball_version}.tar.xz

  

+ # filechooser: Make current file override name and folder

+ # Backported from upstream

+ # Fixes https://bugzilla.redhat.com/2071195

+ Patch:          https://gitlab.gnome.org/GNOME/xdg-desktop-portal-gnome/-/commit/fffa8902db.patch

+ 

  BuildRequires:  desktop-file-utils

  BuildRequires:  gcc

  BuildRequires:  gettext

Untested yet, will report back.

Pull-Request has been closed by amigadave

2 years ago