2 #include <gtkmm/stock.h>
4 #include "ardour/ardour.h"
5 #include "ardour/filesystem_paths.h"
10 using namespace ARDOUR;
15 NagScreen::NagScreen (std::string context, bool maybe_sub)
16 : ArdourDialog (_("Support Ardour Development"), true)
17 , donate_button (button_group, _("I'd like to make a one-time donation"))
18 , subscribe_button (button_group, _("Tell me more about becoming a subscriber"))
19 , existing_button (button_group, _("I'm already a subscriber!"))
20 , next_time_button (button_group, _("Ask about this the next time I export"))
21 , never_again_button (button_group, _("Never ever ask me about this again"))
24 message.set_text (_("Congratulations on your session export.\n\n\
25 It looks as if you may already be a subscriber. If so, thanks, and sorry\n\
26 to bother you again about this - I'm working on improving our subscriber system\n\
27 so that I don't have to keep annoying you with this message.\n\n\
28 If you're not a subscriber, perhaps you might consider supporting my work\n\
29 on Ardour with either a one-time donation or subscription. Nothing will \n\
30 happen if you choose not to do so. However Ardour's continuing development\n\
31 relies on a stable, sustainable income stream. Thanks for using Ardour!"));
33 message.set_text (_("Congratulations on your session export.\n\n\
34 I hope you find Ardour a useful tool. I'd like to ask you to consider supporting\n\
35 its development with either a one-time donation or subscription. Nothing\n\
36 will happen if you choose not to do so. However Ardour's continuing development\n\
37 relies on a stable, sustainable income stream. Thanks for using Ardour!"));
40 button_box.pack_start (donate_button);
41 button_box.pack_start (subscribe_button);
42 button_box.pack_start (existing_button);
43 button_box.pack_start (next_time_button);
44 button_box.pack_start (never_again_button);
46 get_vbox()->set_spacing (12);
47 get_vbox()->pack_start (message);
48 get_vbox()->pack_start (button_box);
50 set_border_width (12);
51 add_button (Stock::OK, RESPONSE_ACCEPT);
54 NagScreen::~NagScreen ()
63 int response = run ();
74 if (donate_button.get_active()) {
76 } else if (subscribe_button.get_active()) {
77 offer_to_subscribe ();
78 } else if (never_again_button.get_active ()) {
80 } else if (existing_button.get_active ()) {
81 mark_affirmed_subscriber ();
86 NagScreen::maybe_nag (std::string why)
89 bool really_subscribed;
90 bool maybe_subscribed;
92 path = Glib::build_filename (user_config_directory().to_string(), ".nevernag");
94 if (Glib::file_test (path, Glib::FILE_TEST_EXISTS)) {
98 maybe_subscribed = is_subscribed (really_subscribed);
100 if (really_subscribed) {
104 return new NagScreen (why, maybe_subscribed);
108 NagScreen::mark_never_again ()
112 path = Glib::build_filename (user_config_directory().to_string(), ".nevernag");
114 ofstream nagfile (path.c_str());
118 NagScreen::mark_subscriber ()
122 path = Glib::build_filename (user_config_directory().to_string(), ".askedaboutsub");
124 ofstream subsfile (path.c_str());
128 NagScreen::mark_affirmed_subscriber ()
132 path = Glib::build_filename (user_config_directory().to_string(), ".isubscribe");
134 ofstream subsfile (path.c_str());
138 NagScreen::is_subscribed (bool& really)
144 /* what we'd really like here is a way to query paypal
145 for someone's subscription status. thats a bit complicated
146 so for now, just see if they ever told us they were
147 subscribed. we try to trust our users :)
150 path = Glib::build_filename (user_config_directory().to_string(), ".isubscribe");
151 if (file_test (path, FILE_TEST_EXISTS)) {
156 path = Glib::build_filename (user_config_directory().to_string(), ".askedaboutsub");
157 if (file_test (path, FILE_TEST_EXISTS)) {
158 /* they never said they were subscribed but they
159 did once express an interest in it.
169 NagScreen::offer_to_donate ()
171 const char* uri = "http://ardour.org/donate";
173 /* we don't care if it fails */
179 NagScreen::offer_to_subscribe ()
181 const char* uri = "http://ardour.org/subscribe";
183 if (open_uri (uri)) {
189 NagScreen::open_uri (const char* uri)
191 #ifdef HAVE_GTK_OPEN_URI
193 return gtk_open_uri (0, uri, GDK_CURRENT_TIME, &err);
196 extern bool cocoa_open_url (const char*);
197 return cocoa_open_url (uri);
199 std::string command = "xdg-open ";
201 spawn_command_line_async (command);