2 #include "gtk2ardour-config.h"
6 #include <gtkmm/stock.h>
8 #include "pbd/openuri.h"
10 #include "ardour/ardour.h"
11 #include "ardour/filesystem_paths.h"
16 using namespace ARDOUR
;
21 NagScreen::NagScreen (std::string
/*context*/, bool maybe_sub
)
22 : ArdourDialog (_("Support Ardour Development"), true)
23 , donate_button (button_group
, _("I'd like to make a one-time donation"))
24 , subscribe_button (button_group
, _("Tell me more about becoming a subscriber"))
25 , existing_button (button_group
, _("I'm already a subscriber!"))
26 , next_time_button (button_group
, _("Ask about this the next time I export"))
27 , never_again_button (button_group
, _("Never ever ask me about this again"))
30 message
.set_text (_("Congratulations on your session export.\n\n\
31 It looks as if you may already be a subscriber. If so, thanks, and sorry\n\
32 to bother you again about this - I'm working on improving our subscriber system\n\
33 so that I don't have to keep annoying you with this message.\n\n\
34 If you're not a subscriber, perhaps you might consider supporting my work\n\
35 on Ardour with either a one-time donation or subscription. Nothing will \n\
36 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!"));
39 message
.set_text (_("Congratulations on your session export.\n\n\
40 I hope you find Ardour a useful tool. I'd like to ask you to consider supporting\n\
41 its development with either a one-time donation or subscription. Nothing\n\
42 will happen if you choose not to do so. However Ardour's continuing development\n\
43 relies on a stable, sustainable income stream. Thanks for using Ardour!"));
46 button_box
.pack_start (donate_button
);
47 button_box
.pack_start (subscribe_button
);
48 button_box
.pack_start (existing_button
);
49 button_box
.pack_start (next_time_button
);
50 button_box
.pack_start (never_again_button
);
52 get_vbox()->set_spacing (12);
53 get_vbox()->pack_start (message
);
54 get_vbox()->pack_start (button_box
);
56 set_border_width (12);
57 add_button (Stock::OK
, RESPONSE_ACCEPT
);
60 NagScreen::~NagScreen ()
69 int response
= run ();
80 if (donate_button
.get_active()) {
82 } else if (subscribe_button
.get_active()) {
83 offer_to_subscribe ();
84 } else if (never_again_button
.get_active ()) {
86 } else if (existing_button
.get_active ()) {
87 mark_affirmed_subscriber ();
92 NagScreen::maybe_nag (std::string why
)
95 bool really_subscribed
;
96 bool maybe_subscribed
;
98 path
= Glib::build_filename (user_config_directory().to_string(), ".nevernag");
100 if (Glib::file_test (path
, Glib::FILE_TEST_EXISTS
)) {
104 maybe_subscribed
= is_subscribed (really_subscribed
);
106 if (really_subscribed
) {
110 return new NagScreen (why
, maybe_subscribed
);
114 NagScreen::mark_never_again ()
118 path
= Glib::build_filename (user_config_directory().to_string(), ".nevernag");
120 ofstream
nagfile (path
.c_str());
124 NagScreen::mark_subscriber ()
128 path
= Glib::build_filename (user_config_directory().to_string(), ".askedaboutsub");
130 ofstream
subsfile (path
.c_str());
134 NagScreen::mark_affirmed_subscriber ()
138 path
= Glib::build_filename (user_config_directory().to_string(), ".isubscribe");
140 ofstream
subsfile (path
.c_str());
144 NagScreen::is_subscribed (bool& really
)
150 /* what we'd really like here is a way to query paypal
151 for someone's subscription status. thats a bit complicated
152 so for now, just see if they ever told us they were
153 subscribed. we try to trust our users :)
156 path
= Glib::build_filename (user_config_directory().to_string(), ".isubscribe");
157 if (file_test (path
, FILE_TEST_EXISTS
)) {
162 path
= Glib::build_filename (user_config_directory().to_string(), ".askedaboutsub");
163 if (file_test (path
, FILE_TEST_EXISTS
)) {
164 /* they never said they were subscribed but they
165 did once express an interest in it.
175 NagScreen::offer_to_donate ()
177 const char* uri
= "http://ardour.org/donate";
179 /* we don't care if it fails */
185 NagScreen::offer_to_subscribe ()
187 const char* uri
= "http://ardour.org/subscribe";
189 if (PBD::open_uri (uri
)) {