diff options
-rw-r--r-- | src/ui/sidebarwidget.c | 2 | ||||
-rw-r--r-- | src/ui/window.c | 34 |
2 files changed, 27 insertions, 9 deletions
diff --git a/src/ui/sidebarwidget.c b/src/ui/sidebarwidget.c index 25fa3f6a..325e8e2b 100644 --- a/src/ui/sidebarwidget.c +++ b/src/ui/sidebarwidget.c | |||
@@ -245,7 +245,7 @@ static void updateItems_SidebarWidget_(iSidebarWidget *d) { | |||
245 | { "Use on This Page", 0, 0, "ident.use arg:1" }, | 245 | { "Use on This Page", 0, 0, "ident.use arg:1" }, |
246 | { "Stop Using This Page", 0, 0, "ident.use arg:0" }, | 246 | { "Stop Using This Page", 0, 0, "ident.use arg:0" }, |
247 | { "Stop Using Everywhere", 0, 0, "ident.use arg:0 clear:1" }, | 247 | { "Stop Using Everywhere", 0, 0, "ident.use arg:0 clear:1" }, |
248 | { "View Use URLs", 0, 0, "ident.showuse" }, | 248 | { "Show Usage", 0, 0, "ident.showuse" }, |
249 | { "---", 0, 0, NULL }, | 249 | { "---", 0, 0, NULL }, |
250 | { "Edit Notes...", 0, 0, "ident.edit" }, | 250 | { "Edit Notes...", 0, 0, "ident.edit" }, |
251 | { "Pick Icon...", 0, 0, "ident.pickicon" }, | 251 | { "Pick Icon...", 0, 0, "ident.pickicon" }, |
diff --git a/src/ui/window.c b/src/ui/window.c index bdf80e52..19fe02ed 100644 --- a/src/ui/window.c +++ b/src/ui/window.c | |||
@@ -22,18 +22,18 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ | |||
22 | 22 | ||
23 | #include "window.h" | 23 | #include "window.h" |
24 | 24 | ||
25 | #include "labelwidget.h" | ||
26 | #include "inputwidget.h" | ||
27 | #include "documentwidget.h" | ||
28 | #include "sidebarwidget.h" | ||
25 | #include "embedded.h" | 29 | #include "embedded.h" |
26 | #include "app.h" | ||
27 | #include "command.h" | 30 | #include "command.h" |
28 | #include "paint.h" | 31 | #include "paint.h" |
29 | #include "text.h" | ||
30 | #include "util.h" | 32 | #include "util.h" |
33 | #include "../app.h" | ||
31 | #include "../visited.h" | 34 | #include "../visited.h" |
32 | #include "labelwidget.h" | 35 | #include "../gmcerts.h" |
33 | #include "inputwidget.h" | 36 | #include "../gmutil.h" |
34 | #include "documentwidget.h" | ||
35 | #include "sidebarwidget.h" | ||
36 | #include "gmutil.h" | ||
37 | #if defined (iPlatformMsys) | 37 | #if defined (iPlatformMsys) |
38 | # include "../win32.h" | 38 | # include "../win32.h" |
39 | #endif | 39 | #endif |
@@ -150,7 +150,7 @@ static const iMenuItem helpMenuItems[] = { | |||
150 | #endif | 150 | #endif |
151 | 151 | ||
152 | static const iMenuItem identityButtonMenuItems[] = { | 152 | static const iMenuItem identityButtonMenuItems[] = { |
153 | { "No Active Identity", 0, 0, NULL }, | 153 | { "No Active Identity", 0, 0, "ident.showactive" }, |
154 | { "---", 0, 0, NULL }, | 154 | { "---", 0, 0, NULL }, |
155 | #if !defined (iHaveNativeMenus) | 155 | #if !defined (iHaveNativeMenus) |
156 | { "New Identity...", SDLK_n, KMOD_PRIMARY | KMOD_SHIFT, "ident.new" }, | 156 | { "New Identity...", SDLK_n, KMOD_PRIMARY | KMOD_SHIFT, "ident.new" }, |
@@ -166,6 +166,21 @@ static const iMenuItem identityButtonMenuItems[] = { | |||
166 | static const char *reloadCStr_ = "\U0001f503"; | 166 | static const char *reloadCStr_ = "\U0001f503"; |
167 | static const char *stopCStr_ = uiTextCaution_ColorEscape "\U0001f310"; | 167 | static const char *stopCStr_ = uiTextCaution_ColorEscape "\U0001f310"; |
168 | 168 | ||
169 | static void updateNavBarIdentity_(iWidget *navBar) { | ||
170 | const iGmIdentity *ident = | ||
171 | identityForUrl_GmCerts(certs_App(), url_DocumentWidget(document_App())); | ||
172 | iWidget *button = findChild_Widget(navBar, "navbar.ident"); | ||
173 | setFlags_Widget(button, selected_WidgetFlag, ident != NULL); | ||
174 | /* Update menu. */ | ||
175 | iLabelWidget *idItem = child_Widget(findChild_Widget(button, "menu"), 0); | ||
176 | setTextCStr_LabelWidget( | ||
177 | idItem, | ||
178 | ident ? format_CStr(uiTextAction_ColorEscape "%s", | ||
179 | cstrCollect_String(subject_TlsCertificate(ident->cert))) | ||
180 | : "No Active Identity"); | ||
181 | setFlags_Widget(as_Widget(idItem), disabled_WidgetFlag, !ident); | ||
182 | } | ||
183 | |||
169 | static iBool handleNavBarCommands_(iWidget *navBar, const char *cmd) { | 184 | static iBool handleNavBarCommands_(iWidget *navBar, const char *cmd) { |
170 | if (equal_Command(cmd, "window.resized")) { | 185 | if (equal_Command(cmd, "window.resized")) { |
171 | const iBool isNarrow = width_Rect(bounds_Widget(navBar)) / gap_UI < 140; | 186 | const iBool isNarrow = width_Rect(bounds_Widget(navBar)) / gap_UI < 140; |
@@ -203,6 +218,7 @@ static iBool handleNavBarCommands_(iWidget *navBar, const char *cmd) { | |||
203 | const iString *urlStr = collect_String(suffix_Command(cmd, "url")); | 218 | const iString *urlStr = collect_String(suffix_Command(cmd, "url")); |
204 | setText_InputWidget(url, urlStr); | 219 | setText_InputWidget(url, urlStr); |
205 | updateTextCStr_LabelWidget(reloadButton, reloadCStr_); | 220 | updateTextCStr_LabelWidget(reloadButton, reloadCStr_); |
221 | updateNavBarIdentity_(navBar); | ||
206 | return iFalse; | 222 | return iFalse; |
207 | } | 223 | } |
208 | else if (equal_Command(cmd, "document.request.cancelled")) { | 224 | else if (equal_Command(cmd, "document.request.cancelled")) { |
@@ -227,6 +243,7 @@ static iBool handleNavBarCommands_(iWidget *navBar, const char *cmd) { | |||
227 | setText_InputWidget(findChild_Widget(navBar, "url"), url_DocumentWidget(doc)); | 243 | setText_InputWidget(findChild_Widget(navBar, "url"), url_DocumentWidget(doc)); |
228 | updateTextCStr_LabelWidget(findChild_Widget(navBar, "reload"), | 244 | updateTextCStr_LabelWidget(findChild_Widget(navBar, "reload"), |
229 | isRequestOngoing_DocumentWidget(doc) ? stopCStr_ : reloadCStr_); | 245 | isRequestOngoing_DocumentWidget(doc) ? stopCStr_ : reloadCStr_); |
246 | updateNavBarIdentity_(navBar); | ||
230 | } | 247 | } |
231 | } | 248 | } |
232 | else if (equal_Command(cmd, "mouse.clicked") && arg_Command(cmd)) { | 249 | else if (equal_Command(cmd, "mouse.clicked") && arg_Command(cmd)) { |
@@ -317,6 +334,7 @@ static void setupUserInterface_Window(iWindow *d) { | |||
317 | makeMenuButton_LabelWidget("\U0001f464", identityButtonMenuItems, iElemCount(identityButtonMenuItems)); | 334 | makeMenuButton_LabelWidget("\U0001f464", identityButtonMenuItems, iElemCount(identityButtonMenuItems)); |
318 | setAlignVisually_LabelWidget(idMenu, iTrue); | 335 | setAlignVisually_LabelWidget(idMenu, iTrue); |
319 | addChild_Widget(navBar, iClob(idMenu)); | 336 | addChild_Widget(navBar, iClob(idMenu)); |
337 | setId_Widget(as_Widget(idMenu), "navbar.ident"); | ||
320 | iLabelWidget *lock = | 338 | iLabelWidget *lock = |
321 | addChildFlags_Widget(navBar, | 339 | addChildFlags_Widget(navBar, |
322 | iClob(newIcon_LabelWidget("\U0001f513", 0, 0, "server.showcert")), | 340 | iClob(newIcon_LabelWidget("\U0001f513", 0, 0, "server.showcert")), |