Commit 493b8ca0 authored by Philip Withnall's avatar Philip Withnall

Merge branch 'keyfile-portal-fixes' into 'master'

Keyfile portal fixes

See merge request !985
parents 003b6dac addb8c15
Pipeline #95481 passed with stages
in 21 minutes and 59 seconds
......@@ -80,7 +80,7 @@ typedef struct
#ifdef G_OS_WIN32
#define EXTENSION_PRIORITY 10
#else
#define EXTENSION_PRIORITY (glib_should_use_portal () ? 110 : 10)
#define EXTENSION_PRIORITY (glib_should_use_portal () && !glib_has_dconf_access_in_sandbox () ? 110 : 10)
#endif
G_DEFINE_TYPE_WITH_CODE (GKeyfileSettingsBackend,
......
......@@ -23,6 +23,7 @@
static gboolean flatpak_info_read;
static gboolean use_portal;
static gboolean network_available;
static gboolean dconf_access;
static void
read_flatpak_info (void)
......@@ -40,11 +41,13 @@ read_flatpak_info (void)
use_portal = TRUE;
network_available = FALSE;
dconf_access = FALSE;
keyfile = g_key_file_new ();
if (g_key_file_load_from_file (keyfile, path, G_KEY_FILE_NONE, NULL))
{
char **shared = NULL;
char *dconf_policy = NULL;
shared = g_key_file_get_string_list (keyfile, "Context", "shared", NULL, NULL);
if (shared)
......@@ -52,6 +55,14 @@ read_flatpak_info (void)
network_available = g_strv_contains ((const char * const *)shared, "network");
g_strfreev (shared);
}
dconf_policy = g_key_file_get_string (keyfile, "Session Bus Policy", "ca.desrt.dconf", NULL);
if (dconf_policy)
{
if (strcmp (dconf_policy, "talk") == 0)
dconf_access = TRUE;
g_free (dconf_policy);
}
}
g_key_file_unref (keyfile);
......@@ -64,6 +75,7 @@ read_flatpak_info (void)
if (var && var[0] == '1')
use_portal = TRUE;
network_available = TRUE;
dconf_access = TRUE;
}
}
......@@ -81,3 +93,9 @@ glib_network_available_in_sandbox (void)
return network_available;
}
gboolean
glib_has_dconf_access_in_sandbox (void)
{
read_flatpak_info ();
return dconf_access;
}
......@@ -24,6 +24,7 @@ G_BEGIN_DECLS
gboolean glib_should_use_portal (void);
gboolean glib_network_available_in_sandbox (void);
gboolean glib_has_dconf_access_in_sandbox (void);
G_END_DECLS
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment