aboutsummaryrefslogtreecommitdiff
path: root/src/profile.vala
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2013-08-09 18:18:59 -0500
committerCharles Kerr <charles.kerr@canonical.com>2013-08-09 18:18:59 -0500
commitc1d8ca09d39ba3070d22529bd40f564e7647bfb3 (patch)
tree92662297f6c919d14d04c169e314db313f0a776f /src/profile.vala
parent654ce426eb9de761f1adec4643eb76a0fcf64fb1 (diff)
downloadayatana-indicator-bluetooth-c1d8ca09d39ba3070d22529bd40f564e7647bfb3.tar.gz
ayatana-indicator-bluetooth-c1d8ca09d39ba3070d22529bd40f564e7647bfb3.tar.bz2
ayatana-indicator-bluetooth-c1d8ca09d39ba3070d22529bd40f564e7647bfb3.zip
on shutdown, unexport the menus and unown the bus name
Diffstat (limited to 'src/profile.vala')
-rw-r--r--src/profile.vala15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/profile.vala b/src/profile.vala
index 96d1b5c..f89490b 100644
--- a/src/profile.vala
+++ b/src/profile.vala
@@ -23,6 +23,7 @@ class Profile: Object
protected string profile_name;
protected Menu root;
protected Menu menu;
+ private uint menu_export_id;
protected bool visible { get; set; default = true; }
@@ -44,8 +45,8 @@ class Profile: Object
{
try
{
- debug (@"exporting '$profile_name' on $object_path");
- connection.export_menu_model (object_path, root);
+ debug (@"exporting menu '$profile_name'");
+ menu_export_id = connection.export_menu_model (object_path, root);
}
catch (Error e)
{
@@ -53,6 +54,16 @@ class Profile: Object
}
}
+ public void unexport_menu (DBusConnection connection)
+ {
+ if (menu_export_id != 0)
+ {
+ debug (@"unexporting menu '$profile_name'");
+ connection.unexport_menu_model (menu_export_id);
+ menu_export_id = 0;
+ }
+ }
+
protected void spawn_command_line_async (string command)
{
try {