1 /* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */
3 * Copyright (c) 2010 Collabora Ltd. <http://www.collabora.co.uk/>
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the "Software"), to
7 * deal in the Software without restriction, including without limitation the
8 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
9 * sell copies of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24 #include "pygobject.h"
26 #include "pygi-private.h"
27 #include "pygi-foreign-gvariant.h"
30 g_variant_to_arg (PyObject *value,
31 GIInterfaceInfo *interface_info,
35 g_assert (transfer == GI_TRANSFER_NOTHING);
37 /* TODO check that value is a PyGPointer */
39 arg->v_pointer = (GVariant *) ( (PyGPointer *) value)->pointer;
44 g_variant_from_arg (GIInterfaceInfo *interface_info,
47 GVariant *variant = (GVariant *) data;
49 PyObject *type = _pygi_type_import_by_gi_info (interface_info);
51 g_variant_ref_sink (variant);
53 return _pygi_struct_new ( (PyTypeObject *) type, variant, FALSE);
57 g_variant_release_foreign (GIBaseInfo *base_info,
60 g_variant_unref ( (GVariant *) struct_);