summaryrefslogtreecommitdiff
path: root/app/flatpak-builtins.h
diff options
context:
space:
mode:
authorMatthew Leeds <matthew.leeds@endlessm.com>2017-12-11 21:08:02 -0800
committerAtomic Bot <atomic-devel@projectatomic.io>2017-12-12 15:26:41 +0000
commit8a59927fdee55d965c63fef53f368bc0032496fc (patch)
tree1a77e3a4503eabf987973f402415f6f6ca665142 /app/flatpak-builtins.h
parent5815d5e92c6387ddbcd80f790fae6000956bb097 (diff)
downloadflatpak-8a59927fdee55d965c63fef53f368bc0032496fc.tar.gz
app: Move installation management to flatpak-main.c
Some builtin flatpak commands work on a single installation, and others work on multiple installations (such as the remotes command that lists both system and user remotes). Currently flatpak_option_context_parse() only supports returning one installation to its caller, and any commands that want to support multiple installations have to implement that themselves which leads to a lot of code duplication. This commit changes flatpak_option_context_parse() to take three new flags: * FLATPAK_BUILTIN_FLAG_ONE_DIR maintains the old behavior by returning one installation (i.e. user if --user was passed, system if --system, etc.). * FLATPAK_BUILTIN_FLAG_STANDARD_DIRS will get all the installations specified by the options, or the user and system ones if none were. * FLATPAK_BUILTIN_FLAG_ALL_DIRS includes non-default system installations along with the user and system ones if none were specified. These flags also affect what options are parsed and whether the directories are ensured to exist, so it makes sense in some circumstances for callers to pass a NULL out_dirs even when not using FLATPAK_BUILTIN_FLAG_NO_DIR. This commit also changes all the callers of flatpak_option_context_parse() so they maintain their behavior. The only functional change introduced by this is that using --installation multiple times for commands that only support one now leads to an error emitted by flatpak rather than by g_option_context_parse(). A follow-up commit will use this refactoring to make many commands behave more intelligently in determining which installation to use. Closes: #1205 Approved by: alexlarsson
Diffstat (limited to 'app/flatpak-builtins.h')
-rw-r--r--app/flatpak-builtins.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/app/flatpak-builtins.h b/app/flatpak-builtins.h
index b7538243..17c4cede 100644
--- a/app/flatpak-builtins.h
+++ b/app/flatpak-builtins.h
@@ -32,6 +32,9 @@ G_BEGIN_DECLS
typedef enum {
FLATPAK_BUILTIN_FLAG_NO_DIR = 1 << 0,
FLATPAK_BUILTIN_FLAG_OPTIONAL_REPO = 1 << 1,
+ FLATPAK_BUILTIN_FLAG_ONE_DIR = 1 << 2,
+ FLATPAK_BUILTIN_FLAG_STANDARD_DIRS = 1 << 3,
+ FLATPAK_BUILTIN_FLAG_ALL_DIRS = 1 << 4,
} FlatpakBuiltinFlags;
gboolean flatpak_option_context_parse (GOptionContext *context,
@@ -39,7 +42,7 @@ gboolean flatpak_option_context_parse (GOptionContext *context,
int *argc,
char ***argv,
FlatpakBuiltinFlags flags,
- FlatpakDir **out_dir,
+ GPtrArray **out_dirs,
GCancellable *cancellable,
GError **error);