summaryrefslogtreecommitdiff
path: root/src/wx/screen_dialog.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-10-14 12:46:15 +0100
committerCarl Hetherington <cth@carlh.net>2013-10-14 12:46:15 +0100
commitc439745bf1a1a38d0fc99ed18e2726730790973b (patch)
tree735ceb6233af308f7a23043fd6f604b84df4ebf0 /src/wx/screen_dialog.cc
parent0cb4b0621cb7f24a1a8c39fd81984b9ef79f0d7d (diff)
Prevent crashes when coming out of the add screen dialog without giving a certificate.
Diffstat (limited to 'src/wx/screen_dialog.cc')
-rw-r--r--src/wx/screen_dialog.cc15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/wx/screen_dialog.cc b/src/wx/screen_dialog.cc
index 6584e1ad6..32a0bce43 100644
--- a/src/wx/screen_dialog.cc
+++ b/src/wx/screen_dialog.cc
@@ -65,7 +65,9 @@ ScreenDialog::ScreenDialog (wxWindow* parent, string title, string name, shared_
overall_sizer->Layout ();
overall_sizer->SetSizeHints (this);
- _certificate_load->Connect (wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler (ScreenDialog::load_certificate), 0, this);
+ _certificate_load->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&ScreenDialog::load_certificate, this));
+
+ setup_sensitivity ();
}
string
@@ -81,7 +83,7 @@ ScreenDialog::certificate () const
}
void
-ScreenDialog::load_certificate (wxCommandEvent &)
+ScreenDialog::load_certificate ()
{
wxFileDialog* d = new wxFileDialog (this, _("Select Certificate File"));
@@ -95,4 +97,13 @@ ScreenDialog::load_certificate (wxCommandEvent &)
}
d->Destroy ();
+
+ setup_sensitivity ();
+}
+
+void
+ScreenDialog::setup_sensitivity ()
+{
+ wxButton* ok = dynamic_cast<wxButton*> (FindWindowById (wxID_OK, this));
+ ok->Enable (_certificate);
}