[nemiver: 1/6] Make the 'View > Memory' conditionally used (Close



commit 6fa4fd3eb5f429634640496ddf18f1f351a03d52
Author: Jonathon Jongsma <jonathon jongsma collabora co uk>
Date:   Sun Mar 8 14:07:38 2009 -0500

    Make the 'View > Memory' conditionally used (Closes: #564832)
    
    	* src/persp/dbgperspective/menus/memoryview-menu.xml: add a new UI
    	  definition with only memory view menu items
    	* src/persp/dbgperspective/menus/menus.xml: remove the memoryview menu item
    	  from the main menus UI definition because it should not always be used
    	* src/persp/dbgperspective/menus/Makefile.am: add new menu file to be installed
    	* src/persp/dbgperspective/nmv-dbg-perspective.cc: conditionally add the
    	  memoryview menu item UI definition if ENABLE_MEMORYVIEW is defined
---
 src/persp/dbgperspective/menus/Makefile.am         |    2 +-
 src/persp/dbgperspective/menus/memoryview-menu.xml |   12 ++++++++++++
 src/persp/dbgperspective/menus/menus.xml           |    2 --
 src/persp/dbgperspective/nmv-dbg-perspective.cc    |    9 +++++++++
 4 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/src/persp/dbgperspective/menus/Makefile.am b/src/persp/dbgperspective/menus/Makefile.am
index 72d162d..d52d85d 100644
--- a/src/persp/dbgperspective/menus/Makefile.am
+++ b/src/persp/dbgperspective/menus/Makefile.am
@@ -1,7 +1,7 @@
 PLUGIN_NAME=dbgperspective
 
 menusfiles = \
-menus.xml toolbar.xml \
+menus.xml memoryview-menu.xml toolbar.xml \
 contextualmenu.xml \
 breakpointspopup.xml \
 callstackpopup.xml \
diff --git a/src/persp/dbgperspective/menus/memoryview-menu.xml b/src/persp/dbgperspective/menus/memoryview-menu.xml
new file mode 100644
index 0000000..404dca6
--- /dev/null
+++ b/src/persp/dbgperspective/menus/memoryview-menu.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+ <ui>
+  <menubar name="MenuBar">
+    <placeholder name="MenuBarAdditions">
+        <menu action="ViewMenuAction" name="ViewMenu">
+            <menuitem action="ActivateMemoryViewMenuAction"
+                name="ActivateMemoryViewMenuItem"/>
+        </menu>
+    </placeholder>
+  </menubar>
+ </ui>
+
diff --git a/src/persp/dbgperspective/menus/menus.xml b/src/persp/dbgperspective/menus/menus.xml
index 4ef0636..46f8d0a 100644
--- a/src/persp/dbgperspective/menus/menus.xml
+++ b/src/persp/dbgperspective/menus/menus.xml
@@ -44,8 +44,6 @@
                 name="ActivateBreakpointsViewMenuItem"/>
             <menuitem action="ActivateRegistersViewMenuAction"
                 name="ActivateRegistersViewMenuItem"/>
-            <menuitem action="ActivateMemoryViewMenuAction"
-                name="ActivateMemoryViewMenuItem"/>
             <!--
             <separator/>
             <menuitem action="ShowCommandsMenuAction"
diff --git a/src/persp/dbgperspective/nmv-dbg-perspective.cc b/src/persp/dbgperspective/nmv-dbg-perspective.cc
index 67c7650..bf0dd1a 100644
--- a/src/persp/dbgperspective/nmv-dbg-perspective.cc
+++ b/src/persp/dbgperspective/nmv-dbg-perspective.cc
@@ -2655,6 +2655,15 @@ DBGPerspective::add_perspective_menu_entries ()
     m_priv->contextual_menu_merge_id =
         workbench ().get_ui_manager ()->add_ui_from_file
                                     (Glib::filename_to_utf8 (absolute_path));
+
+#ifdef WITH_MEMORYVIEW
+    // Add memory view menu item if we're compiling with memoryview support
+    relative_path = Glib::build_filename ("menus", "memoryview-menu.xml");
+    THROW_IF_FAIL (build_absolute_resource_path
+                    (Glib::filename_to_utf8 (relative_path), absolute_path));
+    workbench ().get_ui_manager ()->add_ui_from_file
+                                (Glib::filename_to_utf8 (absolute_path));
+#endif // WITH_MEMORYVIEW
 }
 
 void



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