UI is not allowed to access config. go via controller and talk about hosts

This commit is contained in:
Hylke 2011-07-02 17:10:57 +01:00
parent b57a59cc60
commit 118591e262
3 changed files with 22 additions and 14 deletions

View file

@ -200,16 +200,16 @@ namespace SparkleLib {
} }
public List<string> Domains { public List<string> Hosts {
get { get {
List<string> domains = new List<string> (); List<string> hosts = new List<string> ();
foreach (XmlNode node_folder in SelectNodes ("/sparkleshare/folder")) { foreach (XmlNode node_folder in SelectNodes ("/sparkleshare/folder")) {
Uri uri = new Uri (node_folder ["url"].InnerText); Uri uri = new Uri (node_folder ["url"].InnerText);
domains.Add (uri.Host); hosts.Add (uri.Host);
} }
return domains; return hosts;
} }
} }

View file

@ -230,6 +230,15 @@ namespace SparkleShare {
} }
public List<string> PreviousHosts {
get {
List<string> hosts = SparkleConfig.DefaultConfig.Hosts;
hosts.Sort ();
return hosts;
}
}
public List<string> UnsyncedFolders { public List<string> UnsyncedFolders {
get { get {
List<string> unsynced_folders = new List<string> (); List<string> unsynced_folders = new List<string> ();

View file

@ -681,29 +681,28 @@ namespace SparkleShare {
} }
TreeModel ServerEntryCompletion () private TreeModel ServerEntryCompletion ()
{ {
ListStore store = new ListStore (typeof (string)); List<string> hosts = SparkleShare.Controller.PreviousHosts;
List<string> Urls = SparkleLib.SparkleConfig.DefaultConfig.Domains;
ListStore store = new ListStore (typeof (string));
store.AppendValues ("user@localhost"); store.AppendValues ("user@localhost");
store.AppendValues ("user@example.com"); store.AppendValues ("user@example.com");
foreach (string url in Urls) {
store.AppendValues (url); foreach (string host in hosts)
} store.AppendValues (host);
return store; return store;
} }
TreeModel FolderEntryCompletion () private TreeModel FolderEntryCompletion ()
{ {
ListStore store = new ListStore (typeof (string)); ListStore store = new ListStore (typeof (string));
store.AppendValues ("~/test.git"); store.AppendValues ("~/test.git");
foreach (string folder in SparkleLib.SparkleConfig.DefaultConfig.Folders) {
foreach (string folder in SparkleShare.Controller.Folders)
store.AppendValues (folder); store.AppendValues (folder);
}
return store; return store;
} }