aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorWilliam Hua <william.hua@canonical.com>2014-09-15 12:04:59 -0400
committerWilliam Hua <william.hua@canonical.com>2014-09-15 12:04:59 -0400
commitcd8ecdbcb0d936b6e6ef2b9bdf4253162299cfd4 (patch)
tree2ede12096751e018470ac2fe409d4134effb2e92 /lib
parent4d9387c577ae088321f8a4f6f1f4e14532502364 (diff)
downloadayatana-indicator-keyboard-cd8ecdbcb0d936b6e6ef2b9bdf4253162299cfd4.tar.gz
ayatana-indicator-keyboard-cd8ecdbcb0d936b6e6ef2b9bdf4253162299cfd4.tar.bz2
ayatana-indicator-keyboard-cd8ecdbcb0d936b6e6ef2b9bdf4253162299cfd4.zip
Hide indicator menu in desktop session when Fcitx is active.
Diffstat (limited to 'lib')
-rw-r--r--lib/indicator-menu.vala19
-rw-r--r--lib/main.vala18
2 files changed, 20 insertions, 17 deletions
diff --git a/lib/indicator-menu.vala b/lib/indicator-menu.vala
index 115adc5f..a4587dd8 100644
--- a/lib/indicator-menu.vala
+++ b/lib/indicator-menu.vala
@@ -19,11 +19,12 @@
public class Indicator.Keyboard.IndicatorMenu : MenuModel {
public enum Options {
- NONE = 0x0,
- DCONF = 0x1,
- IBUS = 0x2,
- FCITX = 0x4,
- SETTINGS = 0x8
+ NONE = 0x00,
+ DCONF = 0x01,
+ XKB = 0x02,
+ IBUS = 0x04,
+ FCITX = 0x08,
+ SETTINGS = 0x10
}
private Options options;
@@ -77,9 +78,11 @@ public class Indicator.Keyboard.IndicatorMenu : MenuModel {
sources_section.remove_all ();
for (var i = 0; i < sources.length; i++) {
- if (sources[i].is_xkb ||
- (sources[i].is_ibus && (options & Options.IBUS) != Options.NONE) ||
- (sources[i].is_fcitx && (options & Options.FCITX) != Options.NONE)) {
+ var visible = (sources[i].is_xkb && (options & Options.XKB) != Options.NONE) ||
+ (sources[i].is_ibus && (options & Options.IBUS) != Options.NONE) ||
+ (sources[i].is_fcitx && (options & Options.FCITX) != Options.NONE);
+
+ if (visible) {
string action;
if ((options & Options.DCONF) != Options.NONE) {
diff --git a/lib/main.vala b/lib/main.vala
index 748b2095..41ff5ff7 100644
--- a/lib/main.vala
+++ b/lib/main.vala
@@ -1004,15 +1004,14 @@ public class Indicator.Keyboard.Service : Object {
[DBus (visible = false)]
public IndicatorMenu get_desktop_menu () {
if (desktop_menu == null) {
- var options = IndicatorMenu.Options.DCONF
- | IndicatorMenu.Options.SETTINGS;
+ var options = IndicatorMenu.Options.DCONF;
- if (is_ibus_active ()) {
- options |= IndicatorMenu.Options.IBUS;
- }
+ if (!is_fcitx_active ()) {
+ options |= IndicatorMenu.Options.XKB | IndicatorMenu.Options.SETTINGS;
- if (is_fcitx_active ()) {
- options |= IndicatorMenu.Options.FCITX;
+ if (is_ibus_active ()) {
+ options |= IndicatorMenu.Options.IBUS;
+ }
}
desktop_menu = new IndicatorMenu (get_action_group (), options);
@@ -1036,7 +1035,8 @@ public class Indicator.Keyboard.Service : Object {
[DBus (visible = false)]
public IndicatorMenu get_desktop_greeter_menu () {
if (desktop_greeter_menu == null) {
- var options = IndicatorMenu.Options.DCONF;
+ var options = IndicatorMenu.Options.DCONF |
+ IndicatorMenu.Options.XKB;
desktop_greeter_menu = new IndicatorMenu (get_action_group (), options);
((!) desktop_greeter_menu).set_sources (get_sources ());
@@ -1048,7 +1048,7 @@ 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;
+ var options = IndicatorMenu.Options.XKB;
desktop_lockscreen_menu = new IndicatorMenu (get_action_group (), options);
((!) desktop_lockscreen_menu).set_sources (get_sources ());