Populate listen dropdown with actual interface IP addresses. Remember choice between sessions
This commit is contained in:
@@ -5,6 +5,7 @@ using OpenMetaverse.StructuredData;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Text;
|
||||
using System.Net;
|
||||
|
||||
|
||||
public partial class MainWindow
|
||||
@@ -23,10 +24,32 @@ public partial class MainWindow
|
||||
Resize(Options.Instance["main_width"], Options.Instance["main_height"]);
|
||||
Move(Options.Instance["main_x"], Options.Instance["main_y"]);
|
||||
}
|
||||
|
||||
|
||||
// populate the listen box with the known IP Addresses of this host
|
||||
cbListen.AppendText("127.0.0.1");
|
||||
int selected = 0;
|
||||
try
|
||||
{
|
||||
int current = 0;
|
||||
foreach (var address in Dns.GetHostAddresses(Dns.GetHostName()))
|
||||
{
|
||||
if (address.AddressFamily != System.Net.Sockets.AddressFamily.InterNetwork || address.ToString() == "127.0.0.1") continue;
|
||||
current++;
|
||||
if (Options.Instance["listed_address"] == address.ToString())
|
||||
{
|
||||
selected = current;
|
||||
}
|
||||
cbListen.AppendText(address.ToString());
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
cbListen.Active = selected;
|
||||
}
|
||||
|
||||
void SaveSettings()
|
||||
{
|
||||
Options.Instance["listed_address"] = cbListen.ActiveText;
|
||||
Options.Instance["main_split_pos"] = mainSplit.Position;
|
||||
int x, y;
|
||||
|
||||
|
||||
@@ -166,11 +166,8 @@ public partial class MainWindow
|
||||
w5.Fill = false;
|
||||
// Container child hboxMenu.Gtk.Box+BoxChild
|
||||
this.cbListen = global::Gtk.ComboBoxEntry.NewText ();
|
||||
this.cbListen.AppendText (global::Mono.Unix.Catalog.GetString ("127.0.0.1"));
|
||||
this.cbListen.AppendText (global::Mono.Unix.Catalog.GetString ("0.0.0.0"));
|
||||
this.cbListen.WidthRequest = 100;
|
||||
this.cbListen.WidthRequest = 120;
|
||||
this.cbListen.Name = "cbListen";
|
||||
this.cbListen.Active = 0;
|
||||
this.hboxMenu.Add (this.cbListen);
|
||||
global::Gtk.Box.BoxChild w6 = ((global::Gtk.Box.BoxChild)(this.hboxMenu [this.cbListen]));
|
||||
w6.Position = 3;
|
||||
|
||||
@@ -124,11 +124,9 @@
|
||||
<child>
|
||||
<widget class="Gtk.ComboBoxEntry" id="cbListen">
|
||||
<property name="MemberName" />
|
||||
<property name="WidthRequest">100</property>
|
||||
<property name="WidthRequest">120</property>
|
||||
<property name="IsTextCombo">True</property>
|
||||
<property name="Items" translatable="yes">127.0.0.1
|
||||
0.0.0.0</property>
|
||||
<property name="Active">0</property>
|
||||
<property name="Items" translatable="yes" />
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="Position">3</property>
|
||||
|
||||
Reference in New Issue
Block a user