Commit Graph

23 Commits

Author SHA1 Message Date
Matthias Clasen
68700f8722 Merge branch 'drop-file-dialog-shortcuts' into 'main'
filedialog: Drop shortcut folders

See merge request GNOME/gtk!5396
2023-01-06 13:35:14 +00:00
Matthias Clasen
9356dfc404 filedialog: Drop shortcut folders
The filechooser portal does not support this,
and we are defaulting to using the portal now.
Lets not offer a non-functional API.
2023-01-06 07:40:57 -05:00
Benjamin Otte
446e6a8d62 filedialog: Never set the chooser's file
Instead, get by with setting the name and hope the filechooser figures
things out by itself.

Fixes #5496
2023-01-05 21:30:15 +01:00
Matthias Clasen
5eb4a3af0d filedialog: Handle initial-folder being NULL
This showed up as test failure in ci.
2022-12-24 09:01:16 -05:00
Benjamin Otte
671fad5f34 filedialog: Clarify interaction of :filters and :default-filter 2022-12-24 07:56:57 -05:00
Benjamin Otte
1b9c45b660 filedialog: Rename :current-filter to :default-filter
The last "current" removed from properties. None of these are current.
2022-12-24 07:56:57 -05:00
Benjamin Otte
e2f730c0bf filedialog: Add gtk_file_dialog_set_initial_file()
A shortcut for setting initial-folder and initial-name at the same time.

We can remove all arguments from the actual async calls this way.
2022-12-24 07:56:57 -05:00
Benjamin Otte
8a2d35b9fb filedialog: Add gtk_file_dialog_set_initial_name() 2022-12-24 07:56:57 -05:00
Benjamin Otte
26cec4a021 filedialog: Rename current-folder to initial-folder
It's not the current one - unlike in GtkFileChooser - because there are
no live updates. So we use a more descriptive name.
2022-12-24 07:56:57 -05:00
Benjamin Otte
977fedfdf1 dialog: GTK_DIALOG_ERROR_ABORTED => GTK_DIALOG_ERROR_CANCELLED
This is done via the GCancellable, so let's call it cancelling.
2022-12-24 07:56:57 -05:00
Benjamin Otte
8957302bd4 dialog: GTK_DIALOG_ERROR_CANCELLED => GTK_DIALOG_ERROR_DISMISSED
The term "cancelling" is used with GCancellable, a user clicking a close
button is not that.
User input is usually described as "dismissing", so we use that term.
2022-12-24 07:56:57 -05:00
Christopher Davis
143229f829 gtkfiledialog: Allow devs to set custom accept labels
Accept labels can be used for additional context regarding
the purpose of a file. The old GtkFileChooser APIs allowed
developers to set it, but the initial FileDialog API was missing
this functionality.

This commit adds `gtk_file_dialog_set_accept_label ()` to
restore the missing functionality.

Closes https://gitlab.gnome.org/GNOME/gtk/-/issues/5421
2022-12-16 10:16:52 -05:00
Matthias Clasen
6cb5f20942 Silence a compiler warning 2022-12-16 00:12:44 -05:00
Matthias Clasen
e5560c1535 Add GDK_DEBUG=no-portals
Fixes: #5441
2022-12-14 13:50:20 -05:00
Matthias Clasen
417382375b filedialog: Report cancellation propertly
Unless we prevent it, GTask will always report
cancellation as G_IO_ERROR_CANCELLED. But we
want GTK_DIALOG_ERROR_ABORTED for this case.
2022-12-09 11:05:48 -05:00
Matthias Clasen
de83d57e14 filedialog: Use title if set
This broken when the code was reshuffled into
the switch.

Fixes: #5415
2022-12-08 07:57:16 -05:00
Matthias Clasen
e73f0f6974 file dialog: Handle Escape better
Closing the dialog by hitting Escape should
have the same effect as clicking the cancel
button. Make it so.
2022-11-24 10:29:43 -05:00
Matthias Clasen
b0148972fd filedialog: Use portals
We want this new API to be portal-first.
Make it so.
2022-11-17 15:52:53 -05:00
Matthias Clasen
030e8c0bf9 Be consistent in preconditions for async API
Do the same checks in all our finish functions.
2022-10-31 16:40:54 -04:00
Emmanuele Bassi
37fadb20a9 docs: Add missing Since annotations 2022-10-30 20:08:21 +00:00
Matthias Clasen
9948053cd7 Deprecate GtkDialog
GtkDialog is too flexible in terms of UI (headerbars vs action bar,
etc), and has archaic APIs. It is time to retire it.
2022-10-29 15:27:53 -04:00
Matthias Clasen
f54ab91ff3 Deprecate GtkFileChooser and implementations
These are being replaced by GtkFileDialog.

This commit only moves the headers for GtkFileChooserWidget and
GtkFileChooserDialog to deprecated/, and keeps the implementations
in gtk/, since they will eventually be salvaged into a private
GtkFileChooserWindow.
2022-10-29 13:31:41 -04:00
Matthias Clasen
6ed2d2b232 Add GtkFileDialog
Add an async API for picking a file, together with
a builder object for it. This is meant to replace direct
use of GtkFileChooserDialog.
2022-10-29 13:31:41 -04:00