Esempio n. 1
0
        private void InitCredentialsPage()
        {
            f_CredentialsWidget = new EngineAssistantCredentialsWidget();

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

            f_CredentialsWidget.SshUsernameEntry.Changed += delegate {
                CheckCredentialsPage();
            };
            f_CredentialsWidget.UsernameEntry.Changed += delegate {
                CheckCredentialsPage();
            };
            f_CredentialsWidget.PasswordEntry.Changed += delegate {
                CheckCredentialsPage();
            };
            f_CredentialsWidget.VerifyPasswordEntry.Changed += delegate {
                CheckCredentialsPage();
            };

            // HACK: only show the SSH password field if plink is present as
            // OpenSSH doesn't support passing passwords via command line
            f_CredentialsWidget.SshPasswordVBox.Visible = IsPutty;

            if (IsPutty) {
                // Plink always requires a SSH username, thus
                // remove the (optional) portion from the label
                f_CredentialsWidget.SshUsernameLabel.Text = Regex.Replace(
                    f_CredentialsWidget.SshUsernameLabel.Text, @"\(.*?\)", ""
                );

                // PuTTY/Plink does not support OpenSSH key files but .ppk
                var filter = new Gtk.FileFilter();
                filter.Name = "PuTTY/Plink key files (*.ppk)";
                filter.AddPattern("*.ppk");
                f_CredentialsWidget.SshKeyfileChooserButton.AddFilter(filter);
            }

            if (f_EngineName != null) {
                f_CredentialsWidget.SshUsernameEntry.Text = (string)
                    f_Config["Engines/" + f_EngineName + "/SshUsername"];
                f_CredentialsWidget.SshPasswordEntry.Text = (string)
                    f_Config["Engines/" + f_EngineName + "/SshPassword"];
                var sshKeyfile = (string)
                    f_Config["Engines/" + f_EngineName + "/SshKeyfile"];
                if (!String.IsNullOrEmpty(sshKeyfile)) {
                    f_CredentialsWidget.SshKeyfileChooserButton.SetFilename(
                        sshKeyfile
                    );
                }
                var sshPath = IOPath.Combine(
                    Environment.GetFolderPath(
                        Environment.SpecialFolder.Personal
                    ),
                    ".ssh"
                );
                if (Directory.Exists(sshPath)) {
                    f_CredentialsWidget.SshKeyfileChooserButton.SetCurrentFolder(
                        sshPath
                    );
                }
                f_CredentialsWidget.UsernameEntry.Text = (string)
                    f_Config["Engines/" + f_EngineName + "/Username"];
                f_CredentialsWidget.PasswordEntry.Text = (string)
                    f_Config["Engines/" + f_EngineName + "/Password"];
                f_CredentialsWidget.VerifyPasswordEntry.Text = (string)
                    f_Config["Engines/" + f_EngineName + "/Password"];
            }
        }
