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"
24 #include "pbd/gstdio_compat.h"
25 #include <gtkmm/stock.h>
27 #include "pbd/openuri.h"
29 #include "ardour/filesystem_paths.h"
30 #include "ardour/rc_configuration.h"
35 using namespace ARDOUR;
40 NagScreen::NagScreen (std::string /*context*/, bool maybe_sub)
41 : ArdourDialog (string_compose (_("Support %1 Development"), PROGRAM_NAME), true)
42 , donate_button (button_group, _("I'd like to make a one-time donation"))
43 , subscribe_button (button_group, _("Tell me more about becoming a subscriber"))
44 , existing_button (button_group, _("I'm already a subscriber!"))
45 , next_time_button (button_group, _("Ask about this the next time I export"))
46 , never_again_button (button_group, _("Never ever ask me about this again"))
49 message.set_text (_("Congratulations on your session export.\n\n\
50 It looks as if you may already be a subscriber. If so, thanks, and sorry\n\
51 to bother you again about this - I'm working on improving our subscriber system\n\
52 so that I don't have to keep annoying you with this message.\n\n\
53 If you're not a subscriber, perhaps you might consider supporting my work\n\
54 on Ardour with either a one-time donation or subscription. Nothing will \n\
55 happen if you choose not to do so. However Ardour's continuing development\n\
56 relies on a stable, sustainable income stream. Thanks for using Ardour!"));
58 message.set_text (_("Congratulations on your session export.\n\n\
59 I hope you find Ardour a useful tool. I'd like to ask you to consider supporting\n\
60 its development with either a one-time donation or subscription. Nothing\n\
61 will happen if you choose not to do so. However Ardour's continuing development\n\
62 relies on a stable, sustainable income stream. Thanks for using Ardour!"));
65 button_box.pack_start (donate_button);
66 button_box.pack_start (subscribe_button);
67 button_box.pack_start (existing_button);
68 button_box.pack_start (next_time_button);
69 button_box.pack_start (never_again_button);
71 get_vbox()->set_spacing (12);
72 get_vbox()->pack_start (message);
73 get_vbox()->pack_start (button_box);
75 set_border_width (12);
76 add_button (Stock::OK, RESPONSE_ACCEPT);
79 NagScreen::~NagScreen ()
88 int response = run ();
99 if (donate_button.get_active()) {
101 } else if (subscribe_button.get_active()) {
102 offer_to_subscribe ();
103 } else if (never_again_button.get_active ()) {
105 } else if (existing_button.get_active ()) {
106 mark_affirmed_subscriber ();
111 NagScreen::maybe_nag (std::string why)
114 bool really_subscribed;
115 bool maybe_subscribed;
117 path = Glib::build_filename (user_config_directory(), ".nevernag");
119 if (Glib::file_test (path, Glib::FILE_TEST_EXISTS)) {
123 maybe_subscribed = is_subscribed (really_subscribed);
125 if (really_subscribed) {
129 return new NagScreen (why, maybe_subscribed);
133 NagScreen::mark_never_again ()
137 path = Glib::build_filename (user_config_directory(), ".nevernag");
139 g_file_set_contents (path.c_str(), "", -1, NULL);
143 NagScreen::mark_subscriber ()
147 path = Glib::build_filename (user_config_directory(), ".askedaboutsub");
149 g_file_set_contents (path.c_str(), "", -1, NULL);
153 NagScreen::mark_affirmed_subscriber ()
157 path = Glib::build_filename (user_config_directory(), ".isubscribe");
159 g_file_set_contents (path.c_str(), "", -1, NULL);
163 NagScreen::is_subscribed (bool& really)
169 /* what we'd really like here is a way to query paypal
170 for someone's subscription status. thats a bit complicated
171 so for now, just see if they ever told us they were
172 subscribed. we try to trust our users :)
175 path = Glib::build_filename (user_config_directory(), ".isubscribe");
176 if (file_test (path, FILE_TEST_EXISTS)) {
181 path = Glib::build_filename (user_config_directory(), ".askedaboutsub");
182 if (file_test (path, FILE_TEST_EXISTS)) {
183 /* they never said they were subscribed but they
184 did once express an interest in it.
194 NagScreen::offer_to_donate ()
196 /* we don't care if it fails */
198 PBD::open_uri (Config->get_donate_url());
202 NagScreen::offer_to_subscribe ()
204 const char* uri = "http://ardour.org/subscribe";
206 if (PBD::open_uri (uri)) {