[gnome-system-monitor] Moved menus declaration to menus.ui



commit 6e74e1d05003607816e6e7167237d9d6ae4462f3
Author: Robert Roth <robert roth off gmail com>
Date:   Tue Jul 23 00:02:04 2013 +0300

    Moved menus declaration to menus.ui

 data/interface.ui |  110 -----------------------------------------------------
 data/menus.ui     |  110 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 src/interface.cpp |    7 +++
 3 files changed, 117 insertions(+), 110 deletions(-)
---
diff --git a/data/interface.ui b/data/interface.ui
index 1b2f191..6723ecf 100644
--- a/data/interface.ui
+++ b/data/interface.ui
@@ -62,7 +62,6 @@
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                         <property name="halign">end</property>
-                        <property name="menu_model">view-menu</property>
                         <child>
                           <object class="GtkBox" id="box1">
                             <property name="visible">True</property>
@@ -619,113 +618,4 @@
       </object>
     </child>
   </object>
-  <menu id="view-menu">
-    <section>
-      <item>
-        <attribute name="label" translatable="yes">_Active Processes</attribute>
-        <attribute name="action">win.show-whose-processes</attribute>
-        <attribute name="target">active</attribute>
-      </item>
-      <item>
-        <attribute name="label" translatable="yes">A_ll Processes</attribute>
-        <attribute name="action">win.show-whose-processes</attribute>
-        <attribute name="target">all</attribute>
-      </item>
-      <item>
-        <attribute name="label" translatable="yes">M_y Processes</attribute>
-        <attribute name="action">win.show-whose-processes</attribute>
-        <attribute name="target">user</attribute>
-      </item>
-    </section>
-    <section>
-      <item>
-        <attribute name="label" translatable="yes">_Dependencies</attribute>
-        <attribute name="action">win.show-dependencies</attribute>
-        <attribute name="accel">&lt;Primary&gt;d</attribute>
-      </item>
-    </section>
-  </menu>
-  <menu id="process-popup-menu">
-    <section>
-      <item>
-        <attribute name="label" translatable="yes">_Stop Process</attribute>
-        <attribute name="action">win.send-signal-stop</attribute>
-        <attribute name="accel">&lt;Primary&gt;s</attribute>
-      </item>
-      <item>
-        <attribute name="label" translatable="yes">_Continue Process</attribute>
-        <attribute name="action">win.send-signal-cont</attribute>
-        <attribute name="accel">&lt;Primary&gt;c</attribute>
-      </item>
-    </section>
-    <section>
-      <item>
-        <attribute name="label" translatable="yes">_End Process</attribute>
-        <attribute name="action">win.send-signal-end</attribute>
-        <attribute name="accel">&lt;Primary&gt;e</attribute>
-      </item>
-      <item>
-        <attribute name="label" translatable="yes">_Kill Process</attribute>
-        <attribute name="action">win.send-signal-kill</attribute>
-        <attribute name="accel">&lt;Primary&gt;k</attribute>
-      </item>
-    </section>
-    <section>
-      <submenu>
-        <attribute name="label" translatable="yes">_Change Priority</attribute>
-        <section>
-          <item>
-            <attribute name="label" translatable="yes">Very High</attribute>
-            <attribute name="action">win.priority</attribute>
-            <attribute name="target">very-high</attribute>
-          </item>
-          <item>
-            <attribute name="label" translatable="yes">High</attribute>
-            <attribute name="action">win.priority</attribute>
-            <attribute name="target">high</attribute>
-          </item>
-          <item>
-            <attribute name="label" translatable="yes">Normal</attribute>
-            <attribute name="action">win.priority</attribute>
-            <attribute name="target">normal</attribute>
-          </item>
-          <item>
-            <attribute name="label" translatable="yes">Low</attribute>
-            <attribute name="action">win.priority</attribute>
-            <attribute name="target">low</attribute>
-          </item>
-          <item>
-            <attribute name="label" translatable="yes">Very Low</attribute>
-            <attribute name="action">win.priority</attribute>
-            <attribute name="target">very-low</attribute>
-          </item>
-        </section>
-        <section>
-          <item>
-            <attribute name="label" translatable="yes">Custom</attribute>
-            <attribute name="action">win.priority</attribute>
-            <attribute name="target">custom</attribute>
-          </item>
-        </section>
-      </submenu>
-    </section>
-    <section>
-      <item>
-        <attribute name="label" translatable="yes">_Memory Maps</attribute>
-        <attribute name="action">win.memory-maps</attribute>
-        <attribute name="accel">&lt;Primary&gt;m</attribute>
-      </item>
-      <item>
-        <attribute name="label" translatable="yes" comments="Translators: this means 'Files that are open' 
(open is not a verb here)">Open _Files</attribute>
-        <attribute name="action">win.open-files</attribute>
-        <attribute name="accel">&lt;Primary&gt;f</attribute>
-      </item>
-    </section>
-    <section>
-      <item>
-        <attribute name="label" translatable="yes">_Properties</attribute>
-        <attribute name="action">win.process-properties</attribute>
-      </item>
-    </section>
-  </menu>
 </interface>
diff --git a/data/menus.ui b/data/menus.ui
index 4b734e9..d99fa6e 100644
--- a/data/menus.ui
+++ b/data/menus.ui
@@ -29,4 +29,114 @@
       </item>
     </section>
   </menu>
