diff options
author | Lluis Sanchez Gual <lluis@novell.com> | 2011-02-11 19:35:46 +0300 |
---|---|---|
committer | Lluis Sanchez Gual <lluis@novell.com> | 2011-02-11 19:35:46 +0300 |
commit | 030dd34f1b965f1a62f4ecc29fa5cbd50a2d68ac (patch) | |
tree | 9f1b4084bab169a36a21bc2adbfed3a6bd3c8182 /Mono.Addins.Gui | |
parent | 4e15666fd29886a78f32de20d42dc666daaf14bd (diff) |
Added support for enabling/disabling registered repositories.
Diffstat (limited to 'Mono.Addins.Gui')
-rw-r--r-- | Mono.Addins.Gui/Mono.Addins.Gui/AddinManagerDialog.cs | 5 | ||||
-rw-r--r-- | Mono.Addins.Gui/Mono.Addins.Gui/ManageSitesDialog.cs | 22 |
2 files changed, 22 insertions, 5 deletions
diff --git a/Mono.Addins.Gui/Mono.Addins.Gui/AddinManagerDialog.cs b/Mono.Addins.Gui/Mono.Addins.Gui/AddinManagerDialog.cs index c71e07a..e04f2aa 100644 --- a/Mono.Addins.Gui/Mono.Addins.Gui/AddinManagerDialog.cs +++ b/Mono.Addins.Gui/Mono.Addins.Gui/AddinManagerDialog.cs @@ -246,10 +246,11 @@ namespace Mono.Addins.Gui int i = repoCombo.Active; repoStore.Clear (); - repoStore.AppendValues (Catalog.GetString ("All registered repositories"), AllRepoMarker); + repoStore.AppendValues (Catalog.GetString ("All repositories"), AllRepoMarker); foreach (AddinRepository rep in service.Repositories.GetRepositories ()) { - repoStore.AppendValues (rep.Title, rep.Url); + if (rep.Enabled) + repoStore.AppendValues (rep.Title, rep.Url); } repoStore.AppendValues ("---", ""); repoStore.AppendValues (Catalog.GetString ("Manage Repositories..."), ManageRepoMarker); diff --git a/Mono.Addins.Gui/Mono.Addins.Gui/ManageSitesDialog.cs b/Mono.Addins.Gui/Mono.Addins.Gui/ManageSitesDialog.cs index 6dae61c..0744ba0 100644 --- a/Mono.Addins.Gui/Mono.Addins.Gui/ManageSitesDialog.cs +++ b/Mono.Addins.Gui/Mono.Addins.Gui/ManageSitesDialog.cs @@ -46,9 +46,12 @@ namespace Mono.Addins.Gui { Build (); this.service = service; - treeStore = new Gtk.ListStore (typeof (string), typeof (string)); + treeStore = new Gtk.ListStore (typeof (string), typeof (string), typeof(bool)); repoTree.Model = treeStore; repoTree.HeadersVisible = false; + var crt = new Gtk.CellRendererToggle (); + crt.Toggled += HandleRepoToggled; + repoTree.AppendColumn ("", crt, "active", 2); repoTree.AppendColumn ("", new Gtk.CellRendererText (), "markup", 1); repoTree.Selection.Changed += new EventHandler(OnSelect); @@ -58,7 +61,7 @@ namespace Mono.Addins.Gui btnRemove.Sensitive = false; } - + public override void Dispose () { base.Dispose (); @@ -68,7 +71,7 @@ namespace Mono.Addins.Gui void AppendRepository (AddinRepository rep) { string txt = GLib.Markup.EscapeText (rep.Title) + "\n<span color='darkgray'>" + GLib.Markup.EscapeText (rep.Url) + "</span>"; - treeStore.AppendValues (rep.Url, txt); + treeStore.AppendValues (rep.Url, txt, rep.Enabled); } protected void OnAdd (object sender, EventArgs e) @@ -147,6 +150,19 @@ namespace Mono.Addins.Gui treeStore.Remove (ref iter); } + void HandleRepoToggled (object o, ToggledArgs args) + { + Gtk.TreeIter iter; + if (!repoTree.Selection.GetSelected (out iter)) + return; + + bool newVal = !(bool) treeStore.GetValue (iter, 2); + string rep = (string) treeStore.GetValue (iter, 0); + service.Repositories.SetRepositoryEnabled (rep, newVal); + + treeStore.SetValue (iter, 2, newVal); + } + protected void OnSelect(object sender, EventArgs e) { btnRemove.Sensitive = repoTree.Selection.CountSelectedRows() > 0; |