/* -*- Mode: C; c-basic-offset: 4 -*- * pygobject - Python bindings for GObject * Copyright (C) 2008 Gian Mario Tagliaretti * * gfileattribute.override: module overrides for GFileAttribute* * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA */ %% headers extern PyTypeObject PyGFileAttributeInfo_Type; typedef struct { PyObject_HEAD const GFileAttributeInfo *info; } PyGFileAttributeInfo; static PyObject * pygio_file_attribute_info_tp_new(PyTypeObject *type) { PyGFileAttributeInfo *self; GFileAttributeInfo *info = NULL; self = (PyGFileAttributeInfo *) PyObject_NEW(PyGFileAttributeInfo, &PyGFileAttributeInfo_Type); self->info = info; return (PyObject *) self; } static PyMethodDef pyg_file_attribute_info_methods[] = { { NULL, 0, 0 } }; static PyObject * pyg_file_attribute_info__get_name(PyObject *self, void *closure) { const gchar *ret; ret = ((PyGFileAttributeInfo*)self)->info->name; if (ret) return _PyUnicode_FromString(ret); Py_INCREF(Py_None); return Py_None; } static PyObject * pyg_file_attribute_info__get_type(PyObject *self, void *closure) { gint ret; ret = ((PyGFileAttributeInfo*)self)->info->type; return pyg_enum_from_gtype(G_TYPE_FILE_ATTRIBUTE_TYPE, ret); } static PyObject * pyg_file_attribute_info__get_flags(PyObject *self, void *closure) { guint ret; ret = ((PyGFileAttributeInfo*)self)->info->flags; return pyg_flags_from_gtype(G_TYPE_FILE_ATTRIBUTE_INFO_FLAGS, ret); } static const PyGetSetDef pyg_file_attribute_info_getsets[] = { { "name", (getter)pyg_file_attribute_info__get_name, (setter)0 }, { "type", (getter)pyg_file_attribute_info__get_type, (setter)0 }, { "flags", (getter)pyg_file_attribute_info__get_flags, (setter)0 }, { NULL, (getter)0, (setter)0 }, }; PyTypeObject PyGFileAttributeInfo_Type = { PyVarObject_HEAD_INIT(NULL, 0) "gio.FileAttributeInfo", /* tp_name */ sizeof(PyGFileAttributeInfo), /* tp_basicsize */ 0, /* tp_itemsize */ /* methods */ (destructor)0, /* tp_dealloc */ (printfunc)0, /* tp_print */ (getattrfunc)0, /* tp_getattr */ (setattrfunc)0, /* tp_setattr */ NULL, /* tp_compare */ (reprfunc)0, /* tp_repr */ 0, /* tp_as_number */ 0, /* tp_as_sequence */ 0, /* tp_as_mapping */ (hashfunc)0, /* tp_hash */ (ternaryfunc)0, /* tp_call */ (reprfunc)0, /* tp_str */ (getattrofunc)0, /* tp_getattro */ (setattrofunc)0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT, /* tp_flags */ "Holds information about an attribute", /* Documentation string */ (traverseproc)0, /* tp_traverse */ (inquiry)0, /* tp_clear */ (richcmpfunc)0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ (getiterfunc)0, /* tp_iter */ (iternextfunc)0, /* tp_iternext */ (struct PyMethodDef*)pyg_file_attribute_info_methods, /* tp_methods */ 0, /* tp_members */ (struct PyGetSetDef*)pyg_file_attribute_info_getsets, /* tp_getset */ (PyTypeObject *)0, /* tp_base */ (PyObject *)0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ (initproc)0, /* tp_init */ 0, /* tp_alloc */ (newfunc)pygio_file_attribute_info_tp_new, /* tp_new */ 0, /* tp_free */ (inquiry)0, /* tp_is_gc */ (PyObject *)0, /* tp_bases */ }; PyObject* pyg_file_attribute_info_new(const GFileAttributeInfo *info) { PyGFileAttributeInfo *self; self = (PyGFileAttributeInfo *)PyObject_NEW(PyGFileAttributeInfo, &PyGFileAttributeInfo_Type); if (G_UNLIKELY(self == NULL)) return NULL; if (info) self->info = info; return (PyObject *)self; } %% init if (PyType_Ready(&PyGFileAttributeInfo_Type) < 0) { g_return_if_reached(); } if (PyDict_SetItemString(d, "FileAttributeInfo", (PyObject *)&PyGFileAttributeInfo_Type) < 0) { g_return_if_reached(); }