From 383469d022e9b0c9a08321c7ec9c186fc09c1a36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Mon, 18 Jul 2011 18:13:09 +0200 Subject: examples: add secondary-activate signal usage to Vala and C --- example/simple-client-vala.vala | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'example/simple-client-vala.vala') diff --git a/example/simple-client-vala.vala b/example/simple-client-vala.vala index 61e0c2f..c0adf5b 100644 --- a/example/simple-client-vala.vala +++ b/example/simple-client-vala.vala @@ -92,6 +92,13 @@ 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) { -- cgit v1.2.3 From beb4f164b808f2dbb3fffa6ed85c931c2710a924 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Wed, 20 Jul 2011 03:32:35 +0200 Subject: examples: use the set_secondary_activate_target API --- example/simple-client-vala.vala | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'example/simple-client-vala.vala') 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(), "2"); - radio.activate.connect(() => { print("2\n"); }); + radio.activate.connect(() => { print("2\n"); }); menu.append(radio); radio.show(); -- cgit v1.2.3