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

Ported Action Bar in Rust #554

Merged
merged 8 commits into from
Aug 30, 2023
Merged
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
21 changes: 21 additions & 0 deletions src/Library/demos/Action Bar/code.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
use crate::workbench;
use gtk::prelude::*;

pub fn main() {
let action_bar: gtk::ActionBar = workbench::builder().object("action_bar").unwrap();
let button: gtk::ToggleButton = workbench::builder().object("button").unwrap();
let start_widget: gtk::Button = workbench::builder().object("start_widget").unwrap();
let end_widget: gtk::Button = workbench::builder().object("end_widget").unwrap();

button.connect_clicked(move |button| {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

@itsAdee itsAdee Aug 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should use this function https://gtk-rs.org/gtk-rs-core/stable/0.18/docs/glib/object/trait.ObjectExt.html#tymethod.connect_notify_local with parameter "active" instead

Made the changes :) and also added my name in the contributors list.

action_bar.set_revealed(!button.is_active());
});

start_widget.connect_clicked(|_| {
println!("Start Widget");
});

end_widget.connect_clicked(|_| {
println!("End Widget");
});
}