diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-08-02 21:22:36 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-08-02 21:22:36 +0300 |
commit | 8a588f71b187d5d07ca218747dd5f6708264e2fb (patch) | |
tree | 2f7caeea24e1fb534cd3c63bddfaf8466db28637 /src | |
parent | 179a8f700f0e4432e273372365ba0187961d4f21 (diff) |
Compose window title with host name
Diffstat (limited to 'src')
-rw-r--r-- | src/ui/documentwidget.c | 23 | ||||
-rw-r--r-- | src/ui/window.c | 10 |
2 files changed, 22 insertions, 11 deletions
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index c8755fd2..f8a2e330 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <the_Foundation/path.h> | 15 | #include <the_Foundation/path.h> |
16 | #include <the_Foundation/ptrarray.h> | 16 | #include <the_Foundation/ptrarray.h> |
17 | #include <the_Foundation/regexp.h> | 17 | #include <the_Foundation/regexp.h> |
18 | #include <the_Foundation/stringarray.h> | ||
18 | 19 | ||
19 | #include <SDL_clipboard.h> | 20 | #include <SDL_clipboard.h> |
20 | #include <SDL_timer.h> | 21 | #include <SDL_timer.h> |
@@ -257,16 +258,24 @@ static void updateVisible_DocumentWidget_(iDocumentWidget *d) { | |||
257 | } | 258 | } |
258 | 259 | ||
259 | static void updateWindowTitle_DocumentWidget_(const iDocumentWidget *d) { | 260 | static void updateWindowTitle_DocumentWidget_(const iDocumentWidget *d) { |
260 | const char *titleSep = " \u2013 "; | 261 | iStringArray *title = iClob(new_StringArray()); |
261 | iString *title = collect_String(copy_String(title_GmDocument(d->doc))); | 262 | if (!isEmpty_String(title_GmDocument(d->doc))) { |
263 | pushBack_StringArray(title, title_GmDocument(d->doc)); | ||
264 | } | ||
262 | if (!isEmpty_String(d->titleUser)) { | 265 | if (!isEmpty_String(d->titleUser)) { |
263 | if (!isEmpty_String(title)) appendCStr_String(title, titleSep); | 266 | pushBack_StringArray(title, d->titleUser); |
264 | append_String(title, d->titleUser); | 267 | } |
268 | else { | ||
269 | iUrl parts; | ||
270 | init_Url(&parts, d->url); | ||
271 | if (!isEmpty_Range(&parts.host)) { | ||
272 | pushBackRange_StringArray(title, parts.host); | ||
273 | } | ||
265 | } | 274 | } |
266 | if (isEmpty_String(title)) { | 275 | if (isEmpty_StringArray(title)) { |
267 | setCStr_String(title, "Lagrange"); | 276 | pushBackCStr_StringArray(title, "Lagrange"); |
268 | } | 277 | } |
269 | setTitle_Window(get_Window(), title); | 278 | setTitle_Window(get_Window(), collect_String(joinCStr_StringArray(title, " \u2013 "))); |
270 | } | 279 | } |
271 | 280 | ||
272 | static void setSource_DocumentWidget_(iDocumentWidget *d, const iString *source) { | 281 | static void setSource_DocumentWidget_(iDocumentWidget *d, const iString *source) { |
diff --git a/src/ui/window.c b/src/ui/window.c index be84b6c2..9a523ce9 100644 --- a/src/ui/window.c +++ b/src/ui/window.c | |||
@@ -200,11 +200,13 @@ static void setupUserInterface_Window(iWindow *d) { | |||
200 | addChild_Widget(navBar, iClob(newIcon_LabelWidget(" \U0001f850 ", 0, 0, "navigate.back"))); | 200 | addChild_Widget(navBar, iClob(newIcon_LabelWidget(" \U0001f850 ", 0, 0, "navigate.back"))); |
201 | addChild_Widget(navBar, iClob(newIcon_LabelWidget("\U0001f852", 0, 0, "navigate.forward"))); | 201 | addChild_Widget(navBar, iClob(newIcon_LabelWidget("\U0001f852", 0, 0, "navigate.forward"))); |
202 | addChild_Widget(navBar, iClob(newIcon_LabelWidget("\U0001f3e0", 0, 0, "navigate.home"))); | 202 | addChild_Widget(navBar, iClob(newIcon_LabelWidget("\U0001f3e0", 0, 0, "navigate.home"))); |
203 | iLabelWidget *lock = addChildFlags_Widget(navBar, | 203 | iLabelWidget *lock = |
204 | iClob(newIcon_LabelWidget("\U0001f512", 0, 0, "cert.server")), | 204 | addChildFlags_Widget(navBar, |
205 | frameless_WidgetFlag | tight_WidgetFlag); | 205 | iClob(newIcon_LabelWidget("\U0001f513", 0, 0, "server.showcert")), |
206 | setId_Widget(as_Widget(lock), "lock"); | 206 | frameless_WidgetFlag | tight_WidgetFlag); |
207 | setId_Widget(as_Widget(lock), "navbar.lock"); | ||
207 | setFont_LabelWidget(lock, symbols_FontId); | 208 | setFont_LabelWidget(lock, symbols_FontId); |
209 | updateTextCStr_LabelWidget(lock, "\U0001f512"); | ||
208 | iInputWidget *url = new_InputWidget(0); | 210 | iInputWidget *url = new_InputWidget(0); |
209 | setId_Widget(as_Widget(url), "url"); | 211 | setId_Widget(as_Widget(url), "url"); |
210 | setTextCStr_InputWidget(url, "gemini://"); | 212 | setTextCStr_InputWidget(url, "gemini://"); |