File tree Expand file tree Collapse file tree 4 files changed +24
-0
lines changed
Expand file tree Collapse file tree 4 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,11 @@ template GeopardWindow: Adw.ApplicationWindow {
2121 action-name: "win.next";
2222 }
2323 [start]
24+ Gtk.Button {
25+ icon-name: "view-refresh-symbolic";
26+ action-name: "win.reload";
27+ }
28+ [start]
2429 Gtk.Button {
2530 icon-name: "tab-new-symbolic";
2631 action-name: "win.new-tab";
@@ -109,6 +114,11 @@ template GeopardWindow: Adw.ApplicationWindow {
109114 icon-name: "go-next-symbolic";
110115 action-name: "win.next";
111116 }
117+ [start]
118+ Gtk.Button {
119+ icon-name: "view-refresh-symbolic";
120+ action-name: "win.reload";
121+ }
112122 [title]
113123 Gtk.Button {
114124 icon-name: "system-search-symbolic";
Original file line number Diff line number Diff line change @@ -95,6 +95,7 @@ fn main() {
9595 "win.next" ,
9696 & [ "<Alt>Right" , "<Alt>KP_Right" , "Pointer_DfltBtnNext" ] ,
9797 ) ;
98+ application. set_accels_for_action ( "win.reload" , & [ "<Ctrl>r" , "F5" ] ) ;
9899 application. set_accels_for_action ( "win.show-bookmarks" , & [ "<Ctrl>b" ] ) ;
99100 application. set_accels_for_action ( "win.bookmark-current" , & [ "<Ctrl>d" ] ) ;
100101 application. set_accels_for_action ( "win.new-tab" , & [ "<Ctrl>t" ] ) ;
Original file line number Diff line number Diff line change @@ -404,6 +404,15 @@ impl Tab {
404404 h. map ( |x| self . spawn_request ( self . open_history ( x) ) )
405405 . context ( "retrieving next item from history" )
406406 }
407+ pub fn reload ( & self ) {
408+ let imp = self . imp ( ) ;
409+ let i = imp. current_hi . get ( ) . unwrap ( ) ;
410+
411+ imp. history . borrow_mut ( ) . get ( i) . map ( |h| {
412+ h. cache . replace ( None ) ;
413+ self . spawn_request ( self . open_history ( h. clone ( ) ) ) ;
414+ } ) ;
415+ }
407416 pub fn display_error ( & self , error : anyhow:: Error ) {
408417 let imp = self . imp ( ) ;
409418 error ! ( "{:?}" , error) ;
Original file line number Diff line number Diff line change @@ -209,6 +209,7 @@ impl Window {
209209 imp. action_previous . borrow_mut ( ) . replace ( action_previous) ;
210210 imp. action_next . borrow_mut ( ) . replace ( action_next) ;
211211
212+ self_action ! ( self , "reload" , reload) ;
212213 self_action ! ( self , "new-tab" , new_tab) ;
213214 self_action ! ( self , "show-bookmarks" , show_bookmarks) ;
214215 self_action ! ( self , "bookmark-current" , bookmark_current) ;
@@ -524,6 +525,9 @@ impl Window {
524525 Ok ( _) => info ! ( "went forward" ) ,
525526 }
526527 }
528+ fn reload ( & self ) {
529+ self . current_tab ( ) . reload ( ) ;
530+ }
527531 fn bookmark_current ( & self ) {
528532 let imp = self . imp ( ) ;
529533 let url = imp. url_bar . text ( ) . to_string ( ) ;
You can’t perform that action at this time.
0 commit comments