diff options
Diffstat (limited to 'src/ui/window.c')
-rw-r--r-- | src/ui/window.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/src/ui/window.c b/src/ui/window.c index 8236b9e6..6196a638 100644 --- a/src/ui/window.c +++ b/src/ui/window.c | |||
@@ -74,6 +74,9 @@ static const iMenuItem editMenuItems[] = { | |||
74 | static const iMenuItem viewMenuItems[] = { | 74 | static const iMenuItem viewMenuItems[] = { |
75 | }; | 75 | }; |
76 | 76 | ||
77 | static const char *reloadCStr_ = "\u25cb"; | ||
78 | static const char *stopCStr_ = orange_ColorEscape "\u00d7"; | ||
79 | |||
77 | static iBool handleNavBarCommands_(iWidget *navBar, const char *cmd) { | 80 | static iBool handleNavBarCommands_(iWidget *navBar, const char *cmd) { |
78 | if (equal_Command(cmd, "input.ended")) { | 81 | if (equal_Command(cmd, "input.ended")) { |
79 | iInputWidget *url = findChild_Widget(navBar, "url"); | 82 | iInputWidget *url = findChild_Widget(navBar, "url"); |
@@ -88,8 +91,27 @@ static iBool handleNavBarCommands_(iWidget *navBar, const char *cmd) { | |||
88 | iInputWidget *url = findWidget_App("url"); | 91 | iInputWidget *url = findWidget_App("url"); |
89 | setTextCStr_InputWidget(url, valuePtr_Command(cmd, "url")); | 92 | setTextCStr_InputWidget(url, valuePtr_Command(cmd, "url")); |
90 | setTitle_Window(get_Window(), text_InputWidget(url)); | 93 | setTitle_Window(get_Window(), text_InputWidget(url)); |
94 | updateTextCStr_LabelWidget(findChild_Widget(navBar, "reload"), reloadCStr_); | ||
95 | return iFalse; | ||
96 | } | ||
97 | else if (equal_Command(cmd, "document.request.cancelled")) { | ||
98 | updateTextCStr_LabelWidget(findChild_Widget(navBar, "reload"), reloadCStr_); | ||
91 | return iFalse; | 99 | return iFalse; |
92 | } | 100 | } |
101 | else if (equal_Command(cmd, "document.request.started")) { | ||
102 | updateTextCStr_LabelWidget(findChild_Widget(navBar, "reload"), stopCStr_); | ||
103 | return iFalse; | ||
104 | } | ||
105 | else if (equal_Command(cmd, "navigate.reload")) { | ||
106 | iDocumentWidget *doc = findWidget_App("document"); | ||
107 | if (isRequestOngoing_DocumentWidget(doc)) { | ||
108 | postCommand_App("document.stop"); | ||
109 | } | ||
110 | else { | ||
111 | postCommand_App("document.reload"); | ||
112 | } | ||
113 | return iTrue; | ||
114 | } | ||
93 | return iFalse; | 115 | return iFalse; |
94 | } | 116 | } |
95 | 117 | ||
@@ -120,7 +142,9 @@ static void setupUserInterface_Window(iWindow *d) { | |||
120 | setId_Widget(as_Widget(url), "url"); | 142 | setId_Widget(as_Widget(url), "url"); |
121 | setTextCStr_InputWidget(url, "gemini://"); | 143 | setTextCStr_InputWidget(url, "gemini://"); |
122 | addChildFlags_Widget(navBar, iClob(url), expand_WidgetFlag); | 144 | addChildFlags_Widget(navBar, iClob(url), expand_WidgetFlag); |
123 | addChild_Widget(navBar, iClob(new_LabelWidget("x", 0, 0, "navigate.reload"))); | 145 | setId_Widget( |
146 | addChild_Widget(navBar, iClob(new_LabelWidget(reloadCStr_, 0, 0, "navigate.reload"))), | ||
147 | "reload"); | ||
124 | } | 148 | } |
125 | 149 | ||
126 | addChildFlags_Widget(div, iClob(new_DocumentWidget()), expand_WidgetFlag); | 150 | addChildFlags_Widget(div, iClob(new_DocumentWidget()), expand_WidgetFlag); |