[gnome-tweaks] menus: Update for GNOME 3.32 guidelines



commit 1acde1b85481b68ec5fc15897032538b74036a65
Author: Bilal Elmoussaoui <bil elmoussaoui gmail com>
Date:   Thu Nov 15 20:36:00 2018 +0100

    menus: Update for GNOME 3.32 guidelines
    
    https://gitlab.gnome.org/GNOME/Initiatives/wikis/App-Menu-Retirement

 data/shell.ui       |  9 ++-------
 gtweak/app.py       | 12 ------------
 gtweak/tweakview.py | 17 +++++++++++++++--
 3 files changed, 17 insertions(+), 21 deletions(-)
---
diff --git a/data/shell.ui b/data/shell.ui
index 35f271d..3501513 100644
--- a/data/shell.ui
+++ b/data/shell.ui
@@ -14,14 +14,9 @@
    </section>
    <section>
       <item>
-       <attribute name="label" translatable="yes">_About</attribute>
+       <attribute name="label" translatable="yes">_About Tweaks</attribute>
        <attribute name="action">app.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>        
+      </item>
    </section>      
   </menu>
 </interface>
diff --git a/gtweak/app.py b/gtweak/app.py
index caabdb2..9435c9d 100644
--- a/gtweak/app.py
+++ b/gtweak/app.py
@@ -34,14 +34,6 @@ class GnomeTweaks(Gtk.Application):
     def do_startup(self):
         Gtk.Application.do_startup(self)
 
-        self.builder = Gtk.Builder()
-        assert(os.path.exists(gtweak.PKG_DATA_DIR))
-        filename = os.path.join(gtweak.PKG_DATA_DIR, 'shell.ui')
-        self.builder.add_from_file(filename)
-
-        appmenu = self.builder.get_object('appmenu')
-        self.set_app_menu(appmenu)
-
         reset_action = Gio.SimpleAction.new("reset", None)
         reset_action.connect("activate", self.reset_cb)
         self.add_action(reset_action)
@@ -58,10 +50,6 @@ class GnomeTweaks(Gtk.Application):
         about_action.connect("activate", self.about_cb)
         self.add_action(about_action)
 
-        quit_action = Gio.SimpleAction.new("quit", None)
-        quit_action.connect("activate", self.quit_cb)
-        self.add_action(quit_action)
-
     def reset_cb(self, action, parameter):
         dialog = Gtk.MessageDialog(self.win, 0, Gtk.MessageType.QUESTION,
                                    Gtk.ButtonsType.OK_CANCEL, _("Reset to Defaults"))
diff --git a/gtweak/tweakview.py b/gtweak/tweakview.py
index 98cc43e..3446f05 100644
--- a/gtweak/tweakview.py
+++ b/gtweak/tweakview.py
@@ -4,8 +4,8 @@
 
 import os.path
 
-from gi.repository import Gtk, Gdk
-
+from gi.repository import Gtk, Gdk, Gio
+import gtweak
 import gtweak.tweakmodel
 from gtweak.tweakmodel import string_for_search
 
@@ -84,6 +84,19 @@ class Window(Gtk.ApplicationWindow):
         lbl.get_style_context().add_class("title")
         left_header.set_custom_title(lbl)
 
+        self.builder = Gtk.Builder()
+        assert(os.path.exists(gtweak.PKG_DATA_DIR))
+        filename = os.path.join(gtweak.PKG_DATA_DIR, 'shell.ui')
+        self.builder.add_from_file(filename)
+
+        appmenu = self.builder.get_object('appmenu')
+        menu_btn = Gtk.MenuButton()
+        icon = Gtk.Image.new_from_gicon(Gio.ThemedIcon(name="open-menu-symbolic"),
+                                        Gtk.IconSize.BUTTON)
+        menu_btn.set_image(icon)
+        menu_btn.set_menu_model(appmenu)
+        right_header.pack_end(menu_btn)
+
         header.pack_start(left_header, False, False, 0)
         header.pack_start(Gtk.Separator(orientation=Gtk.Orientation.VERTICAL), False, False, 0)
         header.pack_start(right_header, True, True, 0)


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