Persist login URLs
This commit is contained in:
@@ -6,11 +6,12 @@ using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Text;
|
||||
using System.Net;
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
public partial class MainWindow
|
||||
{
|
||||
string SessionFileName;
|
||||
List<string> LoginServers = new List<string>();
|
||||
|
||||
void LoadSavedSettings()
|
||||
{
|
||||
@@ -45,10 +46,63 @@ public partial class MainWindow
|
||||
}
|
||||
catch { }
|
||||
cbListen.Active = selected;
|
||||
|
||||
if (Options.Instance["login_servers"] is OSDArray)
|
||||
{
|
||||
var servers = (OSDArray)Options.Instance["login_servers"];
|
||||
for (int i = 0; i < servers.Count; i++)
|
||||
{
|
||||
LoginServers.Add(servers[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (LoginServers.Count < 3)
|
||||
{
|
||||
LoginServers.Add("https://login.agni.lindenlab.com/cgi-bin/login.cgi");
|
||||
LoginServers.Add("https://login.aditi.lindenlab.com/cgi-bin/login.cgi");
|
||||
LoginServers.Add("http://login.osgrid.org/");
|
||||
}
|
||||
|
||||
foreach (var server in LoginServers)
|
||||
{
|
||||
cbLoginURL.AppendText(server);
|
||||
}
|
||||
|
||||
selected = Options.Instance["selected_login_server"];
|
||||
|
||||
if (selected >= 0 && selected < LoginServers.Count)
|
||||
{
|
||||
cbLoginURL.Active = selected;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void SaveSettings()
|
||||
{
|
||||
var currentServer = cbLoginURL.ActiveText.Trim();
|
||||
Uri uriResult;
|
||||
if (Uri.TryCreate(currentServer, UriKind.Absolute, out uriResult)
|
||||
&& (uriResult.Scheme == Uri.UriSchemeHttp || uriResult.Scheme == Uri.UriSchemeHttps)
|
||||
&& !LoginServers.Contains(currentServer))
|
||||
{
|
||||
LoginServers.Add(currentServer);
|
||||
Options.Instance["selected_login_server"] = LoginServers.Count - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
Options.Instance["selected_login_server"] = cbLoginURL.Active;
|
||||
}
|
||||
|
||||
if (LoginServers.Count > 0)
|
||||
{
|
||||
OSDArray loginServers = new OSDArray();
|
||||
foreach (var s in LoginServers)
|
||||
{
|
||||
loginServers.Add(s);
|
||||
}
|
||||
Options.Instance["login_servers"] = loginServers;
|
||||
}
|
||||
|
||||
Options.Instance["listed_address"] = cbListen.ActiveText;
|
||||
Options.Instance["main_split_pos"] = mainSplit.Position;
|
||||
int x, y;
|
||||
|
||||
@@ -206,12 +206,8 @@ public partial class MainWindow
|
||||
w9.Fill = false;
|
||||
// Container child hboxMenu.Gtk.Box+BoxChild
|
||||
this.cbLoginURL = global::Gtk.ComboBoxEntry.NewText ();
|
||||
this.cbLoginURL.AppendText (global::Mono.Unix.Catalog.GetString ("https://login.agni.lindenlab.com/cgi-bin/login.cgi"));
|
||||
this.cbLoginURL.AppendText (global::Mono.Unix.Catalog.GetString ("https://login.aditi.lindenlab.com/cgi-bin/login.cgi"));
|
||||
this.cbLoginURL.AppendText (global::Mono.Unix.Catalog.GetString ("http://login.orgrid.org/"));
|
||||
this.cbLoginURL.WidthRequest = 300;
|
||||
this.cbLoginURL.Name = "cbLoginURL";
|
||||
this.cbLoginURL.Active = 0;
|
||||
this.hboxMenu.Add (this.cbLoginURL);
|
||||
global::Gtk.Box.BoxChild w10 = ((global::Gtk.Box.BoxChild)(this.hboxMenu [this.cbLoginURL]));
|
||||
w10.Position = 7;
|
||||
|
||||
@@ -126,7 +126,7 @@
|
||||
<property name="MemberName" />
|
||||
<property name="WidthRequest">120</property>
|
||||
<property name="IsTextCombo">True</property>
|
||||
<property name="Items" translatable="yes" />
|
||||
<property name="Items" />
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="Position">3</property>
|
||||
@@ -180,10 +180,7 @@
|
||||
<property name="MemberName" />
|
||||
<property name="WidthRequest">300</property>
|
||||
<property name="IsTextCombo">True</property>
|
||||
<property name="Items" translatable="yes">https://login.agni.lindenlab.com/cgi-bin/login.cgi
|
||||
https://login.aditi.lindenlab.com/cgi-bin/login.cgi
|
||||
http://login.orgrid.org/</property>
|
||||
<property name="Active">0</property>
|
||||
<property name="Items" />
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="Position">7</property>
|
||||
|
||||
Reference in New Issue
Block a user