After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 616307 - Says GSettings key is not writable
Says GSettings key is not writable
Status: RESOLVED FIXED
Product: GConf
Classification: Deprecated
Component: gconf
unspecified
Other Linux
: Normal normal
: ---
Assigned To: GConf Maintainers
GConf Maintainers
Depends on:
Blocks:
 
 
Reported: 2010-04-20 16:17 UTC by Bastien Nocera
Modified: 2010-04-23 22:58 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
does this patch work for you ? (556 bytes, patch)
2010-04-21 21:14 UTC, Matthias Clasen
none Details | Review
Fix key writability when key does not exist (1.32 KB, patch)
2010-04-22 09:49 UTC, Bastien Nocera
none Details | Review

Description Bastien Nocera 2010-04-20 16:17:58 UTC
The commit at:
http://git.gnome.org/browse/gnome-bluetooth/commit/?id=2e0a63705df026993f3741c491ce258876dca729

ports gnome-bluetooth to GSettings. I had to use the G_SETTINGS_BIND_NO_SENSITIVITY flag to g_settings_bind() because otherwise the widget was unsensitive.

Bug in my code, installation problem?
Comment 1 Matthias Clasen 2010-04-21 04:04:21 UTC
hmm, no idea, really. The gconf backend has:

static gboolean
gconf_settings_backend_get_writable (GSettingsBackend *backend,
                                     const gchar      *name)
{
  GConfSettingsBackend *gconf = GCONF_SETTINGS_BACKEND (backend);

  /* We don't support checking writabality for a whole subpath, so we just say
   * it's not writable in such a case. */
  if (name[strlen(name) - 1] == '/')
    return FALSE;

  return gconf_client_key_is_writable (gconf->priv->client, name, NULL);
}


Can you break in there and see what name is ?
Comment 2 Bastien Nocera 2010-04-21 09:50:41 UTC
It seems to work as expected now. I'll reopen if I can reproduce the problem.
Comment 3 Bastien Nocera 2010-04-21 19:43:22 UTC
Reopening.

This happens when the key does not have a schema in GConf. The key is detected as not writable because it doesn't exist.

You can see this when opening bluetooth-properties in gnome-bluetooth master for the first time.
Comment 4 Bastien Nocera 2010-04-21 19:49:27 UTC
$ GSETTINGS_BACKEND=gconf ./gsettings-tool --writable org.gnome.Bluetooth show-icon
false
$ ./gsettings-tool --writable org.gnome.Bluetooth show-icon
true
Comment 5 Bastien Nocera 2010-04-21 19:58:16 UTC
$ p name
$1 = (const gchar *) 0x608d20 "/apps/bluetooth-manager/show-icon"

In gconf_client_key_is_writable(), the entry doesn't exist:
1198	  g_return_val_if_fail (key != NULL, FALSE);
1199	  g_return_val_if_fail (err == NULL || *err == NULL, FALSE);
1200	
1201	  if (gconf_client_lookup (client, key, &entry))
1202	    {
1203	      if (!entry)
1204	        return FALSE;
So returns as not writable.
Comment 6 Matthias Clasen 2010-04-21 20:56:34 UTC
looks to me like that the last two lines need to be changed to

   if (!entry)
     return TRUE;
Comment 7 Matthias Clasen 2010-04-21 20:58:01 UTC
Ah, no, further down, we are also treating non-existing keys as non-writable.
Comment 8 Matthias Clasen 2010-04-21 21:14:30 UTC
Created attachment 159285 [details] [review]
does this patch work for you ?
Comment 9 Bastien Nocera 2010-04-22 09:49:33 UTC
Created attachment 159319 [details] [review]
Fix key writability when key does not exist

If a key does not exist, it should be marked as writable, otherwise
widget will end up unsensitive when g_settings_bind*() is used.
Comment 10 Bastien Nocera 2010-04-22 09:50:07 UTC
Comment on attachment 159285 [details] [review]
does this patch work for you ?

Missing the declaration for value.
Comment 11 Bastien Nocera 2010-04-22 10:02:38 UTC
Patch works for me.
Comment 12 Matthias Clasen 2010-04-23 22:58:27 UTC
I've committed this for 2.31.2