[pygobject] Remove pyg_type_from_name() and use GType.from_name() instead
- From: Christoph Reiter <creiter src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject] Remove pyg_type_from_name() and use GType.from_name() instead
- Date: Thu, 22 Mar 2018 07:04:45 +0000 (UTC)
commit d72902981623a149ba93e8a27272008ff176be17
Author: Christoph Reiter <reiter christoph gmail com>
Date: Wed Mar 21 10:47:47 2018 +0100
Remove pyg_type_from_name() and use GType.from_name() instead
gi/_constants.py | 48 ++++++++++++++++++++++++------------------------
gi/gimodule.c | 1 -
gi/gobjectmodule.c | 25 -------------------------
gi/gobjectmodule.h | 1 -
4 files changed, 24 insertions(+), 51 deletions(-)
---
diff --git a/gi/_constants.py b/gi/_constants.py
index 2153f90a..6fca96b8 100644
--- a/gi/_constants.py
+++ b/gi/_constants.py
@@ -20,28 +20,28 @@
from . import _gi
TYPE_INVALID = _gi.TYPE_INVALID
-TYPE_NONE = _gi.type_from_name('void')
-TYPE_INTERFACE = _gi.type_from_name('GInterface')
-TYPE_CHAR = _gi.type_from_name('gchar')
-TYPE_UCHAR = _gi.type_from_name('guchar')
-TYPE_BOOLEAN = _gi.type_from_name('gboolean')
-TYPE_INT = _gi.type_from_name('gint')
-TYPE_UINT = _gi.type_from_name('guint')
-TYPE_LONG = _gi.type_from_name('glong')
-TYPE_ULONG = _gi.type_from_name('gulong')
-TYPE_INT64 = _gi.type_from_name('gint64')
-TYPE_UINT64 = _gi.type_from_name('guint64')
-TYPE_ENUM = _gi.type_from_name('GEnum')
-TYPE_FLAGS = _gi.type_from_name('GFlags')
-TYPE_FLOAT = _gi.type_from_name('gfloat')
-TYPE_DOUBLE = _gi.type_from_name('gdouble')
-TYPE_STRING = _gi.type_from_name('gchararray')
-TYPE_POINTER = _gi.type_from_name('gpointer')
-TYPE_BOXED = _gi.type_from_name('GBoxed')
-TYPE_PARAM = _gi.type_from_name('GParam')
-TYPE_OBJECT = _gi.type_from_name('GObject')
-TYPE_PYOBJECT = _gi.type_from_name('PyObject')
-TYPE_GTYPE = _gi.type_from_name('GType')
-TYPE_STRV = _gi.type_from_name('GStrv')
-TYPE_VARIANT = _gi.type_from_name('GVariant')
+TYPE_NONE = _gi.GType.from_name('void')
+TYPE_INTERFACE = _gi.GType.from_name('GInterface')
+TYPE_CHAR = _gi.GType.from_name('gchar')
+TYPE_UCHAR = _gi.GType.from_name('guchar')
+TYPE_BOOLEAN = _gi.GType.from_name('gboolean')
+TYPE_INT = _gi.GType.from_name('gint')
+TYPE_UINT = _gi.GType.from_name('guint')
+TYPE_LONG = _gi.GType.from_name('glong')
+TYPE_ULONG = _gi.GType.from_name('gulong')
+TYPE_INT64 = _gi.GType.from_name('gint64')
+TYPE_UINT64 = _gi.GType.from_name('guint64')
+TYPE_ENUM = _gi.GType.from_name('GEnum')
+TYPE_FLAGS = _gi.GType.from_name('GFlags')
+TYPE_FLOAT = _gi.GType.from_name('gfloat')
+TYPE_DOUBLE = _gi.GType.from_name('gdouble')
+TYPE_STRING = _gi.GType.from_name('gchararray')
+TYPE_POINTER = _gi.GType.from_name('gpointer')
+TYPE_BOXED = _gi.GType.from_name('GBoxed')
+TYPE_PARAM = _gi.GType.from_name('GParam')
+TYPE_OBJECT = _gi.GType.from_name('GObject')
+TYPE_PYOBJECT = _gi.GType.from_name('PyObject')
+TYPE_GTYPE = _gi.GType.from_name('GType')
+TYPE_STRV = _gi.GType.from_name('GStrv')
+TYPE_VARIANT = _gi.GType.from_name('GVariant')
TYPE_UNICHAR = TYPE_UINT
diff --git a/gi/gimodule.c b/gi/gimodule.c
index 7a456b82..013a2101 100644
--- a/gi/gimodule.c
+++ b/gi/gimodule.c
@@ -642,7 +642,6 @@ static PyMethodDef _gi_functions[] = {
"Execute a child program asynchronously within a glib.MainLoop()\n"
"See the reference manual for a complete reference.\n" },
{ "type_name", pyg_type_name, METH_VARARGS },
- { "type_from_name", pyg_type_from_name, METH_VARARGS },
{ "type_register", _wrap_pyg_type_register, METH_VARARGS },
{ "signal_new", pyg_signal_new, METH_VARARGS },
{ "list_properties",
diff --git a/gi/gobjectmodule.c b/gi/gobjectmodule.c
index c872b33b..63c2645c 100644
--- a/gi/gobjectmodule.c
+++ b/gi/gobjectmodule.c
@@ -113,31 +113,6 @@ pyg_type_name (PyObject *self, PyObject *args)
return NULL;
}
-PyObject *
-pyg_type_from_name (PyObject *self, PyObject *args)
-{
- const gchar *name;
- GType type;
- PyObject *repr = NULL;
-#if 0
- if (PyErr_Warn(PyExc_DeprecationWarning,
- "gobject.type_from_name is deprecated; "
- "use GType.from_name instead"))
- return NULL;
-#endif
- if (!PyArg_ParseTuple(args, "s:gobject.type_from_name", &name))
- return NULL;
- type = g_type_from_name(name);
- if (type != 0)
- return pyg_type_wrapper_new(type);
- repr = PyObject_Repr((PyObject*)self);
- PyErr_Format(PyExc_RuntimeError, "%s: unknown type name: %s",
- PYGLIB_PyUnicode_AsString(repr),
- name);
- Py_DECREF(repr);
- return NULL;
-}
-
static void
pyg_object_set_property (GObject *object, guint property_id,
const GValue *value, GParamSpec *pspec)
diff --git a/gi/gobjectmodule.h b/gi/gobjectmodule.h
index 042b6aaa..873a1592 100644
--- a/gi/gobjectmodule.h
+++ b/gi/gobjectmodule.h
@@ -14,7 +14,6 @@ void pygobject_register_version_tuples (PyObject *d);
void pygobject_register_warnings (PyObject *d);
PyObject * pyg_type_name (PyObject *self, PyObject *args);
-PyObject * pyg_type_from_name (PyObject *self, PyObject *args);
PyObject * _wrap_pyg_type_register (PyObject *self, PyObject *args);
PyObject * pyg_signal_new (PyObject *self, PyObject *args);
PyObject * pyg_object_class_list_properties (PyObject *self, PyObject *args);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]