+   <menu id="view-menu">
+    <section>
+      <item>
+        <attribute name="label" translatable="yes">_Active Processes</attribute>
+        <attribute name="action">win.show-whose-processes</attribute>
+        <attribute name="target">active</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">A_ll Processes</attribute>
+        <attribute name="action">win.show-whose-processes</attribute>
+        <attribute name="target">all</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">M_y Processes</attribute>
+        <attribute name="action">win.show-whose-processes</attribute>
+        <attribute name="target">user</attribute>
+      </item>
+    </section>
+    <section>
+      <item>
+        <attribute name="label" translatable="yes">_Dependencies</attribute>
+        <attribute name="action">win.show-dependencies</attribute>
+        <attribute name="accel">&lt;Primary&gt;d</attribute>
+      </item>
+    </section>
+  </menu>
+  <menu id="process-popup-menu">
+    <section>
+      <item>
+        <attribute name="label" translatable="yes">_Stop Process</attribute>
+        <attribute name="action">win.send-signal-stop</attribute>
+        <attribute name="accel">&lt;Primary&gt;s</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">_Continue Process</attribute>
+        <attribute name="action">win.send-signal-cont</attribute>
+        <attribute name="accel">&lt;Primary&gt;c</attribute>
+      </item>
+    </section>
+    <section>
+      <item>
+        <attribute name="label" translatable="yes">_End Process</attribute>
+        <attribute name="action">win.send-signal-end</attribute>
+        <attribute name="accel">&lt;Primary&gt;e</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">_Kill Process</attribute>
+        <attribute name="action">win.send-signal-kill</attribute>
+        <attribute name="accel">&lt;Primary&gt;k</attribute>
+      </item>
+    </section>
+    <section>
+      <submenu>
+        <attribute name="label" translatable="yes">_Change Priority</attribute>
+        <section>
+          <item>
+            <attribute name="label" translatable="yes">Very High</attribute>
+            <attribute name="action">win.priority</attribute>
+            <attribute name="target">very-high</attribute>
+          </item>
+          <item>
+            <attribute name="label" translatable="yes">High</attribute>
+            <attribute name="action">win.priority</attribute>
+            <attribute name="target">high</attribute>
+          </item>
+          <item>
+            <attribute name="label" translatable="yes">Normal</attribute>
+            <attribute name="action">win.priority</attribute>
+            <attribute name="target">normal</attribute>
+          </item>
+          <item>
+            <attribute name="label" translatable="yes">Low</attribute>
+            <attribute name="action">win.priority</attribute>
+            <attribute name="target">low</attribute>
+          </item>
+          <item>
+            <attribute name="label" translatable="yes">Very Low</attribute>
+            <attribute name="action">win.priority</attribute>
+            <attribute name="target">very-low</attribute>
+          </item>
+        </section>
+        <section>
+          <item>
+            <attribute name="label" translatable="yes">Custom</attribute>
+            <attribute name="action">win.priority</attribute>
+            <attribute name="target">custom</attribute>
+          </item>
+        </section>
+      </submenu>
+    </section>
+    <section>
+      <item>
+        <attribute name="label" translatable="yes">_Memory Maps</attribute>
+        <attribute name="action">win.memory-maps</attribute>
+        <attribute name="accel">&lt;Primary&gt;m</attribute>
+      </item>
+      <item>
+        <!-- Translators: this means 'Files that are open' (open is no verb here) -->
+        <attribute name="label" translatable="yes">Open _Files</attribute>
+        <attribute name="action">win.open-files</attribute>
+        <attribute name="accel">&lt;Primary&gt;f</attribute>
+      </item>
+    </section>
+    <section>
+      <item>
+        <attribute name="label" translatable="yes">_Properties</attribute>
+        <attribute name="action">win.process-properties</attribute>
+      </item>
+    </section>
+  </menu>
 </interface>
diff --git a/src/interface.cpp b/src/interface.cpp
index e55e63a..21b7f75 100644
--- a/src/interface.cpp
+++ b/src/interface.cpp
@@ -449,15 +449,22 @@ create_main_window (ProcmanApp *app)
     gint width, height, xpos, ypos;
     GtkWidget *main_window;
     GtkWidget *notebook;
+    GtkWidget *view_menu_button;
+    GMenuModel *view_menu_model;
 
     GtkBuilder *builder = gtk_builder_new();
     gtk_builder_add_from_resource (builder, "/org/gnome/gnome-system-monitor/data/interface.ui", NULL);
+    gtk_builder_add_from_resource (builder, "/org/gnome/gnome-system-monitor/data/menus.ui", NULL);
 
     main_window = GTK_WIDGET (gtk_builder_get_object (builder, "main_window"));
     gtk_window_set_application (GTK_WINDOW (main_window), app->gobj());
     gtk_widget_set_name (main_window, "gnome-system-monitor");
     app->main_window = main_window;
 
+    view_menu_button = GTK_WIDGET (gtk_builder_get_object (builder, "viewmenubutton"));
+    view_menu_model = G_MENU_MODEL (gtk_builder_get_object (builder, "view-menu"));
+    gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (view_menu_button), view_menu_model);
+
     GActionEntry win_action_entries[] = {
         { "about", on_activate_about, NULL, NULL, NULL },
         { "send-signal-stop", on_activate_send_signal_stop, NULL, NULL, NULL },


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