There's no need for reference counting of PavuApplication. --- src/pavuapplication.cc | 21 ++++++++------------- src/pavuapplication.h | 5 +---- 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/src/pavuapplication.cc b/src/pavuapplication.cc index 3fc874f..b67ec04 100644 --- a/src/pavuapplication.cc +++ b/src/pavuapplication.cc @@ -33,11 +33,6 @@ PavuApplication::PavuApplication() : Gtk::Application("org.pulseaudio.pavucontrol", Gio::ApplicationFlags::APPLICATION_HANDLES_COMMAND_LINE) { } -Glib::RefPtr<PavuApplication> PavuApplication::create() { - return Glib::RefPtr<PavuApplication>(new PavuApplication()); - -} - /* * Create the main window and connect its "on_hide_window" signal to our cleanup * function @@ -112,7 +107,7 @@ static bool get_arg_value(const Glib::RefPtr<Glib::VariantDict>& options, const * This is executed in the first-running process. */ int on_command_line(const Glib::RefPtr<Gio::ApplicationCommandLine>& command_line, - Glib::RefPtr<PavuApplication>& app) + PavuApplication *app) { const auto options = command_line->get_options_dict(); @@ -141,26 +136,26 @@ int main(int argc, char *argv[]) { signal(SIGPIPE, SIG_IGN); /* Create the application */ - auto app = PavuApplication::create(); + auto app = PavuApplication(); /* Add command-line options */ - app->add_main_option_entry( + app.add_main_option_entry( Gio::Application::OptionType::OPTION_TYPE_INT, "tab", 't', _("Select a specific tab on load."), _("number")); - app->add_main_option_entry( + app.add_main_option_entry( Gio::Application::OptionType::OPTION_TYPE_BOOL, "retry", 'r', _("Retry forever if pa quits (every 5 seconds).")); - app->add_main_option_entry( + app.add_main_option_entry( Gio::Application::OptionType::OPTION_TYPE_BOOL, "maximize", 'm', _("Maximize the window.")); - app->add_main_option_entry( + app.add_main_option_entry( Gio::Application::OptionType::OPTION_TYPE_BOOL, "version", 'v', _("Show version.")); @@ -168,7 +163,7 @@ int main(int argc, char *argv[]) { /* Connect to the "on_command_line" signal which is fired * when the application receives command-line arguments */ - app->signal_command_line().connect(sigc::bind(sigc::ptr_fun(&on_command_line), app), false); + app.signal_command_line().connect(sigc::bind(sigc::ptr_fun(&on_command_line), &app), false); /* Run the application. * In the first launched instance, this will return when its window is @@ -177,5 +172,5 @@ int main(int argc, char *argv[]) { * Handling a new request consists of presenting the existing window (and * optionally, select a tab). */ - return app->run(argc, argv); + return app.run(argc, argv); } diff --git a/src/pavuapplication.h b/src/pavuapplication.h index 8ff3f35..4df722f 100644 --- a/src/pavuapplication.h +++ b/src/pavuapplication.h @@ -25,11 +25,8 @@ #include "mainwindow.h" class PavuApplication : public Gtk::Application { -protected: - PavuApplication(); - public: - static Glib::RefPtr<PavuApplication> create(); + PavuApplication(); /* Main window */ MainWindow *mainWindow; -- 2.14.2