|
29 | 29 | using MonoDevelop.Ide;
|
30 | 30 | using LibGit2Sharp;
|
31 | 31 | using System.Threading.Tasks;
|
| 32 | +using System.Threading; |
32 | 33 |
|
33 | 34 | namespace MonoDevelop.VersionControl.Git
|
34 | 35 | {
|
35 | 36 | partial class StashManagerDialog : Gtk.Dialog
|
36 | 37 | {
|
37 |
| - readonly GitRepository repository; |
38 |
| - readonly ListStore store; |
39 |
| - readonly StashCollection stashes; |
| 38 | + GitRepository repository; |
| 39 | + ListStore store; |
| 40 | + StashCollection stashes; |
40 | 41 |
|
41 |
| - public StashManagerDialog (GitRepository repo) |
| 42 | + public StashManagerDialog () |
42 | 43 | {
|
43 | 44 | this.Build ();
|
44 | 45 | this.UseNativeContextMenus ();
|
45 |
| - repository = repo; |
46 |
| - |
47 |
| - stashes = repo.GetStashes (); |
| 46 | + } |
48 | 47 |
|
49 |
| - store = new ListStore (typeof(Stash), typeof(string), typeof(string)); |
50 |
| - list.Model = store; |
51 |
| - list.SearchColumn = -1; // disable the interactive search |
| 48 | + public async Task InitializeAsync(GitRepository repo, CancellationToken cancellationToken = default) |
| 49 | + { |
| 50 | + repository = repo; |
| 51 | + stashes = await repo.GetStashesAsync (cancellationToken); |
52 | 52 |
|
53 |
| - list.AppendColumn (GettextCatalog.GetString ("Date/Time"), new CellRendererText (), "text", 1); |
54 |
| - list.AppendColumn (GettextCatalog.GetString ("Comment"), new CellRendererText (), "text", 2); |
55 |
| - Fill (); |
56 |
| - TreeIter it; |
57 |
| - if (store.GetIterFirst (out it)) |
58 |
| - list.Selection.SelectIter (it); |
59 |
| - UpdateButtons (); |
| 53 | + await Runtime.RunInMainThread (delegate { |
| 54 | + store = new ListStore (typeof (Stash), typeof (string), typeof (string)); |
| 55 | + list.Model = store; |
| 56 | + list.SearchColumn = -1; // disable the interactive search |
60 | 57 |
|
61 |
| - list.Selection.Changed += delegate { |
| 58 | + list.AppendColumn (GettextCatalog.GetString ("Date/Time"), new CellRendererText (), "text", 1); |
| 59 | + list.AppendColumn (GettextCatalog.GetString ("Comment"), new CellRendererText (), "text", 2); |
| 60 | + Fill (); |
| 61 | + TreeIter it; |
| 62 | + if (store.GetIterFirst (out it)) |
| 63 | + list.Selection.SelectIter (it); |
62 | 64 | UpdateButtons ();
|
63 |
| - }; |
| 65 | + |
| 66 | + list.Selection.Changed += delegate { |
| 67 | + UpdateButtons (); |
| 68 | + }; |
| 69 | + }); |
64 | 70 | }
|
65 | 71 |
|
66 | 72 | void Fill ()
|
|
0 commit comments