[gnote] Add widgets from addins to note popover



commit 953aad1883f1da0ce7cdf63cf2c877619ce8d16e
Author: Aurimas Černius <aurisc4 gmail com>
Date:   Sat Dec 12 20:21:24 2015 +0200

    Add widgets from addins to note popover

 src/notewindow.cpp |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/src/notewindow.cpp b/src/notewindow.cpp
index 65b8b5e..f553499 100644
--- a/src/notewindow.cpp
+++ b/src/notewindow.cpp
@@ -32,6 +32,7 @@
 #include <gtkmm/separatormenuitem.h>
 
 #include "debug.hpp"
+#include "addinmanager.hpp"
 #include "iconmanager.hpp"
 #include "mainwindow.hpp"
 #include "note.hpp"
@@ -305,9 +306,23 @@ namespace gnote {
 
   std::vector<Gtk::Widget*> NoteWindow::get_popover_widgets()
   {
+    std::map<int, Gtk::Widget*> widget_map;
+    NoteManager & manager = static_cast<NoteManager&>(m_note.manager());
+    Note::Ptr note = std::dynamic_pointer_cast<Note>(m_note.shared_from_this());
+    FOREACH(NoteAddin *addin, manager.get_addin_manager().get_note_addins(note)) {
+      utils::merge_ordered_maps(widget_map, addin->get_actions_popover_widgets());
+    }
+
     std::vector<Gtk::Widget*> widgets;
+    for(std::map<int, Gtk::Widget*>::iterator iter = widget_map.begin();
+        iter != widget_map.end(); ++iter) {
+      widgets.push_back(iter->second);
+    }
+
     widgets.push_back(utils::create_popover_button("win.important-note", _("Is Important")));
+    widgets.push_back(NULL);
     widgets.push_back(utils::create_popover_button("win.delete-note", _("_Delete")));
+
     return widgets;
   }
 


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