1 /*
2  * Copyright (C) 2018, Matthias Clasen
3  *
4  * This file is free software; you can redistribute it and/or modify it
5  * under the terms of the GNU Lesser General Public License as
6  * published by the Free Software Foundation, version 3.0 of the
7  * License.
8  *
9  * This file is distributed in the hope that it will be useful, but
10  * WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this program.  If not, see <http://www.gnu.org/licenses/>.
16  *
17  * SPDX-License-Identifier: LGPL-3.0-only
18  */
19 
20 #pragma once
21 
22 #include <libportal/types.h>
23 
24 G_BEGIN_DECLS
25 
26 /**
27  * XdpOpenFileFlags:
28  * @XDP_OPEN_FILE_FLAG_NONE: No options
29  * @XDP_OPEN_FILE_FLAG_MULTIPLE: Allow selecting multiple files
30  *
31  * Options for opening files.
32  */
33 typedef enum {
34   XDP_OPEN_FILE_FLAG_NONE     = 0,
35   XDP_OPEN_FILE_FLAG_MULTIPLE = 1 << 0,
36 } XdpOpenFileFlags;
37 
38 XDP_PUBLIC
39 void       xdp_portal_open_file                   (XdpPortal            *portal,
40                                                    XdpParent            *parent,
41                                                    const char           *title,
42                                                    GVariant             *filters,
43                                                    GVariant             *current_filter,
44                                                    GVariant             *choices,
45                                                    XdpOpenFileFlags      flags,
46                                                    GCancellable         *cancellable,
47                                                    GAsyncReadyCallback   callback,
48                                                    gpointer              data);
49 
50 XDP_PUBLIC
51 GVariant *xdp_portal_open_file_finish             (XdpPortal            *portal,
52                                                    GAsyncResult         *result,
53                                                    GError              **error);
54 
55 typedef enum {
56   XDP_SAVE_FILE_FLAG_NONE = 0
57 } XdpSaveFileFlags;
58 
59 XDP_PUBLIC
60 void       xdp_portal_save_file                   (XdpPortal            *portal,
61                                                    XdpParent            *parent,
62                                                    const char           *title,
63                                                    const char           *current_name,
64                                                    const char           *current_folder,
65                                                    const char           *current_file,
66                                                    GVariant             *filters,
67                                                    GVariant             *current_filter,
68                                                    GVariant             *choices,
69                                                    XdpSaveFileFlags      flags,
70                                                    GCancellable         *cancellable,
71                                                    GAsyncReadyCallback   callback,
72                                                    gpointer              data);
73 
74 XDP_PUBLIC
75 GVariant *xdp_portal_save_file_finish             (XdpPortal            *portal,
76                                                    GAsyncResult         *result,
77                                                    GError              **error);
78 
79 XDP_PUBLIC
80 void       xdp_portal_save_files                  (XdpPortal            *portal,
81                                                    XdpParent            *parent,
82                                                    const char           *title,
83                                                    const char           *current_name,
84                                                    const char           *current_folder,
85                                                    GVariant             *files,
86                                                    GVariant             *choices,
87                                                    XdpSaveFileFlags      flags,
88                                                    GCancellable         *cancellable,
89                                                    GAsyncReadyCallback   callback,
90                                                    gpointer              data);
91 
92 XDP_PUBLIC
93 GVariant *xdp_portal_save_files_finish            (XdpPortal            *portal,
94                                                    GAsyncResult         *result,
95                                                    GError              **error);
96 
97 G_END_DECLS
98