@@ -14,6 +14,7 @@ use crate::utils;
14
14
use crate :: view;
15
15
16
16
const ACTION_CANCEL : & str = "action-page.cancel" ;
17
+ const ACTION_VIEW_OUTPUT : & str = "action-page.view-output" ;
17
18
const ACTION_VIEW_ARTIFACT : & str = "action-page.view-artifact" ;
18
19
const ACTION_RETRY : & str = "action-page.retry" ;
19
20
@@ -30,6 +31,8 @@ mod imp {
30
31
pub ( super ) show_view_artifact : Cell < bool > ,
31
32
#[ template_child]
32
33
pub ( super ) status_page : TemplateChild < adw:: StatusPage > ,
34
+ #[ template_child]
35
+ pub ( super ) output_box : TemplateChild < adw:: Clamp > ,
33
36
}
34
37
35
38
#[ glib:: object_subclass]
@@ -41,6 +44,9 @@ mod imp {
41
44
fn class_init ( klass : & mut Self :: Class ) {
42
45
klass. bind_template ( ) ;
43
46
klass. install_action ( ACTION_CANCEL , None , |widget, _, _| widget. cancel ( ) ) ;
47
+ klass. install_action ( ACTION_VIEW_OUTPUT , None , |widget, _, _| {
48
+ widget. view_output ( )
49
+ } ) ;
44
50
klass. install_action ( ACTION_VIEW_ARTIFACT , None , |widget, _, _| {
45
51
widget. view_artifact ( ) ;
46
52
} ) ;
@@ -146,6 +152,7 @@ impl ActionPage {
146
152
use model:: ActionType :: * ;
147
153
148
154
let imp = self . imp ( ) ;
155
+ imp. output_box . set_visible ( false ) ;
149
156
150
157
match action. state ( ) {
151
158
model:: ActionState :: Ongoing => {
@@ -225,6 +232,7 @@ impl ActionPage {
225
232
self . set_description ( action) ;
226
233
227
234
self . action_set_enabled ( ACTION_CANCEL , action. state ( ) == Ongoing ) ;
235
+ self . action_set_enabled ( ACTION_VIEW_OUTPUT , action. state ( ) == Finished ) ;
228
236
self . action_set_enabled (
229
237
ACTION_VIEW_ARTIFACT ,
230
238
self . show_view_artifact ( )
@@ -277,6 +285,14 @@ impl ActionPage {
277
285
}
278
286
}
279
287
288
+ fn view_output ( & self ) {
289
+ let imp = self . imp ( ) ;
290
+ imp. status_page . set_icon_name ( None ) ;
291
+ imp. status_page . set_description ( None ) ;
292
+ imp. output_box . set_visible ( true ) ;
293
+ self . action_set_enabled ( ACTION_VIEW_OUTPUT , false ) ;
294
+ }
295
+
280
296
fn view_artifact ( & self ) {
281
297
match self . action ( ) . as_ref ( ) . and_then ( model:: Action :: artifact) {
282
298
Some ( artifact) => {
0 commit comments