Add a --maximize command line option

This commit is contained in:
Pierre Zurek 2014-02-25 17:36:51 +01:00 committed by Tanu Kaskinen
parent 35e844d2b2
commit dc4bdf091f
3 changed files with 12 additions and 3 deletions

View File

@ -137,7 +137,7 @@ MainWindow::MainWindow(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>
connectingLabel->show(); connectingLabel->show();
} }
MainWindow* MainWindow::create() { MainWindow* MainWindow::create(bool maximize) {
MainWindow* w; MainWindow* w;
Glib::RefPtr<Gtk::Builder> x = Gtk::Builder::create(); Glib::RefPtr<Gtk::Builder> x = Gtk::Builder::create();
x->add_from_file(GLADE_FILE, "liststore1"); 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, "liststore4");
x->add_from_file(GLADE_FILE, "mainWindow"); x->add_from_file(GLADE_FILE, "mainWindow");
x->get_widget_derived("mainWindow", w); x->get_widget_derived("mainWindow", w);
if (w && maximize)
w->maximize();
return w; return w;
} }

View File

@ -37,7 +37,7 @@ class RoleWidget;
class MainWindow : public Gtk::Window { class MainWindow : public Gtk::Window {
public: public:
MainWindow(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& x); MainWindow(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& x);
static MainWindow* create(); static MainWindow* create(bool maximize);
virtual ~MainWindow(); virtual ~MainWindow();
void updateCard(const pa_card_info &info); void updateCard(const pa_card_info &info);

View File

@ -664,6 +664,13 @@ int main(int argc, char *argv[]) {
entry2.set_description(_("Retry forever if pa quits (every 5 seconds).")); entry2.set_description(_("Retry forever if pa quits (every 5 seconds)."));
group.add_entry(entry2, retry); 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); options.set_main_group(group);
try { try {
@ -671,7 +678,7 @@ int main(int argc, char *argv[]) {
ca_context_set_driver(ca_gtk_context_get(), "pulse"); 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()); pa_glib_mainloop *m = pa_glib_mainloop_new(g_main_context_default());
g_assert(m); g_assert(m);