diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-05-06 13:53:51 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-05-06 13:53:51 +0300 |
commit | 52d00a1477fc51d4efadbf2ec71ba99ed13647e9 (patch) | |
tree | 1d48dba4f4ca07b69cf35ff5f3dd7f7cb4db2766 /src/ui | |
parent | b5d798c138db73ec14e11cc489084f41517ebf37 (diff) |
Indicate pinning state in URL bar
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/documentwidget.c | 16 | ||||
-rw-r--r-- | src/ui/root.c | 8 |
2 files changed, 24 insertions, 0 deletions
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index 5d449851..0cf027f4 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c | |||
@@ -973,6 +973,12 @@ iBool isPinned_DocumentWidget_(const iDocumentWidget *d) { | |||
973 | (prefs->pinSplit == 2 && w->root == win->roots[1]); | 973 | (prefs->pinSplit == 2 && w->root == win->roots[1]); |
974 | } | 974 | } |
975 | 975 | ||
976 | static void showOrHidePinningIndicator_DocumentWidget_(iDocumentWidget *d) { | ||
977 | iWidget *w = as_Widget(d); | ||
978 | showCollapsed_Widget(findChild_Widget(root_Widget(as_Widget(d)), "document.pinned"), | ||
979 | isPinned_DocumentWidget_(d)); | ||
980 | } | ||
981 | |||
976 | void setSource_DocumentWidget(iDocumentWidget *d, const iString *source) { | 982 | void setSource_DocumentWidget(iDocumentWidget *d, const iString *source) { |
977 | setUrl_GmDocument(d->doc, d->mod.url); | 983 | setUrl_GmDocument(d->doc, d->mod.url); |
978 | setSource_GmDocument(d->doc, source, documentWidth_DocumentWidget_(d)); | 984 | setSource_GmDocument(d->doc, source, documentWidth_DocumentWidget_(d)); |
@@ -991,6 +997,7 @@ void setSource_DocumentWidget(iDocumentWidget *d, const iString *source) { | |||
991 | d->flags |= otherRootByDefault_DocumentWidgetFlag; | 997 | d->flags |= otherRootByDefault_DocumentWidgetFlag; |
992 | } | 998 | } |
993 | } | 999 | } |
1000 | showOrHidePinningIndicator_DocumentWidget_(d); | ||
994 | } | 1001 | } |
995 | 1002 | ||
996 | static void updateTheme_DocumentWidget_(iDocumentWidget *d) { | 1003 | static void updateTheme_DocumentWidget_(iDocumentWidget *d) { |
@@ -1991,6 +1998,14 @@ static iBool handleCommand_DocumentWidget_(iDocumentWidget *d, const char *cmd) | |||
1991 | else if (equal_Command(cmd, "document.layout.changed") && document_App() == d) { | 1998 | else if (equal_Command(cmd, "document.layout.changed") && document_App() == d) { |
1992 | updateSize_DocumentWidget(d); | 1999 | updateSize_DocumentWidget(d); |
1993 | } | 2000 | } |
2001 | else if (equal_Command(cmd, "pinsplit.set")) { | ||
2002 | postCommand_App("document.update.pin"); /* prefs value not set yet */ | ||
2003 | return iFalse; | ||
2004 | } | ||
2005 | else if (equal_Command(cmd, "document.update.pin")) { | ||
2006 | showOrHidePinningIndicator_DocumentWidget_(d); | ||
2007 | return iFalse; | ||
2008 | } | ||
1994 | else if (equal_Command(cmd, "tabs.changed")) { | 2009 | else if (equal_Command(cmd, "tabs.changed")) { |
1995 | setLinkNumberMode_DocumentWidget_(d, iFalse); | 2010 | setLinkNumberMode_DocumentWidget_(d, iFalse); |
1996 | if (cmp_String(id_Widget(w), suffixPtr_Command(cmd, "id")) == 0) { | 2011 | if (cmp_String(id_Widget(w), suffixPtr_Command(cmd, "id")) == 0) { |
@@ -2004,6 +2019,7 @@ static iBool handleCommand_DocumentWidget_(iDocumentWidget *d, const char *cmd) | |||
2004 | init_Anim(&d->altTextOpacity, 0); | 2019 | init_Anim(&d->altTextOpacity, 0); |
2005 | updateSideOpacity_DocumentWidget_(d, iFalse); | 2020 | updateSideOpacity_DocumentWidget_(d, iFalse); |
2006 | updateWindowTitle_DocumentWidget_(d); | 2021 | updateWindowTitle_DocumentWidget_(d); |
2022 | showOrHidePinningIndicator_DocumentWidget_(d); | ||
2007 | allocVisBuffer_DocumentWidget_(d); | 2023 | allocVisBuffer_DocumentWidget_(d); |
2008 | animateMedia_DocumentWidget_(d); | 2024 | animateMedia_DocumentWidget_(d); |
2009 | remove_Periodic(periodic_App(), d); | 2025 | remove_Periodic(periodic_App(), d); |
diff --git a/src/ui/root.c b/src/ui/root.c index 4c5f1781..5c62738d 100644 --- a/src/ui/root.c +++ b/src/ui/root.c | |||
@@ -1047,6 +1047,14 @@ void createUserInterface_Root(iRoot *d) { | |||
1047 | addChildFlags_Widget( | 1047 | addChildFlags_Widget( |
1048 | rightEmbed, iClob(progress), collapse_WidgetFlag); | 1048 | rightEmbed, iClob(progress), collapse_WidgetFlag); |
1049 | } | 1049 | } |
1050 | /* Pinning indicator. */ { | ||
1051 | iLabelWidget *pin = new_LabelWidget(uiTextAction_ColorEscape leftHalf_Icon, NULL); | ||
1052 | setId_Widget(as_Widget(pin), "document.pinned"); | ||
1053 | setBackgroundColor_Widget(as_Widget(pin), uiBackground_ColorId); | ||
1054 | setAlignVisually_LabelWidget(pin, iTrue); | ||
1055 | setNoAutoMinHeight_LabelWidget(pin, iTrue); | ||
1056 | addChildFlags_Widget(rightEmbed, iClob(pin), collapse_WidgetFlag); | ||
1057 | } | ||
1050 | /* Reload button. */ { | 1058 | /* Reload button. */ { |
1051 | iLabelWidget *reload; | 1059 | iLabelWidget *reload; |
1052 | if (deviceType_App() == desktop_AppDeviceType) { | 1060 | if (deviceType_App() == desktop_AppDeviceType) { |