[blam/gtk-builder] Make use of the global SynchronizationContext



commit 66cc099e022df6234891fd47bcd2ab53e1094e36
Author: Carlos Martín Nieto <cmn dwim me>
Date:   Sun Oct 6 23:04:48 2013 +0200

    Make use of the global SynchronizationContext

 src/Blam.cs        |    4 +---
 src/ChannelList.cs |    4 +++-
 2 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/src/Blam.cs b/src/Blam.cs
index 6c29e2c..a5cf5d7 100644
--- a/src/Blam.cs
+++ b/src/Blam.cs
@@ -25,12 +25,10 @@ namespace Blam
 
                ChannelCollection channels;
 
-               public static SynchronizationContext Context { get; private set; }
-
                public BlamApplication()
                {
                        ItemStore.Load();
-                       Context = new GLib.GLibSynchronizationContext();
+                       SynchronizationContext.SetSynchronizationContext(new 
GLib.GLibSynchronizationContext());
 
                        var bld = new Builder();
                        bld.AddFromResource("blam.ui");
diff --git a/src/ChannelList.cs b/src/ChannelList.cs
index 02b94b3..471a98b 100644
--- a/src/ChannelList.cs
+++ b/src/ChannelList.cs
@@ -14,6 +14,7 @@ using System.Collections.Generic;
 using System.Collections.Specialized;
 using System.Runtime.InteropServices;
 using System.ComponentModel;
+using System.Threading;
 using Mono.Unix;
 
 namespace Blam
@@ -33,7 +34,8 @@ namespace Blam
                void OnPropertyChanged(object sender, PropertyChangedEventArgs args)
                {
                        var chan = (IChannel)sender;
-                       BlamApplication.Context.Post((state) => 
Model.EmitRowChanged(Model.GetPath(chan.Iter), chan.Iter), null);
+                       var sc = SynchronizationContext.Current;
+                       sc.Post((state) => Model.EmitRowChanged(Model.GetPath(chan.Iter), chan.Iter), null);
                }
 
                public FeedList(IEnumerable<Channel> channels, IEnumerable<ChannelGroup> groups)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]