Fixing issues with opening a browser when using the bundle. Use xdg-open instead of glib functions. Fix to epa to ensure that the enviroment is restored correctly. The current enviroment has to be cleared. Otherwise any variables that are set in the current enviroment, but do not have a setting in the restored version will be left set.
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@12811 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
8bc35efaf0
commit
08236ff924
|
@ -1,7 +1,9 @@
|
|||
#include <boost/scoped_ptr.hpp>
|
||||
#include <fstream>
|
||||
#include <gtkmm/stock.h>
|
||||
|
||||
#include <ardour/ardour.h>
|
||||
#include <pbd/epa.h>
|
||||
|
||||
#include "nag.h"
|
||||
#include "i18n.h"
|
||||
|
@ -10,6 +12,7 @@ using namespace ARDOUR;
|
|||
using namespace std;
|
||||
using namespace Glib;
|
||||
using namespace Gtk;
|
||||
using namespace PBD;
|
||||
|
||||
NagScreen::NagScreen (std::string context, bool maybe_sub)
|
||||
: ArdourDialog (string_compose (_("Support %1 Development"), PROGRAM_NAME), true)
|
||||
|
@ -187,19 +190,26 @@ NagScreen::offer_to_subscribe ()
|
|||
bool
|
||||
NagScreen::open_uri (const char* uri)
|
||||
{
|
||||
#ifdef HAVE_GTK_OPEN_URI
|
||||
GError* err;
|
||||
return gtk_open_uri (0, uri, GDK_CURRENT_TIME, &err);
|
||||
#else
|
||||
#ifndef __APPLE__
|
||||
EnvironmentalProtectionAgency* global_epa = EnvironmentalProtectionAgency::get_global_epa ();
|
||||
boost::scoped_ptr<EnvironmentalProtectionAgency> current_epa;
|
||||
|
||||
/* revert all environment settings back to whatever they were when ardour started
|
||||
*/
|
||||
|
||||
if (global_epa) {
|
||||
current_epa.reset (new EnvironmentalProtectionAgency(true)); /* will restore settings when we leave scope */
|
||||
global_epa->restore ();
|
||||
}
|
||||
|
||||
std::string command = "xdg-open ";
|
||||
command += uri;
|
||||
spawn_command_line_async (command);
|
||||
command += " &";
|
||||
system (command.c_str());
|
||||
|
||||
return true;
|
||||
#else
|
||||
extern bool cocoa_open_url (const char*);
|
||||
return cocoa_open_url (uri);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -124,7 +124,29 @@ EnvironmentalProtectionAgency::save ()
|
|||
void
|
||||
EnvironmentalProtectionAgency::restore () const
|
||||
{
|
||||
clear ();
|
||||
|
||||
for (map<string,string>::const_iterator i = e.begin(); i != e.end(); ++i) {
|
||||
setenv (i->first.c_str(), i->second.c_str(), 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
EnvironmentalProtectionAgency::clear () const
|
||||
{
|
||||
char** the_environ = environ;
|
||||
|
||||
for (size_t i = 0; the_environ[i]; ++i) {
|
||||
|
||||
string estring = the_environ[i];
|
||||
string::size_type equal = estring.find_first_of ('=');
|
||||
|
||||
if (equal == string::npos) {
|
||||
/* say what? an environ value without = ? */
|
||||
continue;
|
||||
}
|
||||
|
||||
string before = estring.substr (0, equal);
|
||||
unsetenv(before.c_str());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,6 +38,8 @@ class EnvironmentalProtectionAgency {
|
|||
static void set_global_epa (EnvironmentalProtectionAgency* epa) { _global_epa = epa; }
|
||||
|
||||
private:
|
||||
void clear () const;
|
||||
|
||||
bool _armed;
|
||||
std::string _envname;
|
||||
std::map<std::string,std::string> e;
|
||||
|
|
Loading…
Reference in New Issue