Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

library: Ported LinkButton in Rust #546

Merged
merged 7 commits into from
Aug 29, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/Library/demos/Link Button/code.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
use crate::workbench;
use gtk::prelude::*;
use gtk::traits::ButtonExt;

pub fn main() {
let linkbutton: gtk::LinkButton = workbench::builder().object("linkbutton").unwrap();

linkbutton.connect_clicked(move |_| {
Hofer-Julian marked this conversation as resolved.
Show resolved Hide resolved
println!("Link has been visited");
});

linkbutton.connect_notify(Some("visited"), |button, _| {
println!("About to activate {}", button.uri());
// Return true if handling the link manually, or
// false to let the default behavior continue
false;
mbilal234 marked this conversation as resolved.
Show resolved Hide resolved
});
}
12 changes: 12 additions & 0 deletions src/Library/demos/Separator/code.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
use crate::workbench;
use gtk::gio;

pub fn main() {
let picture_one: gtk::Picture = workbench::builder().object("picture_one").unwrap();
let picture_two: gtk::Picture = workbench::builder().object("picture_two").unwrap();

let file = gio::File::for_uri(workbench::resolve("./image.png").as_str());

picture_one.set_file(Some(&file));
picture_two.set_file(Some(&file));
}