[smuxi: 3/4] Frontend-GNOME: any server support



commit d3b7fed8a36bdc96f7d25e212d4eb41ea0da7c4e
Author: Mirco Bauer <meebey meebey net>
Date:   Sun Feb 9 15:21:27 2014 +0100

    Frontend-GNOME: any server support
    
    Servers were always reconstructed in the UI, thus settings that are read from
    the config backend but not exposed in the UI were lost. Instead the ServerModel
    object is now reused, filled with the known UI values and passed as is to the
    engine.

 src/Frontend-GNOME/Views/ServerWidget.cs |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/src/Frontend-GNOME/Views/ServerWidget.cs b/src/Frontend-GNOME/Views/ServerWidget.cs
index 8a5a166..4fa4a5a 100644
--- a/src/Frontend-GNOME/Views/ServerWidget.cs
+++ b/src/Frontend-GNOME/Views/ServerWidget.cs
@@ -31,6 +31,7 @@ namespace Smuxi.Frontend.Gnome
         Gtk.ListStore f_NetworkListStore;
 
         string ServerID { get; set; }
+        ServerModel Server { get; set; }
 
         public Gtk.Entry HostnameEntry {
             get {
@@ -162,6 +163,8 @@ namespace Smuxi.Frontend.Gnome
         {
             Trace.Call(server);
 
+            Server = server;
+
             // protocol is part of the PKEY, not allowed to change
             f_ProtocolComboBox.Sensitive = false;
 
@@ -209,7 +212,10 @@ namespace Smuxi.Frontend.Gnome
         
         public ServerModel GetServer()
         {
-            ServerModel server = new ServerModel();
+            var server = Server;
+            if (server == null) {
+                server = new ServerModel();
+            }
             server.Protocol = f_ProtocolComboBox.ActiveText;
             server.ServerID = ServerID;
             server.Hostname = f_HostnameEntry.Text.Trim();
@@ -230,6 +236,8 @@ namespace Smuxi.Frontend.Gnome
             if (f_OnConnectCommandsTextView.Sensitive) {
                 server.OnConnectCommands =
                     f_OnConnectCommandsTextView.Buffer.Text.Split('\n');
+            } else {
+                server.OnConnectCommands = new List<string>();
             }
 
             return server;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]