Skip to content

Commit

Permalink
Small comments changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejkolin committed Aug 5, 2024
1 parent d7de704 commit 3880928
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions src/Text Fields/code.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,10 @@ pub fn main() {
.target(&target)
.build();

/*
* Animation is defined outside of the scope of the following closure
* That's why we need to use glib::clone! macro
* See: https://gtk-rs.org/gtk-rs-core/stable/latest/docs/glib/macro.clone.html
*/
// Animation is defined outside of the scope of the following closure
// That's why we need to use glib::clone! macro
// See: https://gtk-rs.org/gtk-rs-core/stable/latest/docs/glib/macro.clone.html

entry_progress.connect_icon_press(gtk::glib::clone!(
@strong animation => move |_, __| animation.play()
));
Expand All @@ -57,8 +56,7 @@ pub fn main() {
let entry_confirm_password: gtk::PasswordEntry = workbench::builder()
.object("entry_confirm_password")
.unwrap();
// I am avoiding typing the GString to a normal rust String
// Check the documentation for more details on GString

fn validate_password(
passwd: &gtk::glib::GString,
confirm_passwd: &gtk::glib::GString,
Expand All @@ -75,7 +73,7 @@ pub fn main() {
return String::from("Password made successfully");
}

//Notice how we move the references inside of the closure using the glib::clone! macro
// Using the glib::clone! macro we pass the reference to the closure
entry_confirm_password.connect_activate(
gtk::glib::clone!(@weak label_password, @weak entry_password, @weak entry_confirm_password => move |_| {
let passwd = entry_password.text();
Expand All @@ -92,10 +90,8 @@ pub fn main() {
}),
);

/*
The entry_completion is deprecated
https://discourse.gnome.org/t/replacement-for-entrycompletion/13505
*/
// The entry_completion is deprecated
// https://discourse.gnome.org/t/replacement-for-entrycompletion/13505
let entry_completion: gtk::Entry = workbench::builder().object("entry_completion").unwrap();
let completion = gtk::EntryCompletion::builder().build();
let store = gtk::TreeStore::new(&[gtk::glib::Type::STRING]);
Expand Down

0 comments on commit 3880928

Please sign in to comment.