mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 09:30:24 +00:00
LibGUI: Add GUI::SettingsWindow::add_tab() that takes a constructed tab
This patch adds a new add_tab() function in GUI::SettingsWindow that takes an already created NonnullRefPtr<Tab> object. This allows us to handle errors while creating the Tab object and then pass it to this function to actually add the object to the SettingsWindow.
This commit is contained in:
parent
2693745336
commit
27a1798dd9
Notes:
sideshowbarker
2024-07-17 04:01:41 +09:00
Author: https://github.com/Baitinq Commit: https://github.com/SerenityOS/serenity/commit/27a1798dd9 Pull-request: https://github.com/SerenityOS/serenity/pull/16503 Reviewed-by: https://github.com/AtkinsSJ ✅
1 changed files with 9 additions and 0 deletions
|
@ -55,6 +55,15 @@ public:
|
|||
return tab;
|
||||
}
|
||||
|
||||
ErrorOr<void> add_tab(NonnullRefPtr<Tab> const& tab, DeprecatedString title, StringView id)
|
||||
{
|
||||
tab->set_title(move(title));
|
||||
TRY(m_tab_widget->try_add_widget(*tab));
|
||||
TRY(m_tabs.try_set(id, tab));
|
||||
tab->set_settings_window(*this);
|
||||
return {};
|
||||
}
|
||||
|
||||
Optional<NonnullRefPtr<Tab>> get_tab(StringView id) const;
|
||||
void set_active_tab(StringView id);
|
||||
|
||||
|
|
Loading…
Reference in a new issue