[gnote] Make ReadOnly add-in use CheckAction
- From: Aurimas Černius <aurimasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnote] Make ReadOnly add-in use CheckAction
- Date: Sun, 20 Oct 2013 18:21:11 +0000 (UTC)
commit 8fbb59b5b2b786244b3efc65cf10e38e98f0950d
Author: Aurimas Černius <aurisc4 gmail com>
Date: Sun Oct 20 21:17:39 2013 +0300
Make ReadOnly add-in use CheckAction
src/addins/readonly/readonlynoteaddin.cpp | 29 +++++++----------------------
1 files changed, 7 insertions(+), 22 deletions(-)
---
diff --git a/src/addins/readonly/readonlynoteaddin.cpp b/src/addins/readonly/readonlynoteaddin.cpp
index 0f8e24d..00b28d7 100644
--- a/src/addins/readonly/readonlynoteaddin.cpp
+++ b/src/addins/readonly/readonlynoteaddin.cpp
@@ -19,7 +19,6 @@
*/
#include <glibmm/i18n.h>
-#include <gtkmm/checkmenuitem.h>
#include "iactionmanager.hpp"
#include "itagmanager.hpp"
@@ -30,7 +29,8 @@
namespace {
class ReadOnlyAction
- : public gnote::NoteWindow::NonModifyingAction
+ : public gnote::utils::CheckAction
+ , public gnote::NoteWindow::NonModifyingNoteAction
{
public:
typedef Glib::RefPtr<ReadOnlyAction> Ptr;
@@ -38,36 +38,21 @@ namespace {
{
return Ptr(new ReadOnlyAction);
}
- void checked(bool check)
- {
- m_checked = check;
- }
- bool checked() const
- {
- return m_checked;
- }
- protected:
- virtual Gtk::Widget *create_menu_item_vfunc() override
+ virtual void reference() const override
{
- Gtk::CheckMenuItem *item = new Gtk::CheckMenuItem;
- item->set_active(m_checked);
- return item;
+ gnote::utils::CheckAction::reference();
}
- virtual void on_activate() override
+ virtual void unreference() const override
{
- m_checked = !m_checked;
- Gtk::Action::on_activate();
+ gnote::utils::CheckAction::unreference();
}
private:
ReadOnlyAction()
- : gnote::NoteWindow::NonModifyingAction("ReadOnlyAction")
- , m_checked(false)
+ : gnote::utils::CheckAction("ReadOnlyAction")
{
set_label(_("Read Only"));
set_tooltip(_("Make this note read-only"));
}
-
- bool m_checked;
};
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]