update drobilla's fascistic dir-locals.el to force emacs users into whitespace submis...
[ardour.git] / gtk2_ardour / nag.cc
index d239d850c73164d44a9ca88f95b6eec759e02a7f..d82d986837bb76b1747cddc6ceacdd876a736f5c 100644 (file)
@@ -1,8 +1,14 @@
+#ifdef WAF_BUILD
+#include "gtk2ardour-config.h"
+#endif
+
 #include <fstream>
 #include <gtkmm/stock.h>
 
-#include <ardour/ardour.h>
-#include <ardour/filesystem_paths.h>
+#include "pbd/openuri.h"
+
+#include "ardour/ardour.h"
+#include "ardour/filesystem_paths.h"
 
 #include "nag.h"
 #include "i18n.h"
@@ -12,7 +18,7 @@ using namespace std;
 using namespace Glib;
 using namespace Gtk;
 
-NagScreen::NagScreen (std::string context, bool maybe_sub)
+NagScreen::NagScreen (std::string /*context*/, bool maybe_sub)
        : ArdourDialog (_("Support Ardour Development"), true)
        , donate_button (button_group, _("I'd like to make a one-time donation"))
        , subscribe_button (button_group, _("Tell me more about becoming a subscriber"))
@@ -36,13 +42,13 @@ its development with either a one-time donation or subscription. Nothing\n\
 will happen if you choose not to do so. However Ardour's continuing development\n\
 relies on a stable, sustainable income stream. Thanks for using Ardour!"));
        }
-       
+
        button_box.pack_start (donate_button);
        button_box.pack_start (subscribe_button);
        button_box.pack_start (existing_button);
        button_box.pack_start (next_time_button);
        button_box.pack_start (never_again_button);
-       
+
        get_vbox()->set_spacing (12);
        get_vbox()->pack_start (message);
        get_vbox()->pack_start (button_box);
@@ -85,7 +91,7 @@ NagScreen::nag ()
 NagScreen*
 NagScreen::maybe_nag (std::string why)
 {
-       Glib::ustring path;
+       std::string path;
        bool really_subscribed;
        bool maybe_subscribed;
 
@@ -96,7 +102,7 @@ NagScreen::maybe_nag (std::string why)
        }
 
        maybe_subscribed = is_subscribed (really_subscribed);
-       
+
        if (really_subscribed) {
                return 0;
        }
@@ -107,41 +113,41 @@ NagScreen::maybe_nag (std::string why)
 void
 NagScreen::mark_never_again ()
 {
-       Glib::ustring path;
+       std::string path;
 
        path = Glib::build_filename (user_config_directory().to_string(), ".nevernag");
-       
+
        ofstream nagfile (path.c_str());
 }
 
 void
 NagScreen::mark_subscriber ()
 {
-       Glib::ustring path;
+       std::string path;
 
        path = Glib::build_filename (user_config_directory().to_string(), ".askedaboutsub");
-       
+
        ofstream subsfile (path.c_str());
 }
 
 void
 NagScreen::mark_affirmed_subscriber ()
 {
-       Glib::ustring path;
+       std::string path;
 
        path = Glib::build_filename (user_config_directory().to_string(), ".isubscribe");
-       
+
        ofstream subsfile (path.c_str());
 }
 
 bool
 NagScreen::is_subscribed (bool& really)
 {
-       Glib::ustring path;
+       std::string path;
 
        really = false;
 
-       /* what we'd really like here is a way to query paypal 
+       /* what we'd really like here is a way to query paypal
           for someone's subscription status. thats a bit complicated
           so for now, just see if they ever told us they were
           subscribed. we try to trust our users :)
@@ -172,35 +178,16 @@ NagScreen::offer_to_donate ()
 
        /* we don't care if it fails */
 
-       open_uri (uri);
+        PBD::open_uri (uri);
 }
 
 void
 NagScreen::offer_to_subscribe ()
 {
        const char* uri = "http://ardour.org/subscribe";
-
-       if (open_uri (uri)) {
+        
+       if (PBD::open_uri (uri)) {
                mark_subscriber ();
        }
 }
 
-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
-#ifdef GTKOSX
-       extern bool cocoa_open_url (const char*);
-       return cocoa_open_url (uri);
-#else
-       std::string command = "xdg-open ";
-       command += uri;
-       spawn_command_line_async (command);
-
-       return true;
-#endif
-#endif
-}