Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions Pinta.Core/Extensions/Gtk/GtkExtensions.Widget.cs
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,22 @@ public static Gtk.SpinButton CreateToolBarSpinButton (
return spin;
}

/// <summary>
/// Creates a Gtk.MenuButton with the popover configured to show regular nested
/// menus rather than sliding menus.
/// </summary>
public static Gtk.MenuButton CreateMenuButton (Gio.MenuModel model, string iconName, string? tooltip = null)
{
Gtk.PopoverMenu popover = Gtk.PopoverMenu.NewFromModelFull (model, Gtk.PopoverMenuFlags.Nested);

Gtk.MenuButton menu = Gtk.MenuButton.New ();
menu.Popover = popover;
menu.IconName = iconName;
menu.TooltipText = tooltip;

return menu;
}

public static Gtk.Scale CreateToolBarSlider (
int min,
int max,
Expand Down
59 changes: 27 additions & 32 deletions Pinta/MainWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -434,38 +434,33 @@ private void CreateMainMenu ()
private void CreateMainToolBar ()
{
if (window_shell.HeaderBar is not null) {
var header_bar = window_shell.HeaderBar;
header_bar.PackEnd (new Gtk.MenuButton () {
MenuModel = this.menu_bar,
IconName = Resources.StandardIcons.OpenMenu,
TooltipText = Translations.GetString ("Main Menu"),
});

header_bar.PackEnd (new Gtk.MenuButton () {
MenuModel = PintaCore.Chrome.EffectsMenu,
IconName = Resources.Icons.EffectsDefault,
TooltipText = Translations.GetString ("Effects"),
});

header_bar.PackEnd (new Gtk.MenuButton () {
MenuModel = PintaCore.Chrome.AdjustmentsMenu,
IconName = Resources.Icons.AdjustmentsDefault,
TooltipText = Translations.GetString ("Adjustments"),
});

header_bar.PackEnd (new Gtk.MenuButton () {
MenuModel = this.image_menu,
IconName = Resources.StandardIcons.ImageGeneric,
TooltipText = Translations.GetString ("Image"),
});

header_bar.PackEnd (new Gtk.MenuButton () {
MenuModel = this.view_menu,
IconName = Resources.StandardIcons.ViewReveal,
TooltipText = Translations.GetString ("View"),
});

PintaCore.Actions.CreateHeaderToolBar (header_bar);
var headerBar = window_shell.HeaderBar;
headerBar.PackEnd (GtkExtensions.CreateMenuButton (
this.menu_bar,
Resources.StandardIcons.OpenMenu,
Translations.GetString ("Main Menu")));

headerBar.PackEnd (GtkExtensions.CreateMenuButton (
PintaCore.Chrome.EffectsMenu,
Resources.Icons.EffectsDefault,
Translations.GetString ("Effects")));

headerBar.PackEnd (GtkExtensions.CreateMenuButton (
PintaCore.Chrome.AdjustmentsMenu,
Resources.Icons.AdjustmentsDefault,
Translations.GetString ("Adjustments")));

headerBar.PackEnd (GtkExtensions.CreateMenuButton (
this.image_menu,
Resources.StandardIcons.ImageGeneric,
Translations.GetString ("Image")));

headerBar.PackEnd (GtkExtensions.CreateMenuButton (
this.view_menu,
Resources.StandardIcons.ViewReveal,
Translations.GetString ("View")));

PintaCore.Actions.CreateHeaderToolBar (headerBar);
} else {
var main_toolbar = window_shell.CreateToolBar ("main_toolbar");
PintaCore.Actions.CreateToolBar (main_toolbar);
Expand Down
18 changes: 8 additions & 10 deletions Pinta/Pads/LayersPad.cs
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
//
//
// LayersPad.cs
//
//
// Author:
// Jonathan Pobst <monkey@jpobst.com>
//
//
// Copyright (c) 2011 Jonathan Pobst
//
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
Expand Down Expand Up @@ -63,10 +63,8 @@ public void Initialize (Dock workspace)
hamburger_menu.AppendSection (null, flip_section);
hamburger_menu.AppendSection (null, prop_section);

Gtk.MenuButton hamburger_button = new Gtk.MenuButton () {
MenuModel = hamburger_menu,
IconName = Resources.StandardIcons.OpenMenu
};
Gtk.MenuButton hamburger_button = GtkExtensions.CreateMenuButton (
hamburger_menu, Resources.StandardIcons.OpenMenu);

hamburger_button.Direction = Gtk.ArrowType.Up;

Expand Down
Loading