made popover spawning buttons proper gtk.menubutton

parent 6d528677
Pipeline #225383 failed with stage
in 11 minutes and 30 seconds
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.1 -->
<!-- Generated with glade 3.38.1 -->
<interface>
<requires lib="gtk+" version="3.20"/>
<requires lib="libhandy" version="0.0"/>
<object class="HdyHeaderBar" id="left_headerbar">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can-focus">False</property>
<child type="title">
<placeholder/>
</child>
<child>
<object class="GtkButton" id="add_btn">
<object class="GtkMenuButton" id="add_btn">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="tooltip_text" translatable="yes">Add new feed</property>
<property name="can-focus">True</property>
<property name="focus-on-click">False</property>
<property name="receives-default">True</property>
<property name="tooltip-text" translatable="yes">Add new feed</property>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">list-add-symbolic</property>
<property name="can-focus">False</property>
<property name="icon-name">list-add-symbolic</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkBox" id="refresh_btn_box">
<object class="GtkMenuButton" id="menu_btn">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="can-focus">True</property>
<property name="focus-on-click">False</property>
<property name="receives-default">True</property>
<property name="tooltip-text" translatable="yes">Menu</property>
<child>
<placeholder/>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="icon-name">open-menu-symbolic</property>
</object>
</child>
</object>
<packing>
<property name="pack-type">end</property>
<property name="position">1</property>
</packing>
</child>
<child type="title">
<placeholder/>
</child>
<child>
<object class="GtkButton" id="menu_btn">
<object class="GtkBox" id="refresh_btn_box">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="tooltip_text" translatable="yes">Menu</property>
<signal name="clicked" handler="on_menu_btn_clicked" swapped="no"/>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">open-menu-symbolic</property>
</object>
<placeholder/>
</child>
</object>
<packing>
<property name="pack_type">end</property>
<property name="position">1</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkButton" id="filter_btn">
<object class="GtkToggleButton" id="search_btn">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="tooltip_text" translatable="yes">Filter by feed</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="tooltip-text" translatable="yes">Search</property>
<signal name="toggled" handler="on_search_btn_toggled" swapped="no"/>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">view-list-symbolic</property>
<property name="can-focus">False</property>
<property name="icon-name">system-search-symbolic</property>
</object>
</child>
</object>
<packing>
<property name="pack_type">end</property>
<property name="position">2</property>
<property name="pack-type">end</property>
<property name="position">3</property>
</packing>
</child>
<child>
<object class="GtkToggleButton" id="search_btn">
<object class="GtkMenuButton" id="filter_btn">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="tooltip_text" translatable="yes">Search</property>
<signal name="toggled" handler="on_search_btn_toggled" swapped="no"/>
<property name="can-focus">True</property>
<property name="focus-on-click">False</property>
<property name="receives-default">True</property>
<property name="tooltip-text" translatable="yes">Filter by feed</property>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">system-search-symbolic</property>
<property name="can-focus">False</property>
<property name="icon-name">view-list-symbolic</property>
</object>
</child>
</object>
<packing>
<property name="pack_type">end</property>
<property name="position">3</property>
<property name="pack-type">end</property>
<property name="position">4</property>
</packing>
</child>
</object>
<object class="HdyHeaderBar" id="right_headerbar">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can-focus">False</property>
<child type="title">
<object class="HdySqueezer" id="right_headerbar_squeezer">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<placeholder/>
</child>
</object>
</child>
<child>
<object class="GtkButton" id="back_btn">
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="no_show_all">True</property>
<property name="tooltip_text" translatable="yes">Back to articles</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="no-show-all">True</property>
<property name="tooltip-text" translatable="yes">Back to articles</property>
<signal name="clicked" handler="on_back_button_clicked" swapped="no"/>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">go-previous-symbolic</property>
<property name="can-focus">False</property>
<property name="icon-name">go-previous-symbolic</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkButton" id="open_externally_btn">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="tooltip-text" translatable="yes">Open externally</property>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="icon-name">gfeeds-open-externally-symbolic</property>
</object>
</child>
</object>
<packing>
<property name="pack-type">end</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="view_mode_menu_btn">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="tooltip_text" translatable="yes">Change view mode</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="tooltip-text" translatable="yes">Change view mode</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can-focus">False</property>
<property name="spacing">6</property>
<child>
<object class="GtkImage" id="view_mode_menu_btn_icon">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can-focus">False</property>
</object>
<packing>
<property name="expand">False</property>
......@@ -142,8 +173,8 @@
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">pan-down-symbolic</property>
<property name="can-focus">False</property>
<property name="icon-name">pan-down-symbolic</property>
</object>
<packing>
<property name="expand">False</property>
......@@ -162,15 +193,15 @@
<object class="GtkButton" id="share_btn">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="tooltip_text" translatable="yes">Share</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="tooltip-text" translatable="yes">Share</property>
<signal name="clicked" handler="copy_article_uri" swapped="no"/>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">emblem-shared-symbolic</property>
<property name="can-focus">False</property>
<property name="icon-name">emblem-shared-symbolic</property>
</object>
</child>
</object>
......@@ -178,54 +209,25 @@
<property name="position">6</property>
</packing>
</child>
<child type="title">
<object class="HdySqueezer" id="right_headerbar_squeezer">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<placeholder/>
</child>
</object>
</child>
<child>
<object class="GtkButton" id="open_externally_btn">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="tooltip_text" translatable="yes">Open externally</property>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">gfeeds-open-externally-symbolic</property>
</object>
</child>
</object>
<packing>
<property name="pack_type">end</property>
<property name="position">1</property>
</packing>
</child>
</object>
<object class="GtkScrolledWindow" id="right_headerbar_title_container">
<property name="width_request">100</property>
<property name="width-request">100</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can-focus">True</property>
<property name="hexpand">True</property>
<child>
<object class="GtkViewport">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="shadow_type">none</property>
<property name="can-focus">False</property>
<property name="shadow-type">none</property>
<child>
<object class="GtkLabel" id="title_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="can-focus">False</property>
<property name="halign">center</property>
<property name="justify">center</property>
<property name="ellipsize">end</property>
<property name="single_line_mode">True</property>
<property name="single-line-mode">True</property>
<style>
<class name="title"/>
</style>
......
......@@ -135,11 +135,7 @@ class GFeedsAppWindow(Handy.ApplicationWindow):
shortcuts_l = [
{
'combo': 'F10',
'cb': lambda *args: (
self.headerbar.menu_popover.popup
if not self.headerbar.menu_popover.is_visible()
else self.headerbar.menu_popover.popdown
)()
'cb': lambda *args: self.headerbar.menu_btn.clicked()
},
{
'combo': '<Control>r',
......
......@@ -123,10 +123,6 @@ class GFeedHeaderbar(Handy.WindowHandle):
self.set_view_mode_icon(self.confman.conf['default_view'])
self.view_mode_menu = GFeedsViewModeMenu(self.view_mode_menu_btn)
# low priority: low impact, happens rarely
self.view_mode_menu_btn.connect(
'clicked',
lambda *args: self.view_mode_menu.popup()
)
self.open_externally_btn = self.builder.get_object(
'open_externally_btn'
)
......@@ -146,14 +142,14 @@ class GFeedHeaderbar(Handy.WindowHandle):
)
self.menu = self.menu_builder.get_object('generalMenu')
self.menu_popover.bind_model(self.menu)
self.menu_popover.set_relative_to(self.menu_btn)
self.menu_popover.set_modal(True)
self.menu_btn.set_popover(self.menu_popover)
self.search_btn = self.builder.get_object('search_btn')
self.filter_btn = self.builder.get_object(
'filter_btn'
)
self.filter_popover = FeedsViewPopover(self.filter_btn)
self.filter_btn.set_popover(self.filter_popover)
# this activates the "All" feed filter. while this works it's kinda
# hacky and needs a proper function
self.feedman.connect(
......@@ -169,6 +165,7 @@ class GFeedHeaderbar(Handy.WindowHandle):
)
self.add_btn.set_tooltip_text(_('Add new feed'))
self.add_popover = AddFeedPopover(self.add_btn)
self.add_btn.set_popover(self.add_popover)
self.refresh_btn = RefreshSpinnerButton()
self.refresh_btn.btn.connect('clicked', self.feedman.refresh)
......@@ -258,9 +255,6 @@ class GFeedHeaderbar(Handy.WindowHandle):
self.leaflet.set_visible_child(self.left_headerbar)
self.back_btn_func()
def on_menu_btn_clicked(self, *args):
self.menu_popover.popup()
def on_load_start(self, *args):
self.view_mode_menu_btn.set_sensitive(False)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment