From ca6b164ab34dfc73d5a2acdde22fd19e3f5336d7 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Tue, 16 Dec 2014 10:12:57 -0500 Subject: [PATCH] remove post-export nag screen (an ardour-only feature) --- gtk2_ardour/export_dialog.cc | 11 +- gtk2_ardour/nag.cc | 210 ----------------------------------- gtk2_ardour/nag.h | 57 ---------- gtk2_ardour/wscript | 1 - 4 files changed, 1 insertion(+), 278 deletions(-) delete mode 100644 gtk2_ardour/nag.cc delete mode 100644 gtk2_ardour/nag.h diff --git a/gtk2_ardour/export_dialog.cc b/gtk2_ardour/export_dialog.cc index 332909b102..de09d0dadd 100644 --- a/gtk2_ardour/export_dialog.cc +++ b/gtk2_ardour/export_dialog.cc @@ -30,7 +30,6 @@ #include "waves_message_dialog.h" #include "export_dialog.h" #include "gui_thread.h" -#include "nag.h" #include "i18n.h" @@ -323,15 +322,7 @@ ExportDialog::show_progress () } } - if (!status->aborted()) { - - NagScreen* ns = NagScreen::maybe_nag (_("export")); - - if (ns) { - ns->nag (); - delete ns; - } - } else { + if (status->aborted()) { notify_errors (); } diff --git a/gtk2_ardour/nag.cc b/gtk2_ardour/nag.cc deleted file mode 100644 index 944939c937..0000000000 --- a/gtk2_ardour/nag.cc +++ /dev/null @@ -1,210 +0,0 @@ -/* - Copyright (C) 2012 Paul Davis - - 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., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -#ifdef WAF_BUILD -#include "gtk2ardour-config.h" -#endif - -#include -#include - -#include "pbd/openuri.h" - -#include "ardour/filesystem_paths.h" -#include "ardour/rc_configuration.h" - -#include "nag.h" -#include "i18n.h" - -using namespace ARDOUR; -using namespace std; -using namespace Glib; -using namespace Gtk; - -NagScreen::NagScreen (std::string /*context*/, bool maybe_sub) - : ArdourDialog (string_compose (_("Support %1 Development"), PROGRAM_NAME), true) - , 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!")); - } - - 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); - - get_vbox()->set_spacing (12); - get_vbox()->pack_start (message); - get_vbox()->pack_start (button_box); - - set_border_width (12); - add_button ("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) -{ - std::string path; - bool really_subscribed; - bool maybe_subscribed; - - path = Glib::build_filename (user_config_directory(), ".nevernag"); - - if (Glib::file_test (path, Glib::FILE_TEST_EXISTS)) { - return 0; - } - - maybe_subscribed = is_subscribed (really_subscribed); - - if (really_subscribed) { - return 0; - } - - return new NagScreen (why, maybe_subscribed); -} - -void -NagScreen::mark_never_again () -{ - std::string path; - - path = Glib::build_filename (user_config_directory(), ".nevernag"); - - ofstream nagfile (path.c_str()); -} - -void -NagScreen::mark_subscriber () -{ - std::string path; - - path = Glib::build_filename (user_config_directory(), ".askedaboutsub"); - - ofstream subsfile (path.c_str()); -} - -void -NagScreen::mark_affirmed_subscriber () -{ - std::string path; - - path = Glib::build_filename (user_config_directory(), ".isubscribe"); - - ofstream subsfile (path.c_str()); -} - -bool -NagScreen::is_subscribed (bool& really) -{ - std::string path; - - really = false; - - /* what we'd really like here is a way to query paypal - for someone's subscription status. thats a bit complicated - so for now, just see if they ever told us they were - subscribed. we try to trust our users :) - */ - - path = Glib::build_filename (user_config_directory(), ".isubscribe"); - if (file_test (path, FILE_TEST_EXISTS)) { - really = true; - return true; - } - - path = Glib::build_filename (user_config_directory(), ".askedaboutsub"); - 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 */ - - PBD::open_uri (Config->get_donate_url()); -} - -void -NagScreen::offer_to_subscribe () -{ - const char* uri = "http://ardour.org/subscribe"; - - if (PBD::open_uri (uri)) { - mark_subscriber (); - } -} - diff --git a/gtk2_ardour/nag.h b/gtk2_ardour/nag.h deleted file mode 100644 index fa453ac2ba..0000000000 --- a/gtk2_ardour/nag.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - Copyright (C) 2012 Paul Davis - - 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., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -#ifndef __gtk_ardour_nag_h__ -#define __gtk_ardour_nag_h__ - -#include "ardour_dialog.h" - -#include -#include -#include - -class NagScreen : public ArdourDialog -{ - public: - ~NagScreen(); - - static NagScreen* maybe_nag (std::string context); - void nag (); - - private: - NagScreen (std::string context, bool maybe_subscriber); - - Gtk::Label message; - Gtk::VButtonBox button_box; - Gtk::RadioButtonGroup button_group; - Gtk::RadioButton donate_button; - Gtk::RadioButton subscribe_button; - Gtk::RadioButton existing_button; - Gtk::RadioButton next_time_button; - Gtk::RadioButton never_again_button; - - void mark_never_again (); - void mark_subscriber (); - void mark_affirmed_subscriber (); - void offer_to_donate (); - void offer_to_subscribe (); - static bool is_subscribed (bool& really); -}; - -#endif /* __gtk_ardour_nag_h__ */ diff --git a/gtk2_ardour/wscript b/gtk2_ardour/wscript index c51b99d416..8bde115c22 100644 --- a/gtk2_ardour/wscript +++ b/gtk2_ardour/wscript @@ -171,7 +171,6 @@ gtk2_ardour_sources = [ 'mono_panner.cc', 'mono_panner_editor.cc', 'mouse_cursors.cc', - 'nag.cc', 'new_plugin_preset_dialog.cc', 'normalize_dialog.cc', 'note.cc',