aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/indicator-menu.vala17
-rw-r--r--lib/main.vala29
2 files changed, 40 insertions, 6 deletions
diff --git a/lib/indicator-menu.vala b/lib/indicator-menu.vala
index 1d92a6f6..e321a2d2 100644
--- a/lib/indicator-menu.vala
+++ b/lib/indicator-menu.vala
@@ -20,8 +20,9 @@ public class Indicator.Keyboard.IndicatorMenu : MenuModel {
public enum Options {
NONE = 0x0,
- IBUS = 0x1,
- SETTINGS = 0x2
+ DCONF = 0x1,
+ IBUS = 0x2,
+ SETTINGS = 0x4
}
private Options options;
@@ -30,7 +31,7 @@ public class Indicator.Keyboard.IndicatorMenu : MenuModel {
private Menu sources_section;
private IBusMenu properties_section;
- public IndicatorMenu (ActionMap? action_map = null, Options options = Options.IBUS | Options.SETTINGS) {
+ public IndicatorMenu (ActionMap? action_map = null, Options options = Options.NONE) {
var submenu = new Menu ();
sources_section = new Menu ();
@@ -69,7 +70,15 @@ public class Indicator.Keyboard.IndicatorMenu : MenuModel {
for (var i = 0; i < sources.length; i++) {
if (!sources[i].is_ibus || (options & Options.IBUS) != Options.NONE) {
- var item = new MenuItem (sources[i].name, "indicator.current");
+ string action;
+
+ if ((options & Options.DCONF) != Options.NONE) {
+ action = "indicator.current";
+ } else {
+ action = "indicator.active";
+ }
+
+ var item = new MenuItem (sources[i].name, action);
item.set_attribute (Menu.ATTRIBUTE_TARGET, "u", i);
diff --git a/lib/main.vala b/lib/main.vala
index d8c1f060..cc78c384 100644
--- a/lib/main.vala
+++ b/lib/main.vala
@@ -47,6 +47,7 @@ public class Indicator.Keyboard.Service : Object {
private SimpleAction? indicator_action;
private IndicatorMenu? desktop_menu;
private IndicatorMenu? desktop_greeter_menu;
+ private IndicatorMenu? desktop_lockscreen_menu;
private UnitySession? unity_session;
private uint session_current;
@@ -81,6 +82,10 @@ public class Indicator.Keyboard.Service : Object {
get_desktop_greeter_menu ().set_sources (get_sources ());
}
+ if (desktop_lockscreen_menu != null) {
+ get_desktop_lockscreen_menu ().set_sources (get_sources ());
+ }
+
if (indicator_action != null) {
update_indicator_action ();
}
@@ -758,7 +763,11 @@ public class Indicator.Keyboard.Service : Object {
[DBus (visible = false)]
public IndicatorMenu get_desktop_menu () {
if (desktop_menu == null) {
- desktop_menu = new IndicatorMenu (get_action_group ());
+ var options = IndicatorMenu.Options.DCONF
+ | IndicatorMenu.Options.IBUS
+ | IndicatorMenu.Options.SETTINGS;
+
+ desktop_menu = new IndicatorMenu (get_action_group (), options);
((!) desktop_menu).set_sources (get_sources ());
((!) desktop_menu).activate.connect ((property, state) => {
var panel = get_ibus_panel ();
@@ -779,7 +788,9 @@ public class Indicator.Keyboard.Service : Object {
[DBus (visible = false)]
public IndicatorMenu get_desktop_greeter_menu () {
if (desktop_greeter_menu == null) {
- desktop_greeter_menu = new IndicatorMenu (get_action_group (), IndicatorMenu.Options.NONE);
+ var options = IndicatorMenu.Options.DCONF;
+
+ desktop_greeter_menu = new IndicatorMenu (get_action_group (), options);
((!) desktop_greeter_menu).set_sources (get_sources ());
}
@@ -787,6 +798,18 @@ public class Indicator.Keyboard.Service : Object {
}
[DBus (visible = false)]
+ public IndicatorMenu get_desktop_lockscreen_menu () {
+ if (desktop_lockscreen_menu == null) {
+ var options = IndicatorMenu.Options.NONE;
+
+ desktop_lockscreen_menu = new IndicatorMenu (get_action_group (), options);
+ ((!) desktop_lockscreen_menu).set_sources (get_sources ());
+ }
+
+ return (!) desktop_lockscreen_menu;
+ }
+
+ [DBus (visible = false)]
private void handle_changed_visible (string key) {
update_indicator_action ();
}
@@ -803,6 +826,7 @@ public class Indicator.Keyboard.Service : Object {
get_desktop_menu ().set_sources (get_sources ());
get_desktop_greeter_menu ().set_sources (get_sources ());
+ get_desktop_lockscreen_menu ().set_sources (get_sources ());
update_indicator_action ();
update_login_layout ();
}
@@ -939,6 +963,7 @@ public class Indicator.Keyboard.Service : Object {
connection.export_action_group ("/com/canonical/indicator/keyboard", get_action_group ());
connection.export_menu_model ("/com/canonical/indicator/keyboard/desktop", get_desktop_menu ());
connection.export_menu_model ("/com/canonical/indicator/keyboard/desktop_greeter", get_desktop_greeter_menu ());
+ connection.export_menu_model ("/com/canonical/indicator/keyboard/desktop_lockscreen", get_desktop_lockscreen_menu ());
} catch (Error error) {
warning ("error: %s", error.message);
}