[gnote] Introduce NonModifyingNoteAction marker class



commit c0f8db7ba63936f7e3d89696b47142be42639140
Author: Aurimas Černius <aurisc4 gmail com>
Date:   Sun Oct 20 18:34:03 2013 +0300

    Introduce NonModifyingNoteAction marker class

 src/notewindow.cpp |   14 ++++++++++++--
 src/notewindow.hpp |   12 ++++++++++++
 2 files changed, 24 insertions(+), 2 deletions(-)
---
diff --git a/src/notewindow.cpp b/src/notewindow.cpp
index fbf7995..11ed612 100644
--- a/src/notewindow.cpp
+++ b/src/notewindow.cpp
@@ -74,6 +74,16 @@ namespace gnote {
     : Gtk::Action(name, icon_name, label, tooltip)
   {}
 
+  void NoteWindow::NonModifyingAction::reference() const
+  {
+    Gtk::Action::reference();
+  }
+
+  void NoteWindow::NonModifyingAction::unreference() const
+  {
+    Gtk::Action::unreference();
+  }
+
 
 
   NoteWindow::NoteWindow(Note & note)
@@ -294,7 +304,7 @@ namespace gnote {
     }
     m_widget_actions[order] = action;
     m_signal_actions_changed();
-    if(Glib::RefPtr<NonModifyingAction>::cast_dynamic(action) == 0) {
+    if(Glib::RefPtr<NonModifyingNoteAction>::cast_dynamic(action) == 0) {
       action->set_sensitive(m_enabled);
     }
   }
@@ -624,7 +634,7 @@ namespace gnote {
     if(m_global_keys)
       m_global_keys->enabled(m_enabled);
     FOREACH(Glib::RefPtr<Gtk::Action> & action, get_widget_actions()) {
-      if(Glib::RefPtr<NonModifyingAction>::cast_dynamic(action) == 0) {
+      if(Glib::RefPtr<NonModifyingNoteAction>::cast_dynamic(action) == 0) {
         action->set_sensitive(enable);
       }
     }
diff --git a/src/notewindow.hpp b/src/notewindow.hpp
index 2b1a293..993885e 100644
--- a/src/notewindow.hpp
+++ b/src/notewindow.hpp
@@ -155,8 +155,18 @@ public:
   // use co-variant return
   virtual Gtk::Grid *embeddable_toolbar() override;
 
+  class NonModifyingNoteAction
+  {
+  public:
+    virtual ~NonModifyingNoteAction() {}
+
+    // these are required to make RefPtr
+    virtual void reference() const = 0;
+    virtual void unreference() const = 0;
+  };
   class NonModifyingAction
     : public Gtk::Action
+    , public NonModifyingNoteAction
   {
   public:
     static Glib::RefPtr<NonModifyingAction> create()
@@ -184,6 +194,8 @@ public:
     NonModifyingAction(const Glib::ustring & name, const Glib::ustring & icon_name,
                        const Glib::ustring & label = Glib::ustring(),
                        const Glib::ustring & tooltip = Glib::ustring());
+    virtual void reference() const override;
+    virtual void unreference() const override;
   };
   virtual std::vector<Glib::RefPtr<Gtk::Action> > get_widget_actions() override;
   virtual sigc::signal<void> & signal_actions_changed() override;


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