[gnote] Update popover when notebooks list changes



commit c0def1d38a6c03283bb292cee6e7e98f46e99bd9
Author: Aurimas Černius <aurisc4 gmail com>
Date:   Sat Dec 26 20:37:25 2015 +0200

    Update popover when notebooks list changes

 src/notebooks/notebooknoteaddin.cpp |   15 +++++++++++++++
 src/notebooks/notebooknoteaddin.hpp |    1 +
 2 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/src/notebooks/notebooknoteaddin.cpp b/src/notebooks/notebooknoteaddin.cpp
index e434b94..fb52e73 100644
--- a/src/notebooks/notebooknoteaddin.cpp
+++ b/src/notebooks/notebooknoteaddin.cpp
@@ -73,6 +73,8 @@ namespace notebooks {
     auto note_win = get_window();
     note_win->signal_foregrounded.connect(sigc::mem_fun(*this, 
&NotebookNoteAddin::on_note_window_foregrounded));
     note_win->signal_backgrounded.connect(sigc::mem_fun(*this, 
&NotebookNoteAddin::on_note_window_backgrounded));
+    NotebookManager::obj().signal_notebook_list_changed
+      .connect(sigc::mem_fun(*this, &NotebookNoteAddin::on_notebooks_changed));
   }
 
 
@@ -203,5 +205,18 @@ namespace notebooks {
   }
 
 
+  void NotebookNoteAddin::on_notebooks_changed()
+  {
+    auto note_win = get_window();
+    if(!note_win) {
+      return;
+    }
+    auto host = dynamic_cast<HasActions*>(note_win->host());
+    if(host) {
+      host->signal_popover_widgets_changed();
+    }
+  }
+
+
 }
 }
diff --git a/src/notebooks/notebooknoteaddin.hpp b/src/notebooks/notebooknoteaddin.hpp
index 189f0a0..28e319f 100644
--- a/src/notebooks/notebooknoteaddin.hpp
+++ b/src/notebooks/notebooknoteaddin.hpp
@@ -51,6 +51,7 @@ namespace notebooks {
     void on_note_window_backgrounded();
     void on_new_notebook_menu_item(const Glib::VariantBase&) const;
     void on_move_to_notebook(const Glib::VariantBase &);
+    void on_notebooks_changed();
     void get_notebook_menu_items(std::list<Gtk::ModelButton*> &) const;
     void update_menu(Gtk::Grid *) const;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]