[gnote] Add Open Note In New Window feature



commit b276d392d56eebaefc5e3bf43c6eab2397bce68e
Author: Aurimas Äernius <aurisc4 gmail com>
Date:   Fri Oct 26 22:17:57 2012 +0300

    Add Open Note In New Window feature
    
    Notes list context menu item to open note in new window.

 src/searchnoteswidget.cpp |   20 ++++++++++++++++++++
 src/searchnoteswidget.hpp |    2 ++
 2 files changed, 22 insertions(+), 0 deletions(-)
---
diff --git a/src/searchnoteswidget.cpp b/src/searchnoteswidget.cpp
index 234ffd0..bda2bda 100644
--- a/src/searchnoteswidget.cpp
+++ b/src/searchnoteswidget.cpp
@@ -203,6 +203,10 @@ void SearchNotesWidget::make_actions()
   m_open_note_action = Gtk::Action::create("OpenNoteAction", _("_Open"));
   m_open_note_action->signal_activate().connect(sigc::mem_fun(*this, &SearchNotesWidget::on_open_note));
 
+  m_open_note_new_window_action = Gtk::Action::create("OpenNoteNewWindowAction", _("Open In New _Window"));
+  m_open_note_new_window_action->signal_activate()
+    .connect(sigc::mem_fun(*this, &SearchNotesWidget::on_open_note_new_window));
+
   m_delete_note_action = Gtk::Action::create("DeleteNoteAction", ("_Delete"));
   m_delete_note_action->signal_activate().connect(sigc::mem_fun(*this, &SearchNotesWidget::delete_selected_notes));
 
@@ -1395,6 +1399,15 @@ void SearchNotesWidget::on_open_note()
   }
 }
 
+void SearchNotesWidget::on_open_note_new_window()
+{
+  Note::List selected_notes = get_selected_notes();
+  for(Note::List::iterator iter = selected_notes.begin();
+      iter != selected_notes.end(); ++iter) {
+    signal_open_note_new_window(*iter);
+  }
+}
+
 void SearchNotesWidget::delete_selected_notes()
 {
   Note::List selected_notes = get_selected_notes();
@@ -1445,12 +1458,19 @@ Gtk::Menu *SearchNotesWidget::get_note_list_context_menu()
 {
   if(!m_note_list_context_menu) {
     m_note_list_context_menu = new Gtk::Menu;
+
     Gtk::MenuItem *item = manage(new Gtk::MenuItem);
     item->set_related_action(m_open_note_action);
     m_note_list_context_menu->add(*item);
+
+    item = manage(new Gtk::MenuItem);
+    item->set_related_action(m_open_note_new_window_action);
+    m_note_list_context_menu->add(*item);
+
     item = manage(new Gtk::MenuItem);
     item->set_related_action(m_delete_note_action);
     m_note_list_context_menu->add(*item);
+
     m_note_list_context_menu->add(*manage(new Gtk::SeparatorMenuItem));
     item = manage(new Gtk::MenuItem(_("_New Note"), true));
     item->signal_activate().connect(sigc::mem_fun(*this, &SearchNotesWidget::new_note));
diff --git a/src/searchnoteswidget.hpp b/src/searchnoteswidget.hpp
index 067b76b..13900ff 100644
--- a/src/searchnoteswidget.hpp
+++ b/src/searchnoteswidget.hpp
@@ -113,6 +113,7 @@ private:
   void add_note(const Note::Ptr & note);
   void rename_note(const Note::Ptr & note);
   void on_open_note();
+  void on_open_note_new_window();
   Gtk::Window *get_owning_window();
   void on_note_added_to_notebook(const Note & note, const notebooks::Notebook::Ptr & notebook);
   void on_note_removed_from_notebook(const Note & note, const notebooks::Notebook::Ptr & notebook);
@@ -148,6 +149,7 @@ private:
   };
 
   Glib::RefPtr<Gtk::Action> m_open_note_action;
+  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;
   RecentSearchColumnTypes m_find_combo_columns;



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