Unify menus and put all headerbar buttons on the left

This commit is contained in:
Rafał Dzięgiel
2021-02-04 15:47:14 +01:00
parent a7d99c4f81
commit 3cd98befb1
2 changed files with 7 additions and 19 deletions

View File

@@ -14,27 +14,17 @@ class ClapperHeaderBarBase extends Gtk.HeaderBar
const uiBuilder = Gtk.Builder.new_from_file(
`${clapperPath}/ui/clapper.ui`
);
const models = {
addMediaMenu: uiBuilder.get_object('addMediaMenu'),
settingsMenu: uiBuilder.get_object('settingsMenu'),
};
this.add_css_class('noborder');
this.set_title_widget(this._createWidgetForWindow(window));
const addMediaButton = new Gtk.MenuButton({
icon_name: 'list-add-symbolic',
});
const addMediaPopover = new HeaderBarPopover(models.addMediaMenu);
addMediaButton.set_popover(addMediaPopover);
this.pack_start(addMediaButton);
const openMenuButton = new Gtk.MenuButton({
const mainMenuButton = new Gtk.MenuButton({
icon_name: 'open-menu-symbolic',
});
const settingsPopover = new HeaderBarPopover(models.settingsMenu);
openMenuButton.set_popover(settingsPopover);
this.pack_end(openMenuButton);
const mainMenuModel = uiBuilder.get_object('mainMenu');
const mainMenuPopover = new HeaderBarPopover(mainMenuModel);
mainMenuButton.set_popover(mainMenuPopover);
this.pack_start(mainMenuButton);
const buttonsBox = new Gtk.Box({
orientation: Gtk.Orientation.HORIZONTAL,
@@ -53,7 +43,7 @@ class ClapperHeaderBarBase extends Gtk.HeaderBar
fullscreenButton.connect('clicked', this._onFullscreenButtonClicked.bind(this));
buttonsBox.append(fullscreenButton);
this.pack_end(buttonsBox);
this.pack_start(buttonsBox);
}
updateHeaderBar(title, subtitle)

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<menu id="addMediaMenu">
<menu id="mainMenu">
<section>
<item>
<attribute name="label" translatable="yes">Open Local...</attribute>
@@ -11,8 +11,6 @@
<attribute name="action">app.openUri</attribute>
</item>
</section>
</menu>
<menu id="settingsMenu">
<section>
<item>
<attribute name="label" translatable="yes">Preferences</attribute>