From 0e5047069b5782b39620af8a5fd31d57ba9809e5 Mon Sep 17 00:00:00 2001 From: Jaakko Keränen Date: Thu, 30 Dec 2021 08:12:13 +0200 Subject: DocumentWidget: Update banner while loading The banner would sometimes appear only after the page had finished loading, because the site icon got lost when the GmDocument was switched. --- src/ui/banner.c | 1 - src/ui/documentwidget.c | 9 +++++---- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src/ui') diff --git a/src/ui/banner.c b/src/ui/banner.c index 2b0b852e..e8c2e6d2 100644 --- a/src/ui/banner.c +++ b/src/ui/banner.c @@ -76,7 +76,6 @@ static void updateHeight_Banner_(iBanner *d) { } const size_t numItems = size_Array(&d->items); if (numItems) { -// const int innerPad = gap_UI; iConstForEach(Array, i, &d->items) { const iBannerItem *item = i.value; d->rect.size.y += item->height; diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index 65de157b..cbd32066 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c @@ -2129,12 +2129,17 @@ static void showOrHidePinningIndicator_DocumentWidget_(iDocumentWidget *d) { isPinned_DocumentWidget_(d)); } +static void updateBanner_DocumentWidget_(iDocumentWidget *d) { + setSite_Banner(d->banner, siteText_DocumentWidget_(d), siteIcon_GmDocument(d->view.doc)); +} + static void documentWasChanged_DocumentWidget_(iDocumentWidget *d) { iChangeFlags(d->flags, selecting_DocumentWidgetFlag, iFalse); setFlags_Widget(as_Widget(d), touchDrag_WidgetFlag, iFalse); updateVisitedLinks_GmDocument(d->view.doc); documentRunsInvalidated_DocumentWidget_(d); updateWindowTitle_DocumentWidget_(d); + updateBanner_DocumentWidget_(d); updateVisible_DocumentView_(&d->view); d->view.drawBufs->flags |= updateSideBuf_DrawBufsFlag; invalidate_DocumentWidget_(d); @@ -2161,10 +2166,6 @@ static void replaceDocument_DocumentWidget_(iDocumentWidget *d, iGmDocument *new documentWasChanged_DocumentWidget_(d); } -static void updateBanner_DocumentWidget_(iDocumentWidget *d) { - setSite_Banner(d->banner, siteText_DocumentWidget_(d), siteIcon_GmDocument(d->view.doc)); -} - static void updateTheme_DocumentWidget_(iDocumentWidget *d) { if (document_App() != d || category_GmStatusCode(d->sourceStatus) == categoryInput_GmStatusCode) { return; -- cgit v1.2.3