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 1
1
use crate :: workbench;
2
+ use glib:: signal:: Propagation ;
3
+ use gtk:: glib;
2
4
use gtk:: prelude:: * ;
3
- use gtk:: traits:: ButtonExt ;
4
5
5
6
pub fn main ( ) {
6
7
let linkbutton: gtk:: LinkButton = workbench:: builder ( ) . object ( "linkbutton" ) . unwrap ( ) ;
7
8
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
10
12
} ) ;
11
13
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" ) ;
14
16
} ) ;
15
17
}
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