Esempio n. 2
0
        private void InitCredentialsPage()
        {
            f_CredentialsWidget = new EngineAssistantCredentialsWidget();

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

            f_CredentialsWidget.SshUsernameEntry.Changed += delegate {
                CheckCredentialsPage();
            };
            f_CredentialsWidget.UsernameEntry.Changed += delegate {
                CheckCredentialsPage();
            };
            f_CredentialsWidget.PasswordEntry.Changed += delegate {
                CheckCredentialsPage();
            };
            f_CredentialsWidget.VerifyPasswordEntry.Changed += delegate {
                CheckCredentialsPage();
            };

            // HACK: only show the SSH password field if plink is present as
            // OpenSSH doesn't support passing passwords via command line
            f_CredentialsWidget.SshPasswordVBox.Visible = File.Exists("plink.exe");

            if (f_EngineName != null) {
                f_CredentialsWidget.SshUsernameEntry.Text = (string)
                    f_Config["Engines/" + f_EngineName + "/SshUsername"];
                f_CredentialsWidget.SshPasswordEntry.Text = (string)
                    f_Config["Engines/" + f_EngineName + "/SshPassword"];
                var sshKeyfile = (string)
                    f_Config["Engines/" + f_EngineName + "/SshKeyfile"];
                if (!String.IsNullOrEmpty(sshKeyfile)) {
                    f_CredentialsWidget.SshKeyfileChooserButton.SetFilename(
                        sshKeyfile
                    );
                }
                var sshPath = IOPath.Combine(
                    Environment.GetFolderPath(
                        Environment.SpecialFolder.Personal
                    ),
                    ".ssh"
                );
                if (Directory.Exists(sshPath)) {
                    f_CredentialsWidget.SshKeyfileChooserButton.SetCurrentFolder(
                        sshPath
                    );
                }
                f_CredentialsWidget.UsernameEntry.Text = (string)
                    f_Config["Engines/" + f_EngineName + "/Username"];
                f_CredentialsWidget.PasswordEntry.Text = (string)
                    f_Config["Engines/" + f_EngineName + "/Password"];
                f_CredentialsWidget.VerifyPasswordEntry.Text = (string)
                    f_Config["Engines/" + f_EngineName + "/Password"];
            }
        }
Esempio n. 3
0
        private void InitCredentialsPage()
        {
            f_CredentialsWidget = new EngineAssistantCredentialsWidget();

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

            f_CredentialsWidget.SshUsernameEntry.Changed += delegate {
                CheckCredentialsPage();
            };
            f_CredentialsWidget.UsernameEntry.Changed += delegate {
                CheckCredentialsPage();
            };
            f_CredentialsWidget.PasswordEntry.Changed += delegate {
                CheckCredentialsPage();
            };
            f_CredentialsWidget.VerifyPasswordEntry.Changed += delegate {
                CheckCredentialsPage();
            };

            // HACK: only show the SSH password field if plink is present as
            // OpenSSH doesn't support passing passwords via command line
            f_CredentialsWidget.SshPasswordVBox.Visible = IsPutty;

            if (IsPutty)
            {
                // Plink always requires a SSH username, thus
                // remove the (optional) portion from the label
                f_CredentialsWidget.SshUsernameLabel.Text = Regex.Replace(
                    f_CredentialsWidget.SshUsernameLabel.Text, @"\(.*?\)", ""
                    );

                // PuTTY/Plink does not support OpenSSH key files but .ppk
                var filter = new Gtk.FileFilter();
                filter.Name = "PuTTY/Plink key files (*.ppk)";
                filter.AddPattern("*.ppk");
                f_CredentialsWidget.SshKeyfileChooserButton.AddFilter(filter);
            }

            if (f_EngineName != null)
            {
                f_CredentialsWidget.SshUsernameEntry.Text = (string)
                                                            f_Config["Engines/" + f_EngineName + "/SshUsername"];
                f_CredentialsWidget.SshPasswordEntry.Text = (string)
                                                            f_Config["Engines/" + f_EngineName + "/SshPassword"];
                var sshKeyfile = (string)
                                 f_Config["Engines/" + f_EngineName + "/SshKeyfile"];
                if (!String.IsNullOrEmpty(sshKeyfile))
                {
                    f_CredentialsWidget.SshKeyfileChooserButton.SetFilename(
                        sshKeyfile
                        );
                }
                var sshPath = IOPath.Combine(
                    Environment.GetFolderPath(
                        Environment.SpecialFolder.Personal
                        ),
                    ".ssh"
                    );
                if (Directory.Exists(sshPath))
                {
                    f_CredentialsWidget.SshKeyfileChooserButton.SetCurrentFolder(
                        sshPath
                        );
                }
                f_CredentialsWidget.UsernameEntry.Text = (string)
                                                         f_Config["Engines/" + f_EngineName + "/Username"];
                f_CredentialsWidget.PasswordEntry.Text = (string)
                                                         f_Config["Engines/" + f_EngineName + "/Password"];
                f_CredentialsWidget.VerifyPasswordEntry.Text = (string)
                                                               f_Config["Engines/" + f_EngineName + "/Password"];
            }
        }
