[gnote] Remove unused actions and ui items



commit f092550a6fe649384470d01f669d3d941b507de0
Author: Aurimas Äernius <aurisc4 gmail com>
Date:   Sat Oct 6 15:03:29 2012 +0300

    Remove unused actions and ui items
    
    * Remove actions, that will no longer be used
    * Comment out those to be replaced
    * Remove unused UI elemement, depending on those actions

 data/UIManagerLayout.xml                   |   28 ----------------------------
 src/actionmanager.cpp                      |   15 +++++++--------
 src/gnote.cpp                              |    3 ++-
 src/notebooks/notebookapplicationaddin.cpp |   27 +++++----------------------
 src/synchronization/syncmanager.cpp        |    2 ++
 5 files changed, 16 insertions(+), 59 deletions(-)
---
diff --git a/data/UIManagerLayout.xml b/data/UIManagerLayout.xml
index c18ded0..15af597 100644
--- a/data/UIManagerLayout.xml
+++ b/data/UIManagerLayout.xml
@@ -1,32 +1,4 @@
 <ui>
-    <menubar name="MainWindowMenubar">
-        <menu name="FileMenu" action="FileMenuAction">
-			<placeholder name="FileMenuNewNotePlaceholder">
-				<menuitem name="NewNote" action="NewNoteAction" />
-			</placeholder>
-            <menuitem name="OpenNote" action="OpenNoteAction" />
-            <separator />
-            <menuitem name="CloseWindow" action="CloseWindowAction" />
-            <menuitem name="QuitGNote" action="QuitGNoteAction" />
-        </menu>
-        <menu name="EditMenu" action="EditMenuAction">
-			<placeholder name='EditMenuDeletePlaceholder'>
-            	<menuitem name="DeleteNote" action="DeleteNoteAction" />
-            </placeholder>
-            <separator />
-            <menuitem name="ShowPreferences" action="ShowPreferencesAction" />
-        </menu>
-        <placeholder name="MainWindowMenuPlaceholder" />
-        <menu name="HelpMenu" action="HelpMenuAction">
-            <menuitem name="ShowHelp" action="ShowHelpAction"/>
-            <menuitem name="ShowAbout" action="ShowAboutAction" />
-        </menu>
-    </menubar>
-    <popup name="MainWindowContextMenu" action="MainWindowContextMenuAction">
-    	<menuitem name="OpenNote" action="OpenNoteAction" />
-    	<menuitem name="DeleteNote" action="DeleteNoteAction" />
-    	<placeholder name="MainWindowContextMenuPlaceholder" />
-    </popup>
     <popup name="TrayIconMenu" action="TrayIconMenuAction">
     	<placeholder name="TrayIconMenuPlaceholder0" />
     	<placeholder name="TrayNewNotePlaceholder">
diff --git a/src/actionmanager.cpp b/src/actionmanager.cpp
index 1874687..d1e6bb7 100644
--- a/src/actionmanager.cpp
+++ b/src/actionmanager.cpp
@@ -1,7 +1,7 @@
 /*
  * gnote
  *
- * Copyright (C) 2011 Aurimas Cernius
+ * Copyright (C) 2011-2012 Aurimas Cernius
  * Copyright (C) 2009 Hubert Figuiere
  *
  * This program is free software: you can redistribute it and/or modify
@@ -86,14 +86,16 @@ namespace gnote {
     Gtk::Window::set_default_icon_name("gnote");
 
 
+#if 0
     Gtk::ImageMenuItem *imageitem = (Gtk::ImageMenuItem*)m_ui->get_widget(
       "/MainWindowMenubar/FileMenu/FileMenuNewNotePlaceholder/NewNote");
     DBG_ASSERT(imageitem, "Item not found");
     if (imageitem) {
       imageitem->set_image(*manage(new Gtk::Image(m_newNote)));
     }
-      
-    imageitem = (Gtk::ImageMenuItem*)m_ui->get_widget (
+#endif
+
+    Gtk::ImageMenuItem *imageitem = (Gtk::ImageMenuItem*)m_ui->get_widget (
       "/TrayIconMenu/TrayNewNotePlaceholder/TrayNewNote");
     DBG_ASSERT(imageitem, "Item not found");
     if (imageitem) {
@@ -174,6 +176,7 @@ namespace gnote {
     action = Gtk::Action::create("FileMenuAction", _("_File"));
     m_main_window_actions->add(action);
 
+#if 0
     action = Gtk::Action::create("NewNoteAction", 
                                  Gtk::Stock::NEW, _("_New"),
                                  _("Create a new note"));
@@ -190,11 +193,7 @@ namespace gnote {
       _("_Delete"),  _("Delete the selected note"));
     action->set_sensitive(false);
     m_main_window_actions->add(action, Gtk::AccelKey("Delete"));
-
-    action = Gtk::Action::create(
-      "CloseWindowAction", Gtk::Stock::CLOSE,
-      _("_Close"), _("Close this window"));
-    m_main_window_actions->add(action, Gtk::AccelKey("<Control>W"));
+#endif
 
     action = Gtk::Action::create(
       "QuitGNoteAction", Gtk::Stock::QUIT,
diff --git a/src/gnote.cpp b/src/gnote.cpp
index 5c97fac..ddc02d4 100644
--- a/src/gnote.cpp
+++ b/src/gnote.cpp
@@ -156,7 +156,6 @@ namespace gnote {
   {
     ActionManager & am(ActionManager::obj());
     if((m_is_background = cmd_line.background())) {
-      am["CloseWindowAction"]->set_visible(true);
       am["QuitGNoteAction"]->set_visible(false);
     }
     if(cmd_line.needs_execute()) {
@@ -277,8 +276,10 @@ namespace gnote {
   void Gnote::setup_global_actions()
   {
     ActionManager & am(ActionManager::obj());
+#if 0
     am["NewNoteAction"]->signal_activate()
       .connect(sigc::mem_fun(*this, &Gnote::on_new_note_action));
+#endif
     am["QuitGNoteAction"]->signal_activate()
       .connect(sigc::mem_fun(*this, &Gnote::on_quit_gnote_action));
     am["ShowPreferencesAction"]->signal_activate() 
diff --git a/src/notebooks/notebookapplicationaddin.cpp b/src/notebooks/notebookapplicationaddin.cpp
index a8081c4..f3ea860 100644
--- a/src/notebooks/notebookapplicationaddin.cpp
+++ b/src/notebooks/notebookapplicationaddin.cpp
@@ -1,7 +1,7 @@
 /*
  * gnote
  *
- * Copyright (C) 2011 Aurimas Cernius
+ * Copyright (C) 2011-2012 Aurimas Cernius
  * Copyright (C) 2010 Debarshi Ray
  * Copyright (C) 2009 Hubert Figuiere
  *
@@ -53,6 +53,7 @@ namespace gnote {
     NotebookApplicationAddin::NotebookApplicationAddin()
       : m_initialized(false)
       , m_notebookUi(0)
+      , m_trayNotebookMenu(NULL)
     {
       m_notebookIcon = utils::get_icon ("notebook", 16);
       m_newNotebookIcon = utils::get_icon ("notebook-new", 16);
@@ -61,26 +62,6 @@ namespace gnote {
 
 
     static const char * uixml = "          <ui>"
-          "  <menubar name='MainWindowMenubar'>"
-          "    <menu name='FileMenu' action='FileMenuAction'>"
-          "      <placeholder name='FileMenuNewNotePlaceholder'>"
-          "        <menuitem name='NewNotebookMenu' action='NewNotebookMenuAction' />"
-          "      </placeholder>"
-          "    </menu>"
-          "    <menu name='EditMenu' action='EditMenuAction'>"
-          "      <placeholder name='EditMenuDeletePlaceholder'>"
-          "          <menuitem name='DeleteNotebook' action='DeleteNotebookAction' position='bottom'/>"
-          "      </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' />"
           "    <menuitem name='OpenNotebookTemplateNote' action='OpenNotebookTemplateNoteAction' />"
@@ -151,6 +132,7 @@ namespace gnote {
                                  &NotebookApplicationAddin::on_tray_notebook_menu_hidden));
       }
       
+#if 0
       Gtk::ImageMenuItem *imageitem = dynamic_cast<Gtk::ImageMenuItem*>(
         am.get_widget ("/MainWindowMenubar/FileMenu/FileMenuNewNotePlaceholder/NewNotebookMenu"));
       if (imageitem) {
@@ -166,7 +148,8 @@ namespace gnote {
           .connect(sigc::mem_fun(*this, 
                                  &NotebookApplicationAddin::on_new_notebook_menu_hidden));
       }
-      imageitem = dynamic_cast<Gtk::ImageMenuItem*>(
+#endif
+      Gtk::ImageMenuItem *imageitem = dynamic_cast<Gtk::ImageMenuItem*>(
         am.get_widget ("/NotebooksTreeContextMenu/NewNotebookNote"));
       if (imageitem) {
         imageitem->set_image(*manage(new Gtk::Image(am.get_new_note())));
diff --git a/src/synchronization/syncmanager.cpp b/src/synchronization/syncmanager.cpp
index 7418345..9b0e608 100644
--- a/src/synchronization/syncmanager.cpp
+++ b/src/synchronization/syncmanager.cpp
@@ -137,6 +137,7 @@ namespace sync {
     sync_notes_action->signal_activate().connect(sigc::mem_fun(*this, &SyncManager::on_sync_notes_activate));
     action_group->add(sync_notes_action);
 
+#if 0
     ActionManager::obj().get_ui()->add_ui_from_string(
       "<ui>"
       "<menubar name='MainWindowMenubar'>"
@@ -148,6 +149,7 @@ namespace sync {
       "</menubar>"
       "</ui>"
     );
+#endif
 
     ActionManager::obj().get_ui()->insert_action_group(action_group, 0);
 



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