filter based on app names or category
This commit is contained in:
parent
9d3be77538
commit
3779b7ec5e
4 changed files with 84 additions and 24 deletions
|
|
@ -2,6 +2,7 @@ use gtk::glib;
|
|||
use gtk::prelude::*;
|
||||
use gtk::subclass::prelude::*;
|
||||
use gtk4 as gtk;
|
||||
use std::cell::Cell;
|
||||
|
||||
use gtk::CompositeTemplate;
|
||||
|
||||
|
|
@ -12,6 +13,7 @@ pub struct GridItem {
|
|||
pub name: TemplateChild<gtk::Label>,
|
||||
#[template_child]
|
||||
pub image: TemplateChild<gtk::Image>,
|
||||
pub index: Cell<u32>,
|
||||
}
|
||||
|
||||
#[glib::object_subclass]
|
||||
|
|
|
|||
|
|
@ -7,8 +7,9 @@ use gtk::subclass::prelude::*;
|
|||
use gtk::{gio, glib};
|
||||
|
||||
glib::wrapper! {
|
||||
pub struct GridItem(ObjectSubclass<imp::GridItem>)
|
||||
@extends gtk::Widget, gtk::Box;
|
||||
pub struct GridItem(ObjectSubclass<imp::GridItem>)
|
||||
@extends gtk::Widget, gtk::Box,
|
||||
@implements gtk::Accessible, gtk::Actionable, gtk::Buildable, gtk::ConstraintTarget;
|
||||
}
|
||||
|
||||
impl Default for GridItem {
|
||||
|
|
@ -40,11 +41,15 @@ impl GridItem {
|
|||
);
|
||||
}
|
||||
if let Ok(icon) = app_group.property("icon") {
|
||||
&self_.image.set_from_icon_name(Some(
|
||||
self_.image.set_from_icon_name(Some(
|
||||
&icon
|
||||
.get::<String>()
|
||||
.expect("Property name needs to be a String."),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_index(&self, index: u32) {
|
||||
imp::GridItem::from_instance(self).index.set(index);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue