Skip to content

Commit

Permalink
Ported Overlay Split View in Rust (#559)
Browse files Browse the repository at this point in the history
* Added Rust Implementation

* added closures instead of dedicated functions.

* Delete code.rs

* Ported `Overlay Split View` in Rust

* Correct directory

* Used glib.clone! in required pleces .

* Format

* Added suggestions

---------

Co-authored-by: Julian Hofer <[email protected]>
  • Loading branch information
itsAdee and Hofer-Julian authored Aug 30, 2023
1 parent c7409f3 commit 12e15f9
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/Library/demos/Overlay Split View/code.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
use crate::workbench;
use adw::prelude::*;
use glib::clone;
use gtk::glib;

pub fn main() {
let overlay_split_view: adw::OverlaySplitView =
workbench::builder().object("split_view").unwrap();

let start_toggle: gtk::ToggleButton = workbench::builder().object("start_toggle").unwrap();
let end_toggle: gtk::ToggleButton = workbench::builder().object("end_toggle").unwrap();

start_toggle.connect_toggled(clone!(@weak overlay_split_view => move |_| {
overlay_split_view.set_sidebar_position(gtk::PackType::Start);
}));

end_toggle.connect_toggled(move |_| {
overlay_split_view.set_sidebar_position(gtk::PackType::End);
});
}

0 comments on commit 12e15f9

Please sign in to comment.