aboutsummaryrefslogtreecommitdiff
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
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.
-rw-r--r--src/desktop.vala2
-rw-r--r--src/phone.vala2
-rw-r--r--src/profile.vala22
3 files changed, 8 insertions, 18 deletions
diff --git a/src/desktop.vala b/src/desktop.vala
index 588a584..4a10db8 100644
--- a/src/desktop.vala
+++ b/src/desktop.vala
@@ -51,7 +51,7 @@ class Desktop: Profile
// build the static actions
Action[] actions = {};
- actions += get_root_action (profile_name);
+ actions += root_action;
actions += create_enabled_action (bluetooth);
actions += create_discoverable_action (bluetooth);
actions += create_wizard_action ();
diff --git a/src/phone.vala b/src/phone.vala
index 8adc111..43ca554 100644
--- a/src/phone.vala
+++ b/src/phone.vala
@@ -31,7 +31,7 @@ class Phone: Profile
// build the static actions
Action[] actions = {};
- actions += get_root_action (profile_name);
+ actions += root_action;
actions += create_enabled_action (bluetooth);
actions += create_settings_action ();
foreach (var a in actions)
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 ());