To get the testapp to run on linux you will need to download xulrunner 1.8.1.3 for linux from http://releases.mozilla.org/pub/mozilla.org/xulrunner/releases/1.8.1.3/contrib/linux-i686/xulrunner-1.8.1.3.en-US.linux-i686-20080128.tar.gz. Or you can try using the version you have installed on linux already, I happened to have 1.9.0.13 installed and it seemed to run okay.
Unless you download xulrunner and extract it all into webconnect/xr you will need to modify the testapp code slightly.
In MyApp::OnInit()
- Code: Select all
#if defined (_WIN32)
// the following call will look for a directory named "xr"
xulrunner_path = FindXulRunner(wxT("xr"));
if (xulrunner_path.IsEmpty())
{
wxMessageBox(wxT("Could not find xulrunner directory"));
return false;
}
#elif defined (__linux__)
xulrunner_path = wxT("/usr/lib/xulrunner");
// xulrunner_path = wxT("/usr/lib/xulrunner-1.9.0.13");
#elif
# error TBD find xulrunner dir for this platform
#endif
// Locate some common paths and initialize the control with
// the plugin paths; add these common plugin directories to
// MOZ_PLUGIN_PATH
#if defined (_WIN32)
wxString program_files_dir;
::wxGetEnv(wxT("ProgramFiles"), &program_files_dir);
if (program_files_dir.Length() == 0 || program_files_dir.Last() != '\\')
program_files_dir += wxT("\\");
wxString dir = program_files_dir;
dir += wxT("Mozilla Firefox\\plugins");
wxWebControl::AddPluginPath(dir);
#elif defined (__linux__)
//wxWebControl::AddPluginPath(wxT("/usr/lib/xulrunner-addons/plugins"));
wxWebControl::AddPluginPath(wxT("/usr/lib/firefox-addons/plugins"));
#elif
# error TBD add plugin dirs for this platform
#endif
The combo control for the address also appears to be too small on my linux system so I changed the following in MyFrame::MyFrame():
- Code: Select all
#if defined (__linux__)
m_urlbar = new wxComboBox(toolbar, wxID_URL, wxT(""), wxPoint(0,0), wxSize(850,24));
#else
m_urlbar = new wxComboBox(toolbar, wxID_URL, wxT(""), wxPoint(0,0), wxSize(850,18));
#endif
When building testapp.cpp you'll also get a warning:
- Code: Select all
testapp.cpp: In member function ‘void MyFrame::OnInitDownload(wxWebEvent&)’:
testapp.cpp:939: warning: cannot pass objects of non-POD type ‘class wxString’ through ‘...’; call will abort at runtime
To get rid of this in MyFrame::OnInitDownload() change:
- Code: Select all
wxString::Format(wxT("Would you like to download %s?"), filename),
to
- Code: Select all
wxString::Format(wxT("Would you like to download %s?"), filename.c_str()),
Cheers
Nigel