diff options
author | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2011-07-20 03:32:35 +0200 |
---|---|---|
committer | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2011-07-20 03:32:35 +0200 |
commit | beb4f164b808f2dbb3fffa6ed85c931c2710a924 (patch) | |
tree | 7976e4c102fb62498ebbf86160b57557d880993f /example/simple-client-vala.vala | |
parent | a3812f9b8bfe467873bfe261a161b868c2b42118 (diff) | |
download | libayatana-appindicator-beb4f164b808f2dbb3fffa6ed85c931c2710a924.tar.gz libayatana-appindicator-beb4f164b808f2dbb3fffa6ed85c931c2710a924.tar.bz2 libayatana-appindicator-beb4f164b808f2dbb3fffa6ed85c931c2710a924.zip |
examples: use the set_secondary_activate_target API
Diffstat (limited to 'example/simple-client-vala.vala')
-rw-r--r-- | example/simple-client-vala.vala | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/example/simple-client-vala.vala b/example/simple-client-vala.vala index c0adf5b..8d661ce 100644 --- a/example/simple-client-vala.vala +++ b/example/simple-client-vala.vala @@ -72,6 +72,17 @@ class SimpleClient { menu.append(mi); mi.activate.connect(() => { print("Sub3\n"); }); + mi = new MenuItem.with_label("Toggle Attention"); + menu.append(mi); + mi.activate.connect(() => { + if (ci.get_status() == IndicatorStatus.ATTENTION) + ci.set_status(IndicatorStatus.ACTIVE); + else + ci.set_status(IndicatorStatus.ATTENTION); + }); + + ci.set_secondary_activate_target(mi); + menu.show_all(); item.set_submenu(menu); } @@ -92,13 +103,6 @@ class SimpleClient { print(@"Got scroll event! delta: $delta, direction: $direction\n"); }); - ci.secondary_activate.connect((x, y) => { - print(@"Got secondary activate event at $(x)x$(y)\n"); - - if (ci.get_status() == IndicatorStatus.ATTENTION) - ci.set_status(IndicatorStatus.ACTIVE); - }); - Timeout.add_seconds(1, () => { percentage = (percentage + 1) % 100; if (can_haz_label) { @@ -116,7 +120,7 @@ class SimpleClient { chk.show(); var radio = new RadioMenuItem.with_label(new SList<RadioMenuItem>(), "2"); - radio.activate.connect(() => { print("2\n"); }); + radio.activate.connect(() => { print("2\n"); }); menu.append(radio); radio.show(); |