[gnote] Move "mark important" button to actions menu



commit ddaaceb6f04e7334c05cbe59762397214385259f
Author: Aurimas Černius <aurisc4 gmail com>
Date:   Sat Apr 5 22:38:39 2014 +0300

    Move "mark important" button to actions menu

 src/notewindow.cpp |   38 ++++++++++++--------------------------
 src/notewindow.hpp |    3 +--
 2 files changed, 13 insertions(+), 28 deletions(-)
---
diff --git a/src/notewindow.cpp b/src/notewindow.cpp
index 61e3776..1643a26 100644
--- a/src/notewindow.cpp
+++ b/src/notewindow.cpp
@@ -290,9 +290,11 @@ namespace gnote {
         iter != m_widget_actions.end(); ++iter) {
       res.push_back(iter->second);
     }
+
+    res.push_back(Glib::RefPtr<Gtk::Action>());
+    res.push_back(m_important_action);
     if(m_delete_action) {
       // Separator before delete
-      res.push_back(Glib::RefPtr<Gtk::Action>());
       res.push_back(m_delete_action);
     }
     return res;
@@ -405,23 +407,6 @@ namespace gnote {
     Gtk::Grid *grid = manage(new Gtk::Grid);
     int grid_col = 0;
 
-    m_pin_image = manage(new Gtk::Image);
-    m_pin_button = manage(new Gtk::ToolButton(*m_pin_image, _("Pin")));
-
-    if(m_note.is_pinned()) {
-      m_pin_image->property_gicon() = get_icon_pin_down();
-      m_pin_button->set_tooltip_text(_("Remove from important notes"));
-    }
-    else {
-      m_pin_image->property_gicon() = get_icon_pin_active();
-      m_pin_button->set_tooltip_text(_("Mark note as important"));
-    }
-
-    m_pin_button->signal_clicked().connect(sigc::mem_fun(*this, &NoteWindow::on_pin_button_clicked));
-    grid->attach(*m_pin_button, grid_col++, 0, 1, 1);
-    notebooks::NotebookManager::obj().signal_note_pin_status_changed
-      .connect(sigc::mem_fun(*this, &NoteWindow::on_pin_status_changed));
-
     m_link_button = manage(new Gtk::ToolButton(
                              *manage(new Gtk::Image(Gtk::Stock::JUMP_TO, Gtk::ICON_SIZE_SMALL_TOOLBAR)),
                              _("Link")));
@@ -443,6 +428,14 @@ namespace gnote {
     grid->attach(*text_button, grid_col++, 0, 1, 1);
     text_button->set_tooltip_text(_("Set properties of text"));
 
+    m_important_action = utils::CheckAction::create("mark-important");
+    m_important_action->set_label(_("Is Important"));
+    m_important_action->set_tooltip(_("Toggle notes presence in Important Notes notebook"));
+    m_important_action->checked(m_note.is_pinned());
+    m_important_action->signal_activate().connect(sigc::mem_fun(*this, &NoteWindow::on_pin_button_clicked));
+    notebooks::NotebookManager::obj().signal_note_pin_status_changed
+      .connect(sigc::mem_fun(*this, &NoteWindow::on_pin_status_changed));
+
       // Don't allow deleting the "Start Here" note...
     if(!m_note.is_special()) {
       m_delete_action = Gtk::Action::create("delete-note", _("_Delete"), _("Delete this note"));
@@ -613,14 +606,7 @@ namespace gnote {
     if(&m_note != &note) {
       return;
     }
-    if(pinned) {
-      m_pin_image->property_gicon() = get_icon_pin_down();
-      m_pin_button->set_tooltip_text(_("Remove from important notes"));
-    }
-    else {
-      m_pin_image->property_gicon() = get_icon_pin_active();
-      m_pin_button->set_tooltip_text(_("Mark note as important"));
-    }
+    m_important_action->checked(pinned);
   }
 
   void NoteWindow::on_pin_button_clicked()
diff --git a/src/notewindow.hpp b/src/notewindow.hpp
index 02eef07..de1477f 100644
--- a/src/notewindow.hpp
+++ b/src/notewindow.hpp
@@ -259,13 +259,12 @@ private:
   int                           m_width;
   Glib::RefPtr<Gtk::AccelGroup> m_accel_group;
   Gtk::Grid                    *m_embeddable_toolbar;
-  Gtk::Image                   *m_pin_image;
-  Gtk::ToolButton              *m_pin_button;
   Gtk::ToolButton              *m_link_button;
   NoteTextMenu                 *m_text_menu;
   Gtk::TextView                *m_editor;
   Gtk::ScrolledWindow          *m_editor_window;
   NoteFindHandler              m_find_handler;
+  utils::CheckAction::Ptr       m_important_action;
   Glib::RefPtr<Gtk::Action>     m_delete_action;
   Gtk::Grid                    *m_template_widget;
   Gtk::CheckButton             *m_save_size_check_button;


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