[gnote] Disable rename notebook context menu for special notebooks
- From: Aurimas Černius <aurimasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnote] Disable rename notebook context menu for special notebooks
- Date: Fri, 19 Jul 2013 19:52:03 +0000 (UTC)
commit 3224c0e8d6bad368d703c1efb67ca64e7a9f45fd
Author: Aurimas Černius <aurisc4 gmail com>
Date: Fri Jul 19 22:50:20 2013 +0300
Disable rename notebook context menu for special notebooks
Fixes Bug 704197.
src/searchnoteswidget.cpp | 11 ++++++++---
src/searchnoteswidget.hpp | 1 +
2 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/src/searchnoteswidget.cpp b/src/searchnoteswidget.cpp
index 1c8a1f8..7c2f5d0 100644
--- a/src/searchnoteswidget.cpp
+++ b/src/searchnoteswidget.cpp
@@ -144,6 +144,9 @@ void SearchNotesWidget::make_actions()
m_delete_notebook_action = Gtk::Action::create("DeleteNotebookAction", _("_Delete"));
m_delete_notebook_action->signal_activate().connect(sigc::mem_fun(*this,
&SearchNotesWidget::on_delete_notebook));
+
+ m_rename_notebook_action = Gtk::Action::create("RenameNotebookAction", _("Re_name..."));
+ m_rename_notebook_action->signal_activate().connect(sigc::mem_fun(*this,
&SearchNotesWidget::on_rename_notebook));
}
void SearchNotesWidget::perform_search(const std::string & search_text)
@@ -370,6 +373,7 @@ void SearchNotesWidget::on_notebook_selection_changed()
m_on_notebook_selection_changed_cid.block();
select_all_notes_notebook();
m_delete_notebook_action->set_sensitive(false);
+ m_rename_notebook_action->set_sensitive(false);
m_on_notebook_selection_changed_cid.unblock();
}
else {
@@ -380,9 +384,11 @@ void SearchNotesWidget::on_notebook_selection_changed()
bool allow_edit = false;
if(std::tr1::dynamic_pointer_cast<notebooks::SpecialNotebook>(notebook)) {
m_delete_notebook_action->set_sensitive(false);
+ m_rename_notebook_action->set_sensitive(false);
}
else {
m_delete_notebook_action->set_sensitive(true);
+ m_rename_notebook_action->set_sensitive(true);
allow_edit = true;
}
@@ -1334,9 +1340,8 @@ Gtk::Menu *SearchNotesWidget::get_notebook_list_context_menu()
item->signal_activate()
.connect(sigc::mem_fun(*this, &SearchNotesWidget::on_open_notebook_template_note));
m_notebook_list_context_menu->add(*item);
- item = manage(new Gtk::MenuItem(_("Re_name..."), true));
- item->signal_activate()
- .connect(sigc::mem_fun(*this, &SearchNotesWidget::on_rename_notebook));
+ item = manage(new Gtk::MenuItem);
+ item->set_related_action(m_rename_notebook_action);
m_notebook_list_context_menu->add(*item);
item = manage(new Gtk::MenuItem);
item->set_related_action(m_delete_notebook_action);
diff --git a/src/searchnoteswidget.hpp b/src/searchnoteswidget.hpp
index 3e6c324..1db276a 100644
--- a/src/searchnoteswidget.hpp
+++ b/src/searchnoteswidget.hpp
@@ -156,6 +156,7 @@ private:
Glib::RefPtr<Gtk::Action> m_open_note_new_window_action;
Glib::RefPtr<Gtk::Action> m_delete_note_action;
Glib::RefPtr<Gtk::Action> m_delete_notebook_action;
+ Glib::RefPtr<Gtk::Action> m_rename_notebook_action;
RecentSearchColumnTypes m_find_combo_columns;
Gtk::ScrolledWindow m_matches_window;
Gtk::Grid *m_no_matches_box;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]