feat: basic list store implementation
This commit is contained in:
parent
0a91ca0ccd
commit
32b47eea02
4 changed files with 329 additions and 50 deletions
34
examples/launcher/application_object/mod.rs
Normal file
34
examples/launcher/application_object/mod.rs
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
mod imp;
|
||||
|
||||
use gdk4::glib::Object;
|
||||
use gtk4::glib;
|
||||
use std::cell::RefCell;
|
||||
use std::rc::Rc;
|
||||
|
||||
glib::wrapper! {
|
||||
pub struct ApplicationObject(ObjectSubclass<imp::ApplicationObject>);
|
||||
}
|
||||
|
||||
impl ApplicationObject {
|
||||
pub fn new(application_search_result: &pop_launcher::SearchResult) -> Self {
|
||||
Object::new(&[("name", &application_search_result.name)])
|
||||
.expect("Failed to create `ApplicationObject`.")
|
||||
}
|
||||
}
|
||||
|
||||
// Object holding the state
|
||||
pub struct ApplicationData(pop_launcher::SearchResult);
|
||||
|
||||
impl Default for ApplicationData {
|
||||
fn default() -> Self {
|
||||
let default_application = pop_launcher::SearchResult {
|
||||
id: 0,
|
||||
name: String::default(),
|
||||
description: String::default(),
|
||||
icon: None,
|
||||
category_icon: None,
|
||||
window: None,
|
||||
};
|
||||
Self(default_application)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue