2 #include <gtkmm/stock.h>
4 #include <ardour/ardour.h>
9 using namespace ARDOUR
;
14 NagScreen::NagScreen (std::string context
, bool maybe_sub
)
15 : ArdourDialog (_("Support Ardour Development"), true)
16 , donate_button (button_group
, _("I'd like to make a one-time donation"))
17 , subscribe_button (button_group
, _("Tell me more about becoming a subscriber"))
18 , existing_button (button_group
, _("I'm already a subscriber!"))
19 , next_time_button (button_group
, _("Ask about this the next time I export"))
20 , never_again_button (button_group
, _("Never ever ask me about this again"))
23 message
.set_text (_("Congratulations on your session export.\n\n\
24 It looks as if you may already be a subscriber. If so, thanks, and sorry\n\
25 to bother you again about this - I'm working on improving our subscriber system\n\
26 so that I don't have to keep annoying you with this message.\n\n\
27 If you're not a subscriber, perhaps you might consider supporting my work\n\
28 on Ardour with either a one-time donation or subscription. Nothing will \n\
29 happen if you choose not to do so. However Ardour's continuing development\n\
30 relies on a stable, sustainable income stream. Thanks for using Ardour!"));
32 message
.set_text (_("Congratulations on your session export.\n\n\
33 I hope you find Ardour a useful tool. I'd like to ask you to consider supporting\n\
34 its development with either a one-time donation or subscription. Nothing\n\
35 will 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!"));
39 button_box
.pack_start (donate_button
);
40 button_box
.pack_start (subscribe_button
);
41 button_box
.pack_start (existing_button
);
42 button_box
.pack_start (next_time_button
);
43 button_box
.pack_start (never_again_button
);
45 get_vbox()->set_spacing (12);
46 get_vbox()->pack_start (message
);
47 get_vbox()->pack_start (button_box
);
49 set_border_width (12);
50 add_button (Stock::OK
, RESPONSE_ACCEPT
);
53 NagScreen::~NagScreen ()
62 int response
= run ();
73 if (donate_button
.get_active()) {
75 } else if (subscribe_button
.get_active()) {
76 offer_to_subscribe ();
77 } else if (never_again_button
.get_active ()) {
79 } else if (existing_button
.get_active ()) {
80 mark_affirmed_subscriber ();
85 NagScreen::maybe_nag (std::string why
)
88 bool really_subscribed
;
89 bool maybe_subscribed
;
91 path
= Glib::build_filename (get_user_ardour_path(), ".nevernag");
93 if (Glib::file_test (path
, Glib::FILE_TEST_EXISTS
)) {
97 maybe_subscribed
= is_subscribed (really_subscribed
);
99 if (really_subscribed
) {
103 return new NagScreen (why
, maybe_subscribed
);
107 NagScreen::mark_never_again ()
111 path
= Glib::build_filename (get_user_ardour_path(), ".nevernag");
113 ofstream
nagfile (path
.c_str());
117 NagScreen::mark_subscriber ()
121 path
= Glib::build_filename (get_user_ardour_path(), ".askedaboutsub");
123 ofstream
subsfile (path
.c_str());
127 NagScreen::mark_affirmed_subscriber ()
131 path
= Glib::build_filename (get_user_ardour_path(), ".isubscribe");
133 ofstream
subsfile (path
.c_str());
137 NagScreen::is_subscribed (bool& really
)
143 /* what we'd really like here is a way to query paypal
144 for someone's subscription status. thats a bit complicated
145 so for now, just see if they ever told us they were
146 subscribed. we try to trust our users :)
149 path
= Glib::build_filename (get_user_ardour_path(), ".isubscribe");
150 if (file_test (path
, FILE_TEST_EXISTS
)) {
155 path
= Glib::build_filename (get_user_ardour_path(), ".askedaboutsub");
156 if (file_test (path
, FILE_TEST_EXISTS
)) {
157 /* they never said they were subscribed but they
158 did once express an interest in it.
168 NagScreen::offer_to_donate ()
170 const char* uri
= "http://ardour.org/donate";
172 /* we don't care if it fails */
178 NagScreen::offer_to_subscribe ()
180 const char* uri
= "http://ardour.org/subscribe";
182 if (open_uri (uri
)) {
188 NagScreen::open_uri (const char* uri
)
190 #ifdef HAVE_GTK_OPEN_URI
192 return gtk_open_uri (0, uri
, GDK_CURRENT_TIME
, &err
);
195 std::string command
= "xdg-open ";
197 spawn_command_line_async (command
);
201 extern bool cocoa_open_url (const char*);
202 return cocoa_open_url (uri
);