GNOME Bugzilla – Bug 677532
Drop libgnomekbd dependency
Last modified: 2016-03-31 14:01:41 UTC
Trying out gnome-boxes 3.5.2 gives me the following: GLib-GIO-ERROR **: Settings schema 'org.gnome.libgnomekbd.keyboard' is not installed So obviously gnome-boxes depends on libgnomekdb (but doesn't check for it in configure). This is relevant now because other parts of GNOME have all dropped libgnomekbd usage recently, see http://git.gnome.org/browse/gnome-settings-daemon/commit/?id=b6e011ad16311e2985aa523cf9bceef74168f95e for reference.
Ah thanks, this goes with http://git.gnome.org/browse/gsettings-desktop-schemas/commit/?id=453ba2abe1c135a2176ed899a7b22dfb80cace71
(In reply to comment #0) > Trying out gnome-boxes 3.5.2 gives me the following: > > GLib-GIO-ERROR **: Settings schema 'org.gnome.libgnomekbd.keyboard' is not > installed > > So obviously gnome-boxes depends on libgnomekdb (but doesn't check for it in > configure). Its a runtime dep and configure checks are for buildtime deps. >This is relevant now because other parts of GNOME have all dropped > libgnomekbd usage recently, see > > http://git.gnome.org/browse/gnome-settings-daemon/commit/?id=b6e011ad16311e2985aa523cf9bceef74168f95e > > for reference. Yeah, we should fix this before 3.6.
No 3.6 setup to test :-/ but here is a first draft of what this could look like: diff --git a/src/fedora-installer.vala b/src/fedora-installer.vala index ec7e015..dc40f6c 100644 --- a/src/fedora-installer.vala +++ b/src/fedora-installer.vala @@ -172,16 +172,24 @@ private class Boxes.FedoraInstaller: UnattendedInstaller { } private string fetch_console_kbd_layout () { - var settings = new GLib.Settings ("org.gnome.libgnomekbd.keyboard"); - var layouts = settings.get_strv ("layouts"); - var layout_str = layouts[0]; - if (layout_str == null || layout_str == "") { + var settings = new GLib.Settings ("org.gnome.desktop.input-sources"); + Variant sources = settings.get_value ("sources"); + uint current = settings.get_uint ("current"); + + if (current > sources.n_children ()) + current = 0; + + string method; + string layout_str; + sources.get_child (current, "(ss)", out method, out layout_str); + + if (method != "xkb" || layout_str == null || layout_str == "") { warning ("Failed to fetch prefered keyboard layout from user settings, falling back to 'us'.."); return "us"; } - var tokens = layout_str.split("\t"); + var tokens = layout_str.split("+"); var xkb_layout = tokens[0]; var xkb_variant = tokens[1]; var console_layout = (string) null;
NB: it's *not* a working patch, and not really meant for a review
Created attachment 221600 [details] [review] Use the new schemas for detecting the keyboard layout Gnome 3.6 is moving away from direct libgnomekbd use and instead has the keyboard setting integrated. We should follow suit.
Review of attachment 221600 [details] [review]: Looks good to me. org.gnome.desktop.input-source is defined in gsettings-desktop-schemas which is a dependency of gnome-boxes in jhbuild, so this shouldn't break testers running this code on 3.4. They will likely get a 'us' keyboard in such cases, but that's acceptable imo.
Created attachment 221604 [details] [review] Use the new schemas for detecting the keyboard layout Gnome 3.6 is moving away from direct libgnomekbd use and instead has the keyboard setting integrated. We should follow suit.
Created attachment 221606 [details] [review] Use the new schemas for detecting the keyboard layout Gnome 3.6 is moving away from direct libgnomekbd use and instead has the keyboard setting integrated. We should follow suit.
Review of attachment 221604 [details] [review]: Looks good to me too, I've got a slight preference for the initial version which is simpler, but I'm fine with either one going in. ::: src/fedora-installer.vala @@ +147,2 @@ private string fetch_console_kbd_layout () { + string method = null; Seems to be indented too much to the right @@ +153,3 @@ + foreach (var s in schemas) { + if (s == "org.gnome.desktop.input-sources") { + var settings = new GLib.Settings ("org.gnome.desktop.input-sources"); Maybe we could have a g_debug there to indicate that we have found the schema we're interested in? @@ +166,3 @@ + } + + if (method != "xkb" || layout_str == null) { Is vala ok with comparing a null string with "xkb" or should the || members be swapped?
Review of attachment 221604 [details] [review]: ::: src/fedora-installer.vala @@ +147,2 @@ private string fetch_console_kbd_layout () { + string method = null; Fixed in next patch @@ +166,3 @@ + } + + if (method != "xkb" || layout_str == null) { Yes, it uses g_strcmp0
Attachment 221600 [details] pushed as 4fc27d5 - Use the new schemas for detecting the keyboard layout Attachment 221604 [details] pushed as 4fc27d5 - Use the new schemas for detecting the keyboard layout Attachment 221606 [details] pushed as 4fc27d5 - Use the new schemas for detecting the keyboard layout