remove unnecessary RefPtr wrapping of PavuApplication
There's no need for reference counting of PavuApplication.
This commit is contained in:
parent
f6ce4fb8db
commit
107a8dd305
|
@ -33,11 +33,6 @@
|
||||||
PavuApplication::PavuApplication() : Gtk::Application("org.pulseaudio.pavucontrol", Gio::ApplicationFlags::APPLICATION_HANDLES_COMMAND_LINE) {
|
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
|
* Create the main window and connect its "on_hide_window" signal to our cleanup
|
||||||
* function
|
* 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.
|
* This is executed in the first-running process.
|
||||||
*/
|
*/
|
||||||
int on_command_line(const Glib::RefPtr<Gio::ApplicationCommandLine>& command_line,
|
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();
|
const auto options = command_line->get_options_dict();
|
||||||
|
|
||||||
|
@ -141,26 +136,26 @@ int main(int argc, char *argv[]) {
|
||||||
signal(SIGPIPE, SIG_IGN);
|
signal(SIGPIPE, SIG_IGN);
|
||||||
|
|
||||||
/* Create the application */
|
/* Create the application */
|
||||||
auto app = PavuApplication::create();
|
auto app = PavuApplication();
|
||||||
|
|
||||||
/* Add command-line options */
|
/* Add command-line options */
|
||||||
app->add_main_option_entry(
|
app.add_main_option_entry(
|
||||||
Gio::Application::OptionType::OPTION_TYPE_INT,
|
Gio::Application::OptionType::OPTION_TYPE_INT,
|
||||||
"tab", 't',
|
"tab", 't',
|
||||||
_("Select a specific tab on load."),
|
_("Select a specific tab on load."),
|
||||||
_("number"));
|
_("number"));
|
||||||
|
|
||||||
app->add_main_option_entry(
|
app.add_main_option_entry(
|
||||||
Gio::Application::OptionType::OPTION_TYPE_BOOL,
|
Gio::Application::OptionType::OPTION_TYPE_BOOL,
|
||||||
"retry", 'r',
|
"retry", 'r',
|
||||||
_("Retry forever if pa quits (every 5 seconds)."));
|
_("Retry forever if pa quits (every 5 seconds)."));
|
||||||
|
|
||||||
app->add_main_option_entry(
|
app.add_main_option_entry(
|
||||||
Gio::Application::OptionType::OPTION_TYPE_BOOL,
|
Gio::Application::OptionType::OPTION_TYPE_BOOL,
|
||||||
"maximize", 'm',
|
"maximize", 'm',
|
||||||
_("Maximize the window."));
|
_("Maximize the window."));
|
||||||
|
|
||||||
app->add_main_option_entry(
|
app.add_main_option_entry(
|
||||||
Gio::Application::OptionType::OPTION_TYPE_BOOL,
|
Gio::Application::OptionType::OPTION_TYPE_BOOL,
|
||||||
"version", 'v',
|
"version", 'v',
|
||||||
_("Show version."));
|
_("Show version."));
|
||||||
|
@ -168,7 +163,7 @@ int main(int argc, char *argv[]) {
|
||||||
/* Connect to the "on_command_line" signal which is fired
|
/* Connect to the "on_command_line" signal which is fired
|
||||||
* when the application receives command-line arguments
|
* 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.
|
/* Run the application.
|
||||||
* In the first launched instance, this will return when its window is
|
* 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
|
* Handling a new request consists of presenting the existing window (and
|
||||||
* optionally, select a tab).
|
* optionally, select a tab).
|
||||||
*/
|
*/
|
||||||
return app->run(argc, argv);
|
return app.run(argc, argv);
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,11 +25,8 @@
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
|
|
||||||
class PavuApplication : public Gtk::Application {
|
class PavuApplication : public Gtk::Application {
|
||||||
protected:
|
|
||||||
PavuApplication();
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static Glib::RefPtr<PavuApplication> create();
|
PavuApplication();
|
||||||
|
|
||||||
/* Main window */
|
/* Main window */
|
||||||
MainWindow *mainWindow;
|
MainWindow *mainWindow;
|
||||||
|
|
Loading…
Reference in New Issue