11
namespace Transmission
14
[System.ComponentModel.Category("File")]
15
[System.ComponentModel.ToolboxItem(true)]
16
public partial class TransmissionConfig : Gtk.Bin
18
public static string home_path = Environment.GetFolderPath (Environment.SpecialFolder.Personal);
19
public static string settings_path = System.IO.Path.Combine (home_path, ".config/transmission/settings.json");
21
static IPreferences prefs;
23
public TransmissionConfig()
29
private void RefreshView()
31
address_entry.Text = Address;
32
port_entry.Text = Port.ToString();
33
user_name_entry.Text = UserName;
34
password_entry.Text = Password;
37
static TransmissionConfig()
39
prefs = Services.Preferences.Get<TransmissionConfig>();
42
public static string Address
44
get { return prefs.Get<string>("Address", "127.0.0.1"); }
45
set { prefs.Set<string> ("Address", value); }
48
public static int Port
50
get { return prefs.Get<int>("Port", TransmissionAPI.DEFAULT_PORT); }
51
set { prefs.Set<int> ("Port", value); }
54
public static string UserName
56
get { return prefs.Get<string>("UserName", ""); }
57
set { prefs.Set<string> ("UserName", value); }
60
public static string Password
62
get { return prefs.Get<string>("Password", ""); }
63
set { prefs.Set<string> ("Password", value); }
66
protected virtual void OnAddressEntryChanged (object sender, System.EventArgs e)
68
Address = address_entry.Text;
69
TransmissionPlugin.ResetConnection();
72
protected virtual void OnUserNameEntryChanged (object sender, System.EventArgs e)
74
UserName = user_name_entry.Text;
75
TransmissionPlugin.ResetConnection();
78
protected virtual void OnPasswordEntryChanged (object sender, System.EventArgs e)
80
Password = password_entry.Text;
81
TransmissionPlugin.ResetConnection();
84
protected virtual void OnPortEntryChanged (object sender, System.EventArgs e)
86
Port = int.Parse(port_entry.Text);
87
TransmissionPlugin.ResetConnection();