Users expect to have the layout they marked as the default one (by moving
it to the top of the list) activated for the installation. This patch
adds such activation.
Signed-off-by: Vratislav Podzimek <vpodzime(a)redhat.com>
---
pyanaconda/keyboard.py | 8 ++++++++
pyanaconda/ui/gui/spokes/keyboard.py | 16 ++++++++++++++--
2 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/pyanaconda/keyboard.py b/pyanaconda/keyboard.py
index b720dd5..4df52e5 100755
--- a/pyanaconda/keyboard.py
+++ b/pyanaconda/keyboard.py
@@ -459,6 +459,14 @@ class XklWrapper(object):
return groups_names[state.group]
+ def activate_default_layout(self):
+ """
+ Activates default layout (the first one in the list of configured layouts.
+
+ """
+
+ self._engine.lock_group(0)
+
def is_valid_layout(self, layout):
"""Return if given layout is valid layout or
not"""
diff --git a/pyanaconda/ui/gui/spokes/keyboard.py b/pyanaconda/ui/gui/spokes/keyboard.py
index 81d59e2..97d965f 100644
--- a/pyanaconda/ui/gui/spokes/keyboard.py
+++ b/pyanaconda/ui/gui/spokes/keyboard.py
@@ -433,14 +433,18 @@ class KeyboardSpoke(NormalSpoke):
return
(store, cur) = selection.get_selected()
- prev = cur.copy()
- prev = store.iter_previous(prev)
+ prev = store.iter_previous(cur)
if not prev:
return
store.swap(cur, prev)
if flags.can_touch_runtime_system("reorder runtime X layouts"):
self._flush_layouts_to_X()
+
+ if not store.iter_previous(cur):
+ #layout is first in the list (set as default), activate it
+ self._xkl_wrapper.activate_default_layout()
+
selection.emit("changed")
def on_down_clicked(self, button):
@@ -449,6 +453,10 @@ class KeyboardSpoke(NormalSpoke):
return
(store, cur) = selection.get_selected()
+
+ #if default layout (first in the list) changes we need to activate it
+ activate_default = not store.iter_previous(cur)
+
nxt = store.iter_next(cur)
if not nxt:
return
@@ -456,6 +464,10 @@ class KeyboardSpoke(NormalSpoke):
store.swap(cur, nxt)
if flags.can_touch_runtime_system("reorder runtime X layouts"):
self._flush_layouts_to_X()
+
+ if activate_default:
+ self._xkl_wrapper.activate_default_layout()
+
selection.emit("changed")
def on_preview_clicked(self, button):
--
1.7.11.7