X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fnag.cc;h=5d93d132677dc5048f831c0b8b36aac6be46fb78;hb=737e40a56fa2d325b3b9dc2ca39f5b3b9be887a3;hp=f63e78b20f6cd016213fefb4ce0f6165bbe2b7a8;hpb=88beef2e93d26d28467fe151f5ef2972d0ca9169;p=ardour.git diff --git a/gtk2_ardour/nag.cc b/gtk2_ardour/nag.cc index f63e78b20f..5d93d13267 100644 --- a/gtk2_ardour/nag.cc +++ b/gtk2_ardour/nag.cc @@ -5,7 +5,8 @@ #include #include -#include "ardour/ardour.h" +#include "pbd/openuri.h" + #include "ardour/filesystem_paths.h" #include "nag.h" @@ -16,7 +17,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")) @@ -40,13 +41,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); @@ -89,18 +90,18 @@ NagScreen::nag () NagScreen* NagScreen::maybe_nag (std::string why) { - Glib::ustring path; + std::string path; bool really_subscribed; bool maybe_subscribed; - path = Glib::build_filename (user_config_directory().to_string(), ".nevernag"); + path = Glib::build_filename (user_config_directory(), ".nevernag"); if (Glib::file_test (path, Glib::FILE_TEST_EXISTS)) { return 0; } maybe_subscribed = is_subscribed (really_subscribed); - + if (really_subscribed) { return 0; } @@ -111,53 +112,53 @@ NagScreen::maybe_nag (std::string why) void NagScreen::mark_never_again () { - Glib::ustring path; + std::string path; + + path = Glib::build_filename (user_config_directory(), ".nevernag"); - 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(), ".askedaboutsub"); - 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(), ".isubscribe"); - 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 :) */ - path = Glib::build_filename (user_config_directory().to_string(), ".isubscribe"); + path = Glib::build_filename (user_config_directory(), ".isubscribe"); if (file_test (path, FILE_TEST_EXISTS)) { really = true; return true; } - path = Glib::build_filename (user_config_directory().to_string(), ".askedaboutsub"); + path = Glib::build_filename (user_config_directory(), ".askedaboutsub"); if (file_test (path, FILE_TEST_EXISTS)) { /* they never said they were subscribed but they did once express an interest in it. @@ -176,7 +177,7 @@ NagScreen::offer_to_donate () /* we don't care if it fails */ - open_uri (uri); + PBD::open_uri (uri); } void @@ -184,27 +185,8 @@ 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 -}