forked from Mirrors/flatpak-builder
Rename all non-autogenerated symbols to flatpak
parent
ce20be26f8
commit
6a613d1fab
10
Makefile.am
10
Makefile.am
|
@ -34,11 +34,11 @@ EXTRA_DIST += $(service_in_files)
|
|||
XDG_APP_BINDIR=$(bindir)
|
||||
|
||||
AM_CPPFLAGS = \
|
||||
-DXDG_APP_BINDIR=\"$(XDG_APP_BINDIR)\" \
|
||||
-DXDG_APP_SYSTEMDIR=\"$(localstatedir)/lib/xdg-app\"\
|
||||
-DXDG_APP_CONFIGDIR=\"$(sysconfdir)/xdg-app\"\
|
||||
-DXDG_APP_BASEDIR=\"$(pkgdatadir)\" \
|
||||
-DXDG_APP_TRIGGERDIR=\"$(pkgdatadir)/triggers\" \
|
||||
-DFLATPAK_BINDIR=\"$(XDG_APP_BINDIR)\" \
|
||||
-DFLATPAK_SYSTEMDIR=\"$(localstatedir)/lib/xdg-app\"\
|
||||
-DFLATPAK_CONFIGDIR=\"$(sysconfdir)/xdg-app\"\
|
||||
-DFLATPAK_BASEDIR=\"$(pkgdatadir)\" \
|
||||
-DFLATPAK_TRIGGERDIR=\"$(pkgdatadir)/triggers\" \
|
||||
-DSYSTEM_FONTS_DIR=\"$(SYSTEM_FONTS_DIR)\" \
|
||||
-DHELPER=\"$(libdir)/xdg-app/bwrap\" \
|
||||
-DDBUSPROXY=\"$(libexecdir)/xdg-dbus-proxy\" \
|
||||
|
|
|
@ -112,7 +112,7 @@ open_source_stream (GInputStream **out_source_stream,
|
|||
}
|
||||
|
||||
/* Chain together all the --keyring options as one long stream. */
|
||||
source_stream = (GInputStream *) xdg_app_chain_input_stream_new (streams);
|
||||
source_stream = (GInputStream *) flatpak_chain_input_stream_new (streams);
|
||||
|
||||
*out_source_stream = g_steal_pointer (&source_stream);
|
||||
|
||||
|
@ -120,7 +120,7 @@ open_source_stream (GInputStream **out_source_stream,
|
|||
}
|
||||
|
||||
gboolean
|
||||
import_keys (XdgAppDir *dir,
|
||||
import_keys (FlatpakDir *dir,
|
||||
const char *remote_name,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
|
@ -133,7 +133,7 @@ import_keys (XdgAppDir *dir,
|
|||
if (!open_source_stream (&input_stream, cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
if (!ostree_repo_remote_gpg_import (xdg_app_dir_get_repo (dir), remote_name, input_stream,
|
||||
if (!ostree_repo_remote_gpg_import (flatpak_dir_get_repo (dir), remote_name, input_stream,
|
||||
NULL, &imported, cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
|
@ -146,11 +146,11 @@ import_keys (XdgAppDir *dir,
|
|||
}
|
||||
|
||||
gboolean
|
||||
xdg_app_builtin_add_remote (int argc, char **argv,
|
||||
flatpak_builtin_add_remote (int argc, char **argv,
|
||||
GCancellable *cancellable, GError **error)
|
||||
{
|
||||
g_autoptr(GOptionContext) context = NULL;
|
||||
g_autoptr(XdgAppDir) dir = NULL;
|
||||
g_autoptr(FlatpakDir) dir = NULL;
|
||||
g_autoptr(GVariantBuilder) optbuilder = NULL;
|
||||
g_autoptr(GFile) file = NULL;
|
||||
g_autofree char *title = NULL;
|
||||
|
@ -163,7 +163,7 @@ xdg_app_builtin_add_remote (int argc, char **argv,
|
|||
|
||||
g_option_context_add_main_entries (context, common_options, NULL);
|
||||
|
||||
if (!xdg_app_option_context_parse (context, add_options, &argc, &argv, 0, &dir, cancellable, error))
|
||||
if (!flatpak_option_context_parse (context, add_options, &argc, &argv, 0, &dir, cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
if (argc < 3)
|
||||
|
@ -228,7 +228,7 @@ xdg_app_builtin_add_remote (int argc, char **argv,
|
|||
"xa.title",
|
||||
g_variant_new_variant (g_variant_new_string (title)));
|
||||
|
||||
if (!ostree_repo_remote_change (xdg_app_dir_get_repo (dir), NULL,
|
||||
if (!ostree_repo_remote_change (flatpak_dir_get_repo (dir), NULL,
|
||||
opt_if_not_exists ? OSTREE_REPO_REMOTE_CHANGE_ADD_IF_NOT_EXISTS :
|
||||
OSTREE_REPO_REMOTE_CHANGE_ADD,
|
||||
remote_name, remote_url,
|
||||
|
@ -238,7 +238,7 @@ xdg_app_builtin_add_remote (int argc, char **argv,
|
|||
|
||||
if (title == NULL)
|
||||
{
|
||||
title = xdg_app_dir_fetch_remote_title (dir,
|
||||
title = flatpak_dir_fetch_remote_title (dir,
|
||||
remote_name,
|
||||
NULL,
|
||||
NULL);
|
||||
|
@ -247,10 +247,10 @@ xdg_app_builtin_add_remote (int argc, char **argv,
|
|||
g_autoptr(GKeyFile) config = NULL;
|
||||
g_autofree char *group = g_strdup_printf ("remote \"%s\"", remote_name);
|
||||
|
||||
config = ostree_repo_copy_config (xdg_app_dir_get_repo (dir));
|
||||
config = ostree_repo_copy_config (flatpak_dir_get_repo (dir));
|
||||
g_key_file_set_string (config, group, "xa.title", title);
|
||||
|
||||
if (!ostree_repo_write_config (xdg_app_dir_get_repo (dir), config, error))
|
||||
if (!ostree_repo_write_config (flatpak_dir_get_repo (dir), config, error))
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
@ -258,17 +258,17 @@ xdg_app_builtin_add_remote (int argc, char **argv,
|
|||
if (!import_keys (dir, remote_name, cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
if (!xdg_app_dir_mark_changed (dir, error))
|
||||
if (!flatpak_dir_mark_changed (dir, error))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
xdg_app_builtin_modify_remote (int argc, char **argv, GCancellable *cancellable, GError **error)
|
||||
flatpak_builtin_modify_remote (int argc, char **argv, GCancellable *cancellable, GError **error)
|
||||
{
|
||||
g_autoptr(GOptionContext) context = NULL;
|
||||
g_autoptr(XdgAppDir) dir = NULL;
|
||||
g_autoptr(FlatpakDir) dir = NULL;
|
||||
g_autoptr(GVariantBuilder) optbuilder = NULL;
|
||||
g_autoptr(GKeyFile) config = NULL;
|
||||
const char *remote_name;
|
||||
|
@ -278,7 +278,7 @@ xdg_app_builtin_modify_remote (int argc, char **argv, GCancellable *cancellable,
|
|||
|
||||
g_option_context_add_main_entries (context, common_options, NULL);
|
||||
|
||||
if (!xdg_app_option_context_parse (context, modify_options, &argc, &argv, 0, &dir, cancellable, error))
|
||||
if (!flatpak_option_context_parse (context, modify_options, &argc, &argv, 0, &dir, cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
if (argc < 2)
|
||||
|
@ -290,10 +290,10 @@ xdg_app_builtin_modify_remote (int argc, char **argv, GCancellable *cancellable,
|
|||
|
||||
group = g_strdup_printf ("remote \"%s\"", remote_name);
|
||||
|
||||
if (!ostree_repo_remote_get_url (xdg_app_dir_get_repo (dir), remote_name, NULL, NULL))
|
||||
return xdg_app_fail (error, "No remote %s", remote_name);
|
||||
if (!ostree_repo_remote_get_url (flatpak_dir_get_repo (dir), remote_name, NULL, NULL))
|
||||
return flatpak_fail (error, "No remote %s", remote_name);
|
||||
|
||||
config = ostree_repo_copy_config (xdg_app_dir_get_repo (dir));
|
||||
config = ostree_repo_copy_config (flatpak_dir_get_repo (dir));
|
||||
|
||||
if (opt_no_gpg_verify)
|
||||
{
|
||||
|
@ -330,13 +330,13 @@ xdg_app_builtin_modify_remote (int argc, char **argv, GCancellable *cancellable,
|
|||
g_key_file_set_string (config, group, "xa.prio", prio_as_string);
|
||||
}
|
||||
|
||||
if (!ostree_repo_write_config (xdg_app_dir_get_repo (dir), config, error))
|
||||
if (!ostree_repo_write_config (flatpak_dir_get_repo (dir), config, error))
|
||||
return FALSE;
|
||||
|
||||
if (!import_keys (dir, remote_name, cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
if (!xdg_app_dir_mark_changed (dir, error))
|
||||
if (!flatpak_dir_mark_changed (dir, error))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
|
|
|
@ -92,9 +92,9 @@ read_gpg_data (GCancellable *cancellable,
|
|||
}
|
||||
|
||||
/* Chain together all the --keyring options as one long stream. */
|
||||
source_stream = (GInputStream *) xdg_app_chain_input_stream_new (streams);
|
||||
source_stream = (GInputStream *) flatpak_chain_input_stream_new (streams);
|
||||
|
||||
return xdg_app_read_stream (source_stream, FALSE, error);
|
||||
return flatpak_read_stream (source_stream, FALSE, error);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@ -144,7 +144,7 @@ build_bundle (OstreeRepo *repo, GFile *file,
|
|||
in = (GInputStream *) g_file_read (metadata_file, cancellable, NULL);
|
||||
if (in != NULL)
|
||||
{
|
||||
g_autoptr(GBytes) bytes = xdg_app_read_stream (in, TRUE, error);
|
||||
g_autoptr(GBytes) bytes = flatpak_read_stream (in, TRUE, error);
|
||||
|
||||
if (bytes == NULL)
|
||||
return FALSE;
|
||||
|
@ -166,17 +166,17 @@ build_bundle (OstreeRepo *repo, GFile *file,
|
|||
xml_in = (GInputStream *) g_file_read (appstream_file, cancellable, NULL);
|
||||
if (xml_in)
|
||||
{
|
||||
g_autoptr(XdgAppXml) appstream_root = NULL;
|
||||
g_autoptr(XdgAppXml) xml_root = xdg_app_xml_parse (xml_in, TRUE,
|
||||
cancellable, error);
|
||||
g_autoptr(FlatpakXml) appstream_root = NULL;
|
||||
g_autoptr(FlatpakXml) xml_root = flatpak_xml_parse (xml_in, TRUE,
|
||||
cancellable, error);
|
||||
if (xml_root == NULL)
|
||||
return FALSE;
|
||||
|
||||
appstream_root = xdg_app_appstream_xml_new ();
|
||||
if (xdg_app_appstream_xml_migrate (xml_root, appstream_root,
|
||||
appstream_root = flatpak_appstream_xml_new ();
|
||||
if (flatpak_appstream_xml_migrate (xml_root, appstream_root,
|
||||
full_branch, name, keyfile))
|
||||
{
|
||||
g_autoptr(GBytes) xml_data = xdg_app_appstream_xml_root_to_data (appstream_root, error);
|
||||
g_autoptr(GBytes) xml_data = flatpak_appstream_xml_root_to_data (appstream_root, error);
|
||||
int i;
|
||||
g_autoptr(GFile) icons_dir =
|
||||
g_file_resolve_relative_path (root,
|
||||
|
@ -201,7 +201,7 @@ build_bundle (OstreeRepo *repo, GFile *file,
|
|||
png_in = (GInputStream *) g_file_read (icon_file, cancellable, NULL);
|
||||
if (png_in != NULL)
|
||||
{
|
||||
g_autoptr(GBytes) png_data = xdg_app_read_stream (png_in, FALSE, error);
|
||||
g_autoptr(GBytes) png_data = flatpak_read_stream (png_in, FALSE, error);
|
||||
if (png_data == NULL)
|
||||
return FALSE;
|
||||
|
||||
|
@ -256,14 +256,14 @@ build_bundle (OstreeRepo *repo, GFile *file,
|
|||
|
||||
#if defined(HAVE_LIBARCHIVE) && defined(HAVE_OSTREE_EXPORT_PATH_PREFIX)
|
||||
|
||||
GLNX_DEFINE_CLEANUP_FUNCTION (void *, xdg_app_local_free_read_archive, archive_read_free)
|
||||
#define free_read_archive __attribute__((cleanup (xdg_app_local_free_read_archive)))
|
||||
GLNX_DEFINE_CLEANUP_FUNCTION (void *, flatpak_local_free_read_archive, archive_read_free)
|
||||
#define free_read_archive __attribute__((cleanup (flatpak_local_free_read_archive)))
|
||||
|
||||
GLNX_DEFINE_CLEANUP_FUNCTION (void *, xdg_app_local_free_write_archive, archive_write_free)
|
||||
#define free_write_archive __attribute__((cleanup (xdg_app_local_free_write_archive)))
|
||||
GLNX_DEFINE_CLEANUP_FUNCTION (void *, flatpak_local_free_write_archive, archive_write_free)
|
||||
#define free_write_archive __attribute__((cleanup (flatpak_local_free_write_archive)))
|
||||
|
||||
GLNX_DEFINE_CLEANUP_FUNCTION (void *, xdg_app_local_free_archive_entry, archive_entry_free)
|
||||
#define free_archive_entry __attribute__((cleanup (xdg_app_local_free_archive_entry)))
|
||||
GLNX_DEFINE_CLEANUP_FUNCTION (void *, flatpak_local_free_archive_entry, archive_entry_free)
|
||||
#define free_archive_entry __attribute__((cleanup (flatpak_local_free_archive_entry)))
|
||||
|
||||
|
||||
typedef struct
|
||||
|
@ -884,7 +884,7 @@ build_oci (OstreeRepo *repo, GFile *file,
|
|||
}
|
||||
|
||||
gboolean
|
||||
xdg_app_builtin_build_bundle (int argc, char **argv, GCancellable *cancellable, GError **error)
|
||||
flatpak_builtin_build_bundle (int argc, char **argv, GCancellable *cancellable, GError **error)
|
||||
{
|
||||
g_autoptr(GOptionContext) context = NULL;
|
||||
g_autoptr(GFile) file = NULL;
|
||||
|
@ -898,7 +898,7 @@ xdg_app_builtin_build_bundle (int argc, char **argv, GCancellable *cancellable,
|
|||
|
||||
context = g_option_context_new ("LOCATION FILENAME NAME [BRANCH] - Create a single file bundle from a local repository");
|
||||
|
||||
if (!xdg_app_option_context_parse (context, options, &argc, &argv, XDG_APP_BUILTIN_FLAG_NO_DIR, NULL, cancellable, error))
|
||||
if (!flatpak_option_context_parse (context, options, &argc, &argv, FLATPAK_BUILTIN_FLAG_NO_DIR, NULL, cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
if (argc < 4)
|
||||
|
@ -917,20 +917,20 @@ xdg_app_builtin_build_bundle (int argc, char **argv, GCancellable *cancellable,
|
|||
repo = ostree_repo_new (repofile);
|
||||
|
||||
if (!g_file_query_exists (repofile, cancellable))
|
||||
return xdg_app_fail (error, "'%s' is not a valid repository", location);
|
||||
return flatpak_fail (error, "'%s' is not a valid repository", location);
|
||||
|
||||
file = g_file_new_for_commandline_arg (filename);
|
||||
|
||||
if (!xdg_app_is_valid_name (name))
|
||||
return xdg_app_fail (error, "'%s' is not a valid name", name);
|
||||
if (!flatpak_is_valid_name (name))
|
||||
return flatpak_fail (error, "'%s' is not a valid name", name);
|
||||
|
||||
if (!xdg_app_is_valid_branch (branch))
|
||||
return xdg_app_fail (error, "'%s' is not a valid branch name", branch);
|
||||
if (!flatpak_is_valid_branch (branch))
|
||||
return flatpak_fail (error, "'%s' is not a valid branch name", branch);
|
||||
|
||||
if (opt_runtime)
|
||||
full_branch = xdg_app_build_runtime_ref (name, branch, opt_arch);
|
||||
full_branch = flatpak_build_runtime_ref (name, branch, opt_arch);
|
||||
else
|
||||
full_branch = xdg_app_build_app_ref (name, branch, opt_arch);
|
||||
full_branch = flatpak_build_app_ref (name, branch, opt_arch);
|
||||
|
||||
if (!ostree_repo_open (repo, cancellable, error))
|
||||
return FALSE;
|
||||
|
|
|
@ -84,13 +84,13 @@ metadata_get_arch (GFile *file, char **out_arch, GError **error)
|
|||
"runtime", NULL);
|
||||
if (runtime == NULL)
|
||||
{
|
||||
*out_arch = g_strdup (xdg_app_get_arch ());
|
||||
*out_arch = g_strdup (flatpak_get_arch ());
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
parts = g_strsplit (runtime, "/", 0);
|
||||
if (g_strv_length (parts) != 3)
|
||||
return xdg_app_fail (error, "Failed to determine arch from metadata runtime key: %s", runtime);
|
||||
return flatpak_fail (error, "Failed to determine arch from metadata runtime key: %s", runtime);
|
||||
|
||||
*out_arch = g_strdup (parts[1]);
|
||||
|
||||
|
@ -132,7 +132,7 @@ matches_patterns (const char **patterns, const char *path)
|
|||
|
||||
for (i = 0; patterns[i] != NULL; i++)
|
||||
{
|
||||
if (xdg_app_path_match_prefix (patterns[i], path) != NULL)
|
||||
if (flatpak_path_match_prefix (patterns[i], path) != NULL)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -217,7 +217,7 @@ add_file_to_mtree (GFile *file,
|
|||
}
|
||||
|
||||
gboolean
|
||||
xdg_app_builtin_build_export (int argc, char **argv, GCancellable *cancellable, GError **error)
|
||||
flatpak_builtin_build_export (int argc, char **argv, GCancellable *cancellable, GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
|
||||
|
@ -253,7 +253,7 @@ xdg_app_builtin_build_export (int argc, char **argv, GCancellable *cancellable,
|
|||
|
||||
context = g_option_context_new ("LOCATION DIRECTORY [BRANCH] - Create a repository from a build directory");
|
||||
|
||||
if (!xdg_app_option_context_parse (context, options, &argc, &argv, XDG_APP_BUILTIN_FLAG_NO_DIR, NULL, cancellable, error))
|
||||
if (!flatpak_option_context_parse (context, options, &argc, &argv, FLATPAK_BUILTIN_FLAG_NO_DIR, NULL, cancellable, error))
|
||||
goto out;
|
||||
|
||||
if (argc < 3)
|
||||
|
@ -270,9 +270,9 @@ xdg_app_builtin_build_export (int argc, char **argv, GCancellable *cancellable,
|
|||
else
|
||||
branch = "master";
|
||||
|
||||
if (!xdg_app_is_valid_branch (branch))
|
||||
if (!flatpak_is_valid_branch (branch))
|
||||
{
|
||||
xdg_app_fail (error, "'%s' is not a valid branch name", branch);
|
||||
flatpak_fail (error, "'%s' is not a valid branch name", branch);
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
@ -294,7 +294,7 @@ xdg_app_builtin_build_export (int argc, char **argv, GCancellable *cancellable,
|
|||
if (!g_file_query_exists (files, cancellable) ||
|
||||
!g_file_query_exists (metadata, cancellable))
|
||||
{
|
||||
xdg_app_fail (error, "Build directory %s not initialized", directory);
|
||||
flatpak_fail (error, "Build directory %s not initialized", directory);
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
@ -311,7 +311,7 @@ xdg_app_builtin_build_export (int argc, char **argv, GCancellable *cancellable,
|
|||
|
||||
if (!opt_runtime && !g_file_query_exists (export, cancellable))
|
||||
{
|
||||
xdg_app_fail (error, "Build directory %s not finalized", directory);
|
||||
flatpak_fail (error, "Build directory %s not finalized", directory);
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
@ -352,7 +352,7 @@ xdg_app_builtin_build_export (int argc, char **argv, GCancellable *cancellable,
|
|||
|
||||
mtree = ostree_mutable_tree_new ();
|
||||
|
||||
if (!xdg_app_mtree_create_root (repo, mtree, cancellable, error))
|
||||
if (!flatpak_mtree_create_root (repo, mtree, cancellable, error))
|
||||
goto out;
|
||||
|
||||
if (!ostree_mutable_tree_ensure_dir (mtree, "files", &files_mtree, error))
|
||||
|
@ -424,7 +424,7 @@ xdg_app_builtin_build_export (int argc, char **argv, GCancellable *cancellable,
|
|||
{
|
||||
g_autoptr(GError) my_error = NULL;
|
||||
|
||||
if (!xdg_app_repo_generate_appstream (repo, (const char **) opt_gpg_key_ids, opt_gpg_homedir, cancellable, &my_error))
|
||||
if (!flatpak_repo_generate_appstream (repo, (const char **) opt_gpg_key_ids, opt_gpg_homedir, cancellable, &my_error))
|
||||
{
|
||||
if (g_error_matches (my_error, G_SPAWN_ERROR, G_SPAWN_ERROR_NOENT))
|
||||
{
|
||||
|
@ -438,7 +438,7 @@ xdg_app_builtin_build_export (int argc, char **argv, GCancellable *cancellable,
|
|||
}
|
||||
}
|
||||
|
||||
if (!xdg_app_repo_update (repo,
|
||||
if (!flatpak_repo_update (repo,
|
||||
(const char **) opt_gpg_key_ids,
|
||||
opt_gpg_homedir,
|
||||
cancellable,
|
||||
|
|
|
@ -120,7 +120,7 @@ export_dir (int source_parent_fd,
|
|||
source_printable = g_build_filename (source_relpath, dent->d_name, NULL);
|
||||
|
||||
|
||||
if (!xdg_app_has_name_prefix (dent->d_name, required_prefix))
|
||||
if (!flatpak_has_name_prefix (dent->d_name, required_prefix))
|
||||
{
|
||||
g_print ("Not exporting %s, wrong prefix\n", source_printable);
|
||||
continue;
|
||||
|
@ -241,14 +241,14 @@ collect_exports (GFile *base, const char *app_id, gboolean is_runtime, GCancella
|
|||
}
|
||||
|
||||
static gboolean
|
||||
update_metadata (GFile *base, XdgAppContext *arg_context, GCancellable *cancellable, GError **error)
|
||||
update_metadata (GFile *base, FlatpakContext *arg_context, GCancellable *cancellable, GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
|
||||
g_autoptr(GFile) metadata = NULL;
|
||||
g_autofree char *path = NULL;
|
||||
g_autoptr(GKeyFile) keyfile = NULL;
|
||||
g_autoptr(XdgAppContext) app_context = NULL;
|
||||
g_autoptr(FlatpakContext) app_context = NULL;
|
||||
GError *temp_error = NULL;
|
||||
|
||||
metadata = g_file_get_child (base, "metadata");
|
||||
|
@ -315,11 +315,11 @@ update_metadata (GFile *base, XdgAppContext *arg_context, GCancellable *cancella
|
|||
}
|
||||
}
|
||||
|
||||
app_context = xdg_app_context_new ();
|
||||
if (!xdg_app_context_load_metadata (app_context, keyfile, error))
|
||||
app_context = flatpak_context_new ();
|
||||
if (!flatpak_context_load_metadata (app_context, keyfile, error))
|
||||
goto out;
|
||||
xdg_app_context_merge (app_context, arg_context);
|
||||
xdg_app_context_save_metadata (app_context, keyfile);
|
||||
flatpak_context_merge (app_context, arg_context);
|
||||
flatpak_context_save_metadata (app_context, keyfile);
|
||||
|
||||
if (!g_key_file_save_to_file (keyfile, path, error))
|
||||
goto out;
|
||||
|
@ -334,7 +334,7 @@ out:
|
|||
}
|
||||
|
||||
gboolean
|
||||
xdg_app_builtin_build_finish (int argc, char **argv, GCancellable *cancellable, GError **error)
|
||||
flatpak_builtin_build_finish (int argc, char **argv, GCancellable *cancellable, GError **error)
|
||||
{
|
||||
g_autoptr(GOptionContext) context = NULL;
|
||||
g_autoptr(GFile) base = NULL;
|
||||
|
@ -347,14 +347,14 @@ xdg_app_builtin_build_finish (int argc, char **argv, GCancellable *cancellable,
|
|||
gsize metadata_size;
|
||||
const char *directory;
|
||||
g_autoptr(GKeyFile) metakey = NULL;
|
||||
g_autoptr(XdgAppContext) arg_context = NULL;
|
||||
g_autoptr(FlatpakContext) arg_context = NULL;
|
||||
|
||||
context = g_option_context_new ("DIRECTORY - Convert a directory to a bundle");
|
||||
|
||||
arg_context = xdg_app_context_new ();
|
||||
g_option_context_add_group (context, xdg_app_context_get_options (arg_context));
|
||||
arg_context = flatpak_context_new ();
|
||||
g_option_context_add_group (context, flatpak_context_get_options (arg_context));
|
||||
|
||||
if (!xdg_app_option_context_parse (context, options, &argc, &argv, XDG_APP_BUILTIN_FLAG_NO_DIR, NULL, cancellable, error))
|
||||
if (!flatpak_option_context_parse (context, options, &argc, &argv, FLATPAK_BUILTIN_FLAG_NO_DIR, NULL, cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
if (argc < 2)
|
||||
|
@ -370,7 +370,7 @@ xdg_app_builtin_build_finish (int argc, char **argv, GCancellable *cancellable,
|
|||
|
||||
if (!g_file_query_exists (files_dir, cancellable) ||
|
||||
!g_file_query_exists (metadata_file, cancellable))
|
||||
return xdg_app_fail (error, "Build directory %s not initialized", directory);
|
||||
return flatpak_fail (error, "Build directory %s not initialized", directory);
|
||||
|
||||
if (!g_file_load_contents (metadata_file, cancellable, &metadata_contents, &metadata_size, NULL, error))
|
||||
return FALSE;
|
||||
|
@ -384,12 +384,12 @@ xdg_app_builtin_build_finish (int argc, char **argv, GCancellable *cancellable,
|
|||
{
|
||||
id = g_key_file_get_string (metakey, "Runtime", "name", NULL);
|
||||
if (id == NULL)
|
||||
return xdg_app_fail (error, "No name specified in the metadata");
|
||||
return flatpak_fail (error, "No name specified in the metadata");
|
||||
is_runtime = TRUE;
|
||||
}
|
||||
|
||||
if (g_file_query_exists (export_dir, cancellable))
|
||||
return xdg_app_fail (error, "Build directory %s already finalized", directory);
|
||||
return flatpak_fail (error, "Build directory %s already finalized", directory);
|
||||
|
||||
g_debug ("Collecting exports");
|
||||
if (!collect_exports (base, id, is_runtime, cancellable, error))
|
||||
|
|
|
@ -105,11 +105,11 @@ import_oci (OstreeRepo *repo, GFile *file,
|
|||
commitmeta = g_file_resolve_relative_path (archive_root, "rootfs/commitmeta");
|
||||
|
||||
if (!g_file_query_exists (ref, NULL))
|
||||
return xdg_app_fail (error, "Required file ref not in tarfile");
|
||||
return flatpak_fail (error, "Required file ref not in tarfile");
|
||||
if (!g_file_query_exists (metadata, NULL))
|
||||
return xdg_app_fail (error, "Required file metadata not in tarfile");
|
||||
return flatpak_fail (error, "Required file metadata not in tarfile");
|
||||
if (!g_file_query_exists (commit, NULL))
|
||||
return xdg_app_fail (error, "Required file commit not in tarfile");
|
||||
return flatpak_fail (error, "Required file commit not in tarfile");
|
||||
|
||||
if (!g_file_load_contents (ref, cancellable,
|
||||
&ref_data, NULL,
|
||||
|
@ -123,7 +123,7 @@ import_oci (OstreeRepo *repo, GFile *file,
|
|||
|
||||
files = g_file_resolve_relative_path (archive_root, files_source);
|
||||
if (!g_file_query_exists (files, NULL))
|
||||
return xdg_app_fail (error, "Required directory %s not in tarfile", files_source);
|
||||
return flatpak_fail (error, "Required directory %s not in tarfile", files_source);
|
||||
|
||||
export = g_file_resolve_relative_path (archive_root, "rootfs/export");
|
||||
|
||||
|
@ -151,7 +151,7 @@ import_oci (OstreeRepo *repo, GFile *file,
|
|||
|
||||
mtree = ostree_mutable_tree_new ();
|
||||
|
||||
if (!xdg_app_mtree_create_root (repo, mtree, cancellable, error))
|
||||
if (!flatpak_mtree_create_root (repo, mtree, cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
if (!ostree_mutable_tree_ensure_dir (mtree, "files", &files_mtree, error))
|
||||
|
@ -191,11 +191,11 @@ import_oci (OstreeRepo *repo, GFile *file,
|
|||
tree_metadata_checksum = ostree_checksum_from_bytes_v (tree_metadata_bytes);
|
||||
|
||||
if (strcmp (tree_contents_checksum, ostree_repo_file_tree_get_contents_checksum ((OstreeRepoFile *) root)))
|
||||
return xdg_app_fail (error, "Imported content checksum (%s) does not match original checksum (%s)",
|
||||
return flatpak_fail (error, "Imported content checksum (%s) does not match original checksum (%s)",
|
||||
tree_contents_checksum, ostree_repo_file_tree_get_contents_checksum ((OstreeRepoFile *) root));
|
||||
|
||||
if (strcmp (tree_metadata_checksum, ostree_repo_file_tree_get_metadata_checksum ((OstreeRepoFile *) root)))
|
||||
return xdg_app_fail (error, "Imported metadata checksum (%s) does not match original checksum (%s)",
|
||||
return flatpak_fail (error, "Imported metadata checksum (%s) does not match original checksum (%s)",
|
||||
tree_metadata_checksum, ostree_repo_file_tree_get_metadata_checksum ((OstreeRepoFile *) root));
|
||||
}
|
||||
|
||||
|
@ -245,7 +245,7 @@ import_bundle (OstreeRepo *repo, GFile *file,
|
|||
g_autofree char *to_checksum = NULL;
|
||||
const char *ref;
|
||||
|
||||
metadata = xdg_app_bundle_load (file, &to_checksum,
|
||||
metadata = flatpak_bundle_load (file, &to_checksum,
|
||||
&bundle_ref,
|
||||
NULL,
|
||||
NULL,
|
||||
|
@ -260,7 +260,7 @@ import_bundle (OstreeRepo *repo, GFile *file,
|
|||
ref = bundle_ref;
|
||||
|
||||
g_print ("Importing %s (%s)\n", ref, to_checksum);
|
||||
if (!xdg_app_pull_from_bundle (repo, file,
|
||||
if (!flatpak_pull_from_bundle (repo, file,
|
||||
NULL, ref, FALSE,
|
||||
cancellable,
|
||||
error))
|
||||
|
@ -270,7 +270,7 @@ import_bundle (OstreeRepo *repo, GFile *file,
|
|||
}
|
||||
|
||||
gboolean
|
||||
xdg_app_builtin_build_import (int argc, char **argv, GCancellable *cancellable, GError **error)
|
||||
flatpak_builtin_build_import (int argc, char **argv, GCancellable *cancellable, GError **error)
|
||||
{
|
||||
g_autoptr(GOptionContext) context = NULL;
|
||||
g_autoptr(GFile) file = NULL;
|
||||
|
@ -282,7 +282,7 @@ xdg_app_builtin_build_import (int argc, char **argv, GCancellable *cancellable,
|
|||
|
||||
context = g_option_context_new ("LOCATION FILENAME - Import a file bundle into a local repository");
|
||||
|
||||
if (!xdg_app_option_context_parse (context, options, &argc, &argv, XDG_APP_BUILTIN_FLAG_NO_DIR, NULL, cancellable, error))
|
||||
if (!flatpak_option_context_parse (context, options, &argc, &argv, FLATPAK_BUILTIN_FLAG_NO_DIR, NULL, cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
if (argc < 3)
|
||||
|
@ -295,7 +295,7 @@ xdg_app_builtin_build_import (int argc, char **argv, GCancellable *cancellable,
|
|||
repo = ostree_repo_new (repofile);
|
||||
|
||||
if (!g_file_query_exists (repofile, cancellable))
|
||||
return xdg_app_fail (error, "'%s' is not a valid repository", location);
|
||||
return flatpak_fail (error, "'%s' is not a valid repository", location);
|
||||
|
||||
file = g_file_new_for_commandline_arg (filename);
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ static GOptionEntry options[] = {
|
|||
};
|
||||
|
||||
gboolean
|
||||
xdg_app_builtin_build_init (int argc, char **argv, GCancellable *cancellable, GError **error)
|
||||
flatpak_builtin_build_init (int argc, char **argv, GCancellable *cancellable, GError **error)
|
||||
{
|
||||
g_autoptr(GOptionContext) context = NULL;
|
||||
g_autoptr(GFile) var_deploy_base = NULL;
|
||||
|
@ -76,7 +76,7 @@ xdg_app_builtin_build_init (int argc, char **argv, GCancellable *cancellable, GE
|
|||
|
||||
context = g_option_context_new ("DIRECTORY APPNAME SDK RUNTIME [BRANCH] - Initialize a directory for building");
|
||||
|
||||
if (!xdg_app_option_context_parse (context, options, &argc, &argv, XDG_APP_BUILTIN_FLAG_NO_DIR, NULL, cancellable, error))
|
||||
if (!flatpak_option_context_parse (context, options, &argc, &argv, FLATPAK_BUILTIN_FLAG_NO_DIR, NULL, cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
if (argc < 5)
|
||||
|
@ -89,20 +89,20 @@ xdg_app_builtin_build_init (int argc, char **argv, GCancellable *cancellable, GE
|
|||
if (argc >= 6)
|
||||
branch = argv[5];
|
||||
|
||||
if (!xdg_app_is_valid_name (app_id))
|
||||
return xdg_app_fail (error, "'%s' is not a valid application name", app_id);
|
||||
if (!flatpak_is_valid_name (app_id))
|
||||
return flatpak_fail (error, "'%s' is not a valid application name", app_id);
|
||||
|
||||
if (!xdg_app_is_valid_name (runtime))
|
||||
return xdg_app_fail (error, "'%s' is not a valid runtime name", runtime);
|
||||
if (!flatpak_is_valid_name (runtime))
|
||||
return flatpak_fail (error, "'%s' is not a valid runtime name", runtime);
|
||||
|
||||
if (!xdg_app_is_valid_name (sdk))
|
||||
return xdg_app_fail (error, "'%s' is not a valid sdk name", sdk);
|
||||
if (!flatpak_is_valid_name (sdk))
|
||||
return flatpak_fail (error, "'%s' is not a valid sdk name", sdk);
|
||||
|
||||
if (!xdg_app_is_valid_branch (branch))
|
||||
return xdg_app_fail (error, "'%s' is not a valid branch name", branch);
|
||||
if (!flatpak_is_valid_branch (branch))
|
||||
return flatpak_fail (error, "'%s' is not a valid branch name", branch);
|
||||
|
||||
runtime_ref = xdg_app_build_untyped_ref (runtime, branch, opt_arch);
|
||||
sdk_ref = xdg_app_build_untyped_ref (sdk, branch, opt_arch);
|
||||
runtime_ref = flatpak_build_untyped_ref (runtime, branch, opt_arch);
|
||||
sdk_ref = flatpak_build_untyped_ref (sdk, branch, opt_arch);
|
||||
|
||||
base = g_file_new_for_commandline_arg (directory);
|
||||
|
||||
|
@ -121,16 +121,16 @@ xdg_app_builtin_build_init (int argc, char **argv, GCancellable *cancellable, GE
|
|||
|
||||
if (!opt_update &&
|
||||
g_file_query_exists (files_dir, cancellable))
|
||||
return xdg_app_fail (error, "Build directory %s already initialized", directory);
|
||||
return flatpak_fail (error, "Build directory %s already initialized", directory);
|
||||
|
||||
if (opt_writable_sdk)
|
||||
{
|
||||
g_autofree char *full_sdk_ref = g_strconcat ("runtime/", sdk_ref, NULL);
|
||||
g_autoptr(GError) my_error = NULL;
|
||||
g_autoptr(GFile) sdk_deploy_files = NULL;
|
||||
g_autoptr(XdgAppDeploy) sdk_deploy = NULL;
|
||||
g_autoptr(FlatpakDeploy) sdk_deploy = NULL;
|
||||
|
||||
sdk_deploy = xdg_app_find_deploy_for_ref (full_sdk_ref, cancellable, error);
|
||||
sdk_deploy = flatpak_find_deploy_for_ref (full_sdk_ref, cancellable, error);
|
||||
if (sdk_deploy == NULL)
|
||||
return FALSE;
|
||||
|
||||
|
@ -145,17 +145,17 @@ xdg_app_builtin_build_init (int argc, char **argv, GCancellable *cancellable, GE
|
|||
g_clear_error (&my_error);
|
||||
}
|
||||
|
||||
sdk_deploy_files = xdg_app_deploy_get_files (sdk_deploy);
|
||||
if (!xdg_app_cp_a (sdk_deploy_files, usr_dir, XDG_APP_CP_FLAGS_NO_CHOWN, cancellable, error))
|
||||
sdk_deploy_files = flatpak_deploy_get_files (sdk_deploy);
|
||||
if (!flatpak_cp_a (sdk_deploy_files, usr_dir, FLATPAK_CP_FLAGS_NO_CHOWN, cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
if (opt_sdk_extensions)
|
||||
{
|
||||
g_autoptr(GKeyFile) metakey = xdg_app_deploy_get_metadata (sdk_deploy);
|
||||
g_autoptr(GKeyFile) metakey = flatpak_deploy_get_metadata (sdk_deploy);
|
||||
GList *extensions = NULL, *l;
|
||||
|
||||
/* We leak this on failure, as we have no autoptr for deep lists.. */
|
||||
extensions = xdg_app_list_extensions (metakey,
|
||||
extensions = flatpak_list_extensions (metakey,
|
||||
opt_arch,
|
||||
branch);
|
||||
|
||||
|
@ -166,12 +166,12 @@ xdg_app_builtin_build_init (int argc, char **argv, GCancellable *cancellable, GE
|
|||
|
||||
for (l = extensions; l != NULL; l = l->next)
|
||||
{
|
||||
XdgAppExtension *ext = l->data;
|
||||
FlatpakExtension *ext = l->data;
|
||||
|
||||
if (strcmp (ext->installed_id, requested_extension) == 0 ||
|
||||
strcmp (ext->id, requested_extension) == 0)
|
||||
{
|
||||
g_autoptr(GFile) ext_deploy_dir = xdg_app_find_deploy_dir_for_ref (ext->ref, cancellable, NULL);
|
||||
g_autoptr(GFile) ext_deploy_dir = flatpak_find_deploy_dir_for_ref (ext->ref, cancellable, NULL);
|
||||
if (ext_deploy_dir != NULL)
|
||||
{
|
||||
g_autoptr(GFile) ext_deploy_files = g_file_get_child (ext_deploy_dir, "files");
|
||||
|
@ -185,31 +185,31 @@ xdg_app_builtin_build_init (int argc, char **argv, GCancellable *cancellable, GE
|
|||
if (!gs_shutil_rm_rf (target, cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
if (!xdg_app_cp_a (ext_deploy_files, target, XDG_APP_CP_FLAGS_NO_CHOWN, cancellable, error))
|
||||
if (!flatpak_cp_a (ext_deploy_files, target, FLATPAK_CP_FLAGS_NO_CHOWN, cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
found = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_list_free_full (extensions, (GDestroyNotify) xdg_app_extension_free);
|
||||
return xdg_app_fail (error, "Requested extension %s not installed\n", requested_extension);
|
||||
g_list_free_full (extensions, (GDestroyNotify) flatpak_extension_free);
|
||||
return flatpak_fail (error, "Requested extension %s not installed\n", requested_extension);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!found)
|
||||
return xdg_app_fail (error, "No extension %s in sdk\n", requested_extension);
|
||||
return flatpak_fail (error, "No extension %s in sdk\n", requested_extension);
|
||||
}
|
||||
g_list_free_full (extensions, (GDestroyNotify) xdg_app_extension_free);
|
||||
g_list_free_full (extensions, (GDestroyNotify) flatpak_extension_free);
|
||||
}
|
||||
}
|
||||
|
||||
if (opt_var)
|
||||
{
|
||||
var_ref = xdg_app_build_runtime_ref (opt_var, branch, opt_arch);
|
||||
var_ref = flatpak_build_runtime_ref (opt_var, branch, opt_arch);
|
||||
|
||||
var_deploy_base = xdg_app_find_deploy_dir_for_ref (var_ref, cancellable, error);
|
||||
var_deploy_base = flatpak_find_deploy_dir_for_ref (var_ref, cancellable, error);
|
||||
if (var_deploy_base == NULL)
|
||||
return FALSE;
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ static GOptionEntry options[] = {
|
|||
|
||||
|
||||
gboolean
|
||||
xdg_app_builtin_build_sign (int argc, char **argv, GCancellable *cancellable, GError **error)
|
||||
flatpak_builtin_build_sign (int argc, char **argv, GCancellable *cancellable, GError **error)
|
||||
{
|
||||
g_autoptr(GOptionContext) context = NULL;
|
||||
g_autoptr(GFile) repofile = NULL;
|
||||
|
@ -60,7 +60,7 @@ xdg_app_builtin_build_sign (int argc, char **argv, GCancellable *cancellable, GE
|
|||
|
||||
context = g_option_context_new ("LOCATION ID [BRANCH] - Create a repository from a build directory");
|
||||
|
||||
if (!xdg_app_option_context_parse (context, options, &argc, &argv, XDG_APP_BUILTIN_FLAG_NO_DIR, NULL, cancellable, error))
|
||||
if (!flatpak_option_context_parse (context, options, &argc, &argv, FLATPAK_BUILTIN_FLAG_NO_DIR, NULL, cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
if (argc < 3)
|
||||
|
@ -77,19 +77,19 @@ xdg_app_builtin_build_sign (int argc, char **argv, GCancellable *cancellable, GE
|
|||
else
|
||||
branch = "master";
|
||||
|
||||
if (!xdg_app_is_valid_name (id))
|
||||
return xdg_app_fail (error, "'%s' is not a valid name", id);
|
||||
if (!flatpak_is_valid_name (id))
|
||||
return flatpak_fail (error, "'%s' is not a valid name", id);
|
||||
|
||||
if (!xdg_app_is_valid_branch (branch))
|
||||
return xdg_app_fail (error, "'%s' is not a valid branch name", branch);
|
||||
if (!flatpak_is_valid_branch (branch))
|
||||
return flatpak_fail (error, "'%s' is not a valid branch name", branch);
|
||||
|
||||
if (opt_gpg_key_ids == NULL)
|
||||
return xdg_app_fail (error, "No gpg key ids specified");
|
||||
return flatpak_fail (error, "No gpg key ids specified");
|
||||
|
||||
if (opt_runtime)
|
||||
ref = xdg_app_build_runtime_ref (id, branch, opt_arch);
|
||||
ref = flatpak_build_runtime_ref (id, branch, opt_arch);
|
||||
else
|
||||
ref = xdg_app_build_app_ref (id, branch, opt_arch);
|
||||
ref = flatpak_build_app_ref (id, branch, opt_arch);
|
||||
|
||||
repofile = g_file_new_for_commandline_arg (location);
|
||||
repo = ostree_repo_new (repofile);
|
||||
|
|
|
@ -57,10 +57,10 @@ add_args (GPtrArray *argv_array, ...)
|
|||
}
|
||||
|
||||
gboolean
|
||||
xdg_app_builtin_build (int argc, char **argv, GCancellable *cancellable, GError **error)
|
||||
flatpak_builtin_build (int argc, char **argv, GCancellable *cancellable, GError **error)
|
||||
{
|
||||
g_autoptr(GOptionContext) context = NULL;
|
||||
g_autoptr(XdgAppDeploy) runtime_deploy = NULL;
|
||||
g_autoptr(FlatpakDeploy) runtime_deploy = NULL;
|
||||
g_autoptr(GFile) var = NULL;
|
||||
g_autoptr(GFile) usr = NULL;
|
||||
g_autoptr(GFile) app_deploy = NULL;
|
||||
|
@ -80,8 +80,8 @@ xdg_app_builtin_build (int argc, char **argv, GCancellable *cancellable, GError
|
|||
g_autofree char *app_id = NULL;
|
||||
int i;
|
||||
int rest_argv_start, rest_argc;
|
||||
g_autoptr(XdgAppContext) arg_context = NULL;
|
||||
g_autoptr(XdgAppContext) app_context = NULL;
|
||||
g_autoptr(FlatpakContext) arg_context = NULL;
|
||||
g_autoptr(FlatpakContext) app_context = NULL;
|
||||
gboolean custom_usr;
|
||||
g_auto(GStrv) runtime_ref_parts = NULL;
|
||||
|
||||
|
@ -100,10 +100,10 @@ xdg_app_builtin_build (int argc, char **argv, GCancellable *cancellable, GError
|
|||
}
|
||||
}
|
||||
|
||||
arg_context = xdg_app_context_new ();
|
||||
g_option_context_add_group (context, xdg_app_context_get_options (arg_context));
|
||||
arg_context = flatpak_context_new ();
|
||||
g_option_context_add_group (context, flatpak_context_get_options (arg_context));
|
||||
|
||||
if (!xdg_app_option_context_parse (context, options, &argc, &argv, XDG_APP_BUILTIN_FLAG_NO_DIR, NULL, cancellable, error))
|
||||
if (!flatpak_option_context_parse (context, options, &argc, &argv, FLATPAK_BUILTIN_FLAG_NO_DIR, NULL, cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
if (rest_argc == 0)
|
||||
|
@ -133,15 +133,15 @@ xdg_app_builtin_build (int argc, char **argv, GCancellable *cancellable, GError
|
|||
|
||||
runtime_ref = g_build_filename ("runtime", runtime, NULL);
|
||||
|
||||
runtime_ref_parts = xdg_app_decompose_ref (runtime_ref, error);
|
||||
runtime_ref_parts = flatpak_decompose_ref (runtime_ref, error);
|
||||
if (runtime_ref_parts == NULL)
|
||||
return FALSE;
|
||||
|
||||
runtime_deploy = xdg_app_find_deploy_for_ref (runtime_ref, cancellable, error);
|
||||
runtime_deploy = flatpak_find_deploy_for_ref (runtime_ref, cancellable, error);
|
||||
if (runtime_deploy == NULL)
|
||||
return FALSE;
|
||||
|
||||
runtime_metakey = xdg_app_deploy_get_metadata (runtime_deploy);
|
||||
runtime_metakey = flatpak_deploy_get_metadata (runtime_deploy);
|
||||
|
||||
var = g_file_get_child (app_deploy, "var");
|
||||
if (!gs_file_ensure_directory (var, TRUE, cancellable, error))
|
||||
|
@ -150,7 +150,7 @@ xdg_app_builtin_build (int argc, char **argv, GCancellable *cancellable, GError
|
|||
app_files = g_file_get_child (app_deploy, "files");
|
||||
|
||||
argv_array = g_ptr_array_new_with_free_func (g_free);
|
||||
g_ptr_array_add (argv_array, g_strdup (xdg_app_get_bwrap ()));
|
||||
g_ptr_array_add (argv_array, g_strdup (flatpak_get_bwrap ()));
|
||||
|
||||
custom_usr = FALSE;
|
||||
usr = g_file_get_child (app_deploy, "usr");
|
||||
|
@ -161,7 +161,7 @@ xdg_app_builtin_build (int argc, char **argv, GCancellable *cancellable, GError
|
|||
}
|
||||
else
|
||||
{
|
||||
runtime_files = xdg_app_deploy_get_files (runtime_deploy);
|
||||
runtime_files = flatpak_deploy_get_files (runtime_deploy);
|
||||
}
|
||||
|
||||
add_args (argv_array,
|
||||
|
@ -169,7 +169,7 @@ xdg_app_builtin_build (int argc, char **argv, GCancellable *cancellable, GError
|
|||
"--bind", gs_file_get_path_cached (app_files), "/app",
|
||||
NULL);
|
||||
|
||||
if (!xdg_app_run_setup_base_argv (argv_array, runtime_files, NULL, runtime_ref_parts[2], XDG_APP_RUN_FLAG_DEVEL, error))
|
||||
if (!flatpak_run_setup_base_argv (argv_array, runtime_files, NULL, runtime_ref_parts[2], FLATPAK_RUN_FLAG_DEVEL, error))
|
||||
return FALSE;
|
||||
|
||||
/* After setup_base to avoid conflicts with /var symlinks */
|
||||
|
@ -177,21 +177,21 @@ xdg_app_builtin_build (int argc, char **argv, GCancellable *cancellable, GError
|
|||
"--bind", gs_file_get_path_cached (var), "/var",
|
||||
NULL);
|
||||
|
||||
app_context = xdg_app_context_new ();
|
||||
if (!xdg_app_context_load_metadata (app_context, runtime_metakey, error))
|
||||
app_context = flatpak_context_new ();
|
||||
if (!flatpak_context_load_metadata (app_context, runtime_metakey, error))
|
||||
return FALSE;
|
||||
if (!xdg_app_context_load_metadata (app_context, metakey, error))
|
||||
if (!flatpak_context_load_metadata (app_context, metakey, error))
|
||||
return FALSE;
|
||||
xdg_app_context_allow_host_fs (app_context);
|
||||
xdg_app_context_merge (app_context, arg_context);
|
||||
flatpak_context_allow_host_fs (app_context);
|
||||
flatpak_context_merge (app_context, arg_context);
|
||||
|
||||
envp = xdg_app_run_get_minimal_env (TRUE);
|
||||
envp = xdg_app_run_apply_env_vars (envp, app_context);
|
||||
xdg_app_run_add_environment_args (argv_array, &envp, NULL, NULL, app_id,
|
||||
envp = flatpak_run_get_minimal_env (TRUE);
|
||||
envp = flatpak_run_apply_env_vars (envp, app_context);
|
||||
flatpak_run_add_environment_args (argv_array, &envp, NULL, NULL, app_id,
|
||||
app_context, NULL);
|
||||
|
||||
if (!custom_usr &&
|
||||
!xdg_app_run_add_extension_args (argv_array, runtime_metakey, runtime_ref, cancellable, error))
|
||||
!flatpak_run_add_extension_args (argv_array, runtime_metakey, runtime_ref, cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
for (i = 0; opt_bind_mounts != NULL && opt_bind_mounts[i] != NULL; i++)
|
||||
|
@ -222,7 +222,7 @@ xdg_app_builtin_build (int argc, char **argv, GCancellable *cancellable, GError
|
|||
|
||||
g_ptr_array_add (argv_array, NULL);
|
||||
|
||||
if (!execve (xdg_app_get_bwrap (), (char **) argv_array->pdata, envp))
|
||||
if (!execve (flatpak_get_bwrap (), (char **) argv_array->pdata, envp))
|
||||
{
|
||||
g_set_error (error, G_IO_ERROR, g_io_error_from_errno (errno), "Unable to start app");
|
||||
return FALSE;
|
||||
|
|
|
@ -31,15 +31,15 @@
|
|||
#include "xdg-app-builtins.h"
|
||||
|
||||
gboolean
|
||||
xdg_app_builtin_delete_remote (int argc, char **argv, GCancellable *cancellable, GError **error)
|
||||
flatpak_builtin_delete_remote (int argc, char **argv, GCancellable *cancellable, GError **error)
|
||||
{
|
||||
g_autoptr(GOptionContext) context = NULL;
|
||||
g_autoptr(XdgAppDir) dir = NULL;
|
||||
g_autoptr(FlatpakDir) dir = NULL;
|
||||
const char *remote_name;
|
||||
|
||||
context = g_option_context_new ("NAME - Delete a remote repository");
|
||||
|
||||
if (!xdg_app_option_context_parse (context, NULL, &argc, &argv, 0, &dir, cancellable, error))
|
||||
if (!flatpak_option_context_parse (context, NULL, &argc, &argv, 0, &dir, cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
if (argc < 2)
|
||||
|
@ -47,22 +47,22 @@ xdg_app_builtin_delete_remote (int argc, char **argv, GCancellable *cancellable,
|
|||
|
||||
remote_name = argv[1];
|
||||
|
||||
if (!xdg_app_dir_remove_all_refs (dir, remote_name,
|
||||
if (!flatpak_dir_remove_all_refs (dir, remote_name,
|
||||
cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
if (!xdg_app_dir_remove_appstream (dir, remote_name,
|
||||
if (!flatpak_dir_remove_appstream (dir, remote_name,
|
||||
cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
if (!ostree_repo_remote_change (xdg_app_dir_get_repo (dir), NULL,
|
||||
if (!ostree_repo_remote_change (flatpak_dir_get_repo (dir), NULL,
|
||||
OSTREE_REPO_REMOTE_CHANGE_DELETE,
|
||||
remote_name, NULL,
|
||||
NULL,
|
||||
cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
if (!xdg_app_dir_mark_changed (dir, error))
|
||||
if (!flatpak_dir_mark_changed (dir, error))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
|
|
|
@ -56,7 +56,7 @@ static GOptionEntry options[] = {
|
|||
};
|
||||
|
||||
gboolean
|
||||
xdg_app_builtin_export_file (int argc, char **argv,
|
||||
flatpak_builtin_export_file (int argc, char **argv,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
|
@ -77,8 +77,8 @@ xdg_app_builtin_export_file (int argc, char **argv,
|
|||
|
||||
context = g_option_context_new ("FILE - Export a file to apps");
|
||||
|
||||
if (!xdg_app_option_context_parse (context, options, &argc, &argv,
|
||||
XDG_APP_BUILTIN_FLAG_NO_DIR,
|
||||
if (!flatpak_option_context_parse (context, options, &argc, &argv,
|
||||
FLATPAK_BUILTIN_FLAG_NO_DIR,
|
||||
NULL, cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
|
|
|
@ -117,14 +117,14 @@ child_setup (gpointer user_data)
|
|||
}
|
||||
|
||||
gboolean
|
||||
xdg_app_builtin_enter (int argc,
|
||||
flatpak_builtin_enter (int argc,
|
||||
char **argv,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
g_autoptr(GOptionContext) context = NULL;
|
||||
int rest_argv_start, rest_argc;
|
||||
g_autoptr(XdgAppContext) arg_context = NULL;
|
||||
g_autoptr(FlatpakContext) arg_context = NULL;
|
||||
const char *ns_name[5] = { "user", "ipc", "net", "pid", "mnt" };
|
||||
int ns_fd[G_N_ELEMENTS (ns_name)];
|
||||
char pid_ns[256];
|
||||
|
@ -162,10 +162,10 @@ xdg_app_builtin_enter (int argc,
|
|||
}
|
||||
}
|
||||
|
||||
arg_context = xdg_app_context_new ();
|
||||
g_option_context_add_group (context, xdg_app_context_get_options (arg_context));
|
||||
arg_context = flatpak_context_new ();
|
||||
g_option_context_add_group (context, flatpak_context_get_options (arg_context));
|
||||
|
||||
if (!xdg_app_option_context_parse (context, options, &argc, &argv, XDG_APP_BUILTIN_FLAG_NO_DIR, NULL, cancellable, error))
|
||||
if (!flatpak_option_context_parse (context, options, &argc, &argv, FLATPAK_BUILTIN_FLAG_NO_DIR, NULL, cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
if (rest_argc < 2)
|
||||
|
@ -178,7 +178,7 @@ xdg_app_builtin_enter (int argc,
|
|||
|
||||
pid = atoi (pid_s);
|
||||
if (pid <= 0)
|
||||
return xdg_app_fail (error, "Invalid pid %s\n", pid_s);
|
||||
return flatpak_fail (error, "Invalid pid %s\n", pid_s);
|
||||
|
||||
environment_path = g_strdup_printf ("/proc/%d/environ", pid);
|
||||
if (!g_file_get_contents (environment_path, &environment, &environment_len, error))
|
||||
|
@ -191,12 +191,12 @@ xdg_app_builtin_enter (int argc,
|
|||
|
||||
pid_ns_len = readlink (path, pid_ns, sizeof (pid_ns) - 1);
|
||||
if (pid_ns_len <= 0)
|
||||
return xdg_app_fail (error, "Invalid %s namespace for pid %d\n", ns_name[i], pid);
|
||||
return flatpak_fail (error, "Invalid %s namespace for pid %d\n", ns_name[i], pid);
|
||||
pid_ns[pid_ns_len] = 0;
|
||||
|
||||
self_ns_len = readlink (self_path, self_ns, sizeof (self_ns) - 1);
|
||||
if (self_ns_len <= 0)
|
||||
return xdg_app_fail (error, "Invalid %s namespace for self\n", ns_name[i]);
|
||||
return flatpak_fail (error, "Invalid %s namespace for self\n", ns_name[i]);
|
||||
self_ns[self_ns_len] = 0;
|
||||
|
||||
if (strcmp (self_ns, pid_ns) == 0)
|
||||
|
@ -208,7 +208,7 @@ xdg_app_builtin_enter (int argc,
|
|||
{
|
||||
ns_fd[i] = open (path, O_RDONLY);
|
||||
if (ns_fd[i] == -1)
|
||||
return xdg_app_fail (error, "Can't open %s namespace: %s", ns_name[i], strerror (errno));
|
||||
return flatpak_fail (error, "Can't open %s namespace: %s", ns_name[i], strerror (errno));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -217,7 +217,7 @@ xdg_app_builtin_enter (int argc,
|
|||
if (ns_fd[i] != -1)
|
||||
{
|
||||
if (setns (ns_fd[i], 0) == -1)
|
||||
return xdg_app_fail (error, "Can't enter %s namespace: %s", ns_name[i], strerror (errno));
|
||||
return flatpak_fail (error, "Can't enter %s namespace: %s", ns_name[i], strerror (errno));
|
||||
close (ns_fd[i]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,13 +53,13 @@ static GOptionEntry options[] = {
|
|||
};
|
||||
|
||||
gboolean
|
||||
xdg_app_builtin_info (int argc, char **argv, GCancellable *cancellable, GError **error)
|
||||
flatpak_builtin_info (int argc, char **argv, GCancellable *cancellable, GError **error)
|
||||
{
|
||||
g_autoptr(GOptionContext) context = NULL;
|
||||
g_autofree char *ref = NULL;
|
||||
g_autoptr(XdgAppDir) user_dir = NULL;
|
||||
g_autoptr(XdgAppDir) system_dir = NULL;
|
||||
XdgAppDir *dir = NULL;
|
||||
g_autoptr(FlatpakDir) user_dir = NULL;
|
||||
g_autoptr(FlatpakDir) system_dir = NULL;
|
||||
FlatpakDir *dir = NULL;
|
||||
g_autoptr(GError) lookup_error = NULL;
|
||||
g_autoptr(GVariant) deploy_data = NULL;
|
||||
const char *name;
|
||||
|
@ -71,7 +71,7 @@ xdg_app_builtin_info (int argc, char **argv, GCancellable *cancellable, GError *
|
|||
|
||||
context = g_option_context_new ("NAME [BRANCH] - Get info about installed app and/or runtime");
|
||||
|
||||
if (!xdg_app_option_context_parse (context, options, &argc, &argv, XDG_APP_BUILTIN_FLAG_NO_DIR, NULL, cancellable, error))
|
||||
if (!flatpak_option_context_parse (context, options, &argc, &argv, FLATPAK_BUILTIN_FLAG_NO_DIR, NULL, cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
if (argc < 2)
|
||||
|
@ -89,9 +89,9 @@ xdg_app_builtin_info (int argc, char **argv, GCancellable *cancellable, GError *
|
|||
|
||||
if (opt_user)
|
||||
{
|
||||
user_dir = xdg_app_dir_get_user ();
|
||||
user_dir = flatpak_dir_get_user ();
|
||||
|
||||
ref = xdg_app_dir_find_installed_ref (user_dir,
|
||||
ref = flatpak_dir_find_installed_ref (user_dir,
|
||||
name,
|
||||
branch,
|
||||
opt_arch,
|
||||
|
@ -103,9 +103,9 @@ xdg_app_builtin_info (int argc, char **argv, GCancellable *cancellable, GError *
|
|||
|
||||
if (ref == NULL && opt_system)
|
||||
{
|
||||
system_dir = xdg_app_dir_get_system ();
|
||||
system_dir = flatpak_dir_get_system ();
|
||||
|
||||
ref = xdg_app_dir_find_installed_ref (system_dir,
|
||||
ref = flatpak_dir_find_installed_ref (system_dir,
|
||||
name,
|
||||
branch,
|
||||
opt_arch,
|
||||
|
@ -121,12 +121,12 @@ xdg_app_builtin_info (int argc, char **argv, GCancellable *cancellable, GError *
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
deploy_data = xdg_app_dir_get_deploy_data (dir, ref, cancellable, error);
|
||||
deploy_data = flatpak_dir_get_deploy_data (dir, ref, cancellable, error);
|
||||
if (deploy_data == NULL)
|
||||
return FALSE;
|
||||
|
||||
commit = xdg_app_deploy_data_get_commit (deploy_data);
|
||||
origin = xdg_app_deploy_data_get_origin (deploy_data);
|
||||
commit = flatpak_deploy_data_get_commit (deploy_data);
|
||||
origin = flatpak_deploy_data_get_origin (deploy_data);
|
||||
|
||||
if (!opt_show_ref && !opt_show_origin && !opt_show_commit)
|
||||
opt_show_ref = opt_show_origin = opt_show_commit = TRUE;
|
||||
|
|
|
@ -92,13 +92,13 @@ read_gpg_data (GCancellable *cancellable,
|
|||
}
|
||||
|
||||
/* Chain together all the --keyring options as one long stream. */
|
||||
source_stream = (GInputStream *) xdg_app_chain_input_stream_new (streams);
|
||||
source_stream = (GInputStream *) flatpak_chain_input_stream_new (streams);
|
||||
|
||||
return xdg_app_read_stream (source_stream, FALSE, error);
|
||||
return flatpak_read_stream (source_stream, FALSE, error);
|
||||
}
|
||||
|
||||
gboolean
|
||||
install_bundle (XdgAppDir *dir,
|
||||
install_bundle (FlatpakDir *dir,
|
||||
GOptionContext *context,
|
||||
int argc, char **argv,
|
||||
GCancellable *cancellable,
|
||||
|
@ -125,11 +125,11 @@ install_bundle (XdgAppDir *dir,
|
|||
|
||||
filename = argv[1];
|
||||
|
||||
repo = xdg_app_dir_get_repo (dir);
|
||||
repo = flatpak_dir_get_repo (dir);
|
||||
|
||||
file = g_file_new_for_commandline_arg (filename);
|
||||
|
||||
metadata = xdg_app_bundle_load (file, &to_checksum,
|
||||
metadata = flatpak_bundle_load (file, &to_checksum,
|
||||
&ref,
|
||||
&origin,
|
||||
NULL,
|
||||
|
@ -146,18 +146,18 @@ install_bundle (XdgAppDir *dir,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
parts = xdg_app_decompose_ref (ref, error);
|
||||
parts = flatpak_decompose_ref (ref, error);
|
||||
if (parts == NULL)
|
||||
return FALSE;
|
||||
|
||||
deploy_base = xdg_app_dir_get_deploy_dir (dir, ref);
|
||||
deploy_base = flatpak_dir_get_deploy_dir (dir, ref);
|
||||
|
||||
if (g_file_query_exists (deploy_base, cancellable))
|
||||
return xdg_app_fail (error, "%s branch %s already installed", parts[1], parts[3]);
|
||||
return flatpak_fail (error, "%s branch %s already installed", parts[1], parts[3]);
|
||||
|
||||
/* Add a remote for later updates */
|
||||
basename = g_file_get_basename (file);
|
||||
remote = xdg_app_dir_create_origin_remote (dir,
|
||||
remote = flatpak_dir_create_origin_remote (dir,
|
||||
origin,
|
||||
parts[1],
|
||||
basename,
|
||||
|
@ -170,10 +170,10 @@ install_bundle (XdgAppDir *dir,
|
|||
/* From here we need to goto out on error, to clean up */
|
||||
added_remote = TRUE;
|
||||
|
||||
if (!xdg_app_dir_ensure_repo (dir, cancellable, error))
|
||||
if (!flatpak_dir_ensure_repo (dir, cancellable, error))
|
||||
goto out;
|
||||
|
||||
if (!xdg_app_pull_from_bundle (xdg_app_dir_get_repo (dir),
|
||||
if (!flatpak_pull_from_bundle (flatpak_dir_get_repo (dir),
|
||||
file,
|
||||
remote,
|
||||
ref,
|
||||
|
@ -182,7 +182,7 @@ install_bundle (XdgAppDir *dir,
|
|||
error))
|
||||
goto out;
|
||||
|
||||
if (!xdg_app_dir_deploy_install (dir, ref, remote, NULL, cancellable, error))
|
||||
if (!flatpak_dir_deploy_install (dir, ref, remote, NULL, cancellable, error))
|
||||
goto out;
|
||||
|
||||
ret = TRUE;
|
||||
|
@ -195,10 +195,10 @@ out:
|
|||
}
|
||||
|
||||
gboolean
|
||||
xdg_app_builtin_install (int argc, char **argv, GCancellable *cancellable, GError **error)
|
||||
flatpak_builtin_install (int argc, char **argv, GCancellable *cancellable, GError **error)
|
||||
{
|
||||
g_autoptr(GOptionContext) context = NULL;
|
||||
g_autoptr(XdgAppDir) dir = NULL;
|
||||
g_autoptr(FlatpakDir) dir = NULL;
|
||||
g_autoptr(GFile) deploy_base = NULL;
|
||||
const char *repository;
|
||||
const char *name;
|
||||
|
@ -210,7 +210,7 @@ xdg_app_builtin_install (int argc, char **argv, GCancellable *cancellable, GErro
|
|||
|
||||
context = g_option_context_new ("REPOSITORY NAME [BRANCH] - Install an application or runtime");
|
||||
|
||||
if (!xdg_app_option_context_parse (context, options, &argc, &argv, 0, &dir, cancellable, error))
|
||||
if (!flatpak_option_context_parse (context, options, &argc, &argv, 0, &dir, cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
if (opt_bundle)
|
||||
|
@ -227,14 +227,14 @@ xdg_app_builtin_install (int argc, char **argv, GCancellable *cancellable, GErro
|
|||
if (!opt_app && !opt_runtime)
|
||||
opt_app = opt_runtime = TRUE;
|
||||
|
||||
installed_ref = xdg_app_dir_find_installed_ref (dir,
|
||||
installed_ref = flatpak_dir_find_installed_ref (dir,
|
||||
name,
|
||||
branch,
|
||||
opt_arch,
|
||||
opt_app, opt_runtime, &is_app,
|
||||
&my_error);
|
||||
if (installed_ref != NULL)
|
||||
return xdg_app_fail (error, "%s %s, branch %s is already installed",
|
||||
return flatpak_fail (error, "%s %s, branch %s is already installed",
|
||||
is_app ? "App" : "Runtime", name, branch ? branch : "master");
|
||||
|
||||
if (!g_error_matches (my_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
|
||||
|
@ -243,16 +243,16 @@ xdg_app_builtin_install (int argc, char **argv, GCancellable *cancellable, GErro
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
ref = xdg_app_dir_find_remote_ref (dir, repository, name, branch, opt_arch,
|
||||
ref = flatpak_dir_find_remote_ref (dir, repository, name, branch, opt_arch,
|
||||
opt_app, opt_runtime, &is_app, cancellable, error);
|
||||
if (ref == NULL)
|
||||
return FALSE;
|
||||
|
||||
deploy_base = xdg_app_dir_get_deploy_dir (dir, ref);
|
||||
deploy_base = flatpak_dir_get_deploy_dir (dir, ref);
|
||||
if (g_file_query_exists (deploy_base, cancellable))
|
||||
return xdg_app_fail (error, "Ref %s already deployed", ref);
|
||||
return flatpak_fail (error, "Ref %s already deployed", ref);
|
||||
|
||||
if (!xdg_app_dir_install (dir,
|
||||
if (!flatpak_dir_install (dir,
|
||||
opt_no_pull,
|
||||
opt_no_deploy,
|
||||
ref, repository, opt_subpaths,
|
||||
|
|
|
@ -45,18 +45,18 @@ static GOptionEntry options[] = {
|
|||
};
|
||||
|
||||
gboolean
|
||||
xdg_app_builtin_list_remotes (int argc, char **argv, GCancellable *cancellable, GError **error)
|
||||
flatpak_builtin_list_remotes (int argc, char **argv, GCancellable *cancellable, GError **error)
|
||||
{
|
||||
g_autoptr(GOptionContext) context = NULL;
|
||||
g_autoptr(XdgAppDir) user_dir = NULL;
|
||||
g_autoptr(XdgAppDir) system_dir = NULL;
|
||||
XdgAppDir *dirs[2] = { 0 };
|
||||
g_autoptr(FlatpakDir) user_dir = NULL;
|
||||
g_autoptr(FlatpakDir) system_dir = NULL;
|
||||
FlatpakDir *dirs[2] = { 0 };
|
||||
guint i = 0, n_dirs = 0, j;
|
||||
XdgAppTablePrinter *printer;
|
||||
FlatpakTablePrinter *printer;
|
||||
|
||||
context = g_option_context_new (" - List remote repositories");
|
||||
|
||||
if (!xdg_app_option_context_parse (context, options, &argc, &argv, XDG_APP_BUILTIN_FLAG_NO_DIR, NULL, cancellable, error))
|
||||
if (!flatpak_option_context_parse (context, options, &argc, &argv, FLATPAK_BUILTIN_FLAG_NO_DIR, NULL, cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
if (!opt_user && !opt_system)
|
||||
|
@ -64,24 +64,24 @@ xdg_app_builtin_list_remotes (int argc, char **argv, GCancellable *cancellable,
|
|||
|
||||
if (opt_user)
|
||||
{
|
||||
user_dir = xdg_app_dir_get_user ();
|
||||
user_dir = flatpak_dir_get_user ();
|
||||
dirs[n_dirs++] = user_dir;
|
||||
}
|
||||
|
||||
if (opt_system)
|
||||
{
|
||||
system_dir = xdg_app_dir_get_system ();
|
||||
system_dir = flatpak_dir_get_system ();
|
||||
dirs[n_dirs++] = system_dir;
|
||||
}
|
||||
|
||||
printer = xdg_app_table_printer_new ();
|
||||
printer = flatpak_table_printer_new ();
|
||||
|
||||
for (j = 0; j < n_dirs; j++)
|
||||
{
|
||||
XdgAppDir *dir = dirs[j];
|
||||
FlatpakDir *dir = dirs[j];
|
||||
g_auto(GStrv) remotes = NULL;
|
||||
|
||||
remotes = xdg_app_dir_list_remotes (dir, cancellable, error);
|
||||
remotes = flatpak_dir_list_remotes (dir, cancellable, error);
|
||||
if (remotes == NULL)
|
||||
return FALSE;
|
||||
|
||||
|
@ -90,7 +90,7 @@ xdg_app_builtin_list_remotes (int argc, char **argv, GCancellable *cancellable,
|
|||
char *remote_name = remotes[i];
|
||||
gboolean disabled;
|
||||
|
||||
disabled = xdg_app_dir_get_remote_disabled (dir, remote_name);
|
||||
disabled = flatpak_dir_get_remote_disabled (dir, remote_name);
|
||||
if (disabled && !opt_show_disabled)
|
||||
continue;
|
||||
|
||||
|
@ -102,48 +102,48 @@ xdg_app_builtin_list_remotes (int argc, char **argv, GCancellable *cancellable,
|
|||
g_autofree char *prio_as_string = NULL;
|
||||
gboolean gpg_verify = TRUE;
|
||||
|
||||
xdg_app_table_printer_add_column (printer, remote_name);
|
||||
flatpak_table_printer_add_column (printer, remote_name);
|
||||
|
||||
title = xdg_app_dir_get_remote_title (dir, remote_name);
|
||||
title = flatpak_dir_get_remote_title (dir, remote_name);
|
||||
if (title)
|
||||
xdg_app_table_printer_add_column (printer, title);
|
||||
flatpak_table_printer_add_column (printer, title);
|
||||
else
|
||||
xdg_app_table_printer_add_column (printer, "-");
|
||||
flatpak_table_printer_add_column (printer, "-");
|
||||
|
||||
ostree_repo_remote_get_url (xdg_app_dir_get_repo (dir), remote_name, &remote_url, NULL);
|
||||
ostree_repo_remote_get_url (flatpak_dir_get_repo (dir), remote_name, &remote_url, NULL);
|
||||
|
||||
xdg_app_table_printer_add_column (printer, remote_url);
|
||||
flatpak_table_printer_add_column (printer, remote_url);
|
||||
|
||||
prio = xdg_app_dir_get_remote_prio (dir, remote_name);
|
||||
prio = flatpak_dir_get_remote_prio (dir, remote_name);
|
||||
prio_as_string = g_strdup_printf ("%d", prio);
|
||||
xdg_app_table_printer_add_column (printer, prio_as_string);
|
||||
flatpak_table_printer_add_column (printer, prio_as_string);
|
||||
|
||||
xdg_app_table_printer_add_column (printer, ""); /* Options */
|
||||
flatpak_table_printer_add_column (printer, ""); /* Options */
|
||||
|
||||
ostree_repo_remote_get_gpg_verify (xdg_app_dir_get_repo (dir), remote_name,
|
||||
ostree_repo_remote_get_gpg_verify (flatpak_dir_get_repo (dir), remote_name,
|
||||
&gpg_verify, NULL);
|
||||
if (!gpg_verify)
|
||||
xdg_app_table_printer_append_with_comma (printer, "no-gpg-verify");
|
||||
flatpak_table_printer_append_with_comma (printer, "no-gpg-verify");
|
||||
if (disabled)
|
||||
xdg_app_table_printer_append_with_comma (printer, "disabled");
|
||||
flatpak_table_printer_append_with_comma (printer, "disabled");
|
||||
|
||||
if (xdg_app_dir_get_remote_noenumerate (dir, remote_name))
|
||||
xdg_app_table_printer_append_with_comma (printer, "no-enumerate");
|
||||
if (flatpak_dir_get_remote_noenumerate (dir, remote_name))
|
||||
flatpak_table_printer_append_with_comma (printer, "no-enumerate");
|
||||
|
||||
if (opt_user && opt_system)
|
||||
xdg_app_table_printer_append_with_comma (printer, dir == user_dir ? "user" : "system");
|
||||
flatpak_table_printer_append_with_comma (printer, dir == user_dir ? "user" : "system");
|
||||
}
|
||||
else
|
||||
{
|
||||
xdg_app_table_printer_add_column (printer, remote_name);
|
||||
flatpak_table_printer_add_column (printer, remote_name);
|
||||
}
|
||||
|
||||
xdg_app_table_printer_finish_row (printer);
|
||||
flatpak_table_printer_finish_row (printer);
|
||||
}
|
||||
}
|
||||
|
||||
xdg_app_table_printer_print (printer);
|
||||
xdg_app_table_printer_free (printer);
|
||||
flatpak_table_printer_print (printer);
|
||||
flatpak_table_printer_free (printer);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -82,36 +82,36 @@ print_installed_refs (gboolean app, gboolean runtime, gboolean print_system, gbo
|
|||
g_auto(GStrv) user = NULL;
|
||||
g_auto(GStrv) user_app = NULL;
|
||||
g_auto(GStrv) user_runtime = NULL;
|
||||
g_autoptr(XdgAppDir) user_dir = NULL;
|
||||
g_autoptr(XdgAppDir) system_dir = NULL;
|
||||
g_autoptr(FlatpakDir) user_dir = NULL;
|
||||
g_autoptr(FlatpakDir) system_dir = NULL;
|
||||
int s, u;
|
||||
|
||||
if (print_user)
|
||||
{
|
||||
user_dir = xdg_app_dir_get (TRUE);
|
||||
user_dir = flatpak_dir_get (TRUE);
|
||||
|
||||
if (xdg_app_dir_ensure_repo (user_dir, cancellable, NULL))
|
||||
if (flatpak_dir_ensure_repo (user_dir, cancellable, NULL))
|
||||
{
|
||||
if (app && !xdg_app_dir_list_refs (user_dir, "app", &user_app, cancellable, error))
|
||||
if (app && !flatpak_dir_list_refs (user_dir, "app", &user_app, cancellable, error))
|
||||
return FALSE;
|
||||
if (runtime && !xdg_app_dir_list_refs (user_dir, "runtime", &user_runtime, cancellable, error))
|
||||
if (runtime && !flatpak_dir_list_refs (user_dir, "runtime", &user_runtime, cancellable, error))
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (print_system)
|
||||
{
|
||||
system_dir = xdg_app_dir_get (FALSE);
|
||||
if (xdg_app_dir_ensure_repo (system_dir, cancellable, NULL))
|
||||
system_dir = flatpak_dir_get (FALSE);
|
||||
if (flatpak_dir_ensure_repo (system_dir, cancellable, NULL))
|
||||
{
|
||||
if (app && !xdg_app_dir_list_refs (system_dir, "app", &system_app, cancellable, error))
|
||||
if (app && !flatpak_dir_list_refs (system_dir, "app", &system_app, cancellable, error))
|
||||
return FALSE;
|
||||
if (runtime && !xdg_app_dir_list_refs (system_dir, "runtime", &system_runtime, cancellable, error))
|
||||
if (runtime && !flatpak_dir_list_refs (system_dir, "runtime", &system_runtime, cancellable, error))
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
XdgAppTablePrinter *printer = xdg_app_table_printer_new ();
|
||||
FlatpakTablePrinter *printer = flatpak_table_printer_new ();
|
||||
|
||||
user = join_strv (user_app, user_runtime);
|
||||
system = join_strv (system_app, system_runtime);
|
||||
|
@ -122,7 +122,7 @@ print_installed_refs (gboolean app, gboolean runtime, gboolean print_system, gbo
|
|||
g_auto(GStrv) parts = NULL;
|
||||
const char *repo = NULL;
|
||||
gboolean is_user;
|
||||
XdgAppDir *dir = NULL;
|
||||
FlatpakDir *dir = NULL;
|
||||
g_autoptr(GVariant) deploy_data = NULL;
|
||||
|
||||
if (system[s] == NULL)
|
||||
|
@ -148,21 +148,21 @@ print_installed_refs (gboolean app, gboolean runtime, gboolean print_system, gbo
|
|||
parts = g_strsplit (ref, "/", -1);
|
||||
partial_ref = strchr (ref, '/') + 1;
|
||||
|
||||
deploy_data = xdg_app_dir_get_deploy_data (dir, ref, cancellable, error);
|
||||
deploy_data = flatpak_dir_get_deploy_data (dir, ref, cancellable, error);
|
||||
if (deploy_data == NULL)
|
||||
return FALSE;
|
||||
|
||||
repo = xdg_app_deploy_data_get_origin (deploy_data);
|
||||
repo = flatpak_deploy_data_get_origin (deploy_data);
|
||||
|
||||
if (opt_show_details)
|
||||
{
|
||||
g_autofree char *active = xdg_app_dir_read_active (dir, ref, NULL);
|
||||
g_autofree char *active = flatpak_dir_read_active (dir, ref, NULL);
|
||||
g_autofree char *latest = NULL;
|
||||
g_autofree char *size_s = NULL;
|
||||
guint64 size = 0;
|
||||
g_autofree const char **subpaths = NULL;
|
||||
|
||||
latest = xdg_app_dir_read_latest (dir, repo, ref, NULL, NULL);
|
||||
latest = flatpak_dir_read_latest (dir, repo, ref, NULL, NULL);
|
||||
if (latest)
|
||||
{
|
||||
if (strcmp (active, latest) == 0)
|
||||
|
@ -180,75 +180,75 @@ print_installed_refs (gboolean app, gboolean runtime, gboolean print_system, gbo
|
|||
latest = g_strdup ("?");
|
||||
}
|
||||
|
||||
xdg_app_table_printer_add_column (printer, partial_ref);
|
||||
xdg_app_table_printer_add_column (printer, repo);
|
||||
flatpak_table_printer_add_column (printer, partial_ref);
|
||||
flatpak_table_printer_add_column (printer, repo);
|
||||
|
||||
active[MIN (strlen (active), 12)] = 0;
|
||||
xdg_app_table_printer_add_column (printer, active);
|
||||
xdg_app_table_printer_add_column (printer, latest);
|
||||
flatpak_table_printer_add_column (printer, active);
|
||||
flatpak_table_printer_add_column (printer, latest);
|
||||
|
||||
size = xdg_app_deploy_data_get_installed_size (deploy_data);
|
||||
size = flatpak_deploy_data_get_installed_size (deploy_data);
|
||||
size_s = g_format_size (size);
|
||||
xdg_app_table_printer_add_column (printer, size_s);
|
||||
flatpak_table_printer_add_column (printer, size_s);
|
||||
|
||||
xdg_app_table_printer_add_column (printer, ""); /* Options */
|
||||
flatpak_table_printer_add_column (printer, ""); /* Options */
|
||||
|
||||
if (print_user && print_system)
|
||||
xdg_app_table_printer_append_with_comma (printer, is_user ? "user" : "system");
|
||||
flatpak_table_printer_append_with_comma (printer, is_user ? "user" : "system");
|
||||
|
||||
if (strcmp (parts[0], "app") == 0)
|
||||
{
|
||||
g_autofree char *current;
|
||||
|
||||
current = xdg_app_dir_current_ref (dir, parts[1], cancellable);
|
||||
current = flatpak_dir_current_ref (dir, parts[1], cancellable);
|
||||
if (current && strcmp (ref, current) == 0)
|
||||
xdg_app_table_printer_append_with_comma (printer, "current");
|
||||
flatpak_table_printer_append_with_comma (printer, "current");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (app)
|
||||
xdg_app_table_printer_append_with_comma (printer, "runtime");
|
||||
flatpak_table_printer_append_with_comma (printer, "runtime");
|
||||
}
|
||||
|
||||
subpaths = xdg_app_deploy_data_get_subpaths (deploy_data);
|
||||
subpaths = flatpak_deploy_data_get_subpaths (deploy_data);
|
||||
if (subpaths[0] == NULL)
|
||||
{
|
||||
xdg_app_table_printer_add_column (printer, "");
|
||||
flatpak_table_printer_add_column (printer, "");
|
||||
}
|
||||
else
|
||||
{
|
||||
int i;
|
||||
xdg_app_table_printer_add_column (printer, ""); /* subpaths */
|
||||
flatpak_table_printer_add_column (printer, ""); /* subpaths */
|
||||
for (i = 0; subpaths[i] != NULL; i++)
|
||||
xdg_app_table_printer_append_with_comma (printer, subpaths[i]);
|
||||
flatpak_table_printer_append_with_comma (printer, subpaths[i]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (last == NULL || strcmp (last, parts[1]) != 0)
|
||||
{
|
||||
xdg_app_table_printer_add_column (printer, parts[1]);
|
||||
flatpak_table_printer_add_column (printer, parts[1]);
|
||||
g_clear_pointer (&last, g_free);
|
||||
last = g_strdup (parts[1]);
|
||||
}
|
||||
}
|
||||
xdg_app_table_printer_finish_row (printer);
|
||||
flatpak_table_printer_finish_row (printer);
|
||||
}
|
||||
|
||||
xdg_app_table_printer_print (printer);
|
||||
xdg_app_table_printer_free (printer);
|
||||
flatpak_table_printer_print (printer);
|
||||
flatpak_table_printer_free (printer);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
xdg_app_builtin_list (int argc, char **argv, GCancellable *cancellable, GError **error)
|
||||
flatpak_builtin_list (int argc, char **argv, GCancellable *cancellable, GError **error)
|
||||
{
|
||||
g_autoptr(GOptionContext) context = NULL;
|
||||
|
||||
context = g_option_context_new (" - List installed apps and/or runtimes");
|
||||
|
||||
if (!xdg_app_option_context_parse (context, options, &argc, &argv, XDG_APP_BUILTIN_FLAG_NO_DIR, NULL, cancellable, error))
|
||||
if (!flatpak_option_context_parse (context, options, &argc, &argv, FLATPAK_BUILTIN_FLAG_NO_DIR, NULL, cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
if (!opt_app && !opt_runtime)
|
||||
|
|
|
@ -45,10 +45,10 @@ static GOptionEntry options[] = {
|
|||
};
|
||||
|
||||
gboolean
|
||||
xdg_app_builtin_ls_remote (int argc, char **argv, GCancellable *cancellable, GError **error)
|
||||
flatpak_builtin_ls_remote (int argc, char **argv, GCancellable *cancellable, GError **error)
|
||||
{
|
||||
g_autoptr(GOptionContext) context = NULL;
|
||||
g_autoptr(XdgAppDir) dir = NULL;
|
||||
g_autoptr(FlatpakDir) dir = NULL;
|
||||
g_autoptr(GHashTable) refs = NULL;
|
||||
GHashTableIter iter;
|
||||
gpointer key;
|
||||
|
@ -62,7 +62,7 @@ xdg_app_builtin_ls_remote (int argc, char **argv, GCancellable *cancellable, GEr
|
|||
|
||||
context = g_option_context_new (" REMOTE - Show available runtimes and applications");
|
||||
|
||||
if (!xdg_app_option_context_parse (context, options, &argc, &argv, 0, &dir, cancellable, error))
|
||||
if (!flatpak_option_context_parse (context, options, &argc, &argv, 0, &dir, cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
if (!opt_app && !opt_runtime)
|
||||
|
@ -74,7 +74,7 @@ xdg_app_builtin_ls_remote (int argc, char **argv, GCancellable *cancellable, GEr
|
|||
repository = argv[1];
|
||||
|
||||
|
||||
if (!xdg_app_dir_list_remote_refs (dir,
|
||||
if (!flatpak_dir_list_remote_refs (dir,
|
||||
repository,
|
||||
&refs,
|
||||
cancellable, error))
|
||||
|
@ -82,7 +82,7 @@ xdg_app_builtin_ls_remote (int argc, char **argv, GCancellable *cancellable, GEr
|
|||
|
||||
names = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
|
||||
|
||||
arch = xdg_app_get_arch ();
|
||||
arch = flatpak_get_arch ();
|
||||
|
||||
g_hash_table_iter_init (&iter, refs);
|
||||
while (g_hash_table_iter_next (&iter, &key, &value))
|
||||
|
@ -92,7 +92,7 @@ xdg_app_builtin_ls_remote (int argc, char **argv, GCancellable *cancellable, GEr
|
|||
const char *name = NULL;
|
||||
g_auto(GStrv) parts = NULL;
|
||||
|
||||
parts = xdg_app_decompose_ref (ref, NULL);
|
||||
parts = flatpak_decompose_ref (ref, NULL);
|
||||
if (parts == NULL)
|
||||
{
|
||||
g_debug ("Invalid remote ref %s\n", ref);
|
||||
|
@ -103,7 +103,7 @@ xdg_app_builtin_ls_remote (int argc, char **argv, GCancellable *cancellable, GEr
|
|||
{
|
||||
g_autofree char *deployed = NULL;
|
||||
|
||||
deployed = xdg_app_dir_read_active (dir, ref, cancellable);
|
||||
deployed = flatpak_dir_read_active (dir, ref, cancellable);
|
||||
if (deployed == NULL)
|
||||
continue;
|
||||
|
||||
|
@ -133,7 +133,7 @@ xdg_app_builtin_ls_remote (int argc, char **argv, GCancellable *cancellable, GEr
|
|||
}
|
||||
|
||||
keys = (const char **) g_hash_table_get_keys_as_array (names, &n_keys);
|
||||
g_qsort_with_data (keys, n_keys, sizeof (char *), (GCompareDataFunc) xdg_app_strcmp0_ptr, NULL);
|
||||
g_qsort_with_data (keys, n_keys, sizeof (char *), (GCompareDataFunc) flatpak_strcmp0_ptr, NULL);
|
||||
|
||||
for (i = 0; i < n_keys; i++)
|
||||
{
|
||||
|
|
|
@ -39,10 +39,10 @@ static GOptionEntry options[] = {
|
|||
};
|
||||
|
||||
gboolean
|
||||
xdg_app_builtin_make_current_app (int argc, char **argv, GCancellable *cancellable, GError **error)
|
||||
flatpak_builtin_make_current_app (int argc, char **argv, GCancellable *cancellable, GError **error)
|
||||
{
|
||||
g_autoptr(GOptionContext) context = NULL;
|
||||
g_autoptr(XdgAppDir) dir = NULL;
|
||||
g_autoptr(FlatpakDir) dir = NULL;
|
||||
g_autoptr(GFile) deploy_base = NULL;
|
||||
const char *app;
|
||||
const char *branch = "master";
|
||||
|
@ -51,7 +51,7 @@ xdg_app_builtin_make_current_app (int argc, char **argv, GCancellable *cancellab
|
|||
|
||||
context = g_option_context_new ("APP BRANCH - Make branch of application current");
|
||||
|
||||
if (!xdg_app_option_context_parse (context, options, &argc, &argv, 0, &dir, cancellable, error))
|
||||
if (!flatpak_option_context_parse (context, options, &argc, &argv, 0, &dir, cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
if (argc < 3)
|
||||
|
@ -60,27 +60,27 @@ xdg_app_builtin_make_current_app (int argc, char **argv, GCancellable *cancellab
|
|||
app = argv[1];
|
||||
branch = argv[2];
|
||||
|
||||
ref = xdg_app_compose_ref (TRUE, app, branch, opt_arch, error);
|
||||
ref = flatpak_compose_ref (TRUE, app, branch, opt_arch, error);
|
||||
if (ref == NULL)
|
||||
return FALSE;
|
||||
|
||||
if (!xdg_app_dir_lock (dir, &lock,
|
||||
if (!flatpak_dir_lock (dir, &lock,
|
||||
cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
deploy_base = xdg_app_dir_get_deploy_dir (dir, ref);
|
||||
deploy_base = flatpak_dir_get_deploy_dir (dir, ref);
|
||||
if (!g_file_query_exists (deploy_base, cancellable))
|
||||
return xdg_app_fail (error, "App %s branch %s is not installed", app, branch);
|
||||
return flatpak_fail (error, "App %s branch %s is not installed", app, branch);
|
||||
|
||||
if (!xdg_app_dir_make_current_ref (dir, ref, cancellable, error))
|
||||
if (!flatpak_dir_make_current_ref (dir, ref, cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
if (!xdg_app_dir_update_exports (dir, app, cancellable, error))
|
||||
if (!flatpak_dir_update_exports (dir, app, cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
glnx_release_lock_file (&lock);
|
||||
|
||||
if (!xdg_app_dir_mark_changed (dir, error))
|
||||
if (!flatpak_dir_mark_changed (dir, error))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
|
|
|
@ -39,22 +39,22 @@ static GOptionEntry options[] = {
|
|||
};
|
||||
|
||||
gboolean
|
||||
xdg_app_builtin_override (int argc, char **argv, GCancellable *cancellable, GError **error)
|
||||
flatpak_builtin_override (int argc, char **argv, GCancellable *cancellable, GError **error)
|
||||
{
|
||||
g_autoptr(GOptionContext) context = NULL;
|
||||
const char *app;
|
||||
g_autoptr(XdgAppContext) arg_context = NULL;
|
||||
g_autoptr(XdgAppDir) dir = NULL;
|
||||
g_autoptr(FlatpakContext) arg_context = NULL;
|
||||
g_autoptr(FlatpakDir) dir = NULL;
|
||||
g_autoptr(GKeyFile) metakey = NULL;
|
||||
g_autoptr(XdgAppContext) overrides = NULL;
|
||||
g_autoptr(FlatpakContext) overrides = NULL;
|
||||
g_autoptr(GError) my_error = NULL;
|
||||
|
||||
context = g_option_context_new ("APP - Override settings for application");
|
||||
|
||||
arg_context = xdg_app_context_new ();
|
||||
g_option_context_add_group (context, xdg_app_context_get_options (arg_context));
|
||||
arg_context = flatpak_context_new ();
|
||||
g_option_context_add_group (context, flatpak_context_get_options (arg_context));
|
||||
|
||||
if (!xdg_app_option_context_parse (context, options, &argc, &argv, 0, &dir, cancellable, error))
|
||||
if (!flatpak_option_context_parse (context, options, &argc, &argv, 0, &dir, cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
if (argc < 2)
|
||||
|
@ -65,10 +65,10 @@ xdg_app_builtin_override (int argc, char **argv, GCancellable *cancellable, GErr
|
|||
|
||||
app = argv[1];
|
||||
|
||||
if (!xdg_app_is_valid_name (app))
|
||||
return xdg_app_fail (error, "'%s' is not a valid application name", app);
|
||||
if (!flatpak_is_valid_name (app))
|
||||
return flatpak_fail (error, "'%s' is not a valid application name", app);
|
||||
|
||||
metakey = xdg_app_load_override_keyfile (app, xdg_app_dir_is_user (dir), &my_error);
|
||||
metakey = flatpak_load_override_keyfile (app, flatpak_dir_is_user (dir), &my_error);
|
||||
if (metakey == NULL)
|
||||
{
|
||||
if (!g_error_matches (my_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
|
||||
|
@ -79,15 +79,15 @@ xdg_app_builtin_override (int argc, char **argv, GCancellable *cancellable, GErr
|
|||
metakey = g_key_file_new ();
|
||||
}
|
||||
|
||||
overrides = xdg_app_context_new ();
|
||||
if (!xdg_app_context_load_metadata (overrides, metakey, error))
|
||||
overrides = flatpak_context_new ();
|
||||
if (!flatpak_context_load_metadata (overrides, metakey, error))
|
||||
return FALSE;
|
||||
|
||||
xdg_app_context_merge (overrides, arg_context);
|
||||
flatpak_context_merge (overrides, arg_context);
|
||||
|
||||
xdg_app_context_save_metadata (overrides, metakey);
|
||||
flatpak_context_save_metadata (overrides, metakey);
|
||||
|
||||
if (!xdg_app_save_override_keyfile (metakey, app, xdg_app_dir_is_user (dir), error))
|
||||
if (!flatpak_save_override_keyfile (metakey, app, flatpak_dir_is_user (dir), error))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
|
|
|
@ -49,7 +49,7 @@ static GOptionEntry options[] = {
|
|||
};
|
||||
|
||||
gboolean
|
||||
xdg_app_builtin_build_update_repo (int argc, char **argv,
|
||||
flatpak_builtin_build_update_repo (int argc, char **argv,
|
||||
GCancellable *cancellable, GError **error)
|
||||
{
|
||||
g_autoptr(GOptionContext) context = NULL;
|
||||
|
@ -60,7 +60,7 @@ xdg_app_builtin_build_update_repo (int argc, char **argv,
|
|||
|
||||
context = g_option_context_new ("LOCATION - Update repository metadata");
|
||||
|
||||
if (!xdg_app_option_context_parse (context, options, &argc, &argv, XDG_APP_BUILTIN_FLAG_NO_DIR, NULL, cancellable, error))
|
||||
if (!flatpak_option_context_parse (context, options, &argc, &argv, FLATPAK_BUILTIN_FLAG_NO_DIR, NULL, cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
if (argc < 2)
|
||||
|
@ -75,11 +75,11 @@ xdg_app_builtin_build_update_repo (int argc, char **argv,
|
|||
return FALSE;
|
||||
|
||||
if (opt_title &&
|
||||
!xdg_app_repo_set_title (repo, opt_title, error))
|
||||
!flatpak_repo_set_title (repo, opt_title, error))
|
||||
return FALSE;
|
||||
|
||||
g_print ("Updating appstream branch\n");
|
||||
if (!xdg_app_repo_generate_appstream (repo, (const char **) opt_gpg_key_ids, opt_gpg_homedir, cancellable, &my_error))
|
||||
if (!flatpak_repo_generate_appstream (repo, (const char **) opt_gpg_key_ids, opt_gpg_homedir, cancellable, &my_error))
|
||||
{
|
||||
if (g_error_matches (my_error, G_SPAWN_ERROR, G_SPAWN_ERROR_NOENT))
|
||||
{
|
||||
|
@ -187,7 +187,7 @@ xdg_app_builtin_build_update_repo (int argc, char **argv,
|
|||
}
|
||||
|
||||
g_print ("Updating summary\n");
|
||||
if (!xdg_app_repo_update (repo, (const char **) opt_gpg_key_ids, opt_gpg_homedir, cancellable, error))
|
||||
if (!flatpak_repo_update (repo, (const char **) opt_gpg_key_ids, opt_gpg_homedir, cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
if (opt_prune)
|
||||
|
|
|
@ -57,16 +57,16 @@ static GOptionEntry options[] = {
|
|||
};
|
||||
|
||||
gboolean
|
||||
xdg_app_builtin_run (int argc, char **argv, GCancellable *cancellable, GError **error)
|
||||
flatpak_builtin_run (int argc, char **argv, GCancellable *cancellable, GError **error)
|
||||
{
|
||||
g_autoptr(GOptionContext) context = NULL;
|
||||
g_autoptr(XdgAppDeploy) app_deploy = NULL;
|
||||
g_autoptr(FlatpakDeploy) app_deploy = NULL;
|
||||
g_autofree char *app_ref = NULL;
|
||||
const char *app;
|
||||
const char *branch = "master";
|
||||
int i;
|
||||
int rest_argv_start, rest_argc;
|
||||
g_autoptr(XdgAppContext) arg_context = NULL;
|
||||
g_autoptr(FlatpakContext) arg_context = NULL;
|
||||
|
||||
context = g_option_context_new ("APP [args...] - Run an app");
|
||||
|
||||
|
@ -83,10 +83,10 @@ xdg_app_builtin_run (int argc, char **argv, GCancellable *cancellable, GError **
|
|||
}
|
||||
}
|
||||
|
||||
arg_context = xdg_app_context_new ();
|
||||
g_option_context_add_group (context, xdg_app_context_get_options (arg_context));
|
||||
arg_context = flatpak_context_new ();
|
||||
g_option_context_add_group (context, flatpak_context_get_options (arg_context));
|
||||
|
||||
if (!xdg_app_option_context_parse (context, options, &argc, &argv, XDG_APP_BUILTIN_FLAG_NO_DIR, NULL, cancellable, error))
|
||||
if (!flatpak_option_context_parse (context, options, &argc, &argv, FLATPAK_BUILTIN_FLAG_NO_DIR, NULL, cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
if (rest_argc == 0)
|
||||
|
@ -99,32 +99,32 @@ xdg_app_builtin_run (int argc, char **argv, GCancellable *cancellable, GError **
|
|||
|
||||
if (opt_branch == NULL && opt_arch == NULL)
|
||||
{
|
||||
g_autoptr(XdgAppDir) user_dir = xdg_app_dir_get_user ();
|
||||
g_autoptr(XdgAppDir) system_dir = xdg_app_dir_get_system ();
|
||||
g_autoptr(FlatpakDir) user_dir = flatpak_dir_get_user ();
|
||||
g_autoptr(FlatpakDir) system_dir = flatpak_dir_get_system ();
|
||||
|
||||
app_ref = xdg_app_dir_current_ref (user_dir, app, cancellable);
|
||||
app_ref = flatpak_dir_current_ref (user_dir, app, cancellable);
|
||||
if (app_ref == NULL)
|
||||
app_ref = xdg_app_dir_current_ref (system_dir, app, cancellable);
|
||||
app_ref = flatpak_dir_current_ref (system_dir, app, cancellable);
|
||||
}
|
||||
|
||||
if (app_ref == NULL)
|
||||
{
|
||||
app_ref = xdg_app_compose_ref (TRUE, app, branch, opt_arch, error);
|
||||
app_ref = flatpak_compose_ref (TRUE, app, branch, opt_arch, error);
|
||||
if (app_ref == NULL)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
app_deploy = xdg_app_find_deploy_for_ref (app_ref, cancellable, error);
|
||||
app_deploy = flatpak_find_deploy_for_ref (app_ref, cancellable, error);
|
||||
if (app_deploy == NULL)
|
||||
return FALSE;
|
||||
|
||||
if (!xdg_app_run_app (app_ref, app_deploy,
|
||||
if (!flatpak_run_app (app_ref, app_deploy,
|
||||
arg_context,
|
||||
opt_runtime,
|
||||
opt_runtime_version,
|
||||
(opt_devel ? XDG_APP_RUN_FLAG_DEVEL : 0) |
|
||||
(opt_log_session_bus ? XDG_APP_RUN_FLAG_LOG_SESSION_BUS : 0) |
|
||||
(opt_log_system_bus ? XDG_APP_RUN_FLAG_LOG_SYSTEM_BUS : 0),
|
||||
(opt_devel ? FLATPAK_RUN_FLAG_DEVEL : 0) |
|
||||
(opt_log_session_bus ? FLATPAK_RUN_FLAG_LOG_SESSION_BUS : 0) |
|
||||
(opt_log_system_bus ? FLATPAK_RUN_FLAG_LOG_SYSTEM_BUS : 0),
|
||||
opt_command,
|
||||
&argv[rest_argv_start + 1],
|
||||
rest_argc - 1,
|
||||
|
|
|
@ -47,10 +47,10 @@ static GOptionEntry options[] = {
|
|||
};
|
||||
|
||||
gboolean
|
||||
xdg_app_builtin_uninstall (int argc, char **argv, GCancellable *cancellable, GError **error)
|
||||
flatpak_builtin_uninstall (int argc, char **argv, GCancellable *cancellable, GError **error)
|
||||
{
|
||||
g_autoptr(GOptionContext) context = NULL;
|
||||
g_autoptr(XdgAppDir) dir = NULL;
|
||||
g_autoptr(FlatpakDir) dir = NULL;
|
||||
const char *name = NULL;
|
||||
const char *branch = NULL;
|
||||
g_autofree char *ref = NULL;
|
||||
|
@ -62,7 +62,7 @@ xdg_app_builtin_uninstall (int argc, char **argv, GCancellable *cancellable, GEr
|
|||
|
||||
context = g_option_context_new ("APP [BRANCH] - Uninstall an application");
|
||||
|
||||
if (!xdg_app_option_context_parse (context, options, &argc, &argv, 0, &dir, cancellable, error))
|
||||
if (!flatpak_option_context_parse (context, options, &argc, &argv, 0, &dir, cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
if (argc < 2)
|
||||
|
@ -75,7 +75,7 @@ xdg_app_builtin_uninstall (int argc, char **argv, GCancellable *cancellable, GEr
|
|||
if (!opt_app && !opt_runtime)
|
||||
opt_app = opt_runtime = TRUE;
|
||||
|
||||
ref = xdg_app_dir_find_installed_ref (dir,
|
||||
ref = flatpak_dir_find_installed_ref (dir,
|
||||
name,
|
||||
branch,
|
||||
opt_arch,
|
||||
|
@ -86,33 +86,33 @@ xdg_app_builtin_uninstall (int argc, char **argv, GCancellable *cancellable, GEr
|
|||
|
||||
/* TODO: when removing runtimes, look for apps that use it, require --force */
|
||||
|
||||
if (!xdg_app_dir_lock (dir, &lock,
|
||||
if (!flatpak_dir_lock (dir, &lock,
|
||||
cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
repository = xdg_app_dir_get_origin (dir, ref, cancellable, NULL);
|
||||
repository = flatpak_dir_get_origin (dir, ref, cancellable, NULL);
|
||||
|
||||
g_debug ("dropping active ref");
|
||||
if (!xdg_app_dir_set_active (dir, ref, NULL, cancellable, error))
|
||||
if (!flatpak_dir_set_active (dir, ref, NULL, cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
if (is_app)
|
||||
{
|
||||
current_ref = xdg_app_dir_current_ref (dir, name, cancellable);
|
||||
current_ref = flatpak_dir_current_ref (dir, name, cancellable);
|
||||
if (current_ref != NULL && strcmp (ref, current_ref) == 0)
|
||||
{
|
||||
g_debug ("dropping current ref");
|
||||
if (!xdg_app_dir_drop_current_ref (dir, name, cancellable, error))
|
||||
if (!flatpak_dir_drop_current_ref (dir, name, cancellable, error))
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (!xdg_app_dir_undeploy_all (dir, ref, opt_force_remove, &was_deployed, cancellable, error))
|
||||
if (!flatpak_dir_undeploy_all (dir, ref, opt_force_remove, &was_deployed, cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
if (!opt_keep_ref)
|
||||
{
|
||||
if (!xdg_app_dir_remove_ref (dir, repository, ref, cancellable, error))
|
||||
if (!flatpak_dir_remove_ref (dir, repository, ref, cancellable, error))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -120,28 +120,28 @@ xdg_app_builtin_uninstall (int argc, char **argv, GCancellable *cancellable, GEr
|
|||
|
||||
if (!opt_keep_ref)
|
||||
{
|
||||
if (!xdg_app_dir_prune (dir, cancellable, error))
|
||||
if (!flatpak_dir_prune (dir, cancellable, error))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
xdg_app_dir_cleanup_removed (dir, cancellable, NULL);
|
||||
flatpak_dir_cleanup_removed (dir, cancellable, NULL);
|
||||
|
||||
if (is_app)
|
||||
{
|
||||
if (!xdg_app_dir_update_exports (dir, name, cancellable, error))
|
||||
if (!flatpak_dir_update_exports (dir, name, cancellable, error))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (repository != NULL &&
|
||||
g_str_has_suffix (repository, "-origin") &&
|
||||
xdg_app_dir_get_remote_noenumerate (dir, repository))
|
||||
ostree_repo_remote_delete (xdg_app_dir_get_repo (dir), repository, NULL, NULL);
|
||||
flatpak_dir_get_remote_noenumerate (dir, repository))
|
||||
ostree_repo_remote_delete (flatpak_dir_get_repo (dir), repository, NULL, NULL);
|
||||
|
||||
if (!xdg_app_dir_mark_changed (dir, error))
|
||||
if (!flatpak_dir_mark_changed (dir, error))
|
||||
return FALSE;
|
||||
|
||||
if (!was_deployed)
|
||||
return xdg_app_fail (error, "Nothing to uninstall");
|
||||
return flatpak_fail (error, "Nothing to uninstall");
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -55,11 +55,11 @@ static GOptionEntry options[] = {
|
|||
};
|
||||
|
||||
static gboolean
|
||||
update_appstream (XdgAppDir *dir, const char *remote, GCancellable *cancellable, GError **error)
|
||||
update_appstream (FlatpakDir *dir, const char *remote, GCancellable *cancellable, GError **error)
|
||||
{
|
||||
gboolean changed;
|
||||
|
||||
if (!xdg_app_dir_update_appstream (dir, remote, opt_arch, &changed,
|
||||
if (!flatpak_dir_update_appstream (dir, remote, opt_arch, &changed,
|
||||
NULL, cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
|
@ -67,7 +67,7 @@ update_appstream (XdgAppDir *dir, const char *remote, GCancellable *cancellable,
|
|||
}
|
||||
|
||||
static gboolean
|
||||
do_update (XdgAppDir * dir,
|
||||
do_update (FlatpakDir * dir,
|
||||
const char *name,
|
||||
const char *branch,
|
||||
const char *arch,
|
||||
|
@ -82,7 +82,7 @@ do_update (XdgAppDir * dir,
|
|||
g_auto(GStrv) subpaths = NULL;
|
||||
gboolean is_app;
|
||||
|
||||
ref = xdg_app_dir_find_installed_ref (dir,
|
||||
ref = flatpak_dir_find_installed_ref (dir,
|
||||
name,
|
||||
branch,
|
||||
arch,
|
||||
|
@ -91,18 +91,18 @@ do_update (XdgAppDir * dir,
|
|||
if (ref == NULL)
|
||||
return FALSE;
|
||||
|
||||
repository = xdg_app_dir_get_origin (dir, ref, cancellable, error);
|
||||
repository = flatpak_dir_get_origin (dir, ref, cancellable, error);
|
||||
if (repository == NULL)
|
||||
return FALSE;
|
||||
|
||||
if (xdg_app_dir_get_remote_disabled (dir, repository))
|
||||
if (flatpak_dir_get_remote_disabled (dir, repository))
|
||||
g_print ("Not updating %s due to disabled remote %s\n", ref, repository);
|
||||
|
||||
subpaths = xdg_app_dir_get_subpaths (dir, ref, cancellable, error);
|
||||
subpaths = flatpak_dir_get_subpaths (dir, ref, cancellable, error);
|
||||
if (subpaths == NULL)
|
||||
return FALSE;
|
||||
|
||||
if (!xdg_app_dir_update (dir,
|
||||
if (!flatpak_dir_update (dir,
|
||||
opt_no_pull,
|
||||
opt_no_deploy,
|
||||
ref, repository, opt_commit, opt_subpaths,
|
||||
|
@ -114,13 +114,13 @@ do_update (XdgAppDir * dir,
|
|||
}
|
||||
|
||||
gboolean
|
||||
xdg_app_builtin_update (int argc,
|
||||
flatpak_builtin_update (int argc,
|
||||
char **argv,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
g_autoptr(GOptionContext) context = NULL;
|
||||
g_autoptr(XdgAppDir) dir = NULL;
|
||||
g_autoptr(FlatpakDir) dir = NULL;
|
||||
const char *name = NULL;
|
||||
const char *branch = NULL;
|
||||
const char *arch = opt_arch;
|
||||
|
@ -128,7 +128,7 @@ xdg_app_builtin_update (int argc,
|
|||
|
||||
context = g_option_context_new ("[NAME [BRANCH]] - Update an application or runtime");
|
||||
|
||||
if (!xdg_app_option_context_parse (context, options, &argc, &argv, 0, &dir, cancellable, error))
|
||||
if (!flatpak_option_context_parse (context, options, &argc, &argv, 0, &dir, cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
if (argc < 1)
|
||||
|
@ -140,7 +140,7 @@ xdg_app_builtin_update (int argc,
|
|||
branch = argv[2];
|
||||
|
||||
if (arch == NULL)
|
||||
arch = xdg_app_get_arch ();
|
||||
arch = flatpak_get_arch ();
|
||||
|
||||
if (!opt_app && !opt_runtime)
|
||||
opt_app = opt_runtime = TRUE;
|
||||
|
@ -154,14 +154,14 @@ xdg_app_builtin_update (int argc,
|
|||
{
|
||||
g_auto(GStrv) refs = NULL;
|
||||
|
||||
if (!xdg_app_dir_list_refs (dir, "app", &refs,
|
||||
if (!flatpak_dir_list_refs (dir, "app", &refs,
|
||||
cancellable,
|
||||
error))
|
||||
return FALSE;
|
||||
|
||||
for (i = 0; refs != NULL && refs[i] != NULL; i++)
|
||||
{
|
||||
g_auto(GStrv) parts = xdg_app_decompose_ref (refs[i], error);
|
||||
g_auto(GStrv) parts = flatpak_decompose_ref (refs[i], error);
|
||||
if (parts == NULL)
|
||||
return FALSE;
|
||||
|
||||
|
@ -188,14 +188,14 @@ xdg_app_builtin_update (int argc,
|
|||
{
|
||||
g_auto(GStrv) refs = NULL;
|
||||
|
||||
if (!xdg_app_dir_list_refs (dir, "runtime", &refs,
|
||||
if (!flatpak_dir_list_refs (dir, "runtime", &refs,
|
||||
cancellable,
|
||||
error))
|
||||
return FALSE;
|
||||
|
||||
for (i = 0; refs != NULL && refs[i] != NULL; i++)
|
||||
{
|
||||
g_auto(GStrv) parts = xdg_app_decompose_ref (refs[i], error);
|
||||
g_auto(GStrv) parts = flatpak_decompose_ref (refs[i], error);
|
||||
if (parts == NULL)
|
||||
return FALSE;
|
||||
|
||||
|
@ -230,7 +230,7 @@ xdg_app_builtin_update (int argc,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
xdg_app_dir_cleanup_removed (dir, cancellable, NULL);
|
||||
flatpak_dir_cleanup_removed (dir, cancellable, NULL);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -18,8 +18,8 @@
|
|||
* Alexander Larsson <alexl@redhat.com>
|
||||
*/
|
||||
|
||||
#ifndef __XDG_APP_BUILTINS_H__
|
||||
#define __XDG_APP_BUILTINS_H__
|
||||
#ifndef __FLATPAK_BUILTINS_H__
|
||||
#define __FLATPAK_BUILTINS_H__
|
||||
|
||||
#include <ostree.h>
|
||||
#include <gio/gio.h>
|
||||
|
@ -29,16 +29,16 @@
|
|||
G_BEGIN_DECLS
|
||||
|
||||
typedef enum {
|
||||
XDG_APP_BUILTIN_FLAG_NO_DIR = 1 << 0,
|
||||
XDG_APP_BUILTIN_FLAG_NO_REPO = 1 << 1,
|
||||
} XdgAppBuiltinFlags;
|
||||
FLATPAK_BUILTIN_FLAG_NO_DIR = 1 << 0,
|
||||
FLATPAK_BUILTIN_FLAG_NO_REPO = 1 << 1,
|
||||
} FlatpakBuiltinFlags;
|
||||
|
||||
gboolean xdg_app_option_context_parse (GOptionContext *context,
|
||||
gboolean flatpak_option_context_parse (GOptionContext *context,
|
||||
const GOptionEntry *main_entries,
|
||||
int *argc,
|
||||
char ***argv,
|
||||
XdgAppBuiltinFlags flags,
|
||||
XdgAppDir **out_dir,
|
||||
FlatpakBuiltinFlags flags,
|
||||
FlatpakDir **out_dir,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
|
||||
|
@ -46,7 +46,7 @@ gboolean usage_error (GOptionContext *context,
|
|||
const char *message,
|
||||
GError **error);
|
||||
|
||||
#define BUILTINPROTO(name) gboolean xdg_app_builtin_ ## name (int argc, char **argv, GCancellable * cancellable, GError * *error)
|
||||
#define BUILTINPROTO(name) gboolean flatpak_builtin_ ## name (int argc, char **argv, GCancellable * cancellable, GError * *error)
|
||||
|
||||
BUILTINPROTO (add_remote);
|
||||
BUILTINPROTO (modify_remote);
|
||||
|
@ -77,4 +77,4 @@ BUILTINPROTO (override);
|
|||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __XDG_APP_BUILTINS_H__ */
|
||||
#endif /* __FLATPAK_BUILTINS_H__ */
|
||||
|
|
|
@ -46,39 +46,39 @@ typedef struct
|
|||
GError **error);
|
||||
const char *description;
|
||||
gboolean deprecated;
|
||||
} XdgAppCommand;
|
||||
} FlatpakCommand;
|
||||
|
||||
static XdgAppCommand commands[] = {
|
||||
static FlatpakCommand commands[] = {
|
||||
{ " Manage installed apps and runtimes" },
|
||||
{ "install", xdg_app_builtin_install, "Install an application or runtime from a remote"},
|
||||
{ "update", xdg_app_builtin_update, "Update an installed application or runtime"},
|
||||
{ "uninstall", xdg_app_builtin_uninstall, "Uninstall an installed application or runtime" },
|
||||
{ "list", xdg_app_builtin_list, "List installed apps and/or runtimes" },
|
||||
{ "info", xdg_app_builtin_info, "Show info for installed app or runtime" },
|
||||
{ "install", flatpak_builtin_install, "Install an application or runtime from a remote"},
|
||||
{ "update", flatpak_builtin_update, "Update an installed application or runtime"},
|
||||
{ "uninstall", flatpak_builtin_uninstall, "Uninstall an installed application or runtime" },
|
||||
{ "list", flatpak_builtin_list, "List installed apps and/or runtimes" },
|
||||
{ "info", flatpak_builtin_info, "Show info for installed app or runtime" },
|
||||
|
||||
{ "\n Running applications" },
|
||||
{ "run", xdg_app_builtin_run, "Run an application" },
|
||||
{ "override", xdg_app_builtin_override, "Override permissions for an application" },
|
||||
{ "export-file", xdg_app_builtin_export_file, "Grant an application access to a specific file" },
|
||||
{ "make-current", xdg_app_builtin_make_current_app, "Specify default version to run" },
|
||||
{ "enter", xdg_app_builtin_enter, "Enter the namespace of a running application" },
|
||||
{ "run", flatpak_builtin_run, "Run an application" },
|
||||
{ "override", flatpak_builtin_override, "Override permissions for an application" },
|
||||
{ "export-file", flatpak_builtin_export_file, "Grant an application access to a specific file" },
|
||||
{ "make-current", flatpak_builtin_make_current_app, "Specify default version to run" },
|
||||
{ "enter", flatpak_builtin_enter, "Enter the namespace of a running application" },
|
||||
|
||||
{ "\n Manage remote repositories" },
|
||||
{ "remote-add", xdg_app_builtin_add_remote, "Add a new remote repository (by URL)" },
|
||||
{ "remote-modify", xdg_app_builtin_modify_remote, "Modify properties of a configured remote" },
|
||||
{ "remote-delete", xdg_app_builtin_delete_remote, "Delete a configured remote" },
|
||||
{ "remote-list", xdg_app_builtin_list_remotes, "List all configured remotes" },
|
||||
{ "remote-ls", xdg_app_builtin_ls_remote, "List contents of a configured remote" },
|
||||
{ "remote-add", flatpak_builtin_add_remote, "Add a new remote repository (by URL)" },
|
||||
{ "remote-modify", flatpak_builtin_modify_remote, "Modify properties of a configured remote" },
|
||||
{ "remote-delete", flatpak_builtin_delete_remote, "Delete a configured remote" },
|
||||
{ "remote-list", flatpak_builtin_list_remotes, "List all configured remotes" },
|
||||
{ "remote-ls", flatpak_builtin_ls_remote, "List contents of a configured remote" },
|
||||
|
||||
{ "\n Build applications" },
|
||||
{ "build-init", xdg_app_builtin_build_init, "Initialize a directory for building" },
|
||||
{ "build", xdg_app_builtin_build, "Run a build command inside the build dir" },
|
||||
{ "build-finish", xdg_app_builtin_build_finish, "Finish a build dir for export" },
|
||||
{ "build-export", xdg_app_builtin_build_export, "Export a build dir to a repository" },
|
||||
{ "build-bundle", xdg_app_builtin_build_bundle, "Create a bundle file from a build directory" },
|
||||
{ "build-import-bundle", xdg_app_builtin_build_import, "Import a bundle file" },
|
||||
{ "build-sign", xdg_app_builtin_build_sign, "Sign an application or runtime" },
|
||||
{ "build-update-repo", xdg_app_builtin_build_update_repo, "Update the summary file in a repository" },
|
||||
{ "build-init", flatpak_builtin_build_init, "Initialize a directory for building" },
|
||||
{ "build", flatpak_builtin_build, "Run a build command inside the build dir" },
|
||||
{ "build-finish", flatpak_builtin_build_finish, "Finish a build dir for export" },
|
||||
{ "build-export", flatpak_builtin_build_export, "Export a build dir to a repository" },
|
||||
{ "build-bundle", flatpak_builtin_build_bundle, "Create a bundle file from a build directory" },
|
||||
{ "build-import-bundle", flatpak_builtin_build_import, "Import a bundle file" },
|
||||
{ "build-sign", flatpak_builtin_build_sign, "Sign an application or runtime" },
|
||||
{ "build-update-repo", flatpak_builtin_build_update_repo, "Update the summary file in a repository" },
|
||||
|
||||
{ NULL }
|
||||
};
|
||||
|
@ -110,7 +110,7 @@ message_handler (const gchar *log_domain,
|
|||
}
|
||||
|
||||
GOptionContext *
|
||||
xdg_app_option_context_new_with_commands (XdgAppCommand *commands)
|
||||
flatpak_option_context_new_with_commands (FlatpakCommand *commands)
|
||||
{
|
||||
GOptionContext *context;
|
||||
GString *summary;
|
||||
|
@ -145,13 +145,13 @@ xdg_app_option_context_new_with_commands (XdgAppCommand *commands)
|
|||
}
|
||||
|
||||
int
|
||||
xdg_app_usage (XdgAppCommand *commands,
|
||||
gboolean is_error)
|
||||
flatpak_usage (FlatpakCommand *commands,
|
||||
gboolean is_error)
|
||||
{
|
||||
GOptionContext *context;
|
||||
g_autofree char *help;
|
||||
|
||||
context = xdg_app_option_context_new_with_commands (commands);
|
||||
context = flatpak_option_context_new_with_commands (commands);
|
||||
|
||||
g_option_context_add_main_entries (context, global_entries, NULL);
|
||||
|
||||
|
@ -168,18 +168,18 @@ xdg_app_usage (XdgAppCommand *commands,
|
|||
}
|
||||
|
||||
gboolean
|
||||
xdg_app_option_context_parse (GOptionContext *context,
|
||||
flatpak_option_context_parse (GOptionContext *context,
|
||||
const GOptionEntry *main_entries,
|
||||
int *argc,
|
||||
char ***argv,
|
||||
XdgAppBuiltinFlags flags,
|
||||
XdgAppDir **out_dir,
|
||||
FlatpakBuiltinFlags flags,
|
||||
FlatpakDir **out_dir,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
g_autoptr(XdgAppDir) dir = NULL;
|
||||
g_autoptr(FlatpakDir) dir = NULL;
|
||||
|
||||
if (!(flags & XDG_APP_BUILTIN_FLAG_NO_DIR))
|
||||
if (!(flags & FLATPAK_BUILTIN_FLAG_NO_DIR))
|
||||
g_option_context_add_main_entries (context, user_entries, NULL);
|
||||
|
||||
if (main_entries != NULL)
|
||||
|
@ -198,19 +198,19 @@ xdg_app_option_context_parse (GOptionContext *context,
|
|||
|
||||
if (opt_default_arch)
|
||||
{
|
||||
g_print ("%s\n", xdg_app_get_arch ());
|
||||
g_print ("%s\n", flatpak_get_arch ());
|
||||
exit (EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
if (!(flags & XDG_APP_BUILTIN_FLAG_NO_DIR))
|
||||
if (!(flags & FLATPAK_BUILTIN_FLAG_NO_DIR))
|
||||
{
|
||||
dir = xdg_app_dir_get (opt_user);
|
||||
dir = flatpak_dir_get (opt_user);
|
||||
|
||||
if (!xdg_app_dir_ensure_path (dir, cancellable, error))
|
||||
if (!flatpak_dir_ensure_path (dir, cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
if (!(flags & XDG_APP_BUILTIN_FLAG_NO_REPO) &&
|
||||
!xdg_app_dir_ensure_repo (dir, cancellable, error))
|
||||
if (!(flags & FLATPAK_BUILTIN_FLAG_NO_REPO) &&
|
||||
!flatpak_dir_ensure_repo (dir, cancellable, error))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -234,11 +234,11 @@ usage_error (GOptionContext *context, const char *message, GError **error)
|
|||
}
|
||||
|
||||
int
|
||||
xdg_app_run (int argc,
|
||||
flatpak_run (int argc,
|
||||
char **argv,
|
||||
GError **res_error)
|
||||
{
|
||||
XdgAppCommand *command;
|
||||
FlatpakCommand *command;
|
||||
GError *error = NULL;
|
||||
GCancellable *cancellable = NULL;
|
||||
const char *command_name = NULL;
|
||||
|
@ -283,10 +283,10 @@ xdg_app_run (int argc,
|
|||
GOptionContext *context;
|
||||
g_autofree char *help;
|
||||
|
||||
context = xdg_app_option_context_new_with_commands (commands);
|
||||
context = flatpak_option_context_new_with_commands (commands);
|
||||
|
||||
/* This will not return for some options (e.g. --version). */
|
||||
if (xdg_app_option_context_parse (context, NULL, &argc, &argv, XDG_APP_BUILTIN_FLAG_NO_DIR, NULL, cancellable, &error))
|
||||
if (flatpak_option_context_parse (context, NULL, &argc, &argv, FLATPAK_BUILTIN_FLAG_NO_DIR, NULL, cancellable, &error))
|
||||
{
|
||||
if (command_name == NULL)
|
||||
g_set_error_literal (&error, G_IO_ERROR, G_IO_ERROR_FAILED,
|
||||
|
@ -345,9 +345,9 @@ main (int argc,
|
|||
else
|
||||
g_unsetenv ("GIO_USE_VFS");
|
||||
|
||||
ret = xdg_app_run (argc, argv, &error);
|
||||
ret = flatpak_run (argc, argv, &error);
|
||||
if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED))
|
||||
xdg_app_usage (commands, TRUE);
|
||||
flatpak_usage (commands, TRUE);
|
||||
|
||||
if (error != NULL)
|
||||
{
|
||||
|
|
|
@ -248,7 +248,7 @@ const char *
|
|||
builder_context_get_arch (BuilderContext *self)
|
||||
{
|
||||
if (self->arch == NULL)
|
||||
self->arch = g_strdup (xdg_app_get_arch ());
|
||||
self->arch = g_strdup (flatpak_get_arch ());
|
||||
|
||||
return (const char *) self->arch;
|
||||
}
|
||||
|
|
|
@ -826,7 +826,7 @@ xdg_app (GError **error,
|
|||
va_list ap;
|
||||
|
||||
va_start (ap, error);
|
||||
res = xdg_app_spawn (NULL, &output, error, "xdg-app", ap);
|
||||
res = flatpak_spawn (NULL, &output, error, "xdg-app", ap);
|
||||
va_end (ap);
|
||||
|
||||
if (res)
|
||||
|
@ -849,14 +849,14 @@ builder_manifest_start (BuilderManifest *self,
|
|||
self->sdk_commit = xdg_app (NULL, "info", arch_option, "--show-commit", self->sdk,
|
||||
builder_manifest_get_runtime_version (self), NULL);
|
||||
if (self->sdk_commit == NULL)
|
||||
return xdg_app_fail (error, "Unable to find sdk %s version %s",
|
||||
return flatpak_fail (error, "Unable to find sdk %s version %s",
|
||||
self->sdk,
|
||||
builder_manifest_get_runtime_version (self));
|
||||
|
||||
self->runtime_commit = xdg_app (NULL, "info", arch_option, "--show-commit", self->runtime,
|
||||
builder_manifest_get_runtime_version (self), NULL);
|
||||
if (self->runtime_commit == NULL)
|
||||
return xdg_app_fail (error, "Unable to find runtime %s version %s",
|
||||
return flatpak_fail (error, "Unable to find runtime %s version %s",
|
||||
self->runtime,
|
||||
builder_manifest_get_runtime_version (self));
|
||||
|
||||
|
|
|
@ -563,7 +563,7 @@ build (GFile *app_dir,
|
|||
BuilderContext *context,
|
||||
GFile *source_dir,
|
||||
const char *cwd_subdir,
|
||||
char **xdg_app_opts,
|
||||
char **flatpak_opts,
|
||||
char **env_vars,
|
||||
GError **error,
|
||||
const gchar *argv1,
|
||||
|
@ -608,10 +608,10 @@ build (GFile *app_dir,
|
|||
g_ptr_array_add (args, g_strdup_printf ("--bind-mount=/run/ccache=%s", ccache_dir_path));
|
||||
}
|
||||
|
||||
if (xdg_app_opts)
|
||||
if (flatpak_opts)
|
||||
{
|
||||
for (i = 0; xdg_app_opts[i] != NULL; i++)
|
||||
g_ptr_array_add (args, g_strdup (xdg_app_opts[i]));
|
||||
for (i = 0; flatpak_opts[i] != NULL; i++)
|
||||
g_ptr_array_add (args, g_strdup (flatpak_opts[i]));
|
||||
}
|
||||
|
||||
if (env_vars)
|
||||
|
@ -681,7 +681,7 @@ builder_module_handle_debuginfo (BuilderModule *self,
|
|||
for (i = 0; i < modified->len; i++)
|
||||
g_ptr_array_add (added_or_modified, g_ptr_array_index (modified, i));
|
||||
|
||||
g_ptr_array_sort (added_or_modified, xdg_app_strcmp0_ptr);
|
||||
g_ptr_array_sort (added_or_modified, flatpak_strcmp0_ptr);
|
||||
|
||||
for (i = 0; i < added_or_modified->len; i++)
|
||||
{
|
||||
|
@ -988,10 +988,10 @@ builder_module_build (BuilderModule *self,
|
|||
if (use_builddir)
|
||||
{
|
||||
if (source_subdir_relative)
|
||||
build_dir_relative = g_build_filename (source_subdir_relative, "_xdg_app_build", NULL);
|
||||
build_dir_relative = g_build_filename (source_subdir_relative, "_flatpak_build", NULL);
|
||||
else
|
||||
build_dir_relative = g_strdup ("_xdg_app_build");
|
||||
build_dir = g_file_get_child (source_subdir, "_xdg_app_build");
|
||||
build_dir_relative = g_strdup ("_flatpak_build");
|
||||
build_dir = g_file_get_child (source_subdir, "_flatpak_build");
|
||||
|
||||
if (!g_file_make_directory (build_dir, NULL, error))
|
||||
return FALSE;
|
||||
|
@ -1198,7 +1198,7 @@ collect_cleanup_for_path (const char **patterns,
|
|||
return;
|
||||
|
||||
for (i = 0; patterns[i] != NULL; i++)
|
||||
xdg_app_collect_matches_for_path_pattern (path, patterns[i], add_prefix, to_remove_ht);
|
||||
flatpak_collect_matches_for_path_pattern (path, patterns[i], add_prefix, to_remove_ht);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@ -1212,7 +1212,7 @@ matches_cleanup_for_path (const char **patterns,
|
|||
|
||||
for (i = 0; patterns[i] != NULL; i++)
|
||||
{
|
||||
if (xdg_app_matches_path_pattern (path, patterns[i]))
|
||||
if (flatpak_matches_path_pattern (path, patterns[i]))
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -388,7 +388,7 @@ tar (GFile *dir,
|
|||
va_list ap;
|
||||
|
||||
va_start (ap, error);
|
||||
res = xdg_app_spawn (dir, NULL, error, "tar", ap);
|
||||
res = flatpak_spawn (dir, NULL, error, "tar", ap);
|
||||
va_end (ap);
|
||||
|
||||
return res;
|
||||
|
@ -403,7 +403,7 @@ unzip (GFile *dir,
|
|||
va_list ap;
|
||||
|
||||
va_start (ap, error);
|
||||
res = xdg_app_spawn (dir, NULL, error, "unzip", ap);
|
||||
res = flatpak_spawn (dir, NULL, error, "unzip", ap);
|
||||
va_end (ap);
|
||||
|
||||
return res;
|
||||
|
|
|
@ -124,7 +124,7 @@ bzr (GFile *dir,
|
|||
va_list ap;
|
||||
|
||||
va_start (ap, error);
|
||||
res = xdg_app_spawn (dir, output, error, "bzr", ap);
|
||||
res = flatpak_spawn (dir, output, error, "bzr", ap);
|
||||
va_end (ap);
|
||||
|
||||
return res;
|
||||
|
|
|
@ -132,7 +132,7 @@ git (GFile *dir,
|
|||
va_list ap;
|
||||
|
||||
va_start (ap, error);
|
||||
res = xdg_app_spawn (dir, output, error, "git", ap);
|
||||
res = flatpak_spawn (dir, output, error, "git", ap);
|
||||
va_end (ap);
|
||||
|
||||
return res;
|
||||
|
|
|
@ -157,7 +157,7 @@ patch (GFile *dir,
|
|||
va_list ap;
|
||||
|
||||
va_start (ap, error);
|
||||
res = xdg_app_spawn (dir, NULL, error, "patch", ap);
|
||||
res = flatpak_spawn (dir, NULL, error, "patch", ap);
|
||||
va_end (ap);
|
||||
|
||||
return res;
|
||||
|
|
|
@ -77,7 +77,7 @@ inplace_basename (const char *path)
|
|||
* path, otherwise just the basename.
|
||||
*/
|
||||
void
|
||||
xdg_app_collect_matches_for_path_pattern (const char *path,
|
||||
flatpak_collect_matches_for_path_pattern (const char *path,
|
||||
const char *pattern,
|
||||
const char *add_prefix,
|
||||
GHashTable *to_remove_ht)
|
||||
|
@ -86,7 +86,7 @@ xdg_app_collect_matches_for_path_pattern (const char *path,
|
|||
|
||||
if (pattern[0] != '/')
|
||||
{
|
||||
rest = xdg_app_path_match_prefix (pattern, inplace_basename (path));
|
||||
rest = flatpak_path_match_prefix (pattern, inplace_basename (path));
|
||||
if (rest != NULL)
|
||||
g_hash_table_insert (to_remove_ht, g_strconcat (add_prefix ? add_prefix : "", path, NULL), GINT_TO_POINTER (1));
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ xdg_app_collect_matches_for_path_pattern (const char *path,
|
|||
* files, as a prefix match should remove all files below that
|
||||
* (in this module) */
|
||||
|
||||
rest = xdg_app_path_match_prefix (pattern, path);
|
||||
rest = flatpak_path_match_prefix (pattern, path);
|
||||
while (rest != NULL)
|
||||
{
|
||||
const char *slash;
|
||||
|
@ -115,13 +115,13 @@ xdg_app_collect_matches_for_path_pattern (const char *path,
|
|||
}
|
||||
|
||||
gboolean
|
||||
xdg_app_matches_path_pattern (const char *path,
|
||||
flatpak_matches_path_pattern (const char *path,
|
||||
const char *pattern)
|
||||
{
|
||||
if (pattern[0] != '/')
|
||||
path = inplace_basename (path);
|
||||
|
||||
return xdg_app_path_match_prefix (pattern, path) != NULL;
|
||||
return flatpak_path_match_prefix (pattern, path) != NULL;
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
@ -132,7 +132,7 @@ strip (GError **error,
|
|||
va_list ap;
|
||||
|
||||
va_start (ap, error);
|
||||
res = xdg_app_spawn (NULL, NULL, error, "strip", ap);
|
||||
res = flatpak_spawn (NULL, NULL, error, "strip", ap);
|
||||
va_end (ap);
|
||||
|
||||
return res;
|
||||
|
@ -146,7 +146,7 @@ eu_strip (GError **error,
|
|||
va_list ap;
|
||||
|
||||
va_start (ap, error);
|
||||
res = xdg_app_spawn (NULL, NULL, error, "eu-strip", ap);
|
||||
res = flatpak_spawn (NULL, NULL, error, "eu-strip", ap);
|
||||
va_end (ap);
|
||||
|
||||
return res;
|
||||
|
@ -296,8 +296,8 @@ migrate_locale_dir (GFile *source_dir,
|
|||
NULL, error))
|
||||
return FALSE;
|
||||
|
||||
if (!xdg_app_cp_a (child, locale_subdir,
|
||||
XDG_APP_CP_FLAGS_MERGE | XDG_APP_CP_FLAGS_MOVE,
|
||||
if (!flatpak_cp_a (child, locale_subdir,
|
||||
FLATPAK_CP_FLAGS_MERGE | FLATPAK_CP_FLAGS_MOVE,
|
||||
NULL, error))
|
||||
return FALSE;
|
||||
|
||||
|
@ -676,19 +676,19 @@ handle_dwarf2_line (DebuginfoData *data, uint32_t off, char *comp_dir, GHashTabl
|
|||
endcu = ptr + 4;
|
||||
endcu += read_32 (ptr);
|
||||
if (endcu == ptr + 0xffffffff)
|
||||
return xdg_app_fail (error, "%s: 64-bit DWARF not supported", data->filename);
|
||||
return flatpak_fail (error, "%s: 64-bit DWARF not supported", data->filename);
|
||||
|
||||
if (endcu > endsec)
|
||||
return xdg_app_fail (error, "%s: .debug_line CU does not fit into section", data->filename);
|
||||
return flatpak_fail (error, "%s: .debug_line CU does not fit into section", data->filename);
|
||||
|
||||
value = read_16 (ptr);
|
||||
if (value != 2 && value != 3 && value != 4)
|
||||
return xdg_app_fail (error, "%s: DWARF version %d unhandled", data->filename, value);
|
||||
return flatpak_fail (error, "%s: DWARF version %d unhandled", data->filename, value);
|
||||
|
||||
endprol = ptr + 4;
|
||||
endprol += read_32 (ptr);
|
||||
if (endprol > endcu)
|
||||
return xdg_app_fail (error, "%s: .debug_line CU prologue does not fit into CU", data->filename);
|
||||
return flatpak_fail (error, "%s: .debug_line CU prologue does not fit into CU", data->filename);
|
||||
|
||||
opcode_base = ptr[4 + (value >= 4)];
|
||||
ptr = dir = ptr + 4 + (value >= 4) + opcode_base;
|
||||
|
@ -723,7 +723,7 @@ handle_dwarf2_line (DebuginfoData *data, uint32_t off, char *comp_dir, GHashTabl
|
|||
value = read_uleb128 (ptr);
|
||||
|
||||
if (value >= dirt_cnt)
|
||||
return xdg_app_fail (error, "%s: Wrong directory table index %u", data->filename, value);
|
||||
return flatpak_fail (error, "%s: Wrong directory table index %u", data->filename, value);
|
||||
|
||||
file_len = strlen (file);
|
||||
dir_len = strlen ((char *) dirt[value]);
|
||||
|
@ -978,7 +978,7 @@ handle_dwarf2_section (DebuginfoData *data, GHashTable *files, GError **error)
|
|||
}
|
||||
else
|
||||
{
|
||||
return xdg_app_fail (0, 0, "%s: Wrong ELF data enconding", data->filename);
|
||||
return flatpak_fail (0, 0, "%s: Wrong ELF data enconding", data->filename);
|
||||
}
|
||||
|
||||
debug_sections = data->debug_sections;
|
||||
|
@ -1098,7 +1098,7 @@ handle_dwarf2_section (DebuginfoData *data, GHashTable *files, GError **error)
|
|||
|
||||
default:
|
||||
fail:
|
||||
return xdg_app_fail (error, "%s: Unhandled relocation %d in .debug_info section",
|
||||
return flatpak_fail (error, "%s: Unhandled relocation %d in .debug_info section",
|
||||
data->filename, rtype);
|
||||
}
|
||||
relend->ptr = debug_sections[DEBUG_INFO].data
|
||||
|
@ -1126,38 +1126,38 @@ fail:
|
|||
g_autoptr(GHashTable) abbrev = NULL;
|
||||
|
||||
if (ptr + 11 > endsec)
|
||||
return xdg_app_fail (error, "%s: .debug_info CU header too small", data->filename);
|
||||
return flatpak_fail (error, "%s: .debug_info CU header too small", data->filename);
|
||||
|
||||
endcu = ptr + 4;
|
||||
endcu += read_32 (ptr);
|
||||
if (endcu == ptr + 0xffffffff)
|
||||
return xdg_app_fail (error, "%s: 64-bit DWARF not supported", data->filename);
|
||||
return flatpak_fail (error, "%s: 64-bit DWARF not supported", data->filename);
|
||||
|
||||
if (endcu > endsec)
|
||||
return xdg_app_fail (error, "%s: .debug_info too small", data->filename);
|
||||
return flatpak_fail (error, "%s: .debug_info too small", data->filename);
|
||||
|
||||
cu_version = read_16 (ptr);
|
||||
if (cu_version != 2 && cu_version != 3 && cu_version != 4)
|
||||
return xdg_app_fail (error, "%s: DWARF version %d unhandled", data->filename, cu_version);
|
||||
return flatpak_fail (error, "%s: DWARF version %d unhandled", data->filename, cu_version);
|
||||
|
||||
value = read_32_relocated (ptr);
|
||||
if (value >= debug_sections[DEBUG_ABBREV].size)
|
||||
{
|
||||
if (debug_sections[DEBUG_ABBREV].data == NULL)
|
||||
return xdg_app_fail (error, "%s: .debug_abbrev not present", data->filename);
|
||||
return flatpak_fail (error, "%s: .debug_abbrev not present", data->filename);
|
||||
else
|
||||
return xdg_app_fail (error, "%s: DWARF CU abbrev offset too large", data->filename);
|
||||
return flatpak_fail (error, "%s: DWARF CU abbrev offset too large", data->filename);
|
||||
}
|
||||
|
||||
if (ptr_size == 0)
|
||||
{
|
||||
ptr_size = read_1 (ptr);
|
||||
if (ptr_size != 4 && ptr_size != 8)
|
||||
return xdg_app_fail (error, "%s: Invalid DWARF pointer size %d", data->filename, ptr_size);
|
||||
return flatpak_fail (error, "%s: Invalid DWARF pointer size %d", data->filename, ptr_size);
|
||||
}
|
||||
else if (read_1 (ptr) != ptr_size)
|
||||
{
|
||||
return xdg_app_fail (error, "%s: DWARF pointer size differs between CUs", data->filename);
|
||||
return flatpak_fail (error, "%s: DWARF pointer size differs between CUs", data->filename);
|
||||
}
|
||||
|
||||
abbrev = read_abbrev (data,
|
||||
|
@ -1233,25 +1233,25 @@ builder_get_debuginfo_file_references (const char *filename, GError **error)
|
|||
elf = elf_begin (fd, ELF_C_RDWR_MMAP, NULL);
|
||||
if (elf == NULL)
|
||||
{
|
||||
xdg_app_fail (error, "cannot open ELF file: %s", elf_errmsg (-1));
|
||||
flatpak_fail (error, "cannot open ELF file: %s", elf_errmsg (-1));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (elf_kind (elf) != ELF_K_ELF)
|
||||
{
|
||||
xdg_app_fail (error, "\"%s\" is not an ELF file", filename);
|
||||
flatpak_fail (error, "\"%s\" is not an ELF file", filename);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (gelf_getehdr (elf, &ehdr) == NULL)
|
||||
{
|
||||
xdg_app_fail (error, "cannot get the ELF header: %s", elf_errmsg (-1));
|
||||
flatpak_fail (error, "cannot get the ELF header: %s", elf_errmsg (-1));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (ehdr.e_type != ET_DYN && ehdr.e_type != ET_EXEC && ehdr.e_type != ET_REL)
|
||||
{
|
||||
xdg_app_fail (error, "\"%s\" is not a shared library", filename);
|
||||
flatpak_fail (error, "\"%s\" is not a shared library", filename);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -44,9 +44,9 @@ char ** builder_get_debuginfo_file_references (const char *filename,
|
|||
|
||||
gboolean directory_is_empty (const char *path);
|
||||
|
||||
gboolean xdg_app_matches_path_pattern (const char *path,
|
||||
gboolean flatpak_matches_path_pattern (const char *path,
|
||||
const char *pattern);
|
||||
void xdg_app_collect_matches_for_path_pattern (const char *path,
|
||||
void flatpak_collect_matches_for_path_pattern (const char *path,
|
||||
const char *pattern,
|
||||
const char *add_prefix,
|
||||
GHashTable *to_remove_ht);
|
||||
|
|
|
@ -27,49 +27,49 @@ enum {
|
|||
PROP_STREAMS
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (XdgAppChainInputStream, xdg_app_chain_input_stream, G_TYPE_INPUT_STREAM)
|
||||
G_DEFINE_TYPE (FlatpakChainInputStream, flatpak_chain_input_stream, G_TYPE_INPUT_STREAM)
|
||||
|
||||
struct _XdgAppChainInputStreamPrivate
|
||||
struct _FlatpakChainInputStreamPrivate
|
||||
{
|
||||
GPtrArray *streams;
|
||||
guint index;
|
||||
};
|
||||
|
||||
static void xdg_app_chain_input_stream_set_property (GObject *object,
|
||||
static void flatpak_chain_input_stream_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void xdg_app_chain_input_stream_get_property (GObject *object,
|
||||
static void flatpak_chain_input_stream_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void xdg_app_chain_input_stream_finalize (GObject *object);
|
||||
static gssize xdg_app_chain_input_stream_read (GInputStream *stream,
|
||||
static void flatpak_chain_input_stream_finalize (GObject *object);
|
||||
static gssize flatpak_chain_input_stream_read (GInputStream *stream,
|
||||
void *buffer,
|
||||
gsize count,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
static gboolean xdg_app_chain_input_stream_close (GInputStream *stream,
|
||||
static gboolean flatpak_chain_input_stream_close (GInputStream *stream,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
|
||||
static void
|
||||
xdg_app_chain_input_stream_class_init (XdgAppChainInputStreamClass *klass)
|
||||
flatpak_chain_input_stream_class_init (FlatpakChainInputStreamClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
GInputStreamClass *stream_class = G_INPUT_STREAM_CLASS (klass);
|
||||
|
||||
g_type_class_add_private (klass, sizeof (XdgAppChainInputStreamPrivate));
|
||||
g_type_class_add_private (klass, sizeof (FlatpakChainInputStreamPrivate));
|
||||
|
||||
gobject_class->get_property = xdg_app_chain_input_stream_get_property;
|
||||
gobject_class->set_property = xdg_app_chain_input_stream_set_property;
|
||||
gobject_class->finalize = xdg_app_chain_input_stream_finalize;
|
||||
gobject_class->get_property = flatpak_chain_input_stream_get_property;
|
||||
gobject_class->set_property = flatpak_chain_input_stream_set_property;
|
||||
gobject_class->finalize = flatpak_chain_input_stream_finalize;
|
||||
|
||||
stream_class->read_fn = xdg_app_chain_input_stream_read;
|
||||
stream_class->close_fn = xdg_app_chain_input_stream_close;
|
||||
stream_class->read_fn = flatpak_chain_input_stream_read;
|
||||
stream_class->close_fn = flatpak_chain_input_stream_close;
|
||||
|
||||
/*
|
||||
* XdgAppChainInputStream:streams: (element-type GInputStream)
|
||||
* FlatpakChainInputStream:streams: (element-type GInputStream)
|
||||
*
|
||||
* Chain of input streams read in order.
|
||||
*/
|
||||
|
@ -84,14 +84,14 @@ xdg_app_chain_input_stream_class_init (XdgAppChainInputStreamClass *klass)
|
|||
}
|
||||
|
||||
static void
|
||||
xdg_app_chain_input_stream_set_property (GObject *object,
|
||||
flatpak_chain_input_stream_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
XdgAppChainInputStream *self;
|
||||
FlatpakChainInputStream *self;
|
||||
|
||||
self = XDG_APP_CHAIN_INPUT_STREAM (object);
|
||||
self = FLATPAK_CHAIN_INPUT_STREAM (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
|
@ -106,14 +106,14 @@ xdg_app_chain_input_stream_set_property (GObject *object,
|
|||
}
|
||||
|
||||
static void
|
||||
xdg_app_chain_input_stream_get_property (GObject *object,
|
||||
flatpak_chain_input_stream_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
XdgAppChainInputStream *self;
|
||||
FlatpakChainInputStream *self;
|
||||
|
||||
self = XDG_APP_CHAIN_INPUT_STREAM (object);
|
||||
self = FLATPAK_CHAIN_INPUT_STREAM (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
|
@ -127,46 +127,46 @@ xdg_app_chain_input_stream_get_property (GObject *object,
|
|||
}
|
||||
|
||||
static void
|
||||
xdg_app_chain_input_stream_finalize (GObject *object)
|
||||
flatpak_chain_input_stream_finalize (GObject *object)
|
||||
{
|
||||
XdgAppChainInputStream *stream;
|
||||
FlatpakChainInputStream *stream;
|
||||
|
||||
stream = (XdgAppChainInputStream *) (object);
|
||||
stream = (FlatpakChainInputStream *) (object);
|
||||
|
||||
g_ptr_array_unref (stream->priv->streams);
|
||||
|
||||
G_OBJECT_CLASS (xdg_app_chain_input_stream_parent_class)->finalize (object);
|
||||
G_OBJECT_CLASS (flatpak_chain_input_stream_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
xdg_app_chain_input_stream_init (XdgAppChainInputStream *self)
|
||||
flatpak_chain_input_stream_init (FlatpakChainInputStream *self)
|
||||
{
|
||||
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
|
||||
XDG_APP_TYPE_CHAIN_INPUT_STREAM,
|
||||
XdgAppChainInputStreamPrivate);
|
||||
FLATPAK_TYPE_CHAIN_INPUT_STREAM,
|
||||
FlatpakChainInputStreamPrivate);
|
||||
|
||||
}
|
||||
|
||||
XdgAppChainInputStream *
|
||||
xdg_app_chain_input_stream_new (GPtrArray *streams)
|
||||
FlatpakChainInputStream *
|
||||
flatpak_chain_input_stream_new (GPtrArray *streams)
|
||||
{
|
||||
XdgAppChainInputStream *stream;
|
||||
FlatpakChainInputStream *stream;
|
||||
|
||||
stream = g_object_new (XDG_APP_TYPE_CHAIN_INPUT_STREAM,
|
||||
stream = g_object_new (FLATPAK_TYPE_CHAIN_INPUT_STREAM,
|
||||
"streams", streams,
|
||||
NULL);
|
||||
|
||||
return (XdgAppChainInputStream *) (stream);
|
||||
return (FlatpakChainInputStream *) (stream);
|
||||
}
|
||||
|
||||
static gssize
|
||||
xdg_app_chain_input_stream_read (GInputStream *stream,
|
||||
flatpak_chain_input_stream_read (GInputStream *stream,
|
||||
void *buffer,
|
||||
gsize count,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
XdgAppChainInputStream *self = (XdgAppChainInputStream *) stream;
|
||||
FlatpakChainInputStream *self = (FlatpakChainInputStream *) stream;
|
||||
GInputStream *child;
|
||||
gssize res = -1;
|
||||
|
||||
|
@ -193,12 +193,12 @@ xdg_app_chain_input_stream_read (GInputStream *stream,
|
|||
}
|
||||
|
||||
static gboolean
|
||||
xdg_app_chain_input_stream_close (GInputStream *stream,
|
||||
flatpak_chain_input_stream_close (GInputStream *stream,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
XdgAppChainInputStream *self = (gpointer) stream;
|
||||
FlatpakChainInputStream *self = (gpointer) stream;
|
||||
guint i;
|
||||
|
||||
for (i = 0; i < self->priv->streams->len; i++)
|
||||
|
|
|
@ -27,26 +27,26 @@
|
|||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define XDG_APP_TYPE_CHAIN_INPUT_STREAM (xdg_app_chain_input_stream_get_type ())
|
||||
#define XDG_APP_CHAIN_INPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), XDG_APP_TYPE_CHAIN_INPUT_STREAM, XdgAppChainInputStream))
|
||||
#define XDG_APP_CHAIN_INPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), XDG_APP_TYPE_CHAIN_INPUT_STREAM, XdgAppChainInputStreamClass))
|
||||
#define XDG_APP_IS_CHAIN_INPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), XDG_APP_TYPE_CHAIN_INPUT_STREAM))
|
||||
#define XDG_APP_IS_CHAIN_INPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), XDG_APP_TYPE_CHAIN_INPUT_STREAM))
|
||||
#define XDG_APP_CHAIN_INPUT_STREAM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), XDG_APP_TYPE_CHAIN_INPUT_STREAM, XdgAppChainInputStreamClass))
|
||||
#define FLATPAK_TYPE_CHAIN_INPUT_STREAM (flatpak_chain_input_stream_get_type ())
|
||||
#define FLATPAK_CHAIN_INPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), FLATPAK_TYPE_CHAIN_INPUT_STREAM, FlatpakChainInputStream))
|
||||
#define FLATPAK_CHAIN_INPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), FLATPAK_TYPE_CHAIN_INPUT_STREAM, FlatpakChainInputStreamClass))
|
||||
#define FLATPAK_IS_CHAIN_INPUT_STREAM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), FLATPAK_TYPE_CHAIN_INPUT_STREAM))
|
||||
#define FLATPAK_IS_CHAIN_INPUT_STREAM_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), FLATPAK_TYPE_CHAIN_INPUT_STREAM))
|
||||
#define FLATPAK_CHAIN_INPUT_STREAM_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), FLATPAK_TYPE_CHAIN_INPUT_STREAM, FlatpakChainInputStreamClass))
|
||||
|
||||
typedef struct _XdgAppChainInputStream XdgAppChainInputStream;
|
||||
typedef struct _XdgAppChainInputStreamClass XdgAppChainInputStreamClass;
|
||||
typedef struct _XdgAppChainInputStreamPrivate XdgAppChainInputStreamPrivate;
|
||||
typedef struct _FlatpakChainInputStream FlatpakChainInputStream;
|
||||
typedef struct _FlatpakChainInputStreamClass FlatpakChainInputStreamClass;
|
||||
typedef struct _FlatpakChainInputStreamPrivate FlatpakChainInputStreamPrivate;
|
||||
|
||||
struct _XdgAppChainInputStream
|
||||
struct _FlatpakChainInputStream
|
||||
{
|
||||
GInputStream parent_instance;
|
||||
|
||||
/*< private >*/
|
||||
XdgAppChainInputStreamPrivate *priv;
|
||||
FlatpakChainInputStreamPrivate *priv;
|
||||
};
|
||||
|
||||
struct _XdgAppChainInputStreamClass
|
||||
struct _FlatpakChainInputStreamClass
|
||||
{
|
||||
GInputStreamClass parent_class;
|
||||
|
||||
|
@ -59,9 +59,9 @@ struct _XdgAppChainInputStreamClass
|
|||
void (*_g_reserved5) (void);
|
||||
};
|
||||
|
||||
GType xdg_app_chain_input_stream_get_type (void) G_GNUC_CONST;
|
||||
GType flatpak_chain_input_stream_get_type (void) G_GNUC_CONST;
|
||||
|
||||
XdgAppChainInputStream * xdg_app_chain_input_stream_new (GPtrArray *streams);
|
||||
FlatpakChainInputStream * flatpak_chain_input_stream_new (GPtrArray *streams);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
|
@ -18,11 +18,11 @@
|
|||
* Alexander Larsson <alexl@redhat.com>
|
||||
*/
|
||||
|
||||
#ifndef __XDG_APP_COMMON_TYPES_H__
|
||||
#define __XDG_APP_COMMON_TYPES_H__
|
||||
#ifndef __FLATPAK_COMMON_TYPES_H__
|
||||
#define __FLATPAK_COMMON_TYPES_H__
|
||||
|
||||
typedef struct XdgAppDir XdgAppDir;
|
||||
typedef struct XdgAppDeploy XdgAppDeploy;
|
||||
typedef struct XdgAppContext XdgAppContext;
|
||||
typedef struct FlatpakDir FlatpakDir;
|
||||
typedef struct FlatpakDeploy FlatpakDeploy;
|
||||
typedef struct FlatpakContext FlatpakContext;
|
||||
|
||||
#endif /* __XDG_APP_COMMON_TYPES_H__ */
|
||||
#endif /* __FLATPAK_COMMON_TYPES_H__ */
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#include "gvdb/gvdb-reader.h"
|
||||
#include "gvdb/gvdb-builder.h"
|
||||
|
||||
struct XdgAppDb
|
||||
struct FlatpakDb
|
||||
{
|
||||
GObject parent;
|
||||
|
||||
|
@ -55,11 +55,11 @@ struct XdgAppDb
|
|||
typedef struct
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
} XdgAppDbClass;
|
||||
} FlatpakDbClass;
|
||||
|
||||
static void initable_iface_init (GInitableIface *initable_iface);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (XdgAppDb, xdg_app_db, G_TYPE_OBJECT,
|
||||
G_DEFINE_TYPE_WITH_CODE (FlatpakDb, flatpak_db, G_TYPE_OBJECT,
|
||||
G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE, initable_iface_init));
|
||||
|
||||
enum {
|
||||
|
@ -102,29 +102,29 @@ str_ptr_array_contains (GPtrArray *array,
|
|||
}
|
||||
|
||||
const char *
|
||||
xdg_app_db_get_path (XdgAppDb *self)
|
||||
flatpak_db_get_path (FlatpakDb *self)
|
||||
{
|
||||
g_return_val_if_fail (XDG_APP_IS_DB (self), NULL);
|
||||
g_return_val_if_fail (FLATPAK_IS_DB (self), NULL);
|
||||
|
||||
return self->path;
|
||||
}
|
||||
|
||||
void
|
||||
xdg_app_db_set_path (XdgAppDb *self,
|
||||
flatpak_db_set_path (FlatpakDb *self,
|
||||
const char *path)
|
||||
{
|
||||
g_return_if_fail (XDG_APP_IS_DB (self));
|
||||
g_return_if_fail (FLATPAK_IS_DB (self));
|
||||
|
||||
g_clear_pointer (&self->path, g_free);
|
||||
self->path = g_strdup (path);
|
||||
}
|
||||
|
||||
XdgAppDb *
|
||||
xdg_app_db_new (const char *path,
|
||||
FlatpakDb *
|
||||
flatpak_db_new (const char *path,
|
||||
gboolean fail_if_not_found,
|
||||
GError **error)
|
||||
{
|
||||
return g_initable_new (XDG_APP_TYPE_DB,
|
||||
return g_initable_new (FLATPAK_TYPE_DB,
|
||||
NULL,
|
||||
error,
|
||||
"path", path,
|
||||
|
@ -133,9 +133,9 @@ xdg_app_db_new (const char *path,
|
|||
}
|
||||
|
||||
static void
|
||||
xdg_app_db_finalize (GObject *object)
|
||||
flatpak_db_finalize (GObject *object)
|
||||
{
|
||||
XdgAppDb *self = (XdgAppDb *) object;
|
||||
FlatpakDb *self = (FlatpakDb *) object;
|
||||
|
||||
g_clear_pointer (&self->path, g_free);
|
||||
g_clear_pointer (&self->gvdb_contents, g_bytes_unref);
|
||||
|
@ -146,16 +146,16 @@ xdg_app_db_finalize (GObject *object)
|
|||
g_clear_pointer (&self->app_additions, g_hash_table_unref);
|
||||
g_clear_pointer (&self->app_removals, g_hash_table_unref);
|
||||
|
||||
G_OBJECT_CLASS (xdg_app_db_parent_class)->finalize (object);
|
||||
G_OBJECT_CLASS (flatpak_db_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
xdg_app_db_get_property (GObject *object,
|
||||
flatpak_db_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
XdgAppDb *self = XDG_APP_DB (object);
|
||||
FlatpakDb *self = FLATPAK_DB (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
|
@ -173,12 +173,12 @@ xdg_app_db_get_property (GObject *object,
|
|||
}
|
||||
|
||||
static void
|
||||
xdg_app_db_set_property (GObject *object,
|
||||
flatpak_db_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
XdgAppDb *self = XDG_APP_DB (object);
|
||||
FlatpakDb *self = FLATPAK_DB (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
|
@ -197,13 +197,13 @@ xdg_app_db_set_property (GObject *object,
|
|||
}
|
||||
|
||||
static void
|
||||
xdg_app_db_class_init (XdgAppDbClass *klass)
|
||||
flatpak_db_class_init (FlatpakDbClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->finalize = xdg_app_db_finalize;
|
||||
object_class->get_property = xdg_app_db_get_property;
|
||||
object_class->set_property = xdg_app_db_set_property;
|
||||
object_class->finalize = flatpak_db_finalize;
|
||||
object_class->get_property = flatpak_db_get_property;
|
||||
object_class->set_property = flatpak_db_set_property;
|
||||
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_PATH,
|
||||
|
@ -222,7 +222,7 @@ xdg_app_db_class_init (XdgAppDbClass *klass)
|
|||
}
|
||||
|
||||
static void
|
||||
xdg_app_db_init (XdgAppDb *self)
|
||||
flatpak_db_init (FlatpakDb *self)
|
||||
{
|
||||
self->fail_if_not_found = TRUE;
|
||||
|
||||
|
@ -258,7 +258,7 @@ initable_init (GInitable *initable,
|
|||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
XdgAppDb *self = (XdgAppDb *) initable;
|
||||
FlatpakDb *self = (FlatpakDb *) initable;
|
||||
GError *my_error = NULL;
|
||||
|
||||
if (self->path == NULL)
|
||||
|
@ -332,14 +332,14 @@ initable_iface_init (GInitableIface *initable_iface)
|
|||
|
||||
/* Transfer: full */
|
||||
char **
|
||||
xdg_app_db_list_ids (XdgAppDb *self)
|
||||
flatpak_db_list_ids (FlatpakDb *self)
|
||||
{
|
||||
GPtrArray *res;
|
||||
GHashTableIter iter;
|
||||
gpointer key, value;
|
||||
int i;
|
||||
|
||||
g_return_val_if_fail (XDG_APP_IS_DB (self), NULL);
|
||||
g_return_val_if_fail (FLATPAK_IS_DB (self), NULL);
|
||||
|
||||
res = g_ptr_array_new ();
|
||||
|
||||
|
@ -384,14 +384,14 @@ app_update_empty (GHashTable *ht, const char *app)
|
|||
|
||||
/* Transfer: full */
|
||||
char **
|
||||
xdg_app_db_list_apps (XdgAppDb *self)
|
||||
flatpak_db_list_apps (FlatpakDb *self)
|
||||
{
|
||||
gpointer key, _value;
|
||||
GHashTableIter iter;
|
||||
GPtrArray *res;
|
||||
int i;
|
||||
|
||||
g_return_val_if_fail (XDG_APP_IS_DB (self), NULL);
|
||||
g_return_val_if_fail (FLATPAK_IS_DB (self), NULL);
|
||||
|
||||
res = g_ptr_array_new ();
|
||||
|
||||
|
@ -454,7 +454,7 @@ xdg_app_db_list_apps (XdgAppDb *self)
|
|||
|
||||
/* Transfer: full */
|
||||
char **
|
||||
xdg_app_db_list_ids_by_app (XdgAppDb *self,
|
||||
flatpak_db_list_ids_by_app (FlatpakDb *self,
|
||||
const char *app)
|
||||
{
|
||||
GPtrArray *res;
|
||||
|
@ -462,7 +462,7 @@ xdg_app_db_list_ids_by_app (XdgAppDb *self,
|
|||
GPtrArray *removals;
|
||||
int i;
|
||||
|
||||
g_return_val_if_fail (XDG_APP_IS_DB (self), NULL);
|
||||
g_return_val_if_fail (FLATPAK_IS_DB (self), NULL);
|
||||
|
||||
res = g_ptr_array_new ();
|
||||
|
||||
|
@ -497,14 +497,14 @@ xdg_app_db_list_ids_by_app (XdgAppDb *self,
|
|||
}
|
||||
|
||||
/* Transfer: full */
|
||||
XdgAppDbEntry *
|
||||
xdg_app_db_lookup (XdgAppDb *self,
|
||||
FlatpakDbEntry *
|
||||
flatpak_db_lookup (FlatpakDb *self,
|
||||
const char *id)
|
||||
{
|
||||
GVariant *res = NULL;
|
||||
gpointer value;
|
||||
|
||||
g_return_val_if_fail (XDG_APP_IS_DB (self), NULL);
|
||||
g_return_val_if_fail (FLATPAK_IS_DB (self), NULL);
|
||||
g_return_val_if_fail (id != NULL, NULL);
|
||||
|
||||
if (g_hash_table_lookup_extended (self->main_updates, id, NULL, &value))
|
||||
|
@ -517,19 +517,19 @@ xdg_app_db_lookup (XdgAppDb *self,
|
|||
res = gvdb_table_get_value (self->main_table, id);
|
||||
}
|
||||
|
||||
return (XdgAppDbEntry *) res;
|
||||
return (FlatpakDbEntry *) res;
|
||||
}
|
||||
|
||||
/* Transfer: full */
|
||||
char **
|
||||
xdg_app_db_list_ids_by_value (XdgAppDb *self,
|
||||
GVariant *data)
|
||||
flatpak_db_list_ids_by_value (FlatpakDb *self,
|
||||
GVariant *data)
|
||||
{
|
||||
g_autofree char **ids = xdg_app_db_list_ids (self);
|
||||
g_autofree char **ids = flatpak_db_list_ids (self);
|
||||
int i;
|
||||
GPtrArray *res;
|
||||
|
||||
g_return_val_if_fail (XDG_APP_IS_DB (self), NULL);
|
||||
g_return_val_if_fail (FLATPAK_IS_DB (self), NULL);
|
||||
g_return_val_if_fail (data != NULL, NULL);
|
||||
|
||||
res = g_ptr_array_new ();
|
||||
|
@ -538,13 +538,13 @@ xdg_app_db_list_ids_by_value (XdgAppDb *self,
|
|||
{
|
||||
char *id = ids[i];
|
||||
|
||||
g_autoptr(XdgAppDbEntry) entry = NULL;
|
||||
g_autoptr(FlatpakDbEntry) entry = NULL;
|
||||
g_autoptr(GVariant) entry_data = NULL;
|
||||
|
||||
entry = xdg_app_db_lookup (self, id);
|
||||
entry = flatpak_db_lookup (self, id);
|
||||
if (entry)
|
||||
{
|
||||
entry_data = xdg_app_db_entry_get_data (entry);
|
||||
entry_data = flatpak_db_entry_get_data (entry);
|
||||
if (g_variant_equal (data, entry_data))
|
||||
{
|
||||
g_ptr_array_add (res, id);
|
||||
|
@ -559,7 +559,7 @@ xdg_app_db_list_ids_by_value (XdgAppDb *self,
|
|||
}
|
||||
|
||||
static void
|
||||
add_app_id (XdgAppDb *self,
|
||||
add_app_id (FlatpakDb *self,
|
||||
const char *app,
|
||||
const char *id)
|
||||
{
|
||||
|
@ -592,7 +592,7 @@ add_app_id (XdgAppDb *self,
|
|||
}
|
||||
|
||||
static void
|
||||
remove_app_id (XdgAppDb *self,
|
||||
remove_app_id (FlatpakDb *self,
|
||||
const char *app,
|
||||
const char *id)
|
||||
{
|
||||
|
@ -625,50 +625,50 @@ remove_app_id (XdgAppDb *self,
|
|||
}
|
||||
|
||||
gboolean
|
||||
xdg_app_db_is_dirty (XdgAppDb *self)
|
||||
flatpak_db_is_dirty (FlatpakDb *self)
|
||||
{
|
||||
g_return_val_if_fail (XDG_APP_IS_DB (self), FALSE);
|
||||
g_return_val_if_fail (FLATPAK_IS_DB (self), FALSE);
|
||||
|
||||
return self->dirty;
|
||||
}
|
||||
|
||||
/* add, replace, or NULL entry to remove */
|
||||
void
|
||||
xdg_app_db_set_entry (XdgAppDb *self,
|
||||
const char *id,
|
||||
XdgAppDbEntry *entry)
|
||||
flatpak_db_set_entry (FlatpakDb *self,
|
||||
const char *id,
|
||||
FlatpakDbEntry *entry)
|
||||
{
|
||||
g_autoptr(XdgAppDbEntry) old_entry = NULL;
|
||||
g_autoptr(FlatpakDbEntry) old_entry = NULL;
|
||||
g_autofree const char **old = NULL;
|
||||
g_autofree const char **new = NULL;
|
||||
static const char *empty[] = { NULL };
|
||||
const char **a, **b;
|
||||
int ia, ib;
|
||||
|
||||
g_return_if_fail (XDG_APP_IS_DB (self));
|
||||
g_return_if_fail (FLATPAK_IS_DB (self));
|
||||
g_return_if_fail (id != NULL);
|
||||
|
||||
self->dirty = TRUE;
|
||||
|
||||
old_entry = xdg_app_db_lookup (self, id);
|
||||
old_entry = flatpak_db_lookup (self, id);
|
||||
|
||||
g_hash_table_insert (self->main_updates,
|
||||
g_strdup (id),
|
||||
xdg_app_db_entry_ref (entry));
|
||||
flatpak_db_entry_ref (entry));
|
||||
|
||||
a = empty;
|
||||
b = empty;
|
||||
|
||||
if (old_entry)
|
||||
{
|
||||
old = xdg_app_db_entry_list_apps (old_entry);
|
||||
old = flatpak_db_entry_list_apps (old_entry);
|
||||
sort_strv (old);
|
||||
a = old;
|
||||
}
|
||||
|
||||
if (entry)
|
||||
{
|
||||
new = xdg_app_db_entry_list_apps (entry);
|
||||
new = flatpak_db_entry_list_apps (entry);
|
||||
sort_strv (new);
|
||||
b = new;
|
||||
}
|
||||
|
@ -716,7 +716,7 @@ xdg_app_db_set_entry (XdgAppDb *self,
|
|||
}
|
||||
|
||||
void
|
||||
xdg_app_db_update (XdgAppDb *self)
|
||||
flatpak_db_update (FlatpakDb *self)
|
||||
{
|
||||
GHashTable *root, *main_h, *apps_h;
|
||||
GBytes *new_contents;
|
||||
|
@ -726,7 +726,7 @@ xdg_app_db_update (XdgAppDb *self)
|
|||
g_auto(GStrv) ids = NULL;
|
||||
g_auto(GStrv) apps = NULL;
|
||||
|
||||
g_return_if_fail (XDG_APP_IS_DB (self));
|
||||
g_return_if_fail (FLATPAK_IS_DB (self));
|
||||
|
||||
root = gvdb_hash_table_new (NULL, NULL);
|
||||
main_h = gvdb_hash_table_new (root, "main");
|
||||
|
@ -734,10 +734,10 @@ xdg_app_db_update (XdgAppDb *self)
|
|||
g_hash_table_unref (main_h);
|
||||
g_hash_table_unref (apps_h);
|
||||
|
||||
ids = xdg_app_db_list_ids (self);
|
||||
ids = flatpak_db_list_ids (self);
|
||||
for (i = 0; ids[i] != 0; i++)
|
||||
{
|
||||
g_autoptr(XdgAppDbEntry) entry = xdg_app_db_lookup (self, ids[i]);
|
||||
g_autoptr(FlatpakDbEntry) entry = flatpak_db_lookup (self, ids[i]);
|
||||
if (entry != NULL)
|
||||
{
|
||||
GvdbItem *item;
|
||||
|
@ -747,10 +747,10 @@ xdg_app_db_update (XdgAppDb *self)
|
|||
}
|
||||
}
|
||||
|
||||
apps = xdg_app_db_list_apps (self);
|
||||
apps = flatpak_db_list_apps (self);
|
||||
for (i = 0; apps[i] != 0; i++)
|
||||
{
|
||||
g_auto(GStrv) app_ids = xdg_app_db_list_ids_by_app (self, apps[i]);
|
||||
g_auto(GStrv) app_ids = flatpak_db_list_ids_by_app (self, apps[i]);
|
||||
GVariantBuilder builder;
|
||||
GvdbItem *item;
|
||||
int j;
|
||||
|
@ -783,17 +783,17 @@ xdg_app_db_update (XdgAppDb *self)
|
|||
}
|
||||
|
||||
GBytes *
|
||||
xdg_app_db_get_content (XdgAppDb *self)
|
||||
flatpak_db_get_content (FlatpakDb *self)
|
||||
{
|
||||
g_return_val_if_fail (XDG_APP_IS_DB (self), NULL);
|
||||
g_return_val_if_fail (FLATPAK_IS_DB (self), NULL);
|
||||
|
||||
return self->gvdb_contents;
|
||||
}
|
||||
|
||||
/* Note: You must first call update to serialize, this only saves serialied data */
|
||||
gboolean
|
||||
xdg_app_db_save_content (XdgAppDb *self,
|
||||
GError **error)
|
||||
flatpak_db_save_content (FlatpakDb *self,
|
||||
GError **error)
|
||||
{
|
||||
GBytes *content = NULL;
|
||||
|
||||
|
@ -835,7 +835,7 @@ save_content_callback (GObject *source_object,
|
|||
}
|
||||
|
||||
void
|
||||
xdg_app_db_save_content_async (XdgAppDb *self,
|
||||
flatpak_db_save_content_async (FlatpakDb *self,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data)
|
||||
|
@ -873,7 +873,7 @@ xdg_app_db_save_content_async (XdgAppDb *self,
|
|||
}
|
||||
|
||||
gboolean
|
||||
xdg_app_db_save_content_finish (XdgAppDb *self,
|
||||
flatpak_db_save_content_finish (FlatpakDb *self,
|
||||
GAsyncResult *res,
|
||||
GError **error)
|
||||
{
|
||||
|
@ -882,41 +882,41 @@ xdg_app_db_save_content_finish (XdgAppDb *self,
|
|||
|
||||
|
||||
GString *
|
||||
xdg_app_db_print_string (XdgAppDb *self,
|
||||
GString *string)
|
||||
flatpak_db_print_string (FlatpakDb *self,
|
||||
GString *string)
|
||||
{
|
||||
g_auto(GStrv) ids = NULL;
|
||||
g_auto(GStrv) apps = NULL;
|
||||
int i;
|
||||
|
||||
g_return_val_if_fail (XDG_APP_IS_DB (self), NULL);
|
||||
g_return_val_if_fail (FLATPAK_IS_DB (self), NULL);
|
||||
|
||||
if G_UNLIKELY (string == NULL)
|
||||
string = g_string_new (NULL);
|
||||
|
||||
g_string_append_printf (string, "main {\n");
|
||||
|
||||
ids = xdg_app_db_list_ids (self);
|
||||
ids = flatpak_db_list_ids (self);
|
||||
sort_strv ((const char **) ids);
|
||||
for (i = 0; ids[i] != 0; i++)
|
||||
{
|
||||
g_autoptr(XdgAppDbEntry) entry = xdg_app_db_lookup (self, ids[i]);
|
||||
g_autoptr(FlatpakDbEntry) entry = flatpak_db_lookup (self, ids[i]);
|
||||
g_string_append_printf (string, " %s: ", ids[i]);
|
||||
if (entry != NULL)
|
||||
xdg_app_db_entry_print_string (entry, string);
|
||||
flatpak_db_entry_print_string (entry, string);
|
||||
g_string_append_printf (string, "\n");
|
||||
}
|
||||
|
||||
g_string_append_printf (string, "}\napps {\n");
|
||||
|
||||
apps = xdg_app_db_list_apps (self);
|
||||
apps = flatpak_db_list_apps (self);
|
||||
sort_strv ((const char **) apps);
|
||||
for (i = 0; apps[i] != 0; i++)
|
||||
{
|
||||
int j;
|
||||
g_auto(GStrv) app_ids = NULL;
|
||||
|
||||
app_ids = xdg_app_db_list_ids_by_app (self, apps[i]);
|
||||
app_ids = flatpak_db_list_ids_by_app (self, apps[i]);
|
||||
sort_strv ((const char **) app_ids);
|
||||
|
||||
g_string_append_printf (string, " %s: ", apps[i]);
|
||||
|
@ -931,13 +931,13 @@ xdg_app_db_print_string (XdgAppDb *self,
|
|||
}
|
||||
|
||||
char *
|
||||
xdg_app_db_print (XdgAppDb *self)
|
||||
flatpak_db_print (FlatpakDb *self)
|
||||
{
|
||||
return g_string_free (xdg_app_db_print_string (self, NULL), FALSE);
|
||||
return g_string_free (flatpak_db_print_string (self, NULL), FALSE);
|
||||
}
|
||||
|
||||
XdgAppDbEntry *
|
||||
xdg_app_db_entry_ref (XdgAppDbEntry *entry)
|
||||
FlatpakDbEntry *
|
||||
flatpak_db_entry_ref (FlatpakDbEntry *entry)
|
||||
{
|
||||
if (entry != NULL)
|
||||
g_variant_ref ((GVariant *) entry);
|
||||
|
@ -945,14 +945,14 @@ xdg_app_db_entry_ref (XdgAppDbEntry *entry)
|
|||
}
|
||||
|
||||
void
|
||||
xdg_app_db_entry_unref (XdgAppDbEntry *entry)
|
||||
flatpak_db_entry_unref (FlatpakDbEntry *entry)
|
||||
{
|
||||
g_variant_unref ((GVariant *) entry);
|
||||
}
|
||||
|
||||
/* Transfer: full */
|
||||
GVariant *
|
||||
xdg_app_db_entry_get_data (XdgAppDbEntry *entry)
|
||||
flatpak_db_entry_get_data (FlatpakDbEntry *entry)
|
||||
{
|
||||
g_autoptr(GVariant) variant = g_variant_get_child_value ((GVariant *) entry, 0);
|
||||
|
||||
|
@ -961,7 +961,7 @@ xdg_app_db_entry_get_data (XdgAppDbEntry *entry)
|
|||
|
||||
/* Transfer: container */
|
||||
const char **
|
||||
xdg_app_db_entry_list_apps (XdgAppDbEntry *entry)
|
||||
flatpak_db_entry_list_apps (FlatpakDbEntry *entry)
|
||||
{
|
||||
GVariant *v = (GVariant *) entry;
|
||||
|
||||
|
@ -994,8 +994,8 @@ xdg_app_db_entry_list_apps (XdgAppDbEntry *entry)
|
|||
}
|
||||
|
||||
static GVariant *
|
||||
xdg_app_db_entry_get_permissions_variant (XdgAppDbEntry *entry,
|
||||
const char *app_id)
|
||||
flatpak_db_entry_get_permissions_variant (FlatpakDbEntry *entry,
|
||||
const char *app_id)
|
||||
{
|
||||
GVariant *v = (GVariant *) entry;
|
||||
|
||||
|
@ -1041,12 +1041,12 @@ xdg_app_db_entry_get_permissions_variant (XdgAppDbEntry *entry,
|
|||
|
||||
/* Transfer: container */
|
||||
const char **
|
||||
xdg_app_db_entry_list_permissions (XdgAppDbEntry *entry,
|
||||
const char *app)
|
||||
flatpak_db_entry_list_permissions (FlatpakDbEntry *entry,
|
||||
const char *app)
|
||||
{
|
||||
g_autoptr(GVariant) permissions = NULL;
|
||||
|
||||
permissions = xdg_app_db_entry_get_permissions_variant (entry, app);
|
||||
permissions = flatpak_db_entry_get_permissions_variant (entry, app);
|
||||
if (permissions)
|
||||
return g_variant_get_strv (permissions, NULL);
|
||||
else
|
||||
|
@ -1054,26 +1054,26 @@ xdg_app_db_entry_list_permissions (XdgAppDbEntry *entry,
|
|||
}
|
||||
|
||||
gboolean
|
||||
xdg_app_db_entry_has_permission (XdgAppDbEntry *entry,
|
||||
const char *app,
|
||||
const char *permission)
|
||||
flatpak_db_entry_has_permission (FlatpakDbEntry *entry,
|
||||
const char *app,
|
||||
const char *permission)
|
||||
{
|
||||
g_autofree const char **app_permissions = NULL;
|
||||
|
||||
app_permissions = xdg_app_db_entry_list_permissions (entry, app);
|
||||
app_permissions = flatpak_db_entry_list_permissions (entry, app);
|
||||
|
||||
return g_strv_contains (app_permissions, permission);
|
||||
}
|
||||
|
||||
gboolean
|
||||
xdg_app_db_entry_has_permissions (XdgAppDbEntry *entry,
|
||||
const char *app,
|
||||
const char **permissions)
|
||||
flatpak_db_entry_has_permissions (FlatpakDbEntry *entry,
|
||||
const char *app,
|
||||
const char **permissions)
|
||||
{
|
||||
g_autofree const char **app_permissions = NULL;
|
||||
int i;
|
||||
|
||||
app_permissions = xdg_app_db_entry_list_permissions (entry, app);
|
||||
app_permissions = flatpak_db_entry_list_permissions (entry, app);
|
||||
|
||||
for (i = 0; permissions[i] != NULL; i++)
|
||||
{
|
||||
|
@ -1167,8 +1167,8 @@ add_permissions (GVariant *app_permissions,
|
|||
return g_variant_builder_end (&builder);
|
||||
}
|
||||
|
||||
XdgAppDbEntry *
|
||||
xdg_app_db_entry_new (GVariant *data)
|
||||
FlatpakDbEntry *
|
||||
flatpak_db_entry_new (GVariant *data)
|
||||
{
|
||||
GVariant *res;
|
||||
|
||||
|
@ -1178,12 +1178,12 @@ xdg_app_db_entry_new (GVariant *data)
|
|||
res = make_entry (data,
|
||||
make_empty_app_permissions ());
|
||||
|
||||
return (XdgAppDbEntry *) g_variant_ref_sink (res);
|
||||
return (FlatpakDbEntry *) g_variant_ref_sink (res);
|
||||
}
|
||||
|
||||
XdgAppDbEntry *
|
||||
xdg_app_db_entry_modify_data (XdgAppDbEntry *entry,
|
||||
GVariant *data)
|
||||
FlatpakDbEntry *
|
||||
flatpak_db_entry_modify_data (FlatpakDbEntry *entry,
|
||||
GVariant *data)
|
||||
{
|
||||
GVariant *v = (GVariant *) entry;
|
||||
GVariant *res;
|
||||
|
@ -1193,14 +1193,14 @@ xdg_app_db_entry_modify_data (XdgAppDbEntry *entry,
|
|||
|
||||
res = make_entry (data,
|
||||
g_variant_get_child_value (v, 1));
|
||||
return (XdgAppDbEntry *) g_variant_ref_sink (res);
|
||||
return (FlatpakDbEntry *) g_variant_ref_sink (res);
|
||||
}
|
||||
|
||||
/* NULL (or empty) permissions to remove permissions */
|
||||
XdgAppDbEntry *
|
||||
xdg_app_db_entry_set_app_permissions (XdgAppDbEntry *entry,
|
||||
const char *app,
|
||||
const char **permissions)
|
||||
FlatpakDbEntry *
|
||||
flatpak_db_entry_set_app_permissions (FlatpakDbEntry *entry,
|
||||
const char *app,
|
||||
const char **permissions)
|
||||
{
|
||||
GVariant *v = (GVariant *) entry;
|
||||
GVariant *res;
|
||||
|
@ -1213,12 +1213,12 @@ xdg_app_db_entry_set_app_permissions (XdgAppDbEntry *entry,
|
|||
add_permissions (old_permissions,
|
||||
make_permissions (app,
|
||||
permissions)));
|
||||
return (XdgAppDbEntry *) g_variant_ref_sink (res);
|
||||
return (FlatpakDbEntry *) g_variant_ref_sink (res);
|
||||
}
|
||||
|
||||
GString *
|
||||
xdg_app_db_entry_print_string (XdgAppDbEntry *entry,
|
||||
GString *string)
|
||||
flatpak_db_entry_print_string (FlatpakDbEntry *entry,
|
||||
GString *string)
|
||||
{
|
||||
return g_variant_print_string ((GVariant *) entry, string, FALSE);
|
||||
}
|
||||
|
|
|
@ -19,8 +19,8 @@
|
|||
* Alexander Larsson <alexl@redhat.com>
|
||||
*/
|
||||
|
||||
#ifndef XDG_APP_DB_H
|
||||
#define XDG_APP_DB_H
|
||||
#ifndef FLATPAK_DB_H
|
||||
#define FLATPAK_DB_H
|
||||
|
||||
#include <string.h>
|
||||
|
||||
|
@ -29,75 +29,75 @@
|
|||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef struct XdgAppDb XdgAppDb;
|
||||
typedef struct _XdgAppDbEntry XdgAppDbEntry;
|
||||
typedef struct FlatpakDb FlatpakDb;
|
||||
typedef struct _FlatpakDbEntry FlatpakDbEntry;
|
||||
|
||||
#define XDG_APP_TYPE_DB (xdg_app_db_get_type ())
|
||||
#define XDG_APP_DB(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), XDG_APP_TYPE_DB, XdgAppDb))
|
||||
#define XDG_APP_IS_DB(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), XDG_APP_TYPE_DB))
|
||||
#define FLATPAK_TYPE_DB (flatpak_db_get_type ())
|
||||
#define FLATPAK_DB(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FLATPAK_TYPE_DB, FlatpakDb))
|
||||
#define FLATPAK_IS_DB(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FLATPAK_TYPE_DB))
|
||||
|
||||
GType xdg_app_db_get_type (void);
|
||||
GType flatpak_db_get_type (void);
|
||||
|
||||
XdgAppDb * xdg_app_db_new (const char *path,
|
||||
gboolean fail_if_not_found,
|
||||
GError **error);
|
||||
char ** xdg_app_db_list_ids (XdgAppDb *self);
|
||||
char ** xdg_app_db_list_apps (XdgAppDb *self);
|
||||
char ** xdg_app_db_list_ids_by_app (XdgAppDb *self,
|
||||
FlatpakDb * flatpak_db_new (const char *path,
|
||||
gboolean fail_if_not_found,
|
||||
GError **error);
|
||||
char ** flatpak_db_list_ids (FlatpakDb *self);
|
||||
char ** flatpak_db_list_apps (FlatpakDb *self);
|
||||
char ** flatpak_db_list_ids_by_app (FlatpakDb *self,
|
||||
const char *app);
|
||||
char ** xdg_app_db_list_ids_by_value (XdgAppDb *self,
|
||||
GVariant *data);
|
||||
XdgAppDbEntry *xdg_app_db_lookup (XdgAppDb *self,
|
||||
const char *id);
|
||||
GString * xdg_app_db_print_string (XdgAppDb *self,
|
||||
GString *string);
|
||||
char * xdg_app_db_print (XdgAppDb *self);
|
||||
char ** flatpak_db_list_ids_by_value (FlatpakDb *self,
|
||||
GVariant *data);
|
||||
FlatpakDbEntry *flatpak_db_lookup (FlatpakDb *self,
|
||||
const char *id);
|
||||
GString * flatpak_db_print_string (FlatpakDb *self,
|
||||
GString *string);
|
||||
char * flatpak_db_print (FlatpakDb *self);
|
||||
|
||||
gboolean xdg_app_db_is_dirty (XdgAppDb *self);
|
||||
void xdg_app_db_set_entry (XdgAppDb *self,
|
||||
const char *id,
|
||||
XdgAppDbEntry *entry);
|
||||
void xdg_app_db_update (XdgAppDb *self);
|
||||
GBytes * xdg_app_db_get_content (XdgAppDb *self);
|
||||
const char * xdg_app_db_get_path (XdgAppDb *self);
|
||||
gboolean xdg_app_db_save_content (XdgAppDb *self,
|
||||
GError **error);
|
||||
void xdg_app_db_save_content_async (XdgAppDb *self,
|
||||
gboolean flatpak_db_is_dirty (FlatpakDb *self);
|
||||
void flatpak_db_set_entry (FlatpakDb *self,
|
||||
const char *id,
|
||||
FlatpakDbEntry *entry);
|
||||
void flatpak_db_update (FlatpakDb *self);
|
||||
GBytes * flatpak_db_get_content (FlatpakDb *self);
|
||||
const char * flatpak_db_get_path (FlatpakDb *self);
|
||||
gboolean flatpak_db_save_content (FlatpakDb *self,
|
||||
GError **error);
|
||||
void flatpak_db_save_content_async (FlatpakDb *self,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
gboolean xdg_app_db_save_content_finish (XdgAppDb *self,
|
||||
gboolean flatpak_db_save_content_finish (FlatpakDb *self,
|
||||
GAsyncResult *res,
|
||||
GError **error);
|
||||
void xdg_app_db_set_path (XdgAppDb *self,
|
||||
void flatpak_db_set_path (FlatpakDb *self,
|
||||
const char *path);
|
||||
|
||||
|
||||
XdgAppDbEntry *xdg_app_db_entry_ref (XdgAppDbEntry *entry);
|
||||
void xdg_app_db_entry_unref (XdgAppDbEntry *entry);
|
||||
GVariant * xdg_app_db_entry_get_data (XdgAppDbEntry *entry);
|
||||
const char ** xdg_app_db_entry_list_apps (XdgAppDbEntry *entry);
|
||||
const char ** xdg_app_db_entry_list_permissions (XdgAppDbEntry *entry,
|
||||
const char *app);
|
||||
gboolean xdg_app_db_entry_has_permission (XdgAppDbEntry *entry,
|
||||
const char *app,
|
||||
const char *permission);
|
||||
gboolean xdg_app_db_entry_has_permissions (XdgAppDbEntry *entry,
|
||||
const char *app,
|
||||
const char **permissions);
|
||||
GString * xdg_app_db_entry_print_string (XdgAppDbEntry *entry,
|
||||
GString *string);
|
||||
FlatpakDbEntry *flatpak_db_entry_ref (FlatpakDbEntry *entry);
|
||||
void flatpak_db_entry_unref (FlatpakDbEntry *entry);
|
||||
GVariant * flatpak_db_entry_get_data (FlatpakDbEntry *entry);
|
||||
const char ** flatpak_db_entry_list_apps (FlatpakDbEntry *entry);
|
||||
const char ** flatpak_db_entry_list_permissions (FlatpakDbEntry *entry,
|
||||
const char *app);
|
||||
gboolean flatpak_db_entry_has_permission (FlatpakDbEntry *entry,
|
||||
const char *app,
|
||||
const char *permission);
|
||||
gboolean flatpak_db_entry_has_permissions (FlatpakDbEntry *entry,
|
||||
const char *app,
|
||||
const char **permissions);
|
||||
GString * flatpak_db_entry_print_string (FlatpakDbEntry *entry,
|
||||
GString *string);
|
||||
|
||||
XdgAppDbEntry *xdg_app_db_entry_new (GVariant *data);
|
||||
XdgAppDbEntry *xdg_app_db_entry_modify_data (XdgAppDbEntry *entry,
|
||||
GVariant *data);
|
||||
XdgAppDbEntry *xdg_app_db_entry_set_app_permissions (XdgAppDbEntry *entry,
|
||||
const char *app,
|
||||
const char **permissions);
|
||||
FlatpakDbEntry *flatpak_db_entry_new (GVariant *data);
|
||||
FlatpakDbEntry *flatpak_db_entry_modify_data (FlatpakDbEntry *entry,
|
||||
GVariant *data);
|
||||
FlatpakDbEntry *flatpak_db_entry_set_app_permissions (FlatpakDbEntry *entry,
|
||||
const char *app,
|
||||
const char **permissions);
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (XdgAppDb, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (XdgAppDbEntry, xdg_app_db_entry_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (FlatpakDb, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (FlatpakDbEntry, flatpak_db_entry_unref)
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* XDG_APP_DB_H */
|
||||
#endif /* FLATPAK_DB_H */
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -18,47 +18,47 @@
|
|||
* Alexander Larsson <alexl@redhat.com>
|
||||
*/
|
||||
|
||||
#ifndef __XDG_APP_DIR_H__
|
||||
#define __XDG_APP_DIR_H__
|
||||
#ifndef __FLATPAK_DIR_H__
|
||||
#define __FLATPAK_DIR_H__
|
||||
|
||||
#include <ostree.h>
|
||||
|
||||
#include "libglnx/libglnx.h"
|
||||
#include <xdg-app-common-types.h>
|
||||
|
||||
#define XDG_APP_TYPE_DIR xdg_app_dir_get_type ()
|
||||
#define XDG_APP_DIR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), XDG_APP_TYPE_DIR, XdgAppDir))
|
||||
#define XDG_APP_IS_DIR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), XDG_APP_TYPE_DIR))
|
||||
#define FLATPAK_TYPE_DIR flatpak_dir_get_type ()
|
||||
#define FLATPAK_DIR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FLATPAK_TYPE_DIR, FlatpakDir))
|
||||
#define FLATPAK_IS_DIR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FLATPAK_TYPE_DIR))
|
||||
|
||||
#define XDG_APP_TYPE_DEPLOY xdg_app_deploy_get_type ()
|
||||
#define XDG_APP_DEPLOY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), XDG_APP_TYPE_DEPLOY, XdgAppDeploy))
|
||||
#define XDG_APP_IS_DEPLOY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), XDG_APP_TYPE_DEPLOY))
|
||||
#define FLATPAK_TYPE_DEPLOY flatpak_deploy_get_type ()
|
||||
#define FLATPAK_DEPLOY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FLATPAK_TYPE_DEPLOY, FlatpakDeploy))
|
||||
#define FLATPAK_IS_DEPLOY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FLATPAK_TYPE_DEPLOY))
|
||||
|
||||
GType xdg_app_dir_get_type (void);
|
||||
GType xdg_app_deploy_get_type (void);
|
||||
GType flatpak_dir_get_type (void);
|
||||
GType flatpak_deploy_get_type (void);
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (XdgAppDir, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (XdgAppDeploy, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (FlatpakDir, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (FlatpakDeploy, g_object_unref)
|
||||
|
||||
#define XDG_APP_DIR_ERROR xdg_app_dir_error_quark ()
|
||||
#define FLATPAK_DIR_ERROR flatpak_dir_error_quark ()
|
||||
|
||||
typedef enum {
|
||||
XDG_APP_DIR_ERROR_ALREADY_DEPLOYED,
|
||||
XDG_APP_DIR_ERROR_ALREADY_UNDEPLOYED,
|
||||
XDG_APP_DIR_ERROR_NOT_DEPLOYED,
|
||||
} XdgAppDirErrorEnum;
|
||||
FLATPAK_DIR_ERROR_ALREADY_DEPLOYED,
|
||||
FLATPAK_DIR_ERROR_ALREADY_UNDEPLOYED,
|
||||
FLATPAK_DIR_ERROR_NOT_DEPLOYED,
|
||||
} FlatpakDirErrorEnum;
|
||||
|
||||
typedef enum {
|
||||
XDG_APP_HELPER_DEPLOY_FLAGS_NONE = 0,
|
||||
XDG_APP_HELPER_DEPLOY_FLAGS_UPDATE = 1 << 0,
|
||||
} XdgAppHelperDeployFlags;
|
||||
FLATPAK_HELPER_DEPLOY_FLAGS_NONE = 0,
|
||||
FLATPAK_HELPER_DEPLOY_FLAGS_UPDATE = 1 << 0,
|
||||
} FlatpakHelperDeployFlags;
|
||||
|
||||
#define XDG_APP_HELPER_DEPLOY_FLAGS_ALL (XDG_APP_HELPER_DEPLOY_FLAGS_UPDATE)
|
||||
#define FLATPAK_HELPER_DEPLOY_FLAGS_ALL (FLATPAK_HELPER_DEPLOY_FLAGS_UPDATE)
|
||||
|
||||
GQuark xdg_app_dir_error_quark (void);
|
||||
GQuark flatpak_dir_error_quark (void);
|
||||
|
||||
/**
|
||||
* XDG_APP_DEPLOY_DATA_GVARIANT_FORMAT:
|
||||
* FLATPAK_DEPLOY_DATA_GVARIANT_FORMAT:
|
||||
*
|
||||
* s - origin
|
||||
* s - commit
|
||||
|
@ -66,63 +66,63 @@ GQuark xdg_app_dir_error_quark (void);
|
|||
* t - installed size
|
||||
* a{sv} - Metadata
|
||||
*/
|
||||
#define XDG_APP_DEPLOY_DATA_GVARIANT_STRING "(ssasta{sv})"
|
||||
#define XDG_APP_DEPLOY_DATA_GVARIANT_FORMAT G_VARIANT_TYPE (XDG_APP_DEPLOY_DATA_GVARIANT_STRING)
|
||||
#define FLATPAK_DEPLOY_DATA_GVARIANT_STRING "(ssasta{sv})"
|
||||
#define FLATPAK_DEPLOY_DATA_GVARIANT_FORMAT G_VARIANT_TYPE (FLATPAK_DEPLOY_DATA_GVARIANT_STRING)
|
||||
|
||||
GFile * xdg_app_get_system_base_dir_location (void);
|
||||
GFile * xdg_app_get_user_base_dir_location (void);
|
||||
GFile * flatpak_get_system_base_dir_location (void);
|
||||
GFile * flatpak_get_user_base_dir_location (void);
|
||||
|
||||
GKeyFile * xdg_app_load_override_keyfile (const char *app_id,
|
||||
GKeyFile * flatpak_load_override_keyfile (const char *app_id,
|
||||
gboolean user,
|
||||
GError **error);
|
||||
XdgAppContext *xdg_app_load_override_file (const char *app_id,
|
||||
gboolean user,
|
||||
GError **error);
|
||||
gboolean xdg_app_save_override_keyfile (GKeyFile *metakey,
|
||||
FlatpakContext *flatpak_load_override_file (const char *app_id,
|
||||
gboolean user,
|
||||
GError **error);
|
||||
gboolean flatpak_save_override_keyfile (GKeyFile *metakey,
|
||||
const char *app_id,
|
||||
gboolean user,
|
||||
GError **error);
|
||||
|
||||
const char * xdg_app_deploy_data_get_origin (GVariant *deploy_data);
|
||||
const char * xdg_app_deploy_data_get_commit (GVariant *deploy_data);
|
||||
const char ** xdg_app_deploy_data_get_subpaths (GVariant *deploy_data);
|
||||
guint64 xdg_app_deploy_data_get_installed_size (GVariant *deploy_data);
|
||||
const char * flatpak_deploy_data_get_origin (GVariant *deploy_data);
|
||||
const char * flatpak_deploy_data_get_commit (GVariant *deploy_data);
|
||||
const char ** flatpak_deploy_data_get_subpaths (GVariant *deploy_data);
|
||||
guint64 flatpak_deploy_data_get_installed_size (GVariant *deploy_data);
|
||||
|
||||
GFile * xdg_app_deploy_get_dir (XdgAppDeploy *deploy);
|
||||
GFile * xdg_app_deploy_get_files (XdgAppDeploy *deploy);
|
||||
XdgAppContext *xdg_app_deploy_get_overrides (XdgAppDeploy *deploy);
|
||||
GKeyFile * xdg_app_deploy_get_metadata (XdgAppDeploy *deploy);
|
||||
GFile * flatpak_deploy_get_dir (FlatpakDeploy *deploy);
|
||||
GFile * flatpak_deploy_get_files (FlatpakDeploy *deploy);
|
||||
FlatpakContext *flatpak_deploy_get_overrides (FlatpakDeploy *deploy);
|
||||
GKeyFile * flatpak_deploy_get_metadata (FlatpakDeploy *deploy);
|
||||
|
||||
XdgAppDir * xdg_app_dir_new (GFile *basedir,
|
||||
gboolean user);
|
||||
XdgAppDir * xdg_app_dir_clone (XdgAppDir *self);
|
||||
XdgAppDir *xdg_app_dir_get (gboolean user);
|
||||
XdgAppDir *xdg_app_dir_get_system (void);
|
||||
XdgAppDir *xdg_app_dir_get_user (void);
|
||||
gboolean xdg_app_dir_is_user (XdgAppDir *self);
|
||||
GFile * xdg_app_dir_get_path (XdgAppDir *self);
|
||||
GFile * xdg_app_dir_get_changed_path (XdgAppDir *self);
|
||||
GFile * xdg_app_dir_get_deploy_dir (XdgAppDir *self,
|
||||
FlatpakDir * flatpak_dir_new (GFile *basedir,
|
||||
gboolean user);
|
||||
FlatpakDir * flatpak_dir_clone (FlatpakDir *self);
|
||||
FlatpakDir *flatpak_dir_get (gboolean user);
|
||||
FlatpakDir *flatpak_dir_get_system (void);
|
||||
FlatpakDir *flatpak_dir_get_user (void);
|
||||
gboolean flatpak_dir_is_user (FlatpakDir *self);
|
||||
GFile * flatpak_dir_get_path (FlatpakDir *self);
|
||||
GFile * flatpak_dir_get_changed_path (FlatpakDir *self);
|
||||
GFile * flatpak_dir_get_deploy_dir (FlatpakDir *self,
|
||||
const char *ref);
|
||||
GVariant * xdg_app_dir_get_deploy_data (XdgAppDir *dir,
|
||||
GVariant * flatpak_dir_get_deploy_data (FlatpakDir *dir,
|
||||
const char *ref,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
char * xdg_app_dir_get_origin (XdgAppDir *self,
|
||||
char * flatpak_dir_get_origin (FlatpakDir *self,
|
||||
const char *ref,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
char ** xdg_app_dir_get_subpaths (XdgAppDir *self,
|
||||
char ** flatpak_dir_get_subpaths (FlatpakDir *self,
|
||||
const char *ref,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
GFile * xdg_app_dir_get_exports_dir (XdgAppDir *self);
|
||||
GFile * xdg_app_dir_get_removed_dir (XdgAppDir *self);
|
||||
GFile * xdg_app_dir_get_if_deployed (XdgAppDir *self,
|
||||
GFile * flatpak_dir_get_exports_dir (FlatpakDir *self);
|
||||
GFile * flatpak_dir_get_removed_dir (FlatpakDir *self);
|
||||
GFile * flatpak_dir_get_if_deployed (FlatpakDir *self,
|
||||
const char *ref,
|
||||
const char *checksum,
|
||||
GCancellable *cancellable);
|
||||
char * xdg_app_dir_find_remote_ref (XdgAppDir *self,
|
||||
char * flatpak_dir_find_remote_ref (FlatpakDir *self,
|
||||
const char *remote,
|
||||
const char *name,
|
||||
const char *opt_branch,
|
||||
|
@ -132,7 +132,7 @@ char * xdg_app_dir_find_remote_ref (XdgAppDir *self,
|
|||
gboolean *is_app,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
char * xdg_app_dir_find_installed_ref (XdgAppDir *self,
|
||||
char * flatpak_dir_find_installed_ref (FlatpakDir *self,
|
||||
const char *name,
|
||||
const char *opt_branch,
|
||||
const char *opt_arch,
|
||||
|
@ -140,39 +140,39 @@ char * xdg_app_dir_find_installed_ref (XdgAppDir *self,
|
|||
gboolean runtime,
|
||||
gboolean *is_app,
|
||||
GError **error);
|
||||
XdgAppDeploy *xdg_app_dir_load_deployed (XdgAppDir *self,
|
||||
const char *ref,
|
||||
const char *checksum,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
char * xdg_app_dir_load_override (XdgAppDir *dir,
|
||||
FlatpakDeploy *flatpak_dir_load_deployed (FlatpakDir *self,
|
||||
const char *ref,
|
||||
const char *checksum,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
char * flatpak_dir_load_override (FlatpakDir *dir,
|
||||
const char *app_id,
|
||||
gsize *length,
|
||||
GError **error);
|
||||
OstreeRepo *xdg_app_dir_get_repo (XdgAppDir *self);
|
||||
gboolean xdg_app_dir_ensure_path (XdgAppDir *self,
|
||||
OstreeRepo *flatpak_dir_get_repo (FlatpakDir *self);
|
||||
gboolean flatpak_dir_ensure_path (FlatpakDir *self,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
gboolean xdg_app_dir_use_child_repo (XdgAppDir *self);
|
||||
gboolean xdg_app_dir_ensure_system_child_repo (XdgAppDir *self,
|
||||
GError **error);
|
||||
gboolean xdg_app_dir_ensure_repo (XdgAppDir *self,
|
||||
gboolean flatpak_dir_use_child_repo (FlatpakDir *self);
|
||||
gboolean flatpak_dir_ensure_system_child_repo (FlatpakDir *self,
|
||||
GError **error);
|
||||
gboolean flatpak_dir_ensure_repo (FlatpakDir *self,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
gboolean xdg_app_dir_mark_changed (XdgAppDir *self,
|
||||
GError **error);
|
||||
gboolean xdg_app_dir_remove_appstream (XdgAppDir *self,
|
||||
gboolean flatpak_dir_mark_changed (FlatpakDir *self,
|
||||
GError **error);
|
||||
gboolean flatpak_dir_remove_appstream (FlatpakDir *self,
|
||||
const char *remote,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
gboolean xdg_app_dir_update_appstream (XdgAppDir *self,
|
||||
gboolean flatpak_dir_update_appstream (FlatpakDir *self,
|
||||
const char *remote,
|
||||
const char *arch,
|
||||
gboolean *out_changed,
|
||||
OstreeAsyncProgress *progress,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
gboolean xdg_app_dir_pull (XdgAppDir *self,
|
||||
gboolean flatpak_dir_pull (FlatpakDir *self,
|
||||
const char *repository,
|
||||
const char *ref,
|
||||
char **subpaths,
|
||||
|
@ -181,7 +181,7 @@ gboolean xdg_app_dir_pull (XdgAppDir *self,
|
|||
OstreeAsyncProgress *progress,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
gboolean xdg_app_dir_pull_untrusted_local (XdgAppDir *self,
|
||||
gboolean flatpak_dir_pull_untrusted_local (FlatpakDir *self,
|
||||
const char *src_path,
|
||||
const char *remote_name,
|
||||
const char *ref,
|
||||
|
@ -189,51 +189,51 @@ gboolean xdg_app_dir_pull_untrusted_local (XdgAppDir *self,
|
|||
OstreeAsyncProgress *progress,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
gboolean xdg_app_dir_list_refs_for_name (XdgAppDir *self,
|
||||
gboolean flatpak_dir_list_refs_for_name (FlatpakDir *self,
|
||||
const char *kind,
|
||||
const char *name,
|
||||
char ***refs,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
gboolean xdg_app_dir_list_refs (XdgAppDir *self,
|
||||
gboolean flatpak_dir_list_refs (FlatpakDir *self,
|
||||
const char *kind,
|
||||
char ***refs,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
char * xdg_app_dir_read_latest (XdgAppDir *self,
|
||||
char * flatpak_dir_read_latest (FlatpakDir *self,
|
||||
const char *remote,
|
||||
const char *ref,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
char * xdg_app_dir_read_active (XdgAppDir *self,
|
||||
char * flatpak_dir_read_active (FlatpakDir *self,
|
||||
const char *ref,
|
||||
GCancellable *cancellable);
|
||||
gboolean xdg_app_dir_set_active (XdgAppDir *self,
|
||||
gboolean flatpak_dir_set_active (FlatpakDir *self,
|
||||
const char *ref,
|
||||
const char *checksum,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
char * xdg_app_dir_current_ref (XdgAppDir *self,
|
||||
char * flatpak_dir_current_ref (FlatpakDir *self,
|
||||
const char *name,
|
||||
GCancellable *cancellable);
|
||||
gboolean xdg_app_dir_drop_current_ref (XdgAppDir *self,
|
||||
gboolean flatpak_dir_drop_current_ref (FlatpakDir *self,
|
||||
const char *name,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
gboolean xdg_app_dir_make_current_ref (XdgAppDir *self,
|
||||
gboolean flatpak_dir_make_current_ref (FlatpakDir *self,
|
||||
const char *ref,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
gboolean xdg_app_dir_list_deployed (XdgAppDir *self,
|
||||
gboolean flatpak_dir_list_deployed (FlatpakDir *self,
|
||||
const char *ref,
|
||||
char ***deployed_checksums,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
gboolean xdg_app_dir_lock (XdgAppDir *self,
|
||||
gboolean flatpak_dir_lock (FlatpakDir *self,
|
||||
GLnxLockFile *lockfile,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
gboolean xdg_app_dir_deploy (XdgAppDir *self,
|
||||
gboolean flatpak_dir_deploy (FlatpakDir *self,
|
||||
const char *origin,
|
||||
const char *ref,
|
||||
const char *checksum_or_latest,
|
||||
|
@ -241,18 +241,18 @@ gboolean xdg_app_dir_deploy (XdgAppDir *self,
|
|||
GVariant *old_deploy_data,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
gboolean xdg_app_dir_deploy_update (XdgAppDir *self,
|
||||
gboolean flatpak_dir_deploy_update (FlatpakDir *self,
|
||||
const char *ref,
|
||||
const char *checksum,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
gboolean xdg_app_dir_deploy_install (XdgAppDir *self,
|
||||
gboolean flatpak_dir_deploy_install (FlatpakDir *self,
|
||||
const char *ref,
|
||||
const char *origin,
|
||||
char **subpaths,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
gboolean xdg_app_dir_install (XdgAppDir *self,
|
||||
gboolean flatpak_dir_install (FlatpakDir *self,
|
||||
gboolean no_pull,
|
||||
gboolean no_deploy,
|
||||
const char *ref,
|
||||
|
@ -261,7 +261,7 @@ gboolean xdg_app_dir_install (XdgAppDir *self,
|
|||
OstreeAsyncProgress *progress,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
gboolean xdg_app_dir_update (XdgAppDir *self,
|
||||
gboolean flatpak_dir_update (FlatpakDir *self,
|
||||
gboolean no_pull,
|
||||
gboolean no_deploy,
|
||||
const char *ref,
|
||||
|
@ -271,38 +271,38 @@ gboolean xdg_app_dir_update (XdgAppDir *self,
|
|||
OstreeAsyncProgress *progress,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
gboolean xdg_app_dir_undeploy (XdgAppDir *self,
|
||||
gboolean flatpak_dir_undeploy (FlatpakDir *self,
|
||||
const char *ref,
|
||||
const char *checksum,
|
||||
gboolean force_remove,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
gboolean xdg_app_dir_undeploy_all (XdgAppDir *self,
|
||||
gboolean flatpak_dir_undeploy_all (FlatpakDir *self,
|
||||
const char *ref,
|
||||
gboolean force_remove,
|
||||
gboolean *was_deployed_out,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
gboolean xdg_app_dir_remove_all_refs (XdgAppDir *self,
|
||||
gboolean flatpak_dir_remove_all_refs (FlatpakDir *self,
|
||||
const char *remote,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
gboolean xdg_app_dir_remove_ref (XdgAppDir *self,
|
||||
gboolean flatpak_dir_remove_ref (FlatpakDir *self,
|
||||
const char *remote_name,
|
||||
const char *ref,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
gboolean xdg_app_dir_update_exports (XdgAppDir *self,
|
||||
gboolean flatpak_dir_update_exports (FlatpakDir *self,
|
||||
const char *app,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
gboolean xdg_app_dir_prune (XdgAppDir *self,
|
||||
gboolean flatpak_dir_prune (FlatpakDir *self,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
gboolean xdg_app_dir_cleanup_removed (XdgAppDir *self,
|
||||
gboolean flatpak_dir_cleanup_removed (FlatpakDir *self,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
gboolean xdg_app_dir_collect_deployed_refs (XdgAppDir *self,
|
||||
gboolean flatpak_dir_collect_deployed_refs (FlatpakDir *self,
|
||||
const char *type,
|
||||
const char *name_prefix,
|
||||
const char *branch,
|
||||
|
@ -310,45 +310,45 @@ gboolean xdg_app_dir_collect_deployed_refs (XdgAppDir *self,
|
|||
GHashTable *hash,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
char *xdg_app_dir_create_origin_remote (XdgAppDir *self,
|
||||
char *flatpak_dir_create_origin_remote (FlatpakDir *self,
|
||||
const char *url,
|
||||
const char *id,
|
||||
const char *title,
|
||||
GBytes *gpg_data,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
char **xdg_app_dir_list_remotes (XdgAppDir *self,
|
||||
char **flatpak_dir_list_remotes (FlatpakDir *self,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
char *xdg_app_dir_get_remote_title (XdgAppDir *self,
|
||||
char *flatpak_dir_get_remote_title (FlatpakDir *self,
|
||||
const char *remote_name);
|
||||
int xdg_app_dir_get_remote_prio (XdgAppDir *self,
|
||||
int flatpak_dir_get_remote_prio (FlatpakDir *self,
|
||||
const char *remote_name);
|
||||
gboolean xdg_app_dir_get_remote_noenumerate (XdgAppDir *self,
|
||||
gboolean flatpak_dir_get_remote_noenumerate (FlatpakDir *self,
|
||||
const char *remote_name);
|
||||
gboolean xdg_app_dir_get_remote_disabled (XdgAppDir *self,
|
||||
gboolean flatpak_dir_get_remote_disabled (FlatpakDir *self,
|
||||
const char *remote_name);
|
||||
gboolean xdg_app_dir_list_remote_refs (XdgAppDir *self,
|
||||
gboolean flatpak_dir_list_remote_refs (FlatpakDir *self,
|
||||
const char *remote,
|
||||
GHashTable **refs,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
char * xdg_app_dir_fetch_remote_title (XdgAppDir *self,
|
||||
char * flatpak_dir_fetch_remote_title (FlatpakDir *self,
|
||||
const char *remote,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
GBytes * xdg_app_dir_fetch_remote_object (XdgAppDir *self,
|
||||
GBytes * flatpak_dir_fetch_remote_object (FlatpakDir *self,
|
||||
const char *remote,
|
||||
const char *checksum,
|
||||
const char *type,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
GBytes * xdg_app_dir_fetch_metadata (XdgAppDir *self,
|
||||
GBytes * flatpak_dir_fetch_metadata (FlatpakDir *self,
|
||||
const char *remote_name,
|
||||
const char *commit,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
gboolean xdg_app_dir_fetch_ref_cache (XdgAppDir *self,
|
||||
gboolean flatpak_dir_fetch_ref_cache (FlatpakDir *self,
|
||||
const char *remote_name,
|
||||
const char *ref,
|
||||
guint64 *download_size,
|
||||
|
@ -357,4 +357,4 @@ gboolean xdg_app_dir_fetch_ref_cache (XdgAppDir *self,
|
|||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
|
||||
#endif /* __XDG_APP_DIR_H__ */
|
||||
#endif /* __FLATPAK_DIR_H__ */
|
||||
|
|
|
@ -25,24 +25,24 @@
|
|||
|
||||
#include <gio/gio.h>
|
||||
|
||||
static const GDBusErrorEntry xdg_app_error_entries[] = {
|
||||
{XDG_APP_PORTAL_ERROR_FAILED, "org.freedesktop.XdgApp.Failed"},
|
||||
{XDG_APP_PORTAL_ERROR_INVALID_ARGUMENT, "org.freedesktop.XdgApp.InvalidArgument"},
|
||||
{XDG_APP_PORTAL_ERROR_NOT_FOUND, "org.freedesktop.XdgApp.NotFound"},
|
||||
{XDG_APP_PORTAL_ERROR_EXISTS, "org.freedesktop.XdgApp.Exists"},
|
||||
{XDG_APP_PORTAL_ERROR_NOT_ALLOWED, "org.freedesktop.XdgApp.NotAllowed"},
|
||||
{XDG_APP_PORTAL_ERROR_CANCELLED, "org.freedesktop.XdgApp.Cancelled"},
|
||||
{XDG_APP_PORTAL_ERROR_WINDOW_DESTROYED, "org.freedesktop.XdgApp.WindowDestroyed"},
|
||||
static const GDBusErrorEntry flatpak_error_entries[] = {
|
||||
{FLATPAK_PORTAL_ERROR_FAILED, "org.freedesktop.Flatpak.Failed"},
|
||||
{FLATPAK_PORTAL_ERROR_INVALID_ARGUMENT, "org.freedesktop.Flatpak.InvalidArgument"},
|
||||
{FLATPAK_PORTAL_ERROR_NOT_FOUND, "org.freedesktop.Flatpak.NotFound"},
|
||||
{FLATPAK_PORTAL_ERROR_EXISTS, "org.freedesktop.Flatpak.Exists"},
|
||||
{FLATPAK_PORTAL_ERROR_NOT_ALLOWED, "org.freedesktop.Flatpak.NotAllowed"},
|
||||
{FLATPAK_PORTAL_ERROR_CANCELLED, "org.freedesktop.Flatpak.Cancelled"},
|
||||
{FLATPAK_PORTAL_ERROR_WINDOW_DESTROYED, "org.freedesktop.Flatpak.WindowDestroyed"},
|
||||
};
|
||||
|
||||
GQuark
|
||||
xdg_app_portal_error_quark (void)
|
||||
flatpak_portal_error_quark (void)
|
||||
{
|
||||
static volatile gsize quark_volatile = 0;
|
||||
|
||||
g_dbus_error_register_error_domain ("xdg-app-portal-error-quark",
|
||||
&quark_volatile,
|
||||
xdg_app_error_entries,
|
||||
G_N_ELEMENTS (xdg_app_error_entries));
|
||||
flatpak_error_entries,
|
||||
G_N_ELEMENTS (flatpak_error_entries));
|
||||
return (GQuark) quark_volatile;
|
||||
}
|
||||
|
|
|
@ -19,8 +19,8 @@
|
|||
* Alexander Larsson <alexl@redhat.com>
|
||||
*/
|
||||
|
||||
#ifndef XDG_APP_PORTAL_ERROR_H
|
||||
#define XDG_APP_PORTAL_ERROR_H
|
||||
#ifndef FLATPAK_PORTAL_ERROR_H
|
||||
#define FLATPAK_PORTAL_ERROR_H
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
|
@ -30,20 +30,20 @@ G_BEGIN_DECLS
|
|||
* XdpErrorEnum:
|
||||
*/
|
||||
typedef enum {
|
||||
XDG_APP_PORTAL_ERROR_FAILED = 0,
|
||||
XDG_APP_PORTAL_ERROR_INVALID_ARGUMENT,
|
||||
XDG_APP_PORTAL_ERROR_NOT_FOUND,
|
||||
XDG_APP_PORTAL_ERROR_EXISTS,
|
||||
XDG_APP_PORTAL_ERROR_NOT_ALLOWED,
|
||||
XDG_APP_PORTAL_ERROR_CANCELLED,
|
||||
XDG_APP_PORTAL_ERROR_WINDOW_DESTROYED,
|
||||
} XdgAppErrorEnum;
|
||||
FLATPAK_PORTAL_ERROR_FAILED = 0,
|
||||
FLATPAK_PORTAL_ERROR_INVALID_ARGUMENT,
|
||||
FLATPAK_PORTAL_ERROR_NOT_FOUND,
|
||||
FLATPAK_PORTAL_ERROR_EXISTS,
|
||||
FLATPAK_PORTAL_ERROR_NOT_ALLOWED,
|
||||
FLATPAK_PORTAL_ERROR_CANCELLED,
|
||||
FLATPAK_PORTAL_ERROR_WINDOW_DESTROYED,
|
||||
} FlatpakErrorEnum;
|
||||
|
||||
|
||||
#define XDG_APP_PORTAL_ERROR xdg_app_portal_error_quark ()
|
||||
#define FLATPAK_PORTAL_ERROR flatpak_portal_error_quark ()
|
||||
|
||||
XDG_APP_EXTERN GQuark xdg_app_portal_error_quark (void);
|
||||
FLATPAK_EXTERN GQuark flatpak_portal_error_quark (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* XDG_APP_PORTAL_ERROR_H */
|
||||
#endif /* FLATPAK_PORTAL_ERROR_H */
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -18,94 +18,94 @@
|
|||
* Alexander Larsson <alexl@redhat.com>
|
||||
*/
|
||||
|
||||
#ifndef __XDG_APP_RUN_H__
|
||||
#define __XDG_APP_RUN_H__
|
||||
#ifndef __FLATPAK_RUN_H__
|
||||
#define __FLATPAK_RUN_H__
|
||||
|
||||
#include "libglnx/libglnx.h"
|
||||
#include "dbus-proxy/xdg-app-proxy.h"
|
||||
#include "xdg-app-common-types.h"
|
||||
|
||||
gboolean xdg_app_run_in_transient_unit (const char *app_id,
|
||||
gboolean flatpak_run_in_transient_unit (const char *app_id,
|
||||
GError **error);
|
||||
|
||||
#define XDG_APP_METADATA_GROUP_CONTEXT "Context"
|
||||
#define XDG_APP_METADATA_GROUP_SESSION_BUS_POLICY "Session Bus Policy"
|
||||
#define XDG_APP_METADATA_GROUP_SYSTEM_BUS_POLICY "System Bus Policy"
|
||||
#define XDG_APP_METADATA_GROUP_ENVIRONMENT "Environment"
|
||||
#define XDG_APP_METADATA_KEY_SHARED "shared"
|
||||
#define XDG_APP_METADATA_KEY_SOCKETS "sockets"
|
||||
#define XDG_APP_METADATA_KEY_FILESYSTEMS "filesystems"
|
||||
#define XDG_APP_METADATA_KEY_PERSISTENT "persistent"
|
||||
#define XDG_APP_METADATA_KEY_DEVICES "devices"
|
||||
#define FLATPAK_METADATA_GROUP_CONTEXT "Context"
|
||||
#define FLATPAK_METADATA_GROUP_SESSION_BUS_POLICY "Session Bus Policy"
|
||||
#define FLATPAK_METADATA_GROUP_SYSTEM_BUS_POLICY "System Bus Policy"
|
||||
#define FLATPAK_METADATA_GROUP_ENVIRONMENT "Environment"
|
||||
#define FLATPAK_METADATA_KEY_SHARED "shared"
|
||||
#define FLATPAK_METADATA_KEY_SOCKETS "sockets"
|
||||
#define FLATPAK_METADATA_KEY_FILESYSTEMS "filesystems"
|
||||
#define FLATPAK_METADATA_KEY_PERSISTENT "persistent"
|
||||
#define FLATPAK_METADATA_KEY_DEVICES "devices"
|
||||
|
||||
XdgAppContext *xdg_app_context_new (void);
|
||||
void xdg_app_context_free (XdgAppContext *context);
|
||||
void xdg_app_context_merge (XdgAppContext *context,
|
||||
XdgAppContext *other);
|
||||
GOptionGroup *xdg_app_context_get_options (XdgAppContext *context);
|
||||
gboolean xdg_app_context_load_metadata (XdgAppContext *context,
|
||||
GKeyFile *metakey,
|
||||
GError **error);
|
||||
void xdg_app_context_save_metadata (XdgAppContext *context,
|
||||
GKeyFile *metakey);
|
||||
void xdg_app_context_allow_host_fs (XdgAppContext *context);
|
||||
void xdg_app_context_set_session_bus_policy (XdgAppContext *context,
|
||||
const char *name,
|
||||
XdgAppPolicy policy);
|
||||
void xdg_app_context_set_system_bus_policy (XdgAppContext *context,
|
||||
const char *name,
|
||||
XdgAppPolicy policy);
|
||||
FlatpakContext *flatpak_context_new (void);
|
||||
void flatpak_context_free (FlatpakContext *context);
|
||||
void flatpak_context_merge (FlatpakContext *context,
|
||||
FlatpakContext *other);
|
||||
GOptionGroup *flatpak_context_get_options (FlatpakContext *context);
|
||||
gboolean flatpak_context_load_metadata (FlatpakContext *context,
|
||||
GKeyFile *metakey,
|
||||
GError **error);
|
||||
void flatpak_context_save_metadata (FlatpakContext *context,
|
||||
GKeyFile *metakey);
|
||||
void flatpak_context_allow_host_fs (FlatpakContext *context);
|
||||
void flatpak_context_set_session_bus_policy (FlatpakContext *context,
|
||||
const char *name,
|
||||
FlatpakPolicy policy);
|
||||
void flatpak_context_set_system_bus_policy (FlatpakContext *context,
|
||||
const char *name,
|
||||
FlatpakPolicy policy);
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (XdgAppContext, xdg_app_context_free)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (FlatpakContext, flatpak_context_free)
|
||||
|
||||
gboolean xdg_app_run_add_extension_args (GPtrArray *argv_array,
|
||||
gboolean flatpak_run_add_extension_args (GPtrArray *argv_array,
|
||||
GKeyFile *metakey,
|
||||
const char *full_ref,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
void xdg_app_run_add_environment_args (GPtrArray *argv_array,
|
||||
char ***envp_p,
|
||||
GPtrArray *session_bus_proxy_argv,
|
||||
GPtrArray *system_bus_proxy_argv,
|
||||
const char *app_id,
|
||||
XdgAppContext *context,
|
||||
GFile *app_id_dir);
|
||||
char ** xdg_app_run_get_minimal_env (gboolean devel);
|
||||
char ** xdg_app_run_apply_env_default (char **envp);
|
||||
char ** xdg_app_run_apply_env_appid (char **envp,
|
||||
void flatpak_run_add_environment_args (GPtrArray *argv_array,
|
||||
char ***envp_p,
|
||||
GPtrArray *session_bus_proxy_argv,
|
||||
GPtrArray *system_bus_proxy_argv,
|
||||
const char *app_id,
|
||||
FlatpakContext *context,
|
||||
GFile *app_id_dir);
|
||||
char ** flatpak_run_get_minimal_env (gboolean devel);
|
||||
char ** flatpak_run_apply_env_default (char **envp);
|
||||
char ** flatpak_run_apply_env_appid (char **envp,
|
||||
GFile *app_dir);
|
||||
char ** xdg_app_run_apply_env_vars (char **envp,
|
||||
XdgAppContext *context);
|
||||
char ** flatpak_run_apply_env_vars (char **envp,
|
||||
FlatpakContext *context);
|
||||
|
||||
GFile *xdg_app_get_data_dir (const char *app_id);
|
||||
GFile *xdg_app_ensure_data_dir (const char *app_id,
|
||||
GFile *flatpak_get_data_dir (const char *app_id);
|
||||
GFile *flatpak_ensure_data_dir (const char *app_id,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
|
||||
typedef enum {
|
||||
XDG_APP_RUN_FLAG_DEVEL = (1 << 0),
|
||||
XDG_APP_RUN_FLAG_BACKGROUND = (1 << 1),
|
||||
XDG_APP_RUN_FLAG_LOG_SESSION_BUS = (1 << 2),
|
||||
XDG_APP_RUN_FLAG_LOG_SYSTEM_BUS = (1 << 3),
|
||||
} XdgAppRunFlags;
|
||||
FLATPAK_RUN_FLAG_DEVEL = (1 << 0),
|
||||
FLATPAK_RUN_FLAG_BACKGROUND = (1 << 1),
|
||||
FLATPAK_RUN_FLAG_LOG_SESSION_BUS = (1 << 2),
|
||||
FLATPAK_RUN_FLAG_LOG_SYSTEM_BUS = (1 << 3),
|
||||
} FlatpakRunFlags;
|
||||
|
||||
gboolean xdg_app_run_setup_base_argv (GPtrArray *argv_array,
|
||||
GFile *runtime_files,
|
||||
GFile *app_id_dir,
|
||||
const char *arch,
|
||||
XdgAppRunFlags flags,
|
||||
GError **error);
|
||||
gboolean xdg_app_run_app (const char *app_ref,
|
||||
XdgAppDeploy *app_deploy,
|
||||
XdgAppContext *extra_context,
|
||||
const char *custom_runtime,
|
||||
const char *custom_runtime_version,
|
||||
XdgAppRunFlags flags,
|
||||
const char *custom_command,
|
||||
char *args[],
|
||||
int n_args,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
gboolean flatpak_run_setup_base_argv (GPtrArray *argv_array,
|
||||
GFile *runtime_files,
|
||||
GFile *app_id_dir,
|
||||
const char *arch,
|
||||
FlatpakRunFlags flags,
|
||||
GError **error);
|
||||
gboolean flatpak_run_app (const char *app_ref,
|
||||
FlatpakDeploy *app_deploy,
|
||||
FlatpakContext *extra_context,
|
||||
const char *custom_runtime,
|
||||
const char *custom_runtime_version,
|
||||
FlatpakRunFlags flags,
|
||||
const char *custom_command,
|
||||
char *args[],
|
||||
int n_args,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
|
||||
|
||||
#endif /* __XDG_APP_RUN_H__ */
|
||||
#endif /* __FLATPAK_RUN_H__ */
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -18,8 +18,8 @@
|
|||
* Alexander Larsson <alexl@redhat.com>
|
||||
*/
|
||||
|
||||
#ifndef __XDG_APP_UTILS_H__
|
||||
#define __XDG_APP_UTILS_H__
|
||||
#ifndef __FLATPAK_UTILS_H__
|
||||
#define __FLATPAK_UTILS_H__
|
||||
|
||||
#include <string.h>
|
||||
|
||||
|
@ -31,90 +31,90 @@
|
|||
#include "xdg-app-dir.h"
|
||||
#include <ostree.h>
|
||||
|
||||
gboolean xdg_app_fail (GError **error,
|
||||
gboolean flatpak_fail (GError **error,
|
||||
const char *format,
|
||||
...);
|
||||
|
||||
gint xdg_app_strcmp0_ptr (gconstpointer a,
|
||||
gint flatpak_strcmp0_ptr (gconstpointer a,
|
||||
gconstpointer b);
|
||||
|
||||
const char * xdg_app_path_match_prefix (const char *pattern,
|
||||
const char * flatpak_path_match_prefix (const char *pattern,
|
||||
const char *path);
|
||||
|
||||
const char * xdg_app_get_arch (void);
|
||||
const char * flatpak_get_arch (void);
|
||||
|
||||
const char * xdg_app_get_bwrap (void);
|
||||
const char * flatpak_get_bwrap (void);
|
||||
|
||||
GBytes * xdg_app_read_stream (GInputStream *in,
|
||||
GBytes * flatpak_read_stream (GInputStream *in,
|
||||
gboolean null_terminate,
|
||||
GError **error);
|
||||
|
||||
gboolean xdg_app_variant_save (GFile *dest,
|
||||
gboolean flatpak_variant_save (GFile *dest,
|
||||
GVariant *variant,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
gboolean xdg_app_variant_bsearch_str (GVariant *array,
|
||||
gboolean flatpak_variant_bsearch_str (GVariant *array,
|
||||
const char *str,
|
||||
int *out_pos);
|
||||
gboolean xdg_app_summary_lookup_ref (GVariant *summary,
|
||||
gboolean flatpak_summary_lookup_ref (GVariant *summary,
|
||||
const char *ref,
|
||||
char **out_checksum);
|
||||
|
||||
gboolean xdg_app_has_name_prefix (const char *string,
|
||||
gboolean flatpak_has_name_prefix (const char *string,
|
||||
const char *name);
|
||||
gboolean xdg_app_is_valid_name (const char *string);
|
||||
gboolean xdg_app_is_valid_branch (const char *string);
|
||||
gboolean flatpak_is_valid_name (const char *string);
|
||||
gboolean flatpak_is_valid_branch (const char *string);
|
||||
|
||||
char **xdg_app_decompose_ref (const char *ref,
|
||||
char **flatpak_decompose_ref (const char *ref,
|
||||
GError **error);
|
||||
|
||||
char * xdg_app_compose_ref (gboolean app,
|
||||
char * flatpak_compose_ref (gboolean app,
|
||||
const char *name,
|
||||
const char *branch,
|
||||
const char *arch,
|
||||
GError **error);
|
||||
|
||||
char * xdg_app_build_untyped_ref (const char *runtime,
|
||||
char * flatpak_build_untyped_ref (const char *runtime,
|
||||
const char *branch,
|
||||
const char *arch);
|
||||
char * xdg_app_build_runtime_ref (const char *runtime,
|
||||
char * flatpak_build_runtime_ref (const char *runtime,
|
||||
const char *branch,
|
||||
const char *arch);
|
||||
char * xdg_app_build_app_ref (const char *app,
|
||||
char * flatpak_build_app_ref (const char *app,
|
||||
const char *branch,
|
||||
const char *arch);
|
||||
GFile * xdg_app_find_deploy_dir_for_ref (const char *ref,
|
||||
GFile * flatpak_find_deploy_dir_for_ref (const char *ref,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
XdgAppDeploy * xdg_app_find_deploy_for_ref (const char *ref,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
char ** xdg_app_list_deployed_refs (const char *type,
|
||||
FlatpakDeploy * flatpak_find_deploy_for_ref (const char *ref,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
char ** flatpak_list_deployed_refs (const char *type,
|
||||
const char *name_prefix,
|
||||
const char *branch,
|
||||
const char *arch,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
|
||||
gboolean xdg_app_overlay_symlink_tree (GFile *source,
|
||||
gboolean flatpak_overlay_symlink_tree (GFile *source,
|
||||
GFile *destination,
|
||||
const char *symlink_prefix,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
gboolean xdg_app_remove_dangling_symlinks (GFile *dir,
|
||||
gboolean flatpak_remove_dangling_symlinks (GFile *dir,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
|
||||
void xdg_app_invocation_lookup_app_id (GDBusMethodInvocation *invocation,
|
||||
void flatpak_invocation_lookup_app_id (GDBusMethodInvocation *invocation,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
|
||||
char *xdg_app_invocation_lookup_app_id_finish (GDBusMethodInvocation *invocation,
|
||||
char *flatpak_invocation_lookup_app_id_finish (GDBusMethodInvocation *invocation,
|
||||
GAsyncResult *result,
|
||||
GError **error);
|
||||
|
||||
void xdg_app_connection_track_name_owners (GDBusConnection *connection);
|
||||
void flatpak_connection_track_name_owners (GDBusConnection *connection);
|
||||
|
||||
#if !GLIB_CHECK_VERSION (2, 40, 0)
|
||||
static inline gboolean
|
||||
|
@ -154,58 +154,58 @@ g_strv_subset (const gchar * const *strv,
|
|||
}
|
||||
|
||||
static inline void
|
||||
xdg_app_auto_unlock_helper (GMutex **mutex)
|
||||
flatpak_auto_unlock_helper (GMutex **mutex)
|
||||
{
|
||||
if (*mutex)
|
||||
g_mutex_unlock (*mutex);
|
||||
}
|
||||
|
||||
static inline GMutex *
|
||||
xdg_app_auto_lock_helper (GMutex *mutex)
|
||||
flatpak_auto_lock_helper (GMutex *mutex)
|
||||
{
|
||||
if (mutex)
|
||||
g_mutex_lock (mutex);
|
||||
return mutex;
|
||||
}
|
||||
|
||||
gint xdg_app_mkstempat (int dir_fd,
|
||||
gint flatpak_mkstempat (int dir_fd,
|
||||
gchar *tmpl,
|
||||
int flags,
|
||||
int mode);
|
||||
|
||||
|
||||
typedef struct XdgAppTablePrinter XdgAppTablePrinter;
|
||||
typedef struct FlatpakTablePrinter FlatpakTablePrinter;
|
||||
|
||||
XdgAppTablePrinter *xdg_app_table_printer_new (void);
|
||||
void xdg_app_table_printer_free (XdgAppTablePrinter *printer);
|
||||
void xdg_app_table_printer_add_column (XdgAppTablePrinter *printer,
|
||||
const char *text);
|
||||
void xdg_app_table_printer_append_with_comma (XdgAppTablePrinter *printer,
|
||||
const char *text);
|
||||
void xdg_app_table_printer_finish_row (XdgAppTablePrinter *printer);
|
||||
void xdg_app_table_printer_print (XdgAppTablePrinter *printer);
|
||||
FlatpakTablePrinter *flatpak_table_printer_new (void);
|
||||
void flatpak_table_printer_free (FlatpakTablePrinter *printer);
|
||||
void flatpak_table_printer_add_column (FlatpakTablePrinter *printer,
|
||||
const char *text);
|
||||
void flatpak_table_printer_append_with_comma (FlatpakTablePrinter *printer,
|
||||
const char *text);
|
||||
void flatpak_table_printer_finish_row (FlatpakTablePrinter *printer);
|
||||
void flatpak_table_printer_print (FlatpakTablePrinter *printer);
|
||||
|
||||
gboolean xdg_app_repo_set_title (OstreeRepo *repo,
|
||||
gboolean flatpak_repo_set_title (OstreeRepo *repo,
|
||||
const char *title,
|
||||
GError **error);
|
||||
gboolean xdg_app_repo_update (OstreeRepo *repo,
|
||||
gboolean flatpak_repo_update (OstreeRepo *repo,
|
||||
const char **gpg_key_ids,
|
||||
const char *gpg_homedir,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
gboolean xdg_app_repo_collect_sizes (OstreeRepo *repo,
|
||||
gboolean flatpak_repo_collect_sizes (OstreeRepo *repo,
|
||||
GFile *root,
|
||||
guint64 *installed_size,
|
||||
guint64 *download_size,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
|
||||
gboolean xdg_app_mtree_create_root (OstreeRepo *repo,
|
||||
gboolean flatpak_mtree_create_root (OstreeRepo *repo,
|
||||
OstreeMutableTree *mtree,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
|
||||
GVariant * xdg_app_bundle_load (GFile *file,
|
||||
GVariant * flatpak_bundle_load (GFile *file,
|
||||
char **commit,
|
||||
char **ref,
|
||||
char **origin,
|
||||
|
@ -213,7 +213,7 @@ GVariant * xdg_app_bundle_load (GFile *file,
|
|||
GBytes **gpg_keys,
|
||||
GError **error);
|
||||
|
||||
gboolean xdg_app_pull_from_bundle (OstreeRepo *repo,
|
||||
gboolean flatpak_pull_from_bundle (OstreeRepo *repo,
|
||||
GFile *file,
|
||||
const char *remote,
|
||||
const char *ref,
|
||||
|
@ -228,38 +228,38 @@ typedef struct
|
|||
char *installed_id;
|
||||
char *ref;
|
||||
char *directory;
|
||||
} XdgAppExtension;
|
||||
} FlatpakExtension;
|
||||
|
||||
void xdg_app_extension_free (XdgAppExtension *extension);
|
||||
void flatpak_extension_free (FlatpakExtension *extension);
|
||||
|
||||
GList *xdg_app_list_extensions (GKeyFile *metakey,
|
||||
GList *flatpak_list_extensions (GKeyFile *metakey,
|
||||
const char *arch,
|
||||
const char *branch);
|
||||
|
||||
gboolean xdg_app_spawn (GFile *dir,
|
||||
gboolean flatpak_spawn (GFile *dir,
|
||||
char **output,
|
||||
GError **error,
|
||||
const gchar *argv0,
|
||||
va_list args);
|
||||
|
||||
typedef enum {
|
||||
XDG_APP_CP_FLAGS_NONE = 0,
|
||||
XDG_APP_CP_FLAGS_MERGE = 1<<0,
|
||||
XDG_APP_CP_FLAGS_NO_CHOWN = 1<<1,
|
||||
XDG_APP_CP_FLAGS_MOVE = 1<<2,
|
||||
} XdgAppCpFlags;
|
||||
FLATPAK_CP_FLAGS_NONE = 0,
|
||||
FLATPAK_CP_FLAGS_MERGE = 1<<0,
|
||||
FLATPAK_CP_FLAGS_NO_CHOWN = 1<<1,
|
||||
FLATPAK_CP_FLAGS_MOVE = 1<<2,
|
||||
} FlatpakCpFlags;
|
||||
|
||||
gboolean xdg_app_cp_a (GFile *src,
|
||||
GFile *dest,
|
||||
XdgAppCpFlags flags,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
gboolean flatpak_cp_a (GFile *src,
|
||||
GFile *dest,
|
||||
FlatpakCpFlags flags,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
|
||||
|
||||
#define xdg_app_autorm_rf _GLIB_CLEANUP (g_autoptr_cleanup_generic_gfree)
|
||||
#define flatpak_autorm_rf _GLIB_CLEANUP (g_autoptr_cleanup_generic_gfree)
|
||||
|
||||
static inline void
|
||||
xdg_app_temp_dir_destroy (void *p)
|
||||
flatpak_temp_dir_destroy (void *p)
|
||||
{
|
||||
GFile *dir = p;
|
||||
|
||||
|
@ -270,11 +270,11 @@ xdg_app_temp_dir_destroy (void *p)
|
|||
}
|
||||
}
|
||||
|
||||
typedef GFile XdgAppTempDir;
|
||||
typedef GFile FlatpakTempDir;
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (XdgAppTempDir, xdg_app_temp_dir_destroy)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (FlatpakTempDir, flatpak_temp_dir_destroy)
|
||||
|
||||
#define AUTOLOCK(name) G_GNUC_UNUSED __attribute__((cleanup (xdg_app_auto_unlock_helper))) GMutex * G_PASTE (auto_unlock, __LINE__) = xdg_app_auto_lock_helper (&G_LOCK_NAME (name))
|
||||
#define AUTOLOCK(name) G_GNUC_UNUSED __attribute__((cleanup (flatpak_auto_unlock_helper))) GMutex * G_PASTE (auto_unlock, __LINE__) = flatpak_auto_lock_helper (&G_LOCK_NAME (name))
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (OstreeRepo, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (OstreeMutableTree, g_object_unref)
|
||||
|
@ -295,55 +295,55 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (SoupURI, soup_uri_free)
|
|||
typedef XdgAppSessionHelper AutoXdgAppSessionHelper;
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (AutoXdgAppSessionHelper, g_object_unref)
|
||||
|
||||
typedef struct XdgAppXml XdgAppXml;
|
||||
typedef struct FlatpakXml FlatpakXml;
|
||||
|
||||
struct XdgAppXml
|
||||
struct FlatpakXml
|
||||
{
|
||||
gchar *element_name; /* NULL == text */
|
||||
char **attribute_names;
|
||||
char **attribute_values;
|
||||
char *text;
|
||||
XdgAppXml *parent;
|
||||
XdgAppXml *first_child;
|
||||
XdgAppXml *last_child;
|
||||
XdgAppXml *next_sibling;
|
||||
gchar *element_name; /* NULL == text */
|
||||
char **attribute_names;
|
||||
char **attribute_values;
|
||||
char *text;
|
||||
FlatpakXml *parent;
|
||||
FlatpakXml *first_child;
|
||||
FlatpakXml *last_child;
|
||||
FlatpakXml *next_sibling;
|
||||
};
|
||||
|
||||
XdgAppXml *xdg_app_xml_new (const gchar *element_name);
|
||||
XdgAppXml *xdg_app_xml_new_text (const gchar *text);
|
||||
void xdg_app_xml_add (XdgAppXml *parent,
|
||||
XdgAppXml *node);
|
||||
void xdg_app_xml_free (XdgAppXml *node);
|
||||
XdgAppXml *xdg_app_xml_parse (GInputStream *in,
|
||||
gboolean compressed,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
void xdg_app_xml_to_string (XdgAppXml *node,
|
||||
GString *res);
|
||||
XdgAppXml *xdg_app_xml_unlink (XdgAppXml *node,
|
||||
XdgAppXml *prev_sibling);
|
||||
XdgAppXml *xdg_app_xml_find (XdgAppXml *node,
|
||||
const char *type,
|
||||
XdgAppXml **prev_child_out);
|
||||
FlatpakXml *flatpak_xml_new (const gchar *element_name);
|
||||
FlatpakXml *flatpak_xml_new_text (const gchar *text);
|
||||
void flatpak_xml_add (FlatpakXml *parent,
|
||||
FlatpakXml *node);
|
||||
void flatpak_xml_free (FlatpakXml *node);
|
||||
FlatpakXml *flatpak_xml_parse (GInputStream *in,
|
||||
gboolean compressed,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
void flatpak_xml_to_string (FlatpakXml *node,
|
||||
GString *res);
|
||||
FlatpakXml *flatpak_xml_unlink (FlatpakXml *node,
|
||||
FlatpakXml *prev_sibling);
|
||||
FlatpakXml *flatpak_xml_find (FlatpakXml *node,
|
||||
const char *type,
|
||||
FlatpakXml **prev_child_out);
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (XdgAppXml, xdg_app_xml_free);
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (FlatpakXml, flatpak_xml_free);
|
||||
|
||||
|
||||
XdgAppXml *xdg_app_appstream_xml_new (void);
|
||||
gboolean xdg_app_appstream_xml_migrate (XdgAppXml *source,
|
||||
XdgAppXml *dest,
|
||||
FlatpakXml *flatpak_appstream_xml_new (void);
|
||||
gboolean flatpak_appstream_xml_migrate (FlatpakXml *source,
|
||||
FlatpakXml *dest,
|
||||
const char *ref,
|
||||
const char *id,
|
||||
GKeyFile *metadata);
|
||||
GBytes *xdg_app_appstream_xml_root_to_data (XdgAppXml *appstream_root,
|
||||
GError **error);
|
||||
gboolean xdg_app_repo_generate_appstream (OstreeRepo *repo,
|
||||
GBytes *flatpak_appstream_xml_root_to_data (FlatpakXml *appstream_root,
|
||||
GError **error);
|
||||
gboolean flatpak_repo_generate_appstream (OstreeRepo *repo,
|
||||
const char **gpg_key_ids,
|
||||
const char *gpg_homedir,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
|
||||
gboolean xdg_app_allocate_tmpdir (int tmpdir_dfd,
|
||||
gboolean flatpak_allocate_tmpdir (int tmpdir_dfd,
|
||||
const char *tmpdir_relpath,
|
||||
const char *tmpdir_prefix,
|
||||
char **tmpdir_name_out,
|
||||
|
@ -354,4 +354,4 @@ gboolean xdg_app_allocate_tmpdir (int tmpdir_dfd,
|
|||
GError **error);
|
||||
|
||||
|
||||
#endif /* __XDG_APP_UTILS_H__ */
|
||||
#endif /* __FLATPAK_UTILS_H__ */
|
||||
|
|
68
configure.ac
68
configure.ac
|
@ -1,28 +1,28 @@
|
|||
AC_PREREQ([2.63])
|
||||
|
||||
# Making releases:
|
||||
# XDG_APP_MICRO_VERSION += 1;
|
||||
# XDG_APP_INTERFACE_AGE += 1;
|
||||
# XDG_APP_BINARY_AGE += 1;
|
||||
# if any functions have been added, set XDG_APP_INTERFACE_AGE to 0.
|
||||
# FLATPAK_MICRO_VERSION += 1;
|
||||
# FLATPAK_INTERFACE_AGE += 1;
|
||||
# FLATPAK_BINARY_AGE += 1;
|
||||
# if any functions have been added, set FLATPAK_INTERFACE_AGE to 0.
|
||||
# if backwards compatibility has been broken,
|
||||
# set XDG_APP_BINARY_AGE and XDG_APP_INTERFACE_AGE to 0.
|
||||
# set FLATPAK_BINARY_AGE and FLATPAK_INTERFACE_AGE to 0.
|
||||
#
|
||||
# in easier to understand terms:
|
||||
#
|
||||
# on the stable branch, interface age == micro
|
||||
# on the unstable (ie master), interface age = 0
|
||||
|
||||
m4_define([xdg_app_major_version], [0])
|
||||
m4_define([xdg_app_minor_version], [5])
|
||||
m4_define([xdg_app_micro_version], [2])
|
||||
m4_define([xdg_app_interface_age], [2])
|
||||
m4_define([xdg_app_binary_age],
|
||||
[m4_eval(10000 * xdg_app_major_version + 100 * xdg_app_minor_version + xdg_app_micro_version)])
|
||||
m4_define([xdg_app_version],
|
||||
[xdg_app_major_version.xdg_app_minor_version.xdg_app_micro_version])
|
||||
m4_define([flatpak_major_version], [0])
|
||||
m4_define([flatpak_minor_version], [5])
|
||||
m4_define([flatpak_micro_version], [2])
|
||||
m4_define([flatpak_interface_age], [2])
|
||||
m4_define([flatpak_binary_age],
|
||||
[m4_eval(10000 * flatpak_major_version + 100 * flatpak_minor_version + flatpak_micro_version)])
|
||||
m4_define([flatpak_version],
|
||||
[flatpak_major_version.flatpak_minor_version.flatpak_micro_version])
|
||||
|
||||
AC_INIT([xdg-app],[xdg_app_version])
|
||||
AC_INIT([flatpak],[flatpak_version])
|
||||
|
||||
AC_USE_SYSTEM_EXTENSIONS
|
||||
|
||||
|
@ -41,7 +41,7 @@ AC_CONFIG_MACRO_DIR([m4])
|
|||
AM_INIT_AUTOMAKE([1.11 no-define no-dist-gzip dist-xz tar-ustar foreign subdir-objects])
|
||||
AC_PROG_SED
|
||||
|
||||
GETTEXT_PACKAGE=XdgApp
|
||||
GETTEXT_PACKAGE=Flatpak
|
||||
AC_SUBST([GETTEXT_PACKAGE])
|
||||
AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[gettext domain])
|
||||
|
||||
|
@ -319,11 +319,11 @@ case "$host" in
|
|||
CFLAGS="${SAVED_CFLAGS}"
|
||||
|
||||
AS_IF([test "${enable_fvisibility_hidden}" = "yes"], [
|
||||
AC_DEFINE([XDG_APP_EXTERN], [__attribute__((visibility("default"))) extern],
|
||||
AC_DEFINE([FLATPAK_EXTERN], [__attribute__((visibility("default"))) extern],
|
||||
[defines how to decorate public symbols while building])
|
||||
HIDDEN_VISIBILITY_CFLAGS="-fvisibility=hidden"
|
||||
], [
|
||||
AC_DEFINE([XDG_APP_EXTERN], [extern],
|
||||
AC_DEFINE([FLATPAK_EXTERN], [extern],
|
||||
[defines how to decorate public symbols while building])
|
||||
])
|
||||
;;
|
||||
|
@ -332,27 +332,27 @@ AC_SUBST(HIDDEN_VISIBILITY_CFLAGS)
|
|||
|
||||
GLIB_TESTS
|
||||
|
||||
XDG_APP_MAJOR_VERSION=xdg_app_major_version
|
||||
XDG_APP_MINOR_VERSION=xdg_app_minor_version
|
||||
XDG_APP_MICRO_VERSION=xdg_app_micro_version
|
||||
XDG_APP_INTERFACE_AGE=xdg_app_interface_age
|
||||
XDG_APP_VERSION=xdg_app_version
|
||||
AC_SUBST(XDG_APP_MAJOR_VERSION)
|
||||
AC_SUBST(XDG_APP_MINOR_VERSION)
|
||||
AC_SUBST(XDG_APP_MICRO_VERSION)
|
||||
AC_SUBST(XDG_APP_INTERFACE_AGE)
|
||||
AC_SUBST(XDG_APP_VERSION)
|
||||
FLATPAK_MAJOR_VERSION=flatpak_major_version
|
||||
FLATPAK_MINOR_VERSION=flatpak_minor_version
|
||||
FLATPAK_MICRO_VERSION=flatpak_micro_version
|
||||
FLATPAK_INTERFACE_AGE=flatpak_interface_age
|
||||
FLATPAK_VERSION=flatpak_version
|
||||
AC_SUBST(FLATPAK_MAJOR_VERSION)
|
||||
AC_SUBST(FLATPAK_MINOR_VERSION)
|
||||
AC_SUBST(FLATPAK_MICRO_VERSION)
|
||||
AC_SUBST(FLATPAK_INTERFACE_AGE)
|
||||
AC_SUBST(FLATPAK_VERSION)
|
||||
|
||||
# libtool versioning
|
||||
#LT_RELEASE=$XDG_APP_MAJOR_VERSION.$XDG_APP_MINOR_VERSION
|
||||
#LT_CURRENT=`expr $XDG_APP_MICRO_VERSION - $XDG_APP_INTERFACE_AGE`
|
||||
#LT_REVISION=$XDG_APP_INTERFACE_AGE
|
||||
#LT_AGE=`expr $XDG_APP_BINARY_AGE - $XDG_APP_INTERFACE_AGE`
|
||||
#LT_RELEASE=$FLATPAK_MAJOR_VERSION.$FLATPAK_MINOR_VERSION
|
||||
#LT_CURRENT=`expr $FLATPAK_MICRO_VERSION - $FLATPAK_INTERFACE_AGE`
|
||||
#LT_REVISION=$FLATPAK_INTERFACE_AGE
|
||||
#LT_AGE=`expr $FLATPAK_BINARY_AGE - $FLATPAK_INTERFACE_AGE`
|
||||
#LT_CURRENT_MINUS_AGE=`expr $LT_CURRENT - $LT_AGE`
|
||||
|
||||
m4_define([lt_current], [m4_eval(10000 * xdg_app_major_version + 100 * xdg_app_minor_version + xdg_app_micro_version - xdg_app_interface_age)])
|
||||
m4_define([lt_revision], [xdg_app_interface_age])
|
||||
m4_define([lt_age], [m4_eval(xdg_app_binary_age - xdg_app_interface_age)])
|
||||
m4_define([lt_current], [m4_eval(10000 * flatpak_major_version + 100 * flatpak_minor_version + flatpak_micro_version - flatpak_interface_age)])
|
||||
m4_define([lt_revision], [flatpak_interface_age])
|
||||
m4_define([lt_age], [m4_eval(flatpak_binary_age - flatpak_interface_age)])
|
||||
LT_VERSION_INFO="lt_current:lt_revision:lt_age"
|
||||
LT_CURRENT_MINUS_AGE=m4_eval(lt_current - lt_age)
|
||||
AC_SUBST(LT_VERSION_INFO)
|
||||
|
|
|
@ -62,7 +62,7 @@ parse_generic_args (int n_args, const char *args[])
|
|||
int
|
||||
start_proxy (int n_args, const char *args[])
|
||||
{
|
||||
g_autoptr(XdgAppProxy) proxy = NULL;
|
||||
g_autoptr(FlatpakProxy) proxy = NULL;
|
||||
g_autoptr(GError) error = NULL;
|
||||
const char *bus_address, *socket_path;
|
||||
int n;
|
||||
|
@ -82,7 +82,7 @@ start_proxy (int n_args, const char *args[])
|
|||
}
|
||||
socket_path = args[n++];
|
||||
|
||||
proxy = xdg_app_proxy_new (bus_address, socket_path);
|
||||
proxy = flatpak_proxy_new (bus_address, socket_path);
|
||||
|
||||
while (n < n_args)
|
||||
{
|
||||
|
@ -93,14 +93,14 @@ start_proxy (int n_args, const char *args[])
|
|||
g_str_has_prefix (args[n], "--talk=") ||
|
||||
g_str_has_prefix (args[n], "--own="))
|
||||
{
|
||||
XdgAppPolicy policy = XDG_APP_POLICY_SEE;
|
||||
FlatpakPolicy policy = FLATPAK_POLICY_SEE;
|
||||
g_autofree char *name = NULL;
|
||||
gboolean wildcard = FALSE;
|
||||
|
||||
if (args[n][2] == 't')
|
||||
policy = XDG_APP_POLICY_TALK;
|
||||
policy = FLATPAK_POLICY_TALK;
|
||||
else if (args[n][2] == 'o')
|
||||
policy = XDG_APP_POLICY_OWN;
|
||||
policy = FLATPAK_POLICY_OWN;
|
||||
|
||||
name = g_strdup (strchr (args[n], '=') + 1);
|
||||
if (g_str_has_suffix (name, ".*"))
|
||||
|
@ -116,17 +116,17 @@ start_proxy (int n_args, const char *args[])
|
|||
}
|
||||
|
||||
if (wildcard)
|
||||
xdg_app_proxy_add_wildcarded_policy (proxy, name, policy);
|
||||
flatpak_proxy_add_wildcarded_policy (proxy, name, policy);
|
||||
else
|
||||
xdg_app_proxy_add_policy (proxy, name, policy);
|
||||
flatpak_proxy_add_policy (proxy, name, policy);
|
||||
}
|
||||
else if (g_str_equal (args[n], "--log"))
|
||||
{
|
||||
xdg_app_proxy_set_log_messages (proxy, TRUE);
|
||||
flatpak_proxy_set_log_messages (proxy, TRUE);
|
||||
}
|
||||
else if (g_str_equal (args[n], "--filter"))
|
||||
{
|
||||
xdg_app_proxy_set_filter (proxy, TRUE);
|
||||
flatpak_proxy_set_filter (proxy, TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -140,7 +140,7 @@ start_proxy (int n_args, const char *args[])
|
|||
n++;
|
||||
}
|
||||
|
||||
if (!xdg_app_proxy_start (proxy, &error))
|
||||
if (!flatpak_proxy_start (proxy, &error))
|
||||
{
|
||||
g_printerr ("Failed to start proxy for %s: %s\n", bus_address, error->message);
|
||||
return -1;
|
||||
|
@ -159,7 +159,7 @@ sync_closed_cb (GIOChannel *source,
|
|||
GList *l;
|
||||
|
||||
for (l = proxies; l != NULL; l = l->next)
|
||||
xdg_app_proxy_stop (XDG_APP_PROXY (l->data));
|
||||
flatpak_proxy_stop (FLATPAK_PROXY (l->data));
|
||||
|
||||
exit (0);
|
||||
return TRUE;
|
||||
|
|
|
@ -168,10 +168,10 @@
|
|||
* For unknown methods, we return a synthetic error.
|
||||
*/
|
||||
|
||||
typedef struct XdgAppProxyClient XdgAppProxyClient;
|
||||
typedef struct FlatpakProxyClient FlatpakProxyClient;
|
||||
|
||||
XdgAppPolicy xdg_app_proxy_get_policy (XdgAppProxy *proxy,
|
||||
const char *name);
|
||||
FlatpakPolicy flatpak_proxy_get_policy (FlatpakProxy *proxy,
|
||||
const char *name);
|
||||
|
||||
/* We start looking ignoring the first cr-lf
|
||||
since there is no previous line initially */
|
||||
|
@ -221,35 +221,35 @@ typedef struct
|
|||
|
||||
typedef struct
|
||||
{
|
||||
gboolean got_first_byte; /* always true on bus side */
|
||||
gboolean closed; /* always true on bus side */
|
||||
gboolean got_first_byte; /* always true on bus side */
|
||||
gboolean closed; /* always true on bus side */
|
||||
|
||||
XdgAppProxyClient *client;
|
||||
GSocketConnection *connection;
|
||||
GSource *in_source;
|
||||
GSource *out_source;
|
||||
FlatpakProxyClient *client;
|
||||
GSocketConnection *connection;
|
||||
GSource *in_source;
|
||||
GSource *out_source;
|
||||
|
||||
GBytes *extra_input_data;
|
||||
Buffer *current_read_buffer;
|
||||
Buffer header_buffer;
|
||||
GBytes *extra_input_data;
|
||||
Buffer *current_read_buffer;
|
||||
Buffer header_buffer;
|
||||
|
||||
GList *buffers; /* to be sent */
|
||||
GList *control_messages;
|
||||
GList *buffers; /* to be sent */
|
||||
GList *control_messages;
|
||||
|
||||
GHashTable *expected_replies;
|
||||
GHashTable *expected_replies;
|
||||
} ProxySide;
|
||||
|
||||
struct XdgAppProxyClient
|
||||
struct FlatpakProxyClient
|
||||
{
|
||||
GObject parent;
|
||||
GObject parent;
|
||||
|
||||
XdgAppProxy *proxy;
|
||||
FlatpakProxy *proxy;
|
||||
|
||||
gboolean authenticated;
|
||||
int auth_end_offset;
|
||||
gboolean authenticated;
|
||||
int auth_end_offset;
|
||||
|
||||
ProxySide client_side;
|
||||
ProxySide bus_side;
|
||||
ProxySide client_side;
|
||||
ProxySide bus_side;
|
||||
|
||||
/* Filtering data: */
|
||||
guint32 serial_offset;
|
||||
|
@ -264,9 +264,9 @@ struct XdgAppProxyClient
|
|||
typedef struct
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
} XdgAppProxyClientClass;
|
||||
} FlatpakProxyClientClass;
|
||||
|
||||
struct XdgAppProxy
|
||||
struct FlatpakProxy
|
||||
{
|
||||
GSocketService parent;
|
||||
|
||||
|
@ -285,7 +285,7 @@ struct XdgAppProxy
|
|||
typedef struct
|
||||
{
|
||||
GSocketServiceClass parent_class;
|
||||
} XdgAppProxyClass;
|
||||
} FlatpakProxyClass;
|
||||
|
||||
|
||||
enum {
|
||||
|
@ -295,19 +295,19 @@ enum {
|
|||
PROP_SOCKET_PATH
|
||||
};
|
||||
|
||||
#define XDG_APP_TYPE_PROXY xdg_app_proxy_get_type ()
|
||||
#define XDG_APP_PROXY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), XDG_APP_TYPE_PROXY, XdgAppProxy))
|
||||
#define XDG_APP_IS_PROXY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), XDG_APP_TYPE_PROXY))
|
||||
#define FLATPAK_TYPE_PROXY flatpak_proxy_get_type ()
|
||||
#define FLATPAK_PROXY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FLATPAK_TYPE_PROXY, FlatpakProxy))
|
||||
#define FLATPAK_IS_PROXY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FLATPAK_TYPE_PROXY))
|
||||
|
||||
|
||||
#define XDG_APP_TYPE_PROXY_CLIENT xdg_app_proxy_client_get_type ()
|
||||
#define XDG_APP_PROXY_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), XDG_APP_TYPE_PROXY_CLIENT, XdgAppProxyClient))
|
||||
#define XDG_APP_IS_PROXY_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), XDG_APP_TYPE_PROXY_CLIENT))
|
||||
#define FLATPAK_TYPE_PROXY_CLIENT flatpak_proxy_client_get_type ()
|
||||
#define FLATPAK_PROXY_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FLATPAK_TYPE_PROXY_CLIENT, FlatpakProxyClient))
|
||||
#define FLATPAK_IS_PROXY_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FLATPAK_TYPE_PROXY_CLIENT))
|
||||
|
||||
GType xdg_app_proxy_client_get_type (void);
|
||||
GType flatpak_proxy_client_get_type (void);
|
||||
|
||||
G_DEFINE_TYPE (XdgAppProxy, xdg_app_proxy, G_TYPE_SOCKET_SERVICE)
|
||||
G_DEFINE_TYPE (XdgAppProxyClient, xdg_app_proxy_client, G_TYPE_OBJECT)
|
||||
G_DEFINE_TYPE (FlatpakProxy, flatpak_proxy, G_TYPE_SOCKET_SERVICE)
|
||||
G_DEFINE_TYPE (FlatpakProxyClient, flatpak_proxy_client, G_TYPE_OBJECT)
|
||||
|
||||
static void start_reading (ProxySide *side);
|
||||
static void stop_reading (ProxySide *side);
|
||||
|
@ -337,9 +337,9 @@ free_side (ProxySide *side)
|
|||
}
|
||||
|
||||
static void
|
||||
xdg_app_proxy_client_finalize (GObject *object)
|
||||
flatpak_proxy_client_finalize (GObject *object)
|
||||
{
|
||||
XdgAppProxyClient *client = XDG_APP_PROXY_CLIENT (object);
|
||||
FlatpakProxyClient *client = FLATPAK_PROXY_CLIENT (object);
|
||||
|
||||
client->proxy->clients = g_list_remove (client->proxy->clients, client);
|
||||
g_clear_object (&client->proxy);
|
||||
|
@ -351,19 +351,19 @@ xdg_app_proxy_client_finalize (GObject *object)
|
|||
free_side (&client->client_side);
|
||||
free_side (&client->bus_side);
|
||||
|
||||
G_OBJECT_CLASS (xdg_app_proxy_client_parent_class)->finalize (object);
|
||||
G_OBJECT_CLASS (flatpak_proxy_client_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
xdg_app_proxy_client_class_init (XdgAppProxyClientClass *klass)
|
||||
flatpak_proxy_client_class_init (FlatpakProxyClientClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->finalize = xdg_app_proxy_client_finalize;
|
||||
object_class->finalize = flatpak_proxy_client_finalize;
|
||||
}
|
||||
|
||||
static void
|
||||
init_side (XdgAppProxyClient *client, ProxySide *side)
|
||||
init_side (FlatpakProxyClient *client, ProxySide *side)
|
||||
{
|
||||
side->got_first_byte = (side == &client->bus_side);
|
||||
side->client = client;
|
||||
|
@ -374,7 +374,7 @@ init_side (XdgAppProxyClient *client, ProxySide *side)
|
|||
}
|
||||
|
||||
static void
|
||||
xdg_app_proxy_client_init (XdgAppProxyClient *client)
|
||||
flatpak_proxy_client_init (FlatpakProxyClient *client)
|
||||
{
|
||||
init_side (client, &client->client_side);
|
||||
init_side (client, &client->bus_side);
|
||||
|
@ -385,14 +385,14 @@ xdg_app_proxy_client_init (XdgAppProxyClient *client)
|
|||
client->unique_id_policy = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
|
||||
}
|
||||
|
||||
XdgAppProxyClient *
|
||||
xdg_app_proxy_client_new (XdgAppProxy *proxy, GSocketConnection *connection)
|
||||
FlatpakProxyClient *
|
||||
flatpak_proxy_client_new (FlatpakProxy *proxy, GSocketConnection *connection)
|
||||
{
|
||||
XdgAppProxyClient *client;
|
||||
FlatpakProxyClient *client;
|
||||
|
||||
g_socket_set_blocking (g_socket_connection_get_socket (connection), FALSE);
|
||||
|
||||
client = g_object_new (XDG_APP_TYPE_PROXY_CLIENT, NULL);
|
||||
client = g_object_new (FLATPAK_TYPE_PROXY_CLIENT, NULL);
|
||||
client->proxy = g_object_ref (proxy);
|
||||
client->client_side.connection = g_object_ref (connection);
|
||||
|
||||
|
@ -401,9 +401,9 @@ xdg_app_proxy_client_new (XdgAppProxy *proxy, GSocketConnection *connection)
|
|||
return client;
|
||||
}
|
||||
|
||||
static XdgAppPolicy
|
||||
xdg_app_proxy_get_wildcard_policy (XdgAppProxy *proxy,
|
||||
const char *name)
|
||||
static FlatpakPolicy
|
||||
flatpak_proxy_get_wildcard_policy (FlatpakProxy *proxy,
|
||||
const char *name)
|
||||
{
|
||||
guint wildcard_policy = 0;
|
||||
char *dot;
|
||||
|
@ -420,53 +420,53 @@ xdg_app_proxy_get_wildcard_policy (XdgAppProxy *proxy,
|
|||
return wildcard_policy;
|
||||
}
|
||||
|
||||
XdgAppPolicy
|
||||
xdg_app_proxy_get_policy (XdgAppProxy *proxy,
|
||||
const char *name)
|
||||
FlatpakPolicy
|
||||
flatpak_proxy_get_policy (FlatpakProxy *proxy,
|
||||
const char *name)
|
||||
{
|
||||
guint policy, wildcard_policy;
|
||||
|
||||
policy = GPOINTER_TO_INT (g_hash_table_lookup (proxy->policy, name));
|
||||
|
||||
wildcard_policy = xdg_app_proxy_get_wildcard_policy (proxy, name);
|
||||
wildcard_policy = flatpak_proxy_get_wildcard_policy (proxy, name);
|
||||
|
||||
return MAX (policy, wildcard_policy);
|
||||
}
|
||||
|
||||
void
|
||||
xdg_app_proxy_set_filter (XdgAppProxy *proxy,
|
||||
gboolean filter)
|
||||
flatpak_proxy_set_filter (FlatpakProxy *proxy,
|
||||
gboolean filter)
|
||||
{
|
||||
proxy->filter = filter;
|
||||
}
|
||||
|
||||
void
|
||||
xdg_app_proxy_set_log_messages (XdgAppProxy *proxy,
|
||||
gboolean log)
|
||||
flatpak_proxy_set_log_messages (FlatpakProxy *proxy,
|
||||
gboolean log)
|
||||
{
|
||||
proxy->log_messages = log;
|
||||
}
|
||||
|
||||
void
|
||||
xdg_app_proxy_add_policy (XdgAppProxy *proxy,
|
||||
const char *name,
|
||||
XdgAppPolicy policy)
|
||||
flatpak_proxy_add_policy (FlatpakProxy *proxy,
|
||||
const char *name,
|
||||
FlatpakPolicy policy)
|
||||
{
|
||||
g_hash_table_replace (proxy->policy, g_strdup (name), GINT_TO_POINTER (policy));
|
||||
}
|
||||
|
||||
void
|
||||
xdg_app_proxy_add_wildcarded_policy (XdgAppProxy *proxy,
|
||||
const char *name,
|
||||
XdgAppPolicy policy)
|
||||
flatpak_proxy_add_wildcarded_policy (FlatpakProxy *proxy,
|
||||
const char *name,
|
||||
FlatpakPolicy policy)
|
||||
{
|
||||
g_hash_table_replace (proxy->wildcard_policy, g_strdup (name), GINT_TO_POINTER (policy));
|
||||
}
|
||||
|
||||
static void
|
||||
xdg_app_proxy_finalize (GObject *object)
|
||||
flatpak_proxy_finalize (GObject *object)
|
||||
{
|
||||
XdgAppProxy *proxy = XDG_APP_PROXY (object);
|
||||
FlatpakProxy *proxy = FLATPAK_PROXY (object);
|
||||
|
||||
if (g_socket_service_is_active (G_SOCKET_SERVICE (proxy)))
|
||||
unlink (proxy->socket_path);
|
||||
|
@ -480,16 +480,16 @@ xdg_app_proxy_finalize (GObject *object)
|
|||
g_free (proxy->socket_path);
|
||||
g_free (proxy->dbus_address);
|
||||
|
||||
G_OBJECT_CLASS (xdg_app_proxy_parent_class)->finalize (object);
|
||||
G_OBJECT_CLASS (flatpak_proxy_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
xdg_app_proxy_set_property (GObject *object,
|
||||
flatpak_proxy_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
XdgAppProxy *proxy = XDG_APP_PROXY (object);
|
||||
FlatpakProxy *proxy = FLATPAK_PROXY (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
|
@ -508,12 +508,12 @@ xdg_app_proxy_set_property (GObject *object,
|
|||
}
|
||||
|
||||
static void
|
||||
xdg_app_proxy_get_property (GObject *object,
|
||||
flatpak_proxy_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
XdgAppProxy *proxy = XDG_APP_PROXY (object);
|
||||
FlatpakProxy *proxy = FLATPAK_PROXY (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
|
@ -556,7 +556,7 @@ buffer_new (gsize size, Buffer *old)
|
|||
static ProxySide *
|
||||
get_other_side (ProxySide *side)
|
||||
{
|
||||
XdgAppProxyClient *client = side->client;
|
||||
FlatpakProxyClient *client = side->client;
|
||||
|
||||
if (side == &client->client_side)
|
||||
return &client->bus_side;
|
||||
|
@ -751,7 +751,7 @@ static gboolean
|
|||
side_out_cb (GSocket *socket, GIOCondition condition, gpointer user_data)
|
||||
{
|
||||
ProxySide *side = user_data;
|
||||
XdgAppProxyClient *client = side->client;
|
||||
FlatpakProxyClient *client = side->client;
|
||||
gboolean retval = G_SOURCE_CONTINUE;
|
||||
|
||||
g_object_ref (client);
|
||||
|
@ -1183,26 +1183,26 @@ print_incoming_header (Header *header)
|
|||
}
|
||||
}
|
||||
|
||||
static XdgAppPolicy
|
||||
xdg_app_proxy_client_get_policy (XdgAppProxyClient *client, const char *source)
|
||||
static FlatpakPolicy
|
||||
flatpak_proxy_client_get_policy (FlatpakProxyClient *client, const char *source)
|
||||
{
|
||||
if (source == NULL)
|
||||
return XDG_APP_POLICY_TALK; /* All clients can talk to the bus itself */
|
||||
return FLATPAK_POLICY_TALK; /* All clients can talk to the bus itself */
|
||||
|
||||
if (source[0] == ':')
|
||||
return GPOINTER_TO_UINT (g_hash_table_lookup (client->unique_id_policy, source));
|
||||
|
||||
return xdg_app_proxy_get_policy (client->proxy, source);
|
||||
return flatpak_proxy_get_policy (client->proxy, source);
|
||||
}
|
||||
|
||||
static void
|
||||
xdg_app_proxy_client_update_unique_id_policy (XdgAppProxyClient *client,
|
||||
const char *unique_id,
|
||||
XdgAppPolicy policy)
|
||||
flatpak_proxy_client_update_unique_id_policy (FlatpakProxyClient *client,
|
||||
const char *unique_id,
|
||||
FlatpakPolicy policy)
|
||||
{
|
||||
if (policy > XDG_APP_POLICY_NONE)
|
||||
if (policy > FLATPAK_POLICY_NONE)
|
||||
{
|
||||
XdgAppPolicy old_policy;
|
||||
FlatpakPolicy old_policy;
|
||||
old_policy = GPOINTER_TO_UINT (g_hash_table_lookup (client->unique_id_policy, unique_id));
|
||||
if (policy > old_policy)
|
||||
g_hash_table_replace (client->unique_id_policy, g_strdup (unique_id), GINT_TO_POINTER (policy));
|
||||
|
@ -1210,13 +1210,13 @@ xdg_app_proxy_client_update_unique_id_policy (XdgAppProxyClient *client,
|
|||
}
|
||||
|
||||
static void
|
||||
xdg_app_proxy_client_update_unique_id_policy_from_name (XdgAppProxyClient *client,
|
||||
const char *unique_id,
|
||||
const char *as_name)
|
||||
flatpak_proxy_client_update_unique_id_policy_from_name (FlatpakProxyClient *client,
|
||||
const char *unique_id,
|
||||
const char *as_name)
|
||||
{
|
||||
xdg_app_proxy_client_update_unique_id_policy (client,
|
||||
flatpak_proxy_client_update_unique_id_policy (client,
|
||||
unique_id,
|
||||
xdg_app_proxy_get_policy (client->proxy, as_name));
|
||||
flatpak_proxy_get_policy (client->proxy, as_name));
|
||||
}
|
||||
|
||||
|
||||
|
@ -1252,7 +1252,7 @@ message_to_buffer (GDBusMessage *message)
|
|||
}
|
||||
|
||||
static GDBusMessage *
|
||||
get_error_for_header (XdgAppProxyClient *client, Header *header, const char *error)
|
||||
get_error_for_header (FlatpakProxyClient *client, Header *header, const char *error)
|
||||
{
|
||||
GDBusMessage *reply;
|
||||
|
||||
|
@ -1267,7 +1267,7 @@ get_error_for_header (XdgAppProxyClient *client, Header *header, const char *err
|
|||
}
|
||||
|
||||
static GDBusMessage *
|
||||
get_bool_reply_for_header (XdgAppProxyClient *client, Header *header, gboolean val)
|
||||
get_bool_reply_for_header (FlatpakProxyClient *client, Header *header, gboolean val)
|
||||
{
|
||||
GDBusMessage *reply;
|
||||
|
||||
|
@ -1298,7 +1298,7 @@ get_ping_buffer_for_header (Header *header)
|
|||
}
|
||||
|
||||
static Buffer *
|
||||
get_error_for_roundtrip (XdgAppProxyClient *client, Header *header, const char *error_name)
|
||||
get_error_for_roundtrip (FlatpakProxyClient *client, Header *header, const char *error_name)
|
||||
{
|
||||
Buffer *ping_buffer = get_ping_buffer_for_header (header);
|
||||
GDBusMessage *reply;
|
||||
|
@ -1309,7 +1309,7 @@ get_error_for_roundtrip (XdgAppProxyClient *client, Header *header, const char *
|
|||
}
|
||||
|
||||
static Buffer *
|
||||
get_bool_reply_for_roundtrip (XdgAppProxyClient *client, Header *header, gboolean val)
|
||||
get_bool_reply_for_roundtrip (FlatpakProxyClient *client, Header *header, gboolean val)
|
||||
{
|
||||
Buffer *ping_buffer = get_ping_buffer_for_header (header);
|
||||
GDBusMessage *reply;
|
||||
|
@ -1342,9 +1342,9 @@ is_dbus_method_call (Header *header)
|
|||
}
|
||||
|
||||
static BusHandler
|
||||
get_dbus_method_handler (XdgAppProxyClient *client, Header *header)
|
||||
get_dbus_method_handler (FlatpakProxyClient *client, Header *header)
|
||||
{
|
||||
XdgAppPolicy policy;
|
||||
FlatpakPolicy policy;
|
||||
const char *method;
|
||||
|
||||
if (header->has_reply_serial)
|
||||
|
@ -1358,10 +1358,10 @@ get_dbus_method_handler (XdgAppProxyClient *client, Header *header)
|
|||
return HANDLE_PASS;
|
||||
}
|
||||
|
||||
policy = xdg_app_proxy_client_get_policy (client, header->destination);
|
||||
if (policy < XDG_APP_POLICY_SEE)
|
||||
policy = flatpak_proxy_client_get_policy (client, header->destination);
|
||||
if (policy < FLATPAK_POLICY_SEE)
|
||||
return HANDLE_HIDE;
|
||||
if (policy < XDG_APP_POLICY_TALK)
|
||||
if (policy < FLATPAK_POLICY_TALK)
|
||||
return HANDLE_DENY;
|
||||
|
||||
if (!is_dbus_method_call (header))
|
||||
|
@ -1410,22 +1410,22 @@ get_dbus_method_handler (XdgAppProxyClient *client, Header *header)
|
|||
return HANDLE_DENY;
|
||||
}
|
||||
|
||||
static XdgAppPolicy
|
||||
static FlatpakPolicy
|
||||
policy_from_handler (BusHandler handler)
|
||||
{
|
||||
switch (handler)
|
||||
{
|
||||
case HANDLE_VALIDATE_OWN:
|
||||
return XDG_APP_POLICY_OWN;
|
||||
return FLATPAK_POLICY_OWN;
|
||||
|
||||
case HANDLE_VALIDATE_TALK:
|
||||
return XDG_APP_POLICY_TALK;
|
||||
return FLATPAK_POLICY_TALK;
|
||||
|
||||
case HANDLE_VALIDATE_SEE:
|
||||
return XDG_APP_POLICY_SEE;
|
||||
return FLATPAK_POLICY_SEE;
|
||||
|
||||
default:
|
||||
return XDG_APP_POLICY_NONE;
|
||||
return FLATPAK_POLICY_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1448,16 +1448,16 @@ get_arg0_string (Buffer *buffer)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
validate_arg0_name (XdgAppProxyClient *client, Buffer *buffer, XdgAppPolicy required_policy, XdgAppPolicy *has_policy)
|
||||
validate_arg0_name (FlatpakProxyClient *client, Buffer *buffer, FlatpakPolicy required_policy, FlatpakPolicy *has_policy)
|
||||
{
|
||||
GDBusMessage *message = g_dbus_message_new_from_blob (buffer->data, buffer->size, 0, NULL);
|
||||
GVariant *body, *arg0;
|
||||
const char *name;
|
||||
XdgAppPolicy name_policy;
|
||||
FlatpakPolicy name_policy;
|
||||
gboolean res = FALSE;
|
||||
|
||||
if (has_policy)
|
||||
*has_policy = XDG_APP_POLICY_NONE;
|
||||
*has_policy = FLATPAK_POLICY_NONE;
|
||||
|
||||
if (message != NULL &&
|
||||
(body = g_dbus_message_get_body (message)) != NULL &&
|
||||
|
@ -1465,7 +1465,7 @@ validate_arg0_name (XdgAppProxyClient *client, Buffer *buffer, XdgAppPolicy requ
|
|||
g_variant_is_of_type (arg0, G_VARIANT_TYPE_STRING))
|
||||
{
|
||||
name = g_variant_get_string (arg0, NULL);
|
||||
name_policy = xdg_app_proxy_client_get_policy (client, name);
|
||||
name_policy = flatpak_proxy_client_get_policy (client, name);
|
||||
|
||||
if (has_policy)
|
||||
*has_policy = name_policy;
|
||||
|
@ -1481,7 +1481,7 @@ validate_arg0_name (XdgAppProxyClient *client, Buffer *buffer, XdgAppPolicy requ
|
|||
}
|
||||
|
||||
static Buffer *
|
||||
filter_names_list (XdgAppProxyClient *client, Buffer *buffer)
|
||||
filter_names_list (FlatpakProxyClient *client, Buffer *buffer)
|
||||
{
|
||||
GDBusMessage *message = g_dbus_message_new_from_blob (buffer->data, buffer->size, 0, NULL);
|
||||
GVariant *body, *arg0, *new_names;
|
||||
|
@ -1501,7 +1501,7 @@ filter_names_list (XdgAppProxyClient *client, Buffer *buffer)
|
|||
g_variant_builder_init (&builder, G_VARIANT_TYPE_STRING_ARRAY);
|
||||
for (i = 0; names[i] != NULL; i++)
|
||||
{
|
||||
if (xdg_app_proxy_client_get_policy (client, names[i]) >= XDG_APP_POLICY_SEE)
|
||||
if (flatpak_proxy_client_get_policy (client, names[i]) >= FLATPAK_POLICY_SEE)
|
||||
g_variant_builder_add (&builder, "s", names[i]);
|
||||
}
|
||||
g_free (names);
|
||||
|
@ -1516,7 +1516,7 @@ filter_names_list (XdgAppProxyClient *client, Buffer *buffer)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
message_is_name_owner_changed (XdgAppProxyClient *client, Header *header)
|
||||
message_is_name_owner_changed (FlatpakProxyClient *client, Header *header)
|
||||
{
|
||||
if (header->type == G_DBUS_MESSAGE_TYPE_SIGNAL &&
|
||||
g_strcmp0 (header->sender, "org.freedesktop.DBus") == 0 &&
|
||||
|
@ -1527,7 +1527,7 @@ message_is_name_owner_changed (XdgAppProxyClient *client, Header *header)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
should_filter_name_owner_changed (XdgAppProxyClient *client, Buffer *buffer)
|
||||
should_filter_name_owner_changed (FlatpakProxyClient *client, Buffer *buffer)
|
||||
{
|
||||
GDBusMessage *message = g_dbus_message_new_from_blob (buffer->data, buffer->size, 0, NULL);
|
||||
GVariant *body, *arg0, *arg1, *arg2;
|
||||
|
@ -1548,15 +1548,15 @@ should_filter_name_owner_changed (XdgAppProxyClient *client, Buffer *buffer)
|
|||
old = g_variant_get_string (arg1, NULL);
|
||||
new = g_variant_get_string (arg2, NULL);
|
||||
|
||||
if (xdg_app_proxy_client_get_policy (client, name) >= XDG_APP_POLICY_SEE)
|
||||
if (flatpak_proxy_client_get_policy (client, name) >= FLATPAK_POLICY_SEE)
|
||||
{
|
||||
if (name[0] != ':')
|
||||
{
|
||||
if (old[0] != 0)
|
||||
xdg_app_proxy_client_update_unique_id_policy_from_name (client, old, name);
|
||||
flatpak_proxy_client_update_unique_id_policy_from_name (client, old, name);
|
||||
|
||||
if (new[0] != 0)
|
||||
xdg_app_proxy_client_update_unique_id_policy_from_name (client, new, name);
|
||||
flatpak_proxy_client_update_unique_id_policy_from_name (client, new, name);
|
||||
}
|
||||
|
||||
filter = FALSE;
|
||||
|
@ -1629,7 +1629,7 @@ update_socket_messages (ProxySide *side, Buffer *buffer, Header *header)
|
|||
}
|
||||
|
||||
static void
|
||||
queue_fake_message (XdgAppProxyClient *client, GDBusMessage *message, ExpectedReplyType reply_type)
|
||||
queue_fake_message (FlatpakProxyClient *client, GDBusMessage *message, ExpectedReplyType reply_type)
|
||||
{
|
||||
Buffer *buffer;
|
||||
|
||||
|
@ -1646,7 +1646,7 @@ queue_fake_message (XdgAppProxyClient *client, GDBusMessage *message, ExpectedRe
|
|||
/* After the first Hello message we need to synthesize a bunch of messages to synchronize the
|
||||
ownership state for the names in the policy */
|
||||
static void
|
||||
queue_initial_name_ops (XdgAppProxyClient *client)
|
||||
queue_initial_name_ops (FlatpakProxyClient *client)
|
||||
{
|
||||
GHashTableIter iter;
|
||||
gpointer key, value;
|
||||
|
@ -1724,7 +1724,7 @@ queue_initial_name_ops (XdgAppProxyClient *client)
|
|||
}
|
||||
|
||||
static void
|
||||
queue_wildcard_initial_name_ops (XdgAppProxyClient *client, Header *header, Buffer *buffer)
|
||||
queue_wildcard_initial_name_ops (FlatpakProxyClient *client, Header *header, Buffer *buffer)
|
||||
{
|
||||
GDBusMessage *decoded_message = g_dbus_message_new_from_blob (buffer->data, buffer->size, 0, NULL);
|
||||
GVariant *body, *arg0;
|
||||
|
@ -1745,7 +1745,7 @@ queue_wildcard_initial_name_ops (XdgAppProxyClient *client, Header *header, Buff
|
|||
const char *name = names[i];
|
||||
|
||||
if (name[0] != ':' &&
|
||||
xdg_app_proxy_get_wildcard_policy (client->proxy, name) != XDG_APP_POLICY_NONE)
|
||||
flatpak_proxy_get_wildcard_policy (client->proxy, name) != FLATPAK_POLICY_NONE)
|
||||
{
|
||||
/* Get the current owner of the name (if any) so we can apply policy to it */
|
||||
GDBusMessage *message = g_dbus_message_new_method_call ("org.freedesktop.DBus", "/", "org.freedesktop.DBus", "GetNameOwner");
|
||||
|
@ -1765,7 +1765,7 @@ queue_wildcard_initial_name_ops (XdgAppProxyClient *client, Header *header, Buff
|
|||
|
||||
|
||||
static void
|
||||
got_buffer_from_client (XdgAppProxyClient *client, ProxySide *side, Buffer *buffer)
|
||||
got_buffer_from_client (FlatpakProxyClient *client, ProxySide *side, Buffer *buffer)
|
||||
{
|
||||
ExpectedReplyType expecting_reply = EXPECTED_REPLY_NONE;
|
||||
|
||||
|
@ -1816,7 +1816,7 @@ got_buffer_from_client (XdgAppProxyClient *client, ProxySide *side, Buffer *buff
|
|||
{
|
||||
case HANDLE_FILTER_HAS_OWNER_REPLY:
|
||||
case HANDLE_FILTER_GET_OWNER_REPLY:
|
||||
if (!validate_arg0_name (client, buffer, XDG_APP_POLICY_SEE, NULL))
|
||||
if (!validate_arg0_name (client, buffer, FLATPAK_POLICY_SEE, NULL))
|
||||
{
|
||||
g_clear_pointer (&buffer, buffer_free);
|
||||
if (handler == HANDLE_FILTER_GET_OWNER_REPLY)
|
||||
|
@ -1835,11 +1835,11 @@ got_buffer_from_client (XdgAppProxyClient *client, ProxySide *side, Buffer *buff
|
|||
case HANDLE_VALIDATE_SEE:
|
||||
case HANDLE_VALIDATE_TALK:
|
||||
{
|
||||
XdgAppPolicy name_policy;
|
||||
FlatpakPolicy name_policy;
|
||||
if (validate_arg0_name (client, buffer, policy_from_handler (handler), &name_policy))
|
||||
goto handle_pass;
|
||||
|
||||
if (name_policy < (int) XDG_APP_POLICY_SEE)
|
||||
if (name_policy < (int) FLATPAK_POLICY_SEE)
|
||||
goto handle_hide;
|
||||
else
|
||||
goto handle_deny;
|
||||
|
@ -1920,13 +1920,13 @@ handle_deny:
|
|||
}
|
||||
|
||||
static void
|
||||
got_buffer_from_bus (XdgAppProxyClient *client, ProxySide *side, Buffer *buffer)
|
||||
got_buffer_from_bus (FlatpakProxyClient *client, ProxySide *side, Buffer *buffer)
|
||||
{
|
||||
if (client->authenticated && client->proxy->filter)
|
||||
{
|
||||
Header header;
|
||||
GDBusMessage *rewritten;
|
||||
XdgAppPolicy policy;
|
||||
FlatpakPolicy policy;
|
||||
ExpectedReplyType expected_reply;
|
||||
|
||||
/* Filter and rewrite incomming messages as needed */
|
||||
|
@ -1966,7 +1966,7 @@ got_buffer_from_bus (XdgAppProxyClient *client, ProxySide *side, Buffer *buffer)
|
|||
if (header.type == G_DBUS_MESSAGE_TYPE_METHOD_RETURN)
|
||||
{
|
||||
char *my_id = get_arg0_string (buffer);
|
||||
xdg_app_proxy_client_update_unique_id_policy (client, my_id, XDG_APP_POLICY_TALK);
|
||||
flatpak_proxy_client_update_unique_id_policy (client, my_id, FLATPAK_POLICY_TALK);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -2013,7 +2013,7 @@ got_buffer_from_bus (XdgAppProxyClient *client, ProxySide *side, Buffer *buffer)
|
|||
if (header.type == G_DBUS_MESSAGE_TYPE_METHOD_RETURN)
|
||||
{
|
||||
char *owner = get_arg0_string (buffer);
|
||||
xdg_app_proxy_client_update_unique_id_policy_from_name (client, owner, requested_name);
|
||||
flatpak_proxy_client_update_unique_id_policy_from_name (client, owner, requested_name);
|
||||
g_free (owner);
|
||||
}
|
||||
|
||||
|
@ -2076,8 +2076,8 @@ got_buffer_from_bus (XdgAppProxyClient *client, ProxySide *side, Buffer *buffer)
|
|||
/* All incoming broadcast signals are filtered according to policy */
|
||||
if (header.type == G_DBUS_MESSAGE_TYPE_SIGNAL && header.destination == NULL)
|
||||
{
|
||||
policy = xdg_app_proxy_client_get_policy (client, header.sender);
|
||||
if (policy < XDG_APP_POLICY_TALK)
|
||||
policy = flatpak_proxy_client_get_policy (client, header.sender);
|
||||
if (policy < FLATPAK_POLICY_TALK)
|
||||
{
|
||||
if (client->proxy->log_messages)
|
||||
g_print ("*FILTERED IN*\n");
|
||||
|
@ -2088,7 +2088,7 @@ got_buffer_from_bus (XdgAppProxyClient *client, ProxySide *side, Buffer *buffer)
|
|||
/* We received and forwarded a message from a trusted peer. Make the policy for
|
||||
this unique id SEE so that the client can track its lifetime. */
|
||||
if (buffer && header.sender && header.sender[0] == ':')
|
||||
xdg_app_proxy_client_update_unique_id_policy (client, header.sender, XDG_APP_POLICY_SEE);
|
||||
flatpak_proxy_client_update_unique_id_policy (client, header.sender, FLATPAK_POLICY_SEE);
|
||||
|
||||
if (buffer && client_message_generates_reply (&header))
|
||||
queue_expected_reply (side, header.serial, EXPECTED_REPLY_NORMAL);
|
||||
|
@ -2101,7 +2101,7 @@ got_buffer_from_bus (XdgAppProxyClient *client, ProxySide *side, Buffer *buffer)
|
|||
static void
|
||||
got_buffer_from_side (ProxySide *side, Buffer *buffer)
|
||||
{
|
||||
XdgAppProxyClient *client = side->client;
|
||||
FlatpakProxyClient *client = side->client;
|
||||
|
||||
if (side == &client->client_side)
|
||||
got_buffer_from_client (client, side, buffer);
|
||||
|
@ -2110,7 +2110,7 @@ got_buffer_from_side (ProxySide *side, Buffer *buffer)
|
|||
}
|
||||
|
||||
static gssize
|
||||
find_auth_end (XdgAppProxyClient *client, Buffer *buffer)
|
||||
find_auth_end (FlatpakProxyClient *client, Buffer *buffer)
|
||||
{
|
||||
guchar *match;
|
||||
int i;
|
||||
|
@ -2160,7 +2160,7 @@ static gboolean
|
|||
side_in_cb (GSocket *socket, GIOCondition condition, gpointer user_data)
|
||||
{
|
||||
ProxySide *side = user_data;
|
||||
XdgAppProxyClient *client = side->client;
|
||||
FlatpakProxyClient *client = side->client;
|
||||
GError *error = NULL;
|
||||
Buffer *buffer;
|
||||
gboolean retval = G_SOURCE_CONTINUE;
|
||||
|
@ -2284,7 +2284,7 @@ client_connected_to_dbus (GObject *source_object,
|
|||
GAsyncResult *res,
|
||||
gpointer user_data)
|
||||
{
|
||||
XdgAppProxyClient *client = user_data;
|
||||
FlatpakProxyClient *client = user_data;
|
||||
GSocketConnection *connection;
|
||||
GError *error = NULL;
|
||||
GIOStream *stream;
|
||||
|
@ -2306,14 +2306,14 @@ client_connected_to_dbus (GObject *source_object,
|
|||
}
|
||||
|
||||
static gboolean
|
||||
xdg_app_proxy_incoming (GSocketService *service,
|
||||
flatpak_proxy_incoming (GSocketService *service,
|
||||
GSocketConnection *connection,
|
||||
GObject *source_object)
|
||||
{
|
||||
XdgAppProxy *proxy = XDG_APP_PROXY (service);
|
||||
XdgAppProxyClient *client;
|
||||
FlatpakProxy *proxy = FLATPAK_PROXY (service);
|
||||
FlatpakProxyClient *client;
|
||||
|
||||
client = xdg_app_proxy_client_new (proxy, connection);
|
||||
client = flatpak_proxy_client_new (proxy, connection);
|
||||
|
||||
g_dbus_address_get_stream (proxy->dbus_address,
|
||||
NULL,
|
||||
|
@ -2323,24 +2323,24 @@ xdg_app_proxy_incoming (GSocketService *service,
|
|||
}
|
||||
|
||||
static void
|
||||
xdg_app_proxy_init (XdgAppProxy *proxy)
|
||||
flatpak_proxy_init (FlatpakProxy *proxy)
|
||||
{
|
||||
proxy->policy = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
|
||||
proxy->wildcard_policy = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
|
||||
xdg_app_proxy_add_policy (proxy, "org.freedesktop.DBus", XDG_APP_POLICY_TALK);
|
||||
flatpak_proxy_add_policy (proxy, "org.freedesktop.DBus", FLATPAK_POLICY_TALK);
|
||||
}
|
||||
|
||||
static void
|
||||
xdg_app_proxy_class_init (XdgAppProxyClass *klass)
|
||||
flatpak_proxy_class_init (FlatpakProxyClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GSocketServiceClass *socket_service_class = G_SOCKET_SERVICE_CLASS (klass);
|
||||
|
||||
object_class->get_property = xdg_app_proxy_get_property;
|
||||
object_class->set_property = xdg_app_proxy_set_property;
|
||||
object_class->finalize = xdg_app_proxy_finalize;
|
||||
object_class->get_property = flatpak_proxy_get_property;
|
||||
object_class->set_property = flatpak_proxy_set_property;
|
||||
object_class->finalize = flatpak_proxy_finalize;
|
||||
|
||||
socket_service_class->incoming = xdg_app_proxy_incoming;
|
||||
socket_service_class->incoming = flatpak_proxy_incoming;
|
||||
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_DBUS_ADDRESS,
|
||||
|
@ -2359,18 +2359,18 @@ xdg_app_proxy_class_init (XdgAppProxyClass *klass)
|
|||
|
||||
}
|
||||
|
||||
XdgAppProxy *
|
||||
xdg_app_proxy_new (const char *dbus_address,
|
||||
FlatpakProxy *
|
||||
flatpak_proxy_new (const char *dbus_address,
|
||||
const char *socket_path)
|
||||
{
|
||||
XdgAppProxy *proxy;
|
||||
FlatpakProxy *proxy;
|
||||
|
||||
proxy = g_object_new (XDG_APP_TYPE_PROXY, "dbus-address", dbus_address, "socket-path", socket_path, NULL);
|
||||
proxy = g_object_new (FLATPAK_TYPE_PROXY, "dbus-address", dbus_address, "socket-path", socket_path, NULL);
|
||||
return proxy;
|
||||
}
|
||||
|
||||
gboolean
|
||||
xdg_app_proxy_start (XdgAppProxy *proxy, GError **error)
|
||||
flatpak_proxy_start (FlatpakProxy *proxy, GError **error)
|
||||
{
|
||||
GSocketAddress *address;
|
||||
gboolean res;
|
||||
|
@ -2398,7 +2398,7 @@ xdg_app_proxy_start (XdgAppProxy *proxy, GError **error)
|
|||
}
|
||||
|
||||
void
|
||||
xdg_app_proxy_stop (XdgAppProxy *proxy)
|
||||
flatpak_proxy_stop (FlatpakProxy *proxy)
|
||||
{
|
||||
unlink (proxy->socket_path);
|
||||
|
||||
|
|
|
@ -18,43 +18,43 @@
|
|||
* Alexander Larsson <alexl@redhat.com>
|
||||
*/
|
||||
|
||||
#ifndef __XDG_APP_PROXY_H__
|
||||
#define __XDG_APP_PROXY_H__
|
||||
#ifndef __FLATPAK_PROXY_H__
|
||||
#define __FLATPAK_PROXY_H__
|
||||
|
||||
#include <gio/gio.h>
|
||||
#include "libglnx/libglnx.h"
|
||||
|
||||
typedef enum {
|
||||
XDG_APP_POLICY_NONE,
|
||||
XDG_APP_POLICY_SEE,
|
||||
XDG_APP_POLICY_TALK,
|
||||
XDG_APP_POLICY_OWN
|
||||
} XdgAppPolicy;
|
||||
FLATPAK_POLICY_NONE,
|
||||
FLATPAK_POLICY_SEE,
|
||||
FLATPAK_POLICY_TALK,
|
||||
FLATPAK_POLICY_OWN
|
||||
} FlatpakPolicy;
|
||||
|
||||
typedef struct XdgAppProxy XdgAppProxy;
|
||||
typedef struct FlatpakProxy FlatpakProxy;
|
||||
|
||||
#define XDG_APP_TYPE_PROXY xdg_app_proxy_get_type ()
|
||||
#define XDG_APP_PROXY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), XDG_APP_TYPE_PROXY, XdgAppProxy))
|
||||
#define XDG_APP_IS_PROXY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), XDG_APP_TYPE_PROXY))
|
||||
#define FLATPAK_TYPE_PROXY flatpak_proxy_get_type ()
|
||||
#define FLATPAK_PROXY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FLATPAK_TYPE_PROXY, FlatpakProxy))
|
||||
#define FLATPAK_IS_PROXY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FLATPAK_TYPE_PROXY))
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (XdgAppProxy, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (FlatpakProxy, g_object_unref)
|
||||
|
||||
GType xdg_app_proxy_get_type (void);
|
||||
GType flatpak_proxy_get_type (void);
|
||||
|
||||
XdgAppProxy *xdg_app_proxy_new (const char *dbus_address,
|
||||
const char *socket_path);
|
||||
void xdg_app_proxy_set_log_messages (XdgAppProxy *proxy,
|
||||
gboolean log);
|
||||
void xdg_app_proxy_set_filter (XdgAppProxy *proxy,
|
||||
gboolean filter);
|
||||
void xdg_app_proxy_add_policy (XdgAppProxy *proxy,
|
||||
const char *name,
|
||||
XdgAppPolicy policy);
|
||||
void xdg_app_proxy_add_wildcarded_policy (XdgAppProxy *proxy,
|
||||
const char *name,
|
||||
XdgAppPolicy policy);
|
||||
gboolean xdg_app_proxy_start (XdgAppProxy *proxy,
|
||||
GError **error);
|
||||
void xdg_app_proxy_stop (XdgAppProxy *proxy);
|
||||
FlatpakProxy *flatpak_proxy_new (const char *dbus_address,
|
||||
const char *socket_path);
|
||||
void flatpak_proxy_set_log_messages (FlatpakProxy *proxy,
|
||||
gboolean log);
|
||||
void flatpak_proxy_set_filter (FlatpakProxy *proxy,
|
||||
gboolean filter);
|
||||
void flatpak_proxy_add_policy (FlatpakProxy *proxy,
|
||||
const char *name,
|
||||
FlatpakPolicy policy);
|
||||
void flatpak_proxy_add_wildcarded_policy (FlatpakProxy *proxy,
|
||||
const char *name,
|
||||
FlatpakPolicy policy);
|
||||
gboolean flatpak_proxy_start (FlatpakProxy *proxy,
|
||||
GError **error);
|
||||
void flatpak_proxy_stop (FlatpakProxy *proxy);
|
||||
|
||||
#endif /* __XDG_APP_PROXY_H__ */
|
||||
#endif /* __FLATPAK_PROXY_H__ */
|
||||
|
|
|
@ -1,122 +1,122 @@
|
|||
<SECTION>
|
||||
<FILE>xdg-app-installation</FILE>
|
||||
<TITLE>XdgAppInstallation</TITLE>
|
||||
XdgAppInstallation
|
||||
xdg_app_installation_new_system
|
||||
xdg_app_installation_new_user
|
||||
xdg_app_installation_new_for_path
|
||||
xdg_app_installation_get_is_user
|
||||
xdg_app_installation_get_path
|
||||
xdg_app_installation_create_monitor
|
||||
xdg_app_installation_install
|
||||
xdg_app_installation_update
|
||||
xdg_app_installation_uninstall
|
||||
xdg_app_installation_launch
|
||||
xdg_app_installation_get_current_installed_app
|
||||
xdg_app_installation_get_installed_ref
|
||||
xdg_app_installation_list_installed_refs
|
||||
xdg_app_installation_list_installed_refs_by_kind
|
||||
xdg_app_installation_list_installed_refs_for_update
|
||||
xdg_app_installation_list_remote_refs_sync
|
||||
xdg_app_installation_list_remotes
|
||||
xdg_app_installation_fetch_remote_metadata_sync
|
||||
xdg_app_installation_fetch_remote_ref_sync
|
||||
xdg_app_installation_fetch_remote_size_sync
|
||||
xdg_app_installation_load_app_overrides
|
||||
xdg_app_installation_update_appstream_sync
|
||||
xdg_app_installation_install_bundle
|
||||
XdgAppProgressCallback
|
||||
XdgAppUpdateFlags
|
||||
<FILE>flatpak-installation</FILE>
|
||||
<TITLE>FlatpakInstallation</TITLE>
|
||||
FlatpakInstallation
|
||||
flatpak_installation_new_system
|
||||
flatpak_installation_new_user
|
||||
flatpak_installation_new_for_path
|
||||
flatpak_installation_get_is_user
|
||||
flatpak_installation_get_path
|
||||
flatpak_installation_create_monitor
|
||||
flatpak_installation_install
|
||||
flatpak_installation_update
|
||||
flatpak_installation_uninstall
|
||||
flatpak_installation_launch
|
||||
flatpak_installation_get_current_installed_app
|
||||
flatpak_installation_get_installed_ref
|
||||
flatpak_installation_list_installed_refs
|
||||
flatpak_installation_list_installed_refs_by_kind
|
||||
flatpak_installation_list_installed_refs_for_update
|
||||
flatpak_installation_list_remote_refs_sync
|
||||
flatpak_installation_list_remotes
|
||||
flatpak_installation_fetch_remote_metadata_sync
|
||||
flatpak_installation_fetch_remote_ref_sync
|
||||
flatpak_installation_fetch_remote_size_sync
|
||||
flatpak_installation_load_app_overrides
|
||||
flatpak_installation_update_appstream_sync
|
||||
flatpak_installation_install_bundle
|
||||
FlatpakProgressCallback
|
||||
FlatpakUpdateFlags
|
||||
<SUBSECTION Standard>
|
||||
XDG_APP_INSTALLATION
|
||||
XDG_APP_IS_INSTALLATION
|
||||
XDG_APP_TYPE_INSTALLATION
|
||||
XdgAppInstallationClass
|
||||
xdg_app_installation_get_type
|
||||
FLATPAK_INSTALLATION
|
||||
FLATPAK_IS_INSTALLATION
|
||||
FLATPAK_TYPE_INSTALLATION
|
||||
FlatpakInstallationClass
|
||||
flatpak_installation_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>xdg-app-installed-ref</FILE>
|
||||
<TITLE>XdgAppInstalledRef</TITLE>
|
||||
XdgAppInstalledRef
|
||||
xdg_app_installed_ref_get_deploy_dir
|
||||
xdg_app_installed_ref_get_installed_size
|
||||
xdg_app_installed_ref_get_is_current
|
||||
xdg_app_installed_ref_get_latest_commit
|
||||
xdg_app_installed_ref_get_origin
|
||||
xdg_app_installed_ref_load_metadata
|
||||
<FILE>flatpak-installed-ref</FILE>
|
||||
<TITLE>FlatpakInstalledRef</TITLE>
|
||||
FlatpakInstalledRef
|
||||
flatpak_installed_ref_get_deploy_dir
|
||||
flatpak_installed_ref_get_installed_size
|
||||
flatpak_installed_ref_get_is_current
|
||||
flatpak_installed_ref_get_latest_commit
|
||||
flatpak_installed_ref_get_origin
|
||||
flatpak_installed_ref_load_metadata
|
||||
<SUBSECTION Standard>
|
||||
XdgAppInstalledRefClass
|
||||
XDG_APP_INSTALLED_REF
|
||||
XDG_APP_IS_INSTALLED_REF
|
||||
XDG_APP_TYPE_INSTALLED_REF
|
||||
xdg_app_installed_ref_get_type
|
||||
FlatpakInstalledRefClass
|
||||
FLATPAK_INSTALLED_REF
|
||||
FLATPAK_IS_INSTALLED_REF
|
||||
FLATPAK_TYPE_INSTALLED_REF
|
||||
flatpak_installed_ref_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>xdg-app-remote-ref</FILE>
|
||||
<TITLE>XdgAppRemoteRef</TITLE>
|
||||
XdgAppRemoteRef
|
||||
xdg_app_remote_ref_get_remote_name
|
||||
<FILE>flatpak-remote-ref</FILE>
|
||||
<TITLE>FlatpakRemoteRef</TITLE>
|
||||
FlatpakRemoteRef
|
||||
flatpak_remote_ref_get_remote_name
|
||||
<SUBSECTION Standard>
|
||||
XDG_APP_IS_REMOTE_REF
|
||||
XDG_APP_REMOTE_REF
|
||||
XDG_APP_TYPE_REMOTE_REF
|
||||
XdgAppRemoteRefClass
|
||||
xdg_app_remote_ref_get_type
|
||||
FLATPAK_IS_REMOTE_REF
|
||||
FLATPAK_REMOTE_REF
|
||||
FLATPAK_TYPE_REMOTE_REF
|
||||
FlatpakRemoteRefClass
|
||||
flatpak_remote_ref_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>xdg-app-ref</FILE>
|
||||
<TITLE>XdgAppRef</TITLE>
|
||||
XdgAppRef
|
||||
XdgAppRefKind
|
||||
xdg_app_ref_format_ref
|
||||
xdg_app_ref_get_arch
|
||||
xdg_app_ref_get_branch
|
||||
xdg_app_ref_get_commit
|
||||
xdg_app_ref_get_kind
|
||||
xdg_app_ref_get_name
|
||||
xdg_app_ref_parse
|
||||
<FILE>flatpak-ref</FILE>
|
||||
<TITLE>FlatpakRef</TITLE>
|
||||
FlatpakRef
|
||||
FlatpakRefKind
|
||||
flatpak_ref_format_ref
|
||||
flatpak_ref_get_arch
|
||||
flatpak_ref_get_branch
|
||||
flatpak_ref_get_commit
|
||||
flatpak_ref_get_kind
|
||||
flatpak_ref_get_name
|
||||
flatpak_ref_parse
|
||||
<SUBSECTION Standard>
|
||||
XdgAppRefClass
|
||||
XDG_APP_IS_REF
|
||||
XDG_APP_REF
|
||||
XDG_APP_TYPE_REF
|
||||
xdg_app_ref_get_type
|
||||
FlatpakRefClass
|
||||
FLATPAK_IS_REF
|
||||
FLATPAK_REF
|
||||
FLATPAK_TYPE_REF
|
||||
flatpak_ref_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>xdg-app-remote</FILE>
|
||||
<TITLE>XdgAppRemote</TITLE>
|
||||
XdgAppRemote
|
||||
xdg_app_remote_get_appstream_dir
|
||||
xdg_app_remote_get_appstream_timestamp
|
||||
xdg_app_remote_get_gpg_verify
|
||||
xdg_app_remote_get_name
|
||||
xdg_app_remote_get_noenumerate
|
||||
xdg_app_remote_get_prio
|
||||
xdg_app_remote_get_title
|
||||
xdg_app_remote_get_url
|
||||
<FILE>flatpak-remote</FILE>
|
||||
<TITLE>FlatpakRemote</TITLE>
|
||||
FlatpakRemote
|
||||
flatpak_remote_get_appstream_dir
|
||||
flatpak_remote_get_appstream_timestamp
|
||||
flatpak_remote_get_gpg_verify
|
||||
flatpak_remote_get_name
|
||||
flatpak_remote_get_noenumerate
|
||||
flatpak_remote_get_prio
|
||||
flatpak_remote_get_title
|
||||
flatpak_remote_get_url
|
||||
<SUBSECTION Standard>
|
||||
XdgAppRemoteClass
|
||||
XDG_APP_IS_REMOTE
|
||||
XDG_APP_REMOTE
|
||||
XDG_APP_TYPE_REMOTE
|
||||
xdg_app_remote_get_type
|
||||
FlatpakRemoteClass
|
||||
FLATPAK_IS_REMOTE
|
||||
FLATPAK_REMOTE
|
||||
FLATPAK_TYPE_REMOTE
|
||||
flatpak_remote_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>xdg-app-version-macros</FILE>
|
||||
XDG_APP_MAJOR_VERSION
|
||||
XDG_APP_MINOR_VERSION
|
||||
XDG_APP_MICRO_VERSION
|
||||
XDG_APP_EXTERN
|
||||
<FILE>flatpak-version-macros</FILE>
|
||||
FLATPAK_MAJOR_VERSION
|
||||
FLATPAK_MINOR_VERSION
|
||||
FLATPAK_MICRO_VERSION
|
||||
FLATPAK_EXTERN
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>xdg-app-error</FILE>
|
||||
XDG_APP_ERROR
|
||||
XdgAppError
|
||||
xdg_app_error_quark
|
||||
<FILE>flatpak-error</FILE>
|
||||
FLATPAK_ERROR
|
||||
FlatpakError
|
||||
flatpak_error_quark
|
||||
</SECTION>
|
||||
|
|
|
@ -610,7 +610,7 @@ create_tmp_for_doc (XdpInode *dir, int dir_fd, int flags, mode_t mode, int *fd_o
|
|||
g_autofree char *template = g_strconcat (".xdp_", dir->basename, ".XXXXXX", NULL);
|
||||
int fd;
|
||||
|
||||
fd = xdg_app_mkstempat (dir_fd, template, flags | O_CLOEXEC, mode);
|
||||
fd = flatpak_mkstempat (dir_fd, template, flags | O_CLOEXEC, mode);
|
||||
if (fd == -1)
|
||||
return NULL;
|
||||
|
||||
|
@ -723,7 +723,7 @@ xdp_inode_lookup (fuse_ino_t inode_nr)
|
|||
}
|
||||
|
||||
static XdpInode *
|
||||
xdp_inode_get_dir_unlocked (const char *app_id, const char *doc_id, XdgAppDbEntry *entry)
|
||||
xdp_inode_get_dir_unlocked (const char *app_id, const char *doc_id, FlatpakDbEntry *entry)
|
||||
{
|
||||
fuse_ino_t ino;
|
||||
XdpInode *inode;
|
||||
|
@ -775,7 +775,7 @@ xdp_inode_get_dir_unlocked (const char *app_id, const char *doc_id, XdgAppDbEntr
|
|||
}
|
||||
|
||||
static XdpInode *
|
||||
xdp_inode_get_dir (const char *app_id, const char *doc_id, XdgAppDbEntry *entry)
|
||||
xdp_inode_get_dir (const char *app_id, const char *doc_id, FlatpakDbEntry *entry)
|
||||
{
|
||||
AUTOLOCK (inodes);
|
||||
return xdp_inode_get_dir_unlocked (app_id, doc_id, entry);
|
||||
|
@ -793,7 +793,7 @@ get_user_perms (const struct stat *stbuf)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
app_can_write_doc (XdgAppDbEntry *entry, const char *app_id)
|
||||
app_can_write_doc (FlatpakDbEntry *entry, const char *app_id)
|
||||
{
|
||||
if (app_id == NULL)
|
||||
return TRUE;
|
||||
|
@ -805,7 +805,7 @@ app_can_write_doc (XdgAppDbEntry *entry, const char *app_id)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
app_can_see_doc (XdgAppDbEntry *entry, const char *app_id)
|
||||
app_can_see_doc (FlatpakDbEntry *entry, const char *app_id)
|
||||
{
|
||||
if (app_id == NULL)
|
||||
return TRUE;
|
||||
|
@ -866,7 +866,7 @@ xdp_inode_stat (XdpInode *inode,
|
|||
|
||||
case XDP_INODE_DOC_FILE:
|
||||
{
|
||||
g_autoptr(XdgAppDbEntry) entry = NULL;
|
||||
g_autoptr(FlatpakDbEntry) entry = NULL;
|
||||
struct stat tmp_stbuf;
|
||||
gboolean can_see, can_write;
|
||||
int fd, res, errsv;
|
||||
|
@ -943,7 +943,7 @@ xdp_fuse_lookup (fuse_req_t req,
|
|||
g_autoptr(XdpInode) parent_inode = NULL;
|
||||
struct fuse_entry_param e = {0};
|
||||
g_autoptr(XdpInode) child_inode = NULL;
|
||||
g_autoptr(XdgAppDbEntry) entry = NULL;
|
||||
g_autoptr(FlatpakDbEntry) entry = NULL;
|
||||
|
||||
g_debug ("xdp_fuse_lookup %lx/%s -> ", parent, name);
|
||||
|
||||
|
@ -976,7 +976,7 @@ xdp_fuse_lookup (fuse_req_t req,
|
|||
|
||||
case XDP_INODE_BY_APP:
|
||||
/* This lazily creates the app dir */
|
||||
if (xdg_app_is_valid_name (name))
|
||||
if (flatpak_is_valid_name (name))
|
||||
child_inode = xdp_inode_get_dir (name, NULL, NULL);
|
||||
break;
|
||||
|
||||
|
@ -1105,7 +1105,7 @@ dirbuf_add_docs (fuse_req_t req,
|
|||
{
|
||||
if (app_id)
|
||||
{
|
||||
g_autoptr(XdgAppDbEntry) entry = xdp_lookup_doc (docs[i]);
|
||||
g_autoptr(FlatpakDbEntry) entry = xdp_lookup_doc (docs[i]);
|
||||
if (entry == NULL ||
|
||||
!app_can_see_doc (entry, app_id))
|
||||
continue;
|
||||
|
@ -1202,7 +1202,7 @@ xdp_fuse_opendir (fuse_req_t req,
|
|||
{
|
||||
GList *children, *l;
|
||||
g_autoptr(XdpInode) doc_inode = NULL;
|
||||
g_autoptr(XdgAppDbEntry) entry = NULL;
|
||||
g_autoptr(FlatpakDbEntry) entry = NULL;
|
||||
|
||||
entry = xdp_lookup_doc (inode->doc_id);
|
||||
if (entry == NULL)
|
||||
|
@ -1309,7 +1309,7 @@ xdp_fuse_fsyncdir (fuse_req_t req,
|
|||
if (inode->type == XDP_INODE_APP_DOC_DIR ||
|
||||
inode->type == XDP_INODE_DOC_DIR)
|
||||
{
|
||||
g_autoptr(XdgAppDbEntry) entry = xdp_lookup_doc (inode->doc_id);
|
||||
g_autoptr(FlatpakDbEntry) entry = xdp_lookup_doc (inode->doc_id);
|
||||
if (entry != NULL)
|
||||
{
|
||||
g_autofree char *dirname = xdp_entry_dup_dirname (entry);
|
||||
|
@ -1431,9 +1431,9 @@ xdp_file_free (XdpFile *file)
|
|||
|
||||
/* sets errno */
|
||||
static int
|
||||
xdp_inode_locked_ensure_fd_open (XdpInode *inode,
|
||||
XdgAppDbEntry *entry,
|
||||
gboolean for_write)
|
||||
xdp_inode_locked_ensure_fd_open (XdpInode *inode,
|
||||
FlatpakDbEntry *entry,
|
||||
gboolean for_write)
|
||||
{
|
||||
/* Ensure all fds are open */
|
||||
if (inode->dir_fd == -1)
|
||||
|
@ -1487,7 +1487,7 @@ xdp_fuse_open (fuse_req_t req,
|
|||
struct fuse_file_info *fi)
|
||||
{
|
||||
g_autoptr(XdpInode) inode = NULL;
|
||||
g_autoptr(XdgAppDbEntry) entry = NULL;
|
||||
g_autoptr(FlatpakDbEntry) entry = NULL;
|
||||
gboolean can_write;
|
||||
int open_mode;
|
||||
XdpFile *file = NULL;
|
||||
|
@ -1568,7 +1568,7 @@ xdp_fuse_create (fuse_req_t req,
|
|||
struct fuse_file_info *fi)
|
||||
{
|
||||
g_autoptr(XdpInode) parent_inode = NULL;
|
||||
g_autoptr(XdgAppDbEntry) entry = NULL;
|
||||
g_autoptr(FlatpakDbEntry) entry = NULL;
|
||||
struct fuse_entry_param e = {0};
|
||||
gboolean can_see, can_write;
|
||||
int open_mode;
|
||||
|
@ -1764,7 +1764,7 @@ xdp_fuse_setattr (fuse_req_t req,
|
|||
struct fuse_file_info *fi)
|
||||
{
|
||||
g_autoptr(XdpInode) inode = NULL;
|
||||
g_autoptr(XdgAppDbEntry) entry = NULL;
|
||||
g_autoptr(FlatpakDbEntry) entry = NULL;
|
||||
double attr_cache_time = ATTR_CACHE_TIME;
|
||||
struct stat newattr = {0};
|
||||
gboolean can_write;
|
||||
|
@ -2042,7 +2042,7 @@ xdp_fuse_rename (fuse_req_t req,
|
|||
const char *newname)
|
||||
{
|
||||
g_autoptr(XdpInode) parent_inode = NULL;
|
||||
g_autoptr(XdgAppDbEntry) entry = NULL;
|
||||
g_autoptr(FlatpakDbEntry) entry = NULL;
|
||||
gboolean can_see, can_write;
|
||||
|
||||
g_debug ("xdp_fuse_rename %lx/%s -> %lx/%s", parent, name, newparent, newname);
|
||||
|
@ -2244,7 +2244,7 @@ xdp_fuse_init (GError **error)
|
|||
|
||||
if (g_mkdir_with_parents (mount_path, 0700))
|
||||
{
|
||||
g_set_error (error, XDG_APP_PORTAL_ERROR, XDG_APP_PORTAL_ERROR_FAILED,
|
||||
g_set_error (error, FLATPAK_PORTAL_ERROR, FLATPAK_PORTAL_ERROR_FAILED,
|
||||
"Unable to create dir %s", mount_path);
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -2252,7 +2252,7 @@ xdp_fuse_init (GError **error)
|
|||
main_ch = fuse_mount (mount_path, &args);
|
||||
if (main_ch == NULL)
|
||||
{
|
||||
g_set_error (error, XDG_APP_PORTAL_ERROR, XDG_APP_PORTAL_ERROR_FAILED, "Can't mount fuse fs");
|
||||
g_set_error (error, FLATPAK_PORTAL_ERROR, FLATPAK_PORTAL_ERROR_FAILED, "Can't mount fuse fs");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -2260,7 +2260,7 @@ xdp_fuse_init (GError **error)
|
|||
sizeof (xdp_fuse_oper), NULL);
|
||||
if (session == NULL)
|
||||
{
|
||||
g_set_error (error, XDG_APP_PORTAL_ERROR, XDG_APP_PORTAL_ERROR_FAILED,
|
||||
g_set_error (error, FLATPAK_PORTAL_ERROR, FLATPAK_PORTAL_ERROR_FAILED,
|
||||
"Can't create fuse session");
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ G_BEGIN_DECLS
|
|||
|
||||
char ** xdp_list_apps (void);
|
||||
char ** xdp_list_docs (void);
|
||||
XdgAppDbEntry *xdp_lookup_doc (const char *doc_id);
|
||||
FlatpakDbEntry *xdp_lookup_doc (const char *doc_id);
|
||||
|
||||
gboolean xdp_fuse_init (GError **error);
|
||||
void xdp_fuse_exit (void);
|
||||
|
|
|
@ -35,7 +35,7 @@ typedef struct
|
|||
|
||||
|
||||
static GMainLoop *loop = NULL;
|
||||
static XdgAppDb *db = NULL;
|
||||
static FlatpakDb *db = NULL;
|
||||
static XdgAppPermissionStore *permission_store;
|
||||
static int daemon_event_fd = -1;
|
||||
static int final_exit_status = 0;
|
||||
|
@ -47,25 +47,25 @@ char **
|
|||
xdp_list_apps (void)
|
||||
{
|
||||
AUTOLOCK (db);
|
||||
return xdg_app_db_list_apps (db);
|
||||
return flatpak_db_list_apps (db);
|
||||
}
|
||||
|
||||
char **
|
||||
xdp_list_docs (void)
|
||||
{
|
||||
AUTOLOCK (db);
|
||||
return xdg_app_db_list_ids (db);
|
||||
return flatpak_db_list_ids (db);
|
||||
}
|
||||
|
||||
XdgAppDbEntry *
|
||||
FlatpakDbEntry *
|
||||
xdp_lookup_doc (const char *doc_id)
|
||||
{
|
||||
AUTOLOCK (db);
|
||||
return xdg_app_db_lookup (db, doc_id);
|
||||
return flatpak_db_lookup (db, doc_id);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
persist_entry (XdgAppDbEntry *entry)
|
||||
persist_entry (FlatpakDbEntry *entry)
|
||||
{
|
||||
guint32 flags = xdp_entry_get_flags (entry);
|
||||
|
||||
|
@ -73,19 +73,19 @@ persist_entry (XdgAppDbEntry *entry)
|
|||
}
|
||||
|
||||
static void
|
||||
do_set_permissions (XdgAppDbEntry *entry,
|
||||
do_set_permissions (FlatpakDbEntry *entry,
|
||||
const char *doc_id,
|
||||
const char *app_id,
|
||||
XdpPermissionFlags perms)
|
||||
{
|
||||
g_autofree const char **perms_s = xdg_unparse_permissions (perms);
|
||||
|
||||
g_autoptr(XdgAppDbEntry) new_entry = NULL;
|
||||
g_autoptr(FlatpakDbEntry) new_entry = NULL;
|
||||
|
||||
g_debug ("set_permissions %s %s %x", doc_id, app_id, perms);
|
||||
|
||||
new_entry = xdg_app_db_entry_set_app_permissions (entry, app_id, perms_s);
|
||||
xdg_app_db_set_entry (db, doc_id, new_entry);
|
||||
new_entry = flatpak_db_entry_set_app_permissions (entry, app_id, perms_s);
|
||||
flatpak_db_set_entry (db, doc_id, new_entry);
|
||||
|
||||
if (persist_entry (new_entry))
|
||||
{
|
||||
|
@ -110,24 +110,24 @@ portal_grant_permissions (GDBusMethodInvocation *invocation,
|
|||
g_autofree const char **permissions = NULL;
|
||||
XdpPermissionFlags perms;
|
||||
|
||||
g_autoptr(XdgAppDbEntry) entry = NULL;
|
||||
g_autoptr(FlatpakDbEntry) entry = NULL;
|
||||
|
||||
g_variant_get (parameters, "(&s&s^a&s)", &id, &target_app_id, &permissions);
|
||||
|
||||
{
|
||||
AUTOLOCK (db);
|
||||
|
||||
entry = xdg_app_db_lookup (db, id);
|
||||
entry = flatpak_db_lookup (db, id);
|
||||
if (entry == NULL)
|
||||
{
|
||||
g_dbus_method_invocation_return_error (invocation, XDG_APP_PORTAL_ERROR, XDG_APP_PORTAL_ERROR_NOT_FOUND,
|
||||
g_dbus_method_invocation_return_error (invocation, FLATPAK_PORTAL_ERROR, FLATPAK_PORTAL_ERROR_NOT_FOUND,
|
||||
"No such document: %s", id);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!xdg_app_is_valid_name (target_app_id))
|
||||
if (!flatpak_is_valid_name (target_app_id))
|
||||
{
|
||||
g_dbus_method_invocation_return_error (invocation, XDG_APP_PORTAL_ERROR, XDG_APP_PORTAL_ERROR_INVALID_ARGUMENT,
|
||||
g_dbus_method_invocation_return_error (invocation, FLATPAK_PORTAL_ERROR, FLATPAK_PORTAL_ERROR_INVALID_ARGUMENT,
|
||||
"Invalid app name: %s", target_app_id);
|
||||
return;
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ portal_grant_permissions (GDBusMethodInvocation *invocation,
|
|||
if (!xdp_entry_has_permissions (entry, app_id,
|
||||
XDP_PERMISSION_FLAGS_GRANT_PERMISSIONS | perms))
|
||||
{
|
||||
g_dbus_method_invocation_return_error (invocation, XDG_APP_PORTAL_ERROR, XDG_APP_PORTAL_ERROR_NOT_ALLOWED,
|
||||
g_dbus_method_invocation_return_error (invocation, FLATPAK_PORTAL_ERROR, FLATPAK_PORTAL_ERROR_NOT_ALLOWED,
|
||||
"Not enough permissions");
|
||||
return;
|
||||
}
|
||||
|
@ -162,7 +162,7 @@ portal_revoke_permissions (GDBusMethodInvocation *invocation,
|
|||
const char *id;
|
||||
g_autofree const char **permissions = NULL;
|
||||
|
||||
g_autoptr(XdgAppDbEntry) entry = NULL;
|
||||
g_autoptr(FlatpakDbEntry) entry = NULL;
|
||||
XdpPermissionFlags perms;
|
||||
|
||||
g_variant_get (parameters, "(&s&s^a&s)", &id, &target_app_id, &permissions);
|
||||
|
@ -170,17 +170,17 @@ portal_revoke_permissions (GDBusMethodInvocation *invocation,
|
|||
{
|
||||
AUTOLOCK (db);
|
||||
|
||||
entry = xdg_app_db_lookup (db, id);
|
||||
entry = flatpak_db_lookup (db, id);
|
||||
if (entry == NULL)
|
||||
{
|
||||
g_dbus_method_invocation_return_error (invocation, XDG_APP_PORTAL_ERROR, XDG_APP_PORTAL_ERROR_NOT_FOUND,
|
||||
g_dbus_method_invocation_return_error (invocation, FLATPAK_PORTAL_ERROR, FLATPAK_PORTAL_ERROR_NOT_FOUND,
|
||||
"No such document: %s", id);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!xdg_app_is_valid_name (target_app_id))
|
||||
if (!flatpak_is_valid_name (target_app_id))
|
||||
{
|
||||
g_dbus_method_invocation_return_error (invocation, XDG_APP_PORTAL_ERROR, XDG_APP_PORTAL_ERROR_INVALID_ARGUMENT,
|
||||
g_dbus_method_invocation_return_error (invocation, FLATPAK_PORTAL_ERROR, FLATPAK_PORTAL_ERROR_INVALID_ARGUMENT,
|
||||
"Invalid app name: %s", target_app_id);
|
||||
return;
|
||||
}
|
||||
|
@ -192,7 +192,7 @@ portal_revoke_permissions (GDBusMethodInvocation *invocation,
|
|||
XDP_PERMISSION_FLAGS_GRANT_PERMISSIONS) ||
|
||||
strcmp (app_id, target_app_id) == 0)
|
||||
{
|
||||
g_dbus_method_invocation_return_error (invocation, XDG_APP_PORTAL_ERROR, XDG_APP_PORTAL_ERROR_NOT_ALLOWED,
|
||||
g_dbus_method_invocation_return_error (invocation, FLATPAK_PORTAL_ERROR, FLATPAK_PORTAL_ERROR_NOT_ALLOWED,
|
||||
"Not enough permissions");
|
||||
return;
|
||||
}
|
||||
|
@ -214,7 +214,7 @@ portal_delete (GDBusMethodInvocation *invocation,
|
|||
{
|
||||
const char *id;
|
||||
|
||||
g_autoptr(XdgAppDbEntry) entry = NULL;
|
||||
g_autoptr(FlatpakDbEntry) entry = NULL;
|
||||
g_autofree const char **old_apps = NULL;
|
||||
int i;
|
||||
|
||||
|
@ -223,24 +223,24 @@ portal_delete (GDBusMethodInvocation *invocation,
|
|||
{
|
||||
AUTOLOCK (db);
|
||||
|
||||
entry = xdg_app_db_lookup (db, id);
|
||||
entry = flatpak_db_lookup (db, id);
|
||||
if (entry == NULL)
|
||||
{
|
||||
g_dbus_method_invocation_return_error (invocation, XDG_APP_PORTAL_ERROR, XDG_APP_PORTAL_ERROR_NOT_FOUND,
|
||||
g_dbus_method_invocation_return_error (invocation, FLATPAK_PORTAL_ERROR, FLATPAK_PORTAL_ERROR_NOT_FOUND,
|
||||
"No such document: %s", id);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!xdp_entry_has_permissions (entry, app_id, XDP_PERMISSION_FLAGS_DELETE))
|
||||
{
|
||||
g_dbus_method_invocation_return_error (invocation, XDG_APP_PORTAL_ERROR, XDG_APP_PORTAL_ERROR_NOT_ALLOWED,
|
||||
g_dbus_method_invocation_return_error (invocation, FLATPAK_PORTAL_ERROR, FLATPAK_PORTAL_ERROR_NOT_ALLOWED,
|
||||
"Not enough permissions");
|
||||
return;
|
||||
}
|
||||
|
||||
g_debug ("delete %s", id);
|
||||
|
||||
xdg_app_db_set_entry (db, id, NULL);
|
||||
flatpak_db_set_entry (db, id, NULL);
|
||||
|
||||
if (persist_entry (entry))
|
||||
xdg_app_permission_store_call_delete (permission_store, TABLE_NAME,
|
||||
|
@ -248,7 +248,7 @@ portal_delete (GDBusMethodInvocation *invocation,
|
|||
}
|
||||
|
||||
/* All i/o is done now, so drop the lock so we can invalidate the fuse caches */
|
||||
old_apps = xdg_app_db_entry_list_apps (entry);
|
||||
old_apps = flatpak_db_entry_list_apps (entry);
|
||||
for (i = 0; old_apps[i] != NULL; i++)
|
||||
xdp_fuse_invalidate_doc_app (id, old_apps[i]);
|
||||
xdp_fuse_invalidate_doc_app (id, NULL);
|
||||
|
@ -261,7 +261,7 @@ char *
|
|||
do_create_doc (struct stat *parent_st_buf, const char *path, gboolean reuse_existing, gboolean persistent)
|
||||
{
|
||||
g_autoptr(GVariant) data = NULL;
|
||||
g_autoptr(XdgAppDbEntry) entry = NULL;
|
||||
g_autoptr(FlatpakDbEntry) entry = NULL;
|
||||
g_auto(GStrv) ids = NULL;
|
||||
char *id = NULL;
|
||||
guint32 flags = 0;
|
||||
|
@ -279,7 +279,7 @@ do_create_doc (struct stat *parent_st_buf, const char *path, gboolean reuse_exis
|
|||
|
||||
if (reuse_existing)
|
||||
{
|
||||
ids = xdg_app_db_list_ids_by_value (db, data);
|
||||
ids = flatpak_db_list_ids_by_value (db, data);
|
||||
|
||||
if (ids[0] != NULL)
|
||||
return g_strdup (ids[0]); /* Reuse pre-existing entry with same path */
|
||||
|
@ -287,19 +287,19 @@ do_create_doc (struct stat *parent_st_buf, const char *path, gboolean reuse_exis
|
|||
|
||||
while (TRUE)
|
||||
{
|
||||
g_autoptr(XdgAppDbEntry) existing = NULL;
|
||||
g_autoptr(FlatpakDbEntry) existing = NULL;
|
||||
|
||||
g_clear_pointer (&id, g_free);
|
||||
id = xdp_name_from_id ((guint32) g_random_int ());
|
||||
existing = xdg_app_db_lookup (db, id);
|
||||
existing = flatpak_db_lookup (db, id);
|
||||
if (existing == NULL)
|
||||
break;
|
||||
}
|
||||
|
||||
g_debug ("create_doc %s", id);
|
||||
|
||||
entry = xdg_app_db_entry_new (data);
|
||||
xdg_app_db_set_entry (db, id, entry);
|
||||
entry = flatpak_db_entry_new (data);
|
||||
flatpak_db_set_entry (db, id, entry);
|
||||
|
||||
if (persistent)
|
||||
{
|
||||
|
@ -365,7 +365,7 @@ portal_add (GDBusMethodInvocation *invocation,
|
|||
(symlink_size = readlink (proc_path, path_buffer, sizeof (path_buffer) - 1)) < 0)
|
||||
{
|
||||
g_dbus_method_invocation_return_error (invocation,
|
||||
XDG_APP_PORTAL_ERROR, XDG_APP_PORTAL_ERROR_INVALID_ARGUMENT,
|
||||
FLATPAK_PORTAL_ERROR, FLATPAK_PORTAL_ERROR_INVALID_ARGUMENT,
|
||||
"Invalid fd passed");
|
||||
return;
|
||||
}
|
||||
|
@ -386,7 +386,7 @@ portal_add (GDBusMethodInvocation *invocation,
|
|||
{
|
||||
/* Don't leak any info about real file path existance, etc */
|
||||
g_dbus_method_invocation_return_error (invocation,
|
||||
XDG_APP_PORTAL_ERROR, XDG_APP_PORTAL_ERROR_INVALID_ARGUMENT,
|
||||
FLATPAK_PORTAL_ERROR, FLATPAK_PORTAL_ERROR_INVALID_ARGUMENT,
|
||||
"Invalid fd passed");
|
||||
return;
|
||||
}
|
||||
|
@ -396,14 +396,14 @@ portal_add (GDBusMethodInvocation *invocation,
|
|||
if (st_buf.st_dev == fuse_dev)
|
||||
{
|
||||
/* The passed in fd is on the fuse filesystem itself */
|
||||
g_autoptr(XdgAppDbEntry) old_entry = NULL;
|
||||
g_autoptr(FlatpakDbEntry) old_entry = NULL;
|
||||
|
||||
id = xdp_fuse_lookup_id_for_inode (st_buf.st_ino);
|
||||
g_debug ("path on fuse, id %s", id);
|
||||
if (id == NULL)
|
||||
{
|
||||
g_dbus_method_invocation_return_error (invocation,
|
||||
XDG_APP_PORTAL_ERROR, XDG_APP_PORTAL_ERROR_INVALID_ARGUMENT,
|
||||
FLATPAK_PORTAL_ERROR, FLATPAK_PORTAL_ERROR_INVALID_ARGUMENT,
|
||||
"Invalid fd passed");
|
||||
return;
|
||||
}
|
||||
|
@ -417,12 +417,12 @@ portal_add (GDBusMethodInvocation *invocation,
|
|||
resuse_existing, because otherwise the user could use this to
|
||||
get a copy with permissions and thus escape later permission
|
||||
revocations */
|
||||
old_entry = xdg_app_db_lookup (db, id);
|
||||
old_entry = flatpak_db_lookup (db, id);
|
||||
if (old_entry == NULL ||
|
||||
!reuse_existing)
|
||||
{
|
||||
g_dbus_method_invocation_return_error (invocation,
|
||||
XDG_APP_PORTAL_ERROR, XDG_APP_PORTAL_ERROR_INVALID_ARGUMENT,
|
||||
FLATPAK_PORTAL_ERROR, FLATPAK_PORTAL_ERROR_INVALID_ARGUMENT,
|
||||
"Invalid fd passed");
|
||||
return;
|
||||
}
|
||||
|
@ -436,13 +436,13 @@ portal_add (GDBusMethodInvocation *invocation,
|
|||
|
||||
if (app_id[0] != '\0')
|
||||
{
|
||||
g_autoptr(XdgAppDbEntry) entry = NULL;
|
||||
g_autoptr(FlatpakDbEntry) entry = NULL;
|
||||
XdpPermissionFlags perms =
|
||||
XDP_PERMISSION_FLAGS_GRANT_PERMISSIONS |
|
||||
XDP_PERMISSION_FLAGS_READ |
|
||||
XDP_PERMISSION_FLAGS_WRITE;
|
||||
{
|
||||
entry = xdg_app_db_lookup (db, id);
|
||||
entry = flatpak_db_lookup (db, id);
|
||||
|
||||
/* If its a unique one its safe for the creator to
|
||||
delete it at will */
|
||||
|
@ -490,7 +490,7 @@ portal_add_named (GDBusMethodInvocation *invocation,
|
|||
/* This is only allowed from the host, or else we could leak existance of files */
|
||||
if (*app_id != 0)
|
||||
{
|
||||
g_dbus_method_invocation_return_error (invocation, XDG_APP_PORTAL_ERROR, XDG_APP_PORTAL_ERROR_NOT_ALLOWED,
|
||||
g_dbus_method_invocation_return_error (invocation, FLATPAK_PORTAL_ERROR, FLATPAK_PORTAL_ERROR_NOT_ALLOWED,
|
||||
"Not enough permissions");
|
||||
return;
|
||||
}
|
||||
|
@ -509,7 +509,7 @@ portal_add_named (GDBusMethodInvocation *invocation,
|
|||
if (strchr (filename, '/') != NULL)
|
||||
{
|
||||
g_dbus_method_invocation_return_error (invocation,
|
||||
XDG_APP_PORTAL_ERROR, XDG_APP_PORTAL_ERROR_INVALID_ARGUMENT,
|
||||
FLATPAK_PORTAL_ERROR, FLATPAK_PORTAL_ERROR_INVALID_ARGUMENT,
|
||||
"Invalid filename passed");
|
||||
return;
|
||||
}
|
||||
|
@ -532,7 +532,7 @@ portal_add_named (GDBusMethodInvocation *invocation,
|
|||
(symlink_size = readlink (proc_path, parent_path_buffer, sizeof (parent_path_buffer) - 1)) < 0)
|
||||
{
|
||||
g_dbus_method_invocation_return_error (invocation,
|
||||
XDG_APP_PORTAL_ERROR, XDG_APP_PORTAL_ERROR_INVALID_ARGUMENT,
|
||||
FLATPAK_PORTAL_ERROR, FLATPAK_PORTAL_ERROR_INVALID_ARGUMENT,
|
||||
"Invalid fd passed");
|
||||
return;
|
||||
}
|
||||
|
@ -540,7 +540,7 @@ portal_add_named (GDBusMethodInvocation *invocation,
|
|||
if (parent_st_buf.st_dev == fuse_dev)
|
||||
{
|
||||
g_dbus_method_invocation_return_error (invocation,
|
||||
XDG_APP_PORTAL_ERROR, XDG_APP_PORTAL_ERROR_INVALID_ARGUMENT,
|
||||
FLATPAK_PORTAL_ERROR, FLATPAK_PORTAL_ERROR_INVALID_ARGUMENT,
|
||||
"Invalid fd passed");
|
||||
return;
|
||||
}
|
||||
|
@ -575,7 +575,7 @@ got_app_id_cb (GObject *source_object,
|
|||
g_autofree char *app_id = NULL;
|
||||
PortalMethod portal_method = user_data;
|
||||
|
||||
app_id = xdg_app_invocation_lookup_app_id_finish (invocation, res, &error);
|
||||
app_id = flatpak_invocation_lookup_app_id_finish (invocation, res, &error);
|
||||
|
||||
if (app_id == NULL)
|
||||
g_dbus_method_invocation_return_gerror (invocation, error);
|
||||
|
@ -587,7 +587,7 @@ static gboolean
|
|||
handle_method (GCallback method_callback,
|
||||
GDBusMethodInvocation *invocation)
|
||||
{
|
||||
xdg_app_invocation_lookup_app_id (invocation, NULL, got_app_id_cb, method_callback);
|
||||
flatpak_invocation_lookup_app_id (invocation, NULL, got_app_id_cb, method_callback);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -616,7 +616,7 @@ on_bus_acquired (GDBusConnection *connection,
|
|||
g_signal_connect_swapped (helper, "handle-revoke-permissions", G_CALLBACK (handle_method), portal_revoke_permissions);
|
||||
g_signal_connect_swapped (helper, "handle-delete", G_CALLBACK (handle_method), portal_delete);
|
||||
|
||||
xdg_app_connection_track_name_owners (connection);
|
||||
flatpak_connection_track_name_owners (connection);
|
||||
|
||||
if (!g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (helper),
|
||||
connection,
|
||||
|
@ -807,7 +807,7 @@ main (int argc,
|
|||
loop = g_main_loop_new (NULL, FALSE);
|
||||
|
||||
path = g_build_filename (g_get_user_data_dir (), "xdg-app/db", TABLE_NAME, NULL);
|
||||
db = xdg_app_db_new (path, FALSE, &error);
|
||||
db = flatpak_db_new (path, FALSE, &error);
|
||||
if (db == NULL)
|
||||
{
|
||||
g_printerr ("Failed to load db: %s\n", error->message);
|
||||
|
@ -822,8 +822,8 @@ main (int argc,
|
|||
}
|
||||
|
||||
permission_store = xdg_app_permission_store_proxy_new_sync (session_bus, G_DBUS_PROXY_FLAGS_NONE,
|
||||
"org.freedesktop.XdgApp",
|
||||
"/org/freedesktop/XdgApp/PermissionStore",
|
||||
"org.freedesktop.Flatpak",
|
||||
"/org/freedesktop/Flatpak/PermissionStore",
|
||||
NULL, &error);
|
||||
if (permission_store == NULL)
|
||||
{
|
||||
|
|
|
@ -50,20 +50,20 @@ xdp_parse_permissions (const char **permissions)
|
|||
}
|
||||
|
||||
XdpPermissionFlags
|
||||
xdp_entry_get_permissions (XdgAppDbEntry *entry,
|
||||
const char *app_id)
|
||||
xdp_entry_get_permissions (FlatpakDbEntry *entry,
|
||||
const char *app_id)
|
||||
{
|
||||
g_autofree const char **permissions = NULL;
|
||||
|
||||
if (strcmp (app_id, "") == 0)
|
||||
return XDP_PERMISSION_FLAGS_ALL;
|
||||
|
||||
permissions = xdg_app_db_entry_list_permissions (entry, app_id);
|
||||
permissions = flatpak_db_entry_list_permissions (entry, app_id);
|
||||
return xdp_parse_permissions (permissions);
|
||||
}
|
||||
|
||||
gboolean
|
||||
xdp_entry_has_permissions (XdgAppDbEntry *entry,
|
||||
xdp_entry_has_permissions (FlatpakDbEntry *entry,
|
||||
const char *app_id,
|
||||
XdpPermissionFlags perms)
|
||||
{
|
||||
|
@ -81,15 +81,15 @@ xdp_name_from_id (guint32 doc_id)
|
|||
}
|
||||
|
||||
const char *
|
||||
xdp_entry_get_path (XdgAppDbEntry *entry)
|
||||
xdp_entry_get_path (FlatpakDbEntry *entry)
|
||||
{
|
||||
g_autoptr(GVariant) v = xdg_app_db_entry_get_data (entry);
|
||||
g_autoptr(GVariant) v = flatpak_db_entry_get_data (entry);
|
||||
g_autoptr(GVariant) c = g_variant_get_child_value (v, 0);
|
||||
return g_variant_get_bytestring (c);
|
||||
}
|
||||
|
||||
char *
|
||||
xdp_entry_dup_basename (XdgAppDbEntry *entry)
|
||||
xdp_entry_dup_basename (FlatpakDbEntry *entry)
|
||||
{
|
||||
const char *path = xdp_entry_get_path (entry);
|
||||
|
||||
|
@ -97,7 +97,7 @@ xdp_entry_dup_basename (XdgAppDbEntry *entry)
|
|||
}
|
||||
|
||||
char *
|
||||
xdp_entry_dup_dirname (XdgAppDbEntry *entry)
|
||||
xdp_entry_dup_dirname (FlatpakDbEntry *entry)
|
||||
{
|
||||
const char *path = xdp_entry_get_path (entry);
|
||||
|
||||
|
@ -105,25 +105,25 @@ xdp_entry_dup_dirname (XdgAppDbEntry *entry)
|
|||
}
|
||||
|
||||
guint64
|
||||
xdp_entry_get_device (XdgAppDbEntry *entry)
|
||||
xdp_entry_get_device (FlatpakDbEntry *entry)
|
||||
{
|
||||
g_autoptr(GVariant) v = xdg_app_db_entry_get_data (entry);
|
||||
g_autoptr(GVariant) v = flatpak_db_entry_get_data (entry);
|
||||
g_autoptr(GVariant) c = g_variant_get_child_value (v, 1);
|
||||
return g_variant_get_uint64 (c);
|
||||
}
|
||||
|
||||
guint64
|
||||
xdp_entry_get_inode (XdgAppDbEntry *entry)
|
||||
xdp_entry_get_inode (FlatpakDbEntry *entry)
|
||||
{
|
||||
g_autoptr(GVariant) v = xdg_app_db_entry_get_data (entry);
|
||||
g_autoptr(GVariant) v = flatpak_db_entry_get_data (entry);
|
||||
g_autoptr(GVariant) c = g_variant_get_child_value (v, 2);
|
||||
return g_variant_get_uint64 (c);
|
||||
}
|
||||
|
||||
guint32
|
||||
xdp_entry_get_flags (XdgAppDbEntry *entry)
|
||||
xdp_entry_get_flags (FlatpakDbEntry *entry)
|
||||
{
|
||||
g_autoptr(GVariant) v = xdg_app_db_entry_get_data (entry);
|
||||
g_autoptr(GVariant) v = flatpak_db_entry_get_data (entry);
|
||||
g_autoptr(GVariant) c = g_variant_get_child_value (v, 3);
|
||||
return g_variant_get_uint32 (c);
|
||||
}
|
||||
|
|
|
@ -13,17 +13,17 @@ G_BEGIN_DECLS
|
|||
const char ** xdg_unparse_permissions (XdpPermissionFlags permissions);
|
||||
XdpPermissionFlags xdp_parse_permissions (const char **permissions);
|
||||
|
||||
XdpPermissionFlags xdp_entry_get_permissions (XdgAppDbEntry *entry,
|
||||
const char *app_id);
|
||||
gboolean xdp_entry_has_permissions (XdgAppDbEntry *entry,
|
||||
XdpPermissionFlags xdp_entry_get_permissions (FlatpakDbEntry *entry,
|
||||
const char *app_id);
|
||||
gboolean xdp_entry_has_permissions (FlatpakDbEntry *entry,
|
||||
const char *app_id,
|
||||
XdpPermissionFlags perms);
|
||||
const char * xdp_entry_get_path (XdgAppDbEntry *entry);
|
||||
char * xdp_entry_dup_basename (XdgAppDbEntry *entry);
|
||||
char * xdp_entry_dup_dirname (XdgAppDbEntry *entry);
|
||||
guint64 xdp_entry_get_device (XdgAppDbEntry *entry);
|
||||
guint64 xdp_entry_get_inode (XdgAppDbEntry *entry);
|
||||
guint32 xdp_entry_get_flags (XdgAppDbEntry *entry);
|
||||
const char * xdp_entry_get_path (FlatpakDbEntry *entry);
|
||||
char * xdp_entry_dup_basename (FlatpakDbEntry *entry);
|
||||
char * xdp_entry_dup_dirname (FlatpakDbEntry *entry);
|
||||
guint64 xdp_entry_get_device (FlatpakDbEntry *entry);
|
||||
guint64 xdp_entry_get_inode (FlatpakDbEntry *entry);
|
||||
guint32 xdp_entry_get_flags (FlatpakDbEntry *entry);
|
||||
|
||||
char * xdp_name_from_id (guint32 doc_id);
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ libxdg_app_la_SOURCES = \
|
|||
|
||||
libxdg_app_la_CFLAGS = \
|
||||
$(HIDDEN_VISIBILITY_CFLAGS) \
|
||||
-DXDG_APP_COMPILATION \
|
||||
-DFLATPAK_COMPILATION \
|
||||
-I$(top_srcdir)/lib \
|
||||
-I$(top_builddir)/lib \
|
||||
$(AM_CFLAGS) \
|
||||
|
@ -107,23 +107,23 @@ test_libxdg_app_LDADD = \
|
|||
INTROSPECTION_GIRS =
|
||||
|
||||
if HAVE_INTROSPECTION
|
||||
XdgApp-1.0.gir: libxdg-app.la Makefile
|
||||
Flatpak-1.0.gir: libxdg-app.la Makefile
|
||||
|
||||
introspected_headers = $(public_headers)
|
||||
introspected_sources = $(filter-out %-private.h,$(sources))
|
||||
|
||||
XdgApp_1_0_gir_NAMESPACE = XdgApp
|
||||
XdgApp_1_0_gir_VERSION = 1.0
|
||||
XdgApp_1_0_gir_LIBS = libxdg-app.la
|
||||
XdgApp_1_0_gir_FILES = $(introspected_headers) $(introspected_sources)
|
||||
XdgApp_1_0_gir_CFLAGS = $(libxdg_app_la_CFLAGS)
|
||||
XdgApp_1_0_gir_INCLUDES = GObject-2.0 Gio-2.0
|
||||
XdgApp_1_0_gir_SCANNERFLAGS = \
|
||||
Flatpak_1_0_gir_NAMESPACE = Flatpak
|
||||
Flatpak_1_0_gir_VERSION = 1.0
|
||||
Flatpak_1_0_gir_LIBS = libxdg-app.la
|
||||
Flatpak_1_0_gir_FILES = $(introspected_headers) $(introspected_sources)
|
||||
Flatpak_1_0_gir_CFLAGS = $(libxdg_app_la_CFLAGS)
|
||||
Flatpak_1_0_gir_INCLUDES = GObject-2.0 Gio-2.0
|
||||
Flatpak_1_0_gir_SCANNERFLAGS = \
|
||||
--warn-all \
|
||||
--c-include='xdg-app.h' \
|
||||
--pkg-export=xdg-app
|
||||
|
||||
INTROSPECTION_GIRS += XdgApp-1.0.gir
|
||||
INTROSPECTION_GIRS += Flatpak-1.0.gir
|
||||
|
||||
girdir = $(datadir)/gir-1.0
|
||||
nodist_gir_DATA = $(INTROSPECTION_GIRS)
|
||||
|
|
258
lib/test-lib.c
258
lib/test-lib.c
|
@ -28,16 +28,16 @@ monitor_callback (GFileMonitor * monitor,
|
|||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
XdgAppInstallation *installation;
|
||||
XdgAppInstalledRef *app1;
|
||||
XdgAppInstalledRef *app2;
|
||||
XdgAppRemoteRef *remote_ref;
|
||||
FlatpakInstallation *installation;
|
||||
FlatpakInstalledRef *app1;
|
||||
FlatpakInstalledRef *app2;
|
||||
FlatpakRemoteRef *remote_ref;
|
||||
|
||||
g_autoptr(GPtrArray) remotes = NULL;
|
||||
GError *error = NULL;
|
||||
int i, j;
|
||||
|
||||
installation = xdg_app_installation_new_user (NULL, &error);
|
||||
installation = flatpak_installation_new_user (NULL, &error);
|
||||
if (installation == NULL)
|
||||
{
|
||||
g_print ("error: %s\n", error->message);
|
||||
|
@ -46,7 +46,7 @@ main (int argc, char *argv[])
|
|||
|
||||
if (argc == 4)
|
||||
{
|
||||
GFileMonitor * monitor = xdg_app_installation_create_monitor (installation, NULL, NULL);
|
||||
GFileMonitor * monitor = flatpak_installation_create_monitor (installation, NULL, NULL);
|
||||
GMainLoop *main_loop;
|
||||
|
||||
g_signal_connect (monitor, "changed", (GCallback) monitor_callback, NULL);
|
||||
|
@ -56,9 +56,9 @@ main (int argc, char *argv[])
|
|||
|
||||
if (argc == 3)
|
||||
{
|
||||
app1 = xdg_app_installation_install (installation,
|
||||
app1 = flatpak_installation_install (installation,
|
||||
argv[1],
|
||||
XDG_APP_REF_KIND_APP,
|
||||
FLATPAK_REF_KIND_APP,
|
||||
argv[2],
|
||||
NULL, NULL,
|
||||
progress_cb, (gpointer) 0xdeadbeef,
|
||||
|
@ -67,16 +67,16 @@ main (int argc, char *argv[])
|
|||
g_print ("Error: %s\n", error->message);
|
||||
else
|
||||
g_print ("Installed %s: %s\n", argv[2],
|
||||
xdg_app_ref_get_commit (XDG_APP_REF (app1)));
|
||||
flatpak_ref_get_commit (FLATPAK_REF (app1)));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (argc == 2)
|
||||
{
|
||||
app1 = xdg_app_installation_update (installation,
|
||||
XDG_APP_UPDATE_FLAGS_NONE,
|
||||
XDG_APP_REF_KIND_APP,
|
||||
app1 = flatpak_installation_update (installation,
|
||||
FLATPAK_UPDATE_FLAGS_NONE,
|
||||
FLATPAK_REF_KIND_APP,
|
||||
argv[1],
|
||||
NULL, NULL,
|
||||
progress_cb, (gpointer) 0xdeadbeef,
|
||||
|
@ -85,7 +85,7 @@ main (int argc, char *argv[])
|
|||
g_print ("Error: %s\n", error->message);
|
||||
else
|
||||
g_print ("Updated %s: %s\n", argv[1],
|
||||
xdg_app_ref_get_commit (XDG_APP_REF (app1)));
|
||||
flatpak_ref_get_commit (FLATPAK_REF (app1)));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ main (int argc, char *argv[])
|
|||
g_print ("\n**** Loading bundle\n");
|
||||
{
|
||||
g_autoptr(GFile) f = g_file_new_for_commandline_arg ("tests/hello.xdgapp");
|
||||
g_autoptr(XdgAppBundleRef) bundle = xdg_app_bundle_ref_new (f, &error);
|
||||
g_autoptr(FlatpakBundleRef) bundle = flatpak_bundle_ref_new (f, &error);
|
||||
if (bundle == NULL)
|
||||
{
|
||||
g_print ("Error loading bundle: %s\n", error->message);
|
||||
|
@ -101,17 +101,17 @@ main (int argc, char *argv[])
|
|||
}
|
||||
else
|
||||
{
|
||||
g_autofree char *path = g_file_get_path (xdg_app_bundle_ref_get_file (bundle));
|
||||
g_autoptr(GBytes) metadata = xdg_app_bundle_ref_get_metadata (bundle);
|
||||
g_autoptr(GBytes) appdata = xdg_app_bundle_ref_get_appstream (bundle);
|
||||
g_autofree char *path = g_file_get_path (flatpak_bundle_ref_get_file (bundle));
|
||||
g_autoptr(GBytes) metadata = flatpak_bundle_ref_get_metadata (bundle);
|
||||
g_autoptr(GBytes) appdata = flatpak_bundle_ref_get_appstream (bundle);
|
||||
g_print ("%d %s %s %s %s %s %"G_GUINT64_FORMAT "\n%s\n",
|
||||
xdg_app_ref_get_kind (XDG_APP_REF (bundle)),
|
||||
xdg_app_ref_get_name (XDG_APP_REF (bundle)),
|
||||
xdg_app_ref_get_arch (XDG_APP_REF (bundle)),
|
||||
xdg_app_ref_get_branch (XDG_APP_REF (bundle)),
|
||||
xdg_app_ref_get_commit (XDG_APP_REF (bundle)),
|
||||
flatpak_ref_get_kind (FLATPAK_REF (bundle)),
|
||||
flatpak_ref_get_name (FLATPAK_REF (bundle)),
|
||||
flatpak_ref_get_arch (FLATPAK_REF (bundle)),
|
||||
flatpak_ref_get_branch (FLATPAK_REF (bundle)),
|
||||
flatpak_ref_get_commit (FLATPAK_REF (bundle)),
|
||||
path,
|
||||
xdg_app_bundle_ref_get_installed_size (bundle),
|
||||
flatpak_bundle_ref_get_installed_size (bundle),
|
||||
(char *) g_bytes_get_data (metadata, NULL));
|
||||
|
||||
if (appdata != NULL)
|
||||
|
@ -139,7 +139,7 @@ main (int argc, char *argv[])
|
|||
g_print ("\n**** Checking for updates\n");
|
||||
{
|
||||
g_autoptr(GPtrArray) updates =
|
||||
xdg_app_installation_list_installed_refs_for_update (installation,
|
||||
flatpak_installation_list_installed_refs_for_update (installation,
|
||||
NULL, &error);
|
||||
|
||||
if (updates == NULL)
|
||||
|
@ -151,18 +151,18 @@ main (int argc, char *argv[])
|
|||
{
|
||||
for (i = 0; i < updates->len; i++)
|
||||
{
|
||||
XdgAppInstalledRef *ref = g_ptr_array_index (updates, i);
|
||||
FlatpakInstalledRef *ref = g_ptr_array_index (updates, i);
|
||||
g_print ("%d %s %s %s %s %s %s %s %d %"G_GUINT64_FORMAT "\n",
|
||||
xdg_app_ref_get_kind (XDG_APP_REF (ref)),
|
||||
xdg_app_ref_get_name (XDG_APP_REF (ref)),
|
||||
xdg_app_ref_get_arch (XDG_APP_REF (ref)),
|
||||
xdg_app_ref_get_branch (XDG_APP_REF (ref)),
|
||||
xdg_app_ref_get_commit (XDG_APP_REF (ref)),
|
||||
xdg_app_installed_ref_get_latest_commit (ref),
|
||||
xdg_app_installed_ref_get_origin (ref),
|
||||
xdg_app_installed_ref_get_deploy_dir (ref),
|
||||
xdg_app_installed_ref_get_is_current (ref),
|
||||
xdg_app_installed_ref_get_installed_size (ref));
|
||||
flatpak_ref_get_kind (FLATPAK_REF (ref)),
|
||||
flatpak_ref_get_name (FLATPAK_REF (ref)),
|
||||
flatpak_ref_get_arch (FLATPAK_REF (ref)),
|
||||
flatpak_ref_get_branch (FLATPAK_REF (ref)),
|
||||
flatpak_ref_get_commit (FLATPAK_REF (ref)),
|
||||
flatpak_installed_ref_get_latest_commit (ref),
|
||||
flatpak_installed_ref_get_origin (ref),
|
||||
flatpak_installed_ref_get_deploy_dir (ref),
|
||||
flatpak_installed_ref_get_is_current (ref),
|
||||
flatpak_installed_ref_get_installed_size (ref));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -171,23 +171,23 @@ main (int argc, char *argv[])
|
|||
{
|
||||
g_autoptr(GPtrArray) refs = NULL;
|
||||
|
||||
refs = xdg_app_installation_list_installed_refs (installation,
|
||||
refs = flatpak_installation_list_installed_refs (installation,
|
||||
NULL, NULL);
|
||||
|
||||
for (i = 0; i < refs->len; i++)
|
||||
{
|
||||
XdgAppInstalledRef *ref = g_ptr_array_index (refs, i);
|
||||
FlatpakInstalledRef *ref = g_ptr_array_index (refs, i);
|
||||
g_print ("%d %s %s %s %s %s %s %s %d %"G_GUINT64_FORMAT "\n",
|
||||
xdg_app_ref_get_kind (XDG_APP_REF (ref)),
|
||||
xdg_app_ref_get_name (XDG_APP_REF (ref)),
|
||||
xdg_app_ref_get_arch (XDG_APP_REF (ref)),
|
||||
xdg_app_ref_get_branch (XDG_APP_REF (ref)),
|
||||
xdg_app_ref_get_commit (XDG_APP_REF (ref)),
|
||||
xdg_app_installed_ref_get_latest_commit (ref),
|
||||
xdg_app_installed_ref_get_origin (ref),
|
||||
xdg_app_installed_ref_get_deploy_dir (ref),
|
||||
xdg_app_installed_ref_get_is_current (ref),
|
||||
xdg_app_installed_ref_get_installed_size (ref));
|
||||
flatpak_ref_get_kind (FLATPAK_REF (ref)),
|
||||
flatpak_ref_get_name (FLATPAK_REF (ref)),
|
||||
flatpak_ref_get_arch (FLATPAK_REF (ref)),
|
||||
flatpak_ref_get_branch (FLATPAK_REF (ref)),
|
||||
flatpak_ref_get_commit (FLATPAK_REF (ref)),
|
||||
flatpak_installed_ref_get_latest_commit (ref),
|
||||
flatpak_installed_ref_get_origin (ref),
|
||||
flatpak_installed_ref_get_deploy_dir (ref),
|
||||
flatpak_installed_ref_get_is_current (ref),
|
||||
flatpak_installed_ref_get_installed_size (ref));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -195,26 +195,26 @@ main (int argc, char *argv[])
|
|||
{
|
||||
g_autoptr(GPtrArray) apps = NULL;
|
||||
|
||||
apps = xdg_app_installation_list_installed_refs_by_kind (installation,
|
||||
XDG_APP_REF_KIND_APP,
|
||||
apps = flatpak_installation_list_installed_refs_by_kind (installation,
|
||||
FLATPAK_REF_KIND_APP,
|
||||
NULL, NULL);
|
||||
|
||||
for (i = 0; i < apps->len; i++)
|
||||
{
|
||||
XdgAppInstalledRef *app = g_ptr_array_index (apps, i);
|
||||
FlatpakInstalledRef *app = g_ptr_array_index (apps, i);
|
||||
|
||||
g_print ("%d %s %s %s %s %s %s %s %d %"G_GUINT64_FORMAT "\n",
|
||||
xdg_app_ref_get_kind (XDG_APP_REF (app)),
|
||||
xdg_app_ref_get_name (XDG_APP_REF (app)),
|
||||
xdg_app_ref_get_arch (XDG_APP_REF (app)),
|
||||
xdg_app_ref_get_branch (XDG_APP_REF (app)),
|
||||
xdg_app_ref_get_commit (XDG_APP_REF (app)),
|
||||
xdg_app_installed_ref_get_latest_commit (app),
|
||||
xdg_app_installed_ref_get_origin (app),
|
||||
xdg_app_installed_ref_get_deploy_dir (app),
|
||||
xdg_app_installed_ref_get_is_current (app),
|
||||
xdg_app_installed_ref_get_installed_size (app));
|
||||
g_print ("metadata:\n%s\n", (char *) g_bytes_get_data (xdg_app_installed_ref_load_metadata (app, NULL, NULL), NULL));
|
||||
flatpak_ref_get_kind (FLATPAK_REF (app)),
|
||||
flatpak_ref_get_name (FLATPAK_REF (app)),
|
||||
flatpak_ref_get_arch (FLATPAK_REF (app)),
|
||||
flatpak_ref_get_branch (FLATPAK_REF (app)),
|
||||
flatpak_ref_get_commit (FLATPAK_REF (app)),
|
||||
flatpak_installed_ref_get_latest_commit (app),
|
||||
flatpak_installed_ref_get_origin (app),
|
||||
flatpak_installed_ref_get_deploy_dir (app),
|
||||
flatpak_installed_ref_get_is_current (app),
|
||||
flatpak_installed_ref_get_installed_size (app));
|
||||
g_print ("metadata:\n%s\n", (char *) g_bytes_get_data (flatpak_installed_ref_load_metadata (app, NULL, NULL), NULL));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -222,43 +222,43 @@ main (int argc, char *argv[])
|
|||
{
|
||||
g_autoptr(GPtrArray) runtimes = NULL;
|
||||
|
||||
runtimes = xdg_app_installation_list_installed_refs_by_kind (installation,
|
||||
XDG_APP_REF_KIND_RUNTIME,
|
||||
runtimes = flatpak_installation_list_installed_refs_by_kind (installation,
|
||||
FLATPAK_REF_KIND_RUNTIME,
|
||||
NULL, NULL);
|
||||
|
||||
for (i = 0; i < runtimes->len; i++)
|
||||
{
|
||||
XdgAppInstalledRef *runtime = g_ptr_array_index (runtimes, i);
|
||||
FlatpakInstalledRef *runtime = g_ptr_array_index (runtimes, i);
|
||||
g_print ("%d %s %s %s %s %s %s %d\n",
|
||||
xdg_app_ref_get_kind (XDG_APP_REF (runtime)),
|
||||
xdg_app_ref_get_name (XDG_APP_REF (runtime)),
|
||||
xdg_app_ref_get_arch (XDG_APP_REF (runtime)),
|
||||
xdg_app_ref_get_branch (XDG_APP_REF (runtime)),
|
||||
xdg_app_ref_get_commit (XDG_APP_REF (runtime)),
|
||||
xdg_app_installed_ref_get_origin (runtime),
|
||||
xdg_app_installed_ref_get_deploy_dir (runtime),
|
||||
xdg_app_installed_ref_get_is_current (runtime));
|
||||
flatpak_ref_get_kind (FLATPAK_REF (runtime)),
|
||||
flatpak_ref_get_name (FLATPAK_REF (runtime)),
|
||||
flatpak_ref_get_arch (FLATPAK_REF (runtime)),
|
||||
flatpak_ref_get_branch (FLATPAK_REF (runtime)),
|
||||
flatpak_ref_get_commit (FLATPAK_REF (runtime)),
|
||||
flatpak_installed_ref_get_origin (runtime),
|
||||
flatpak_installed_ref_get_deploy_dir (runtime),
|
||||
flatpak_installed_ref_get_is_current (runtime));
|
||||
}
|
||||
}
|
||||
|
||||
g_print ("\n**** Getting installed gedit master\n");
|
||||
app1 = xdg_app_installation_get_installed_ref (installation,
|
||||
XDG_APP_REF_KIND_APP,
|
||||
app1 = flatpak_installation_get_installed_ref (installation,
|
||||
FLATPAK_REF_KIND_APP,
|
||||
"org.gnome.gedit",
|
||||
NULL, "master", NULL, NULL);
|
||||
if (app1)
|
||||
{
|
||||
g_print ("gedit master: %d %s %s %s %s %s %s %d\n",
|
||||
xdg_app_ref_get_kind (XDG_APP_REF (app1)),
|
||||
xdg_app_ref_get_name (XDG_APP_REF (app1)),
|
||||
xdg_app_ref_get_arch (XDG_APP_REF (app1)),
|
||||
xdg_app_ref_get_branch (XDG_APP_REF (app1)),
|
||||
xdg_app_ref_get_commit (XDG_APP_REF (app1)),
|
||||
xdg_app_installed_ref_get_origin (app1),
|
||||
xdg_app_installed_ref_get_deploy_dir (app1),
|
||||
xdg_app_installed_ref_get_is_current (app1));
|
||||
flatpak_ref_get_kind (FLATPAK_REF (app1)),
|
||||
flatpak_ref_get_name (FLATPAK_REF (app1)),
|
||||
flatpak_ref_get_arch (FLATPAK_REF (app1)),
|
||||
flatpak_ref_get_branch (FLATPAK_REF (app1)),
|
||||
flatpak_ref_get_commit (FLATPAK_REF (app1)),
|
||||
flatpak_installed_ref_get_origin (app1),
|
||||
flatpak_installed_ref_get_deploy_dir (app1),
|
||||
flatpak_installed_ref_get_is_current (app1));
|
||||
}
|
||||
if (!xdg_app_installation_launch (installation,
|
||||
if (!flatpak_installation_launch (installation,
|
||||
"org.gnome.gedit",
|
||||
NULL, NULL, NULL,
|
||||
NULL, &error))
|
||||
|
@ -268,63 +268,63 @@ main (int argc, char *argv[])
|
|||
}
|
||||
|
||||
g_print ("\n**** Getting current installed gedit\n");
|
||||
app2 = xdg_app_installation_get_current_installed_app (installation,
|
||||
app2 = flatpak_installation_get_current_installed_app (installation,
|
||||
"org.gnome.gedit",
|
||||
NULL, NULL);
|
||||
if (app2)
|
||||
{
|
||||
g_print ("gedit current: %d %s %s %s %s %s %s %d\n",
|
||||
xdg_app_ref_get_kind (XDG_APP_REF (app2)),
|
||||
xdg_app_ref_get_name (XDG_APP_REF (app2)),
|
||||
xdg_app_ref_get_arch (XDG_APP_REF (app2)),
|
||||
xdg_app_ref_get_branch (XDG_APP_REF (app2)),
|
||||
xdg_app_ref_get_commit (XDG_APP_REF (app2)),
|
||||
xdg_app_installed_ref_get_origin (app2),
|
||||
xdg_app_installed_ref_get_deploy_dir (app2),
|
||||
xdg_app_installed_ref_get_is_current (app2));
|
||||
flatpak_ref_get_kind (FLATPAK_REF (app2)),
|
||||
flatpak_ref_get_name (FLATPAK_REF (app2)),
|
||||
flatpak_ref_get_arch (FLATPAK_REF (app2)),
|
||||
flatpak_ref_get_branch (FLATPAK_REF (app2)),
|
||||
flatpak_ref_get_commit (FLATPAK_REF (app2)),
|
||||
flatpak_installed_ref_get_origin (app2),
|
||||
flatpak_installed_ref_get_deploy_dir (app2),
|
||||
flatpak_installed_ref_get_is_current (app2));
|
||||
}
|
||||
|
||||
|
||||
g_print ("\n**** Listing remotes\n");
|
||||
remotes = xdg_app_installation_list_remotes (installation,
|
||||
remotes = flatpak_installation_list_remotes (installation,
|
||||
NULL, NULL);
|
||||
|
||||
for (i = 0; i < remotes->len; i++)
|
||||
{
|
||||
XdgAppRemote *remote = g_ptr_array_index (remotes, i);
|
||||
FlatpakRemote *remote = g_ptr_array_index (remotes, i);
|
||||
g_autoptr(GPtrArray) refs = NULL;
|
||||
g_print ("\nRemote: %s %d %s %s %d %d %s\n",
|
||||
xdg_app_remote_get_name (remote),
|
||||
xdg_app_remote_get_prio (remote),
|
||||
xdg_app_remote_get_url (remote),
|
||||
xdg_app_remote_get_title (remote),
|
||||
xdg_app_remote_get_gpg_verify (remote),
|
||||
xdg_app_remote_get_noenumerate (remote),
|
||||
g_file_get_path (xdg_app_remote_get_appstream_dir (remote, NULL)));
|
||||
flatpak_remote_get_name (remote),
|
||||
flatpak_remote_get_prio (remote),
|
||||
flatpak_remote_get_url (remote),
|
||||
flatpak_remote_get_title (remote),
|
||||
flatpak_remote_get_gpg_verify (remote),
|
||||
flatpak_remote_get_noenumerate (remote),
|
||||
g_file_get_path (flatpak_remote_get_appstream_dir (remote, NULL)));
|
||||
|
||||
g_print ("\n**** Listing remote refs on %s\n", xdg_app_remote_get_name (remote));
|
||||
refs = xdg_app_installation_list_remote_refs_sync (installation, xdg_app_remote_get_name (remote),
|
||||
g_print ("\n**** Listing remote refs on %s\n", flatpak_remote_get_name (remote));
|
||||
refs = flatpak_installation_list_remote_refs_sync (installation, flatpak_remote_get_name (remote),
|
||||
NULL, NULL);
|
||||
if (refs)
|
||||
{
|
||||
for (j = 0; j < refs->len; j++)
|
||||
{
|
||||
XdgAppRemoteRef *ref = g_ptr_array_index (refs, j);
|
||||
FlatpakRemoteRef *ref = g_ptr_array_index (refs, j);
|
||||
g_print ("%d %s %s %s %s %s\n",
|
||||
xdg_app_ref_get_kind (XDG_APP_REF (ref)),
|
||||
xdg_app_ref_get_name (XDG_APP_REF (ref)),
|
||||
xdg_app_ref_get_arch (XDG_APP_REF (ref)),
|
||||
xdg_app_ref_get_branch (XDG_APP_REF (ref)),
|
||||
xdg_app_ref_get_commit (XDG_APP_REF (ref)),
|
||||
xdg_app_remote_ref_get_remote_name (ref));
|
||||
flatpak_ref_get_kind (FLATPAK_REF (ref)),
|
||||
flatpak_ref_get_name (FLATPAK_REF (ref)),
|
||||
flatpak_ref_get_arch (FLATPAK_REF (ref)),
|
||||
flatpak_ref_get_branch (FLATPAK_REF (ref)),
|
||||
flatpak_ref_get_commit (FLATPAK_REF (ref)),
|
||||
flatpak_remote_ref_get_remote_name (ref));
|
||||
|
||||
if (j == 0)
|
||||
{
|
||||
guint64 download_size;
|
||||
guint64 installed_size;
|
||||
if (!xdg_app_installation_fetch_remote_size_sync (installation,
|
||||
xdg_app_remote_get_name (remote),
|
||||
xdg_app_ref_get_commit (XDG_APP_REF (ref)),
|
||||
if (!flatpak_installation_fetch_remote_size_sync (installation,
|
||||
flatpak_remote_get_name (remote),
|
||||
flatpak_ref_get_commit (FLATPAK_REF (ref)),
|
||||
&download_size,
|
||||
&installed_size,
|
||||
NULL, &error))
|
||||
|
@ -338,9 +338,9 @@ main (int argc, char *argv[])
|
|||
download_size, installed_size);
|
||||
}
|
||||
|
||||
if (!xdg_app_installation_fetch_remote_size_sync2 (installation,
|
||||
xdg_app_remote_get_name (remote),
|
||||
XDG_APP_REF (ref),
|
||||
if (!flatpak_installation_fetch_remote_size_sync2 (installation,
|
||||
flatpak_remote_get_name (remote),
|
||||
FLATPAK_REF (ref),
|
||||
&download_size,
|
||||
&installed_size,
|
||||
NULL, &error))
|
||||
|
@ -358,10 +358,10 @@ main (int argc, char *argv[])
|
|||
}
|
||||
}
|
||||
|
||||
g_print ("\n**** Getting remote platform 3.20 on %s\n", xdg_app_remote_get_name (remote));
|
||||
g_print ("\n**** Getting remote platform 3.20 on %s\n", flatpak_remote_get_name (remote));
|
||||
error = NULL;
|
||||
remote_ref = xdg_app_installation_fetch_remote_ref_sync (installation, xdg_app_remote_get_name (remote),
|
||||
XDG_APP_REF_KIND_RUNTIME,
|
||||
remote_ref = flatpak_installation_fetch_remote_ref_sync (installation, flatpak_remote_get_name (remote),
|
||||
FLATPAK_REF_KIND_RUNTIME,
|
||||
"org.gnome.Platform", NULL, "3.20",
|
||||
NULL, &error);
|
||||
if (remote_ref)
|
||||
|
@ -370,15 +370,15 @@ main (int argc, char *argv[])
|
|||
GBytes *metadata2;
|
||||
|
||||
g_print ("%d %s %s %s %s %s\n",
|
||||
xdg_app_ref_get_kind (XDG_APP_REF (remote_ref)),
|
||||
xdg_app_ref_get_name (XDG_APP_REF (remote_ref)),
|
||||
xdg_app_ref_get_arch (XDG_APP_REF (remote_ref)),
|
||||
xdg_app_ref_get_branch (XDG_APP_REF (remote_ref)),
|
||||
xdg_app_ref_get_commit (XDG_APP_REF (remote_ref)),
|
||||
xdg_app_remote_ref_get_remote_name (remote_ref));
|
||||
flatpak_ref_get_kind (FLATPAK_REF (remote_ref)),
|
||||
flatpak_ref_get_name (FLATPAK_REF (remote_ref)),
|
||||
flatpak_ref_get_arch (FLATPAK_REF (remote_ref)),
|
||||
flatpak_ref_get_branch (FLATPAK_REF (remote_ref)),
|
||||
flatpak_ref_get_commit (FLATPAK_REF (remote_ref)),
|
||||
flatpak_remote_ref_get_remote_name (remote_ref));
|
||||
|
||||
metadata = xdg_app_installation_fetch_remote_metadata_sync (installation, xdg_app_remote_get_name (remote),
|
||||
xdg_app_ref_get_commit (XDG_APP_REF (remote_ref)), NULL, &error);
|
||||
metadata = flatpak_installation_fetch_remote_metadata_sync (installation, flatpak_remote_get_name (remote),
|
||||
flatpak_ref_get_commit (FLATPAK_REF (remote_ref)), NULL, &error);
|
||||
if (metadata)
|
||||
{
|
||||
g_print ("metadata: %s\n", (char *) g_bytes_get_data (metadata, NULL));
|
||||
|
@ -390,8 +390,8 @@ main (int argc, char *argv[])
|
|||
g_clear_error (&error);
|
||||
}
|
||||
|
||||
metadata2 = xdg_app_installation_fetch_remote_metadata_sync2 (installation, xdg_app_remote_get_name (remote),
|
||||
XDG_APP_REF (remote_ref), NULL, &error);
|
||||
metadata2 = flatpak_installation_fetch_remote_metadata_sync2 (installation, flatpak_remote_get_name (remote),
|
||||
FLATPAK_REF (remote_ref), NULL, &error);
|
||||
if (metadata2)
|
||||
{
|
||||
g_print ("metadata2: %s\n", (char *) g_bytes_get_data (metadata2, NULL));
|
||||
|
|
|
@ -26,9 +26,9 @@
|
|||
#include "xdg-app-bundle-ref.h"
|
||||
#include "xdg-app-enum-types.h"
|
||||
|
||||
typedef struct _XdgAppBundleRefPrivate XdgAppBundleRefPrivate;
|
||||
typedef struct _FlatpakBundleRefPrivate FlatpakBundleRefPrivate;
|
||||
|
||||
struct _XdgAppBundleRefPrivate
|
||||
struct _FlatpakBundleRefPrivate
|
||||
{
|
||||
GFile *file;
|
||||
char *origin;
|
||||
|
@ -39,7 +39,7 @@ struct _XdgAppBundleRefPrivate
|
|||
guint64 installed_size;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (XdgAppBundleRef, xdg_app_bundle_ref, XDG_APP_TYPE_REF)
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (FlatpakBundleRef, flatpak_bundle_ref, FLATPAK_TYPE_REF)
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
|
@ -48,10 +48,10 @@ enum {
|
|||
};
|
||||
|
||||
static void
|
||||
xdg_app_bundle_ref_finalize (GObject *object)
|
||||
flatpak_bundle_ref_finalize (GObject *object)
|
||||
{
|
||||
XdgAppBundleRef *self = XDG_APP_BUNDLE_REF (object);
|
||||
XdgAppBundleRefPrivate *priv = xdg_app_bundle_ref_get_instance_private (self);
|
||||
FlatpakBundleRef *self = FLATPAK_BUNDLE_REF (object);
|
||||
FlatpakBundleRefPrivate *priv = flatpak_bundle_ref_get_instance_private (self);
|
||||
|
||||
g_clear_object (&priv->file);
|
||||
|
||||
|
@ -61,17 +61,17 @@ xdg_app_bundle_ref_finalize (GObject *object)
|
|||
g_bytes_unref (priv->icon_128);
|
||||
g_free (priv->origin);
|
||||
|
||||
G_OBJECT_CLASS (xdg_app_bundle_ref_parent_class)->finalize (object);
|
||||
G_OBJECT_CLASS (flatpak_bundle_ref_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
xdg_app_bundle_ref_set_property (GObject *object,
|
||||
flatpak_bundle_ref_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
XdgAppBundleRef *self = XDG_APP_BUNDLE_REF (object);
|
||||
XdgAppBundleRefPrivate *priv = xdg_app_bundle_ref_get_instance_private (self);
|
||||
FlatpakBundleRef *self = FLATPAK_BUNDLE_REF (object);
|
||||
FlatpakBundleRefPrivate *priv = flatpak_bundle_ref_get_instance_private (self);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
|
@ -86,13 +86,13 @@ xdg_app_bundle_ref_set_property (GObject *object,
|
|||
}
|
||||
|
||||
static void
|
||||
xdg_app_bundle_ref_get_property (GObject *object,
|
||||
flatpak_bundle_ref_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
XdgAppBundleRef *self = XDG_APP_BUNDLE_REF (object);
|
||||
XdgAppBundleRefPrivate *priv = xdg_app_bundle_ref_get_instance_private (self);
|
||||
FlatpakBundleRef *self = FLATPAK_BUNDLE_REF (object);
|
||||
FlatpakBundleRefPrivate *priv = flatpak_bundle_ref_get_instance_private (self);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
|
@ -107,13 +107,13 @@ xdg_app_bundle_ref_get_property (GObject *object,
|
|||
}
|
||||
|
||||
static void
|
||||
xdg_app_bundle_ref_class_init (XdgAppBundleRefClass *klass)
|
||||
flatpak_bundle_ref_class_init (FlatpakBundleRefClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->get_property = xdg_app_bundle_ref_get_property;
|
||||
object_class->set_property = xdg_app_bundle_ref_set_property;
|
||||
object_class->finalize = xdg_app_bundle_ref_finalize;
|
||||
object_class->get_property = flatpak_bundle_ref_get_property;
|
||||
object_class->set_property = flatpak_bundle_ref_set_property;
|
||||
object_class->finalize = flatpak_bundle_ref_finalize;
|
||||
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_FILE,
|
||||
|
@ -125,38 +125,38 @@ xdg_app_bundle_ref_class_init (XdgAppBundleRefClass *klass)
|
|||
}
|
||||
|
||||
static void
|
||||
xdg_app_bundle_ref_init (XdgAppBundleRef *self)
|
||||
flatpak_bundle_ref_init (FlatpakBundleRef *self)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* xdg_app_bundle_ref_get_file:
|
||||
* @self: a #XdgAppInstallation
|
||||
* flatpak_bundle_ref_get_file:
|
||||
* @self: a #FlatpakInstallation
|
||||
*
|
||||
* Get the file this bundle is stored in.
|
||||
*
|
||||
* Returns: (transfer full) : an #GFile
|
||||
*/
|
||||
GFile *
|
||||
xdg_app_bundle_ref_get_file (XdgAppBundleRef *self)
|
||||
flatpak_bundle_ref_get_file (FlatpakBundleRef *self)
|
||||
{
|
||||
XdgAppBundleRefPrivate *priv = xdg_app_bundle_ref_get_instance_private (self);
|
||||
FlatpakBundleRefPrivate *priv = flatpak_bundle_ref_get_instance_private (self);
|
||||
|
||||
return g_object_ref (priv->file);
|
||||
}
|
||||
|
||||
/**
|
||||
* xdg_app_bundle_ref_get_metadata:
|
||||
* @self: a #XdgAppInstallation
|
||||
* flatpak_bundle_ref_get_metadata:
|
||||
* @self: a #FlatpakInstallation
|
||||
*
|
||||
* Get the metadata for the app/runtime
|
||||
*
|
||||
* Returns: (transfer full) : an #GBytes with the metadata contents, or %NULL
|
||||
*/
|
||||
GBytes *
|
||||
xdg_app_bundle_ref_get_metadata (XdgAppBundleRef *self)
|
||||
flatpak_bundle_ref_get_metadata (FlatpakBundleRef *self)
|
||||
{
|
||||
XdgAppBundleRefPrivate *priv = xdg_app_bundle_ref_get_instance_private (self);
|
||||
FlatpakBundleRefPrivate *priv = flatpak_bundle_ref_get_instance_private (self);
|
||||
|
||||
if (priv->metadata)
|
||||
return g_bytes_ref (priv->metadata);
|
||||
|
@ -164,17 +164,17 @@ xdg_app_bundle_ref_get_metadata (XdgAppBundleRef *self)
|
|||
}
|
||||
|
||||
/**
|
||||
* xdg_app_bundle_ref_get_appstream:
|
||||
* @self: a #XdgAppInstallation
|
||||
* flatpak_bundle_ref_get_appstream:
|
||||
* @self: a #FlatpakInstallation
|
||||
*
|
||||
* Get the compressed appstream for the app/runtime
|
||||
*
|
||||
* Returns: (transfer full) : an #GBytes with the appstream contents, or %NULL
|
||||
*/
|
||||
GBytes *
|
||||
xdg_app_bundle_ref_get_appstream (XdgAppBundleRef *self)
|
||||
flatpak_bundle_ref_get_appstream (FlatpakBundleRef *self)
|
||||
{
|
||||
XdgAppBundleRefPrivate *priv = xdg_app_bundle_ref_get_instance_private (self);
|
||||
FlatpakBundleRefPrivate *priv = flatpak_bundle_ref_get_instance_private (self);
|
||||
|
||||
if (priv->appstream)
|
||||
return g_bytes_ref (priv->appstream);
|
||||
|
@ -182,8 +182,8 @@ xdg_app_bundle_ref_get_appstream (XdgAppBundleRef *self)
|
|||
}
|
||||
|
||||
/**
|
||||
* xdg_app_bundle_ref_get_icon:
|
||||
* @self: a #XdgAppInstallation
|
||||
* flatpak_bundle_ref_get_icon:
|
||||
* @self: a #FlatpakInstallation
|
||||
* @size: 64 or 128
|
||||
*
|
||||
* Get the icon png data for the app/runtime
|
||||
|
@ -191,10 +191,10 @@ xdg_app_bundle_ref_get_appstream (XdgAppBundleRef *self)
|
|||
* Returns: (transfer full) : an #GBytes with png contents
|
||||
*/
|
||||
GBytes *
|
||||
xdg_app_bundle_ref_get_icon (XdgAppBundleRef *self,
|
||||
int size)
|
||||
flatpak_bundle_ref_get_icon (FlatpakBundleRef *self,
|
||||
int size)
|
||||
{
|
||||
XdgAppBundleRefPrivate *priv = xdg_app_bundle_ref_get_instance_private (self);
|
||||
FlatpakBundleRefPrivate *priv = flatpak_bundle_ref_get_instance_private (self);
|
||||
|
||||
if (size == 64 && priv->icon_64)
|
||||
return g_bytes_ref (priv->icon_64);
|
||||
|
@ -206,39 +206,39 @@ xdg_app_bundle_ref_get_icon (XdgAppBundleRef *self,
|
|||
}
|
||||
|
||||
/**
|
||||
* xdg_app_bundle_ref_get_origin:
|
||||
* @self: a #XdgAppInstallation
|
||||
* flatpak_bundle_ref_get_origin:
|
||||
* @self: a #FlatpakInstallation
|
||||
*
|
||||
* Get the origin url stored in the bundle
|
||||
*
|
||||
* Returns: (transfer full) : an url string, or %NULL
|
||||
*/
|
||||
char *
|
||||
xdg_app_bundle_ref_get_origin (XdgAppBundleRef *self)
|
||||
flatpak_bundle_ref_get_origin (FlatpakBundleRef *self)
|
||||
{
|
||||
XdgAppBundleRefPrivate *priv = xdg_app_bundle_ref_get_instance_private (self);
|
||||
FlatpakBundleRefPrivate *priv = flatpak_bundle_ref_get_instance_private (self);
|
||||
|
||||
return g_strdup (priv->origin);
|
||||
}
|
||||
|
||||
guint64
|
||||
xdg_app_bundle_ref_get_installed_size (XdgAppBundleRef *self)
|
||||
flatpak_bundle_ref_get_installed_size (FlatpakBundleRef *self)
|
||||
{
|
||||
XdgAppBundleRefPrivate *priv = xdg_app_bundle_ref_get_instance_private (self);
|
||||
FlatpakBundleRefPrivate *priv = flatpak_bundle_ref_get_instance_private (self);
|
||||
|
||||
return priv->installed_size;
|
||||
}
|
||||
|
||||
|
||||
XdgAppBundleRef *
|
||||
xdg_app_bundle_ref_new (GFile *file,
|
||||
FlatpakBundleRef *
|
||||
flatpak_bundle_ref_new (GFile *file,
|
||||
GError **error)
|
||||
{
|
||||
XdgAppRefKind kind = XDG_APP_REF_KIND_APP;
|
||||
XdgAppBundleRefPrivate *priv;
|
||||
FlatpakRefKind kind = FLATPAK_REF_KIND_APP;
|
||||
FlatpakBundleRefPrivate *priv;
|
||||
|
||||
g_auto(GStrv) parts = NULL;
|
||||
XdgAppBundleRef *ref;
|
||||
FlatpakBundleRef *ref;
|
||||
g_autoptr(GVariant) metadata = NULL;
|
||||
g_autofree char *commit = NULL;
|
||||
g_autofree char *full_ref = NULL;
|
||||
|
@ -249,12 +249,12 @@ xdg_app_bundle_ref_new (GFile *file,
|
|||
g_autoptr(GVariant) icon_128 = NULL;
|
||||
guint64 installed_size;
|
||||
|
||||
metadata = xdg_app_bundle_load (file, &commit, &full_ref, &origin, &installed_size,
|
||||
metadata = flatpak_bundle_load (file, &commit, &full_ref, &origin, &installed_size,
|
||||
NULL, error);
|
||||
if (metadata == NULL)
|
||||
return NULL;
|
||||
|
||||
parts = xdg_app_decompose_ref (full_ref, error);
|
||||
parts = flatpak_decompose_ref (full_ref, error);
|
||||
if (parts == NULL)
|
||||
return NULL;
|
||||
|
||||
|
@ -262,9 +262,9 @@ xdg_app_bundle_ref_new (GFile *file,
|
|||
metadata_contents = NULL;
|
||||
|
||||
if (strcmp (parts[0], "app") != 0)
|
||||
kind = XDG_APP_REF_KIND_RUNTIME;
|
||||
kind = FLATPAK_REF_KIND_RUNTIME;
|
||||
|
||||
ref = g_object_new (XDG_APP_TYPE_BUNDLE_REF,
|
||||
ref = g_object_new (FLATPAK_TYPE_BUNDLE_REF,
|
||||
"kind", kind,
|
||||
"name", parts[1],
|
||||
"arch", parts[2],
|
||||
|
@ -272,7 +272,7 @@ xdg_app_bundle_ref_new (GFile *file,
|
|||
"commit", commit,
|
||||
"file", file,
|
||||
NULL);
|
||||
priv = xdg_app_bundle_ref_get_instance_private (ref);
|
||||
priv = flatpak_bundle_ref_get_instance_private (ref);
|
||||
|
||||
if (metadata_contents)
|
||||
priv->metadata = g_bytes_new_take (metadata_contents,
|
||||
|
|
|
@ -18,47 +18,47 @@
|
|||
* Alexander Larsson <alexl@redhat.com>
|
||||
*/
|
||||
|
||||
#if !defined(__XDG_APP_H_INSIDE__) && !defined(XDG_APP_COMPILATION)
|
||||
#if !defined(__FLATPAK_H_INSIDE__) && !defined(FLATPAK_COMPILATION)
|
||||
#error "Only <xdg-app.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#ifndef __XDG_APP_BUNDLE_REF_H__
|
||||
#define __XDG_APP_BUNDLE_REF_H__
|
||||
#ifndef __FLATPAK_BUNDLE_REF_H__
|
||||
#define __FLATPAK_BUNDLE_REF_H__
|
||||
|
||||
typedef struct _XdgAppBundleRef XdgAppBundleRef;
|
||||
typedef struct _FlatpakBundleRef FlatpakBundleRef;
|
||||
|
||||
#include <gio/gio.h>
|
||||
#include <xdg-app-ref.h>
|
||||
|
||||
#define XDG_APP_TYPE_BUNDLE_REF xdg_app_bundle_ref_get_type ()
|
||||
#define XDG_APP_BUNDLE_REF(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), XDG_APP_TYPE_BUNDLE_REF, XdgAppBundleRef))
|
||||
#define XDG_APP_IS_BUNDLE_REF(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), XDG_APP_TYPE_BUNDLE_REF))
|
||||
#define FLATPAK_TYPE_BUNDLE_REF flatpak_bundle_ref_get_type ()
|
||||
#define FLATPAK_BUNDLE_REF(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FLATPAK_TYPE_BUNDLE_REF, FlatpakBundleRef))
|
||||
#define FLATPAK_IS_BUNDLE_REF(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FLATPAK_TYPE_BUNDLE_REF))
|
||||
|
||||
XDG_APP_EXTERN GType xdg_app_bundle_ref_get_type (void);
|
||||
FLATPAK_EXTERN GType flatpak_bundle_ref_get_type (void);
|
||||
|
||||
struct _XdgAppBundleRef
|
||||
struct _FlatpakBundleRef
|
||||
{
|
||||
XdgAppRef parent;
|
||||
FlatpakRef parent;
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
XdgAppRefClass parent_class;
|
||||
} XdgAppBundleRefClass;
|
||||
FlatpakRefClass parent_class;
|
||||
} FlatpakBundleRefClass;
|
||||
|
||||
XDG_APP_EXTERN XdgAppBundleRef *xdg_app_bundle_ref_new (GFile *file,
|
||||
GError **error);
|
||||
XDG_APP_EXTERN GFile *xdg_app_bundle_ref_get_file (XdgAppBundleRef *self);
|
||||
XDG_APP_EXTERN GBytes *xdg_app_bundle_ref_get_metadata (XdgAppBundleRef *self);
|
||||
XDG_APP_EXTERN GBytes *xdg_app_bundle_ref_get_appstream (XdgAppBundleRef *self);
|
||||
XDG_APP_EXTERN GBytes *xdg_app_bundle_ref_get_icon (XdgAppBundleRef *self,
|
||||
int size);
|
||||
XDG_APP_EXTERN char *xdg_app_bundle_ref_get_origin (XdgAppBundleRef *self);
|
||||
XDG_APP_EXTERN guint64 xdg_app_bundle_ref_get_installed_size (XdgAppBundleRef *self);
|
||||
FLATPAK_EXTERN FlatpakBundleRef *flatpak_bundle_ref_new (GFile *file,
|
||||
GError **error);
|
||||
FLATPAK_EXTERN GFile *flatpak_bundle_ref_get_file (FlatpakBundleRef *self);
|
||||
FLATPAK_EXTERN GBytes *flatpak_bundle_ref_get_metadata (FlatpakBundleRef *self);
|
||||
FLATPAK_EXTERN GBytes *flatpak_bundle_ref_get_appstream (FlatpakBundleRef *self);
|
||||
FLATPAK_EXTERN GBytes *flatpak_bundle_ref_get_icon (FlatpakBundleRef *self,
|
||||
int size);
|
||||
FLATPAK_EXTERN char *flatpak_bundle_ref_get_origin (FlatpakBundleRef *self);
|
||||
FLATPAK_EXTERN guint64 flatpak_bundle_ref_get_installed_size (FlatpakBundleRef *self);
|
||||
|
||||
|
||||
#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (XdgAppBundleRef, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (FlatpakBundleRef, g_object_unref)
|
||||
#endif
|
||||
|
||||
#endif /* __XDG_APP_BUNDLE_REF_H__ */
|
||||
#endif /* __FLATPAK_BUNDLE_REF_H__ */
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*** BEGIN file-header ***/
|
||||
#ifndef __XDG_APP_ENUM_TYPES_H__
|
||||
#define __XDG_APP_ENUM_TYPES_H__
|
||||
#ifndef __FLATPAK_ENUM_TYPES_H__
|
||||
#define __FLATPAK_ENUM_TYPES_H__
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
|
@ -13,7 +13,7 @@ G_BEGIN_DECLS
|
|||
/*** END file-production ***/
|
||||
|
||||
/*** BEGIN value-header ***/
|
||||
XDG_APP_EXTERN GType @enum_name@_get_type (void) G_GNUC_CONST;
|
||||
FLATPAK_EXTERN GType @enum_name@_get_type (void) G_GNUC_CONST;
|
||||
#define @ENUMPREFIX@_TYPE_@ENUMSHORT@ (@enum_name@_get_type ())
|
||||
/*** END value-header ***/
|
||||
|
||||
|
|
|
@ -31,4 +31,4 @@
|
|||
*
|
||||
*/
|
||||
|
||||
G_DEFINE_QUARK (xdg - app - error - quark, xdg_app_error)
|
||||
G_DEFINE_QUARK (xdg - app - error - quark, flatpak_error)
|
||||
|
|
|
@ -19,29 +19,29 @@
|
|||
* Alexander Larsson <alexl@redhat.com>
|
||||
*/
|
||||
|
||||
#ifndef XDG_APP_ERROR_H
|
||||
#define XDG_APP_ERROR_H
|
||||
#ifndef FLATPAK_ERROR_H
|
||||
#define FLATPAK_ERROR_H
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/**
|
||||
* XdgAppError:
|
||||
* @XDG_APP_ERROR_ALREADY_INSTALLED: App/runtime is already installed
|
||||
* @XDG_APP_ERROR_NOT_INSTALLED: App/runtime is not installed
|
||||
* FlatpakError:
|
||||
* @FLATPAK_ERROR_ALREADY_INSTALLED: App/runtime is already installed
|
||||
* @FLATPAK_ERROR_NOT_INSTALLED: App/runtime is not installed
|
||||
*
|
||||
* Error codes for library functions.
|
||||
*/
|
||||
typedef enum {
|
||||
XDG_APP_ERROR_ALREADY_INSTALLED,
|
||||
XDG_APP_ERROR_NOT_INSTALLED,
|
||||
} XdgAppError;
|
||||
FLATPAK_ERROR_ALREADY_INSTALLED,
|
||||
FLATPAK_ERROR_NOT_INSTALLED,
|
||||
} FlatpakError;
|
||||
|
||||
#define XDG_APP_ERROR xdg_app_error_quark ()
|
||||
#define FLATPAK_ERROR flatpak_error_quark ()
|
||||
|
||||
XDG_APP_EXTERN GQuark xdg_app_error_quark (void);
|
||||
FLATPAK_EXTERN GQuark flatpak_error_quark (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* XDG_APP_ERROR_H */
|
||||
#endif /* FLATPAK_ERROR_H */
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -18,26 +18,26 @@
|
|||
* Alexander Larsson <alexl@redhat.com>
|
||||
*/
|
||||
|
||||
#if !defined(__XDG_APP_H_INSIDE__) && !defined(XDG_APP_COMPILATION)
|
||||
#if !defined(__FLATPAK_H_INSIDE__) && !defined(FLATPAK_COMPILATION)
|
||||
#error "Only <xdg-app.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#ifndef __XDG_APP_INSTALLATION_H__
|
||||
#define __XDG_APP_INSTALLATION_H__
|
||||
#ifndef __FLATPAK_INSTALLATION_H__
|
||||
#define __FLATPAK_INSTALLATION_H__
|
||||
|
||||
typedef struct _XdgAppInstallation XdgAppInstallation;
|
||||
typedef struct _FlatpakInstallation FlatpakInstallation;
|
||||
|
||||
#include <gio/gio.h>
|
||||
#include <xdg-app-installed-ref.h>
|
||||
#include <xdg-app-remote.h>
|
||||
|
||||
#define XDG_APP_TYPE_INSTALLATION xdg_app_installation_get_type ()
|
||||
#define XDG_APP_INSTALLATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), XDG_APP_TYPE_INSTALLATION, XdgAppInstallation))
|
||||
#define XDG_APP_IS_INSTALLATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), XDG_APP_TYPE_INSTALLATION))
|
||||
#define FLATPAK_TYPE_INSTALLATION flatpak_installation_get_type ()
|
||||
#define FLATPAK_INSTALLATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FLATPAK_TYPE_INSTALLATION, FlatpakInstallation))
|
||||
#define FLATPAK_IS_INSTALLATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FLATPAK_TYPE_INSTALLATION))
|
||||
|
||||
XDG_APP_EXTERN GType xdg_app_installation_get_type (void);
|
||||
FLATPAK_EXTERN GType flatpak_installation_get_type (void);
|
||||
|
||||
struct _XdgAppInstallation
|
||||
struct _FlatpakInstallation
|
||||
{
|
||||
GObject parent;
|
||||
};
|
||||
|
@ -45,40 +45,40 @@ struct _XdgAppInstallation
|
|||
typedef struct
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
} XdgAppInstallationClass;
|
||||
} FlatpakInstallationClass;
|
||||
|
||||
/**
|
||||
* XdgAppUpdateFlags:
|
||||
* @XDG_APP_UPDATE_FLAGS_NONE: Fetch remote builds and install the latest one (default)
|
||||
* @XDG_APP_UPDATE_FLAGS_NO_DEPLOY: Don't install any new builds that might be fetched
|
||||
* @XDG_APP_UPDATE_FLAGS_NO_PULL: Don't try to fetch new builds from the remote repo
|
||||
* FlatpakUpdateFlags:
|
||||
* @FLATPAK_UPDATE_FLAGS_NONE: Fetch remote builds and install the latest one (default)
|
||||
* @FLATPAK_UPDATE_FLAGS_NO_DEPLOY: Don't install any new builds that might be fetched
|
||||
* @FLATPAK_UPDATE_FLAGS_NO_PULL: Don't try to fetch new builds from the remote repo
|
||||
*
|
||||
* Flags to alter the behavior of xdg_app_installation_update().
|
||||
* Flags to alter the behavior of flatpak_installation_update().
|
||||
*/
|
||||
typedef enum {
|
||||
XDG_APP_UPDATE_FLAGS_NONE = 0,
|
||||
XDG_APP_UPDATE_FLAGS_NO_DEPLOY = (1 << 0),
|
||||
XDG_APP_UPDATE_FLAGS_NO_PULL = (1 << 1),
|
||||
} XdgAppUpdateFlags;
|
||||
FLATPAK_UPDATE_FLAGS_NONE = 0,
|
||||
FLATPAK_UPDATE_FLAGS_NO_DEPLOY = (1 << 0),
|
||||
FLATPAK_UPDATE_FLAGS_NO_PULL = (1 << 1),
|
||||
} FlatpakUpdateFlags;
|
||||
|
||||
|
||||
#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (XdgAppInstallation, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (FlatpakInstallation, g_object_unref)
|
||||
#endif
|
||||
|
||||
XDG_APP_EXTERN const char *xdg_app_get_default_arch (void);
|
||||
FLATPAK_EXTERN const char *flatpak_get_default_arch (void);
|
||||
|
||||
XDG_APP_EXTERN XdgAppInstallation *xdg_app_installation_new_system (GCancellable *cancellable,
|
||||
GError **error);
|
||||
XDG_APP_EXTERN XdgAppInstallation *xdg_app_installation_new_user (GCancellable *cancellable,
|
||||
GError **error);
|
||||
XDG_APP_EXTERN XdgAppInstallation *xdg_app_installation_new_for_path (GFile *path,
|
||||
gboolean user,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
FLATPAK_EXTERN FlatpakInstallation *flatpak_installation_new_system (GCancellable *cancellable,
|
||||
GError **error);
|
||||
FLATPAK_EXTERN FlatpakInstallation *flatpak_installation_new_user (GCancellable *cancellable,
|
||||
GError **error);
|
||||
FLATPAK_EXTERN FlatpakInstallation *flatpak_installation_new_for_path (GFile *path,
|
||||
gboolean user,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
|
||||
/**
|
||||
* XdgAppProgressCallback:
|
||||
* FlatpakProgressCallback:
|
||||
* @status: A status string, suitable for display
|
||||
* @progress: percentage of completion
|
||||
* @estimating: whether @progress is just an estimate
|
||||
|
@ -90,132 +90,132 @@ XDG_APP_EXTERN XdgAppInstallation *xdg_app_installation_new_for_path (GFile
|
|||
*
|
||||
* The callback occurs in the thread-default context of the caller.
|
||||
*/
|
||||
typedef void (*XdgAppProgressCallback)(const char *status,
|
||||
guint progress,
|
||||
gboolean estimating,
|
||||
gpointer user_data);
|
||||
typedef void (*FlatpakProgressCallback)(const char *status,
|
||||
guint progress,
|
||||
gboolean estimating,
|
||||
gpointer user_data);
|
||||
|
||||
XDG_APP_EXTERN gboolean xdg_app_installation_get_is_user (XdgAppInstallation *self);
|
||||
XDG_APP_EXTERN GFile *xdg_app_installation_get_path (XdgAppInstallation *self);
|
||||
XDG_APP_EXTERN gboolean xdg_app_installation_launch (XdgAppInstallation *self,
|
||||
const char *name,
|
||||
const char *arch,
|
||||
const char *branch,
|
||||
const char *commit,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
XDG_APP_EXTERN GFileMonitor *xdg_app_installation_create_monitor (XdgAppInstallation *self,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
XDG_APP_EXTERN GPtrArray *xdg_app_installation_list_installed_refs (XdgAppInstallation *self,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
XDG_APP_EXTERN GPtrArray *xdg_app_installation_list_installed_refs_by_kind (XdgAppInstallation *self,
|
||||
XdgAppRefKind kind,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
XDG_APP_EXTERN GPtrArray *xdg_app_installation_list_installed_refs_for_update (XdgAppInstallation *self,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
XDG_APP_EXTERN XdgAppInstalledRef * xdg_app_installation_get_installed_ref (XdgAppInstallation *self,
|
||||
XdgAppRefKind kind,
|
||||
const char *name,
|
||||
const char *arch,
|
||||
const char *branch,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
XDG_APP_EXTERN XdgAppInstalledRef * xdg_app_installation_get_current_installed_app (XdgAppInstallation *self,
|
||||
const char *name,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
XDG_APP_EXTERN GPtrArray *xdg_app_installation_list_remotes (XdgAppInstallation *self,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
XDG_APP_EXTERN XdgAppRemote *xdg_app_installation_get_remote_by_name (XdgAppInstallation *self,
|
||||
const gchar *name,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
XDG_APP_EXTERN char * xdg_app_installation_load_app_overrides (XdgAppInstallation *self,
|
||||
const char *app_id,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
XDG_APP_EXTERN XdgAppInstalledRef * xdg_app_installation_install (XdgAppInstallation *self,
|
||||
const char *remote_name,
|
||||
XdgAppRefKind kind,
|
||||
const char *name,
|
||||
const char *arch,
|
||||
const char *branch,
|
||||
XdgAppProgressCallback progress,
|
||||
gpointer progress_data,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
XDG_APP_EXTERN XdgAppInstalledRef * xdg_app_installation_update (XdgAppInstallation *self,
|
||||
XdgAppUpdateFlags flags,
|
||||
XdgAppRefKind kind,
|
||||
const char *name,
|
||||
const char *arch,
|
||||
const char *branch,
|
||||
XdgAppProgressCallback progress,
|
||||
gpointer progress_data,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
XDG_APP_EXTERN XdgAppInstalledRef * xdg_app_installation_install_bundle (XdgAppInstallation *self,
|
||||
GFile *file,
|
||||
XdgAppProgressCallback progress,
|
||||
gpointer progress_data,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
XDG_APP_EXTERN gboolean xdg_app_installation_uninstall (XdgAppInstallation *self,
|
||||
XdgAppRefKind kind,
|
||||
const char *name,
|
||||
const char *arch,
|
||||
const char *branch,
|
||||
XdgAppProgressCallback progress,
|
||||
gpointer progress_data,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
FLATPAK_EXTERN gboolean flatpak_installation_get_is_user (FlatpakInstallation *self);
|
||||
FLATPAK_EXTERN GFile *flatpak_installation_get_path (FlatpakInstallation *self);
|
||||
FLATPAK_EXTERN gboolean flatpak_installation_launch (FlatpakInstallation *self,
|
||||
const char *name,
|
||||
const char *arch,
|
||||
const char *branch,
|
||||
const char *commit,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
FLATPAK_EXTERN GFileMonitor *flatpak_installation_create_monitor (FlatpakInstallation *self,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
FLATPAK_EXTERN GPtrArray *flatpak_installation_list_installed_refs (FlatpakInstallation *self,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
FLATPAK_EXTERN GPtrArray *flatpak_installation_list_installed_refs_by_kind (FlatpakInstallation *self,
|
||||
FlatpakRefKind kind,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
FLATPAK_EXTERN GPtrArray *flatpak_installation_list_installed_refs_for_update (FlatpakInstallation *self,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
FLATPAK_EXTERN FlatpakInstalledRef * flatpak_installation_get_installed_ref (FlatpakInstallation *self,
|
||||
FlatpakRefKind kind,
|
||||
const char *name,
|
||||
const char *arch,
|
||||
const char *branch,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
FLATPAK_EXTERN FlatpakInstalledRef * flatpak_installation_get_current_installed_app (FlatpakInstallation *self,
|
||||
const char *name,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
FLATPAK_EXTERN GPtrArray *flatpak_installation_list_remotes (FlatpakInstallation *self,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
FLATPAK_EXTERN FlatpakRemote *flatpak_installation_get_remote_by_name (FlatpakInstallation *self,
|
||||
const gchar *name,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
FLATPAK_EXTERN char * flatpak_installation_load_app_overrides (FlatpakInstallation *self,
|
||||
const char *app_id,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
FLATPAK_EXTERN FlatpakInstalledRef * flatpak_installation_install (FlatpakInstallation *self,
|
||||
const char *remote_name,
|
||||
FlatpakRefKind kind,
|
||||
const char *name,
|
||||
const char *arch,
|
||||
const char *branch,
|
||||
FlatpakProgressCallback progress,
|
||||
gpointer progress_data,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
FLATPAK_EXTERN FlatpakInstalledRef * flatpak_installation_update (FlatpakInstallation *self,
|
||||
FlatpakUpdateFlags flags,
|
||||
FlatpakRefKind kind,
|
||||
const char *name,
|
||||
const char *arch,
|
||||
const char *branch,
|
||||
FlatpakProgressCallback progress,
|
||||
gpointer progress_data,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
FLATPAK_EXTERN FlatpakInstalledRef * flatpak_installation_install_bundle (FlatpakInstallation *self,
|
||||
GFile *file,
|
||||
FlatpakProgressCallback progress,
|
||||
gpointer progress_data,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
FLATPAK_EXTERN gboolean flatpak_installation_uninstall (FlatpakInstallation *self,
|
||||
FlatpakRefKind kind,
|
||||
const char *name,
|
||||
const char *arch,
|
||||
const char *branch,
|
||||
FlatpakProgressCallback progress,
|
||||
gpointer progress_data,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
|
||||
XDG_APP_EXTERN gboolean xdg_app_installation_fetch_remote_size_sync (XdgAppInstallation *self,
|
||||
const char *remote_name,
|
||||
const char *commit,
|
||||
guint64 *download_size,
|
||||
guint64 *installed_size,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
XDG_APP_EXTERN gboolean xdg_app_installation_fetch_remote_size_sync2 (XdgAppInstallation *self,
|
||||
const char *remote_name,
|
||||
XdgAppRef *ref,
|
||||
guint64 *download_size,
|
||||
guint64 *installed_size,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
XDG_APP_EXTERN GBytes * xdg_app_installation_fetch_remote_metadata_sync (XdgAppInstallation *self,
|
||||
const char *remote_name,
|
||||
const char *commit,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
XDG_APP_EXTERN GBytes * xdg_app_installation_fetch_remote_metadata_sync2 (XdgAppInstallation *self,
|
||||
const char *remote_name,
|
||||
XdgAppRef *ref,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
XDG_APP_EXTERN GPtrArray * xdg_app_installation_list_remote_refs_sync (XdgAppInstallation *self,
|
||||
const char *remote_name,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
XDG_APP_EXTERN XdgAppRemoteRef *xdg_app_installation_fetch_remote_ref_sync (XdgAppInstallation *self,
|
||||
const char *remote_name,
|
||||
XdgAppRefKind kind,
|
||||
const char *name,
|
||||
const char *arch,
|
||||
const char *branch,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
XDG_APP_EXTERN gboolean xdg_app_installation_update_appstream_sync (XdgAppInstallation *self,
|
||||
const char *remote_name,
|
||||
const char *arch,
|
||||
gboolean *out_changed,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
FLATPAK_EXTERN gboolean flatpak_installation_fetch_remote_size_sync (FlatpakInstallation *self,
|
||||
const char *remote_name,
|
||||
const char *commit,
|
||||
guint64 *download_size,
|
||||
guint64 *installed_size,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
FLATPAK_EXTERN gboolean flatpak_installation_fetch_remote_size_sync2 (FlatpakInstallation *self,
|
||||
const char *remote_name,
|
||||
FlatpakRef *ref,
|
||||
guint64 *download_size,
|
||||
guint64 *installed_size,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
FLATPAK_EXTERN GBytes * flatpak_installation_fetch_remote_metadata_sync (FlatpakInstallation *self,
|
||||
const char *remote_name,
|
||||
const char *commit,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
FLATPAK_EXTERN GBytes * flatpak_installation_fetch_remote_metadata_sync2 (FlatpakInstallation *self,
|
||||
const char *remote_name,
|
||||
FlatpakRef *ref,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
FLATPAK_EXTERN GPtrArray * flatpak_installation_list_remote_refs_sync (FlatpakInstallation *self,
|
||||
const char *remote_name,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
FLATPAK_EXTERN FlatpakRemoteRef *flatpak_installation_fetch_remote_ref_sync (FlatpakInstallation *self,
|
||||
const char *remote_name,
|
||||
FlatpakRefKind kind,
|
||||
const char *name,
|
||||
const char *arch,
|
||||
const char *branch,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
FLATPAK_EXTERN gboolean flatpak_installation_update_appstream_sync (FlatpakInstallation *self,
|
||||
const char *remote_name,
|
||||
const char *arch,
|
||||
gboolean *out_changed,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
|
||||
#endif /* __XDG_APP_INSTALLATION_H__ */
|
||||
#endif /* __FLATPAK_INSTALLATION_H__ */
|
||||
|
|
|
@ -18,23 +18,23 @@
|
|||
* Alexander Larsson <alexl@redhat.com>
|
||||
*/
|
||||
|
||||
#if !defined(__XDG_APP_H_INSIDE__) && !defined(XDG_APP_COMPILATION)
|
||||
#if !defined(__FLATPAK_H_INSIDE__) && !defined(FLATPAK_COMPILATION)
|
||||
#error "Only <xdg-app.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#ifndef __XDG_APP_INSTALLED_REF_PRIVATE_H__
|
||||
#define __XDG_APP_INSTALLED_REF_PRIVATE_H__
|
||||
#ifndef __FLATPAK_INSTALLED_REF_PRIVATE_H__
|
||||
#define __FLATPAK_INSTALLED_REF_PRIVATE_H__
|
||||
|
||||
#include <xdg-app-installed-ref.h>
|
||||
#include <xdg-app-dir.h>
|
||||
|
||||
XdgAppInstalledRef *xdg_app_installed_ref_new (const char *full_ref,
|
||||
const char *commit,
|
||||
const char *latest_commit,
|
||||
const char *origin,
|
||||
const char **subpaths,
|
||||
const char *deploy_dir,
|
||||
guint64 installed_size,
|
||||
gboolean current);
|
||||
FlatpakInstalledRef *flatpak_installed_ref_new (const char *full_ref,
|
||||
const char *commit,
|
||||
const char *latest_commit,
|
||||
const char *origin,
|
||||
const char **subpaths,
|
||||
const char *deploy_dir,
|
||||
guint64 installed_size,
|
||||
gboolean current);
|
||||
|
||||
#endif /* __XDG_APP_INSTALLED_REF_PRIVATE_H__ */
|
||||
#endif /* __FLATPAK_INSTALLED_REF_PRIVATE_H__ */
|
||||
|
|
|
@ -28,17 +28,17 @@
|
|||
|
||||
/**
|
||||
* SECTION:xdg-app-installed-ref
|
||||
* @Title: XdgAppInstalledRef
|
||||
* @Title: FlatpakInstalledRef
|
||||
* @Short_description: Installed application reference
|
||||
*
|
||||
* A XdgAppInstalledRef provides information about an installed
|
||||
* A FlatpakInstalledRef provides information about an installed
|
||||
* application or runtime (in short: ref), such as the available
|
||||
* builds, its size, location, etc.
|
||||
*/
|
||||
|
||||
typedef struct _XdgAppInstalledRefPrivate XdgAppInstalledRefPrivate;
|
||||
typedef struct _FlatpakInstalledRefPrivate FlatpakInstalledRefPrivate;
|
||||
|
||||
struct _XdgAppInstalledRefPrivate
|
||||
struct _FlatpakInstalledRefPrivate
|
||||
{
|
||||
gboolean is_current;
|
||||
char *origin;
|
||||
|
@ -48,7 +48,7 @@ struct _XdgAppInstalledRefPrivate
|
|||
guint64 installed_size;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (XdgAppInstalledRef, xdg_app_installed_ref, XDG_APP_TYPE_REF)
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (FlatpakInstalledRef, flatpak_installed_ref, FLATPAK_TYPE_REF)
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
|
@ -62,26 +62,26 @@ enum {
|
|||
};
|
||||
|
||||
static void
|
||||
xdg_app_installed_ref_finalize (GObject *object)
|
||||
flatpak_installed_ref_finalize (GObject *object)
|
||||
{
|
||||
XdgAppInstalledRef *self = XDG_APP_INSTALLED_REF (object);
|
||||
XdgAppInstalledRefPrivate *priv = xdg_app_installed_ref_get_instance_private (self);
|
||||
FlatpakInstalledRef *self = FLATPAK_INSTALLED_REF (object);
|
||||
FlatpakInstalledRefPrivate *priv = flatpak_installed_ref_get_instance_private (self);
|
||||
|
||||
g_free (priv->origin);
|
||||
g_free (priv->deploy_dir);
|
||||
g_strfreev (priv->subpaths);
|
||||
|
||||
G_OBJECT_CLASS (xdg_app_installed_ref_parent_class)->finalize (object);
|
||||
G_OBJECT_CLASS (flatpak_installed_ref_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
xdg_app_installed_ref_set_property (GObject *object,
|
||||
flatpak_installed_ref_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
XdgAppInstalledRef *self = XDG_APP_INSTALLED_REF (object);
|
||||
XdgAppInstalledRefPrivate *priv = xdg_app_installed_ref_get_instance_private (self);
|
||||
FlatpakInstalledRef *self = FLATPAK_INSTALLED_REF (object);
|
||||
FlatpakInstalledRefPrivate *priv = flatpak_installed_ref_get_instance_private (self);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
|
@ -120,13 +120,13 @@ xdg_app_installed_ref_set_property (GObject *object,
|
|||
}
|
||||
|
||||
static void
|
||||
xdg_app_installed_ref_get_property (GObject *object,
|
||||
flatpak_installed_ref_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
XdgAppInstalledRef *self = XDG_APP_INSTALLED_REF (object);
|
||||
XdgAppInstalledRefPrivate *priv = xdg_app_installed_ref_get_instance_private (self);
|
||||
FlatpakInstalledRef *self = FLATPAK_INSTALLED_REF (object);
|
||||
FlatpakInstalledRefPrivate *priv = flatpak_installed_ref_get_instance_private (self);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
|
@ -161,13 +161,13 @@ xdg_app_installed_ref_get_property (GObject *object,
|
|||
}
|
||||
|
||||
static void
|
||||
xdg_app_installed_ref_class_init (XdgAppInstalledRefClass *klass)
|
||||
flatpak_installed_ref_class_init (FlatpakInstalledRefClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->get_property = xdg_app_installed_ref_get_property;
|
||||
object_class->set_property = xdg_app_installed_ref_set_property;
|
||||
object_class->finalize = xdg_app_installed_ref_finalize;
|
||||
object_class->get_property = flatpak_installed_ref_get_property;
|
||||
object_class->set_property = flatpak_installed_ref_set_property;
|
||||
object_class->finalize = flatpak_installed_ref_finalize;
|
||||
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_IS_CURRENT,
|
||||
|
@ -214,109 +214,109 @@ xdg_app_installed_ref_class_init (XdgAppInstalledRefClass *klass)
|
|||
}
|
||||
|
||||
static void
|
||||
xdg_app_installed_ref_init (XdgAppInstalledRef *self)
|
||||
flatpak_installed_ref_init (FlatpakInstalledRef *self)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* xdg_app_installed_ref_get_origin:
|
||||
* @self: a #XdgAppInstalledRef
|
||||
* flatpak_installed_ref_get_origin:
|
||||
* @self: a #FlatpakInstalledRef
|
||||
*
|
||||
* Gets the origin of the ref.
|
||||
*
|
||||
* Returns: (transfer none): the origin
|
||||
*/
|
||||
const char *
|
||||
xdg_app_installed_ref_get_origin (XdgAppInstalledRef *self)
|
||||
flatpak_installed_ref_get_origin (FlatpakInstalledRef *self)
|
||||
{
|
||||
XdgAppInstalledRefPrivate *priv = xdg_app_installed_ref_get_instance_private (self);
|
||||
FlatpakInstalledRefPrivate *priv = flatpak_installed_ref_get_instance_private (self);
|
||||
|
||||
return priv->origin;
|
||||
}
|
||||
|
||||
/**
|
||||
* xdg_app_installed_ref_get_latest_commit:
|
||||
* @self: a #XdgAppInstalledRef
|
||||
* flatpak_installed_ref_get_latest_commit:
|
||||
* @self: a #FlatpakInstalledRef
|
||||
*
|
||||
* Gets the latest commit of the ref.
|
||||
*
|
||||
* Returns: (transfer none): the latest commit
|
||||
*/
|
||||
const char *
|
||||
xdg_app_installed_ref_get_latest_commit (XdgAppInstalledRef *self)
|
||||
flatpak_installed_ref_get_latest_commit (FlatpakInstalledRef *self)
|
||||
{
|
||||
XdgAppInstalledRefPrivate *priv = xdg_app_installed_ref_get_instance_private (self);
|
||||
FlatpakInstalledRefPrivate *priv = flatpak_installed_ref_get_instance_private (self);
|
||||
|
||||
return priv->latest_commit;
|
||||
}
|
||||
|
||||
/**
|
||||
* xdg_app_installed_ref_get_deploy_dir:
|
||||
* @self: a #XdgAppInstalledRef
|
||||
* flatpak_installed_ref_get_deploy_dir:
|
||||
* @self: a #FlatpakInstalledRef
|
||||
*
|
||||
* Gets the deploy dir of the ref.
|
||||
*
|
||||
* Returns: (transfer none): the deploy dir
|
||||
*/
|
||||
const char *
|
||||
xdg_app_installed_ref_get_deploy_dir (XdgAppInstalledRef *self)
|
||||
flatpak_installed_ref_get_deploy_dir (FlatpakInstalledRef *self)
|
||||
{
|
||||
XdgAppInstalledRefPrivate *priv = xdg_app_installed_ref_get_instance_private (self);
|
||||
FlatpakInstalledRefPrivate *priv = flatpak_installed_ref_get_instance_private (self);
|
||||
|
||||
return priv->deploy_dir;
|
||||
}
|
||||
|
||||
/**
|
||||
* xdg_app_installed_ref_get_is_current:
|
||||
* @self: a #XdgAppInstalledRef
|
||||
* flatpak_installed_ref_get_is_current:
|
||||
* @self: a #FlatpakInstalledRef
|
||||
*
|
||||
* Returns whether the ref is current.
|
||||
*
|
||||
* Returns: %TRUE if the ref is current
|
||||
*/
|
||||
gboolean
|
||||
xdg_app_installed_ref_get_is_current (XdgAppInstalledRef *self)
|
||||
flatpak_installed_ref_get_is_current (FlatpakInstalledRef *self)
|
||||
{
|
||||
XdgAppInstalledRefPrivate *priv = xdg_app_installed_ref_get_instance_private (self);
|
||||
FlatpakInstalledRefPrivate *priv = flatpak_installed_ref_get_instance_private (self);
|
||||
|
||||
return priv->is_current;
|
||||
}
|
||||
|
||||
/**
|
||||
* xdg_app_installed_ref_get_subpaths:
|
||||
* @self: a #XdgAppInstalledRef
|
||||
* flatpak_installed_ref_get_subpaths:
|
||||
* @self: a #FlatpakInstalledRef
|
||||
*
|
||||
* Returns the subpaths that are installed, or %NULL if all files installed.
|
||||
*
|
||||
* Returns: (transfer none): A strv, or %NULL
|
||||
*/
|
||||
const char * const *
|
||||
xdg_app_installed_ref_get_subpaths (XdgAppInstalledRef *self)
|
||||
flatpak_installed_ref_get_subpaths (FlatpakInstalledRef *self)
|
||||
{
|
||||
XdgAppInstalledRefPrivate *priv = xdg_app_installed_ref_get_instance_private (self);
|
||||
FlatpakInstalledRefPrivate *priv = flatpak_installed_ref_get_instance_private (self);
|
||||
|
||||
return (const char * const *) priv->subpaths;
|
||||
}
|
||||
|
||||
/**
|
||||
* xdg_app_installed_ref_get_installed_size:
|
||||
* @self: a #XdgAppInstalledRef
|
||||
* flatpak_installed_ref_get_installed_size:
|
||||
* @self: a #FlatpakInstalledRef
|
||||
*
|
||||
* Returns the installed size of the ref.
|
||||
*
|
||||
* Returns: the installed size
|
||||
*/
|
||||
guint64
|
||||
xdg_app_installed_ref_get_installed_size (XdgAppInstalledRef *self)
|
||||
flatpak_installed_ref_get_installed_size (FlatpakInstalledRef *self)
|
||||
{
|
||||
XdgAppInstalledRefPrivate *priv = xdg_app_installed_ref_get_instance_private (self);
|
||||
FlatpakInstalledRefPrivate *priv = flatpak_installed_ref_get_instance_private (self);
|
||||
|
||||
return priv->installed_size;
|
||||
}
|
||||
|
||||
/**
|
||||
* xdg_app_installed_ref_load_metadata:
|
||||
* @self: a #XdgAppInstalledRef
|
||||
* flatpak_installed_ref_load_metadata:
|
||||
* @self: a #FlatpakInstalledRef
|
||||
* @cancellable: (nullable): a #GCancellable
|
||||
* @error: a return location for a #GError
|
||||
*
|
||||
|
@ -326,11 +326,11 @@ xdg_app_installed_ref_get_installed_size (XdgAppInstalledRef *self)
|
|||
* or %NULL if an error occurred
|
||||
*/
|
||||
GBytes *
|
||||
xdg_app_installed_ref_load_metadata (XdgAppInstalledRef *self,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
flatpak_installed_ref_load_metadata (FlatpakInstalledRef *self,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
XdgAppInstalledRefPrivate *priv = xdg_app_installed_ref_get_instance_private (self);
|
||||
FlatpakInstalledRefPrivate *priv = flatpak_installed_ref_get_instance_private (self);
|
||||
g_autofree char *path = NULL;
|
||||
char *metadata;
|
||||
gsize length;
|
||||
|
@ -349,8 +349,8 @@ xdg_app_installed_ref_load_metadata (XdgAppInstalledRef *self,
|
|||
return g_bytes_new_take (metadata, length);
|
||||
}
|
||||
|
||||
XdgAppInstalledRef *
|
||||
xdg_app_installed_ref_new (const char *full_ref,
|
||||
FlatpakInstalledRef *
|
||||
flatpak_installed_ref_new (const char *full_ref,
|
||||
const char *commit,
|
||||
const char *latest_commit,
|
||||
const char *origin,
|
||||
|
@ -359,21 +359,21 @@ xdg_app_installed_ref_new (const char *full_ref,
|
|||
guint64 installed_size,
|
||||
gboolean is_current)
|
||||
{
|
||||
XdgAppRefKind kind = XDG_APP_REF_KIND_APP;
|
||||
XdgAppInstalledRef *ref;
|
||||
FlatpakRefKind kind = FLATPAK_REF_KIND_APP;
|
||||
FlatpakInstalledRef *ref;
|
||||
|
||||
g_auto(GStrv) parts = NULL;
|
||||
|
||||
parts = g_strsplit (full_ref, "/", -1);
|
||||
|
||||
if (strcmp (parts[0], "app") != 0)
|
||||
kind = XDG_APP_REF_KIND_RUNTIME;
|
||||
kind = FLATPAK_REF_KIND_RUNTIME;
|
||||
|
||||
/* Canonicalize the "no subpaths" case */
|
||||
if (subpaths && *subpaths == NULL)
|
||||
subpaths = NULL;
|
||||
|
||||
ref = g_object_new (XDG_APP_TYPE_INSTALLED_REF,
|
||||
ref = g_object_new (FLATPAK_TYPE_INSTALLED_REF,
|
||||
"kind", kind,
|
||||
"name", parts[1],
|
||||
"arch", parts[2],
|
||||
|
|
|
@ -18,46 +18,46 @@
|
|||
* Alexander Larsson <alexl@redhat.com>
|
||||
*/
|
||||
|
||||
#if !defined(__XDG_APP_H_INSIDE__) && !defined(XDG_APP_COMPILATION)
|
||||
#if !defined(__FLATPAK_H_INSIDE__) && !defined(FLATPAK_COMPILATION)
|
||||
#error "Only <xdg-app.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#ifndef __XDG_APP_INSTALLED_REF_H__
|
||||
#define __XDG_APP_INSTALLED_REF_H__
|
||||
#ifndef __FLATPAK_INSTALLED_REF_H__
|
||||
#define __FLATPAK_INSTALLED_REF_H__
|
||||
|
||||
typedef struct _XdgAppInstalledRef XdgAppInstalledRef;
|
||||
typedef struct _FlatpakInstalledRef FlatpakInstalledRef;
|
||||
|
||||
#include <gio/gio.h>
|
||||
#include <xdg-app-ref.h>
|
||||
|
||||
#define XDG_APP_TYPE_INSTALLED_REF xdg_app_installed_ref_get_type ()
|
||||
#define XDG_APP_INSTALLED_REF(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), XDG_APP_TYPE_INSTALLED_REF, XdgAppInstalledRef))
|
||||
#define XDG_APP_IS_INSTALLED_REF(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), XDG_APP_TYPE_INSTALLED_REF))
|
||||
#define FLATPAK_TYPE_INSTALLED_REF flatpak_installed_ref_get_type ()
|
||||
#define FLATPAK_INSTALLED_REF(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FLATPAK_TYPE_INSTALLED_REF, FlatpakInstalledRef))
|
||||
#define FLATPAK_IS_INSTALLED_REF(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FLATPAK_TYPE_INSTALLED_REF))
|
||||
|
||||
XDG_APP_EXTERN GType xdg_app_installed_ref_get_type (void);
|
||||
FLATPAK_EXTERN GType flatpak_installed_ref_get_type (void);
|
||||
|
||||
struct _XdgAppInstalledRef
|
||||
struct _FlatpakInstalledRef
|
||||
{
|
||||
XdgAppRef parent;
|
||||
FlatpakRef parent;
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
XdgAppRefClass parent_class;
|
||||
} XdgAppInstalledRefClass;
|
||||
FlatpakRefClass parent_class;
|
||||
} FlatpakInstalledRefClass;
|
||||
|
||||
#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (XdgAppInstalledRef, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (FlatpakInstalledRef, g_object_unref)
|
||||
#endif
|
||||
|
||||
XDG_APP_EXTERN const char *xdg_app_installed_ref_get_origin (XdgAppInstalledRef * self);
|
||||
XDG_APP_EXTERN const char * const *xdg_app_installed_ref_get_subpaths (XdgAppInstalledRef *self);
|
||||
XDG_APP_EXTERN guint64 xdg_app_installed_ref_get_installed_size (XdgAppInstalledRef *self);
|
||||
XDG_APP_EXTERN const char *xdg_app_installed_ref_get_deploy_dir (XdgAppInstalledRef *self);
|
||||
XDG_APP_EXTERN const char *xdg_app_installed_ref_get_latest_commit (XdgAppInstalledRef *self);
|
||||
XDG_APP_EXTERN gboolean xdg_app_installed_ref_get_is_current (XdgAppInstalledRef *self);
|
||||
XDG_APP_EXTERN GBytes *xdg_app_installed_ref_load_metadata (XdgAppInstalledRef *self,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
FLATPAK_EXTERN const char *flatpak_installed_ref_get_origin (FlatpakInstalledRef * self);
|
||||
FLATPAK_EXTERN const char * const *flatpak_installed_ref_get_subpaths (FlatpakInstalledRef *self);
|
||||
FLATPAK_EXTERN guint64 flatpak_installed_ref_get_installed_size (FlatpakInstalledRef *self);
|
||||
FLATPAK_EXTERN const char *flatpak_installed_ref_get_deploy_dir (FlatpakInstalledRef *self);
|
||||
FLATPAK_EXTERN const char *flatpak_installed_ref_get_latest_commit (FlatpakInstalledRef *self);
|
||||
FLATPAK_EXTERN gboolean flatpak_installed_ref_get_is_current (FlatpakInstalledRef *self);
|
||||
FLATPAK_EXTERN GBytes *flatpak_installed_ref_load_metadata (FlatpakInstalledRef *self,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
|
||||
#endif /* __XDG_APP_INSTALLED_REF_H__ */
|
||||
#endif /* __FLATPAK_INSTALLED_REF_H__ */
|
||||
|
|
|
@ -26,37 +26,37 @@
|
|||
|
||||
/**
|
||||
* SECTION:xdg-app-ref
|
||||
* @Title: XdgAppRef
|
||||
* @Title: FlatpakRef
|
||||
* @Short_description: Application reference
|
||||
*
|
||||
* Currently xdg-app manages two types of binary artifacts: applications, and
|
||||
* runtimes. Applications contain a program that desktop users can run, while
|
||||
* runtimes contain only libraries and data. An XdgAppRef object (or short: ref)
|
||||
* runtimes contain only libraries and data. An FlatpakRef object (or short: ref)
|
||||
* can refer to either of these.
|
||||
*
|
||||
* Both applications and runtimes are identified by a 4-tuple of strings: kind,
|
||||
* name, arch and branch, e.g. app/org.gnome.evince/x86_64/master. The functions
|
||||
* xdg_app_ref_parse() and xdg_app_ref_format_ref() can be used to convert
|
||||
* XdgAppRef objects into this string representation and back.
|
||||
* flatpak_ref_parse() and flatpak_ref_format_ref() can be used to convert
|
||||
* FlatpakRef objects into this string representation and back.
|
||||
*
|
||||
* To uniquely identify a particular version of an application or runtime, you
|
||||
* need a commit.
|
||||
*
|
||||
* The subclasses #XdgAppInstalledRef and #XdgAppRemoteRef provide more information
|
||||
* The subclasses #FlatpakInstalledRef and #FlatpakRemoteRef provide more information
|
||||
* for artifacts that are locally installed or available from a remote repository.
|
||||
*/
|
||||
typedef struct _XdgAppRefPrivate XdgAppRefPrivate;
|
||||
typedef struct _FlatpakRefPrivate FlatpakRefPrivate;
|
||||
|
||||
struct _XdgAppRefPrivate
|
||||
struct _FlatpakRefPrivate
|
||||
{
|
||||
char *name;
|
||||
char *arch;
|
||||
char *branch;
|
||||
char *commit;
|
||||
XdgAppRefKind kind;
|
||||
char *name;
|
||||
char *arch;
|
||||
char *branch;
|
||||
char *commit;
|
||||
FlatpakRefKind kind;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (XdgAppRef, xdg_app_ref, G_TYPE_OBJECT)
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (FlatpakRef, flatpak_ref, G_TYPE_OBJECT)
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
|
@ -69,27 +69,27 @@ enum {
|
|||
};
|
||||
|
||||
static void
|
||||
xdg_app_ref_finalize (GObject *object)
|
||||
flatpak_ref_finalize (GObject *object)
|
||||
{
|
||||
XdgAppRef *self = XDG_APP_REF (object);
|
||||
XdgAppRefPrivate *priv = xdg_app_ref_get_instance_private (self);
|
||||
FlatpakRef *self = FLATPAK_REF (object);
|
||||
FlatpakRefPrivate *priv = flatpak_ref_get_instance_private (self);
|
||||
|
||||
g_free (priv->name);
|
||||
g_free (priv->arch);
|
||||
g_free (priv->branch);
|
||||
g_free (priv->commit);
|
||||
|
||||
G_OBJECT_CLASS (xdg_app_ref_parent_class)->finalize (object);
|
||||
G_OBJECT_CLASS (flatpak_ref_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
xdg_app_ref_set_property (GObject *object,
|
||||
flatpak_ref_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
XdgAppRef *self = XDG_APP_REF (object);
|
||||
XdgAppRefPrivate *priv = xdg_app_ref_get_instance_private (self);
|
||||
FlatpakRef *self = FLATPAK_REF (object);
|
||||
FlatpakRefPrivate *priv = flatpak_ref_get_instance_private (self);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
|
@ -124,13 +124,13 @@ xdg_app_ref_set_property (GObject *object,
|
|||
}
|
||||
|
||||
static void
|
||||
xdg_app_ref_get_property (GObject *object,
|
||||
flatpak_ref_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
XdgAppRef *self = XDG_APP_REF (object);
|
||||
XdgAppRefPrivate *priv = xdg_app_ref_get_instance_private (self);
|
||||
FlatpakRef *self = FLATPAK_REF (object);
|
||||
FlatpakRefPrivate *priv = flatpak_ref_get_instance_private (self);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
|
@ -161,13 +161,13 @@ xdg_app_ref_get_property (GObject *object,
|
|||
}
|
||||
|
||||
static void
|
||||
xdg_app_ref_class_init (XdgAppRefClass *klass)
|
||||
flatpak_ref_class_init (FlatpakRefClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->get_property = xdg_app_ref_get_property;
|
||||
object_class->set_property = xdg_app_ref_set_property;
|
||||
object_class->finalize = xdg_app_ref_finalize;
|
||||
object_class->get_property = flatpak_ref_get_property;
|
||||
object_class->set_property = flatpak_ref_set_property;
|
||||
object_class->finalize = flatpak_ref_finalize;
|
||||
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_NAME,
|
||||
|
@ -202,150 +202,150 @@ xdg_app_ref_class_init (XdgAppRefClass *klass)
|
|||
g_param_spec_enum ("kind",
|
||||
"Kind",
|
||||
"The kind of artifact",
|
||||
XDG_TYPE_APP_REF_KIND,
|
||||
XDG_APP_REF_KIND_APP,
|
||||
FLATPAK_TYPE_REF_KIND,
|
||||
FLATPAK_REF_KIND_APP,
|
||||
G_PARAM_READWRITE));
|
||||
}
|
||||
|
||||
static void
|
||||
xdg_app_ref_init (XdgAppRef *self)
|
||||
flatpak_ref_init (FlatpakRef *self)
|
||||
{
|
||||
XdgAppRefPrivate *priv = xdg_app_ref_get_instance_private (self);
|
||||
FlatpakRefPrivate *priv = flatpak_ref_get_instance_private (self);
|
||||
|
||||
priv->kind = XDG_APP_REF_KIND_APP;
|
||||
priv->kind = FLATPAK_REF_KIND_APP;
|
||||
}
|
||||
|
||||
/**
|
||||
* xdg_app_ref_get_name:
|
||||
* @self: a #XdgAppRef
|
||||
* flatpak_ref_get_name:
|
||||
* @self: a #FlatpakRef
|
||||
*
|
||||
* Gets the name of the ref.
|
||||
*
|
||||
* Returns: (transfer none): the name
|
||||
*/
|
||||
const char *
|
||||
xdg_app_ref_get_name (XdgAppRef *self)
|
||||
flatpak_ref_get_name (FlatpakRef *self)
|
||||
{
|
||||
XdgAppRefPrivate *priv = xdg_app_ref_get_instance_private (self);
|
||||
FlatpakRefPrivate *priv = flatpak_ref_get_instance_private (self);
|
||||
|
||||
return priv->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* xdg_app_ref_get_arch:
|
||||
* @self: a #XdgAppRef
|
||||
* flatpak_ref_get_arch:
|
||||
* @self: a #FlatpakRef
|
||||
*
|
||||
* Gets the arch or the ref.
|
||||
*
|
||||
* Returns: (transfer none): the arch
|
||||
*/
|
||||
const char *
|
||||
xdg_app_ref_get_arch (XdgAppRef *self)
|
||||
flatpak_ref_get_arch (FlatpakRef *self)
|
||||
{
|
||||
XdgAppRefPrivate *priv = xdg_app_ref_get_instance_private (self);
|
||||
FlatpakRefPrivate *priv = flatpak_ref_get_instance_private (self);
|
||||
|
||||
return priv->arch;
|
||||
}
|
||||
|
||||
/**
|
||||
* xdg_app_ref_get_branch:
|
||||
* @self: a #XdgAppRef
|
||||
* flatpak_ref_get_branch:
|
||||
* @self: a #FlatpakRef
|
||||
*
|
||||
* Gets the branch of the ref.
|
||||
*
|
||||
* Returns: (transfer none): the branch
|
||||
*/
|
||||
const char *
|
||||
xdg_app_ref_get_branch (XdgAppRef *self)
|
||||
flatpak_ref_get_branch (FlatpakRef *self)
|
||||
{
|
||||
XdgAppRefPrivate *priv = xdg_app_ref_get_instance_private (self);
|
||||
FlatpakRefPrivate *priv = flatpak_ref_get_instance_private (self);
|
||||
|
||||
return priv->branch;
|
||||
}
|
||||
|
||||
/**
|
||||
* xdg_app_ref_get_commit:
|
||||
* @self: a #XdgAppRef
|
||||
* flatpak_ref_get_commit:
|
||||
* @self: a #FlatpakRef
|
||||
*
|
||||
* Gets the commit of the ref.
|
||||
*
|
||||
* Returns: (transfer none): the commit
|
||||
*/
|
||||
const char *
|
||||
xdg_app_ref_get_commit (XdgAppRef *self)
|
||||
flatpak_ref_get_commit (FlatpakRef *self)
|
||||
{
|
||||
XdgAppRefPrivate *priv = xdg_app_ref_get_instance_private (self);
|
||||
FlatpakRefPrivate *priv = flatpak_ref_get_instance_private (self);
|
||||
|
||||
return priv->commit;
|
||||
}
|
||||
|
||||
/**
|
||||
* xdg_app_ref_get_kind:
|
||||
* @self: a #XdgAppRef
|
||||
* flatpak_ref_get_kind:
|
||||
* @self: a #FlatpakRef
|
||||
*
|
||||
* Gets the kind of artifact that this ref refers to.
|
||||
*
|
||||
* Returns: the kind of artifact
|
||||
*/
|
||||
XdgAppRefKind
|
||||
xdg_app_ref_get_kind (XdgAppRef *self)
|
||||
FlatpakRefKind
|
||||
flatpak_ref_get_kind (FlatpakRef *self)
|
||||
{
|
||||
XdgAppRefPrivate *priv = xdg_app_ref_get_instance_private (self);
|
||||
FlatpakRefPrivate *priv = flatpak_ref_get_instance_private (self);
|
||||
|
||||
return priv->kind;
|
||||
}
|
||||
|
||||
/**
|
||||
* xdg_app_ref_format_ref:
|
||||
* @self: a #XdgAppRef
|
||||
* flatpak_ref_format_ref:
|
||||
* @self: a #FlatpakRef
|
||||
*
|
||||
* Convert an XdgAppRef object into a string representation that
|
||||
* can be parsed by xdg_app_ref_parse().
|
||||
* Convert an FlatpakRef object into a string representation that
|
||||
* can be parsed by flatpak_ref_parse().
|
||||
*
|
||||
* Returns: (transfer full): string representation
|
||||
*/
|
||||
char *
|
||||
xdg_app_ref_format_ref (XdgAppRef *self)
|
||||
flatpak_ref_format_ref (FlatpakRef *self)
|
||||
{
|
||||
XdgAppRefPrivate *priv = xdg_app_ref_get_instance_private (self);
|
||||
FlatpakRefPrivate *priv = flatpak_ref_get_instance_private (self);
|
||||
|
||||
if (priv->kind == XDG_APP_REF_KIND_APP)
|
||||
return xdg_app_build_app_ref (priv->name,
|
||||
if (priv->kind == FLATPAK_REF_KIND_APP)
|
||||
return flatpak_build_app_ref (priv->name,
|
||||
priv->branch,
|
||||
priv->arch);
|
||||
else
|
||||
return xdg_app_build_runtime_ref (priv->name,
|
||||
return flatpak_build_runtime_ref (priv->name,
|
||||
priv->branch,
|
||||
priv->arch);
|
||||
}
|
||||
|
||||
/**
|
||||
* xdg_app_ref_parse:
|
||||
* flatpak_ref_parse:
|
||||
* @ref: A string ref name, such as "app/org.test.App/86_64/master"
|
||||
* @error: return location for a #GError
|
||||
*
|
||||
* Tries to parse a full ref name and return a #XdgAppRef (without a
|
||||
* Tries to parse a full ref name and return a #FlatpakRef (without a
|
||||
* commit set) or fail if the ref is invalid somehow.
|
||||
*
|
||||
* Returns: (transfer full): an #XdgAppRef, or %NULL
|
||||
* Returns: (transfer full): an #FlatpakRef, or %NULL
|
||||
*/
|
||||
XdgAppRef *
|
||||
xdg_app_ref_parse (const char *ref, GError **error)
|
||||
FlatpakRef *
|
||||
flatpak_ref_parse (const char *ref, GError **error)
|
||||
{
|
||||
g_auto(GStrv) parts = NULL;
|
||||
|
||||
parts = xdg_app_decompose_ref (ref, error);
|
||||
parts = flatpak_decompose_ref (ref, error);
|
||||
if (parts == NULL)
|
||||
return NULL;
|
||||
|
||||
XdgAppRefKind kind;
|
||||
FlatpakRefKind kind;
|
||||
if (g_strcmp0 (parts[0], "app") == 0)
|
||||
{
|
||||
kind = XDG_APP_REF_KIND_APP;
|
||||
kind = FLATPAK_REF_KIND_APP;
|
||||
}
|
||||
else if (g_strcmp0 (parts[0], "runtime") == 0)
|
||||
{
|
||||
kind = XDG_APP_REF_KIND_RUNTIME;
|
||||
kind = FLATPAK_REF_KIND_RUNTIME;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -354,7 +354,7 @@ xdg_app_ref_parse (const char *ref, GError **error)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
return XDG_APP_REF (g_object_new (XDG_APP_TYPE_REF,
|
||||
return FLATPAK_REF (g_object_new (FLATPAK_TYPE_REF,
|
||||
"kind", kind,
|
||||
"name", parts[1],
|
||||
"arch", parts[2],
|
||||
|
|
|
@ -18,24 +18,24 @@
|
|||
* Alexander Larsson <alexl@redhat.com>
|
||||
*/
|
||||
|
||||
#if !defined(__XDG_APP_H_INSIDE__) && !defined(XDG_APP_COMPILATION)
|
||||
#if !defined(__FLATPAK_H_INSIDE__) && !defined(FLATPAK_COMPILATION)
|
||||
#error "Only <xdg-app.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#ifndef __XDG_APP_REF_H__
|
||||
#define __XDG_APP_REF_H__
|
||||
#ifndef __FLATPAK_REF_H__
|
||||
#define __FLATPAK_REF_H__
|
||||
|
||||
typedef struct _XdgAppRef XdgAppRef;
|
||||
typedef struct _FlatpakRef FlatpakRef;
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
#define XDG_APP_TYPE_REF xdg_app_ref_get_type ()
|
||||
#define XDG_APP_REF(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), XDG_APP_TYPE_REF, XdgAppRef))
|
||||
#define XDG_APP_IS_REF(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), XDG_APP_TYPE_REF))
|
||||
#define FLATPAK_TYPE_REF flatpak_ref_get_type ()
|
||||
#define FLATPAK_REF(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FLATPAK_TYPE_REF, FlatpakRef))
|
||||
#define FLATPAK_IS_REF(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FLATPAK_TYPE_REF))
|
||||
|
||||
XDG_APP_EXTERN GType xdg_app_ref_get_type (void);
|
||||
FLATPAK_EXTERN GType flatpak_ref_get_type (void);
|
||||
|
||||
struct _XdgAppRef
|
||||
struct _FlatpakRef
|
||||
{
|
||||
GObject parent;
|
||||
};
|
||||
|
@ -43,32 +43,32 @@ struct _XdgAppRef
|
|||
typedef struct
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
} XdgAppRefClass;
|
||||
} FlatpakRefClass;
|
||||
|
||||
|
||||
#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (XdgAppRef, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (FlatpakRef, g_object_unref)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* XdgAppRefKind:
|
||||
* @XDG_APP_REF_KIND_APP: An application
|
||||
* @XDG_APP_REF_KIND_RUNTIME: A runtime that applications can use.
|
||||
* FlatpakRefKind:
|
||||
* @FLATPAK_REF_KIND_APP: An application
|
||||
* @FLATPAK_REF_KIND_RUNTIME: A runtime that applications can use.
|
||||
*
|
||||
* The kind of artifact that a XdgAppRef refers to.
|
||||
* The kind of artifact that a FlatpakRef refers to.
|
||||
*/
|
||||
typedef enum {
|
||||
XDG_APP_REF_KIND_APP,
|
||||
XDG_APP_REF_KIND_RUNTIME,
|
||||
} XdgAppRefKind;
|
||||
FLATPAK_REF_KIND_APP,
|
||||
FLATPAK_REF_KIND_RUNTIME,
|
||||
} FlatpakRefKind;
|
||||
|
||||
XDG_APP_EXTERN const char * xdg_app_ref_get_name (XdgAppRef *self);
|
||||
XDG_APP_EXTERN const char * xdg_app_ref_get_arch (XdgAppRef *self);
|
||||
XDG_APP_EXTERN const char * xdg_app_ref_get_branch (XdgAppRef *self);
|
||||
XDG_APP_EXTERN const char * xdg_app_ref_get_commit (XdgAppRef *self);
|
||||
XDG_APP_EXTERN XdgAppRefKind xdg_app_ref_get_kind (XdgAppRef *self);
|
||||
XDG_APP_EXTERN char * xdg_app_ref_format_ref (XdgAppRef *self);
|
||||
XDG_APP_EXTERN XdgAppRef * xdg_app_ref_parse (const char *ref,
|
||||
GError **error);
|
||||
FLATPAK_EXTERN const char * flatpak_ref_get_name (FlatpakRef *self);
|
||||
FLATPAK_EXTERN const char * flatpak_ref_get_arch (FlatpakRef *self);
|
||||
FLATPAK_EXTERN const char * flatpak_ref_get_branch (FlatpakRef *self);
|
||||
FLATPAK_EXTERN const char * flatpak_ref_get_commit (FlatpakRef *self);
|
||||
FLATPAK_EXTERN FlatpakRefKind flatpak_ref_get_kind (FlatpakRef *self);
|
||||
FLATPAK_EXTERN char * flatpak_ref_format_ref (FlatpakRef *self);
|
||||
FLATPAK_EXTERN FlatpakRef * flatpak_ref_parse (const char *ref,
|
||||
GError **error);
|
||||
|
||||
#endif /* __XDG_APP_REF_H__ */
|
||||
#endif /* __FLATPAK_REF_H__ */
|
||||
|
|
|
@ -18,18 +18,18 @@
|
|||
* Alexander Larsson <alexl@redhat.com>
|
||||
*/
|
||||
|
||||
#if !defined(__XDG_APP_H_INSIDE__) && !defined(XDG_APP_COMPILATION)
|
||||
#if !defined(__FLATPAK_H_INSIDE__) && !defined(FLATPAK_COMPILATION)
|
||||
#error "Only <xdg-app.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#ifndef __XDG_APP_REMOTE_PRIVATE_H__
|
||||
#define __XDG_APP_REMOTE_PRIVATE_H__
|
||||
#ifndef __FLATPAK_REMOTE_PRIVATE_H__
|
||||
#define __FLATPAK_REMOTE_PRIVATE_H__
|
||||
|
||||
#include <xdg-app-remote.h>
|
||||
#include <xdg-app-dir.h>
|
||||
#include <ostree.h>
|
||||
|
||||
XdgAppRemote *xdg_app_remote_new (XdgAppDir *dir,
|
||||
const char *name);
|
||||
FlatpakRemote *flatpak_remote_new (FlatpakDir *dir,
|
||||
const char *name);
|
||||
|
||||
#endif /* __XDG_APP_REMOTE_PRIVATE_H__ */
|
||||
#endif /* __FLATPAK_REMOTE_PRIVATE_H__ */
|
||||
|
|
|
@ -18,18 +18,18 @@
|
|||
* Alexander Larsson <alexl@redhat.com>
|
||||
*/
|
||||
|
||||
#if !defined(__XDG_APP_H_INSIDE__) && !defined(XDG_APP_COMPILATION)
|
||||
#if !defined(__FLATPAK_H_INSIDE__) && !defined(FLATPAK_COMPILATION)
|
||||
#error "Only <xdg-app.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#ifndef __XDG_APP_REMOTE_REF_PRIVATE_H__
|
||||
#define __XDG_APP_REMOTE_REF_PRIVATE_H__
|
||||
#ifndef __FLATPAK_REMOTE_REF_PRIVATE_H__
|
||||
#define __FLATPAK_REMOTE_REF_PRIVATE_H__
|
||||
|
||||
#include <xdg-app-remote-ref.h>
|
||||
#include <xdg-app-dir.h>
|
||||
|
||||
XdgAppRemoteRef *xdg_app_remote_ref_new (const char *full_ref,
|
||||
const char *commit,
|
||||
const char *remote_name);
|
||||
FlatpakRemoteRef *flatpak_remote_ref_new (const char *full_ref,
|
||||
const char *commit,
|
||||
const char *remote_name);
|
||||
|
||||
#endif /* __XDG_APP_REMOTE_REF_PRIVATE_H__ */
|
||||
#endif /* __FLATPAK_REMOTE_REF_PRIVATE_H__ */
|
||||
|
|
|
@ -29,20 +29,20 @@
|
|||
|
||||
/**
|
||||
* SECTION:xdg-app-remote-ref
|
||||
* @Title: XdgAppRemoteRef
|
||||
* @Title: FlatpakRemoteRef
|
||||
* @Short_description: Remote application reference
|
||||
*
|
||||
* A XdgAppRemoteRef provides information about an application or runtime
|
||||
* A FlatpakRemoteRef provides information about an application or runtime
|
||||
* (in short: ref) that is available from a remote repository.
|
||||
*/
|
||||
typedef struct _XdgAppRemoteRefPrivate XdgAppRemoteRefPrivate;
|
||||
typedef struct _FlatpakRemoteRefPrivate FlatpakRemoteRefPrivate;
|
||||
|
||||
struct _XdgAppRemoteRefPrivate
|
||||
struct _FlatpakRemoteRefPrivate
|
||||
{
|
||||
char *remote_name;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (XdgAppRemoteRef, xdg_app_remote_ref, XDG_APP_TYPE_REF)
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (FlatpakRemoteRef, flatpak_remote_ref, FLATPAK_TYPE_REF)
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
|
@ -51,24 +51,24 @@ enum {
|
|||
};
|
||||
|
||||
static void
|
||||
xdg_app_remote_ref_finalize (GObject *object)
|
||||
flatpak_remote_ref_finalize (GObject *object)
|
||||
{
|
||||
XdgAppRemoteRef *self = XDG_APP_REMOTE_REF (object);
|
||||
XdgAppRemoteRefPrivate *priv = xdg_app_remote_ref_get_instance_private (self);
|
||||
FlatpakRemoteRef *self = FLATPAK_REMOTE_REF (object);
|
||||
FlatpakRemoteRefPrivate *priv = flatpak_remote_ref_get_instance_private (self);
|
||||
|
||||
g_free (priv->remote_name);
|
||||
|
||||
G_OBJECT_CLASS (xdg_app_remote_ref_parent_class)->finalize (object);
|
||||
G_OBJECT_CLASS (flatpak_remote_ref_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
xdg_app_remote_ref_set_property (GObject *object,
|
||||
flatpak_remote_ref_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
XdgAppRemoteRef *self = XDG_APP_REMOTE_REF (object);
|
||||
XdgAppRemoteRefPrivate *priv = xdg_app_remote_ref_get_instance_private (self);
|
||||
FlatpakRemoteRef *self = FLATPAK_REMOTE_REF (object);
|
||||
FlatpakRemoteRefPrivate *priv = flatpak_remote_ref_get_instance_private (self);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
|
@ -84,13 +84,13 @@ xdg_app_remote_ref_set_property (GObject *object,
|
|||
}
|
||||
|
||||
static void
|
||||
xdg_app_remote_ref_get_property (GObject *object,
|
||||
flatpak_remote_ref_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
XdgAppRemoteRef *self = XDG_APP_REMOTE_REF (object);
|
||||
XdgAppRemoteRefPrivate *priv = xdg_app_remote_ref_get_instance_private (self);
|
||||
FlatpakRemoteRef *self = FLATPAK_REMOTE_REF (object);
|
||||
FlatpakRemoteRefPrivate *priv = flatpak_remote_ref_get_instance_private (self);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
|
@ -105,13 +105,13 @@ xdg_app_remote_ref_get_property (GObject *object,
|
|||
}
|
||||
|
||||
static void
|
||||
xdg_app_remote_ref_class_init (XdgAppRemoteRefClass *klass)
|
||||
flatpak_remote_ref_class_init (FlatpakRemoteRefClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->get_property = xdg_app_remote_ref_get_property;
|
||||
object_class->set_property = xdg_app_remote_ref_set_property;
|
||||
object_class->finalize = xdg_app_remote_ref_finalize;
|
||||
object_class->get_property = flatpak_remote_ref_get_property;
|
||||
object_class->set_property = flatpak_remote_ref_set_property;
|
||||
object_class->finalize = flatpak_remote_ref_finalize;
|
||||
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_REMOTE_NAME,
|
||||
|
@ -123,45 +123,45 @@ xdg_app_remote_ref_class_init (XdgAppRemoteRefClass *klass)
|
|||
}
|
||||
|
||||
static void
|
||||
xdg_app_remote_ref_init (XdgAppRemoteRef *self)
|
||||
flatpak_remote_ref_init (FlatpakRemoteRef *self)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* xdg_app_remote_ref_get_remote_name:
|
||||
* @self: a #XdgAppRemoteRef
|
||||
* flatpak_remote_ref_get_remote_name:
|
||||
* @self: a #FlatpakRemoteRef
|
||||
*
|
||||
* Gets the remote name of the ref.
|
||||
*
|
||||
* Returns: (transfer none): the remote name
|
||||
*/
|
||||
const char *
|
||||
xdg_app_remote_ref_get_remote_name (XdgAppRemoteRef *self)
|
||||
flatpak_remote_ref_get_remote_name (FlatpakRemoteRef *self)
|
||||
{
|
||||
XdgAppRemoteRefPrivate *priv = xdg_app_remote_ref_get_instance_private (self);
|
||||
FlatpakRemoteRefPrivate *priv = flatpak_remote_ref_get_instance_private (self);
|
||||
|
||||
return priv->remote_name;
|
||||
}
|
||||
|
||||
|
||||
XdgAppRemoteRef *
|
||||
xdg_app_remote_ref_new (const char *full_ref,
|
||||
FlatpakRemoteRef *
|
||||
flatpak_remote_ref_new (const char *full_ref,
|
||||
const char *commit,
|
||||
const char *remote_name)
|
||||
{
|
||||
XdgAppRefKind kind = XDG_APP_REF_KIND_APP;
|
||||
FlatpakRefKind kind = FLATPAK_REF_KIND_APP;
|
||||
|
||||
g_auto(GStrv) parts = NULL;
|
||||
XdgAppRemoteRef *ref;
|
||||
FlatpakRemoteRef *ref;
|
||||
|
||||
parts = xdg_app_decompose_ref (full_ref, NULL);
|
||||
parts = flatpak_decompose_ref (full_ref, NULL);
|
||||
if (parts == NULL)
|
||||
return NULL;
|
||||
|
||||
if (strcmp (parts[0], "app") != 0)
|
||||
kind = XDG_APP_REF_KIND_RUNTIME;
|
||||
kind = FLATPAK_REF_KIND_RUNTIME;
|
||||
|
||||
ref = g_object_new (XDG_APP_TYPE_REMOTE_REF,
|
||||
ref = g_object_new (FLATPAK_TYPE_REMOTE_REF,
|
||||
"kind", kind,
|
||||
"name", parts[1],
|
||||
"arch", parts[2],
|
||||
|
|
|
@ -18,38 +18,38 @@
|
|||
* Alexander Larsson <alexl@redhat.com>
|
||||
*/
|
||||
|
||||
#if !defined(__XDG_APP_H_INSIDE__) && !defined(XDG_APP_COMPILATION)
|
||||
#if !defined(__FLATPAK_H_INSIDE__) && !defined(FLATPAK_COMPILATION)
|
||||
#error "Only <xdg-app.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#ifndef __XDG_APP_REMOTE_REF_H__
|
||||
#define __XDG_APP_REMOTE_REF_H__
|
||||
#ifndef __FLATPAK_REMOTE_REF_H__
|
||||
#define __FLATPAK_REMOTE_REF_H__
|
||||
|
||||
typedef struct _XdgAppRemoteRef XdgAppRemoteRef;
|
||||
typedef struct _FlatpakRemoteRef FlatpakRemoteRef;
|
||||
|
||||
#include <gio/gio.h>
|
||||
#include <xdg-app-ref.h>
|
||||
|
||||
#define XDG_APP_TYPE_REMOTE_REF xdg_app_remote_ref_get_type ()
|
||||
#define XDG_APP_REMOTE_REF(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), XDG_APP_TYPE_REMOTE_REF, XdgAppRemoteRef))
|
||||
#define XDG_APP_IS_REMOTE_REF(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), XDG_APP_TYPE_REMOTE_REF))
|
||||
#define FLATPAK_TYPE_REMOTE_REF flatpak_remote_ref_get_type ()
|
||||
#define FLATPAK_REMOTE_REF(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FLATPAK_TYPE_REMOTE_REF, FlatpakRemoteRef))
|
||||
#define FLATPAK_IS_REMOTE_REF(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FLATPAK_TYPE_REMOTE_REF))
|
||||
|
||||
XDG_APP_EXTERN GType xdg_app_remote_ref_get_type (void);
|
||||
FLATPAK_EXTERN GType flatpak_remote_ref_get_type (void);
|
||||
|
||||
struct _XdgAppRemoteRef
|
||||
struct _FlatpakRemoteRef
|
||||
{
|
||||
XdgAppRef parent;
|
||||
FlatpakRef parent;
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
XdgAppRefClass parent_class;
|
||||
} XdgAppRemoteRefClass;
|
||||
FlatpakRefClass parent_class;
|
||||
} FlatpakRemoteRefClass;
|
||||
|
||||
XDG_APP_EXTERN const char * xdg_app_remote_ref_get_remote_name (XdgAppRemoteRef *self);
|
||||
FLATPAK_EXTERN const char * flatpak_remote_ref_get_remote_name (FlatpakRemoteRef *self);
|
||||
|
||||
#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (XdgAppRemoteRef, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (FlatpakRemoteRef, g_object_unref)
|
||||
#endif
|
||||
|
||||
#endif /* __XDG_APP_REMOTE_REF_H__ */
|
||||
#endif /* __FLATPAK_REMOTE_REF_H__ */
|
||||
|
|
|
@ -30,9 +30,9 @@
|
|||
/**
|
||||
* SECTION:xdg-app-remote
|
||||
* @Short_description: Remote repository
|
||||
* @Title: XdgAppRemote
|
||||
* @Title: FlatpakRemote
|
||||
*
|
||||
* A #XdgAppRemote object provides information about a remote
|
||||
* A #FlatpakRemote object provides information about a remote
|
||||
* repository (or short: remote) that has been configured.
|
||||
*
|
||||
* At its most basic level, a remote has a name and the URL for
|
||||
|
@ -41,20 +41,20 @@
|
|||
* in a UI, such as a title, a priority or a "don't enumerate"
|
||||
* flags.
|
||||
*
|
||||
* To obtain XdgAppRemote objects for the configured remotes
|
||||
* on a system, use xdg_app_installation_list_remotes() or
|
||||
* xdg_app_installation_get_remote_by_name().
|
||||
* To obtain FlatpakRemote objects for the configured remotes
|
||||
* on a system, use flatpak_installation_list_remotes() or
|
||||
* flatpak_installation_get_remote_by_name().
|
||||
*/
|
||||
|
||||
typedef struct _XdgAppRemotePrivate XdgAppRemotePrivate;
|
||||
typedef struct _FlatpakRemotePrivate FlatpakRemotePrivate;
|
||||
|
||||
struct _XdgAppRemotePrivate
|
||||
struct _FlatpakRemotePrivate
|
||||
{
|
||||
char *name;
|
||||
XdgAppDir *dir;
|
||||
char *name;
|
||||
FlatpakDir *dir;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (XdgAppRemote, xdg_app_remote, G_TYPE_OBJECT)
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (FlatpakRemote, flatpak_remote, G_TYPE_OBJECT)
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
|
@ -63,25 +63,25 @@ enum {
|
|||
};
|
||||
|
||||
static void
|
||||
xdg_app_remote_finalize (GObject *object)
|
||||
flatpak_remote_finalize (GObject *object)
|
||||
{
|
||||
XdgAppRemote *self = XDG_APP_REMOTE (object);
|
||||
XdgAppRemotePrivate *priv = xdg_app_remote_get_instance_private (self);
|
||||
FlatpakRemote *self = FLATPAK_REMOTE (object);
|
||||
FlatpakRemotePrivate *priv = flatpak_remote_get_instance_private (self);
|
||||
|
||||
g_free (priv->name);
|
||||
g_object_unref (priv->dir);
|
||||
|
||||
G_OBJECT_CLASS (xdg_app_remote_parent_class)->finalize (object);
|
||||
G_OBJECT_CLASS (flatpak_remote_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
xdg_app_remote_set_property (GObject *object,
|
||||
flatpak_remote_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
XdgAppRemote *self = XDG_APP_REMOTE (object);
|
||||
XdgAppRemotePrivate *priv = xdg_app_remote_get_instance_private (self);
|
||||
FlatpakRemote *self = FLATPAK_REMOTE (object);
|
||||
FlatpakRemotePrivate *priv = flatpak_remote_get_instance_private (self);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
|
@ -97,13 +97,13 @@ xdg_app_remote_set_property (GObject *object,
|
|||
}
|
||||
|
||||
static void
|
||||
xdg_app_remote_get_property (GObject *object,
|
||||
flatpak_remote_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
XdgAppRemote *self = XDG_APP_REMOTE (object);
|
||||
XdgAppRemotePrivate *priv = xdg_app_remote_get_instance_private (self);
|
||||
FlatpakRemote *self = FLATPAK_REMOTE (object);
|
||||
FlatpakRemotePrivate *priv = flatpak_remote_get_instance_private (self);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
|
@ -118,13 +118,13 @@ xdg_app_remote_get_property (GObject *object,
|
|||
}
|
||||
|
||||
static void
|
||||
xdg_app_remote_class_init (XdgAppRemoteClass *klass)
|
||||
flatpak_remote_class_init (FlatpakRemoteClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->get_property = xdg_app_remote_get_property;
|
||||
object_class->set_property = xdg_app_remote_set_property;
|
||||
object_class->finalize = xdg_app_remote_finalize;
|
||||
object_class->get_property = flatpak_remote_get_property;
|
||||
object_class->set_property = flatpak_remote_set_property;
|
||||
object_class->finalize = flatpak_remote_finalize;
|
||||
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_NAME,
|
||||
|
@ -136,29 +136,29 @@ xdg_app_remote_class_init (XdgAppRemoteClass *klass)
|
|||
}
|
||||
|
||||
static void
|
||||
xdg_app_remote_init (XdgAppRemote *self)
|
||||
flatpak_remote_init (FlatpakRemote *self)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* xdg_app_remote_get_name:
|
||||
* @self: a #XdgAppRemote
|
||||
* flatpak_remote_get_name:
|
||||
* @self: a #FlatpakRemote
|
||||
*
|
||||
* Returns the name of the remote repository.
|
||||
*
|
||||
* Returns: (transfer none): the name
|
||||
*/
|
||||
const char *
|
||||
xdg_app_remote_get_name (XdgAppRemote *self)
|
||||
flatpak_remote_get_name (FlatpakRemote *self)
|
||||
{
|
||||
XdgAppRemotePrivate *priv = xdg_app_remote_get_instance_private (self);
|
||||
FlatpakRemotePrivate *priv = flatpak_remote_get_instance_private (self);
|
||||
|
||||
return priv->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* xdg_app_remote_get_appstream_dir:
|
||||
* @self: a #XdgAppRemote
|
||||
* flatpak_remote_get_appstream_dir:
|
||||
* @self: a #FlatpakRemote
|
||||
* @arch: (nullable): which architecture to fetch (default: current architecture)
|
||||
*
|
||||
* Returns the directory where this remote will store locally cached
|
||||
|
@ -167,23 +167,23 @@ xdg_app_remote_get_name (XdgAppRemote *self)
|
|||
* Returns: (transfer full): a #GFile
|
||||
**/
|
||||
GFile *
|
||||
xdg_app_remote_get_appstream_dir (XdgAppRemote *self,
|
||||
const char *arch)
|
||||
flatpak_remote_get_appstream_dir (FlatpakRemote *self,
|
||||
const char *arch)
|
||||
{
|
||||
XdgAppRemotePrivate *priv = xdg_app_remote_get_instance_private (self);
|
||||
FlatpakRemotePrivate *priv = flatpak_remote_get_instance_private (self);
|
||||
g_autofree char *subdir = NULL;
|
||||
|
||||
if (arch == NULL)
|
||||
arch = xdg_app_get_arch ();
|
||||
arch = flatpak_get_arch ();
|
||||
|
||||
subdir = g_strdup_printf ("appstream/%s/%s/active", priv->name, arch);
|
||||
return g_file_resolve_relative_path (xdg_app_dir_get_path (priv->dir),
|
||||
return g_file_resolve_relative_path (flatpak_dir_get_path (priv->dir),
|
||||
subdir);
|
||||
}
|
||||
|
||||
/**
|
||||
* xdg_app_remote_get_appstream_timestamp:
|
||||
* @self: a #XdgAppRemote
|
||||
* flatpak_remote_get_appstream_timestamp:
|
||||
* @self: a #FlatpakRemote
|
||||
* @arch: (nullable): which architecture to fetch (default: current architecture)
|
||||
*
|
||||
* Returns the timestamp file that will be updated whenever the appstream information
|
||||
|
@ -192,33 +192,33 @@ xdg_app_remote_get_appstream_dir (XdgAppRemote *self,
|
|||
* Returns: (transfer full): a #GFile
|
||||
**/
|
||||
GFile *
|
||||
xdg_app_remote_get_appstream_timestamp (XdgAppRemote *self,
|
||||
const char *arch)
|
||||
flatpak_remote_get_appstream_timestamp (FlatpakRemote *self,
|
||||
const char *arch)
|
||||
{
|
||||
XdgAppRemotePrivate *priv = xdg_app_remote_get_instance_private (self);
|
||||
FlatpakRemotePrivate *priv = flatpak_remote_get_instance_private (self);
|
||||
g_autofree char *subdir = NULL;
|
||||
|
||||
if (arch == NULL)
|
||||
arch = xdg_app_get_arch ();
|
||||
arch = flatpak_get_arch ();
|
||||
|
||||
subdir = g_strdup_printf ("appstream/%s/%s/.timestamp", priv->name, arch);
|
||||
return g_file_resolve_relative_path (xdg_app_dir_get_path (priv->dir),
|
||||
return g_file_resolve_relative_path (flatpak_dir_get_path (priv->dir),
|
||||
subdir);
|
||||
}
|
||||
|
||||
/**
|
||||
* xdg_app_remote_get_url:
|
||||
* @self: a #XdgAppRemote
|
||||
* flatpak_remote_get_url:
|
||||
* @self: a #FlatpakRemote
|
||||
*
|
||||
* Returns the repository URL of this remote.
|
||||
*
|
||||
* Returns: (transfer full): the URL
|
||||
*/
|
||||
char *
|
||||
xdg_app_remote_get_url (XdgAppRemote *self)
|
||||
flatpak_remote_get_url (FlatpakRemote *self)
|
||||
{
|
||||
XdgAppRemotePrivate *priv = xdg_app_remote_get_instance_private (self);
|
||||
OstreeRepo *repo = xdg_app_dir_get_repo (priv->dir);
|
||||
FlatpakRemotePrivate *priv = flatpak_remote_get_instance_private (self);
|
||||
OstreeRepo *repo = flatpak_dir_get_repo (priv->dir);
|
||||
char *url;
|
||||
|
||||
if (ostree_repo_remote_get_url (repo, priv->name, &url, NULL))
|
||||
|
@ -228,82 +228,82 @@ xdg_app_remote_get_url (XdgAppRemote *self)
|
|||
}
|
||||
|
||||
/**
|
||||
* xdg_app_remote_get_title:
|
||||
* @self: a #XdgAppRemote
|
||||
* flatpak_remote_get_title:
|
||||
* @self: a #FlatpakRemote
|
||||
*
|
||||
* Returns the title of the remote.
|
||||
*
|
||||
* Returns: (transfer full): the title
|
||||
*/
|
||||
char *
|
||||
xdg_app_remote_get_title (XdgAppRemote *self)
|
||||
flatpak_remote_get_title (FlatpakRemote *self)
|
||||
{
|
||||
XdgAppRemotePrivate *priv = xdg_app_remote_get_instance_private (self);
|
||||
FlatpakRemotePrivate *priv = flatpak_remote_get_instance_private (self);
|
||||
|
||||
return xdg_app_dir_get_remote_title (priv->dir, priv->name);
|
||||
return flatpak_dir_get_remote_title (priv->dir, priv->name);
|
||||
}
|
||||
|
||||
/**
|
||||
* xdg_app_remote_get_noenumerate:
|
||||
* @self: a #XdgAppRemote
|
||||
* flatpak_remote_get_noenumerate:
|
||||
* @self: a #FlatpakRemote
|
||||
*
|
||||
* Returns whether this remote should be used to list applications.
|
||||
*
|
||||
* Returns: whether the remote is marked as "don't enumerate"
|
||||
*/
|
||||
gboolean
|
||||
xdg_app_remote_get_noenumerate (XdgAppRemote *self)
|
||||
flatpak_remote_get_noenumerate (FlatpakRemote *self)
|
||||
{
|
||||
XdgAppRemotePrivate *priv = xdg_app_remote_get_instance_private (self);
|
||||
FlatpakRemotePrivate *priv = flatpak_remote_get_instance_private (self);
|
||||
|
||||
return xdg_app_dir_get_remote_noenumerate (priv->dir, priv->name);
|
||||
return flatpak_dir_get_remote_noenumerate (priv->dir, priv->name);
|
||||
}
|
||||
|
||||
/**
|
||||
* xdg_app_remote_get_disable:
|
||||
* @self: a #XdgAppRemote
|
||||
* flatpak_remote_get_disable:
|
||||
* @self: a #FlatpakRemote
|
||||
*
|
||||
* Returns whether this remote is disabled.
|
||||
*
|
||||
* Returns: whether the remote is marked as "don't enumerate"
|
||||
*/
|
||||
gboolean
|
||||
xdg_app_remote_get_disabled (XdgAppRemote *self)
|
||||
flatpak_remote_get_disabled (FlatpakRemote *self)
|
||||
{
|
||||
XdgAppRemotePrivate *priv = xdg_app_remote_get_instance_private (self);
|
||||
FlatpakRemotePrivate *priv = flatpak_remote_get_instance_private (self);
|
||||
|
||||
return xdg_app_dir_get_remote_disabled (priv->dir, priv->name);
|
||||
return flatpak_dir_get_remote_disabled (priv->dir, priv->name);
|
||||
}
|
||||
|
||||
/**
|
||||
* xdg_app_remote_get_prio:
|
||||
* @self: a #XdgAppRemote
|
||||
* flatpak_remote_get_prio:
|
||||
* @self: a #FlatpakRemote
|
||||
*
|
||||
* Returns the priority for the remote.
|
||||
*
|
||||
* Returns: the priority
|
||||
*/
|
||||
int
|
||||
xdg_app_remote_get_prio (XdgAppRemote *self)
|
||||
flatpak_remote_get_prio (FlatpakRemote *self)
|
||||
{
|
||||
XdgAppRemotePrivate *priv = xdg_app_remote_get_instance_private (self);
|
||||
FlatpakRemotePrivate *priv = flatpak_remote_get_instance_private (self);
|
||||
|
||||
return xdg_app_dir_get_remote_prio (priv->dir, priv->name);
|
||||
return flatpak_dir_get_remote_prio (priv->dir, priv->name);
|
||||
}
|
||||
|
||||
/**
|
||||
* xdg_app_remote_get_gpg_verify:
|
||||
* @self: a #XdgAppRemote
|
||||
* flatpak_remote_get_gpg_verify:
|
||||
* @self: a #FlatpakRemote
|
||||
*
|
||||
* Returns whether GPG verification is enabled for the remote.
|
||||
*
|
||||
* Returns: whether GPG verification is enabled
|
||||
*/
|
||||
gboolean
|
||||
xdg_app_remote_get_gpg_verify (XdgAppRemote *self)
|
||||
flatpak_remote_get_gpg_verify (FlatpakRemote *self)
|
||||
{
|
||||
XdgAppRemotePrivate *priv = xdg_app_remote_get_instance_private (self);
|
||||
OstreeRepo *repo = xdg_app_dir_get_repo (priv->dir);
|
||||
FlatpakRemotePrivate *priv = flatpak_remote_get_instance_private (self);
|
||||
OstreeRepo *repo = flatpak_dir_get_repo (priv->dir);
|
||||
gboolean res;
|
||||
|
||||
if (ostree_repo_remote_get_gpg_verify (repo, priv->name, &res, NULL))
|
||||
|
@ -312,16 +312,16 @@ xdg_app_remote_get_gpg_verify (XdgAppRemote *self)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
XdgAppRemote *
|
||||
xdg_app_remote_new (XdgAppDir *dir,
|
||||
FlatpakRemote *
|
||||
flatpak_remote_new (FlatpakDir *dir,
|
||||
const char *name)
|
||||
{
|
||||
XdgAppRemotePrivate *priv;
|
||||
XdgAppRemote *self = g_object_new (XDG_APP_TYPE_REMOTE,
|
||||
"name", name,
|
||||
NULL);
|
||||
FlatpakRemotePrivate *priv;
|
||||
FlatpakRemote *self = g_object_new (FLATPAK_TYPE_REMOTE,
|
||||
"name", name,
|
||||
NULL);
|
||||
|
||||
priv = xdg_app_remote_get_instance_private (self);
|
||||
priv = flatpak_remote_get_instance_private (self);
|
||||
priv->dir = g_object_ref (dir);
|
||||
|
||||
return self;
|
||||
|
|
|
@ -18,25 +18,25 @@
|
|||
* Alexander Larsson <alexl@redhat.com>
|
||||
*/
|
||||
|
||||
#if !defined(__XDG_APP_H_INSIDE__) && !defined(XDG_APP_COMPILATION)
|
||||
#if !defined(__FLATPAK_H_INSIDE__) && !defined(FLATPAK_COMPILATION)
|
||||
#error "Only <xdg-app.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#ifndef __XDG_APP_REMOTE_H__
|
||||
#define __XDG_APP_REMOTE_H__
|
||||
#ifndef __FLATPAK_REMOTE_H__
|
||||
#define __FLATPAK_REMOTE_H__
|
||||
|
||||
typedef struct _XdgAppRemote XdgAppRemote;
|
||||
typedef struct _FlatpakRemote FlatpakRemote;
|
||||
|
||||
#include <gio/gio.h>
|
||||
#include <xdg-app-remote-ref.h>
|
||||
|
||||
#define XDG_APP_TYPE_REMOTE xdg_app_remote_get_type ()
|
||||
#define XDG_APP_REMOTE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), XDG_APP_TYPE_REMOTE, XdgAppRemote))
|
||||
#define XDG_APP_IS_REMOTE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), XDG_APP_TYPE_REMOTE))
|
||||
#define FLATPAK_TYPE_REMOTE flatpak_remote_get_type ()
|
||||
#define FLATPAK_REMOTE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FLATPAK_TYPE_REMOTE, FlatpakRemote))
|
||||
#define FLATPAK_IS_REMOTE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FLATPAK_TYPE_REMOTE))
|
||||
|
||||
XDG_APP_EXTERN GType xdg_app_remote_get_type (void);
|
||||
FLATPAK_EXTERN GType flatpak_remote_get_type (void);
|
||||
|
||||
struct _XdgAppRemote
|
||||
struct _FlatpakRemote
|
||||
{
|
||||
GObject parent;
|
||||
};
|
||||
|
@ -44,22 +44,22 @@ struct _XdgAppRemote
|
|||
typedef struct
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
} XdgAppRemoteClass;
|
||||
} FlatpakRemoteClass;
|
||||
|
||||
#ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (XdgAppRemote, g_object_unref)
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (FlatpakRemote, g_object_unref)
|
||||
#endif
|
||||
|
||||
XDG_APP_EXTERN const char * xdg_app_remote_get_name (XdgAppRemote * self);
|
||||
XDG_APP_EXTERN GFile * xdg_app_remote_get_appstream_dir (XdgAppRemote *self,
|
||||
const char *arch);
|
||||
XDG_APP_EXTERN GFile * xdg_app_remote_get_appstream_timestamp (XdgAppRemote *self,
|
||||
const char *arch);
|
||||
XDG_APP_EXTERN char * xdg_app_remote_get_url (XdgAppRemote *self);
|
||||
XDG_APP_EXTERN char * xdg_app_remote_get_title (XdgAppRemote *self);
|
||||
XDG_APP_EXTERN gboolean xdg_app_remote_get_gpg_verify (XdgAppRemote *self);
|
||||
XDG_APP_EXTERN gboolean xdg_app_remote_get_noenumerate (XdgAppRemote *self);
|
||||
XDG_APP_EXTERN gboolean xdg_app_remote_get_disabled (XdgAppRemote *self);
|
||||
XDG_APP_EXTERN int xdg_app_remote_get_prio (XdgAppRemote *self);
|
||||
FLATPAK_EXTERN const char * flatpak_remote_get_name (FlatpakRemote * self);
|
||||
FLATPAK_EXTERN GFile * flatpak_remote_get_appstream_dir (FlatpakRemote *self,
|
||||
const char *arch);
|
||||
FLATPAK_EXTERN GFile * flatpak_remote_get_appstream_timestamp (FlatpakRemote *self,
|
||||
const char *arch);
|
||||
FLATPAK_EXTERN char * flatpak_remote_get_url (FlatpakRemote *self);
|
||||
FLATPAK_EXTERN char * flatpak_remote_get_title (FlatpakRemote *self);
|
||||
FLATPAK_EXTERN gboolean flatpak_remote_get_gpg_verify (FlatpakRemote *self);
|
||||
FLATPAK_EXTERN gboolean flatpak_remote_get_noenumerate (FlatpakRemote *self);
|
||||
FLATPAK_EXTERN gboolean flatpak_remote_get_disabled (FlatpakRemote *self);
|
||||
FLATPAK_EXTERN int flatpak_remote_get_prio (FlatpakRemote *self);
|
||||
|
||||
#endif /* __XDG_APP_REMOTE_H__ */
|
||||
#endif /* __FLATPAK_REMOTE_H__ */
|
||||
|
|
|
@ -18,19 +18,19 @@
|
|||
* Alexander Larsson <alexl@redhat.com>
|
||||
*/
|
||||
|
||||
#if !defined (__XDG_APP_H_INSIDE__) && !defined (XDG_APP_COMPILATION)
|
||||
#if !defined (__FLATPAK_H_INSIDE__) && !defined (FLATPAK_COMPILATION)
|
||||
#error "Only <xdg-app.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#ifndef __XDG_APP_VERSION_MACROS_H__
|
||||
#define __XDG_APP_VERSION_MACROS_H__
|
||||
#ifndef __FLATPAK_VERSION_MACROS_H__
|
||||
#define __FLATPAK_VERSION_MACROS_H__
|
||||
|
||||
#define XDG_APP_MAJOR_VERSION (@XDG_APP_MAJOR_VERSION@)
|
||||
#define XDG_APP_MINOR_VERSION (@XDG_APP_MINOR_VERSION@)
|
||||
#define XDG_APP_MICRO_VERSION (@XDG_APP_MICRO_VERSION@)
|
||||
#define FLATPAK_MAJOR_VERSION (@FLATPAK_MAJOR_VERSION@)
|
||||
#define FLATPAK_MINOR_VERSION (@FLATPAK_MINOR_VERSION@)
|
||||
#define FLATPAK_MICRO_VERSION (@FLATPAK_MICRO_VERSION@)
|
||||
|
||||
#ifndef XDG_APP_EXTERN
|
||||
#define XDG_APP_EXTERN extern
|
||||
#ifndef FLATPAK_EXTERN
|
||||
#define FLATPAK_EXTERN extern
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -38,4 +38,4 @@
|
|||
* @Title: Version information
|
||||
*/
|
||||
|
||||
#endif /* __XDG_APP_VERSION_MACROS_H__ */
|
||||
#endif /* __FLATPAK_VERSION_MACROS_H__ */
|
||||
|
|
|
@ -18,10 +18,10 @@
|
|||
* Alexander Larsson <alexl@redhat.com>
|
||||
*/
|
||||
|
||||
#ifndef __XDG_APP_H__
|
||||
#define __XDG_APP_H__
|
||||
#ifndef __FLATPAK_H__
|
||||
#define __FLATPAK_H__
|
||||
|
||||
#define __XDG_APP_H_INSIDE__
|
||||
#define __FLATPAK_H_INSIDE__
|
||||
|
||||
#include <gio/gio.h>
|
||||
|
||||
|
@ -35,6 +35,6 @@
|
|||
#include <xdg-app-remote.h>
|
||||
#include <xdg-app-installation.h>
|
||||
|
||||
#undef __XDG_APP_H_INSIDE__
|
||||
#undef __FLATPAK_H_INSIDE__
|
||||
|
||||
#endif /* __XDG_APP_H__ */
|
||||
#endif /* __FLATPAK_H__ */
|
||||
|
|
|
@ -32,11 +32,11 @@ GHashTable *tables = NULL;
|
|||
|
||||
typedef struct
|
||||
{
|
||||
char *name;
|
||||
XdgAppDb *db;
|
||||
GList *outstanding_writes;
|
||||
GList *current_writes;
|
||||
gboolean writing;
|
||||
char *name;
|
||||
FlatpakDb *db;
|
||||
GList *outstanding_writes;
|
||||
GList *current_writes;
|
||||
gboolean writing;
|
||||
} Table;
|
||||
|
||||
static void start_writeout (Table *table);
|
||||
|
@ -54,7 +54,7 @@ lookup_table (const char *name,
|
|||
GDBusMethodInvocation *invocation)
|
||||
{
|
||||
Table *table;
|
||||
XdgAppDb *db;
|
||||
FlatpakDb *db;
|
||||
g_autofree char *dir = NULL;
|
||||
g_autofree char *path = NULL;
|
||||
|
||||
|
@ -68,11 +68,11 @@ lookup_table (const char *name,
|
|||
g_mkdir_with_parents (dir, 0755);
|
||||
|
||||
path = g_build_filename (dir, name, NULL);
|
||||
db = xdg_app_db_new (path, FALSE, &error);
|
||||
db = flatpak_db_new (path, FALSE, &error);
|
||||
if (db == NULL)
|
||||
{
|
||||
g_dbus_method_invocation_return_error (invocation,
|
||||
XDG_APP_PORTAL_ERROR, XDG_APP_PORTAL_ERROR_FAILED,
|
||||
FLATPAK_PORTAL_ERROR, FLATPAK_PORTAL_ERROR_FAILED,
|
||||
"Unable to load db file: %s", error->message);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -97,7 +97,7 @@ writeout_done (GObject *source_object,
|
|||
g_autoptr(GError) error = NULL;
|
||||
gboolean ok;
|
||||
|
||||
ok = xdg_app_db_save_content_finish (table->db, res, &error);
|
||||
ok = flatpak_db_save_content_finish (table->db, res, &error);
|
||||
|
||||
for (l = table->current_writes; l != NULL; l = l->next)
|
||||
{
|
||||
|
@ -108,7 +108,7 @@ writeout_done (GObject *source_object,
|
|||
g_variant_new ("()"));
|
||||
else
|
||||
g_dbus_method_invocation_return_error (invocation,
|
||||
XDG_APP_PORTAL_ERROR, XDG_APP_PORTAL_ERROR_FAILED,
|
||||
FLATPAK_PORTAL_ERROR, FLATPAK_PORTAL_ERROR_FAILED,
|
||||
"Unable to write db: %s", error->message);
|
||||
}
|
||||
|
||||
|
@ -128,9 +128,9 @@ start_writeout (Table *table)
|
|||
table->outstanding_writes = NULL;
|
||||
table->writing = TRUE;
|
||||
|
||||
xdg_app_db_update (table->db);
|
||||
flatpak_db_update (table->db);
|
||||
|
||||
xdg_app_db_save_content_async (table->db, NULL, writeout_done, table);
|
||||
flatpak_db_save_content_async (table->db, NULL, writeout_done, table);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -156,7 +156,7 @@ handle_list (XdgAppPermissionStore *object,
|
|||
if (table == NULL)
|
||||
return TRUE;
|
||||
|
||||
ids = xdg_app_db_list_ids (table->db);
|
||||
ids = flatpak_db_list_ids (table->db);
|
||||
|
||||
xdg_app_permission_store_complete_list (object, invocation, (const char * const *) ids);
|
||||
|
||||
|
@ -164,18 +164,18 @@ handle_list (XdgAppPermissionStore *object,
|
|||
}
|
||||
|
||||
static GVariant *
|
||||
get_app_permissions (XdgAppDbEntry *entry)
|
||||
get_app_permissions (FlatpakDbEntry *entry)
|
||||
{
|
||||
g_autofree const char **apps = NULL;
|
||||
GVariantBuilder builder;
|
||||
int i;
|
||||
|
||||
apps = xdg_app_db_entry_list_apps (entry);
|
||||
apps = flatpak_db_entry_list_apps (entry);
|
||||
g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sas}"));
|
||||
|
||||
for (i = 0; apps[i] != NULL; i++)
|
||||
{
|
||||
g_autofree const char **permissions = xdg_app_db_entry_list_permissions (entry, apps[i]);
|
||||
g_autofree const char **permissions = flatpak_db_entry_list_permissions (entry, apps[i]);
|
||||
g_variant_builder_add_value (&builder,
|
||||
g_variant_new ("{s@as}",
|
||||
apps[i],
|
||||
|
@ -195,22 +195,22 @@ handle_lookup (XdgAppPermissionStore *object,
|
|||
|
||||
g_autoptr(GVariant) data = NULL;
|
||||
g_autoptr(GVariant) permissions = NULL;
|
||||
g_autoptr(XdgAppDbEntry) entry = NULL;
|
||||
g_autoptr(FlatpakDbEntry) entry = NULL;
|
||||
|
||||
table = lookup_table (table_name, invocation);
|
||||
if (table == NULL)
|
||||
return TRUE;
|
||||
|
||||
entry = xdg_app_db_lookup (table->db, id);
|
||||
entry = flatpak_db_lookup (table->db, id);
|
||||
if (entry == NULL)
|
||||
{
|
||||
g_dbus_method_invocation_return_error (invocation,
|
||||
XDG_APP_PORTAL_ERROR, XDG_APP_PORTAL_ERROR_NOT_FOUND,
|
||||
FLATPAK_PORTAL_ERROR, FLATPAK_PORTAL_ERROR_NOT_FOUND,
|
||||
"No entry for %s", id);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
data = xdg_app_db_entry_get_data (entry);
|
||||
data = flatpak_db_entry_get_data (entry);
|
||||
permissions = get_app_permissions (entry);
|
||||
|
||||
xdg_app_permission_store_complete_lookup (object, invocation,
|
||||
|
@ -224,12 +224,12 @@ static void
|
|||
emit_deleted (XdgAppPermissionStore *object,
|
||||
const gchar *table_name,
|
||||
const gchar *id,
|
||||
XdgAppDbEntry *entry)
|
||||
FlatpakDbEntry *entry)
|
||||
{
|
||||
g_autoptr(GVariant) data = NULL;
|
||||
g_autoptr(GVariant) permissions = NULL;
|
||||
|
||||
data = xdg_app_db_entry_get_data (entry);
|
||||
data = flatpak_db_entry_get_data (entry);
|
||||
permissions = g_variant_ref_sink (g_variant_new_array (G_VARIANT_TYPE ("{sas}"), NULL, 0));
|
||||
|
||||
xdg_app_permission_store_emit_changed (object,
|
||||
|
@ -244,12 +244,12 @@ static void
|
|||
emit_changed (XdgAppPermissionStore *object,
|
||||
const gchar *table_name,
|
||||
const gchar *id,
|
||||
XdgAppDbEntry *entry)
|
||||
FlatpakDbEntry *entry)
|
||||
{
|
||||
g_autoptr(GVariant) data = NULL;
|
||||
g_autoptr(GVariant) permissions = NULL;
|
||||
|
||||
data = xdg_app_db_entry_get_data (entry);
|
||||
data = flatpak_db_entry_get_data (entry);
|
||||
permissions = get_app_permissions (entry);
|
||||
|
||||
xdg_app_permission_store_emit_changed (object,
|
||||
|
@ -267,22 +267,22 @@ handle_delete (XdgAppPermissionStore *object,
|
|||
{
|
||||
Table *table;
|
||||
|
||||
g_autoptr(XdgAppDbEntry) entry = NULL;
|
||||
g_autoptr(FlatpakDbEntry) entry = NULL;
|
||||
|
||||
table = lookup_table (table_name, invocation);
|
||||
if (table == NULL)
|
||||
return TRUE;
|
||||
|
||||
entry = xdg_app_db_lookup (table->db, id);
|
||||
entry = flatpak_db_lookup (table->db, id);
|
||||
if (entry == NULL)
|
||||
{
|
||||
g_dbus_method_invocation_return_error (invocation,
|
||||
XDG_APP_PORTAL_ERROR, XDG_APP_PORTAL_ERROR_NOT_FOUND,
|
||||
FLATPAK_PORTAL_ERROR, FLATPAK_PORTAL_ERROR_NOT_FOUND,
|
||||
"No entry for %s", id);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
xdg_app_db_set_entry (table->db, id, NULL);
|
||||
flatpak_db_set_entry (table->db, id, NULL);
|
||||
emit_deleted (object, table_name, id, entry);
|
||||
|
||||
ensure_writeout (table, invocation);
|
||||
|
@ -304,43 +304,43 @@ handle_set (XdgAppPermissionStore *object,
|
|||
GVariant *child;
|
||||
|
||||
g_autoptr(GVariant) data_child = NULL;
|
||||
g_autoptr(XdgAppDbEntry) old_entry = NULL;
|
||||
g_autoptr(XdgAppDbEntry) new_entry = NULL;
|
||||
g_autoptr(FlatpakDbEntry) old_entry = NULL;
|
||||
g_autoptr(FlatpakDbEntry) new_entry = NULL;
|
||||
|
||||
table = lookup_table (table_name, invocation);
|
||||
if (table == NULL)
|
||||
return TRUE;
|
||||
|
||||
old_entry = xdg_app_db_lookup (table->db, id);
|
||||
old_entry = flatpak_db_lookup (table->db, id);
|
||||
if (old_entry == NULL && !create)
|
||||
{
|
||||
g_dbus_method_invocation_return_error (invocation,
|
||||
XDG_APP_PORTAL_ERROR, XDG_APP_PORTAL_ERROR_NOT_FOUND,
|
||||
FLATPAK_PORTAL_ERROR, FLATPAK_PORTAL_ERROR_NOT_FOUND,
|
||||
"Id %s not found", id);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
data_child = g_variant_get_child_value (data, 0);
|
||||
new_entry = xdg_app_db_entry_new (data_child);
|
||||
new_entry = flatpak_db_entry_new (data_child);
|
||||
|
||||
/* Add all the given app permissions */
|
||||
|
||||
g_variant_iter_init (&iter, app_permissions);
|
||||
while ((child = g_variant_iter_next_value (&iter)))
|
||||
{
|
||||
g_autoptr(XdgAppDbEntry) old_entry;
|
||||
g_autoptr(FlatpakDbEntry) old_entry;
|
||||
const char *child_app_id;
|
||||
g_autofree const char **permissions;
|
||||
|
||||
g_variant_get (child, "{&s^a&s}", &child_app_id, &permissions);
|
||||
|
||||
old_entry = new_entry;
|
||||
new_entry = xdg_app_db_entry_set_app_permissions (new_entry, child_app_id, (const char **) permissions);
|
||||
new_entry = flatpak_db_entry_set_app_permissions (new_entry, child_app_id, (const char **) permissions);
|
||||
|
||||
g_variant_unref (child);
|
||||
}
|
||||
|
||||
xdg_app_db_set_entry (table->db, id, new_entry);
|
||||
flatpak_db_set_entry (table->db, id, new_entry);
|
||||
emit_changed (object, table_name, id, new_entry);
|
||||
|
||||
ensure_writeout (table, invocation);
|
||||
|
@ -359,31 +359,31 @@ handle_set_permission (XdgAppPermissionStore *object,
|
|||
{
|
||||
Table *table;
|
||||
|
||||
g_autoptr(XdgAppDbEntry) entry = NULL;
|
||||
g_autoptr(XdgAppDbEntry) new_entry = NULL;
|
||||
g_autoptr(FlatpakDbEntry) entry = NULL;
|
||||
g_autoptr(FlatpakDbEntry) new_entry = NULL;
|
||||
|
||||
table = lookup_table (table_name, invocation);
|
||||
if (table == NULL)
|
||||
return TRUE;
|
||||
|
||||
entry = xdg_app_db_lookup (table->db, id);
|
||||
entry = flatpak_db_lookup (table->db, id);
|
||||
if (entry == NULL)
|
||||
{
|
||||
if (create)
|
||||
{
|
||||
entry = xdg_app_db_entry_new (NULL);
|
||||
entry = flatpak_db_entry_new (NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_dbus_method_invocation_return_error (invocation,
|
||||
XDG_APP_PORTAL_ERROR, XDG_APP_PORTAL_ERROR_NOT_FOUND,
|
||||
FLATPAK_PORTAL_ERROR, FLATPAK_PORTAL_ERROR_NOT_FOUND,
|
||||
"Id %s not found", id);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
new_entry = xdg_app_db_entry_set_app_permissions (entry, app, (const char **) permissions);
|
||||
xdg_app_db_set_entry (table->db, id, new_entry);
|
||||
new_entry = flatpak_db_entry_set_app_permissions (entry, app, (const char **) permissions);
|
||||
flatpak_db_set_entry (table->db, id, new_entry);
|
||||
emit_changed (object, table_name, id, new_entry);
|
||||
|
||||
ensure_writeout (table, invocation);
|
||||
|
@ -401,34 +401,34 @@ handle_set_value (XdgAppPermissionStore *object,
|
|||
{
|
||||
Table *table;
|
||||
|
||||
g_autoptr(XdgAppDbEntry) entry = NULL;
|
||||
g_autoptr(XdgAppDbEntry) new_entry = NULL;
|
||||
g_autoptr(FlatpakDbEntry) entry = NULL;
|
||||
g_autoptr(FlatpakDbEntry) new_entry = NULL;
|
||||
|
||||
table = lookup_table (table_name, invocation);
|
||||
if (table == NULL)
|
||||
return TRUE;
|
||||
|
||||
entry = xdg_app_db_lookup (table->db, id);
|
||||
entry = flatpak_db_lookup (table->db, id);
|
||||
if (entry == NULL)
|
||||
{
|
||||
if (create)
|
||||
{
|
||||
new_entry = xdg_app_db_entry_new (data);
|
||||
new_entry = flatpak_db_entry_new (data);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_dbus_method_invocation_return_error (invocation,
|
||||
XDG_APP_PORTAL_ERROR, XDG_APP_PORTAL_ERROR_NOT_FOUND,
|
||||
FLATPAK_PORTAL_ERROR, FLATPAK_PORTAL_ERROR_NOT_FOUND,
|
||||
"Id %s not found", id);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
new_entry = xdg_app_db_entry_modify_data (entry, data);
|
||||
new_entry = flatpak_db_entry_modify_data (entry, data);
|
||||
}
|
||||
|
||||
xdg_app_db_set_entry (table->db, id, new_entry);
|
||||
flatpak_db_set_entry (table->db, id, new_entry);
|
||||
emit_changed (object, table_name, id, new_entry);
|
||||
|
||||
ensure_writeout (table, invocation);
|
||||
|
@ -437,7 +437,7 @@ handle_set_value (XdgAppPermissionStore *object,
|
|||
}
|
||||
|
||||
void
|
||||
xdg_app_permission_store_start (GDBusConnection *connection)
|
||||
flatpak_permission_store_start (GDBusConnection *connection)
|
||||
{
|
||||
XdgAppPermissionStore *store;
|
||||
GError *error = NULL;
|
||||
|
@ -456,7 +456,7 @@ xdg_app_permission_store_start (GDBusConnection *connection)
|
|||
|
||||
if (!g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (store),
|
||||
connection,
|
||||
"/org/freedesktop/XdgApp/PermissionStore",
|
||||
"/org/freedesktop/Flatpak/PermissionStore",
|
||||
&error))
|
||||
{
|
||||
g_warning ("error: %s\n", error->message);
|
||||
|
|
|
@ -18,11 +18,11 @@
|
|||
* Alexander Larsson <alexl@redhat.com>
|
||||
*/
|
||||
|
||||
#ifndef __XDG_APP_PERMISSION_STORE_H__
|
||||
#define __XDG_APP_PERMISSION_STORE_H__
|
||||
#ifndef __FLATPAK_PERMISSION_STORE_H__
|
||||
#define __FLATPAK_PERMISSION_STORE_H__
|
||||
|
||||
#include "xdg-app-dbus.h"
|
||||
|
||||
void xdg_app_permission_store_start (GDBusConnection *connection);
|
||||
void flatpak_permission_store_start (GDBusConnection *connection);
|
||||
|
||||
#endif /* __XDG_APP_PERMISSION_STORE_H__ */
|
||||
#endif /* __FLATPAK_PERMISSION_STORE_H__ */
|
||||
|
|
|
@ -48,7 +48,7 @@ on_bus_acquired (GDBusConnection *connection,
|
|||
XdgAppSessionHelper *helper;
|
||||
GError *error = NULL;
|
||||
|
||||
xdg_app_permission_store_start (connection);
|
||||
flatpak_permission_store_start (connection);
|
||||
|
||||
helper = xdg_app_session_helper_skeleton_new ();
|
||||
|
||||
|
@ -56,7 +56,7 @@ on_bus_acquired (GDBusConnection *connection,
|
|||
|
||||
if (!g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (helper),
|
||||
connection,
|
||||
"/org/freedesktop/XdgApp/SessionHelper",
|
||||
"/org/freedesktop/Flatpak/SessionHelper",
|
||||
&error))
|
||||
{
|
||||
g_warning ("error: %s\n", error->message);
|
||||
|
@ -145,7 +145,7 @@ main (int argc,
|
|||
setup_file_monitor ("/etc/localtime");
|
||||
|
||||
owner_id = g_bus_own_name (G_BUS_TYPE_SESSION,
|
||||
"org.freedesktop.XdgApp",
|
||||
"org.freedesktop.Flatpak",
|
||||
G_BUS_NAME_OWNER_FLAGS_NONE,
|
||||
on_bus_acquired,
|
||||
on_name_acquired,
|
||||
|
|
|
@ -51,7 +51,7 @@ handle_deploy (XdgAppSystemHelper *object,
|
|||
const gchar *arg_origin,
|
||||
const gchar *const *arg_subpaths)
|
||||
{
|
||||
g_autoptr(XdgAppDir) system = xdg_app_dir_get_system ();
|
||||
g_autoptr(FlatpakDir) system = flatpak_dir_get_system ();
|
||||
g_autoptr(GFile) path = g_file_new_for_path (arg_repo_path);
|
||||
g_autoptr(GError) error = NULL;
|
||||
g_autoptr(GFile) deploy_dir = NULL;
|
||||
|
@ -60,10 +60,10 @@ handle_deploy (XdgAppSystemHelper *object,
|
|||
gboolean is_update;
|
||||
g_autoptr(GMainContext) main_context = NULL;
|
||||
|
||||
if ((arg_flags & ~XDG_APP_HELPER_DEPLOY_FLAGS_ALL) != 0)
|
||||
if ((arg_flags & ~FLATPAK_HELPER_DEPLOY_FLAGS_ALL) != 0)
|
||||
{
|
||||
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS,
|
||||
"Unsupported flags enabled: 0x%x", (arg_flags & ~XDG_APP_HELPER_DEPLOY_FLAGS_ALL));
|
||||
"Unsupported flags enabled: 0x%x", (arg_flags & ~FLATPAK_HELPER_DEPLOY_FLAGS_ALL));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -73,9 +73,9 @@ handle_deploy (XdgAppSystemHelper *object,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
is_update = (arg_flags & XDG_APP_HELPER_DEPLOY_FLAGS_UPDATE) != 0;
|
||||
is_update = (arg_flags & FLATPAK_HELPER_DEPLOY_FLAGS_UPDATE) != 0;
|
||||
|
||||
deploy_dir = xdg_app_dir_get_if_deployed (system, arg_ref,
|
||||
deploy_dir = flatpak_dir_get_if_deployed (system, arg_ref,
|
||||
NULL, NULL);
|
||||
|
||||
if (deploy_dir)
|
||||
|
@ -84,12 +84,12 @@ handle_deploy (XdgAppSystemHelper *object,
|
|||
if (!is_update)
|
||||
{
|
||||
/* Can't install already installed app */
|
||||
g_dbus_method_invocation_return_error (invocation, XDG_APP_ERROR, XDG_APP_ERROR_ALREADY_INSTALLED,
|
||||
g_dbus_method_invocation_return_error (invocation, FLATPAK_ERROR, FLATPAK_ERROR_ALREADY_INSTALLED,
|
||||
"%s is already installed", arg_ref);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
real_origin = xdg_app_dir_get_origin (system, arg_ref, NULL, NULL);
|
||||
real_origin = flatpak_dir_get_origin (system, arg_ref, NULL, NULL);
|
||||
if (g_strcmp0 (real_origin, arg_origin) != 0)
|
||||
{
|
||||
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS,
|
||||
|
@ -100,12 +100,12 @@ handle_deploy (XdgAppSystemHelper *object,
|
|||
else if (!deploy_dir && is_update)
|
||||
{
|
||||
/* Can't update not installed app */
|
||||
g_dbus_method_invocation_return_error (invocation, XDG_APP_ERROR, XDG_APP_ERROR_ALREADY_INSTALLED,
|
||||
g_dbus_method_invocation_return_error (invocation, FLATPAK_ERROR, FLATPAK_ERROR_ALREADY_INSTALLED,
|
||||
"%s is not installed", arg_ref);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (!xdg_app_dir_ensure_repo (system, NULL, &error))
|
||||
if (!flatpak_dir_ensure_repo (system, NULL, &error))
|
||||
{
|
||||
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_FAILED,
|
||||
"Can't open system repo %s", error->message);
|
||||
|
@ -116,7 +116,7 @@ handle_deploy (XdgAppSystemHelper *object,
|
|||
main_context = g_main_context_new ();
|
||||
g_main_context_push_thread_default (main_context);
|
||||
|
||||
if (!xdg_app_dir_pull_untrusted_local (system, arg_repo_path,
|
||||
if (!flatpak_dir_pull_untrusted_local (system, arg_repo_path,
|
||||
arg_origin,
|
||||
arg_ref,
|
||||
(char **) arg_subpaths,
|
||||
|
@ -134,7 +134,7 @@ handle_deploy (XdgAppSystemHelper *object,
|
|||
if (is_update)
|
||||
{
|
||||
/* TODO: This doesn't support a custom subpath */
|
||||
if (!xdg_app_dir_deploy_update (system, arg_ref,
|
||||
if (!flatpak_dir_deploy_update (system, arg_ref,
|
||||
NULL,
|
||||
NULL, &error))
|
||||
{
|
||||
|
@ -145,7 +145,7 @@ handle_deploy (XdgAppSystemHelper *object,
|
|||
}
|
||||
else
|
||||
{
|
||||
if (!xdg_app_dir_deploy_install (system, arg_ref, arg_origin,
|
||||
if (!flatpak_dir_deploy_install (system, arg_ref, arg_origin,
|
||||
(char **) arg_subpaths,
|
||||
NULL, &error))
|
||||
{
|
||||
|
@ -162,7 +162,7 @@ handle_deploy (XdgAppSystemHelper *object,
|
|||
|
||||
|
||||
static gboolean
|
||||
xdg_app_authorize_method_handler (GDBusInterfaceSkeleton *interface,
|
||||
flatpak_authorize_method_handler (GDBusInterfaceSkeleton *interface,
|
||||
GDBusMethodInvocation *invocation,
|
||||
gpointer user_data)
|
||||
{
|
||||
|
@ -196,22 +196,22 @@ xdg_app_authorize_method_handler (GDBusInterfaceSkeleton *interface,
|
|||
g_variant_get_child (parameters, 2, "&s", &ref);
|
||||
g_variant_get_child (parameters, 3, "&s", &origin);
|
||||
|
||||
is_update = (flags & XDG_APP_HELPER_DEPLOY_FLAGS_UPDATE) != 0;
|
||||
is_update = (flags & FLATPAK_HELPER_DEPLOY_FLAGS_UPDATE) != 0;
|
||||
is_app = g_str_has_prefix (ref, "app/");
|
||||
|
||||
if (is_update)
|
||||
{
|
||||
if (is_app)
|
||||
action = "org.freedesktop.XdgApp.app-update";
|
||||
action = "org.freedesktop.Flatpak.app-update";
|
||||
else
|
||||
action = "org.freedesktop.XdgApp.runtime-update";
|
||||
action = "org.freedesktop.Flatpak.runtime-update";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (is_app)
|
||||
action = "org.freedesktop.XdgApp.app-install";
|
||||
action = "org.freedesktop.Flatpak.app-install";
|
||||
else
|
||||
action = "org.freedesktop.XdgApp.runtime-install";
|
||||
action = "org.freedesktop.Flatpak.runtime-install";
|
||||
}
|
||||
|
||||
details = polkit_details_new ();
|
||||
|
@ -260,12 +260,12 @@ on_bus_acquired (GDBusConnection *connection,
|
|||
g_signal_connect (helper, "handle-deploy", G_CALLBACK (handle_deploy), NULL);
|
||||
|
||||
g_signal_connect (helper, "g-authorize-method",
|
||||
G_CALLBACK (xdg_app_authorize_method_handler),
|
||||
G_CALLBACK (flatpak_authorize_method_handler),
|
||||
NULL);
|
||||
|
||||
if (!g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (helper),
|
||||
connection,
|
||||
"/org/freedesktop/XdgApp/SystemHelper",
|
||||
"/org/freedesktop/Flatpak/SystemHelper",
|
||||
&error))
|
||||
{
|
||||
g_warning ("error: %s\n", error->message);
|
||||
|
@ -311,7 +311,7 @@ main (int argc,
|
|||
}
|
||||
|
||||
owner_id = g_bus_own_name (G_BUS_TYPE_SYSTEM,
|
||||
"org.freedesktop.XdgApp.SystemHelper",
|
||||
"org.freedesktop.Flatpak.SystemHelper",
|
||||
G_BUS_NAME_OWNER_FLAGS_NONE,
|
||||
on_bus_acquired,
|
||||
on_name_acquired,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
TESTS_ENVIRONMENT += OT_TESTS_DEBUG=1 \
|
||||
XDG_APP_TRIGGERSDIR=$$(cd $(top_srcdir) && pwd)/triggers \
|
||||
XDG_APP_BWRAP=$$(cd $(top_builddir) && pwd)/bwrap \
|
||||
XDG_APP_DBUSPROXY=$$(cd $(top_builddir) && pwd)/xdg-dbus-proxy \
|
||||
FLATPAK_TRIGGERSDIR=$$(cd $(top_srcdir) && pwd)/triggers \
|
||||
FLATPAK_BWRAP=$$(cd $(top_builddir) && pwd)/bwrap \
|
||||
FLATPAK_DBUSPROXY=$$(cd $(top_builddir) && pwd)/xdg-dbus-proxy \
|
||||
GI_TYPELIB_PATH=$$(cd $(top_builddir) && pwd) \
|
||||
LD_LIBRARY_PATH=$$(cd $(top_builddir)/.libs && pwd) \
|
||||
PATH=$$(cd $(top_builddir) && pwd):$${PATH} \
|
||||
|
|
|
@ -26,7 +26,7 @@ echo "1..3"
|
|||
${XDG_APP} --version > version_out
|
||||
|
||||
VERSION=`cat $(dirname $0)/package_version.txt`
|
||||
assert_file_has_content version_out "^xdg-app $VERSION$"
|
||||
assert_file_has_content version_out "^flatpak $VERSION$"
|
||||
|
||||
echo "ok version"
|
||||
|
||||
|
|
194
tests/testdb.c
194
tests/testdb.c
|
@ -5,144 +5,144 @@
|
|||
|
||||
/*
|
||||
static void
|
||||
dump_db (XdgAppDb *db)
|
||||
dump_db (FlatpakDb *db)
|
||||
{
|
||||
g_autofree char *s = xdg_app_db_print (db);
|
||||
g_autofree char *s = flatpak_db_print (db);
|
||||
g_printerr ("\n%s\n", s);
|
||||
}
|
||||
*/
|
||||
|
||||
static XdgAppDb *
|
||||
static FlatpakDb *
|
||||
create_test_db (gboolean serialized)
|
||||
{
|
||||
XdgAppDb *db;
|
||||
FlatpakDb *db;
|
||||
|
||||
g_autoptr(XdgAppDbEntry) entry1 = NULL;
|
||||
g_autoptr(XdgAppDbEntry) entry2 = NULL;
|
||||
g_autoptr(XdgAppDbEntry) entry3 = NULL;
|
||||
g_autoptr(XdgAppDbEntry) entry4 = NULL;
|
||||
g_autoptr(XdgAppDbEntry) entry5 = NULL;
|
||||
g_autoptr(XdgAppDbEntry) entry6 = NULL;
|
||||
g_autoptr(XdgAppDbEntry) entry7 = NULL;
|
||||
g_autoptr(FlatpakDbEntry) entry1 = NULL;
|
||||
g_autoptr(FlatpakDbEntry) entry2 = NULL;
|
||||
g_autoptr(FlatpakDbEntry) entry3 = NULL;
|
||||
g_autoptr(FlatpakDbEntry) entry4 = NULL;
|
||||
g_autoptr(FlatpakDbEntry) entry5 = NULL;
|
||||
g_autoptr(FlatpakDbEntry) entry6 = NULL;
|
||||
g_autoptr(FlatpakDbEntry) entry7 = NULL;
|
||||
GError *error = NULL;
|
||||
const char *permissions1[] = { "read", "write", NULL };
|
||||
const char *permissions2[] = { "read", NULL };
|
||||
const char *permissions3[] = { "write", NULL };
|
||||
|
||||
db = xdg_app_db_new (NULL, FALSE, &error);
|
||||
db = flatpak_db_new (NULL, FALSE, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (db != NULL);
|
||||
|
||||
{
|
||||
g_auto(GStrv) ids = xdg_app_db_list_ids (db);
|
||||
g_auto(GStrv) ids = flatpak_db_list_ids (db);
|
||||
g_assert (ids != NULL);
|
||||
g_assert (ids[0] == NULL);
|
||||
}
|
||||
|
||||
{
|
||||
g_auto(GStrv) apps = xdg_app_db_list_apps (db);
|
||||
g_auto(GStrv) apps = flatpak_db_list_apps (db);
|
||||
g_assert (apps != NULL);
|
||||
g_assert (apps[0] == NULL);
|
||||
}
|
||||
|
||||
entry1 = xdg_app_db_entry_new (g_variant_new_string ("foo-data"));
|
||||
entry2 = xdg_app_db_entry_set_app_permissions (entry1, "org.test.bapp", permissions2);
|
||||
entry3 = xdg_app_db_entry_set_app_permissions (entry2, "org.test.app", permissions1);
|
||||
entry4 = xdg_app_db_entry_set_app_permissions (entry3, "org.test.capp", permissions1);
|
||||
entry1 = flatpak_db_entry_new (g_variant_new_string ("foo-data"));
|
||||
entry2 = flatpak_db_entry_set_app_permissions (entry1, "org.test.bapp", permissions2);
|
||||
entry3 = flatpak_db_entry_set_app_permissions (entry2, "org.test.app", permissions1);
|
||||
entry4 = flatpak_db_entry_set_app_permissions (entry3, "org.test.capp", permissions1);
|
||||
|
||||
xdg_app_db_set_entry (db, "foo", entry4);
|
||||
flatpak_db_set_entry (db, "foo", entry4);
|
||||
|
||||
entry5 = xdg_app_db_entry_new (g_variant_new_string ("bar-data"));
|
||||
entry6 = xdg_app_db_entry_set_app_permissions (entry5, "org.test.app", permissions2);
|
||||
entry7 = xdg_app_db_entry_set_app_permissions (entry6, "org.test.dapp", permissions3);
|
||||
entry5 = flatpak_db_entry_new (g_variant_new_string ("bar-data"));
|
||||
entry6 = flatpak_db_entry_set_app_permissions (entry5, "org.test.app", permissions2);
|
||||
entry7 = flatpak_db_entry_set_app_permissions (entry6, "org.test.dapp", permissions3);
|
||||
|
||||
xdg_app_db_set_entry (db, "bar", entry7);
|
||||
flatpak_db_set_entry (db, "bar", entry7);
|
||||
|
||||
if (serialized)
|
||||
xdg_app_db_update (db);
|
||||
flatpak_db_update (db);
|
||||
|
||||
return db;
|
||||
}
|
||||
|
||||
static void
|
||||
verify_test_db (XdgAppDb *db)
|
||||
verify_test_db (FlatpakDb *db)
|
||||
{
|
||||
g_auto(GStrv) ids;
|
||||
g_autofree const char **apps1 = NULL;
|
||||
g_autofree const char **apps2 = NULL;
|
||||
g_auto(GStrv) all_apps = NULL;
|
||||
|
||||
ids = xdg_app_db_list_ids (db);
|
||||
ids = flatpak_db_list_ids (db);
|
||||
g_assert (g_strv_length (ids) == 2);
|
||||
g_assert (g_strv_contains ((const char **) ids, "foo"));
|
||||
g_assert (g_strv_contains ((const char **) ids, "bar"));
|
||||
|
||||
{
|
||||
g_autoptr(XdgAppDbEntry) entry = NULL;
|
||||
g_autoptr(FlatpakDbEntry) entry = NULL;
|
||||
g_autofree const char **permissions1 = NULL;
|
||||
g_autofree const char **permissions2 = NULL;
|
||||
g_autofree const char **permissions3 = NULL;
|
||||
g_autofree const char **permissions4 = NULL;
|
||||
g_autoptr(GVariant) data1 = NULL;
|
||||
|
||||
entry = xdg_app_db_lookup (db, "foo");
|
||||
entry = flatpak_db_lookup (db, "foo");
|
||||
g_assert (entry != NULL);
|
||||
data1 = xdg_app_db_entry_get_data (entry);
|
||||
data1 = flatpak_db_entry_get_data (entry);
|
||||
g_assert (data1 != NULL);
|
||||
g_assert_cmpstr (g_variant_get_type_string (data1), ==, "s");
|
||||
g_assert_cmpstr (g_variant_get_string (data1, NULL), ==, "foo-data");
|
||||
apps1 = xdg_app_db_entry_list_apps (entry);
|
||||
apps1 = flatpak_db_entry_list_apps (entry);
|
||||
g_assert (g_strv_length ((char **) apps1) == 3);
|
||||
g_assert (g_strv_contains (apps1, "org.test.app"));
|
||||
g_assert (g_strv_contains (apps1, "org.test.bapp"));
|
||||
g_assert (g_strv_contains (apps1, "org.test.capp"));
|
||||
permissions1 = xdg_app_db_entry_list_permissions (entry, "org.test.app");
|
||||
permissions1 = flatpak_db_entry_list_permissions (entry, "org.test.app");
|
||||
g_assert (g_strv_length ((char **) permissions1) == 2);
|
||||
g_assert (g_strv_contains (permissions1, "read"));
|
||||
g_assert (g_strv_contains (permissions1, "write"));
|
||||
permissions2 = xdg_app_db_entry_list_permissions (entry, "org.test.bapp");
|
||||
permissions2 = flatpak_db_entry_list_permissions (entry, "org.test.bapp");
|
||||
g_assert (g_strv_length ((char **) permissions2) == 1);
|
||||
g_assert (g_strv_contains (permissions2, "read"));
|
||||
permissions3 = xdg_app_db_entry_list_permissions (entry, "org.test.capp");
|
||||
permissions3 = flatpak_db_entry_list_permissions (entry, "org.test.capp");
|
||||
g_assert (g_strv_length ((char **) permissions3) == 2);
|
||||
g_assert (g_strv_contains (permissions3, "read"));
|
||||
g_assert (g_strv_contains (permissions3, "write"));
|
||||
permissions4 = xdg_app_db_entry_list_permissions (entry, "org.test.noapp");
|
||||
permissions4 = flatpak_db_entry_list_permissions (entry, "org.test.noapp");
|
||||
g_assert (permissions4 != NULL);
|
||||
g_assert (g_strv_length ((char **) permissions4) == 0);
|
||||
}
|
||||
|
||||
{
|
||||
g_autoptr(XdgAppDbEntry) entry = NULL;
|
||||
g_autoptr(FlatpakDbEntry) entry = NULL;
|
||||
g_autofree const char **permissions5 = NULL;
|
||||
g_autofree const char **permissions6 = NULL;
|
||||
g_autoptr(GVariant) data2 = NULL;
|
||||
|
||||
entry = xdg_app_db_lookup (db, "bar");
|
||||
entry = flatpak_db_lookup (db, "bar");
|
||||
g_assert (entry != NULL);
|
||||
data2 = xdg_app_db_entry_get_data (entry);
|
||||
data2 = flatpak_db_entry_get_data (entry);
|
||||
g_assert (data2 != NULL);
|
||||
g_assert_cmpstr (g_variant_get_type_string (data2), ==, "s");
|
||||
g_assert_cmpstr (g_variant_get_string (data2, NULL), ==, "bar-data");
|
||||
apps2 = xdg_app_db_entry_list_apps (entry);
|
||||
apps2 = flatpak_db_entry_list_apps (entry);
|
||||
g_assert (g_strv_length ((char **) apps2) == 2);
|
||||
g_assert (g_strv_contains (apps2, "org.test.app"));
|
||||
g_assert (g_strv_contains (apps2, "org.test.dapp"));
|
||||
permissions5 = xdg_app_db_entry_list_permissions (entry, "org.test.app");
|
||||
permissions5 = flatpak_db_entry_list_permissions (entry, "org.test.app");
|
||||
g_assert (g_strv_length ((char **) permissions5) == 1);
|
||||
g_assert (g_strv_contains (permissions5, "read"));
|
||||
permissions6 = xdg_app_db_entry_list_permissions (entry, "org.test.dapp");
|
||||
permissions6 = flatpak_db_entry_list_permissions (entry, "org.test.dapp");
|
||||
g_assert (g_strv_length ((char **) permissions6) == 1);
|
||||
g_assert (g_strv_contains (permissions6, "write"));
|
||||
}
|
||||
|
||||
{
|
||||
g_autoptr(XdgAppDbEntry) entry = NULL;
|
||||
entry = xdg_app_db_lookup (db, "gazonk");
|
||||
g_autoptr(FlatpakDbEntry) entry = NULL;
|
||||
entry = flatpak_db_lookup (db, "gazonk");
|
||||
g_assert (entry == NULL);
|
||||
}
|
||||
|
||||
all_apps = xdg_app_db_list_apps (db);
|
||||
all_apps = flatpak_db_list_apps (db);
|
||||
g_assert (g_strv_length (all_apps) == 4);
|
||||
g_assert (g_strv_contains ((const char **) all_apps, "org.test.app"));
|
||||
g_assert (g_strv_contains ((const char **) all_apps, "org.test.bapp"));
|
||||
|
@ -154,20 +154,20 @@ static void
|
|||
test_db_open (void)
|
||||
{
|
||||
GError *error = NULL;
|
||||
XdgAppDb *db;
|
||||
FlatpakDb *db;
|
||||
|
||||
db = xdg_app_db_new (DB_DIR "/does_not_exist", TRUE, &error);
|
||||
db = flatpak_db_new (DB_DIR "/does_not_exist", TRUE, &error);
|
||||
g_assert_error (error, G_FILE_ERROR, G_FILE_ERROR_NOENT);
|
||||
g_assert (db == NULL);
|
||||
g_clear_error (&error);
|
||||
|
||||
db = xdg_app_db_new (DB_DIR "/does_not_exist", FALSE, &error);
|
||||
db = flatpak_db_new (DB_DIR "/does_not_exist", FALSE, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (db != NULL);
|
||||
g_clear_error (&error);
|
||||
g_object_unref (db);
|
||||
|
||||
db = xdg_app_db_new (DB_DIR "/no_tables", TRUE, &error);
|
||||
db = flatpak_db_new (DB_DIR "/no_tables", TRUE, &error);
|
||||
g_assert_error (error, G_FILE_ERROR, G_FILE_ERROR_INVAL);
|
||||
g_assert (db == NULL);
|
||||
g_clear_error (&error);
|
||||
|
@ -176,8 +176,8 @@ test_db_open (void)
|
|||
static void
|
||||
test_serialize (void)
|
||||
{
|
||||
g_autoptr(XdgAppDb) db = NULL;
|
||||
g_autoptr(XdgAppDb) db2 = NULL;
|
||||
g_autoptr(FlatpakDb) db = NULL;
|
||||
g_autoptr(FlatpakDb) db2 = NULL;
|
||||
g_autofree char *dump1 = NULL;
|
||||
g_autofree char *dump2 = NULL;
|
||||
g_autofree char *dump3 = NULL;
|
||||
|
@ -189,33 +189,33 @@ test_serialize (void)
|
|||
|
||||
verify_test_db (db);
|
||||
|
||||
dump1 = xdg_app_db_print (db);
|
||||
dump1 = flatpak_db_print (db);
|
||||
|
||||
g_assert (xdg_app_db_is_dirty (db));
|
||||
g_assert (flatpak_db_is_dirty (db));
|
||||
|
||||
xdg_app_db_update (db);
|
||||
flatpak_db_update (db);
|
||||
|
||||
verify_test_db (db);
|
||||
|
||||
g_assert (!xdg_app_db_is_dirty (db));
|
||||
g_assert (!flatpak_db_is_dirty (db));
|
||||
|
||||
dump2 = xdg_app_db_print (db);
|
||||
dump2 = flatpak_db_print (db);
|
||||
|
||||
g_assert_cmpstr (dump1, ==, dump2);
|
||||
|
||||
fd = g_mkstemp (tmpfile);
|
||||
close (fd);
|
||||
|
||||
xdg_app_db_set_path (db, tmpfile);
|
||||
flatpak_db_set_path (db, tmpfile);
|
||||
|
||||
xdg_app_db_save_content (db, &error);
|
||||
flatpak_db_save_content (db, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
db2 = xdg_app_db_new (tmpfile, TRUE, &error);
|
||||
db2 = flatpak_db_new (tmpfile, TRUE, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (db2 != NULL);
|
||||
|
||||
dump3 = xdg_app_db_print (db2);
|
||||
dump3 = flatpak_db_print (db2);
|
||||
|
||||
g_assert_cmpstr (dump1, ==, dump3);
|
||||
|
||||
|
@ -225,7 +225,7 @@ test_serialize (void)
|
|||
static void
|
||||
test_modify (void)
|
||||
{
|
||||
g_autoptr(XdgAppDb) db = NULL;
|
||||
g_autoptr(FlatpakDb) db = NULL;
|
||||
const char *permissions[] = { "read", "write", "execute", NULL };
|
||||
const char *no_permissions[] = { NULL };
|
||||
|
||||
|
@ -233,68 +233,68 @@ test_modify (void)
|
|||
|
||||
/* Add permission */
|
||||
{
|
||||
g_autoptr(XdgAppDbEntry) entry1 = NULL;
|
||||
g_autoptr(XdgAppDbEntry) entry2 = NULL;
|
||||
g_autoptr(FlatpakDbEntry) entry1 = NULL;
|
||||
g_autoptr(FlatpakDbEntry) entry2 = NULL;
|
||||
|
||||
entry1 = xdg_app_db_lookup (db, "foo");
|
||||
entry2 = xdg_app_db_entry_set_app_permissions (entry1, "org.test.app", permissions);
|
||||
xdg_app_db_set_entry (db, "foo", entry2);
|
||||
entry1 = flatpak_db_lookup (db, "foo");
|
||||
entry2 = flatpak_db_entry_set_app_permissions (entry1, "org.test.app", permissions);
|
||||
flatpak_db_set_entry (db, "foo", entry2);
|
||||
}
|
||||
|
||||
/* Add entry */
|
||||
{
|
||||
g_autoptr(XdgAppDbEntry) entry1 = NULL;
|
||||
g_autoptr(XdgAppDbEntry) entry2 = NULL;
|
||||
g_autoptr(FlatpakDbEntry) entry1 = NULL;
|
||||
g_autoptr(FlatpakDbEntry) entry2 = NULL;
|
||||
|
||||
entry1 = xdg_app_db_entry_new (g_variant_new_string ("gazonk-data"));
|
||||
entry2 = xdg_app_db_entry_set_app_permissions (entry1, "org.test.eapp", permissions);
|
||||
xdg_app_db_set_entry (db, "gazonk", entry2);
|
||||
entry1 = flatpak_db_entry_new (g_variant_new_string ("gazonk-data"));
|
||||
entry2 = flatpak_db_entry_set_app_permissions (entry1, "org.test.eapp", permissions);
|
||||
flatpak_db_set_entry (db, "gazonk", entry2);
|
||||
}
|
||||
|
||||
/* Remove permission */
|
||||
{
|
||||
g_autoptr(XdgAppDbEntry) entry1 = NULL;
|
||||
g_autoptr(XdgAppDbEntry) entry2 = NULL;
|
||||
g_autoptr(FlatpakDbEntry) entry1 = NULL;
|
||||
g_autoptr(FlatpakDbEntry) entry2 = NULL;
|
||||
|
||||
entry1 = xdg_app_db_lookup (db, "bar");
|
||||
entry2 = xdg_app_db_entry_set_app_permissions (entry1, "org.test.dapp", no_permissions);
|
||||
xdg_app_db_set_entry (db, "bar", entry2);
|
||||
entry1 = flatpak_db_lookup (db, "bar");
|
||||
entry2 = flatpak_db_entry_set_app_permissions (entry1, "org.test.dapp", no_permissions);
|
||||
flatpak_db_set_entry (db, "bar", entry2);
|
||||
}
|
||||
|
||||
/* Verify */
|
||||
{
|
||||
g_autoptr(XdgAppDbEntry) entry5 = NULL;
|
||||
g_autoptr(XdgAppDbEntry) entry6 = NULL;
|
||||
g_autoptr(XdgAppDbEntry) entry7 = NULL;
|
||||
g_autoptr(FlatpakDbEntry) entry5 = NULL;
|
||||
g_autoptr(FlatpakDbEntry) entry6 = NULL;
|
||||
g_autoptr(FlatpakDbEntry) entry7 = NULL;
|
||||
g_autofree const char **apps2 = NULL;
|
||||
g_auto(GStrv) apps3 = NULL;
|
||||
g_autofree const char **permissions1 = NULL;
|
||||
g_autofree const char **permissions2 = NULL;
|
||||
g_autofree const char **permissions3 = NULL;
|
||||
|
||||
entry5 = xdg_app_db_lookup (db, "foo");
|
||||
permissions1 = xdg_app_db_entry_list_permissions (entry5, "org.test.app");
|
||||
entry5 = flatpak_db_lookup (db, "foo");
|
||||
permissions1 = flatpak_db_entry_list_permissions (entry5, "org.test.app");
|
||||
g_assert (g_strv_length ((char **) permissions1) == 3);
|
||||
g_assert (g_strv_contains (permissions1, "read"));
|
||||
g_assert (g_strv_contains (permissions1, "write"));
|
||||
g_assert (g_strv_contains (permissions1, "execute"));
|
||||
|
||||
entry6 = xdg_app_db_lookup (db, "bar");
|
||||
permissions2 = xdg_app_db_entry_list_permissions (entry6, "org.test.dapp");
|
||||
entry6 = flatpak_db_lookup (db, "bar");
|
||||
permissions2 = flatpak_db_entry_list_permissions (entry6, "org.test.dapp");
|
||||
g_assert (g_strv_length ((char **) permissions2) == 0);
|
||||
|
||||
entry7 = xdg_app_db_lookup (db, "gazonk");
|
||||
permissions3 = xdg_app_db_entry_list_permissions (entry7, "org.test.eapp");
|
||||
entry7 = flatpak_db_lookup (db, "gazonk");
|
||||
permissions3 = flatpak_db_entry_list_permissions (entry7, "org.test.eapp");
|
||||
g_assert (g_strv_length ((char **) permissions3) == 3);
|
||||
g_assert (g_strv_contains (permissions3, "read"));
|
||||
g_assert (g_strv_contains (permissions3, "write"));
|
||||
g_assert (g_strv_contains (permissions3, "execute"));
|
||||
|
||||
apps2 = xdg_app_db_entry_list_apps (entry6);
|
||||
apps2 = flatpak_db_entry_list_apps (entry6);
|
||||
g_assert_cmpint (g_strv_length ((char **) apps2), ==, 1);
|
||||
g_assert (g_strv_contains (apps2, "org.test.app"));
|
||||
|
||||
apps3 = xdg_app_db_list_apps (db);
|
||||
apps3 = flatpak_db_list_apps (db);
|
||||
g_assert_cmpint (g_strv_length (apps3), ==, 4);
|
||||
g_assert (g_strv_contains ((const char **) apps3, "org.test.app"));
|
||||
g_assert (g_strv_contains ((const char **) apps3, "org.test.bapp"));
|
||||
|
@ -302,42 +302,42 @@ test_modify (void)
|
|||
g_assert (g_strv_contains ((const char **) apps3, "org.test.eapp"));
|
||||
}
|
||||
|
||||
xdg_app_db_update (db);
|
||||
flatpak_db_update (db);
|
||||
|
||||
/* Verify after serialize */
|
||||
{
|
||||
g_autoptr(XdgAppDbEntry) entry5 = NULL;
|
||||
g_autoptr(XdgAppDbEntry) entry6 = NULL;
|
||||
g_autoptr(XdgAppDbEntry) entry7 = NULL;
|
||||
g_autoptr(FlatpakDbEntry) entry5 = NULL;
|
||||
g_autoptr(FlatpakDbEntry) entry6 = NULL;
|
||||
g_autoptr(FlatpakDbEntry) entry7 = NULL;
|
||||
g_autofree const char **apps2 = NULL;
|
||||
g_auto(GStrv) apps3 = NULL;
|
||||
g_autofree const char **permissions1 = NULL;
|
||||
g_autofree const char **permissions2 = NULL;
|
||||
g_autofree const char **permissions3 = NULL;
|
||||
|
||||
entry5 = xdg_app_db_lookup (db, "foo");
|
||||
permissions1 = xdg_app_db_entry_list_permissions (entry5, "org.test.app");
|
||||
entry5 = flatpak_db_lookup (db, "foo");
|
||||
permissions1 = flatpak_db_entry_list_permissions (entry5, "org.test.app");
|
||||
g_assert (g_strv_length ((char **) permissions1) == 3);
|
||||
g_assert (g_strv_contains (permissions1, "read"));
|
||||
g_assert (g_strv_contains (permissions1, "write"));
|
||||
g_assert (g_strv_contains (permissions1, "execute"));
|
||||
|
||||
entry6 = xdg_app_db_lookup (db, "bar");
|
||||
permissions2 = xdg_app_db_entry_list_permissions (entry6, "org.test.dapp");
|
||||
entry6 = flatpak_db_lookup (db, "bar");
|
||||
permissions2 = flatpak_db_entry_list_permissions (entry6, "org.test.dapp");
|
||||
g_assert (g_strv_length ((char **) permissions2) == 0);
|
||||
|
||||
entry7 = xdg_app_db_lookup (db, "gazonk");
|
||||
permissions3 = xdg_app_db_entry_list_permissions (entry7, "org.test.eapp");
|
||||
entry7 = flatpak_db_lookup (db, "gazonk");
|
||||
permissions3 = flatpak_db_entry_list_permissions (entry7, "org.test.eapp");
|
||||
g_assert (g_strv_length ((char **) permissions3) == 3);
|
||||
g_assert (g_strv_contains (permissions3, "read"));
|
||||
g_assert (g_strv_contains (permissions3, "write"));
|
||||
g_assert (g_strv_contains (permissions3, "execute"));
|
||||
|
||||
apps2 = xdg_app_db_entry_list_apps (entry6);
|
||||
apps2 = flatpak_db_entry_list_apps (entry6);
|
||||
g_assert_cmpint (g_strv_length ((char **) apps2), ==, 1);
|
||||
g_assert (g_strv_contains (apps2, "org.test.app"));
|
||||
|
||||
apps3 = xdg_app_db_list_apps (db);
|
||||
apps3 = flatpak_db_list_apps (db);
|
||||
g_assert_cmpint (g_strv_length (apps3), ==, 4);
|
||||
g_assert (g_strv_contains ((const char **) apps3, "org.test.app"));
|
||||
g_assert (g_strv_contains ((const char **) apps3, "org.test.bapp"));
|
||||
|
|
Loading…
Reference in New Issue