diff options
author | Matthias Clasen <mclasen@redhat.com> | 2022-11-17 15:51:11 -0500 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2022-11-17 15:52:53 -0500 |
commit | b0148972fdeb03765f73ade8ffa0b4be4bfb35ef (patch) | |
tree | bcdf59b5f51ee1e343a32ea5ea765783ebbf9877 | |
parent | 793954055ee57730d6ba09496a9d4b1f4604d04c (diff) | |
download | gtk+-b0148972fdeb03765f73ade8ffa0b4be4bfb35ef.tar.gz |
filedialog: Use portals
We want this new API to be portal-first.
Make it so.
-rw-r--r-- | gtk/gtkfilechoosernative.c | 7 | ||||
-rw-r--r-- | gtk/gtkfilechoosernativeportal.c | 2 | ||||
-rw-r--r-- | gtk/gtkfilechoosernativeprivate.h | 4 | ||||
-rw-r--r-- | gtk/gtkfiledialog.c | 3 |
4 files changed, 14 insertions, 2 deletions
diff --git a/gtk/gtkfilechoosernative.c b/gtk/gtkfilechoosernative.c index 7ec767c427..d28eb23f39 100644 --- a/gtk/gtkfilechoosernative.c +++ b/gtk/gtkfilechoosernative.c @@ -561,6 +561,13 @@ gtk_file_chooser_native_new (const char *title, return result; } +void +gtk_file_chooser_native_set_use_portal (GtkFileChooserNative *self, + gboolean use_portal) +{ + self->use_portal = use_portal; +} + static void dialog_response_cb (GtkDialog *dialog, int response_id, diff --git a/gtk/gtkfilechoosernativeportal.c b/gtk/gtkfilechoosernativeportal.c index 530e63cff0..8c5903ce30 100644 --- a/gtk/gtkfilechoosernativeportal.c +++ b/gtk/gtkfilechoosernativeportal.c @@ -468,7 +468,7 @@ gtk_file_chooser_native_portal_show (GtkFileChooserNative *self, GtkFileChooserAction action; const char *method_name; - if (!gdk_should_use_portal ()) + if (!self->use_portal && !gdk_should_use_portal ()) return FALSE; connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL); diff --git a/gtk/gtkfilechoosernativeprivate.h b/gtk/gtkfilechoosernativeprivate.h index eacb92cce3..bc4633dfe5 100644 --- a/gtk/gtkfilechoosernativeprivate.h +++ b/gtk/gtkfilechoosernativeprivate.h @@ -52,9 +52,13 @@ struct _GtkFileChooserNative GtkWidget *accept_button; GtkWidget *cancel_button; + gboolean use_portal; gpointer mode_data; }; +void gtk_file_chooser_native_set_use_portal (GtkFileChooserNative *self, + gboolean use_portal); + gboolean gtk_file_chooser_native_win32_show (GtkFileChooserNative *self); void gtk_file_chooser_native_win32_hide (GtkFileChooserNative *self); diff --git a/gtk/gtkfiledialog.c b/gtk/gtkfiledialog.c index 26c662f65e..a1ad1c9731 100644 --- a/gtk/gtkfiledialog.c +++ b/gtk/gtkfiledialog.c @@ -22,7 +22,7 @@ #include "gtkfiledialog.h" #include "deprecated/gtkdialog.h" -#include "deprecated/gtkfilechoosernative.h" +#include "gtkfilechoosernativeprivate.h" #include "gtkdialogerror.h" #include <glib/gi18n-lib.h> @@ -679,6 +679,7 @@ create_file_chooser (GtkFileDialog *self, } chooser = gtk_file_chooser_native_new (title, parent, action, accept, _("_Cancel")); + gtk_file_chooser_native_set_use_portal (chooser, TRUE); gtk_native_dialog_set_modal (GTK_NATIVE_DIALOG (chooser), self->modal); gtk_file_chooser_set_select_multiple (GTK_FILE_CHOOSER (chooser), select_multiple); |