[gnote] Update export to HTML addin for popover



commit fab85fe5a3b7b5a664200e92acb890bec2ccbbfc
Author: Aurimas Černius <aurisc4 gmail com>
Date:   Sun Jan 3 21:29:27 2016 +0200

    Update export to HTML addin for popover

 src/addins/exporttohtml/exporttohtml.desktop.in.in |    4 +++-
 src/addins/exporttohtml/exporttohtmlnoteaddin.cpp  |   19 ++++++++++++-------
 src/addins/exporttohtml/exporttohtmlnoteaddin.hpp  |   11 +++--------
 3 files changed, 18 insertions(+), 16 deletions(-)
---
diff --git a/src/addins/exporttohtml/exporttohtml.desktop.in.in 
b/src/addins/exporttohtml/exporttohtml.desktop.in.in
index 65f1d38..5aca509 100644
--- a/src/addins/exporttohtml/exporttohtml.desktop.in.in
+++ b/src/addins/exporttohtml/exporttohtml.desktop.in.in
@@ -4,8 +4,10 @@ _Name=Export to HTML
 _Description=Exports individual notes to HTML.
 _Authors=Hubert Figuiere and the Tomboy Project
 Category=Tools
-Version=0.3
+Version=0.4
 DefaultEnabled=false
 Module=exporttohtml
 LibgnoteRelease= LIBGNOTE_RELEASE@
 LibgnoteVersionInfo= LIBGNOTE_VERSION_INFO@
+[Actions]
+actions_void=exporttohtml-export
diff --git a/src/addins/exporttohtml/exporttohtmlnoteaddin.cpp 
b/src/addins/exporttohtml/exporttohtmlnoteaddin.cpp
index 404a05e..e15b1c4 100644
--- a/src/addins/exporttohtml/exporttohtmlnoteaddin.cpp
+++ b/src/addins/exporttohtml/exporttohtmlnoteaddin.cpp
@@ -1,7 +1,7 @@
 /*
  * gnote
  *
- * Copyright (C) 2010-2013 Aurimas Cernius
+ * Copyright (C) 2010-2013,2016 Aurimas Cernius
  * Copyright (C) 2009 Hubert Figuiere
  *
  * This program is free software: you can redistribute it and/or modify
@@ -72,16 +72,21 @@ void ExportToHtmlNoteAddin::shutdown()
 
 void ExportToHtmlNoteAddin::on_note_opened()
 {
-  Glib::RefPtr<gnote::NoteWindow::NonModifyingAction> action =
-    gnote::NoteWindow::NonModifyingAction::create("ExportToHtmlAction", _("Export to HTML"),
-                                                  _("Export note to HTML"));
-  action->signal_activate().connect(
+  register_main_window_action_callback("exporttohtml-export",
     sigc::mem_fun(*this, &ExportToHtmlNoteAddin::export_button_clicked));
-  add_note_action(action, gnote::EXPORT_TO_HTML_ORDER);
 }
 
 
-void ExportToHtmlNoteAddin::export_button_clicked()
+std::map<int, Gtk::Widget*> ExportToHtmlNoteAddin::get_actions_popover_widgets() const
+{
+  auto widgets = NoteAddin::get_actions_popover_widgets();
+  auto button = gnote::utils::create_popover_button("win.exporttohtml-export", _("Export to HTML"));
+  gnote::utils::add_item_to_ordered_map(widgets, gnote::EXPORT_TO_HTML_ORDER, button);
+  return widgets;
+}
+
+
+void ExportToHtmlNoteAddin::export_button_clicked(const Glib::VariantBase&)
 {
   ExportToHtmlDialog dialog(get_note()->get_title() + ".html");
   int response = dialog.run();
diff --git a/src/addins/exporttohtml/exporttohtmlnoteaddin.hpp 
b/src/addins/exporttohtml/exporttohtmlnoteaddin.hpp
index 1b1d327..71c539d 100644
--- a/src/addins/exporttohtml/exporttohtmlnoteaddin.hpp
+++ b/src/addins/exporttohtml/exporttohtmlnoteaddin.hpp
@@ -1,7 +1,7 @@
 /*
  * gnote
  *
- * Copyright (C) 2010,2013 Aurimas Cernius
+ * Copyright (C) 2010,2013,2016 Aurimas Cernius
  * Copyright (C) 2009 Hubert Figuiere
  *
  * This program is free software: you can redistribute it and/or modify
@@ -26,9 +26,6 @@
 #ifndef _EXPORTTOHTML_ADDIN_HPP_
 #define _EXPORTTOHTML_ADDIN_HPP_
 
-#include <gtkmm/imagemenuitem.h>
-
-#include "base/macros.hpp"
 #include "sharp/dynamicmodule.hpp"
 #include "sharp/streamwriter.hpp"
 #include "sharp/xsltransform.hpp"
@@ -59,14 +56,12 @@ public:
   virtual void initialize() override;
   virtual void shutdown() override;
   virtual void on_note_opened() override;
-
-
+  virtual std::map<int, Gtk::Widget*> get_actions_popover_widgets() const override;
 private:
   sharp::XslTransform & get_note_xsl();
-  void export_button_clicked();
+  void export_button_clicked(const Glib::VariantBase&);
   void write_html_for_note (sharp::StreamWriter &, const gnote::Note::Ptr &, bool, bool);
 
-  Gtk::ImageMenuItem * m_item;
   static sharp::XslTransform *s_xsl;
 };
 


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