[gnote] Add menu item and accelerator for renaming notebook
- From: Aurimas Černius <aurimasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnote] Add menu item and accelerator for renaming notebook
- Date: Sat, 13 Jul 2013 15:48:53 +0000 (UTC)
commit 74f3db0a58697e4739a8b743cf29d86ef167199c
Author: Aurimas Černius <aurisc4 gmail com>
Date: Sat Jul 13 18:47:18 2013 +0300
Add menu item and accelerator for renaming notebook
Context menu item and F2.
Fixes Bug 700435.
src/searchnoteswidget.cpp | 20 ++++++++++++++++++++
src/searchnoteswidget.hpp | 1 +
2 files changed, 21 insertions(+), 0 deletions(-)
---
diff --git a/src/searchnoteswidget.cpp b/src/searchnoteswidget.cpp
index 0529d0e..33965b6 100644
--- a/src/searchnoteswidget.cpp
+++ b/src/searchnoteswidget.cpp
@@ -424,6 +424,9 @@ bool SearchNotesWidget::on_notebooks_tree_button_pressed(GdkEventButton *ev)
bool SearchNotesWidget::on_notebooks_key_pressed(GdkEventKey *ev)
{
switch(ev->keyval) {
+ case GDK_KEY_F2:
+ on_rename_notebook();
+ break;
case GDK_KEY_Menu:
{
Gtk::Menu *menu = get_notebook_list_context_menu();
@@ -1331,6 +1334,10 @@ 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 Notebook"), true));
+ item->signal_activate()
+ .connect(sigc::mem_fun(*this, &SearchNotesWidget::on_rename_notebook));
+ m_notebook_list_context_menu->add(*item);
item = manage(new Gtk::MenuItem);
item->set_related_action(m_delete_notebook_action);
m_notebook_list_context_menu->add(*item);
@@ -1504,4 +1511,17 @@ void SearchNotesWidget::parse_sorting_setting(const Glib::ustring & sorting)
m_sort_column_order = order;
}
+void SearchNotesWidget::on_rename_notebook()
+{
+ Glib::RefPtr<Gtk::TreeSelection> selection = m_notebooksTree->get_selection();
+ if(selection == 0) {
+ return;
+ }
+ std::vector<Gtk::TreeModel::Path> selected_row = selection->get_selected_rows();
+ if(selected_row.size() != 1) {
+ return;
+ }
+ m_notebooksTree->set_cursor(selected_row[0], *m_notebooksTree->get_column(0), true);
+}
+
}
diff --git a/src/searchnoteswidget.hpp b/src/searchnoteswidget.hpp
index bfe9bc3..e648c50 100644
--- a/src/searchnoteswidget.hpp
+++ b/src/searchnoteswidget.hpp
@@ -123,6 +123,7 @@ private:
void on_settings_changed(const Glib::ustring & key);
void on_sorting_changed();
void parse_sorting_setting(const Glib::ustring & sorting);
+ void on_rename_notebook();
class RecentSearchColumnTypes
: public Gtk::TreeModelColumnRecord
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]