window, image_view: Cleanups
* Move context menu model to image_view.ui * Remove useless property assignment
This commit is contained in:
parent
293dc3c124
commit
e41acf0701
3 changed files with 26 additions and 53 deletions
|
|
@ -91,13 +91,6 @@ mod imp {
|
|||
fn properties() -> &'static [glib::ParamSpec] {
|
||||
static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| {
|
||||
vec![
|
||||
glib::ParamSpec::new_object(
|
||||
"popover-menu-model",
|
||||
"Popover Menu Model",
|
||||
"The menu model for the menu button",
|
||||
gio::MenuModel::static_type(),
|
||||
glib::ParamFlags::READWRITE,
|
||||
),
|
||||
glib::ParamSpec::new_string(
|
||||
"filename",
|
||||
"Filename",
|
||||
|
|
@ -140,30 +133,12 @@ mod imp {
|
|||
|
||||
fn property(&self, _obj: &Self::Type, _id: usize, psec: &glib::ParamSpec) -> glib::Value {
|
||||
match psec.name() {
|
||||
"popover-menu-model" => self.popover_menu_model.borrow().to_value(),
|
||||
"filename" => self.filename.borrow().to_value(),
|
||||
"controls" => self.controls.to_value(),
|
||||
_ => unimplemented!(),
|
||||
}
|
||||
}
|
||||
|
||||
fn set_property(
|
||||
&self,
|
||||
_obj: &Self::Type,
|
||||
_id: usize,
|
||||
value: &glib::Value,
|
||||
psec: &glib::ParamSpec,
|
||||
) {
|
||||
match psec.name() {
|
||||
"popover-menu-model" => {
|
||||
let model: Option<gio::MenuModel> = value.get().unwrap();
|
||||
self.popover.set_menu_model(model.as_ref());
|
||||
*self.popover_menu_model.borrow_mut() = model;
|
||||
}
|
||||
_ => unimplemented!(),
|
||||
}
|
||||
}
|
||||
|
||||
fn constructed(&self, obj: &Self::Type) {
|
||||
self.parent_constructed(obj);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue