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 677532 - Drop libgnomekbd dependency
Drop libgnomekbd dependency
Status: RESOLVED FIXED
Product: gnome-boxes
Classification: Applications
Component: general
3.5.x (unsupported)
Other Linux
: Normal normal
: --
Assigned To: GNOME Boxes maintainer(s)
GNOME Boxes maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2012-06-06 07:29 UTC by Andreas Proschofsky
Modified: 2016-03-31 14:01 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Use the new schemas for detecting the keyboard layout (1.89 KB, patch)
2012-08-17 13:08 UTC, Alexander Larsson
committed Details | Review
Use the new schemas for detecting the keyboard layout (2.06 KB, patch)
2012-08-17 13:38 UTC, Alexander Larsson
committed Details | Review
Use the new schemas for detecting the keyboard layout (2.17 KB, patch)
2012-08-17 13:45 UTC, Alexander Larsson
committed Details | Review

Description Andreas Proschofsky 2012-06-06 07:29:23 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.
Comment 2 Zeeshan Ali 2012-06-06 13:25:30 UTC
(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.
Comment 3 Christophe Fergeau 2012-06-08 11:31:57 UTC
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;
Comment 4 Christophe Fergeau 2012-06-08 11:32:19 UTC
NB: it's *not* a working patch, and not really meant for a review
Comment 5 Alexander Larsson 2012-08-17 13:08:25 UTC
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.
Comment 6 Christophe Fergeau 2012-08-17 13:29:14 UTC
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.
Comment 7 Alexander Larsson 2012-08-17 13:38:31 UTC
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.
Comment 8 Alexander Larsson 2012-08-17 13:45:07 UTC
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.
Comment 9 Christophe Fergeau 2012-08-17 13:45:55 UTC
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?
Comment 10 Alexander Larsson 2012-08-17 13:52:06 UTC
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
Comment 11 Alexander Larsson 2012-08-17 13:53:12 UTC
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