remove unnecessary RefPtr wrapping of PavuApplication

There's no need for reference counting of PavuApplication.
This commit is contained in:
Tanu Kaskinen 2017-11-01 13:47:05 +02:00
parent f6ce4fb8db
commit 107a8dd305
2 changed files with 9 additions and 17 deletions

View File

@ -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);
}

View File

@ -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;