Merge lp:~leonardolemos/wingpanel-indicator-keyboard/fix-1559189 into lp:~wingpanel-devs/wingpanel-indicator-keyboard/trunk

Proposed by Leonardo Lemos
Status: Merged
Approved by: David Hewitt
Approved revision: 69
Merged at revision: 69
Proposed branch: lp:~leonardolemos/wingpanel-indicator-keyboard/fix-1559189
Merge into: lp:~wingpanel-devs/wingpanel-indicator-keyboard/trunk
Diff against target: 41 lines (+17/-0)
1 file modified
src/Indicator.vala (+17/-0)
To merge this branch: bzr merge lp:~leonardolemos/wingpanel-indicator-keyboard/fix-1559189
Reviewer Review Type Date Requested Status
David Hewitt code, function Approve
Review via email: mp+319349@code.launchpad.net

Commit message

Add a method to show the current keyboard layout.

Description of the change

This branch introduces a method to open gkbd-keyboard-display and show the current layout map.

To post a comment you must log in.
Revision history for this message
David Hewitt (davidmhewitt) wrote :

It's possible to make this much simpler by using "layouts.get_current ()" in your show_keyboard_map method.

review: Needs Fixing
69. By Leonardo Lemos

Simplify show_keyboard_map method using alyouts.get_current ()

Revision history for this message
David Hewitt (davidmhewitt) wrote :

Looks good now.

review: Approve (code, function)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Indicator.vala'
2--- src/Indicator.vala 2016-09-26 03:08:28 +0000
3+++ src/Indicator.vala 2017-03-16 20:23:35 +0000
4@@ -53,6 +53,9 @@
5 var settings_button = new Wingpanel.Widgets.Button (_("Keyboard Settingsā€¦"));
6 settings_button.clicked.connect (show_settings);
7
8+ var map_button = new Wingpanel.Widgets.Button (_("Show keyboard map"));
9+ map_button.clicked.connect (show_keyboard_map);
10+
11 layouts.updated.connect (() => {
12 display_icon.label = layouts.get_current (true);
13 var new_visibility = layouts.has_layouts ();
14@@ -66,6 +69,7 @@
15 main_grid.add (layouts);
16 main_grid.add (separator);
17 main_grid.add (settings_button);
18+ main_grid.add (map_button);
19 main_grid.show_all ();
20 }
21
22@@ -89,6 +93,19 @@
23 warning ("%s\n", e.message);
24 }
25 }
26+
27+ private void show_keyboard_map () {
28+ close ();
29+
30+ string command = "gkbd-keyboard-display -l " + layouts.get_current ();
31+
32+ try {
33+ AppInfo.create_from_commandline (command, null, AppInfoCreateFlags.NONE).launch (null, null);
34+ }
35+ catch (Error e) {
36+ warning ("%s\n", e.message);
37+ }
38+ }
39 }
40
41 public Wingpanel.Indicator? get_indicator (Module module, Wingpanel.IndicatorManager.ServerType server_type) {

Subscribers

People subscribed via source and target branches

to all changes: