Skip to content
This repository has been archived by the owner on Jun 8, 2021. It is now read-only.

Commit

Permalink
Merge pull request #240 from EPashkin/set_property_IsA
Browse files Browse the repository at this point in the history
Use IsA for property setters
  • Loading branch information
sdroege committed Sep 10, 2019
2 parents 5874159 + 346cd11 commit e2da008
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 8 deletions.
2 changes: 1 addition & 1 deletion gir-files
11 changes: 9 additions & 2 deletions src/auto/application.rs
Expand Up @@ -9,6 +9,7 @@ use glib::object::IsA;
use glib::signal::connect_raw;
use glib::signal::SignalHandlerId;
use glib::translate::*;
use glib::value::SetValueOptional;
use glib::GString;
use glib::StaticType;
use glib::ToValue;
Expand Down Expand Up @@ -209,7 +210,10 @@ pub trait ApplicationExt: 'static {

fn withdraw_notification(&self, id: &str);

fn set_property_action_group(&self, action_group: Option<&ActionGroup>);
fn set_property_action_group<P: IsA<ActionGroup> + SetValueOptional>(
&self,
action_group: Option<&P>,
);

fn connect_activate<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;

Expand Down Expand Up @@ -528,7 +532,10 @@ impl<O: IsA<Application>> ApplicationExt for O {
}
}

fn set_property_action_group(&self, action_group: Option<&ActionGroup>) {
fn set_property_action_group<P: IsA<ActionGroup> + SetValueOptional>(
&self,
action_group: Option<&P>,
) {
unsafe {
gobject_sys::g_object_set_property(
self.to_glib_none().0 as *mut gobject_sys::GObject,
Expand Down
5 changes: 3 additions & 2 deletions src/auto/inet_address_mask.rs
Expand Up @@ -8,6 +8,7 @@ use glib::object::IsA;
use glib::signal::connect_raw;
use glib::signal::SignalHandlerId;
use glib::translate::*;
use glib::value::SetValueOptional;
use glib::GString;
use glib::Value;
use glib_sys;
Expand Down Expand Up @@ -79,7 +80,7 @@ pub trait InetAddressMaskExt: 'static {

fn to_string(&self) -> GString;

fn set_property_address(&self, address: Option<&InetAddress>);
fn set_property_address<P: IsA<InetAddress> + SetValueOptional>(&self, address: Option<&P>);

fn set_property_length(&self, length: u32);

Expand Down Expand Up @@ -146,7 +147,7 @@ impl<O: IsA<InetAddressMask>> InetAddressMaskExt for O {
}
}

fn set_property_address(&self, address: Option<&InetAddress>) {
fn set_property_address<P: IsA<InetAddress> + SetValueOptional>(&self, address: Option<&P>) {
unsafe {
gobject_sys::g_object_set_property(
self.to_glib_none().0 as *mut gobject_sys::GObject,
Expand Down
4 changes: 2 additions & 2 deletions src/auto/versions.txt
@@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ 567f2b3)
from gir-files (https://github.com/gtk-rs/gir-files @ cae49a8)
Generated by gir (https://github.com/gtk-rs/gir @ a615468)
from gir-files (https://github.com/gtk-rs/gir-files @ f7e3c51)

0 comments on commit e2da008

Please sign in to comment.