BibliothecaWindow is the top-level GTK window that stitches together the data
model (BookList) and the UI widgets (BookShelf, search bar, placeholders).
It owns the application chrome and orchestrates imports, filtering, and state
transitions between empty / shelf / no-results views.
Gtk::Box).Gtk::SearchBar + Gtk::SearchEntry) and pipe queries
to BookShelf::setFilter().Gtk::Stack that swaps between:
BookShelf).BookList::upsertMany().Gtk::Window (BibliothecaWindow)
└── Gtk::Box m_mainBox (vertical)
├── Gtk::SearchBar m_searchBar
│ └── Gtk::SearchEntry m_searchEntry
└── Gtk::Stack m_stack
├── Gtk::Box m_placeholder // empty library
├── BookShelf (GridView) // main shelf view
└── Gtk::Box m_noResults // "no match" placeholder
The header bar carries the add (+) button and a search toggle button that activates the search bar.
buildHeaderBar(), buildPlaceholder(),
creates the shelf, search widgets, and stack, then calls updateVisibleView()
to pick the correct page based on the current library.Gtk::SearchBar.m_lastQuery, calls BookShelf::setFilter(), and refreshes
the stack (showing “no results” if the filtered shelf is empty).onAddBookClicked() opens Gtk::FileDialog::open_multiple().import_book_assets(), merge metadata, collect into a vector.BookList::upsertMany(), and the UI refreshes.BookShelf::signalBookActivated() connects to
BibliothecaWindow::onBookActivated(), which currently logs a placeholder
message (can be extended to open a details pane or reader).BibliothecaWindow subscribes to the relevant BookList signals to call
updateVisibleView() whenever the library changes. This keeps the stack in sync
with imports, deletions, and resets without manual intervention.
m_mainBox that reuses
the existing import flow.BookShelf.BibliothecaWindow is the root window instantiated in main.cpp. Other modules
should construct it with an existing BookList:
auto window = Gtk::make_managed<BibliothecaWindow>(bookList);
app->add_window(*window);
The window takes ownership of the BookShelf widget and manages presentation
according to the current state of the library and active search query.