[gnote] Move delete to action menu in note view



commit c26e1afffe2e07047c271e79775258b34a123666
Author: Aurimas Černius <aurisc4 gmail com>
Date:   Sun Mar 30 21:23:27 2014 +0300

    Move delete to action menu in note view

 src/notewindow.cpp |   21 +++++++++------------
 src/notewindow.hpp |    6 +-----
 2 files changed, 10 insertions(+), 17 deletions(-)
---
diff --git a/src/notewindow.cpp b/src/notewindow.cpp
index 6de97dc..61e3776 100644
--- a/src/notewindow.cpp
+++ b/src/notewindow.cpp
@@ -290,6 +290,11 @@ namespace gnote {
         iter != m_widget_actions.end(); ++iter) {
       res.push_back(iter->second);
     }
+    if(m_delete_action) {
+      // Separator before delete
+      res.push_back(Glib::RefPtr<Gtk::Action>());
+      res.push_back(m_delete_action);
+    }
     return res;
   }
 
@@ -438,19 +443,11 @@ namespace gnote {
     grid->attach(*text_button, grid_col++, 0, 1, 1);
     text_button->set_tooltip_text(_("Set properties of text"));
 
-    grid->attach(*manage(new Gtk::SeparatorToolItem()), grid_col++, 0, 1, 1);
-
-    m_delete_button = manage(new Gtk::ToolButton(Gtk::Stock::DELETE));
-    m_delete_button->set_use_underline(true);
-    m_delete_button->signal_clicked().connect(
-      sigc::mem_fun(*this, &NoteWindow::on_delete_button_clicked));
-    m_delete_button->show_all();
-    grid->attach(*m_delete_button, grid_col++, 0, 1, 1);
-    m_delete_button->set_tooltip_text(_("Delete this note"));
-
       // Don't allow deleting the "Start Here" note...
-    if (m_note.is_special()) {
-      m_delete_button->set_sensitive(false);
+    if(!m_note.is_special()) {
+      m_delete_action = Gtk::Action::create("delete-note", _("_Delete"), _("Delete this note"));
+      m_delete_action->signal_activate()
+        .connect(sigc::mem_fun(*this, &NoteWindow::on_delete_button_clicked));
     }
     grid->attach(*manage(new Gtk::SeparatorToolItem()), grid_col++, 0, 1, 1);
 
diff --git a/src/notewindow.hpp b/src/notewindow.hpp
index 0814005..02eef07 100644
--- a/src/notewindow.hpp
+++ b/src/notewindow.hpp
@@ -211,10 +211,6 @@ public:
     {
       return m_editor;
     }
-  Gtk::ToolButton * delete_button() const
-    {
-      return m_delete_button;
-    }
   Gtk::Menu * text_menu() const
     {
       return m_text_menu;
@@ -270,7 +266,7 @@ private:
   Gtk::TextView                *m_editor;
   Gtk::ScrolledWindow          *m_editor_window;
   NoteFindHandler              m_find_handler;
-  Gtk::ToolButton              *m_delete_button;
+  Glib::RefPtr<Gtk::Action>     m_delete_action;
   Gtk::Grid                    *m_template_widget;
   Gtk::CheckButton             *m_save_size_check_button;
   Gtk::CheckButton             *m_save_selection_check_button;


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