Esempio n. 4
0
        private void InitCredentialsPage()
        {
            f_CredentialsWidget = new EngineAssistantCredentialsWidget();

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

            f_CredentialsWidget.SshUsernameEntry.Changed += delegate {
                CheckCredentialsPage();
            };
            f_CredentialsWidget.UsernameEntry.Changed += delegate {
                CheckCredentialsPage();
            };
            f_CredentialsWidget.PasswordEntry.Changed += delegate {
                CheckCredentialsPage();
            };
            f_CredentialsWidget.VerifyPasswordEntry.Changed += delegate {
                CheckCredentialsPage();
            };

            // HACK: only show the SSH password field if plink is present as
            // OpenSSH doesn't support passing passwords via command line
            f_CredentialsWidget.SshPasswordVBox.Visible = File.Exists("plink.exe");

            if (f_EngineName != null)
            {
                f_CredentialsWidget.SshUsernameEntry.Text = (string)
                                                            f_Config["Engines/" + f_EngineName + "/SshUsername"];
                f_CredentialsWidget.SshPasswordEntry.Text = (string)
                                                            f_Config["Engines/" + f_EngineName + "/SshPassword"];
                var sshKeyfile = (string)
                                 f_Config["Engines/" + f_EngineName + "/SshKeyfile"];
                if (!String.IsNullOrEmpty(sshKeyfile))
                {
                    f_CredentialsWidget.SshKeyfileChooserButton.SetFilename(
                        sshKeyfile
                        );
                }
                var sshPath = IOPath.Combine(
                    Environment.GetFolderPath(
                        Environment.SpecialFolder.Personal
                        ),
                    ".ssh"
                    );
                if (Directory.Exists(sshPath))
                {
                    f_CredentialsWidget.SshKeyfileChooserButton.SetCurrentFolder(
                        sshPath
                        );
                }
                f_CredentialsWidget.UsernameEntry.Text = (string)
                                                         f_Config["Engines/" + f_EngineName + "/Username"];
                f_CredentialsWidget.PasswordEntry.Text = (string)
                                                         f_Config["Engines/" + f_EngineName + "/Password"];
                f_CredentialsWidget.VerifyPasswordEntry.Text = (string)
                                                               f_Config["Engines/" + f_EngineName + "/Password"];
            }
        }
Esempio n. 5
0
        private void InitCredentialsPage()
        {
            f_CredentialsWidget = new EngineAssistantCredentialsWidget();

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

            f_CredentialsWidget.SshUsernameEntry.Changed += delegate {
                CheckCredentialsPage();
            };
            f_CredentialsWidget.UsernameEntry.Changed += delegate {
                CheckCredentialsPage();
            };
            f_CredentialsWidget.PasswordEntry.Changed += delegate {
                CheckCredentialsPage();
            };
            f_CredentialsWidget.VerifyPasswordEntry.Changed += delegate {
                CheckCredentialsPage();
            };

            // HACK: only show the SSH password field if plink is present as
            // OpenSSH doesn't support passing passwords via command line
            f_CredentialsWidget.SshPasswordVBox.Visible = File.Exists("plink.exe");

            if (f_EngineName != null) {
                f_CredentialsWidget.SshUsernameEntry.Text = (string)
                    f_Config["Engines/" + f_EngineName + "/SshUsername"];
                f_CredentialsWidget.SshPasswordEntry.Text = (string)
                    f_Config["Engines/" + f_EngineName + "/SshPassword"];
                f_CredentialsWidget.UsernameEntry.Text = (string)
                    f_Config["Engines/" + f_EngineName + "/Username"];
                f_CredentialsWidget.PasswordEntry.Text = (string)
                    f_Config["Engines/" + f_EngineName + "/Password"];
                f_CredentialsWidget.VerifyPasswordEntry.Text = (string)
                    f_Config["Engines/" + f_EngineName + "/Password"];
            }
        }