2 Copyright (C) 2012 Paul Davis
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 #include "gtk2ardour-config.h"
25 #include <gtkmm/stock.h>
27 #include "pbd/openuri.h"
29 #include "ardour/filesystem_paths.h"
34 using namespace ARDOUR;
39 NagScreen::NagScreen (std::string /*context*/, bool maybe_sub)
40 : ArdourDialog (_("Support Ardour Development"), true)
41 , donate_button (button_group, _("I'd like to make a one-time donation"))
42 , subscribe_button (button_group, _("Tell me more about becoming a subscriber"))
43 , existing_button (button_group, _("I'm already a subscriber!"))
44 , next_time_button (button_group, _("Ask about this the next time I export"))
45 , never_again_button (button_group, _("Never ever ask me about this again"))
48 message.set_text (_("Congratulations on your session export.\n\n\
49 It looks as if you may already be a subscriber. If so, thanks, and sorry\n\
50 to bother you again about this - I'm working on improving our subscriber system\n\
51 so that I don't have to keep annoying you with this message.\n\n\
52 If you're not a subscriber, perhaps you might consider supporting my work\n\
53 on Ardour with either a one-time donation or subscription. Nothing will \n\
54 happen if you choose not to do so. However Ardour's continuing development\n\
55 relies on a stable, sustainable income stream. Thanks for using Ardour!"));
57 message.set_text (_("Congratulations on your session export.\n\n\
58 I hope you find Ardour a useful tool. I'd like to ask you to consider supporting\n\
59 its development with either a one-time donation or subscription. Nothing\n\
60 will happen if you choose not to do so. However Ardour's continuing development\n\
61 relies on a stable, sustainable income stream. Thanks for using Ardour!"));
64 button_box.pack_start (donate_button);
65 button_box.pack_start (subscribe_button);
66 button_box.pack_start (existing_button);
67 button_box.pack_start (next_time_button);
68 button_box.pack_start (never_again_button);
70 get_vbox()->set_spacing (12);
71 get_vbox()->pack_start (message);
72 get_vbox()->pack_start (button_box);
74 set_border_width (12);
75 add_button (Stock::OK, RESPONSE_ACCEPT);
78 NagScreen::~NagScreen ()
87 int response = run ();
98 if (donate_button.get_active()) {
100 } else if (subscribe_button.get_active()) {
101 offer_to_subscribe ();
102 } else if (never_again_button.get_active ()) {
104 } else if (existing_button.get_active ()) {
105 mark_affirmed_subscriber ();
110 NagScreen::maybe_nag (std::string why)
113 bool really_subscribed;
114 bool maybe_subscribed;
116 path = Glib::build_filename (user_config_directory(), ".nevernag");
118 if (Glib::file_test (path, Glib::FILE_TEST_EXISTS)) {
122 maybe_subscribed = is_subscribed (really_subscribed);
124 if (really_subscribed) {
128 return new NagScreen (why, maybe_subscribed);
132 NagScreen::mark_never_again ()
136 path = Glib::build_filename (user_config_directory(), ".nevernag");
138 ofstream nagfile (path.c_str());
142 NagScreen::mark_subscriber ()
146 path = Glib::build_filename (user_config_directory(), ".askedaboutsub");
148 ofstream subsfile (path.c_str());
152 NagScreen::mark_affirmed_subscriber ()
156 path = Glib::build_filename (user_config_directory(), ".isubscribe");
158 ofstream subsfile (path.c_str());
162 NagScreen::is_subscribed (bool& really)
168 /* what we'd really like here is a way to query paypal
169 for someone's subscription status. thats a bit complicated
170 so for now, just see if they ever told us they were
171 subscribed. we try to trust our users :)
174 path = Glib::build_filename (user_config_directory(), ".isubscribe");
175 if (file_test (path, FILE_TEST_EXISTS)) {
180 path = Glib::build_filename (user_config_directory(), ".askedaboutsub");
181 if (file_test (path, FILE_TEST_EXISTS)) {
182 /* they never said they were subscribed but they
183 did once express an interest in it.
193 NagScreen::offer_to_donate ()
195 const char* uri = "http://ardour.org/donate";
197 /* we don't care if it fails */
203 NagScreen::offer_to_subscribe ()
205 const char* uri = "http://ardour.org/subscribe";
207 if (PBD::open_uri (uri)) {