2 #include "gtk2ardour-config.h"
6 #include <gtkmm/stock.h>
8 #include "pbd/openuri.h"
10 #include "ardour/filesystem_paths.h"
15 using namespace ARDOUR;
20 NagScreen::NagScreen (std::string /*context*/, bool maybe_sub)
21 : ArdourDialog (_("Support Ardour Development"), true)
22 , donate_button (button_group, _("I'd like to make a one-time donation"))
23 , subscribe_button (button_group, _("Tell me more about becoming a subscriber"))
24 , existing_button (button_group, _("I'm already a subscriber!"))
25 , next_time_button (button_group, _("Ask about this the next time I export"))
26 , never_again_button (button_group, _("Never ever ask me about this again"))
29 message.set_text (_("Congratulations on your session export.\n\n\
30 It looks as if you may already be a subscriber. If so, thanks, and sorry\n\
31 to bother you again about this - I'm working on improving our subscriber system\n\
32 so that I don't have to keep annoying you with this message.\n\n\
33 If you're not a subscriber, perhaps you might consider supporting my work\n\
34 on Ardour with either a one-time donation or subscription. Nothing will \n\
35 happen if you choose not to do so. However Ardour's continuing development\n\
36 relies on a stable, sustainable income stream. Thanks for using Ardour!"));
38 message.set_text (_("Congratulations on your session export.\n\n\
39 I hope you find Ardour a useful tool. I'd like to ask you to consider supporting\n\
40 its development with either a one-time donation or subscription. Nothing\n\
41 will happen if you choose not to do so. However Ardour's continuing development\n\
42 relies on a stable, sustainable income stream. Thanks for using Ardour!"));
45 button_box.pack_start (donate_button);
46 button_box.pack_start (subscribe_button);
47 button_box.pack_start (existing_button);
48 button_box.pack_start (next_time_button);
49 button_box.pack_start (never_again_button);
51 get_vbox()->set_spacing (12);
52 get_vbox()->pack_start (message);
53 get_vbox()->pack_start (button_box);
55 set_border_width (12);
56 add_button (Stock::OK, RESPONSE_ACCEPT);
59 NagScreen::~NagScreen ()
68 int response = run ();
79 if (donate_button.get_active()) {
81 } else if (subscribe_button.get_active()) {
82 offer_to_subscribe ();
83 } else if (never_again_button.get_active ()) {
85 } else if (existing_button.get_active ()) {
86 mark_affirmed_subscriber ();
91 NagScreen::maybe_nag (std::string why)
94 bool really_subscribed;
95 bool maybe_subscribed;
97 path = Glib::build_filename (user_config_directory(), ".nevernag");
99 if (Glib::file_test (path, Glib::FILE_TEST_EXISTS)) {
103 maybe_subscribed = is_subscribed (really_subscribed);
105 if (really_subscribed) {
109 return new NagScreen (why, maybe_subscribed);
113 NagScreen::mark_never_again ()
117 path = Glib::build_filename (user_config_directory(), ".nevernag");
119 ofstream nagfile (path.c_str());
123 NagScreen::mark_subscriber ()
127 path = Glib::build_filename (user_config_directory(), ".askedaboutsub");
129 ofstream subsfile (path.c_str());
133 NagScreen::mark_affirmed_subscriber ()
137 path = Glib::build_filename (user_config_directory(), ".isubscribe");
139 ofstream subsfile (path.c_str());
143 NagScreen::is_subscribed (bool& really)
149 /* what we'd really like here is a way to query paypal
150 for someone's subscription status. thats a bit complicated
151 so for now, just see if they ever told us they were
152 subscribed. we try to trust our users :)
155 path = Glib::build_filename (user_config_directory(), ".isubscribe");
156 if (file_test (path, FILE_TEST_EXISTS)) {
161 path = Glib::build_filename (user_config_directory(), ".askedaboutsub");
162 if (file_test (path, FILE_TEST_EXISTS)) {
163 /* they never said they were subscribed but they
164 did once express an interest in it.
174 NagScreen::offer_to_donate ()
176 const char* uri = "http://ardour.org/donate";
178 /* we don't care if it fails */
184 NagScreen::offer_to_subscribe ()
186 const char* uri = "http://ardour.org/subscribe";
188 if (PBD::open_uri (uri)) {