make sched update

This commit is contained in:
Ward from fusion-voyager-3 2024-06-21 17:12:25 +03:00
parent 8456aa4e4b
commit bada7b8740
3 changed files with 26 additions and 7 deletions

View File

@ -23,8 +23,6 @@ pub fn content(
window: &adw::ApplicationWindow, window: &adw::ApplicationWindow,
window_banner: &adw::Banner, window_banner: &adw::Banner,
) -> gtk::Box { ) -> gtk::Box {
let running_kernel_info = get_running_kernel_info();
let (get_kernel_branches_sender, get_kernel_branches_receiver) = async_channel::unbounded(); let (get_kernel_branches_sender, get_kernel_branches_receiver) = async_channel::unbounded();
let get_kernel_branches_sender = get_kernel_branches_sender.clone(); let get_kernel_branches_sender = get_kernel_branches_sender.clone();
@ -194,7 +192,7 @@ pub fn content(
load_badge_async_context.spawn_local(clone!(@weak content_box, @weak loading_box, @weak kernel_badge_box, @strong selected_kernel_branch, @strong db_load_complete => async move { load_badge_async_context.spawn_local(clone!(@weak content_box, @weak loading_box, @weak kernel_badge_box, @strong selected_kernel_branch, @strong db_load_complete => async move {
while let Ok(_state) = load_badge_async_receiver.recv().await { while let Ok(_state) = load_badge_async_receiver.recv().await {
if *db_load_complete.borrow() == true { if *db_load_complete.borrow() == true {
create_kernel_badges(&kernel_badge_box, &running_kernel_info, &selected_kernel_branch); create_kernel_badges(&kernel_badge_box, &get_running_kernel_info(), &selected_kernel_branch);
loading_box.set_visible(false); loading_box.set_visible(false);
content_box.set_sensitive(true) content_box.set_sensitive(true)
} }
@ -331,6 +329,8 @@ pub fn create_kernel_badge(
.margin_end(5) .margin_end(5)
.margin_bottom(1) .margin_bottom(1)
.margin_top(1) .margin_top(1)
.valign(Align::Center)
.halign(Align::Center)
.hexpand(true) .hexpand(true)
.vexpand(true) .vexpand(true)
.build(); .build();
@ -344,6 +344,8 @@ pub fn create_kernel_badge(
.margin_end(0) .margin_end(0)
.margin_bottom(1) .margin_bottom(1)
.margin_top(1) .margin_top(1)
.valign(Align::Center)
.halign(Align::Center)
.hexpand(true) .hexpand(true)
.vexpand(true) .vexpand(true)
.build(); .build();

View File

@ -217,10 +217,14 @@ fn add_package_rows(
let kernel_status_icon = gtk::Image::builder() let kernel_status_icon = gtk::Image::builder()
.icon_name("emblem-default") .icon_name("emblem-default")
.pixel_size(24) .pixel_size(24)
.valign(Align::Center)
.visible(false) .visible(false)
.tooltip_text("Installed") .tooltip_text("Installed")
.build(); .build();
let kernel_description_label = gtk::Label::builder().label(&kernel_description).build(); let kernel_description_label = gtk::Label::builder()
.label(&kernel_description)
.valign(Align::Center)
.build();
let kernel_content_row = adw::ActionRow::builder().build(); let kernel_content_row = adw::ActionRow::builder().build();
let kernel_install_button = gtk::Button::builder() let kernel_install_button = gtk::Button::builder()
.margin_start(5) .margin_start(5)

View File

@ -139,13 +139,26 @@ pub fn sched_ext_page(content_stack: &gtk::Stack, window: &adw::ApplicationWindo
Ok(_) => { Ok(_) => {
cmd_status_dialog.set_heading(Some("Success!")); cmd_status_dialog.set_heading(Some("Success!"));
cmd_status_dialog.set_body(format!("SCX has been set to: {}", &selected_scx_sched_clone1).as_str()); cmd_status_dialog.set_body(format!("SCX has been set to: {}", &selected_scx_sched_clone1).as_str());
cmd_status_dialog.present() cmd_status_dialog.present();
create_current_sched_badge(
&badge_box,
&get_running_kernel_info(),
&kernel_badges_size_group,
&kernel_badges_size_group0,
&kernel_badges_size_group1,
);
} }
Err(_) => { Err(_) => {
cmd_status_dialog.set_heading(Some("Failed!")); cmd_status_dialog.set_heading(Some("Failed!"));
cmd_status_dialog.set_body(format!("SCX couldn't be has been set to: {}", &selected_scx_sched_clone1).as_str()); cmd_status_dialog.set_body(format!("SCX couldn't be has been set to: {}", &selected_scx_sched_clone1).as_str());
cmd_status_dialog.present() cmd_status_dialog.present();
create_current_sched_badge(
&badge_box,
&get_running_kernel_info(),
&kernel_badges_size_group,
&kernel_badges_size_group0,
&kernel_badges_size_group1,
);
} }
}; };
})); }));