[gnote] Search window context menus rework



commit 6fc6dd8de8f46779b2a22e13ab9b2b9be043967e
Author: Aurimas Ä?ernius <aurisc4 gmail com>
Date:   Tue May 17 22:45:01 2011 +0300

    Search window context menus rework
    
    * Use only one context menu in notebooks list, because the second
    is not always available (when there are a lot of notebooks, you
    can not click on empty place, also, it is not possible to press
    the context menu key on empty place). "New notebook" item has been
    added to the first context menu, while the second is removed.
    * Added "new note" item to notes list context menu.
    
    Fixes bug 601852.

 src/notebooks/notebookapplicationaddin.cpp |   12 +++++++++---
 src/recentchanges.cpp                      |   27 +++------------------------
 2 files changed, 12 insertions(+), 27 deletions(-)
---
diff --git a/src/notebooks/notebookapplicationaddin.cpp b/src/notebooks/notebookapplicationaddin.cpp
index ae307d3..a8081c4 100644
--- a/src/notebooks/notebookapplicationaddin.cpp
+++ b/src/notebooks/notebookapplicationaddin.cpp
@@ -73,13 +73,19 @@ namespace gnote {
           "      </placeholder>"
           "    </menu>"
           "  </menubar>"
+          "  <popup name='MainWindowContextMenu' action='MainWindowContextMenuAction'>"
+          "    <menuitem name='OpenNote' action='OpenNoteAction' />"
+          "    <menuitem name='DeleteNote' action='DeleteNoteAction' />"
+          "    <placeholder name='MainWindowContextMenuPlaceholder'>"
+          "      <separator />"
+          "      <menuitem name='NewNote' action='NewNotebookNoteAction' />"
+          "    </placeholder>"
+          "  </popup>"
           "  <popup name='NotebooksTreeContextMenu' action='NotebooksTreeContextMenuAction'>"
           "    <menuitem name='NewNotebookNote' action='NewNotebookNoteAction' />"
-          "    <separator />"
           "    <menuitem name='OpenNotebookTemplateNote' action='OpenNotebookTemplateNoteAction' />"
           "    <menuitem name='DeleteNotebook' action='DeleteNotebookAction' />"
-          "  </popup>"
-          "  <popup name='NotebooksTreeNoRowContextMenu' action='NotebooksTreeNoRowContextMenuAction'>"
+          "    <separator />"
           "    <menuitem name='NewNotebook' action='NewNotebookAction' />"
           "  </popup>"
           "  <popup name='TrayIconMenu' action='TrayIconMenuAction'>"
diff --git a/src/recentchanges.cpp b/src/recentchanges.cpp
index f6cb528..eec4b16 100644
--- a/src/recentchanges.cpp
+++ b/src/recentchanges.cpp
@@ -802,12 +802,7 @@ namespace gnote {
                   
     m_tree->get_path_at_pos (ev->x, ev->y,
                              dest_path, column, unused, unused);
-    // we need to test gobj() isn't NULL.
-    // See Gtkmm bug 586437
-    // https://bugzilla.gnome.org/show_bug.cgi?id=586437
-    if (dest_path.empty() || !dest_path.gobj())
-      return false;
-                  
+
     m_clickX = ev->x;
     m_clickY = ev->y;
                   
@@ -1484,26 +1479,10 @@ namespace gnote {
       notebooks::Notebook::Ptr notebook = get_selected_notebook ();
       if (!notebook)
         return true; // Don't pop open a submenu
-          
 
-      bool rowClicked = true;
-      if (m_notebooksTree->get_path_at_pos (ev->x, ev->y, p, col, cell_x, cell_y) == false) {
-        rowClicked = false;
-      }
-      if (selection->count_selected_rows () == 0) {
-        rowClicked = false;
-      }
+      Gtk::Menu *menu = dynamic_cast<Gtk::Menu*>(ActionManager::obj().get_widget (
+                                                 "/NotebooksTreeContextMenu"));
 
-      Gtk::Menu *menu = NULL;
-      if (rowClicked) {
-        menu = dynamic_cast<Gtk::Menu*>(ActionManager::obj().get_widget (
-                                          "/NotebooksTreeContextMenu"));
-      }
-      else {
-        menu = dynamic_cast<Gtk::Menu*>(ActionManager::obj().get_widget (
-                                          "/NotebooksTreeNoRowContextMenu"));
-      }
-          
       popup_context_menu_at_location (menu,
                                       ev->x, ev->y);
       return true;



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