@@ -2,43 +2,35 @@ use gtk::prelude::*;
22use gtk:: { Application , ApplicationWindow , Button , HeaderBar , Notebook } ;
33use glib:: clone:: Downgrade ;
44use crate :: terminal:: add_tab;
5-
65pub fn build_ui ( app : & Application ) {
76 let window = ApplicationWindow :: builder ( )
8- . application ( app)
9- . title ( "Hacker Terminal - Hackeros Edition" )
10- . default_width ( 1000 )
11- . default_height ( 700 )
12- . build ( ) ;
13-
7+ . application ( app)
8+ . title ( "Hacker Terminal - Hackeros Edition" )
9+ . default_width ( 1000 )
10+ . default_height ( 700 )
11+ . build ( ) ;
1412 // Create and set header bar
1513 let header = HeaderBar :: new ( ) ;
1614 header. set_show_title_buttons ( true ) ;
1715 window. set_titlebar ( Some ( & header) ) ;
18-
1916 // Create notebook for tabs
2017 let notebook = Notebook :: new ( ) ;
2118 notebook. set_tab_pos ( gtk:: PositionType :: Top ) ;
2219 notebook. set_scrollable ( true ) ;
23-
2420 // Add button to header for new tab
2521 let add_button = Button :: with_label ( "+" ) ;
2622 add_button. set_css_classes ( & [ "suggested-action" ] ) ; // Use suggested action for prominence
2723 header. pack_start ( & add_button) ;
28-
2924 let notebook_weak = Downgrade :: downgrade ( & notebook) ;
3025 add_button. connect_clicked ( move |_| {
3126 if let Some ( notebook) = notebook_weak. upgrade ( ) {
3227 add_tab ( & notebook) ;
3328 }
3429 } ) ;
35-
3630 // Add initial tab
3731 add_tab ( & notebook) ;
38-
3932 // Set notebook as child
4033 window. set_child ( Some ( & notebook) ) ;
41-
4234 // Present the window
4335 window. present ( ) ;
4436}
0 commit comments