mirror of
https://github.com/Xetibo/ReSet.git
synced 2025-12-15 10:01:39 +01:00
Add factory for dropdowns
Replace ListEntry with libadwaita components
This commit is contained in:
parent
ba48f5ba33
commit
babc0e8cc4
10 changed files with 182 additions and 307 deletions
|
|
@ -1,8 +1,12 @@
|
|||
use std::cell::RefCell;
|
||||
use std::collections::HashMap;
|
||||
use adw::ComboRow;
|
||||
use adw::subclass::action_row::ActionRowImpl;
|
||||
use adw::subclass::preferences_row::PreferencesRowImpl;
|
||||
use adw::subclass::prelude::ComboRowImpl;
|
||||
|
||||
use gtk::subclass::prelude::*;
|
||||
use gtk::{glib, CompositeTemplate, DropDown, Label, StringList, TemplateChild};
|
||||
use gtk::{glib, CompositeTemplate};
|
||||
|
||||
use super::cardEntry;
|
||||
|
||||
|
|
@ -10,12 +14,6 @@ use super::cardEntry;
|
|||
#[derive(Default, CompositeTemplate)]
|
||||
#[template(resource = "/org/Xetibo/ReSet/resetCardEntry.ui")]
|
||||
pub struct CardEntry {
|
||||
#[template_child]
|
||||
pub resetCardName: TemplateChild<Label>,
|
||||
#[template_child]
|
||||
pub resetCardDropdown: TemplateChild<DropDown>,
|
||||
#[template_child]
|
||||
pub resetCardList: TemplateChild<StringList>,
|
||||
// first string is the alias name, the first return string is the index of the adapter and the
|
||||
// second the name of the profile
|
||||
pub resetCardMap: RefCell<HashMap<String, (u32, String)>>,
|
||||
|
|
@ -25,7 +23,7 @@ pub struct CardEntry {
|
|||
impl ObjectSubclass for CardEntry {
|
||||
const NAME: &'static str = "resetCardEntry";
|
||||
type Type = cardEntry::CardEntry;
|
||||
type ParentType = gtk::Box;
|
||||
type ParentType = ComboRow;
|
||||
|
||||
fn class_init(klass: &mut Self::Class) {
|
||||
klass.bind_template();
|
||||
|
|
@ -36,7 +34,11 @@ impl ObjectSubclass for CardEntry {
|
|||
}
|
||||
}
|
||||
|
||||
impl BoxImpl for CardEntry {}
|
||||
impl ActionRowImpl for CardEntry {}
|
||||
|
||||
impl PreferencesRowImpl for CardEntry {}
|
||||
|
||||
impl ComboRowImpl for CardEntry {}
|
||||
|
||||
impl ObjectImpl for CardEntry {
|
||||
fn constructed(&self) {}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue