[gnote] Remove Gtk::Action for rename notebook
- From: Aurimas Černius <aurimasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnote] Remove Gtk::Action for rename notebook
- Date: Wed, 19 May 2021 20:24:49 +0000 (UTC)
commit a66fe0f919f0d0b1b9093f018e4fd100ac0de681
Author: Aurimas Černius <aurisc4 gmail com>
Date: Wed May 19 23:24:20 2021 +0300
Remove Gtk::Action for rename notebook
src/searchnoteswidget.cpp | 26 +++++++++++++-------------
src/searchnoteswidget.hpp | 3 +--
2 files changed, 14 insertions(+), 15 deletions(-)
---
diff --git a/src/searchnoteswidget.cpp b/src/searchnoteswidget.cpp
index 634a7aa7..57a60cff 100644
--- a/src/searchnoteswidget.cpp
+++ b/src/searchnoteswidget.cpp
@@ -58,6 +58,7 @@ SearchNotesWidget::SearchNotesWidget(IGnote & g, NoteManagerBase & m)
, m_open_note_new_window_menu_item(nullptr)
, m_delete_note_menu_item(nullptr)
, m_delete_notebook_menu_item(nullptr)
+ , m_rename_notebook_menu_item(nullptr)
, m_no_matches_box(NULL)
, m_gnote(g)
, m_manager(m)
@@ -71,7 +72,6 @@ SearchNotesWidget::SearchNotesWidget(IGnote & g, NoteManagerBase & m)
{
set_hexpand(true);
set_vexpand(true);
- make_actions();
// Notebooks Pane
Gtk::Widget *notebooksPane = Gtk::manage(make_notebooks_pane());
@@ -137,12 +137,6 @@ Glib::ustring SearchNotesWidget::get_name() const
return selected_notebook->get_name();
}
-void SearchNotesWidget::make_actions()
-{
- 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 Glib::ustring & search_text)
{
restore_matches_window();
@@ -368,7 +362,9 @@ void SearchNotesWidget::on_notebook_selection_changed()
if(m_delete_notebook_menu_item) {
m_delete_notebook_menu_item->set_sensitive(false);
}
- m_rename_notebook_action->set_sensitive(false);
+ if(m_rename_notebook_menu_item) {
+ m_rename_notebook_menu_item->set_sensitive(false);
+ }
m_on_notebook_selection_changed_cid.unblock();
}
else {
@@ -381,13 +377,17 @@ void SearchNotesWidget::on_notebook_selection_changed()
if(m_delete_notebook_menu_item) {
m_delete_notebook_menu_item->set_sensitive(false);
}
- m_rename_notebook_action->set_sensitive(false);
+ if(m_rename_notebook_menu_item) {
+ m_rename_notebook_menu_item->set_sensitive(false);
+ }
}
else {
if(m_delete_notebook_menu_item) {
m_delete_notebook_menu_item->set_sensitive(true);
}
- m_rename_notebook_action->set_sensitive(true);
+ if(m_rename_notebook_menu_item) {
+ m_rename_notebook_menu_item->set_sensitive(true);
+ }
allow_edit = true;
}
@@ -1357,9 +1357,9 @@ 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);
- item->set_related_action(m_rename_notebook_action);
- m_notebook_list_context_menu->add(*item);
+ m_rename_notebook_menu_item = manage(new Gtk::MenuItem(_("Re_name..."), true));
+ m_rename_notebook_menu_item->signal_activate().connect(sigc::mem_fun(*this,
&SearchNotesWidget::on_rename_notebook));
+ m_notebook_list_context_menu->add(*m_rename_notebook_menu_item);
m_delete_notebook_menu_item = manage(new Gtk::MenuItem(_("_Delete"), true));
m_delete_notebook_menu_item->signal_activate().connect(sigc::mem_fun(*this,
&SearchNotesWidget::on_delete_notebook));
m_notebook_list_context_menu->add(*m_delete_notebook_menu_item);
diff --git a/src/searchnoteswidget.hpp b/src/searchnoteswidget.hpp
index f833ecae..b67d2bf0 100644
--- a/src/searchnoteswidget.hpp
+++ b/src/searchnoteswidget.hpp
@@ -68,7 +68,6 @@ public:
sigc::signal<void, const Note::Ptr &> signal_open_note;
sigc::signal<void, const Note::Ptr &> signal_open_note_new_window;
private:
- void make_actions();
void perform_search();
void restore_matches_window();
Gtk::Widget *make_notebooks_pane();
@@ -162,7 +161,7 @@ private:
Gtk::MenuItem *m_open_note_new_window_menu_item;
Gtk::MenuItem *m_delete_note_menu_item;
Gtk::MenuItem *m_delete_notebook_menu_item;
- Glib::RefPtr<Gtk::Action> m_rename_notebook_action;
+ Gtk::MenuItem *m_rename_notebook_menu_item;
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]