aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Hua <william.hua@canonical.com>2014-04-04 16:27:41 +1300
committerWilliam Hua <william.hua@canonical.com>2014-04-04 16:27:41 +1300
commitdc64a5387763dda0aae30695741dd62ee9fe8614 (patch)
treef329170fe2dd157ddaf8adf9eddeb76993099014
parent202d1631f69e473c162c62d5e29b2ac1212390f1 (diff)
downloadayatana-indicator-keyboard-dc64a5387763dda0aae30695741dd62ee9fe8614.tar.gz
ayatana-indicator-keyboard-dc64a5387763dda0aae30695741dd62ee9fe8614.tar.bz2
ayatana-indicator-keyboard-dc64a5387763dda0aae30695741dd62ee9fe8614.zip
Separate lock screen menu.
-rw-r--r--data/Makefile.am2
-rw-r--r--lib/indicator-menu.vala17
-rw-r--r--lib/main.vala29
3 files changed, 41 insertions, 7 deletions
diff --git a/data/Makefile.am b/data/Makefile.am
index 104d2073..03c377c7 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -57,7 +57,7 @@ com.canonical.indicator.keyboard:
echo 'ObjectPath=/com/canonical/indicator/keyboard/desktop_greeter'; \
echo ''; \
echo '[desktop_lockscreen]'; \
- echo 'ObjectPath=/com/canonical/indicator/keyboard/desktop_greeter'; \
+ echo 'ObjectPath=/com/canonical/indicator/keyboard/desktop_lockscreen'; \
echo ''; \
echo '[ubiquity]'; \
echo 'ObjectPath=/com/canonical/indicator/keyboard/desktop') > $@.tmp && \
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);
}