[banshee] Dap: refactor DapService, extract method
- From: Andrés Aragoneses <aaragoneses src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [banshee] Dap: refactor DapService, extract method
- Date: Wed, 30 Jul 2014 22:48:22 +0000 (UTC)
commit e13c46f3e889090b955485f23b62f4e6a4e8c621
Author: Nicholas Little <arealityfarbetween googlemail com>
Date: Thu Jul 31 00:36:16 2014 +0200
Dap: refactor DapService, extract method
Signed-off-by: Andrés G. Aragoneses <knocte gmail com>
src/Dap/Banshee.Dap/Banshee.Dap/DapService.cs | 49 ++++++++++++++-----------
1 files changed, 27 insertions(+), 22 deletions(-)
---
diff --git a/src/Dap/Banshee.Dap/Banshee.Dap/DapService.cs b/src/Dap/Banshee.Dap/Banshee.Dap/DapService.cs
index 8537dca..c00af21 100644
--- a/src/Dap/Banshee.Dap/Banshee.Dap/DapService.cs
+++ b/src/Dap/Banshee.Dap/Banshee.Dap/DapService.cs
@@ -221,32 +221,37 @@ namespace Banshee.Dap
}
if (source != null) {
- ThreadAssist.ProxyToMain (delegate {
-
- ServiceManager.SourceManager.AddSource (source);
- source.NotifyUser ();
-
- // If there are any queued device commands, see if they are to be
- // handled by this new DAP (e.g. --device-activate=file:///media/disk)
- try {
- if (service.unhandled_device_commands != null) {
- foreach (DeviceCommand command in service.unhandled_device_commands) {
- if (source.CanHandleDeviceCommand (command)) {
- service.HandleDeviceCommand (source, command.Action);
- service.unhandled_device_commands.Remove (command);
- if (service.unhandled_device_commands.Count == 0) {
- service.unhandled_device_commands = null;
- }
- break;
- }
+ service.MapSource (source);
+ }
+ }
+ }
+
+ private void MapSource (DapSource source)
+ {
+ ThreadAssist.ProxyToMain (() => {
+
+ ServiceManager.SourceManager.AddSource (source);
+ source.NotifyUser ();
+
+ // If there are any queued device commands, see if they are to be
+ // handled by this new DAP (e.g. --device-activate=file:///media/disk)
+ try {
+ if (unhandled_device_commands != null) {
+ foreach (DeviceCommand command in unhandled_device_commands) {
+ if (source.CanHandleDeviceCommand (command)) {
+ HandleDeviceCommand (source, command.Action);
+ unhandled_device_commands.Remove (command);
+ if (unhandled_device_commands.Count == 0) {
+ unhandled_device_commands = null;
}
+ break;
}
- } catch (Exception e) {
- Log.Error (e);
}
- });
+ }
+ } catch (Exception e) {
+ Log.Error (e);
}
- }
+ });
}
internal void UnmapDevice (string uuid)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]