Imported Upstream version 2.60.6
authorHyunjee Kim <hj0426.kim@samsung.com>
Tue, 3 Dec 2019 01:53:23 +0000 (10:53 +0900)
committerHyunjee Kim <hj0426.kim@samsung.com>
Tue, 3 Dec 2019 01:53:23 +0000 (10:53 +0900)
NEWS
gio/gkeyfilesettingsbackend.c
gio/gportalsupport.c
gio/gportalsupport.h
meson.build

diff --git a/NEWS b/NEWS
index e5d72ea..7ab14c5 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,12 @@
+Overview of changes in GLib 2.60.6
+==================================
+
+* Fix various bugs with use of the `GKeyfileSettingsBackend` within flatpaks (!984, !985, #1825)
+
+* Bugs fixed:
+ - !993 Backport !984, !985 keyfile/portal fixes to glib-2-60
+
+
 Overview of changes in GLib 2.60.5
 ==================================
 
index 6ffb482..3d793f5 100644 (file)
@@ -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,
@@ -740,7 +740,8 @@ g_keyfile_settings_backend_set_property (GObject      *object,
     case PROP_FILENAME:
       /* Construct only. */
       g_assert (kfsb->file == NULL);
-      kfsb->file = g_file_new_for_path (g_value_get_string (value));
+      if (g_value_get_string (value))
+        kfsb->file = g_file_new_for_path (g_value_get_string (value));
       break;
 
     case PROP_ROOT_PATH:
index 2f1e825..b0a94b3 100644 (file)
@@ -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;
+}
index a331f45..746f1fd 100644 (file)
@@ -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
 
index d76d973..578b698 100644 (file)
@@ -1,5 +1,5 @@
 project('glib', 'c', 'cpp',
-  version : '2.60.5',
+  version : '2.60.6',
   meson_version : '>= 0.48.0',
   default_options : [
     'buildtype=debugoptimized',