Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.16 backports #815

Merged
merged 6 commits into from Oct 27, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion gio/Cargo.toml
Expand Up @@ -43,7 +43,7 @@ futures-channel = "0.3"
futures-io = "0.3"
futures-util = { version = "0.3", default-features = false }
ffi = { version = "0.16", package = "gio-sys", path = "sys" }
glib = { version = "0.16", path = "../glib" }
glib = { version = "0.16.2", path = "../glib" }
thiserror = "1"
pin-project-lite = "0.2"
smallvec = "1"
Expand Down
82 changes: 19 additions & 63 deletions gio/src/subclass/action_group.rs
Expand Up @@ -111,10 +111,7 @@ impl<T: ActionGroupImpl> ActionGroupImplExt for T {

if let Some(func) = (*parent_iface).action_added {
func(
self.instance()
.unsafe_cast_ref::<ActionGroup>()
.to_glib_none()
.0,
self.obj().unsafe_cast_ref::<ActionGroup>().to_glib_none().0,
action_name.to_glib_none().0,
);
}
Expand All @@ -129,10 +126,7 @@ impl<T: ActionGroupImpl> ActionGroupImplExt for T {

if let Some(func) = (*parent_iface).action_enabled_changed {
func(
self.instance()
.unsafe_cast_ref::<ActionGroup>()
.to_glib_none()
.0,
self.obj().unsafe_cast_ref::<ActionGroup>().to_glib_none().0,
action_name.to_glib_none().0,
enabled.into_glib(),
);
Expand All @@ -148,10 +142,7 @@ impl<T: ActionGroupImpl> ActionGroupImplExt for T {

if let Some(func) = (*parent_iface).action_removed {
func(
self.instance()
.unsafe_cast_ref::<ActionGroup>()
.to_glib_none()
.0,
self.obj().unsafe_cast_ref::<ActionGroup>().to_glib_none().0,
action_name.to_glib_none().0,
);
}
Expand All @@ -166,10 +157,7 @@ impl<T: ActionGroupImpl> ActionGroupImplExt for T {

if let Some(func) = (*parent_iface).action_state_changed {
func(
self.instance()
.unsafe_cast_ref::<ActionGroup>()
.to_glib_none()
.0,
self.obj().unsafe_cast_ref::<ActionGroup>().to_glib_none().0,
action_name.to_glib_none().0,
state.to_glib_none().0,
);
Expand All @@ -187,10 +175,7 @@ impl<T: ActionGroupImpl> ActionGroupImplExt for T {
.activate_action
.expect("no parent \"activate_action\" implementation");
func(
self.instance()
.unsafe_cast_ref::<ActionGroup>()
.to_glib_none()
.0,
self.obj().unsafe_cast_ref::<ActionGroup>().to_glib_none().0,
action_name.to_glib_none().0,
parameter.to_glib_none().0,
);
Expand All @@ -207,10 +192,7 @@ impl<T: ActionGroupImpl> ActionGroupImplExt for T {
.change_action_state
.expect("no parent \"change_action_state\" implementation");
func(
self.instance()
.unsafe_cast_ref::<ActionGroup>()
.to_glib_none()
.0,
self.obj().unsafe_cast_ref::<ActionGroup>().to_glib_none().0,
action_name.to_glib_none().0,
value.to_glib_none().0,
);
Expand All @@ -227,10 +209,7 @@ impl<T: ActionGroupImpl> ActionGroupImplExt for T {
.get_action_enabled
.expect("no parent \"action_is_enabled\" implementation");
let ret = func(
self.instance()
.unsafe_cast_ref::<ActionGroup>()
.to_glib_none()
.0,
self.obj().unsafe_cast_ref::<ActionGroup>().to_glib_none().0,
action_name.to_glib_none().0,
);
from_glib(ret)
Expand All @@ -247,10 +226,7 @@ impl<T: ActionGroupImpl> ActionGroupImplExt for T {
.get_action_parameter_type
.expect("no parent \"get_action_parameter_type\" implementation");
let ret = func(
self.instance()
.unsafe_cast_ref::<ActionGroup>()
.to_glib_none()
.0,
self.obj().unsafe_cast_ref::<ActionGroup>().to_glib_none().0,
action_name.to_glib_none().0,
);
from_glib_none(ret)
Expand All @@ -267,10 +243,7 @@ impl<T: ActionGroupImpl> ActionGroupImplExt for T {
.get_action_state
.expect("no parent \"get_action_state\" implementation");
let ret = func(
self.instance()
.unsafe_cast_ref::<ActionGroup>()
.to_glib_none()
.0,
self.obj().unsafe_cast_ref::<ActionGroup>().to_glib_none().0,
action_name.to_glib_none().0,
);
from_glib_none(ret)
Expand All @@ -287,10 +260,7 @@ impl<T: ActionGroupImpl> ActionGroupImplExt for T {
.get_action_state_hint
.expect("no parent \"get_action_state_hint\" implementation");
let ret = func(
self.instance()
.unsafe_cast_ref::<ActionGroup>()
.to_glib_none()
.0,
self.obj().unsafe_cast_ref::<ActionGroup>().to_glib_none().0,
action_name.to_glib_none().0,
);
from_glib_none(ret)
Expand All @@ -307,10 +277,7 @@ impl<T: ActionGroupImpl> ActionGroupImplExt for T {
.get_action_state_type
.expect("no parent \"get_action_state_type\" implementation");
let ret = func(
self.instance()
.unsafe_cast_ref::<ActionGroup>()
.to_glib_none()
.0,
self.obj().unsafe_cast_ref::<ActionGroup>().to_glib_none().0,
action_name.to_glib_none().0,
);
from_glib_none(ret)
Expand All @@ -327,10 +294,7 @@ impl<T: ActionGroupImpl> ActionGroupImplExt for T {
.has_action
.expect("no parent \"has_action\" implementation");
let ret = func(
self.instance()
.unsafe_cast_ref::<ActionGroup>()
.to_glib_none()
.0,
self.obj().unsafe_cast_ref::<ActionGroup>().to_glib_none().0,
action_name.to_glib_none().0,
);
from_glib(ret)
Expand All @@ -346,12 +310,7 @@ impl<T: ActionGroupImpl> ActionGroupImplExt for T {
let func = (*parent_iface)
.list_actions
.expect("no parent \"list_actions\" implementation");
let ret = func(
self.instance()
.unsafe_cast_ref::<ActionGroup>()
.to_glib_none()
.0,
);
let ret = func(self.obj().unsafe_cast_ref::<ActionGroup>().to_glib_none().0);
FromGlibPtrContainer::from_glib_none(ret)
}
}
Expand Down Expand Up @@ -382,10 +341,7 @@ impl<T: ActionGroupImpl> ActionGroupImplExt for T {
let mut state = ptr::null_mut();

let ret: bool = from_glib(func(
self.instance()
.unsafe_cast_ref::<ActionGroup>()
.to_glib_none()
.0,
self.obj().unsafe_cast_ref::<ActionGroup>().to_glib_none().0,
action_name.to_glib_none().0,
enabled.as_mut_ptr(),
&mut parameter_type,
Expand Down Expand Up @@ -502,7 +458,7 @@ unsafe extern "C" fn action_group_get_action_state_type<T: ActionGroupImpl>(
let ret = imp.action_state_type(&action_name);

if let Some(state_type) = ret {
let instance = imp.instance();
let instance = imp.obj();
let state_type = state_type.to_glib_full();
instance.set_qdata(
*ACTION_GROUP_GET_ACTION_STATE_TYPE_QUARK,
Expand All @@ -527,7 +483,7 @@ unsafe extern "C" fn action_group_get_action_state_hint<T: ActionGroupImpl>(

let ret = imp.action_state_hint(&action_name);
if let Some(state_hint) = ret {
let instance = imp.instance();
let instance = imp.obj();
let state_hint_ptr = state_hint.to_glib_full();
instance.set_qdata(
*ACTION_GROUP_GET_ACTION_STATE_HINT_QUARK,
Expand All @@ -551,7 +507,7 @@ unsafe extern "C" fn action_group_get_action_state<T: ActionGroupImpl>(

let ret = imp.action_state(&action_name);
if let Some(state) = ret {
let instance = imp.instance();
let instance = imp.obj();
let state_ptr = state.to_glib_full();
instance.set_qdata(
*ACTION_GROUP_GET_ACTION_STATE_QUARK,
Expand Down Expand Up @@ -648,7 +604,7 @@ unsafe extern "C" fn action_group_list_actions<T: ActionGroupImpl>(
let actions = imp.list_actions();

{
let instance = imp.instance();
let instance = imp.obj();
let actionsptr = actions.to_glib_full();
instance.set_qdata(*ACTION_GROUP_LIST_ACTIONS_QUARK, actionsptr);
actionsptr
Expand Down Expand Up @@ -682,7 +638,7 @@ unsafe extern "C" fn action_group_query_action<T: ActionGroupImpl>(

let ret = imp.query_action(&action_name);
if let Some((rs_enabled, rs_parameter_type, rs_state_type, rs_state_hint, rs_state)) = ret {
let instance = imp.instance();
let instance = imp.obj();

if !enabled.is_null() {
*enabled = rs_enabled.into_glib();
Expand Down
17 changes: 4 additions & 13 deletions gio/src/subclass/action_map.rs
Expand Up @@ -30,10 +30,7 @@ impl<T: ActionMapImpl> ActionMapImplExt for T {
.lookup_action
.expect("no parent \"lookup_action\" implementation");
let ret = func(
self.instance()
.unsafe_cast_ref::<ActionMap>()
.to_glib_none()
.0,
self.obj().unsafe_cast_ref::<ActionMap>().to_glib_none().0,
name.to_glib_none().0,
);
from_glib_none(ret)
Expand All @@ -50,10 +47,7 @@ impl<T: ActionMapImpl> ActionMapImplExt for T {
.add_action
.expect("no parent \"add_action\" implementation");
func(
self.instance()
.unsafe_cast_ref::<ActionMap>()
.to_glib_none()
.0,
self.obj().unsafe_cast_ref::<ActionMap>().to_glib_none().0,
action.to_glib_none().0,
);
}
Expand All @@ -69,10 +63,7 @@ impl<T: ActionMapImpl> ActionMapImplExt for T {
.remove_action
.expect("no parent \"remove_action\" implementation");
func(
self.instance()
.unsafe_cast_ref::<ActionMap>()
.to_glib_none()
.0,
self.obj().unsafe_cast_ref::<ActionMap>().to_glib_none().0,
action_name.to_glib_none().0,
);
}
Expand Down Expand Up @@ -105,7 +96,7 @@ unsafe extern "C" fn action_map_lookup_action<T: ActionMapImpl>(

let ret = imp.lookup_action(&action_name);
if let Some(action) = ret {
let instance = imp.instance();
let instance = imp.obj();
let actionptr = action.to_glib_none().0;

let mut map = instance
Expand Down