2 #include "gtk2ardour-config.h"
6 #include <gtkmm/stock.h>
8 #include "ardour/ardour.h"
9 #include "ardour/filesystem_paths.h"
14 using namespace ARDOUR;
19 NagScreen::NagScreen (std::string context, bool maybe_sub)
20 : ArdourDialog (_("Support Ardour Development"), true)
21 , donate_button (button_group, _("I'd like to make a one-time donation"))
22 , subscribe_button (button_group, _("Tell me more about becoming a subscriber"))
23 , existing_button (button_group, _("I'm already a subscriber!"))
24 , next_time_button (button_group, _("Ask about this the next time I export"))
25 , never_again_button (button_group, _("Never ever ask me about this again"))
28 message.set_text (_("Congratulations on your session export.\n\n\
29 It looks as if you may already be a subscriber. If so, thanks, and sorry\n\
30 to bother you again about this - I'm working on improving our subscriber system\n\
31 so that I don't have to keep annoying you with this message.\n\n\
32 If you're not a subscriber, perhaps you might consider supporting my work\n\
33 on Ardour with either a one-time donation or subscription. Nothing will \n\
34 happen if you choose not to do so. However Ardour's continuing development\n\
35 relies on a stable, sustainable income stream. Thanks for using Ardour!"));
37 message.set_text (_("Congratulations on your session export.\n\n\
38 I hope you find Ardour a useful tool. I'd like to ask you to consider supporting\n\
39 its development with either a one-time donation or subscription. Nothing\n\
40 will happen if you choose not to do so. However Ardour's continuing development\n\
41 relies on a stable, sustainable income stream. Thanks for using Ardour!"));
44 button_box.pack_start (donate_button);
45 button_box.pack_start (subscribe_button);
46 button_box.pack_start (existing_button);
47 button_box.pack_start (next_time_button);
48 button_box.pack_start (never_again_button);
50 get_vbox()->set_spacing (12);
51 get_vbox()->pack_start (message);
52 get_vbox()->pack_start (button_box);
54 set_border_width (12);
55 add_button (Stock::OK, RESPONSE_ACCEPT);
58 NagScreen::~NagScreen ()
67 int response = run ();
78 if (donate_button.get_active()) {
80 } else if (subscribe_button.get_active()) {
81 offer_to_subscribe ();
82 } else if (never_again_button.get_active ()) {
84 } else if (existing_button.get_active ()) {
85 mark_affirmed_subscriber ();
90 NagScreen::maybe_nag (std::string why)
93 bool really_subscribed;
94 bool maybe_subscribed;
96 path = Glib::build_filename (user_config_directory().to_string(), ".nevernag");
98 if (Glib::file_test (path, Glib::FILE_TEST_EXISTS)) {
102 maybe_subscribed = is_subscribed (really_subscribed);
104 if (really_subscribed) {
108 return new NagScreen (why, maybe_subscribed);
112 NagScreen::mark_never_again ()
116 path = Glib::build_filename (user_config_directory().to_string(), ".nevernag");
118 ofstream nagfile (path.c_str());
122 NagScreen::mark_subscriber ()
126 path = Glib::build_filename (user_config_directory().to_string(), ".askedaboutsub");
128 ofstream subsfile (path.c_str());
132 NagScreen::mark_affirmed_subscriber ()
136 path = Glib::build_filename (user_config_directory().to_string(), ".isubscribe");
138 ofstream subsfile (path.c_str());
142 NagScreen::is_subscribed (bool& really)
148 /* what we'd really like here is a way to query paypal
149 for someone's subscription status. thats a bit complicated
150 so for now, just see if they ever told us they were
151 subscribed. we try to trust our users :)
154 path = Glib::build_filename (user_config_directory().to_string(), ".isubscribe");
155 if (file_test (path, FILE_TEST_EXISTS)) {
160 path = Glib::build_filename (user_config_directory().to_string(), ".askedaboutsub");
161 if (file_test (path, FILE_TEST_EXISTS)) {
162 /* they never said they were subscribed but they
163 did once express an interest in it.
173 NagScreen::offer_to_donate ()
175 const char* uri = "http://ardour.org/donate";
177 /* we don't care if it fails */
183 NagScreen::offer_to_subscribe ()
185 const char* uri = "http://ardour.org/subscribe";
187 if (open_uri (uri)) {
193 NagScreen::open_uri (const char* uri)
195 #ifdef HAVE_GTK_OPEN_URI
197 return gtk_open_uri (0, uri, GDK_CURRENT_TIME, &err);
200 extern bool cocoa_open_url (const char*);
201 return cocoa_open_url (uri);
203 std::string command = "xdg-open ";
205 spawn_command_line_async (command);