From 4013d1a167850bb1649d592b24d03f63e19338ef Mon Sep 17 00:00:00 2001 From: Joel Klinghed Date: Wed, 9 Aug 2017 22:50:26 +0200 Subject: Remember main window size --- src/monitor-gui.cc | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/monitor-gui.cc') diff --git a/src/monitor-gui.cc b/src/monitor-gui.cc index eb1f34d..6805814 100644 --- a/src/monitor-gui.cc +++ b/src/monitor-gui.cc @@ -695,6 +695,18 @@ public: selection_(0), modified_(false) { + auto size = main_->config()->get("main-size", nullptr); + if (size) { + char* end = nullptr; + auto w = strtoul(size, &end, 10); + if (w > 0 && end && *end == 'x') { + auto h = strtoul(end + 1, &end, 10); + if (h > 0 && end && *end == '\0') { + main_->resize(w, h); + } + } + } + pem_filter_.emplace_back(); pem_filter_.back().name = "PEM (*.pem)"; pem_filter_.back().masks.emplace_back("*.pem"); @@ -1008,6 +1020,13 @@ public: return true; } + void resize(uint32_t width, uint32_t height) override { + char tmp[50]; + snprintf(tmp, sizeof(tmp), "%lux%lu", static_cast(width), + static_cast(height)); + main_->config()->set("main-size", std::string(tmp)); + } + void selected_row(GuiMain* main, size_t index) override { assert(main_.get() == main); if (selection_content_) { -- cgit v1.2.3-70-g09d2