mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 00:27:43 +00:00
LibGUI: Remove Window::try_add_menu()
And fall back to the infallible add_menu().
This commit is contained in:
parent
5300896095
commit
bd61e75e0b
51 changed files with 294 additions and 302 deletions
|
@ -1318,17 +1318,16 @@ Gfx::Bitmap* Window::back_bitmap()
|
|||
return m_back_store ? &m_back_store->bitmap() : nullptr;
|
||||
}
|
||||
|
||||
ErrorOr<void> Window::try_add_menu(NonnullRefPtr<Menu> menu)
|
||||
void Window::add_menu(NonnullRefPtr<Menu> menu)
|
||||
{
|
||||
m_menubar->add_menu({}, move(menu));
|
||||
if (m_window_id) {
|
||||
menu->realize_menu_if_needed();
|
||||
ConnectionToWindowServer::the().async_add_menu(m_window_id, menu->menu_id());
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
ErrorOr<NonnullRefPtr<Menu>> Window::try_add_menu(String name)
|
||||
NonnullRefPtr<Menu> Window::add_menu(String name)
|
||||
{
|
||||
auto menu = m_menubar->add_menu({}, move(name));
|
||||
if (m_window_id) {
|
||||
|
@ -1338,12 +1337,6 @@ ErrorOr<NonnullRefPtr<Menu>> Window::try_add_menu(String name)
|
|||
return menu;
|
||||
}
|
||||
|
||||
Menu& Window::add_menu(String name)
|
||||
{
|
||||
auto menu = MUST(try_add_menu(move(name)));
|
||||
return *menu;
|
||||
}
|
||||
|
||||
void Window::flash_menubar_menu_for(MenuItem const& menu_item)
|
||||
{
|
||||
if (!Desktop::the().system_effects().flash_menus())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue