diff options
Diffstat (limited to 'src/gui_gtk.cc')
| -rw-r--r-- | src/gui_gtk.cc | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/gui_gtk.cc b/src/gui_gtk.cc index 2a37306..2af33e2 100644 --- a/src/gui_gtk.cc +++ b/src/gui_gtk.cc @@ -639,6 +639,9 @@ public: bool exit() override; void set_title(std::string const& title) override; + std::string const& title() const override { + return title_; + } void show(GuiWindow* window) override; @@ -882,7 +885,7 @@ class GtkGuiAbout : public virtual GuiAbout, public GtkGuiWindow { public: GtkGuiAbout(std::string const& title, std::string const& version, std::vector<std::string> const& authors) - : about_(GTK_ABOUT_DIALOG(gtk_about_dialog_new())) { + : title_(title), about_(GTK_ABOUT_DIALOG(gtk_about_dialog_new())) { gtk_about_dialog_set_program_name(about_, title.c_str()); gtk_about_dialog_set_version(about_, version.c_str()); std::vector<std::string> tmp; @@ -915,8 +918,12 @@ public: } void set_title(std::string const& title) override { + title_ = title; GtkGuiWindow::set_title(title); } + std::string const& title() const override { + return title_; + } void add_listener(GuiAbout::Listener* listener) override { observers_.insert(listener); @@ -927,6 +934,7 @@ public: } private: + std::string title_; GtkAboutDialog* about_; Observers<GuiAbout::Listener*> observers_; }; @@ -946,6 +954,10 @@ public: GtkGuiWindow::set_title(title); } + std::string const& title() const override { + return title_; + } + void* impl() const override { return dialog_; } @@ -1508,6 +1520,9 @@ public: title_ = title; GtkGuiWindow::set_title(title); } + std::string const& title() const override { + return title_; + } void set_text(AttributedText const* text) override { if (!text) { @@ -1734,6 +1749,7 @@ void main_app_activate(GApplication* g_app) { gtk_application_set_menubar(GTK_APPLICATION(app), menu->model()); } auto win = main_app_window_new(app); + gtk_window_set_title(GTK_WINDOW(win), app->main_->title().c_str()); gtk_window_present(GTK_WINDOW(win)); app->main_->sync_split(); @@ -1747,6 +1763,7 @@ void main_app_open(GApplication* app, GFile** files, gint n_files, auto windows = gtk_application_get_windows(GTK_APPLICATION(app)); auto win = windows ? MAIN_APP_WINDOW(windows->data) : main_app_window_new(MAIN_APP(app)); + gtk_window_set_title(GTK_WINDOW(win), MAIN_APP(app)->main_->title().c_str()); for (auto i = 0; i < n_files; i++) { main_app_window_open(win, files[i]); } |
