public void Dispose () { if (streaming_server != null) { streaming_server.Stop (); streaming_server = null; } if (proxy_server != null) { proxy_server.Stop (); proxy_server = null; } if (download_manager != null) { download_manager.Dispose (); download_manager = null; } if (upload_manager != null) { upload_manager.Dispose (); upload_manager = null; } if (container != null) { foreach (ContactSource source in container.Children) { Log.DebugFormat ("Disposing of ContactSource named {0}", source.Name); source.Contact.ContactServicesChanged -= OnContactServicesChanged; source.Dispose (); } ServiceManager.SourceManager.RemoveSource (container, true); container = null; } if (locator != null) { locator.ConnectionStatusChanged -= OnConnectionStatusChanged; locator.Dispose (); locator = null; } foreach (KeyValuePair <string, Connection> kv in conn_map) { if (kv.Value != null) { kv.Value.Roster.RosterStateChanged -= OnRosterStateChanged; kv.Value.Disconnected -= OnDisconnected; kv.Value.Dispose (); } } conn_map.Clear (); source_map.Clear (); TelepathyNotification notify = TelepathyNotification.Get; if (notify != null) { notify.Dispose (); } }
public void DelayedInitialize () { // require for bundled version of NDesk.DBus NDesk.DBus.BusG.Init (); conn_map = new Dictionary <string, Connection> (); source_map = new Dictionary <string, IDictionary <Contact, ContactSource>> (); container = new ContactContainerSource (this); ServiceManager.SourceManager.AddSource (container); download_manager = new DownloadManagerUi (); upload_manager = new UploadManagerUi (); try { locator = new ConnectionLocator (); } catch (DBusProxyObjectNotFound e) { Log.Error (e.ToString ()); return; } foreach (Account account in locator.GetConnections ()) { CreateConnection (account); } locator.ConnectionStatusChanged += OnConnectionStatusChanged; try { proxy_server = new StreamingHTTPProxyServer (); proxy_server.Start (); } catch (Exception e) { Log.Error ("Failed to start Banshee.Telepathy.StreamingHTTPProxyServer"); Log.Exception (e); } try { streaming_server = new StreamingServer (); streaming_server.Start (); } catch (Exception e) { Log.Error ("Failed to start Banshee.Telepathy.StreamingHTTPProxyServer"); Log.Exception (e); } }