Skip to content

Commit

Permalink
Add Bpftune Button (#59)
Browse files Browse the repository at this point in the history
* Add Bpftune Button

 * Formatted the code with rustfmt
 * All the style is good on the tweak section no need others fixes

* Fix typo
  • Loading branch information
NextWork123 authored Aug 25, 2023
1 parent 2cc9c33 commit dbb6b85
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/pages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ fn create_options_section() -> gtk::Box {
gtk::CheckButton::with_label(&fl!("tweak-enabled-title", tweak = "Profile-sync-daemon"));
let systemd_oomd_btn =
gtk::CheckButton::with_label(&fl!("tweak-enabled-title", tweak = "Systemd-oomd"));
let bpftune_btn = gtk::CheckButton::with_label(&fl!("tweak-enabled-title", tweak = "Bpftune"));
let apparmor_btn =
gtk::CheckButton::with_label(&fl!("tweak-enabled-title", tweak = "Apparmor"));
let bluetooth_btn =
Expand All @@ -276,6 +277,7 @@ fn create_options_section() -> gtk::Box {
psd_btn.set_widget_name("Profile-sync-daemon");
systemd_oomd_btn.set_widget_name("Systemd-oomd");
apparmor_btn.set_widget_name("Apparmor");
bpftune_btn.set_widget_name("Bpftune");
bluetooth_btn.set_widget_name("Bluetooth");
ananicy_cpp_btn.set_widget_name("Ananicy Cpp");
}
Expand All @@ -290,6 +292,9 @@ fn create_options_section() -> gtk::Box {
apparmor_btn.set_data("actionData", "apparmor.service");
apparmor_btn.set_data("actionType", "service");
apparmor_btn.set_data("alpmPackage", "apparmor");
bpftune_btn.set_data("actionData", "bpftune.service");
bpftune_btn.set_data("actionType", "service");
bpftune_btn.set_data("alpmPackage", "bpftune-git");
bluetooth_btn.set_data("actionData", "bluetooth.service");
bluetooth_btn.set_data("actionType", "service");
bluetooth_btn.set_data("alpmPackage", "bluez");
Expand All @@ -298,7 +303,14 @@ fn create_options_section() -> gtk::Box {
ananicy_cpp_btn.set_data("alpmPackage", "ananicy-cpp");
}

for btn in &[&psd_btn, &systemd_oomd_btn, &apparmor_btn, &bluetooth_btn, &ananicy_cpp_btn] {
for btn in &[
&psd_btn,
&systemd_oomd_btn,
&apparmor_btn,
&bpftune_btn,
&bluetooth_btn,
&ananicy_cpp_btn,
] {
let data: &str = unsafe { *btn.data("actionData").unwrap().as_ptr() };
if G_LOCAL_UNITS.lock().unwrap().enabled_units.contains(&String::from(data))
|| G_GLOBAL_UNITS.lock().unwrap().enabled_units.contains(&String::from(data))
Expand All @@ -312,6 +324,7 @@ fn create_options_section() -> gtk::Box {
box_collection.pack_start(&psd_btn, true, false, 2);
box_collection_s.pack_start(&systemd_oomd_btn, true, false, 2);
box_collection.pack_start(&apparmor_btn, true, false, 2);
box_collection_s.pack_start(&bpftune_btn, true, false, 2);
box_collection.pack_start(&ananicy_cpp_btn, true, false, 2);
box_collection_s.pack_start(&bluetooth_btn, true, false, 2);
box_collection.set_halign(gtk::Align::Fill);
Expand Down

0 comments on commit dbb6b85

Please sign in to comment.