~ubuntu-branches/ubuntu/trusty/monodevelop/trusty-proposed

« back to all changes in this revision

Viewing changes to external/monomac/src/AppKit/NSDocument.cs

  • Committer: Package Import Robot
  • Author(s): Jo Shields
  • Date: 2013-05-12 09:46:03 UTC
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20130512094603-mad323bzcxvmcam0
Tags: upstream-4.0.5+dfsg
ImportĀ upstreamĀ versionĀ 4.0.5+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
using System;
 
2
using System.Collections.Generic;
 
3
 
 
4
using MonoMac.Foundation;
 
5
using MonoMac.ObjCRuntime;
 
6
 
1
7
namespace MonoMac.AppKit {
2
8
                
3
9
        public partial class NSDocument {
4
 
                public void delegate DuplicateCallback (NSDocument document, bool didDuplicate);
5
 
                static ArrayList proxies;
 
10
                public delegate void DuplicateCallback (NSDocument document, bool didDuplicate);
 
11
                static List<Callback> proxies;
6
12
                
7
13
                [Register ("__NSDocumentDuplicateCallback")]
8
14
                internal class Callback : NSObject {
17
23
                        void SelectorCallback (NSDocument source, bool didDuplicate, IntPtr contextInfo)
18
24
                        {
19
25
                                callback (source, didDuplicate);
20
 
                                proxies.Remove (this);
21
 
                                if (proxies.Count == 0)
22
 
                                        proxies = null;
 
26
                                if (proxies != null) {
 
27
                                        proxies.Remove (this);
 
28
                                        if (proxies.Count == 0)
 
29
                                                proxies = null;
 
30
                                }
23
31
                        }
24
32
                }
25
33
                
27
35
                {
28
36
                        if (callback == null)
29
37
                                _DuplicateDocument (null, null, IntPtr.Zero);
30
 
                        proxy = new Callback ();
 
38
                        var proxy = new Callback (callback);
31
39
                        if (proxies == null)
32
 
                                proxies = new ArrayList ();
 
40
                                proxies = new List<Callback> ();
33
41
                        proxies.Add (proxy);
34
42
                        _DuplicateDocument (proxy, new Selector ("document:didDuplicate:contextInfo:"), IntPtr.Zero);
35
43
                }