aboutsummaryrefslogtreecommitdiff
path: root/src/profile.vala
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2013-08-09 18:22:31 -0500
committerCharles Kerr <charles.kerr@canonical.com>2013-08-09 18:22:31 -0500
commitaacf0decdb47a27d05b4701517a0e36e68491f66 (patch)
treeb750d0ad3d24b259915484db4dc4b4bb770e26b5 /src/profile.vala
parentc1d8ca09d39ba3070d22529bd40f564e7647bfb3 (diff)
downloadayatana-indicator-bluetooth-aacf0decdb47a27d05b4701517a0e36e68491f66.tar.gz
ayatana-indicator-bluetooth-aacf0decdb47a27d05b4701517a0e36e68491f66.tar.bz2
ayatana-indicator-bluetooth-aacf0decdb47a27d05b4701517a0e36e68491f66.zip
create Profile.root_action in Profile's constructor.
Diffstat (limited to 'src/profile.vala')
-rw-r--r--src/profile.vala22
1 files changed, 6 insertions, 16 deletions
diff --git a/src/profile.vala b/src/profile.vala
index f89490b..c288b4e 100644
--- a/src/profile.vala
+++ b/src/profile.vala
@@ -24,6 +24,7 @@ class Profile: Object
protected Menu root;
protected Menu menu;
private uint menu_export_id;
+ protected SimpleAction root_action;
protected bool visible { get; set; default = true; }
@@ -32,6 +33,11 @@ class Profile: Object
this.bluetooth = bluetooth;
this.profile_name = profile_name;
+ root_action = new SimpleAction.stateful (@"root-$profile_name",
+ null,
+ action_state_for_root());
+ notify["visible"].connect (() => update_root_action_state());
+
menu = new Menu ();
var item = create_root_menuitem ();
@@ -119,22 +125,6 @@ class Profile: Object
return action;
}
- protected SimpleAction root_action = null;
-
- protected SimpleAction get_root_action (string profile)
- {
- if (root_action == null)
- {
- root_action = new SimpleAction.stateful (@"root-$profile",
- null,
- action_state_for_root());
-
- notify["visible"].connect (() => update_root_action_state());
- }
-
- return root_action;
- }
-
protected void update_root_action_state ()
{
root_action.set_state (action_state_for_root ());