summaryrefslogtreecommitdiff
path: root/src/ui/documentwidget.c
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-10-26 08:46:55 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-10-26 08:46:55 +0300
commitc2f3c6569c0dd6bddd26e3c63196b0afb236def0 (patch)
tree0a50798689b5c3664722989b48f7d805a8608ffa /src/ui/documentwidget.c
parent4d878508c816e9d42215db3c72240a13a9f96f8c (diff)
Dismissing document warnings; Banner hover
The warning about terminal emulation can be dismissed on site-specific basis. Banner items show a hover frame (like buttons) to indicate they can be clicked.
Diffstat (limited to 'src/ui/documentwidget.c')
-rw-r--r--src/ui/documentwidget.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c
index 755cec6a..7e7a2983 100644
--- a/src/ui/documentwidget.c
+++ b/src/ui/documentwidget.c
@@ -47,6 +47,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
47#include "root.h" 47#include "root.h"
48#include "mediaui.h" 48#include "mediaui.h"
49#include "scrollwidget.h" 49#include "scrollwidget.h"
50#include "sitespec.h"
50#include "touch.h" 51#include "touch.h"
51#include "translation.h" 52#include "translation.h"
52#include "uploadwidget.h" 53#include "uploadwidget.h"
@@ -1798,11 +1799,14 @@ static void cacheDocumentGlyphs_DocumentWidget_(const iDocumentWidget *d) {
1798} 1799}
1799 1800
1800static void addBannerWarnings_DocumentWidget_(iDocumentWidget *d) { 1801static void addBannerWarnings_DocumentWidget_(iDocumentWidget *d) {
1801 if (warnings_GmDocument(d->doc) & missingGlyphs_GmDocumentWarning) { 1802 const int dismissed = value_SiteSpec(collectNewRange_String(urlRoot_String(d->mod.url)),
1803 dismissWarnings_SiteSpecKey);
1804 const int warnings = warnings_GmDocument(d->doc) & ~dismissed;
1805 if (warnings & missingGlyphs_GmDocumentWarning) {
1802 add_Banner(d->banner, warning_BannerType, missingGlyphs_GmStatusCode, NULL); 1806 add_Banner(d->banner, warning_BannerType, missingGlyphs_GmStatusCode, NULL);
1803 /* TODO: List one or more of the missing characters and/or their Unicode blocks? */ 1807 /* TODO: List one or more of the missing characters and/or their Unicode blocks? */
1804 } 1808 }
1805 if (warnings_GmDocument(d->doc) & ansiEscapes_GmDocumentWarning) { 1809 if (warnings & ansiEscapes_GmDocumentWarning) {
1806 add_Banner(d->banner, warning_BannerType, ansiEscapes_GmStatusCode, NULL); 1810 add_Banner(d->banner, warning_BannerType, ansiEscapes_GmStatusCode, NULL);
1807 } 1811 }
1808} 1812}
@@ -3383,6 +3387,17 @@ static iBool handleCommand_DocumentWidget_(iDocumentWidget *d, const char *cmd)
3383 else if (equal_Command(cmd, "document.autoreload.set") && document_App() == d) { 3387 else if (equal_Command(cmd, "document.autoreload.set") && document_App() == d) {
3384 d->mod.reloadInterval = arg_Command(cmd); 3388 d->mod.reloadInterval = arg_Command(cmd);
3385 } 3389 }
3390 else if (equalWidget_Command(cmd, w, "document.dismiss")) {
3391 const iString *site = collectNewRange_String(urlRoot_String(d->mod.url));
3392 const int dismissed = value_SiteSpec(site, dismissWarnings_SiteSpecKey);
3393 const int arg = argLabel_Command(cmd, "warning");
3394 setValue_SiteSpec(site, dismissWarnings_SiteSpecKey, dismissed | arg);
3395 if (arg == ansiEscapes_GmDocumentWarning) {
3396 remove_Banner(d->banner, ansiEscapes_GmStatusCode);
3397 refresh_Widget(w);
3398 }
3399 return iTrue;
3400 }
3386 else if (startsWith_CStr(cmd, "pinch.") && document_Command(cmd) == d) { 3401 else if (startsWith_CStr(cmd, "pinch.") && document_Command(cmd) == d) {
3387 return handlePinch_DocumentWidget_(d, cmd); 3402 return handlePinch_DocumentWidget_(d, cmd);
3388 } 3403 }