diff options
-rw-r--r-- | deps/libgnomekbd.vapi | 6 | ||||
-rw-r--r-- | deps/libgnomekbd/libgnomekbd/Gkbd.Configuration.get_indicator_config.html | 2 | ||||
-rw-r--r-- | deps/libgnomekbd/libgnomekbd/Gkbd.Configuration.get_keyboard_config.html | 2 | ||||
-rw-r--r-- | deps/libgnomekbd/libgnomekbd/Gkbd.Configuration.html | 4 | ||||
-rw-r--r-- | deps/libgnomekbd/libgnomekbd/Gkbd.html | 2 | ||||
-rw-r--r-- | deps/libgnomekbd/libgnomekbd/Gkbd.preview_load_position.html | 2 | ||||
-rw-r--r-- | deps/libgnomekbd/libgnomekbd/index.htm | 2 | ||||
-rw-r--r-- | lib/main.vala | 49 |
8 files changed, 59 insertions, 10 deletions
diff --git a/deps/libgnomekbd.vapi b/deps/libgnomekbd.vapi index 0d5d2843..f555bdad 100644 --- a/deps/libgnomekbd.vapi +++ b/deps/libgnomekbd.vapi @@ -19,8 +19,8 @@ namespace Gkbd { [CCode (array_length = false, array_null_terminated = true)] public unowned string[] get_group_names (); public string get_image_filename (uint group); - public Gkbd.IndicatorConfig get_indicator_config (); - public Gkbd.KeyboardConfig get_keyboard_config (); + public unowned Gkbd.IndicatorConfig? get_indicator_config (); + public unowned Gkbd.KeyboardConfig? get_keyboard_config (); public bool get_num_lock_state (); public bool get_scroll_lock_state (); [CCode (array_length = false, array_null_terminated = true)] @@ -208,7 +208,7 @@ namespace Gkbd { [CCode (cheader_filename = "libgnomekbd/gkbd-util.h")] public static void install_glib_log_appender (); [CCode (cheader_filename = "libgnomekbd/gkbd-util.h")] - public static Gdk.Rectangle preview_load_position (); + public static Gdk.Rectangle? preview_load_position (); [CCode (cheader_filename = "libgnomekbd/gkbd-util.h")] public static void preview_save_position (Gdk.Rectangle rect); [CCode (array_length = false, array_null_terminated = true, cheader_filename = "libgnomekbd/gkbd-util.h")] diff --git a/deps/libgnomekbd/libgnomekbd/Gkbd.Configuration.get_indicator_config.html b/deps/libgnomekbd/libgnomekbd/Gkbd.Configuration.get_indicator_config.html index 871e6fb4..a2841e92 100644 --- a/deps/libgnomekbd/libgnomekbd/Gkbd.Configuration.get_indicator_config.html +++ b/deps/libgnomekbd/libgnomekbd/Gkbd.Configuration.get_indicator_config.html @@ -62,7 +62,7 @@ <h1 class="main_title">get_indicator_config</h1> <hr class="main_hr"/> <h2 class="main_title">Description:</h2> - <div class="main_code_definition"><span class="main_keyword">public</span> <span class="main_type"><a href="Gkbd.IndicatorConfig.html" class="struct">IndicatorConfig</a></span> <b><span css="method">get_indicator_config</span></b> () + <div class="main_code_definition"><span class="main_keyword">public</span> <span class="main_keyword">unowned</span> <span class="main_type"><a href="Gkbd.IndicatorConfig.html" class="struct">IndicatorConfig</a></span>? <b><span css="method">get_indicator_config</span></b> () </div> </div> </div><br/> diff --git a/deps/libgnomekbd/libgnomekbd/Gkbd.Configuration.get_keyboard_config.html b/deps/libgnomekbd/libgnomekbd/Gkbd.Configuration.get_keyboard_config.html index a2b78e93..cb108b21 100644 --- a/deps/libgnomekbd/libgnomekbd/Gkbd.Configuration.get_keyboard_config.html +++ b/deps/libgnomekbd/libgnomekbd/Gkbd.Configuration.get_keyboard_config.html @@ -62,7 +62,7 @@ <h1 class="main_title">get_keyboard_config</h1> <hr class="main_hr"/> <h2 class="main_title">Description:</h2> - <div class="main_code_definition"><span class="main_keyword">public</span> <span class="main_type"><a href="Gkbd.KeyboardConfig.html" class="struct">KeyboardConfig</a></span> <b><span css="method">get_keyboard_config</span></b> () + <div class="main_code_definition"><span class="main_keyword">public</span> <span class="main_keyword">unowned</span> <span class="main_type"><a href="Gkbd.KeyboardConfig.html" class="struct">KeyboardConfig</a></span>? <b><span css="method">get_keyboard_config</span></b> () </div> </div> </div><br/> diff --git a/deps/libgnomekbd/libgnomekbd/Gkbd.Configuration.html b/deps/libgnomekbd/libgnomekbd/Gkbd.Configuration.html index 58ecd346..7b92e9ad 100644 --- a/deps/libgnomekbd/libgnomekbd/Gkbd.Configuration.html +++ b/deps/libgnomekbd/libgnomekbd/Gkbd.Configuration.html @@ -134,11 +134,11 @@ </span> <div class="leaf_brief_description"> </div></li> - <li class="method"><span class="leaf_code_definition"><span class="main_keyword">public</span> <span class="main_type"><a href="Gkbd.IndicatorConfig.html" class="struct">IndicatorConfig</a></span> <b><a href="Gkbd.Configuration.get_indicator_config.html" class="method">get_indicator_config</a></b> () + <li class="method"><span class="leaf_code_definition"><span class="main_keyword">public</span> <span class="main_keyword">unowned</span> <span class="main_type"><a href="Gkbd.IndicatorConfig.html" class="struct">IndicatorConfig</a></span>? <b><a href="Gkbd.Configuration.get_indicator_config.html" class="method">get_indicator_config</a></b> () </span> <div class="leaf_brief_description"> </div></li> - <li class="method"><span class="leaf_code_definition"><span class="main_keyword">public</span> <span class="main_type"><a href="Gkbd.KeyboardConfig.html" class="struct">KeyboardConfig</a></span> <b><a href="Gkbd.Configuration.get_keyboard_config.html" class="method">get_keyboard_config</a></b> () + <li class="method"><span class="leaf_code_definition"><span class="main_keyword">public</span> <span class="main_keyword">unowned</span> <span class="main_type"><a href="Gkbd.KeyboardConfig.html" class="struct">KeyboardConfig</a></span>? <b><a href="Gkbd.Configuration.get_keyboard_config.html" class="method">get_keyboard_config</a></b> () </span> <div class="leaf_brief_description"> </div></li> diff --git a/deps/libgnomekbd/libgnomekbd/Gkbd.html b/deps/libgnomekbd/libgnomekbd/Gkbd.html index b91a8861..3842e7f4 100644 --- a/deps/libgnomekbd/libgnomekbd/Gkbd.html +++ b/deps/libgnomekbd/libgnomekbd/Gkbd.html @@ -96,7 +96,7 @@ </span> <div class="leaf_brief_description"> </div></li> - <li class="method"><span class="leaf_code_definition"><span class="main_keyword">public</span> <span class="main_type"><code>Rectangle</code></span> <b><a href="Gkbd.preview_load_position.html" class="method">preview_load_position</a></b> () + <li class="method"><span class="leaf_code_definition"><span class="main_keyword">public</span> <span class="main_type"><code>Rectangle</code></span>? <b><a href="Gkbd.preview_load_position.html" class="method">preview_load_position</a></b> () </span> <div class="leaf_brief_description"> </div></li> diff --git a/deps/libgnomekbd/libgnomekbd/Gkbd.preview_load_position.html b/deps/libgnomekbd/libgnomekbd/Gkbd.preview_load_position.html index 4f74dc30..1f5ea25a 100644 --- a/deps/libgnomekbd/libgnomekbd/Gkbd.preview_load_position.html +++ b/deps/libgnomekbd/libgnomekbd/Gkbd.preview_load_position.html @@ -51,7 +51,7 @@ <h1 class="main_title">preview_load_position</h1> <hr class="main_hr"/> <h2 class="main_title">Description:</h2> - <div class="main_code_definition"><span class="main_keyword">public</span> <span class="main_type"><code>Rectangle</code></span> <b><span css="method">preview_load_position</span></b> () + <div class="main_code_definition"><span class="main_keyword">public</span> <span class="main_type"><code>Rectangle</code></span>? <b><span css="method">preview_load_position</span></b> () </div><br/> <div class="namespace_note"><b>Namespace:</b> Gkbd</div> <div class="package_note"><b>Package:</b> libgnomekbd</div> diff --git a/deps/libgnomekbd/libgnomekbd/index.htm b/deps/libgnomekbd/libgnomekbd/index.htm index 52705d32..c2e54ead 100644 --- a/deps/libgnomekbd/libgnomekbd/index.htm +++ b/deps/libgnomekbd/libgnomekbd/index.htm @@ -73,7 +73,7 @@ </span> <div class="leaf_brief_description"> </div></li> - <li class="method"><span class="leaf_code_definition"><span class="main_keyword">public</span> <span class="main_type"><code>Rectangle</code></span> <b><a href="Gkbd.preview_load_position.html" class="method">preview_load_position</a></b> () + <li class="method"><span class="leaf_code_definition"><span class="main_keyword">public</span> <span class="main_type"><code>Rectangle</code></span>? <b><a href="Gkbd.preview_load_position.html" class="method">preview_load_position</a></b> () </span> <div class="leaf_brief_description"> </div></li> diff --git a/lib/main.vala b/lib/main.vala index ec4ceafa..e06c7794 100644 --- a/lib/main.vala +++ b/lib/main.vala @@ -41,6 +41,8 @@ public class Indicator.Keyboard.Service : Object { this.xkb_info = new Gnome.XkbInfo (); + migrate_keyboard_layouts (); + update_window_sources (); this.loop = new MainLoop (); @@ -48,6 +50,53 @@ public class Indicator.Keyboard.Service : Object { } [DBus (visible = false)] + private void migrate_keyboard_layouts () { + if (!this.indicator_settings.get_boolean ("migrated")) { + var builder = new VariantBuilder (new VariantType ("a(ss)")); + var length = 0; + + var layout_settings = new Settings ("org.gnome.libgnomekbd.keyboard"); + var layouts = layout_settings.get_strv ("layouts"); + + foreach (var layout in layouts) { + var source = layout; + + source = source.replace (" ", "+"); + source = source.replace ("\t", "+"); + + builder.add ("(ss)", "xkb", source); + length++; + } + + var ibus = get_ibus (); + var engines = ibus.list_active_engines (); + + foreach (var engine in engines) { + if (length == 0) { + var source = "us"; + var layout = engine.get_layout (); + var variant = engine.get_layout_variant (); + + if (layout != null && variant != null) { + source = @"$layout+$variant"; + } else if (layout != null) { + source = layout; + } + + builder.add ("(ss)", "xkb", source); + } + + builder.add ("(ss)", "ibus", engine.name); + length++; + } + + this.source_settings.set_value ("sources", builder.end ()); + + this.indicator_settings.set_boolean ("migrated", true); + } + } + + [DBus (visible = false)] private void update_window_sources () { var group_per_window = this.per_window_settings.get_boolean ("group-per-window"); |