[gnome-news] Revert "application: Migrate to Primary Menu"



commit b94ce54e205ca3445177d515fbd3298b0c94a7f4
Author: Christopher Davis <brainblasted disroot org>
Date:   Mon Jan 21 10:21:52 2019 -0500

    Revert "application: Migrate to Primary Menu"
    
    This reverts commit 56a97929acd50967db6581d4528828184ac2c9df.

 data/gtk/menus.ui        |   9 +-
 data/ui/headerbar.ui     | 239 ++++++++++++++++++++---------------------------
 gnomenews/application.py |   2 -
 gnomenews/toolbar.py     |   6 --
 4 files changed, 109 insertions(+), 147 deletions(-)
---
diff --git a/data/gtk/menus.ui b/data/gtk/menus.ui
index e796e70..659d969 100644
--- a/data/gtk/menus.ui
+++ b/data/gtk/menus.ui
@@ -1,11 +1,16 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface domain="gnome-news">
-  <menu id="primary-menu">
+  <menu id="app-menu">
     <section>
       <item>
-        <attribute name="label" translatable="yes">About News</attribute>
+        <attribute name="label" translatable="yes">About</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>
     </section>
   </menu>
 </interface>
diff --git a/data/ui/headerbar.ui b/data/ui/headerbar.ui
index c89bc8b..63f26ba 100644
--- a/data/ui/headerbar.ui
+++ b/data/ui/headerbar.ui
@@ -1,35 +1,32 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.22.0 -->
 <interface domain="gnome-news">
-  <requires lib="gtk+" version="3.12"/>
+  <!-- interface-requires gtk+ 3.10 -->
   <object class="GtkPopover" id="add-popover">
     <property name="visible">True</property>
     <property name="can_focus">False</property>
-    <property name="tooltip_text" translatable="yes">Add a new feed</property>
     <property name="valign">center</property>
+    <property name="sensitive">True</property>
+    <property name="tooltip_text" translatable="yes">Add a new feed</property>
     <child>
       <object class="GtkBox" id="add-box">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
         <property name="valign">center</property>
+        <property name="sensitive">True</property>
         <property name="orientation">vertical</property>
+        <property name="margin">10</property>
         <property name="spacing">6</property>
         <child>
           <object class="GtkLabel" id="add-box-enter-address-label">
             <property name="visible">True</property>
-            <property name="can_focus">False</property>
+            <property name="can-focus">False</property>
             <property name="halign">start</property>
-            <property name="hexpand">True</property>
+            <property name="hexpand">true</property>
             <property name="label" translatable="yes">Enter feed address to add</property>
             <style>
               <class name="dim-label"/>
             </style>
           </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="position">0</property>
-          </packing>
         </child>
         <child>
           <object class="GtkBox" id="add-entry-box">
@@ -39,28 +36,22 @@
             <child>
               <object class="GtkEntry" id="new-url">
                 <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="width_chars">30</property>
                 <property name="input_purpose">url</property>
+                <property name="width-chars">30</property>
               </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="position">0</property>
-              </packing>
             </child>
             <child>
               <object class="GtkStack" id="add-button-stack">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
+                <property name="vhomogeneous">True</property>
                 <property name="interpolate_size">True</property>
                 <child>
                   <object class="GtkButton" id="add-button">
-                    <property name="label" translatable="yes">Add</property>
                     <property name="visible">True</property>
-                    <property name="sensitive">False</property>
                     <property name="can_focus">False</property>
-                    <property name="receives_default">False</property>
+                    <property name="sensitive">False</property>
+                    <property name="label" translatable="yes">Add</property>
                     <style>
                       <class name="suggested-action"/>
                     </style>
@@ -73,226 +64,200 @@
                   <object class="GtkSpinner">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="halign">start</property>
-                    <property name="valign">center</property>
                     <property name="active">True</property>
+                    <property name="valign">center</property>
+                    <property name="halign">start</property>
                   </object>
                   <packing>
                     <property name="name">spinner</property>
-                    <property name="position">1</property>
                   </packing>
                 </child>
               </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="position">1</property>
-              </packing>
             </child>
           </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="position">1</property>
-          </packing>
         </child>
         <child>
           <object class="GtkLabel" id="add-box-already-subscribed-label">
-            <property name="can_focus">False</property>
+            <property name="visible">False</property>
+            <property name="can-focus">False</property>
             <property name="halign">start</property>
             <property name="label" translatable="yes">You are already subscribed to that feed!</property>
           </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="position">2</property>
