Skip to content

Commit

Permalink
Merge branch 'sonnyp:main' into Workbench-Switch
Browse files Browse the repository at this point in the history
  • Loading branch information
onkarrai06 authored Aug 30, 2023
2 parents 4115107 + a07bb31 commit 119eb2d
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 1 deletion.
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_notify_local(Some("active"), move |button, _| {
action_bar.set_revealed(!button.is_active());
});

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

end_widget.connect_clicked(|_| {
println!("End Widget");
});
}
16 changes: 16 additions & 0 deletions src/Library/demos/Menu Button/code.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
use crate::workbench;
use gtk::prelude::*;
use gtk::{MenuButton, Switch};

pub fn main() {
let circular_switch: Switch = workbench::builder().object("circular_switch").unwrap();
let secondary_button: MenuButton = workbench::builder().object("secondary").unwrap();

circular_switch.connect_active_notify(move |switch| {
if switch.is_active() {
secondary_button.add_css_class("circular");
} else {
secondary_button.remove_css_class("circular");
}
});
}
1 change: 0 additions & 1 deletion src/Library/demos/Menu Button/main.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import Gtk from "gi://Gtk";

const circular_switch = workbench.builder.get_object("circular_switch");
const primary_button = workbench.builder.get_object("primary");
const secondary_button = workbench.builder.get_object("secondary");

circular_switch.connect("notify::active", () => {
Expand Down
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);
});
}
2 changes: 2 additions & 0 deletions src/about.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ ${getBlueprintVersion()}
"Rasmus Thomsen <[email protected]>",
"Marvin W https://github.com/mar-v-in",
"Saad Khan https://github.com/saadulkh",
"Adeel Ahmed Qureshi https://github.com/itsAdee",
"Muhammad Bilal https://github.com/mbilal234",
// Add yourself as
// "John Doe",
// or
Expand Down

0 comments on commit 119eb2d

Please sign in to comment.