2013-01-16 13:22:15 -05:00
|
|
|
/*
|
2019-08-02 17:26:43 -04:00
|
|
|
* Copyright (C) 2008-2016 Paul Davis <paul@linuxaudiosystems.com>
|
|
|
|
* Copyright (C) 2009-2012 David Robillard <d@drobilla.net>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
2013-01-16 13:22:15 -05:00
|
|
|
|
2009-07-12 20:26:28 -04:00
|
|
|
#ifdef WAF_BUILD
|
|
|
|
#include "gtk2ardour-config.h"
|
|
|
|
#endif
|
|
|
|
|
2015-10-05 15:51:52 -04:00
|
|
|
#include "pbd/gstdio_compat.h"
|
2008-12-12 09:43:24 -05:00
|
|
|
#include <gtkmm/stock.h>
|
|
|
|
|
2010-03-16 11:33:04 -04:00
|
|
|
#include "pbd/openuri.h"
|
|
|
|
|
2009-02-25 13:26:51 -05:00
|
|
|
#include "ardour/filesystem_paths.h"
|
2013-03-18 16:56:05 -04:00
|
|
|
#include "ardour/rc_configuration.h"
|
2008-12-12 09:43:24 -05:00
|
|
|
|
|
|
|
#include "nag.h"
|
2016-07-14 14:44:52 -04:00
|
|
|
#include "pbd/i18n.h"
|
2008-12-12 09:43:24 -05:00
|
|
|
|
|
|
|
using namespace ARDOUR;
|
|
|
|
using namespace std;
|
|
|
|
using namespace Glib;
|
|
|
|
using namespace Gtk;
|
|
|
|
|
2009-07-21 11:55:17 -04:00
|
|
|
NagScreen::NagScreen (std::string /*context*/, bool maybe_sub)
|
2013-02-05 13:18:35 -05:00
|
|
|
: ArdourDialog (string_compose (_("Support %1 Development"), PROGRAM_NAME), true)
|
2008-12-12 09:43:24 -05:00
|
|
|
, donate_button (button_group, _("I'd like to make a one-time donation"))
|
|
|
|
, subscribe_button (button_group, _("Tell me more about becoming a subscriber"))
|
|
|
|
, existing_button (button_group, _("I'm already a subscriber!"))
|
|
|
|
, next_time_button (button_group, _("Ask about this the next time I export"))
|
|
|
|
, never_again_button (button_group, _("Never ever ask me about this again"))
|
|
|
|
{
|
|
|
|
if (maybe_sub) {
|
|
|
|
message.set_text (_("Congratulations on your session export.\n\n\
|
|
|
|
It looks as if you may already be a subscriber. If so, thanks, and sorry\n\
|
|
|
|
to bother you again about this - I'm working on improving our subscriber system\n\
|
|
|
|
so that I don't have to keep annoying you with this message.\n\n\
|
|
|
|
If you're not a subscriber, perhaps you might consider supporting my work\n\
|
|
|
|
on Ardour with either a one-time donation or subscription. Nothing will \n\
|
|
|
|
happen if you choose not to do so. However Ardour's continuing development\n\
|
|
|
|
relies on a stable, sustainable income stream. Thanks for using Ardour!"));
|
|
|
|
} else {
|
|
|
|
message.set_text (_("Congratulations on your session export.\n\n\
|
|
|
|
I hope you find Ardour a useful tool. I'd like to ask you to consider supporting\n\
|
|
|
|
its development with either a one-time donation or subscription. Nothing\n\
|
|
|
|
will happen if you choose not to do so. However Ardour's continuing development\n\
|
|
|
|
relies on a stable, sustainable income stream. Thanks for using Ardour!"));
|
|
|
|
}
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-12-12 09:43:24 -05:00
|
|
|
button_box.pack_start (donate_button);
|
|
|
|
button_box.pack_start (subscribe_button);
|
|
|
|
button_box.pack_start (existing_button);
|
|
|
|
button_box.pack_start (next_time_button);
|
|
|
|
button_box.pack_start (never_again_button);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-12-12 09:43:24 -05:00
|
|
|
get_vbox()->set_spacing (12);
|
|
|
|
get_vbox()->pack_start (message);
|
|
|
|
get_vbox()->pack_start (button_box);
|
|
|
|
|
|
|
|
set_border_width (12);
|
|
|
|
add_button (Stock::OK, RESPONSE_ACCEPT);
|
|
|
|
}
|
|
|
|
|
|
|
|
NagScreen::~NagScreen ()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
NagScreen::nag ()
|
|
|
|
{
|
|
|
|
show_all ();
|
|
|
|
|
|
|
|
int response = run ();
|
|
|
|
|
|
|
|
hide ();
|
|
|
|
|
|
|
|
switch (response) {
|
|
|
|
case RESPONSE_ACCEPT:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (donate_button.get_active()) {
|
|
|
|
offer_to_donate ();
|
|
|
|
} else if (subscribe_button.get_active()) {
|
|
|
|
offer_to_subscribe ();
|
|
|
|
} else if (never_again_button.get_active ()) {
|
|
|
|
mark_never_again ();
|
|
|
|
} else if (existing_button.get_active ()) {
|
|
|
|
mark_affirmed_subscriber ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
NagScreen*
|
|
|
|
NagScreen::maybe_nag (std::string why)
|
|
|
|
{
|
2010-09-14 12:51:02 -04:00
|
|
|
std::string path;
|
2008-12-12 09:43:24 -05:00
|
|
|
bool really_subscribed;
|
|
|
|
bool maybe_subscribed;
|
|
|
|
|
2012-06-23 01:06:54 -04:00
|
|
|
path = Glib::build_filename (user_config_directory(), ".nevernag");
|
2008-12-12 09:43:24 -05:00
|
|
|
|
|
|
|
if (Glib::file_test (path, Glib::FILE_TEST_EXISTS)) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
maybe_subscribed = is_subscribed (really_subscribed);
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-12-12 09:43:24 -05:00
|
|
|
if (really_subscribed) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return new NagScreen (why, maybe_subscribed);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
NagScreen::mark_never_again ()
|
|
|
|
{
|
2010-09-14 12:51:02 -04:00
|
|
|
std::string path;
|
2008-12-12 09:43:24 -05:00
|
|
|
|
2012-06-23 01:06:54 -04:00
|
|
|
path = Glib::build_filename (user_config_directory(), ".nevernag");
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2015-10-05 15:51:52 -04:00
|
|
|
g_file_set_contents (path.c_str(), "", -1, NULL);
|
2008-12-12 09:43:24 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
NagScreen::mark_subscriber ()
|
|
|
|
{
|
2010-09-14 12:51:02 -04:00
|
|
|
std::string path;
|
2008-12-12 09:43:24 -05:00
|
|
|
|
2012-06-23 01:06:54 -04:00
|
|
|
path = Glib::build_filename (user_config_directory(), ".askedaboutsub");
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2015-10-05 15:51:52 -04:00
|
|
|
g_file_set_contents (path.c_str(), "", -1, NULL);
|
2008-12-12 09:43:24 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
NagScreen::mark_affirmed_subscriber ()
|
|
|
|
{
|
2010-09-14 12:51:02 -04:00
|
|
|
std::string path;
|
2008-12-12 09:43:24 -05:00
|
|
|
|
2012-06-23 01:06:54 -04:00
|
|
|
path = Glib::build_filename (user_config_directory(), ".isubscribe");
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2015-10-05 15:51:52 -04:00
|
|
|
g_file_set_contents (path.c_str(), "", -1, NULL);
|
2008-12-12 09:43:24 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
NagScreen::is_subscribed (bool& really)
|
|
|
|
{
|
2010-09-14 12:51:02 -04:00
|
|
|
std::string path;
|
2008-12-12 09:43:24 -05:00
|
|
|
|
|
|
|
really = false;
|
|
|
|
|
2009-10-14 12:10:01 -04:00
|
|
|
/* what we'd really like here is a way to query paypal
|
Fix typos in gtk2_ardour/ directory
Found via `codespell -q 3 -S *.po,./share/patchfiles,./libs -L ba,buss,busses,doubleclick,hsi,ontop,ro,seh,siz,sur,te,trough,ue`
2022-01-26 12:35:38 -05:00
|
|
|
for someone's subscription status. that's a bit complicated
|
2008-12-12 09:43:24 -05:00
|
|
|
so for now, just see if they ever told us they were
|
|
|
|
subscribed. we try to trust our users :)
|
|
|
|
*/
|
|
|
|
|
2012-06-23 01:06:54 -04:00
|
|
|
path = Glib::build_filename (user_config_directory(), ".isubscribe");
|
2008-12-12 09:43:24 -05:00
|
|
|
if (file_test (path, FILE_TEST_EXISTS)) {
|
|
|
|
really = true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-06-23 01:06:54 -04:00
|
|
|
path = Glib::build_filename (user_config_directory(), ".askedaboutsub");
|
2008-12-12 09:43:24 -05:00
|
|
|
if (file_test (path, FILE_TEST_EXISTS)) {
|
|
|
|
/* they never said they were subscribed but they
|
|
|
|
did once express an interest in it.
|
|
|
|
*/
|
|
|
|
really = false;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
NagScreen::offer_to_donate ()
|
|
|
|
{
|
|
|
|
/* we don't care if it fails */
|
|
|
|
|
2017-07-01 12:42:24 -04:00
|
|
|
PBD::open_uri (Config->get_donate_url());
|
2008-12-12 09:43:24 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
NagScreen::offer_to_subscribe ()
|
|
|
|
{
|
2022-10-23 23:00:44 -04:00
|
|
|
const char* uri = "https://ardour.org/subscribe";
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2010-03-16 11:33:04 -04:00
|
|
|
if (PBD::open_uri (uri)) {
|
2008-12-12 09:43:24 -05:00
|
|
|
mark_subscriber ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|