-          </packing>
         </child>
       </object>
     </child>
   </object>
-  <object class="GtkHeaderBar" id="header-bar">
+  <menu id="selection-menu">
+    <section>
+      <item>
+        <attribute name="label" translatable="yes">Select All</attribute>
+        <attribute name="action">win.selectAll</attribute>
+        <attribute name="accel">&lt;Primary&gt;a</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">Select None</attribute>
+        <attribute name="action">win.selectNone</attribute>
+      </item>
+    </section>
+  </menu>
+  <object class="GtkMenuButton" id="selection-menu-button">
+    <property name="menu-model">selection-menu</property>
     <property name="visible">True</property>
-    <property name="can_focus">False</property>
-    <property name="vexpand">False</property>
-    <property name="show_close_button">True</property>
+    <property name="can-focus">True</property>
+    <property name="relief">none</property>
+    <property name="can-focus">False</property>
     <child>
-      <object class="GtkMenuButton" id="primary-menu-button">
+      <object class="GtkBox" id="selection-menu-button-box">
         <property name="visible">True</property>
-        <property name="can_focus">True</property>
-        <property name="receives_default">True</property>
-        <property name="valign">center</property>
+        <property name="can-focus">False</property>
+        <property name="orientation">horizontal</property>
+        <property name="spacing">6</property>
         <child>
-          <object class="GtkImage">
+          <object class="GtkLabel" id="selection-menu-button-label">
             <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="icon_name">open-menu-symbolic</property>
+            <property name="can-focus">False</property>
+            <property name="label" translatable="yes">Click on items to select them</property>
           </object>
+          <packing>
+            <property name="pack-type">start</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkArrow" id="selection-menu-button-arrow">
+            <property name="visible">True</property>
+            <property name="can-focus">False</property>
+            <property name="arrow-type">down</property>
+            <property name="shadow-type">none</property>
+          </object>
+          <packing>
+            <property name="pack-type">start</property>
+            <property name="position">1</property>
+          </packing>
         </child>
-        <style>
-          <class name="image-button"/>
-        </style>
       </object>
-      <packing>
-        <property name="pack_type">end</property>
-      </packing>
     </child>
+    <style>
+      <class name="selection-menu"/>
+    </style>
+  </object>
+  <object class="GtkHeaderBar" id="header-bar">
+    <property name="visible">True</property>
+    <property name="vexpand">False</property>
+    <property name="show_close_button">True</property>
     <child>
       <object class="GtkButton" id="starred-button">
         <property name="can_focus">False</property>
-        <property name="receives_default">False</property>
-        <property name="tooltip_text" translatable="yes">Mark this article as starred</property>
         <property name="valign">center</property>
+        <property name="sensitive">True</property>
+        <property name="tooltip_text" translatable="yes">Mark this article as starred</property>
+        <style>
+          <class name="image-button"/>
+        </style>
         <child>
           <object class="GtkImage" id="starred-button-image">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <property name="icon_name">non-starred-symbolic</property>
-            <property name="icon_size">1</property>
+            <property name="icon-name">non-starred-symbolic</property>
+            <property name="icon-size">1</property>
           </object>
         </child>
-        <style>
-          <class name="image-button"/>
-        </style>
       </object>
       <packing>
         <property name="pack_type">end</property>
-        <property name="position">1</property>
       </packing>
     </child>
     <child>
       <object class="GtkToggleButton" id="search-button">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
-        <property name="receives_default">False</property>
-        <property name="tooltip_text" translatable="yes">Search</property>
         <property name="valign">center</property>
+        <property name="sensitive">True</property>
+        <property name="tooltip_text" translatable="yes">Search</property>
+        <style>
+          <class name="image-button"/>
+        </style>
         <child>
           <object class="GtkImage" id="search-button-image">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <property name="icon_name">edit-find-symbolic</property>
-            <property name="icon_size">1</property>
+            <property name="icon-name">edit-find-symbolic</property>
+            <property name="icon-size">1</property>
           </object>
         </child>
-        <style>
-          <class name="image-button"/>
-        </style>
       </object>
       <packing>
         <property name="pack_type">end</property>
-        <property name="position">2</property>
       </packing>
     </child>
     <child>
       <object class="GtkToggleButton" id="select-button">
         <property name="can_focus">False</property>
-        <property name="receives_default">False</property>
-        <property name="tooltip_text" translatable="yes">Select</property>
         <property name="valign">center</property>
