nub is:module

Functions to remove duplicates from a list.

Performance

To check the performance there was done a bunch of benchmarks. Benchmarks were made on lists of Ints and Texts. There were two types of list to use:
  • Lists which consist of many different elements
  • Lists which consist of many same elements
Here are some recommendations for usage of particular functions based on benchmarking results.
  • hashNub is faster than ordNub when there're not so many different values in the list.
  • hashNub is the fastest with Text.
  • intNub is faster when you work with lists of Ints.
  • intNubOn is fast with the lists of type that can have fixed number representations.
  • sortNub has better performance than ordNub but should be used when sorting is also needed.
  • unstableNub has better performance than hashNub but doesn't save the original order.
Functions to remove duplicates from a list.

Performance

To check the performance many benchmarks were done. Benchmarks were made on lists of Ints and Texts. There were two types of list to use:
  • Lists which consist of many different elements
  • Lists which consist of many same elements
Here are some recomendations for usage of particular functions based on benchmarking resutls.
  • hashNub is faster than ordNub when there're not so many different values in the list.
  • hashNub is the fastest with Text.
  • sortNub has better performance than ordNub but should be used when sorting is also needed.
  • unstableNub has better performance than hashNub but doesn't save the original order.
A subclass widget for MenuShell which holds MenuItem widgets
The GtkMenuButton widget is used to display a popup when clicked. This popup can be provided either as a GtkPopover or as an abstract GMenuModel. The GtkMenuButton widget can show either an icon (set with the MenuButton:iconName property) or a label (set with the MenuButton:label property). If neither is explicitly set, a Image is automatically created, using an arrow image oriented according to MenuButton:direction or the generic “open-menu-symbolic” icon if the direction is not set. The positioning of the popup is determined by the MenuButton:direction property of the menu button. For menus, the Widget:halign and Widget:valign properties of the menu are also taken into account. For example, when the direction is ArrowTypeDown and the horizontal alignment is AlignStart, the menu will be positioned below the button, with the starting edge (depending on the text direction) of the menu aligned with the starting edge of the button. If there is not enough space below the button, the menu is popped up above the button instead. If the alignment would move part of the menu offscreen, it is “pushed in”. | | start | center | end | | - | --- | --- | --- | | down | | | | | up | | | | | left | | | | | right | | | |

CSS nodes

menubutton
╰── button.toggle
╰── <content>
╰── [arrow]
GtkMenuButton has a single CSS node with name menubutton which contains a button node with a .toggle style class. If the button contains an icon, it will have the .image-button style class, if it contains text, it will have .text-button style class. If an arrow is visible in addition to an icon, text or a custom child, it will also have .arrow-button style class. Inside the toggle button content, there is an arrow node for the indicator, which will carry one of the .none, .up, .down, .left or .right style classes to indicate the direction that the menu will appear in. The CSS is expected to provide a suitable image for each of these cases using the -gtk-icon-source property. Optionally, the menubutton node can carry the .circular style class to request a round appearance.

Accessibility

GtkMenuButton uses the AccessibleRoleButton role.
GtkPopoverMenuBar presents a horizontal bar of items that pop up popover menus when clicked. The only way to create instances of GtkPopoverMenuBar is from a GMenuModel.

CSS nodes

menubar
├── item[.active]
┊   ╰── popover
╰── item
╰── popover
GtkPopoverMenuBar has a single CSS node with name menubar, below which each item has its CSS node, and below that the corresponding popover. The item whose popover is currently open gets the .active style class.

Accessibility

GtkPopoverMenuBar uses the AccessibleRoleMenuBar role, the menu items use the AccessibleRoleMenuItem role and the menus use the AccessibleRoleMenu role.
Displays a popup when clicked. <picture> <source srcset="menu-button-dark.png" media="(prefers-color-scheme: dark)"> <img alt="An example GtkMenuButton" src="menu-button.png"> </picture> This popup can be provided either as a GtkPopover or as an abstract GMenuModel. The GtkMenuButton widget can show either an icon (set with the MenuButton:iconName property) or a label (set with the MenuButton:label property). If neither is explicitly set, a Image is automatically created, using an arrow image oriented according to MenuButton:direction or the generic “open-menu-symbolic” icon if the direction is not set. The positioning of the popup is determined by the MenuButton:direction property of the menu button. For menus, the Widget:halign and Widget:valign properties of the menu are also taken into account. For example, when the direction is ArrowTypeDown and the horizontal alignment is AlignStart, the menu will be positioned below the button, with the starting edge (depending on the text direction) of the menu aligned with the starting edge of the button. If there is not enough space below the button, the menu is popped up above the button instead. If the alignment would move part of the menu offscreen, it is “pushed in”. | | start | center | end | | - | --- | --- | --- | | down | | | | | up | | | | | left | | | | | right | | | |

CSS nodes

menubutton
╰── button.toggle
╰── <content>
╰── [arrow]
GtkMenuButton has a single CSS node with name menubutton which contains a button node with a .toggle style class. If the button contains an icon, it will have the .image-button style class, if it contains text, it will have .text-button style class. If an arrow is visible in addition to an icon, text or a custom child, it will also have .arrow-button style class. Inside the toggle button content, there is an arrow node for the indicator, which will carry one of the .none, .up, .down, .left or .right style classes to indicate the direction that the menu will appear in. The CSS is expected to provide a suitable image for each of these cases using the -gtk-icon-source property. Optionally, the menubutton node can carry the .circular style class to request a round appearance.

Accessibility

GtkMenuButton uses the AccessibleRoleButton role.
Presents a horizontal bar of items that pop up menus when clicked. <picture> <source srcset="menubar-dark.png" media="(prefers-color-scheme: dark)"> <img alt="An example GtkPopoverMenuBar" src="menubar.png"> </picture> The only way to create instances of GtkPopoverMenuBar is from a GMenuModel.

CSS nodes

menubar
├── item[.active]
┊   ╰── popover
╰── item
╰── popover
GtkPopoverMenuBar has a single CSS node with name menubar, below which each item has its CSS node, and below that the corresponding popover. The item whose popover is currently open gets the .active style class.

Accessibility

GtkPopoverMenuBar uses the AccessibleRoleMenuBar role, the menu items use the AccessibleRoleMenuItem role and the menus use the AccessibleRoleMenu role.