summaryrefslogtreecommitdiff
path: root/src/ui/documentwidget.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/documentwidget.c')
-rw-r--r--src/ui/documentwidget.c29
1 files changed, 24 insertions, 5 deletions
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c
index 9a97c39e..6313e6df 100644
--- a/src/ui/documentwidget.c
+++ b/src/ui/documentwidget.c
@@ -280,6 +280,11 @@ static void updateVisible_DocumentWidget_(iDocumentWidget *d) {
280} 280}
281 281
282static void updateWindowTitle_DocumentWidget_(const iDocumentWidget *d) { 282static void updateWindowTitle_DocumentWidget_(const iDocumentWidget *d) {
283 iLabelWidget *tabButton = tabPageButton_Widget(findWidget_App("doctabs"), d);
284 if (!tabButton) {
285 /* Not part of the UI at the moment. */
286 return;
287 }
283 iStringArray *title = iClob(new_StringArray()); 288 iStringArray *title = iClob(new_StringArray());
284 if (!isEmpty_String(title_GmDocument(d->doc))) { 289 if (!isEmpty_String(title_GmDocument(d->doc))) {
285 pushBack_StringArray(title, title_GmDocument(d->doc)); 290 pushBack_StringArray(title, title_GmDocument(d->doc));
@@ -298,7 +303,6 @@ static void updateWindowTitle_DocumentWidget_(const iDocumentWidget *d) {
298 pushBackCStr_StringArray(title, "Lagrange"); 303 pushBackCStr_StringArray(title, "Lagrange");
299 } 304 }
300 /* Take away parts if it doesn't fit. */ 305 /* Take away parts if it doesn't fit. */
301 iLabelWidget *tabButton = tabPageButton_Widget(findWidget_App("doctabs"), d);
302 const int avail = bounds_Widget(as_Widget(tabButton)).size.x - 3 * gap_UI; 306 const int avail = bounds_Widget(as_Widget(tabButton)).size.x - 3 * gap_UI;
303 iBool setWindow = (document_App() == d); 307 iBool setWindow = (document_App() == d);
304 for (;;) { 308 for (;;) {
@@ -455,9 +459,11 @@ static void fetch_DocumentWidget_(iDocumentWidget *d) {
455static void updateTrust_DocumentWidget_(iDocumentWidget *d, const iGmResponse *response) { 459static void updateTrust_DocumentWidget_(iDocumentWidget *d, const iGmResponse *response) {
456#define openLock_CStr "\U0001f513" 460#define openLock_CStr "\U0001f513"
457#define closedLock_CStr "\U0001f512" 461#define closedLock_CStr "\U0001f512"
458 d->certFlags = response->certFlags; 462 if (response) {
459 d->certExpiry = response->certValidUntil; 463 d->certFlags = response->certFlags;
460 set_String(d->certSubject, &response->certSubject); 464 d->certExpiry = response->certValidUntil;
465 set_String(d->certSubject, &response->certSubject);
466 }
461 iLabelWidget *lock = findWidget_App("navbar.lock"); 467 iLabelWidget *lock = findWidget_App("navbar.lock");
462 if (~d->certFlags & available_GmCertFlag) { 468 if (~d->certFlags & available_GmCertFlag) {
463 setFlags_Widget(as_Widget(lock), disabled_WidgetFlag, iTrue); 469 setFlags_Widget(as_Widget(lock), disabled_WidgetFlag, iTrue);
@@ -516,6 +522,16 @@ void setUrlFromCache_DocumentWidget(iDocumentWidget *d, const iString *url, iBoo
516 } 522 }
517} 523}
518 524
525iDocumentWidget *duplicate_DocumentWidget(iDocumentWidget *orig) {
526 iDocumentWidget *d = new_DocumentWidget();
527 delete_History(d->history);
528 d->textSizePercent = orig->textSizePercent;
529 d->initialScrollY = orig->scrollY;
530 d->history = copy_History(orig->history);
531 setUrlFromCache_DocumentWidget(d, orig->url, iTrue);
532 return d;
533}
534
519void setUrl_DocumentWidget(iDocumentWidget *d, const iString *url) { 535void setUrl_DocumentWidget(iDocumentWidget *d, const iString *url) {
520 setUrlFromCache_DocumentWidget(d, url, iFalse); 536 setUrlFromCache_DocumentWidget(d, url, iFalse);
521} 537}
@@ -754,11 +770,14 @@ static iBool handleCommand_DocumentWidget_(iDocumentWidget *d, const char *cmd)
754 if (cmp_String(id_Widget(w), suffixPtr_Command(cmd, "id")) == 0) { 770 if (cmp_String(id_Widget(w), suffixPtr_Command(cmd, "id")) == 0) {
755 /* Set palette for our document. */ 771 /* Set palette for our document. */
756 updateTheme_DocumentWidget_(d); 772 updateTheme_DocumentWidget_(d);
773 updateTrust_DocumentWidget_(d, NULL);
774 setWidth_GmDocument(d->doc, documentWidth_DocumentWidget_(d));
775 updateVisible_DocumentWidget_(d);
757 } 776 }
758 updateWindowTitle_DocumentWidget_(d); 777 updateWindowTitle_DocumentWidget_(d);
759 return iFalse; 778 return iFalse;
760 } 779 }
761 else if (equal_Command(cmd, "server.showcert")) { 780 else if (equal_Command(cmd, "server.showcert") && d == document_App()) {
762 const char *unchecked = red_ColorEscape "\u2610"; 781 const char *unchecked = red_ColorEscape "\u2610";
763 const char *checked = green_ColorEscape "\u2611"; 782 const char *checked = green_ColorEscape "\u2611";
764 makeMessage_Widget( 783 makeMessage_Widget(