-
Notifications
You must be signed in to change notification settings - Fork 1
Overrides
Kevin edited this page Jun 12, 2026
·
4 revisions
Some properties, methods, and attributes of GObject.Objects are overridden to make declarative UI construction easier and reduce boilerplate.
local menu = Gio.Menu()
local item = Gio.MenuItem()
item:set_label('option 1')
item:set_detailed_action('action()')
local submenu = Gio.Menu()
local submenu_item = Gio.MenuItem()
submenu_item:set_label('submenu')
submenu_item:set_submenu(submenu)
menu:append_item(item)
menu:append_item(submenu_item)local menu = Gio.Menu {
Gio.MenuItem {
label = 'option 1',
action = 'action()',
},
Gio.MenuItem {
label = 'submenu',
-- Same as:
-- submenu = Gio.Menu { ... }
Gio.Menu {},
},
}