[gnote] Add support for string state actions in main window



commit ec47e112f5e2d52e35e222311c2cf6bd811e1470
Author: Aurimas Černius <aurisc4 gmail com>
Date:   Thu Dec 24 16:10:39 2015 +0200

    Add support for string state actions in main window

 src/mainwindowaction.cpp |   10 ++++++++++
 src/mainwindowaction.hpp |    2 ++
 src/recentchanges.cpp    |    3 +++
 3 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/src/mainwindowaction.cpp b/src/mainwindowaction.cpp
index c20a8d5..3252f7b 100644
--- a/src/mainwindowaction.cpp
+++ b/src/mainwindowaction.cpp
@@ -31,6 +31,11 @@ MainWindowAction::Ptr MainWindowAction::create(const Glib::ustring & name, bool
   return Ptr(new MainWindowAction(name, state));
 }
 
+MainWindowAction::Ptr MainWindowAction::create(const Glib::ustring & name, const Glib::ustring & state)
+{
+  return Ptr(new MainWindowAction(name, state));
+}
+
 MainWindowAction::MainWindowAction(const Glib::ustring & name)
   : Gio::SimpleAction(name)
 {
@@ -41,4 +46,9 @@ MainWindowAction::MainWindowAction(const Glib::ustring & name, bool state)
 {
 }
 
+MainWindowAction::MainWindowAction(const Glib::ustring & name, const Glib::ustring & state)
+  : Gio::SimpleAction(name, Glib::VARIANT_TYPE_STRING, Glib::Variant<Glib::ustring>::create(state))
+{
+}
+
 }
diff --git a/src/mainwindowaction.hpp b/src/mainwindowaction.hpp
index 42bb5b1..9439338 100644
--- a/src/mainwindowaction.hpp
+++ b/src/mainwindowaction.hpp
@@ -35,6 +35,7 @@ public:
 
   static Ptr create(const Glib::ustring & name);
   static Ptr create(const Glib::ustring & name, bool state);
+  static Ptr create(const Glib::ustring & name, const Glib::ustring & state);
 
   void set_state(const Glib::VariantBase & value)
     {
@@ -43,6 +44,7 @@ public:
 protected:
   MainWindowAction(const Glib::ustring & name);
   MainWindowAction(const Glib::ustring & name, bool state);
+  MainWindowAction(const Glib::ustring & name, const Glib::ustring & state);
 };
 
 }
diff --git a/src/recentchanges.cpp b/src/recentchanges.cpp
index 28dcaa0..64a1905 100644
--- a/src/recentchanges.cpp
+++ b/src/recentchanges.cpp
@@ -109,6 +109,9 @@ namespace gnote {
       else if(iter->second == &Glib::Variant<bool>::variant_type()) {
         add_action(MainWindowAction::create(iter->first, false));
       }
+      else if(iter->second == &Glib::Variant<Glib::ustring>::variant_type()) {
+        add_action(MainWindowAction::create(iter->first, Glib::ustring("")));
+      }
     }
     find_action("close-window")->signal_activate()
       .connect(sigc::mem_fun(*this, &NoteRecentChanges::on_close_window));


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