[gnome-characters/bilelmoussaoui/gtk4: 24/76] menu: set from UI file




commit 24b5e51198744856bd6fc7302d7fee78c06e0eea
Author: Bilal Elmoussaoui <bil elmoussaoui gmail com>
Date:   Sat Nov 20 18:05:25 2021 +0100

    menu: set from UI file

 data/mainwindow.ui | 3 +++
 src/window.js      | 9 +++------
 2 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/data/mainwindow.ui b/data/mainwindow.ui
index 8d39dc1..b5eb669 100644
--- a/data/mainwindow.ui
+++ b/data/mainwindow.ui
@@ -113,6 +113,9 @@
                 <child type="end">
                   <object class="GtkMenuButton" id="menu-button">
                     <property name="icon-name">view-more-symbolic</property>
+                    <property name="popover">
+                      <object class="Gjs_MenuPopover" id="menuPopover" />
+                    </property>
                   </object>
                 </child>
               </object>
diff --git a/src/window.js b/src/window.js
index fee77cf..b60b987 100644
--- a/src/window.js
+++ b/src/window.js
@@ -40,7 +40,7 @@ var MainWindow = GObject.registerClass({
     InternalChildren: [
         'main-headerbar', 'search-active-button',
         'search-bar', 'search-entry', 'back-button',
-        'menu-button', 'container', 'sidebar',
+        'menuPopover', 'container', 'sidebar',
         'leaflet'
     ],
     Properties: {
@@ -96,9 +96,6 @@ var MainWindow = GObject.registerClass({
             this._leaflet.navigate(Adw.NavigationDirection.BACK);
         });
 
-        this._menu_popover = new MenuPopover();
-        this._menu_button.set_popover(this._menu_popover);
-
         this._mainView = new MainView(this._sidebar);
 
         this._container.append(this._mainView);
@@ -165,7 +162,7 @@ var MainWindow = GObject.registerClass({
     }
 
     _handleKeyPress(self, event) {
-        if (this._menu_popover.visible)
+        if (this._menuPopover.visible)
             return false;
         return this._search_bar.handle_event(event);
     }
@@ -235,7 +232,7 @@ var MainWindow = GObject.registerClass({
             family = null;
         this._mainView.filterFontFamily = family;
         this._updateTitle(this._mainView.visible_child.title);
-        this._menu_popover.hide();
+        this._menuPopover.hide();
     }
 
     _find() {


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