@@ -4,7 +4,8 @@ use gtk4::prelude::*;
44use gtk4:: { Box as GtkBox , MenuButton , ApplicationWindow , Application } ;
55use std:: cell:: RefCell ;
66use std:: rc:: Rc ;
7- use gtk4:: glib;
7+ use gtk4:: { glib, gio} ;
8+ use crate :: files_panel;
89
910pub fn build_headerbar ( ) -> GtkBox {
1011 let headerbar = GtkBox :: new ( gtk4:: Orientation :: Horizontal , 6 ) ;
@@ -37,16 +38,24 @@ pub fn build_headerbar() -> GtkBox {
3738 headerbar
3839}
3940
40- pub fn implement_actions ( window : & ApplicationWindow , app : & Application , fmstate : Rc < RefCell < FmState > > ) {
41+ pub fn implement_actions ( window : & ApplicationWindow , app : & Application , fmstate : Rc < RefCell < FmState > > , files_list : & gtk4 :: StringList ) {
4142 // Show Hidden Files action
4243 let show_hidden_initial = fmstate. borrow ( ) . settings . show_hidden ;
4344 let show_hidden_action =
4445 SimpleAction :: new_stateful ( "show_hidden" , None , & show_hidden_initial. into ( ) ) ;
4546
46- show_hidden_action. connect_activate ( glib:: clone!( #[ strong] fmstate, move |action, _| {
47+ show_hidden_action. connect_activate ( glib:: clone!( #[ strong] fmstate, # [ weak ] files_list , move |action, _| {
4748 let current: bool = action. state( ) . unwrap( ) . get( ) . unwrap( ) ;
4849 action. set_state( & ( !current) . into( ) ) ;
49- fmstate. borrow_mut( ) . settings. show_hidden = !current;
50+
51+ let mut fmstate_mut = fmstate. borrow_mut( ) ;
52+ fmstate_mut. settings. show_hidden = !current;
53+
54+ files_panel:: populate_files_list(
55+ & files_list,
56+ & fmstate_mut. current_path,
57+ & fmstate_mut. settings. show_hidden,
58+ ) ;
5059 } ) ) ;
5160
5261 window. add_action ( & show_hidden_action) ;
0 commit comments