summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2014-09-03 00:37:51 +0100
committerCarl Hetherington <cth@carlh.net>2014-09-03 00:37:51 +0100
commitfb86361c31c35d7df3dede7b40e4b60e2e7f9c1a (patch)
tree22e40eadded096629fee8c867d51604a099e722b
parent6788ff5967508056d1321c16143bf72fa7cd4516 (diff)
Similar fix to Dolby cert downloads.
-rw-r--r--ChangeLog4
-rw-r--r--src/wx/dolby_certificate_dialog.cc47
-rw-r--r--src/wx/dolby_certificate_dialog.h4
-rw-r--r--src/wx/wx_util.cc10
-rw-r--r--src/wx/wx_util.h1
5 files changed, 50 insertions, 16 deletions
diff --git a/ChangeLog b/ChangeLog
index 54188c26a..d9be8474e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2014-09-03 Carl Hetherington <cth@carlh.net>
+
+ * Fix server certificate downloads on OS X (#376).
+
2014-09-02 Carl Hetherington <cth@carlh.net>
* Improve behaviour of batch converter window when it is shrunk (#338).
diff --git a/src/wx/dolby_certificate_dialog.cc b/src/wx/dolby_certificate_dialog.cc
index a05a3bbc7..5e094844d 100644
--- a/src/wx/dolby_certificate_dialog.cc
+++ b/src/wx/dolby_certificate_dialog.cc
@@ -21,6 +21,7 @@
#include <curl/curl.h>
#include "lib/compose.hpp"
#include "lib/internet.h"
+#include "lib/ui_signaller.h"
#include "dolby_certificate_dialog.h"
#include "wx_util.h"
@@ -74,8 +75,17 @@ DolbyCertificateDialog::setup_countries ()
_country->Append (_("Fetching..."));
_country->SetSelection (0);
- run_gui_loop ();
-
+
+#ifdef DCPOMATIC_OSX
+ /* See DoremiCertificateDialog for discussion about this daft delay */
+ wxMilliSleep (200);
+#endif
+ ui_signaller->when_idle (boost::bind (&DolbyCertificateDialog::finish_setup_countries, this));
+}
+
+void
+DolbyCertificateDialog::finish_setup_countries ()
+{
list<string> const countries = get_dir ("");
_country->Clear ();
for (list<string>::const_iterator i = countries.begin(); i != countries.end(); ++i) {
@@ -89,8 +99,16 @@ DolbyCertificateDialog::country_selected ()
_cinema->Clear ();
_cinema->Append (_("Fetching..."));
_cinema->SetSelection (0);
- run_gui_loop ();
-
+
+#ifdef DCPOMATIC_OSX
+ wxMilliSleep (200);
+#endif
+ ui_signaller->when_idle (boost::bind (&DolbyCertificateDialog::finish_country_selected, this));
+}
+
+void
+DolbyCertificateDialog::finish_country_selected ()
+{
list<string> const cinemas = get_dir (wx_to_std (_country->GetStringSelection()));
_cinema->Clear ();
for (list<string>::const_iterator i = cinemas.begin(); i != cinemas.end(); ++i) {
@@ -104,8 +122,16 @@ DolbyCertificateDialog::cinema_selected ()
_serial->Clear ();
_serial->Append (_("Fetching..."));
_serial->SetSelection (0);
- run_gui_loop ();
+#ifdef DCPOMATIC_OSX
+ wxMilliSleep (200);
+#endif
+ ui_signaller->when_idle (boost::bind (&DolbyCertificateDialog::finish_cinema_selected, this));
+}
+
+void
+DolbyCertificateDialog::finish_cinema_selected ()
+{
string const dir = String::compose ("%1/%2", wx_to_std (_country->GetStringSelection()), wx_to_std (_cinema->GetStringSelection()));
list<string> const zips = get_dir (dir);
@@ -129,8 +155,17 @@ void
DolbyCertificateDialog::download ()
{
_message->SetLabel (_("Downloading certificate"));
- run_gui_loop ();
+#ifdef DCPOMATIC_OSX
+ wxMilliSleep (200);
+#endif
+
+ ui_signaller->when_idle (boost::bind (&DolbyCertificateDialog::finish_download, this));
+}
+
+void
+DolbyCertificateDialog::finish_download ()
+{
string const zip = string_client_data (_serial->GetClientObject (_serial->GetSelection ()));
string const file = String::compose (
diff --git a/src/wx/dolby_certificate_dialog.h b/src/wx/dolby_certificate_dialog.h
index 194150363..e9bbffda0 100644
--- a/src/wx/dolby_certificate_dialog.h
+++ b/src/wx/dolby_certificate_dialog.h
@@ -27,9 +27,13 @@ public:
private:
void download ();
+ void finish_download ();
void setup_countries ();
+ void finish_setup_countries ();
void country_selected ();
+ void finish_country_selected ();
void cinema_selected ();
+ void finish_cinema_selected ();
void serial_selected ();
std::list<std::string> get_dir (std::string) const;
diff --git a/src/wx/wx_util.cc b/src/wx/wx_util.cc
index 218a786b2..23a85534a 100644
--- a/src/wx/wx_util.cc
+++ b/src/wx/wx_util.cc
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -312,14 +312,6 @@ wx_get (wxSpinCtrlDouble* w)
return w->GetValue ();
}
-void
-run_gui_loop ()
-{
- while (wxTheApp->Pending ()) {
- wxTheApp->Dispatch ();
- }
-}
-
/** @param s String of the form Context|String
* @return translation, or String if no translation is available.
*/
diff --git a/src/wx/wx_util.h b/src/wx/wx_util.h
index 6dfc0bf5c..f0e20be95 100644
--- a/src/wx/wx_util.h
+++ b/src/wx/wx_util.h
@@ -63,7 +63,6 @@ extern wxStaticText* add_label_to_grid_bag_sizer (wxGridBagSizer *, wxWindow *,
extern std::string wx_to_std (wxString);
extern wxString std_to_wx (std::string);
extern void dcpomatic_setup_i18n ();
-extern void run_gui_loop ();
extern wxString context_translation (wxString);
/** @class ThreadedStaticText