Add css font color detect

This commit is contained in:
Ward from fusion-voyager-3 2024-10-26 01:51:33 +03:00
parent a5149a990b
commit 5468c8fbdd
9 changed files with 206 additions and 23 deletions

View File

@ -346,13 +346,7 @@ pub fn apt_manage_page(
retry_signal_action.activate(None); retry_signal_action.activate(None);
let unofficial_sources_box = Box::builder() let unofficial_sources_box = Box::builder().orientation(Orientation::Vertical).build();
.orientation(Orientation::Vertical)
.margin_bottom(3)
.margin_top(3)
.margin_end(3)
.margin_start(3)
.build();
let unofficial_sources_viewport = ScrolledWindow::builder() let unofficial_sources_viewport = ScrolledWindow::builder()
.vexpand(true) .vexpand(true)
@ -363,9 +357,10 @@ pub fn apt_manage_page(
.margin_end(15) .margin_end(15)
.margin_start(15) .margin_start(15)
.child(&unofficial_sources_box) .child(&unofficial_sources_box)
.overflow(Overflow::Hidden)
.height_request(390) .height_request(390)
.build(); .build();
unofficial_sources_viewport.add_css_class("round-all-scroll"); unofficial_sources_viewport.add_css_class("round-all-scroll-no-padding");
// //

View File

@ -32,6 +32,8 @@ pub struct AptPackageRow {
package_installed_size: RefCell<u64>, package_installed_size: RefCell<u64>,
#[property(get, set)] #[property(get, set)]
package_marked: RefCell<bool>, package_marked: RefCell<bool>,
#[property(get, set)]
theme_changed_action: RefCell<Option<gio::SimpleAction>>,
} }
// ANCHOR_END: custom_button // ANCHOR_END: custom_button
@ -78,6 +80,27 @@ impl ObjectImpl for AptPackageRow {
let expandable_box = Box::new(Orientation::Vertical, 0); let expandable_box = Box::new(Orientation::Vertical, 0);
let temp_simple_action = gio::SimpleAction::new("theme_change2", None);
obj.connect_theme_changed_action_notify(clone!(
#[strong]
obj,
#[strong]
temp_simple_action,
move |_| {
match obj.theme_changed_action() {
Some(a) => {
a.connect_activate(clone!(
#[strong]
temp_simple_action,
move |_, _| temp_simple_action.activate(None)
));
}
None => {}
}
}
));
obj.connect_package_name_notify(clone!( obj.connect_package_name_notify(clone!(
#[weak] #[weak]
prefix_box, prefix_box,
@ -85,6 +108,8 @@ impl ObjectImpl for AptPackageRow {
expandable_box, expandable_box,
#[strong] #[strong]
obj, obj,
#[strong]
temp_simple_action,
move |_| { move |_| {
remove_all_children_from_box(&prefix_box); remove_all_children_from_box(&prefix_box);
remove_all_children_from_box(&expandable_box); remove_all_children_from_box(&expandable_box);
@ -110,6 +135,7 @@ impl ObjectImpl for AptPackageRow {
create_expandable_content( create_expandable_content(
&obj, &obj,
&expandable_box, &expandable_box,
&temp_simple_action,
package_description, package_description,
package_source_uri, package_source_uri,
package_maintainer, package_maintainer,
@ -322,6 +348,7 @@ fn create_prefix_content(
fn create_expandable_content( fn create_expandable_content(
apt_package_row: &impl IsA<ExpanderRow>, apt_package_row: &impl IsA<ExpanderRow>,
expandable_box: &gtk::Box, expandable_box: &gtk::Box,
theme_changed_action: &gio::SimpleAction,
package_description: String, package_description: String,
package_source_uri: String, package_source_uri: String,
package_maintainer: String, package_maintainer: String,
@ -385,12 +412,15 @@ fn create_expandable_content(
expandable_bin, expandable_bin,
#[strong] #[strong]
extra_info_page_button, extra_info_page_button,
#[strong]
theme_changed_action,
move |_| { move |_| {
if extra_info_page_button.is_active() { if extra_info_page_button.is_active() {
expandable_bin.set_child(Some(&extra_info_stack_page( expandable_bin.set_child(Some(&extra_info_stack_page(
&package_maintainer, &package_maintainer,
package_size, package_size,
package_installed_size, package_installed_size,
&theme_changed_action,
))); )));
} }
} }
@ -482,6 +512,7 @@ fn extra_info_stack_page(
package_maintainer: &str, package_maintainer: &str,
package_size: u64, package_size: u64,
package_installed_size: u64, package_installed_size: u64,
theme_changed_action: &gio::SimpleAction,
) -> gtk::Box { ) -> gtk::Box {
let extra_info_badges_content_box = Box::builder() let extra_info_badges_content_box = Box::builder()
.hexpand(true) .hexpand(true)
@ -497,6 +528,7 @@ fn extra_info_stack_page(
&t!("extra_info_maintainer").to_string(), &t!("extra_info_maintainer").to_string(),
package_maintainer, package_maintainer,
"background-accent-bg", "background-accent-bg",
&theme_changed_action,
&extra_info_badges_size_group, &extra_info_badges_size_group,
&extra_info_badges_size_group0, &extra_info_badges_size_group0,
&extra_info_badges_size_group1, &extra_info_badges_size_group1,
@ -505,6 +537,7 @@ fn extra_info_stack_page(
&t!("extra_info_download_size").to_string(), &t!("extra_info_download_size").to_string(),
&convert(package_size), &convert(package_size),
"background-accent-bg", "background-accent-bg",
&theme_changed_action,
&extra_info_badges_size_group, &extra_info_badges_size_group,
&extra_info_badges_size_group0, &extra_info_badges_size_group0,
&extra_info_badges_size_group1, &extra_info_badges_size_group1,
@ -513,6 +546,7 @@ fn extra_info_stack_page(
&t!("extra_info_installed_size").to_string(), &t!("extra_info_installed_size").to_string(),
&convert(package_installed_size), &convert(package_installed_size),
"background-accent-bg", "background-accent-bg",
&theme_changed_action,
&extra_info_badges_size_group, &extra_info_badges_size_group,
&extra_info_badges_size_group0, &extra_info_badges_size_group0,
&extra_info_badges_size_group1, &extra_info_badges_size_group1,
@ -523,6 +557,7 @@ fn create_color_badge(
label0_text: &str, label0_text: &str,
label1_text: &str, label1_text: &str,
css_style: &str, css_style: &str,
theme_changed_action: &gio::SimpleAction,
group_size: &SizeGroup, group_size: &SizeGroup,
group_size0: &SizeGroup, group_size0: &SizeGroup,
group_size1: &SizeGroup, group_size1: &SizeGroup,
@ -559,6 +594,38 @@ fn create_color_badge(
label1.add_css_class(css_style); label1.add_css_class(css_style);
#[allow(deprecated)]
let color = label1
.style_context()
.lookup_color("accent_bg_color")
.unwrap();
if (color.red() * 0.299 + color.green() * 0.587 + color.blue() * 0.114) > 170.0 {
label1.remove_css_class("white-color-text");
label1.add_css_class("black-color-text");
} else {
label1.remove_css_class("black-color-text");
label1.add_css_class("white-color-text");
}
theme_changed_action.connect_activate(clone!(
#[strong]
label1,
move |_, _| {
#[allow(deprecated)]
let color = label1
.style_context()
.lookup_color("accent_bg_color")
.unwrap();
if (color.red() * 0.299 + color.green() * 0.587 + color.blue() * 0.114) > 170.0 {
label1.remove_css_class("white-color-text");
label1.add_css_class("black-color-text");
} else {
label1.remove_css_class("black-color-text");
label1.add_css_class("white-color-text");
}
}
));
badge_box.append(&label0); badge_box.append(&label0);
badge_box.append(&label_separator); badge_box.append(&label_separator);
badge_box.append(&label1); badge_box.append(&label1);

View File

@ -190,7 +190,7 @@ pub fn apt_update_page(
.sensitive(false) .sensitive(false)
.build(); .build();
packages_boxedlist.add_css_class("boxed-list"); packages_boxedlist.add_css_class("boxed-list");
packages_boxedlist.add_css_class("round-all-scroll"); packages_boxedlist.add_css_class("no-round-borders");
let packages_viewport = ScrolledWindow::builder() let packages_viewport = ScrolledWindow::builder()
.vexpand(true) .vexpand(true)
@ -202,8 +202,9 @@ pub fn apt_update_page(
.margin_start(15) .margin_start(15)
.height_request(390) .height_request(390)
.child(&packages_boxedlist) .child(&packages_boxedlist)
.overflow(Overflow::Hidden)
.build(); .build();
packages_viewport.add_css_class("round-all-scroll"); packages_viewport.add_css_class("round-all-scroll-no-padding");
let packages_no_viewport_page = adw::StatusPage::builder() let packages_no_viewport_page = adw::StatusPage::builder()
.icon_name("emblem-default-symbolic") .icon_name("emblem-default-symbolic")
@ -571,11 +572,14 @@ pub fn apt_update_page(
apt_update_count, apt_update_count,
#[strong] #[strong]
flatpak_update_count, flatpak_update_count,
#[strong]
theme_changed_action,
async move { async move {
while let Ok(state) = get_upgradable_receiver.recv().await { while let Ok(state) = get_upgradable_receiver.recv().await {
viewport_bin.set_child(Some(&packages_viewport)); viewport_bin.set_child(Some(&packages_viewport));
update_button.set_sensitive(true); update_button.set_sensitive(true);
let apt_row = AptPackageRow::new(state.clone()); let apt_row = AptPackageRow::new(state.clone());
apt_row.set_theme_changed_action(&theme_changed_action);
apt_row.connect_closure( apt_row.connect_closure(
"checkbutton-toggled", "checkbutton-toggled",
false, false,

View File

@ -209,6 +209,7 @@ fn apt_confirm_window(
&t!("package_count_upgrade_badge_label"), &t!("package_count_upgrade_badge_label"),
&apt_changes_struct.package_count_upgrade.to_string(), &apt_changes_struct.package_count_upgrade.to_string(),
"background-accent-bg", "background-accent-bg",
&theme_changed_action,
&apt_update_dialog_badges_size_group, &apt_update_dialog_badges_size_group,
&apt_update_dialog_badges_size_group0, &apt_update_dialog_badges_size_group0,
&apt_update_dialog_badges_size_group1, &apt_update_dialog_badges_size_group1,
@ -218,6 +219,7 @@ fn apt_confirm_window(
&t!("package_count_install_badge_label"), &t!("package_count_install_badge_label"),
&apt_changes_struct.package_count_install.to_string(), &apt_changes_struct.package_count_install.to_string(),
"background-accent-bg", "background-accent-bg",
&theme_changed_action,
&apt_update_dialog_badges_size_group, &apt_update_dialog_badges_size_group,
&apt_update_dialog_badges_size_group0, &apt_update_dialog_badges_size_group0,
&apt_update_dialog_badges_size_group1, &apt_update_dialog_badges_size_group1,
@ -227,6 +229,7 @@ fn apt_confirm_window(
&t!("package_count_downgrade_badge_label"), &t!("package_count_downgrade_badge_label"),
&apt_changes_struct.package_count_downgrade.to_string(), &apt_changes_struct.package_count_downgrade.to_string(),
"background-accent-bg", "background-accent-bg",
&theme_changed_action,
&apt_update_dialog_badges_size_group, &apt_update_dialog_badges_size_group,
&apt_update_dialog_badges_size_group0, &apt_update_dialog_badges_size_group0,
&apt_update_dialog_badges_size_group1, &apt_update_dialog_badges_size_group1,
@ -236,6 +239,7 @@ fn apt_confirm_window(
&t!("package_count_remove_badge_label"), &t!("package_count_remove_badge_label"),
&apt_changes_struct.package_count_remove.to_string(), &apt_changes_struct.package_count_remove.to_string(),
"background-accent-bg", "background-accent-bg",
&theme_changed_action,
&apt_update_dialog_badges_size_group, &apt_update_dialog_badges_size_group,
&apt_update_dialog_badges_size_group0, &apt_update_dialog_badges_size_group0,
&apt_update_dialog_badges_size_group1, &apt_update_dialog_badges_size_group1,
@ -245,6 +249,7 @@ fn apt_confirm_window(
&t!("total_download_size_badge_label"), &t!("total_download_size_badge_label"),
&convert(apt_changes_struct.total_download_size as f64), &convert(apt_changes_struct.total_download_size as f64),
"background-accent-bg", "background-accent-bg",
&theme_changed_action,
&apt_update_dialog_badges_size_group, &apt_update_dialog_badges_size_group,
&apt_update_dialog_badges_size_group0, &apt_update_dialog_badges_size_group0,
&apt_update_dialog_badges_size_group1, &apt_update_dialog_badges_size_group1,
@ -254,6 +259,7 @@ fn apt_confirm_window(
&t!("total_installed_size_badge_label"), &t!("total_installed_size_badge_label"),
&convert(apt_changes_struct.total_installed_size as f64), &convert(apt_changes_struct.total_installed_size as f64),
"background-accent-bg", "background-accent-bg",
&theme_changed_action,
&apt_update_dialog_badges_size_group, &apt_update_dialog_badges_size_group,
&apt_update_dialog_badges_size_group0, &apt_update_dialog_badges_size_group0,
&apt_update_dialog_badges_size_group1, &apt_update_dialog_badges_size_group1,
@ -661,6 +667,7 @@ fn create_color_badge(
label0_text: &str, label0_text: &str,
label1_text: &str, label1_text: &str,
css_style: &str, css_style: &str,
theme_changed_action: &SimpleAction,
group_size: &SizeGroup, group_size: &SizeGroup,
group_size0: &SizeGroup, group_size0: &SizeGroup,
group_size1: &SizeGroup, group_size1: &SizeGroup,
@ -697,6 +704,38 @@ fn create_color_badge(
label1.add_css_class(css_style); label1.add_css_class(css_style);
#[allow(deprecated)]
let color = label1
.style_context()
.lookup_color("accent_bg_color")
.unwrap();
if (color.red() * 0.299 + color.green() * 0.587 + color.blue() * 0.114) > 170.0 {
label1.remove_css_class("white-color-text");
label1.add_css_class("black-color-text");
} else {
label1.remove_css_class("black-color-text");
label1.add_css_class("white-color-text");
}
theme_changed_action.connect_activate(clone!(
#[strong]
label1,
move |_, _| {
#[allow(deprecated)]
let color = label1
.style_context()
.lookup_color("accent_bg_color")
.unwrap();
if (color.red() * 0.299 + color.green() * 0.587 + color.blue() * 0.114) > 170.0 {
label1.remove_css_class("white-color-text");
label1.add_css_class("black-color-text");
} else {
label1.remove_css_class("black-color-text");
label1.add_css_class("white-color-text");
}
}
));
badge_box.append(&label0); badge_box.append(&label0);
badge_box.append(&label_separator); badge_box.append(&label_separator);
badge_box.append(&label1); badge_box.append(&label1);

View File

@ -432,7 +432,7 @@ pub fn build_ui(app: &Application) {
let theme_changed_action = theme_changed_action.clone(); let theme_changed_action = theme_changed_action.clone();
glib::timeout_add_seconds_local(5, move || { glib::timeout_add_seconds_local(5, move || {
theme_changed_action.activate(None); theme_changed_action.activate(None);
glib::ControlFlow::Continue glib::ControlFlow::Break
}); });
} }
)); ));
@ -443,7 +443,7 @@ pub fn build_ui(app: &Application) {
let theme_changed_action = theme_changed_action.clone(); let theme_changed_action = theme_changed_action.clone();
glib::timeout_add_seconds_local(5, move || { glib::timeout_add_seconds_local(5, move || {
theme_changed_action.activate(None); theme_changed_action.activate(None);
glib::ControlFlow::Continue glib::ControlFlow::Break
}); });
} }
)); ));
@ -462,7 +462,7 @@ pub fn build_ui(app: &Application) {
let gsettings_change_sender_clone0 = gsettings_change_sender_clone0.clone(); let gsettings_change_sender_clone0 = gsettings_change_sender_clone0.clone();
glib::timeout_add_seconds_local(5, move || { glib::timeout_add_seconds_local(5, move || {
gsettings_change_sender_clone0.send_blocking(()).unwrap(); gsettings_change_sender_clone0.send_blocking(()).unwrap();
glib::ControlFlow::Continue glib::ControlFlow::Break
}); });
} }
), ),

View File

@ -236,13 +236,7 @@ pub fn flatpak_manage_page(
retry_signal_action.activate(None); retry_signal_action.activate(None);
let flatpak_remotes_box = Box::builder() let flatpak_remotes_box = Box::builder().orientation(Orientation::Vertical).build();
.orientation(Orientation::Vertical)
.margin_bottom(3)
.margin_top(3)
.margin_end(3)
.margin_start(3)
.build();
let flatpak_remotes_viewport = ScrolledWindow::builder() let flatpak_remotes_viewport = ScrolledWindow::builder()
.vexpand(true) .vexpand(true)
@ -253,9 +247,10 @@ pub fn flatpak_manage_page(
.margin_end(15) .margin_end(15)
.margin_start(15) .margin_start(15)
.child(&flatpak_remotes_box) .child(&flatpak_remotes_box)
.overflow(Overflow::Hidden)
.height_request(390) .height_request(390)
.build(); .build();
flatpak_remotes_viewport.add_css_class("round-all-scroll"); flatpak_remotes_viewport.add_css_class("round-all-scroll-no-padding");
// //

View File

@ -34,6 +34,8 @@ pub struct FlatpakRefRow {
flatref_is_system: RefCell<bool>, flatref_is_system: RefCell<bool>,
#[property(get, set)] #[property(get, set)]
flatref_marked: RefCell<bool>, flatref_marked: RefCell<bool>,
#[property(get, set)]
theme_changed_action: RefCell<Option<gio::SimpleAction>>,
} }
// ANCHOR_END: custom_button // ANCHOR_END: custom_button
@ -80,6 +82,27 @@ impl ObjectImpl for FlatpakRefRow {
let expandable_box = Box::new(Orientation::Vertical, 0); let expandable_box = Box::new(Orientation::Vertical, 0);
let temp_simple_action = gio::SimpleAction::new("theme_change2", None);
obj.connect_theme_changed_action_notify(clone!(
#[strong]
obj,
#[strong]
temp_simple_action,
move |_| {
match obj.theme_changed_action() {
Some(a) => {
a.connect_activate(clone!(
#[strong]
temp_simple_action,
move |_, _| temp_simple_action.activate(None)
));
}
None => {}
}
}
));
obj.connect_flatref_name_notify(clone!( obj.connect_flatref_name_notify(clone!(
#[weak] #[weak]
prefix_box, prefix_box,
@ -87,6 +110,8 @@ impl ObjectImpl for FlatpakRefRow {
expandable_box, expandable_box,
#[strong] #[strong]
obj, obj,
#[strong]
temp_simple_action,
move |_| { move |_| {
remove_all_children_from_box(&prefix_box); remove_all_children_from_box(&prefix_box);
remove_all_children_from_box(&expandable_box); remove_all_children_from_box(&expandable_box);
@ -114,6 +139,7 @@ impl ObjectImpl for FlatpakRefRow {
create_expandable_content( create_expandable_content(
&obj, &obj,
&expandable_box, &expandable_box,
&temp_simple_action,
flatref_ref_name, flatref_ref_name,
flatref_summary, flatref_summary,
flatref_download_size, flatref_download_size,
@ -279,6 +305,7 @@ fn create_prefix_content(
fn create_expandable_content( fn create_expandable_content(
flatpak_package_row: &impl IsA<ExpanderRow>, flatpak_package_row: &impl IsA<ExpanderRow>,
expandable_box: &gtk::Box, expandable_box: &gtk::Box,
theme_changed_action: &gio::SimpleAction,
flatref_ref_name: String, flatref_ref_name: String,
flatref_summary: String, flatref_summary: String,
flatref_download_size: u64, flatref_download_size: u64,
@ -329,12 +356,15 @@ fn create_expandable_content(
expandable_bin, expandable_bin,
#[strong] #[strong]
extra_info_page_button, extra_info_page_button,
#[strong]
theme_changed_action,
move |_| { move |_| {
if extra_info_page_button.is_active() { if extra_info_page_button.is_active() {
expandable_bin.set_child(Some(&extra_info_stack_page( expandable_bin.set_child(Some(&extra_info_stack_page(
&flatref_ref_name, &flatref_ref_name,
flatref_download_size, flatref_download_size,
flatref_installed_size_remote, flatref_installed_size_remote,
&theme_changed_action,
))); )));
} }
} }
@ -388,6 +418,7 @@ fn extra_info_stack_page(
flatref_ref_name: &str, flatref_ref_name: &str,
flatref_download_size: u64, flatref_download_size: u64,
flatref_installed_size_remote: u64, flatref_installed_size_remote: u64,
theme_changed_action: &gio::SimpleAction,
) -> gtk::Box { ) -> gtk::Box {
let extra_info_badges_content_box = Box::builder() let extra_info_badges_content_box = Box::builder()
.hexpand(true) .hexpand(true)
@ -403,6 +434,7 @@ fn extra_info_stack_page(
&t!("flatpak_extra_info_ref_name").to_string(), &t!("flatpak_extra_info_ref_name").to_string(),
flatref_ref_name, flatref_ref_name,
"background-accent-bg", "background-accent-bg",
&theme_changed_action,
&extra_info_badges_size_group, &extra_info_badges_size_group,
&extra_info_badges_size_group0, &extra_info_badges_size_group0,
&extra_info_badges_size_group1, &extra_info_badges_size_group1,
@ -411,6 +443,7 @@ fn extra_info_stack_page(
&t!("flatpak_extra_info_download_size").to_string(), &t!("flatpak_extra_info_download_size").to_string(),
&convert(package_size), &convert(package_size),
"background-accent-bg", "background-accent-bg",
&theme_changed_action,
&extra_info_badges_size_group, &extra_info_badges_size_group,
&extra_info_badges_size_group0, &extra_info_badges_size_group0,
&extra_info_badges_size_group1, &extra_info_badges_size_group1,
@ -419,6 +452,7 @@ fn extra_info_stack_page(
&t!("flatpak_extra_info_installed_size").to_string(), &t!("flatpak_extra_info_installed_size").to_string(),
&convert(package_installed_size), &convert(package_installed_size),
"background-accent-bg", "background-accent-bg",
&theme_changed_action,
&extra_info_badges_size_group, &extra_info_badges_size_group,
&extra_info_badges_size_group0, &extra_info_badges_size_group0,
&extra_info_badges_size_group1, &extra_info_badges_size_group1,
@ -429,6 +463,7 @@ fn create_color_badge(
label0_text: &str, label0_text: &str,
label1_text: &str, label1_text: &str,
css_style: &str, css_style: &str,
theme_changed_action: &gio::SimpleAction,
group_size: &SizeGroup, group_size: &SizeGroup,
group_size0: &SizeGroup, group_size0: &SizeGroup,
group_size1: &SizeGroup, group_size1: &SizeGroup,
@ -465,6 +500,38 @@ fn create_color_badge(
label1.add_css_class(css_style); label1.add_css_class(css_style);
#[allow(deprecated)]
let color = label1
.style_context()
.lookup_color("accent_bg_color")
.unwrap();
if (color.red() * 0.299 + color.green() * 0.587 + color.blue() * 0.114) > 170.0 {
label1.remove_css_class("white-color-text");
label1.add_css_class("black-color-text");
} else {
label1.remove_css_class("black-color-text");
label1.add_css_class("white-color-text");
}
theme_changed_action.connect_activate(clone!(
#[strong]
label1,
move |_, _| {
#[allow(deprecated)]
let color = label1
.style_context()
.lookup_color("accent_bg_color")
.unwrap();
if (color.red() * 0.299 + color.green() * 0.587 + color.blue() * 0.114) > 170.0 {
label1.remove_css_class("white-color-text");
label1.add_css_class("black-color-text");
} else {
label1.remove_css_class("black-color-text");
label1.add_css_class("white-color-text");
}
}
));
badge_box.append(&label0); badge_box.append(&label0);
badge_box.append(&label_separator); badge_box.append(&label_separator);
badge_box.append(&label1); badge_box.append(&label1);

View File

@ -172,7 +172,7 @@ pub fn flatpak_update_page(
.sensitive(false) .sensitive(false)
.build(); .build();
packages_boxedlist.add_css_class("boxed-list"); packages_boxedlist.add_css_class("boxed-list");
packages_boxedlist.add_css_class("round-all-scroll"); packages_boxedlist.add_css_class("no-round-borders");
let packages_viewport = ScrolledWindow::builder() let packages_viewport = ScrolledWindow::builder()
.vexpand(true) .vexpand(true)
@ -184,8 +184,9 @@ pub fn flatpak_update_page(
.margin_start(15) .margin_start(15)
.height_request(390) .height_request(390)
.child(&packages_boxedlist) .child(&packages_boxedlist)
.overflow(Overflow::Hidden)
.build(); .build();
packages_viewport.add_css_class("round-all-scroll"); packages_viewport.add_css_class("round-all-scroll-no-padding");
let packages_no_viewport_page = adw::StatusPage::builder() let packages_no_viewport_page = adw::StatusPage::builder()
.icon_name("emblem-default-symbolic") .icon_name("emblem-default-symbolic")
@ -395,6 +396,8 @@ pub fn flatpak_update_page(
apt_update_count, apt_update_count,
#[strong] #[strong]
flatpak_update_count, flatpak_update_count,
#[strong]
theme_changed_action,
async move { async move {
while let Ok(state) = appstream_sync_status_receiver.recv().await { while let Ok(state) = appstream_sync_status_receiver.recv().await {
match state.as_ref() { match state.as_ref() {
@ -406,6 +409,7 @@ pub fn flatpak_update_page(
&select_button, &select_button,
&packages_viewport, &packages_viewport,
&packages_boxedlist, &packages_boxedlist,
&theme_changed_action,
&system_refs_for_upgrade_vec, &system_refs_for_upgrade_vec,
&system_refs_for_upgrade_vec_all, &system_refs_for_upgrade_vec_all,
&user_refs_for_upgrade_vec, &user_refs_for_upgrade_vec,
@ -424,6 +428,7 @@ pub fn flatpak_update_page(
&select_button, &select_button,
&packages_viewport, &packages_viewport,
&packages_boxedlist, &packages_boxedlist,
&theme_changed_action,
&system_refs_for_upgrade_vec, &system_refs_for_upgrade_vec,
&system_refs_for_upgrade_vec_all, &system_refs_for_upgrade_vec_all,
&user_refs_for_upgrade_vec, &user_refs_for_upgrade_vec,
@ -540,6 +545,7 @@ fn get_flatpak_updates(
select_button: &gtk::Button, select_button: &gtk::Button,
packages_viewport: &gtk::ScrolledWindow, packages_viewport: &gtk::ScrolledWindow,
packages_boxedlist: &gtk::ListBox, packages_boxedlist: &gtk::ListBox,
theme_changed_action: &gio::SimpleAction,
system_refs_for_upgrade_vec: &Rc<RefCell<Vec<FlatpakRefRow>>>, system_refs_for_upgrade_vec: &Rc<RefCell<Vec<FlatpakRefRow>>>,
system_refs_for_upgrade_vec_all: &Rc<RefCell<Vec<FlatpakRefRow>>>, system_refs_for_upgrade_vec_all: &Rc<RefCell<Vec<FlatpakRefRow>>>,
user_refs_for_upgrade_vec: &Rc<RefCell<Vec<FlatpakRefRow>>>, user_refs_for_upgrade_vec: &Rc<RefCell<Vec<FlatpakRefRow>>>,
@ -638,6 +644,8 @@ fn get_flatpak_updates(
let flatpak_row = FlatpakRefRow::new(&flatref_struct); let flatpak_row = FlatpakRefRow::new(&flatref_struct);
flatpak_row.set_theme_changed_action(theme_changed_action);
system_refs_for_upgrade_vec system_refs_for_upgrade_vec
.borrow_mut() .borrow_mut()
.push(flatpak_row.clone()); .push(flatpak_row.clone());

View File

@ -83,6 +83,14 @@
color: @success_bg_color; color: @success_bg_color;
} }
.black-color-text {
color: black;
}
.white-color-text {
color: white;
}
.size-20-bold-text { .size-20-bold-text {
font-weight: 800; font-weight: 800;
font-size: 20px; font-size: 20px;