+        <property name="sensitive">True</property>
+        <property name="tooltip_text" translatable="yes">Select</property>
+        <style>
+          <class name="image-button"/>
+        </style>
         <child>
           <object class="GtkImage" id="select-button-image">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <property name="icon_name">object-select-symbolic</property>
-            <property name="icon_size">1</property>
+            <property name="icon-name">object-select-symbolic</property>
+            <property name="icon-size">1</property>
           </object>
         </child>
-        <style>
-          <class name="image-button"/>
-        </style>
       </object>
       <packing>
         <property name="pack_type">end</property>
-        <property name="position">3</property>
       </packing>
     </child>
     <child>
       <object class="GtkMenuButton" id="add-toggle-button">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
-        <property name="receives_default">False</property>
-        <property name="tooltip_text" translatable="yes">Add a new feed</property>
         <property name="valign">center</property>
+        <property name="sensitive">True</property>
+        <property name="use_popover">True</property>
+        <property name="tooltip_text" translatable="yes">Add a new feed</property>
+        <style>
+              <class name="image-button"/>
+        </style>
         <child>
           <object class="GtkImage" id="add-button-image">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <property name="icon_name">list-add-symbolic</property>
-            <property name="icon_size">1</property>
+            <property name="icon-name">list-add-symbolic</property>
+            <property name="icon-size">1</property>
           </object>
         </child>
-        <style>
-          <class name="image-button"/>
-        </style>
       </object>
       <packing>
-        <property name="position">4</property>
+        <property name="pack_type">start</property>
       </packing>
     </child>
     <child>
       <object class="GtkButton" id="back-button">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
-        <property name="receives_default">False</property>
-        <property name="tooltip_text" translatable="yes">Back</property>
         <property name="valign">center</property>
+        <property name="sensitive">True</property>
+        <property name="tooltip_text" translatable="yes">Back</property>
+        <style>
+              <class name="image-button"/>
+        </style>
         <child>
           <object class="GtkImage" id="back-button-image">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <property name="icon_name">go-previous-symbolic</property>
-            <property name="icon_size">1</property>
+            <property name="icon-name">go-previous-symbolic</property>
+            <property name="icon-size">1</property>
           </object>
         </child>
-        <style>
-          <class name="image-button"/>
-        </style>
       </object>
       <packing>
-        <property name="position">5</property>
+        <property name="pack_type">start</property>
       </packing>
     </child>
   </object>
-  <object class="GtkMenuButton" id="selection-menu-button">
-    <property name="visible">True</property>
-    <property name="can_focus">False</property>
-    <property name="receives_default">False</property>
-    <property name="relief">none</property>
-    <child>
-      <object class="GtkBox" id="selection-menu-button-box">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="spacing">6</property>
-        <child>
-          <object class="GtkLabel" id="selection-menu-button-label">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="label" translatable="yes">Click on items to select them</property>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="position">0</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkArrow" id="selection-menu-button-arrow">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="arrow_type">down</property>
-            <property name="shadow_type">none</property>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="position">1</property>
-          </packing>
-        </child>
-      </object>
-    </child>
-    <style>
-      <class name="selection-menu"/>
-    </style>
-  </object>
 </interface>
diff --git a/gnomenews/application.py b/gnomenews/application.py
index 273ad5d..91bb63d 100644
--- a/gnomenews/application.py
+++ b/gnomenews/application.py
@@ -68,8 +68,6 @@ class Application(Gtk.Application):
             action.connect("activate", getattr(self, action_name))
             self.add_action(action)
 
-        self.set_accels_for_action("app.quit", ["<Primary>q"])
-
         Gtk.Application.do_startup(self)
 
     @log
diff --git a/gnomenews/toolbar.py b/gnomenews/toolbar.py
index eea0fbd..cd4a8a9 100644
--- a/gnomenews/toolbar.py
+++ b/gnomenews/toolbar.py
@@ -77,12 +77,6 @@ class Toolbar(GObject.GObject):
         self._starred_button.connect('clicked', self._toggle_starred)
         self.starred = False
 
-        # Primary menu
-        self._ui.add_from_resource('/org/gnome/News/gtk/menus.ui')
-        self._primary_menu_model = self._ui.get_object('primary-menu')
-        self._primary_menu_button = self._ui.get_object('primary-menu-button')
-        self._primary_menu_button.set_menu_model(self._primary_menu_model)
-
         self.set_state(ToolbarState.MAIN)
 
         self._stack_switcher.show()


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