[gnome-boxes] Use the new schemas for detecting the keyboard layout
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes] Use the new schemas for detecting the keyboard layout
- Date: Fri, 17 Aug 2012 13:53:07 +0000 (UTC)
commit 4fc27d53a4197613b87083dc42861120bea6b11b
Author: Alexander Larsson <alexl redhat com>
Date: Fri Aug 17 15:06:01 2012 +0200
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.
https://bugzilla.gnome.org/show_bug.cgi?id=677532
src/fedora-installer.vala | 27 +++++++++++++++++++++------
1 files changed, 21 insertions(+), 6 deletions(-)
---
diff --git a/src/fedora-installer.vala b/src/fedora-installer.vala
index 56b3b67..fa22e30 100644
--- a/src/fedora-installer.vala
+++ b/src/fedora-installer.vala
@@ -145,16 +145,31 @@ 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 == "") {
+ string method = null;
+ string layout_str = null;
+
+ // Don't crash if the schema is not installed
+ var schemas = GLib.Settings.list_schemas ();
+ foreach (var s in schemas) {
+ if (s == "org.gnome.desktop.input-sources") {
+ var settings = new GLib.Settings (s);
+ Variant sources = settings.get_value ("sources");
+ uint current = settings.get_uint ("current");
+ if (current > sources.n_children ())
+ current = 0;
+
+ if (sources.n_children () > 0)
+ sources.get_child (current, "(ss)", out method, out layout_str);
+ break;
+ }
+ }
+
+ if (method != "xkb" || layout_str == null) {
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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]