예제 #1
0
        private void InitConnectionPage()
        {
            f_ConnectionWidget = new EngineAssistantConnectionWidget();

            AppendPage(f_ConnectionWidget);
            SetPageTitle(f_ConnectionWidget, _("Connection"));
            SetPageType(f_ConnectionWidget, Gtk.AssistantPageType.Content);
            Prepare += delegate(object sender, Gtk.PrepareArgs e) {
                if (e.Page != f_ConnectionWidget)
                {
                    return;
                }
                CheckConnectionPage();
            };

            f_ConnectionWidget.UseSshTunnelCheckButton.Toggled += delegate {
                bool isActive = f_ConnectionWidget.UseSshTunnelCheckButton.Active;
                f_ConnectionWidget.SshHostEntry.Sensitive      = isActive;
                f_ConnectionWidget.SshPortSpinButton.Sensitive = isActive;
                f_ConnectionWidget.HostEntry.Sensitive         = !isActive;
                if (isActive)
                {
                    f_ConnectionWidget.HostEntry.Text = "localhost";
                }
                else
                {
                    f_ConnectionWidget.HostEntry.Text          = String.Empty;
                    f_ConnectionWidget.SshHostEntry.Text       = String.Empty;
                    f_ConnectionWidget.SshPortSpinButton.Value = 22d;
                }

                CheckConnectionPage();
            };
            f_ConnectionWidget.SshHostEntry.Changed += delegate {
                CheckConnectionPage();
            };
            f_ConnectionWidget.HostEntry.Changed += delegate {
                CheckConnectionPage();
            };

            if (f_EngineName != null)
            {
                f_ConnectionWidget.UseSshTunnelCheckButton.Active = (bool)
                                                                    f_Config["Engines/" + f_EngineName + "/UseSshTunnel"];
                f_ConnectionWidget.SshHostEntry.Text = (string)
                                                       f_Config["Engines/" + f_EngineName + "/SshHostname"];
                f_ConnectionWidget.SshPortSpinButton.Value = (double)(int)
                                                             f_Config["Engines/" + f_EngineName + "/SshPort"];

                f_ConnectionWidget.HostEntry.Text = (string)
                                                    f_Config["Engines/" + f_EngineName + "/Hostname"];
                f_ConnectionWidget.PortSpinButton.Value = (double)(int)
                                                          f_Config["Engines/" + f_EngineName + "/Port"];
            }
        }
예제 #2
0
        private void InitConnectionPage()
        {
            f_ConnectionWidget = new EngineAssistantConnectionWidget();

            AppendPage(f_ConnectionWidget);
            SetPageTitle(f_ConnectionWidget, _("Connection"));
            SetPageType(f_ConnectionWidget, Gtk.AssistantPageType.Content);
            Prepare += delegate(object sender, Gtk.PrepareArgs e) {
                if (e.Page != f_ConnectionWidget) {
                    return;
                }
                CheckConnectionPage();
            };

            f_ConnectionWidget.UseSshTunnelCheckButton.Toggled += delegate {
                bool isActive = f_ConnectionWidget.UseSshTunnelCheckButton.Active;
                f_ConnectionWidget.SshHostEntry.Sensitive = isActive;
                f_ConnectionWidget.SshPortSpinButton.Sensitive = isActive;
                f_ConnectionWidget.HostEntry.Sensitive = !isActive;
                if (isActive) {
                    f_ConnectionWidget.HostEntry.Text = "localhost";
                } else {
                    f_ConnectionWidget.HostEntry.Text = String.Empty;
                    f_ConnectionWidget.SshHostEntry.Text = String.Empty;
                    f_ConnectionWidget.SshPortSpinButton.Value = 22d;
                }

                CheckConnectionPage();
            };
            f_ConnectionWidget.SshHostEntry.Changed += delegate {
                CheckConnectionPage();
            };
            f_ConnectionWidget.HostEntry.Changed += delegate {
                CheckConnectionPage();
            };

            if (f_EngineName != null) {
                f_ConnectionWidget.UseSshTunnelCheckButton.Active = (bool)
                    f_Config["Engines/" + f_EngineName + "/UseSshTunnel"];
                f_ConnectionWidget.SshHostEntry.Text = (string)
                    f_Config["Engines/" + f_EngineName + "/SshHostname"];
                f_ConnectionWidget.SshPortSpinButton.Value = (double)(int)
                    f_Config["Engines/" + f_EngineName + "/SshPort"];

                f_ConnectionWidget.HostEntry.Text = (string)
                    f_Config["Engines/" + f_EngineName + "/Hostname"];
                f_ConnectionWidget.PortSpinButton.Value = (double)(int)
                    f_Config["Engines/" + f_EngineName + "/Port"];
            }
        }