[pygobject] GVariant has now a GType, take that into account
- From: John Palmieri <johnp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject] GVariant has now a GType, take that into account
- Date: Wed, 8 Jun 2011 02:55:57 +0000 (UTC)
commit fe386a0ad548a23e30e9cb947bfa2198fb48ef29
Author: Tomeu Vizoso <tomeu vizoso collabora co uk>
Date: Mon Jun 6 19:07:22 2011 +0200
GVariant has now a GType, take that into account
https://bugzilla.gnome.org/show_bug.cgi?id=647509
gi/pygi-argument.c | 8 ++++----
gi/pygi-invoke.c | 20 +++++++++++++-------
2 files changed, 17 insertions(+), 11 deletions(-)
---
diff --git a/gi/pygi-argument.c b/gi/pygi-argument.c
index d2be476..2f14a94 100644
--- a/gi/pygi-argument.c
+++ b/gi/pygi-argument.c
@@ -1084,15 +1084,15 @@ array_success:
}
arg.v_pointer = closure;
+ } else if (g_struct_info_is_foreign (info)) {
+ PyObject *result;
+ result = pygi_struct_foreign_convert_to_g_argument (
+ object, info, transfer, &arg);
} else if (g_type_is_a (type, G_TYPE_BOXED)) {
arg.v_pointer = pyg_boxed_get (object, void);
if (transfer == GI_TRANSFER_EVERYTHING) {
arg.v_pointer = g_boxed_copy (type, arg.v_pointer);
}
- } else if ( (type == G_TYPE_NONE) && (g_struct_info_is_foreign (info))) {
- PyObject *result;
- result = pygi_struct_foreign_convert_to_g_argument (
- object, info, transfer, &arg);
} else if (g_type_is_a (type, G_TYPE_POINTER) || type == G_TYPE_NONE) {
g_warn_if_fail (!g_type_info_is_pointer (type_info) || transfer == GI_TRANSFER_NOTHING);
arg.v_pointer = pyg_pointer_get (object, void);
diff --git a/gi/pygi-invoke.c b/gi/pygi-invoke.c
index b474567..4f3fda2 100644
--- a/gi/pygi-invoke.c
+++ b/gi/pygi-invoke.c
@@ -378,9 +378,7 @@ _prepare_invocation_state (struct invocation_state *state,
/* if caller allocates only use one level of indirection */
state->out_args[out_args_pos].v_pointer = NULL;
state->args[i] = &state->out_args[out_args_pos];
- if (g_type_is_a (g_registered_type_info_get_g_type (info), G_TYPE_BOXED)) {
- state->args[i]->v_pointer = _pygi_boxed_alloc (info, NULL);
- } else if (g_struct_info_is_foreign((GIStructInfo *) info) ) {
+ if (g_struct_info_is_foreign((GIStructInfo *) info) ) {
PyObject *foreign_struct =
pygi_struct_foreign_convert_from_g_argument(info, NULL);
@@ -391,6 +389,8 @@ _prepare_invocation_state (struct invocation_state *state,
state->args[i]);
Py_DECREF(foreign_struct);
+ } else if (g_type_is_a (g_registered_type_info_get_g_type (info), G_TYPE_BOXED)) {
+ state->args[i]->v_pointer = _pygi_boxed_alloc (info, NULL);
} else {
gssize size = g_struct_info_get_size ( (GIStructInfo *) info);
state->args[i]->v_pointer = g_malloc0 (size);
@@ -457,6 +457,12 @@ _prepare_invocation_state (struct invocation_state *state,
if (g_type_is_a (type, G_TYPE_BOXED)) {
g_assert (state->n_in_args > 0);
state->in_args[0].v_pointer = pyg_boxed_get (py_arg, void);
+ } else if (g_struct_info_is_foreign (container_info)) {
+ PyObject *result;
+ result = pygi_struct_foreign_convert_to_g_argument (
+ py_arg, container_info,
+ GI_TRANSFER_NOTHING,
+ &state->in_args[0]);
} else if (g_type_is_a (type, G_TYPE_POINTER) || type == G_TYPE_NONE) {
g_assert (state->n_in_args > 0);
state->in_args[0].v_pointer = pyg_pointer_get (py_arg, void);
@@ -688,13 +694,13 @@ _process_invocation_state (struct invocation_state *state,
type = g_registered_type_info_get_g_type ( (GIRegisteredTypeInfo *) info);
- if (g_type_is_a (type, G_TYPE_BOXED)) {
- g_warn_if_fail (transfer == GI_TRANSFER_EVERYTHING);
- state->return_value = _pygi_boxed_new (py_type, state->return_arg.v_pointer, transfer == GI_TRANSFER_EVERYTHING);
- } else if (type == G_TYPE_NONE && g_struct_info_is_foreign (info)) {
+ if (g_struct_info_is_foreign (info)) {
state->return_value =
pygi_struct_foreign_convert_from_g_argument (
info, state->return_arg.v_pointer);
+ } else if (g_type_is_a (type, G_TYPE_BOXED)) {
+ g_warn_if_fail (transfer == GI_TRANSFER_EVERYTHING);
+ state->return_value = _pygi_boxed_new (py_type, state->return_arg.v_pointer, transfer == GI_TRANSFER_EVERYTHING);
} else if (g_type_is_a (type, G_TYPE_POINTER) || type == G_TYPE_NONE) {
if (transfer != GI_TRANSFER_NOTHING)
g_warning ("Return argument in %s returns a struct "
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]