-
-
Notifications
You must be signed in to change notification settings - Fork 96
feat: improve pstates UI #896
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
ilya-zlobintsev
merged 21 commits into
ilya-zlobintsev:master
from
makarov-roman:improve-pstates-ui
Feb 15, 2026
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
f05c76c
move state_row to dedicated component
makarov-roman 45c8660
remove selectable behavior
makarov-roman 18551e2
highlight active pstate
makarov-roman 1951658
hide checkboxes when not configurable
makarov-roman 4e3543e
hide pstates table when there is no data
makarov-roman c341bfa
prevents container width jumps when active row change
makarov-roman 7c86a85
add page_section_expander and wrap PowerStatesFrame into it
makarov-roman d29eab7
move active indicator to the beginning and use opacity instead of vis…
makarov-roman f6255f1
improve listbox captions styles
makarov-roman 2251a8f
remove states_expanded state from PowerStatesFrame
makarov-roman e5bfa75
remove no longer relevant styles
makarov-roman f9d4a4b
improve margins
makarov-roman a0dd323
move SelectionMode to view, kinda
makarov-roman 24557f0
clean up
makarov-roman 6a6679b
align expaner label
makarov-roman baea5b7
organize imports
makarov-roman c13187b
hide active p-state indicator if non is active
makarov-roman 5fb78dc
use bindings for configurable
makarov-roman 7f387f9
fix PowerStateRow props visibility
makarov-roman 49224d4
move bindings inits
makarov-roman 3cf054f
fix set_sensitive on enable-pstate-config checkbox
makarov-roman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,132 @@ | ||
| use cairo::glib::subclass::types::ObjectSubclassIsExt; | ||
| use gtk::prelude::*; | ||
| use gtk::{ | ||
| glib::{ | ||
| self, Object, | ||
| subclass::types::{IsSubclassable, ObjectSubclass}, | ||
| }, | ||
| subclass::box_::BoxImpl, | ||
| }; | ||
|
|
||
| glib::wrapper! { | ||
| pub struct PageSectionExpander(ObjectSubclass<imp::PageSectionExpander>) | ||
| @extends gtk::Box, gtk::Widget, | ||
| @implements gtk::Orientable, gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget; | ||
| } | ||
|
|
||
| impl PageSectionExpander { | ||
| pub fn new(name: &str) -> Self { | ||
| Object::builder().property("name", name).build() | ||
| } | ||
|
|
||
| pub fn append_header(&self, widget: &impl IsA<gtk::Widget>) { | ||
| self.imp().header_box.append(widget); | ||
| } | ||
|
|
||
| pub fn append_expandable(&self, widget: &impl IsA<gtk::Widget>) { | ||
| self.imp().children_box.append(widget); | ||
| } | ||
| } | ||
|
|
||
| unsafe impl<T: ObjectSubclass + BoxImpl> IsSubclassable<T> for PageSectionExpander {} | ||
|
|
||
| mod imp { | ||
| use std::cell::RefCell; | ||
|
|
||
| use glib::Properties; | ||
| use gtk::{ | ||
| Label, | ||
| glib::{self}, | ||
| prelude::*, | ||
| subclass::{prelude::*, widget::WidgetImpl}, | ||
| }; | ||
| use relm4::{RelmWidgetExt, view}; | ||
|
|
||
| #[derive(Default, Properties)] | ||
| #[properties(wrapper_type = super::PageSectionExpander)] | ||
| pub struct PageSectionExpander { | ||
| section_label: Label, | ||
| pub(super) header_box: gtk::Box, | ||
| pub(super) content_box: gtk::Box, | ||
| pub(super) children_box: gtk::Box, | ||
| pub(super) expander: gtk::Expander, | ||
|
|
||
| #[property(get, set)] | ||
| name: RefCell<String>, | ||
|
|
||
| #[property(get, set)] | ||
| expanded: std::cell::Cell<bool>, | ||
| } | ||
|
|
||
| #[glib::object_subclass] | ||
| impl ObjectSubclass for PageSectionExpander { | ||
| const NAME: &'static str = "PageSectionExpander"; | ||
| type Type = super::PageSectionExpander; | ||
| type ParentType = gtk::Box; | ||
| } | ||
|
|
||
| #[glib::derived_properties] | ||
| impl ObjectImpl for PageSectionExpander { | ||
| fn constructed(&self) { | ||
| self.parent_constructed(); | ||
| let obj = self.obj(); | ||
|
|
||
| let section_label = &self.section_label; | ||
| let header_box = &self.header_box; | ||
| let content_box = &self.content_box; | ||
| let children_box = &self.children_box; | ||
| let expander = &self.expander; | ||
|
|
||
| view! { | ||
| #[local_ref] | ||
| obj { | ||
| set_orientation: gtk::Orientation::Vertical, | ||
| set_spacing: 10, | ||
|
|
||
| #[local_ref] | ||
| append = expander { | ||
| set_child: Some(content_box), | ||
| set_label_widget : Some(header_box), | ||
| }, | ||
| }, | ||
|
|
||
| #[local_ref] | ||
| header_box { | ||
| set_orientation: gtk::Orientation::Horizontal, | ||
| set_spacing: 10, | ||
|
|
||
| #[local_ref] | ||
| append = section_label { | ||
| set_use_markup: true, | ||
| set_halign: gtk::Align::Start, | ||
| set_margin_vertical: 5, | ||
| // align label with normal PageSection | ||
| set_margin_start: -1, | ||
| set_margin_end: 1, | ||
| }, | ||
| }, | ||
|
|
||
| #[local_ref] | ||
| content_box { | ||
| set_orientation: gtk::Orientation::Vertical, | ||
|
|
||
| #[local_ref] | ||
| append = children_box { | ||
| set_orientation: gtk::Orientation::Vertical, | ||
| set_spacing: 10, | ||
| set_margin_all: 10, | ||
| }, | ||
| }, | ||
| } | ||
|
|
||
| obj.bind_property("name", &self.section_label, "label") | ||
| .transform_to(|_, value: String| { | ||
| Some(format!("<span font_desc='13'><b>{value}</b></span>")) | ||
| }) | ||
| .build(); | ||
| } | ||
| } | ||
|
|
||
| impl WidgetImpl for PageSectionExpander {} | ||
| impl BoxImpl for PageSectionExpander {} | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,3 @@ | ||
| pub mod power_states_frame; | ||
| mod power_states_list; | ||
| mod power_states_row; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.