[gnome-system-monitor] Removed appmenu (#89)



commit 6a55bfa196e5ede4697945459bfe8a9b1c4eed28
Author: Robert Roth <robert roth off gmail com>
Date:   Mon Dec 10 19:40:08 2018 +0200

    Removed appmenu (#89)

 data/interface.ui   | 17 +++++++++++++++++
 data/menus.ui       | 34 ++++++++++++++++++++++++----------
 src/application.cpp |  1 +
 src/application.h   |  1 +
 src/interface.cpp   | 12 +++++++++---
 5 files changed, 52 insertions(+), 13 deletions(-)
---
diff --git a/data/interface.ui b/data/interface.ui
index 80edfa84..9f1e40cf 100644
--- a/data/interface.ui
+++ b/data/interface.ui
@@ -37,6 +37,23 @@
             <property name="pack_type">end</property>
           </packing>
         </child>
+        <child>
+          <object class="GtkMenuButton" id="window_menu_button">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="use_popover">True</property>
+            <property name="valign">center</property>
+            <property name="halign">end</property>
+            <property name="direction">none</property>
+            <accelerator key="F10" signal="clicked"/>
+            <style>
+              <class name="title-button"/>
+            </style>
+          </object>
+          <packing>
+            <property name="pack_type">end</property>
+          </packing>
+        </child>
         <child>
           <object class="GtkToggleButton" id="search_button">
             <property name="visible">True</property>
diff --git a/data/menus.ui b/data/menus.ui
index 61d3a826..c8cfdef3 100644
--- a/data/menus.ui
+++ b/data/menus.ui
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
 <interface>
-  <menu id="app-menu">
+  <menu id="generic-window-menu">
     <section>
       <item>
         <attribute name="label" translatable="yes" context="Menu item to Open Search for Open Files 
dialog">Search for Open Files</attribute>
@@ -12,22 +12,15 @@
         <attribute name="label" translatable="yes">Preferences</attribute>
         <attribute name="action">app.preferences</attribute>
       </item>
-    </section>
-    <section>
       <item>
         <attribute name="label" translatable="yes">Help</attribute>
         <attribute name="action">app.help</attribute>
         <attribute name="accel">F1</attribute>
       </item>
       <item>
-        <attribute name="label" translatable="yes">About</attribute>
+        <attribute name="label" translatable="yes">About System Monitor</attribute>
         <attribute name="action">win.about</attribute>
       </item>
-      <item>
-        <attribute name="label" translatable="yes">Quit</attribute>
-        <attribute name="action">app.quit</attribute>
-        <attribute name="accel">&lt;Primary&gt;q</attribute>
-      </item>
     </section>
   </menu>
   <menu id="process-window-menu">
@@ -57,11 +50,32 @@
     </section>
     <section>
       <item>
-        <attribute name="label" translatable="yes">_Dependencies</attribute>
+        <attribute name="label" translatable="yes">Show _Dependencies</attribute>
         <attribute name="action">win.show-dependencies</attribute>
         <attribute name="accel">&lt;Primary&gt;d</attribute>
       </item>
     </section>
+    <section>
+      <item>
+        <attribute name="label" translatable="yes" context="Menu item to Open Search for Open Files 
dialog">Search for Open Files</attribute>
+        <attribute name="action">app.lsof</attribute>
+      </item>
+    </section>
+    <section>
+      <item>
+        <attribute name="label" translatable="yes">Preferences</attribute>
+        <attribute name="action">app.preferences</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">Help</attribute>
+        <attribute name="action">app.help</attribute>
+        <attribute name="accel">F1</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">About System Monitor</attribute>
+        <attribute name="action">win.about</attribute>
+      </item>
+    </section>
   </menu>
   <menu id="process-popup-menu">
     <section>
diff --git a/src/application.cpp b/src/application.cpp
index eb66e584..9963f46f 100644
--- a/src/application.cpp
+++ b/src/application.cpp
@@ -217,6 +217,7 @@ GsmApplication::GsmApplication()
       stack(NULL),
       refresh_button(NULL),
       process_menu_button(NULL),
+      window_menu_button(NULL),
       end_process_button(NULL),
       search_button(NULL),
       search_entry(NULL),
diff --git a/src/application.h b/src/application.h
index f1f20790..49efc802 100644
--- a/src/application.h
+++ b/src/application.h
@@ -205,6 +205,7 @@ public:
     GtkStack         *stack;
     GtkButton        *refresh_button;
     GtkMenuButton    *process_menu_button;
+    GtkMenuButton    *window_menu_button;
     GtkButton        *end_process_button;
     GtkButton        *search_button;
     GtkSearchEntry   *search_entry;
diff --git a/src/interface.cpp b/src/interface.cpp
index 57b1594b..449b4d34 100644
--- a/src/interface.cpp
+++ b/src/interface.cpp
@@ -560,6 +560,7 @@ update_page_activities (GsmApplication *app)
         gtk_widget_show (GTK_WIDGET (app->end_process_button));
         gtk_widget_show (GTK_WIDGET (app->search_button));
         gtk_widget_show (GTK_WIDGET (app->process_menu_button));
+        gtk_widget_hide (GTK_WIDGET (app->window_menu_button));
 
         update_sensitivity (app);
 
@@ -573,6 +574,7 @@ update_page_activities (GsmApplication *app)
         gtk_widget_hide (GTK_WIDGET (app->end_process_button));
         gtk_widget_hide (GTK_WIDGET (app->search_button));
         gtk_widget_hide (GTK_WIDGET (app->process_menu_button));
+        gtk_widget_show (GTK_WIDGET (app->window_menu_button));
 
         update_sensitivity (app);
     }
@@ -650,7 +652,7 @@ create_main_window (GsmApplication *app)
 {
     GtkApplicationWindow *main_window;
     GtkStack *stack;
-    GtkMenuButton *process_menu_button;
+    GMenuModel *window_menu_model;
     GMenuModel *process_menu_model;
     GdkDisplay *display;
     GdkMonitor *monitor;
@@ -701,9 +703,13 @@ create_main_window (GsmApplication *app)
     if (app->settings->get_boolean (GSM_SETTING_MAXIMIZED))
         gtk_window_maximize (GTK_WINDOW (main_window));
 
-    app->process_menu_button = process_menu_button = GTK_MENU_BUTTON (gtk_builder_get_object (builder, 
"process_menu_button"));
+    app->process_menu_button = GTK_MENU_BUTTON (gtk_builder_get_object (builder, "process_menu_button"));
     process_menu_model = G_MENU_MODEL (gtk_builder_get_object (builder, "process-window-menu"));
-    gtk_menu_button_set_menu_model (process_menu_button, process_menu_model);
+    gtk_menu_button_set_menu_model (app->process_menu_button, process_menu_model);
+
+    app->window_menu_button = GTK_MENU_BUTTON (gtk_builder_get_object (builder, "window_menu_button"));
+    window_menu_model = G_MENU_MODEL (gtk_builder_get_object (builder, "generic-window-menu"));
+    gtk_menu_button_set_menu_model (app->window_menu_button, window_menu_model);
 
     app->end_process_button = GTK_BUTTON (gtk_builder_get_object (builder, "end_process_button"));
 


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