[pulseaudio-discuss] [pavucontrol PATCH] Add a --maximize command line option

Pierre Zurek pierrezurek at gmail.com
Tue Feb 25 08:36:51 PST 2014


---
 src/mainwindow.cc  | 4 +++-
 src/mainwindow.h   | 2 +-
 src/pavucontrol.cc | 9 ++++++++-
 3 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/src/mainwindow.cc b/src/mainwindow.cc
index fc378c4..5a42318 100644
--- a/src/mainwindow.cc
+++ b/src/mainwindow.cc
@@ -137,7 +137,7 @@ MainWindow::MainWindow(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>
     connectingLabel->show();
 }
 
-MainWindow* MainWindow::create() {
+MainWindow* MainWindow::create(bool maximize) {
     MainWindow* w;
     Glib::RefPtr<Gtk::Builder> x = Gtk::Builder::create();
     x->add_from_file(GLADE_FILE, "liststore1");
@@ -146,6 +146,8 @@ MainWindow* MainWindow::create() {
     x->add_from_file(GLADE_FILE, "liststore4");
     x->add_from_file(GLADE_FILE, "mainWindow");
     x->get_widget_derived("mainWindow", w);
+    if (w && maximize)
+        w->maximize();
     return w;
 }
 
diff --git a/src/mainwindow.h b/src/mainwindow.h
index 8f779b3..5c501f7 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -37,7 +37,7 @@ class RoleWidget;
 class MainWindow : public Gtk::Window {
 public:
     MainWindow(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& x);
-    static MainWindow* create();
+    static MainWindow* create(bool maximize);
     virtual ~MainWindow();
 
     void updateCard(const pa_card_info &info);
diff --git a/src/pavucontrol.cc b/src/pavucontrol.cc
index 72ec980..c1019b6 100644
--- a/src/pavucontrol.cc
+++ b/src/pavucontrol.cc
@@ -664,6 +664,13 @@ int main(int argc, char *argv[]) {
     entry2.set_description(_("Retry forever if pa quits (every 5 seconds)."));
     group.add_entry(entry2, retry);
 
+    bool maximize = false;
+    Glib::OptionEntry entry3;
+    entry3.set_long_name("maximize");
+    entry3.set_short_name('m');
+    entry3.set_description(_("Maximize the window."));
+    group.add_entry(entry3, maximize);
+
     options.set_main_group(group);
 
     try {
@@ -671,7 +678,7 @@ int main(int argc, char *argv[]) {
 
         ca_context_set_driver(ca_gtk_context_get(), "pulse");
 
-        MainWindow* mainWindow = MainWindow::create();
+        MainWindow* mainWindow = MainWindow::create(maximize);
 
         pa_glib_mainloop *m = pa_glib_mainloop_new(g_main_context_default());
         g_assert(m);
-- 
1.8.3.2



More information about the pulseaudio-discuss mailing list