File tree Expand file tree Collapse file tree 2 files changed +17
-5
lines changed Expand file tree Collapse file tree 2 files changed +17
-5
lines changed Original file line number Diff line number Diff line change 11use crate :: workbench;
2+ use glib:: signal:: Propagation ;
3+ use gtk:: glib;
24use gtk:: prelude:: * ;
3- use gtk:: traits:: ButtonExt ;
45
56pub fn main ( ) {
67 let linkbutton: gtk:: LinkButton = workbench:: builder ( ) . object ( "linkbutton" ) . unwrap ( ) ;
78
8- linkbutton. connect_clicked ( move |_| {
9- println ! ( "Link has been visited" ) ;
9+ linkbutton. connect_activate_link ( |button| {
10+ println ! ( "About to activate {}" , button. uri( ) ) ;
11+ Propagation :: Proceed
1012 } ) ;
1113
12- linkbutton. connect_notify ( Some ( "visited" ) , |button , _| {
13- println ! ( "About to activate {}" , button . uri ( ) ) ;
14+ linkbutton. connect_notify ( Some ( "visited" ) , |_ , _| {
15+ println ! ( "The link has been visited" ) ;
1416 } ) ;
1517}
Original file line number Diff line number Diff line change 1+ #! / usr/ bin/ env - S vala workbench. vala -- pkg gtk4
2+
3+ public void main () {
4+ var linkbutton = (Gtk . LinkButton ) workbench. builder. get_object (" linkbutton" );
5+ linkbutton. notify[" visited" ]. connect ((_) = > message (" The link has been visited" ));
6+ linkbutton. activate_link. connect (() = > {
7+ message (@" About to activate $(linkbutton.uri)" );
8+ return false ;
9+ });
10+ }
You can’t perform that action at this time.
0 commit comments