[banshee/stable-1.8] [Daap] Remove actions when disposing the extension
- From: Bertrand Lorentz <blorentz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [banshee/stable-1.8] [Daap] Remove actions when disposing the extension
- Date: Sun, 16 Jan 2011 18:37:55 +0000 (UTC)
commit 99c55d000f58127c4d10f99cbb1f10aef04eded5
Author: Bertrand Lorentz <bertrand lorentz gmail com>
Date: Sat Nov 20 21:42:43 2010 +0100
[Daap] Remove actions when disposing the extension
Also guard against a null InterfaceActionService.
.../Banshee.Daap/Banshee.Daap/DaapService.cs | 24 ++++++++++++++-----
1 files changed, 17 insertions(+), 7 deletions(-)
---
diff --git a/src/Extensions/Banshee.Daap/Banshee.Daap/DaapService.cs b/src/Extensions/Banshee.Daap/Banshee.Daap/DaapService.cs
index 97dab26..9493d95 100644
--- a/src/Extensions/Banshee.Daap/Banshee.Daap/DaapService.cs
+++ b/src/Extensions/Banshee.Daap/Banshee.Daap/DaapService.cs
@@ -53,6 +53,8 @@ namespace Banshee.Daap
private DaapContainerSource container;
private Dictionary<string, DaapSource> source_map;
+ private uint actions_id;
+
internal static DaapProxyWebServer ProxyServer {
get { return proxy_server; }
}
@@ -75,6 +77,12 @@ namespace Banshee.Daap
proxy_server = null;
}
+ var uia_service = ServiceManager.Get<InterfaceActionService> ();
+ if (uia_service != null) {
+ uia_service.UIManager.RemoveUi (actions_id);
+ uia_service.GlobalActions.Remove ("AddRemoteDaapServerAction");
+ }
+
// Dispose any remaining child sources
if (source_map != null) {
foreach (KeyValuePair <string, DaapSource> kv in source_map) {
@@ -173,13 +181,15 @@ namespace Banshee.Daap
}
var uia_service = ServiceManager.Get<InterfaceActionService> ();
- uia_service.GlobalActions.Add (
- new ActionEntry ("AddRemoteDaapServerAction", Stock.Add,
- Catalog.GetString ("Add Remote DAAP Server"), null,
- Catalog.GetString ("Add a new remote DAAP server"),
- OnAddRemoteServer)
- );
- uia_service.UIManager.AddUiFromResource ("GlobalUI.xml");
+ if (uia_service != null) {
+ uia_service.GlobalActions.Add (
+ new ActionEntry ("AddRemoteDaapServerAction", Stock.Add,
+ Catalog.GetString ("Add Remote DAAP Server"), null,
+ Catalog.GetString ("Add a new remote DAAP server"),
+ OnAddRemoteServer)
+ );
+ actions_id = uia_service.UIManager.AddUiFromResource ("GlobalUI.xml");
+ }
}
private void OnAddRemoteServer (object o, EventArgs args)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]