summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohan Dahlin <johan@src.gnome.org>2004-07-20 11:05:41 +0000
committerJohan Dahlin <johan@src.gnome.org>2004-07-20 11:05:41 +0000
commitd2c71ff53b42afec6bf4ebca3bcf801dce5cfbb2 (patch)
tree8e24537a5847c6c93a0ef7ae12b8cdb2076e1839
parent7a068035003772b1c393c072377ebc8acfb875ae (diff)
downloadpygobject-d2c71ff53b42afec6bf4ebca3bcf801dce5cfbb2.tar.gz
Simplify, fix name in exceptions and remove warning.
* gtk/gtk.override (_wrap_gtk_file_chooser_dialog_new): Simplify, fix name in exceptions and remove warning. * gobject/pygenum.c (pyg_enum_from_gtype): Fall back to int for unregistered enums. * gobject/pygflags.c (pyg_flags_from_gtype): Ditto * gobject/gobjectmodule.c (initgobject): Rename back to MainLoop, MainContext
-rw-r--r--gobject/gobjectmodule.c4
-rw-r--r--gobject/pygenum.c4
-rw-r--r--gobject/pygflags.c3
3 files changed, 7 insertions, 4 deletions
diff --git a/gobject/gobjectmodule.c b/gobject/gobjectmodule.c
index 9de16a5f..60272541 100644
--- a/gobject/gobjectmodule.c
+++ b/gobject/gobjectmodule.c
@@ -1843,8 +1843,8 @@ initgobject(void)
PyGFlags_Type.tp_base = &PyInt_Type;
REGISTER_GTYPE(d, PyGFlags_Type, "GFlags", G_TYPE_FLAGS);
- REGISTER_TYPE(d, PyGMainLoop_Type, "GMainLoop");
- REGISTER_TYPE(d, PyGMainContext_Type, "GMainContext");
+ REGISTER_TYPE(d, PyGMainLoop_Type, "MainLoop");
+ REGISTER_TYPE(d, PyGMainContext_Type, "MainContext");
/* glib version */
tuple = Py_BuildValue ("(iii)", glib_major_version, glib_minor_version,
diff --git a/gobject/pygenum.c b/gobject/pygenum.c
index 0ccbb90f..89f1616e 100644
--- a/gobject/pygenum.c
+++ b/gobject/pygenum.c
@@ -131,7 +131,9 @@ pyg_enum_from_gtype (GType gtype, int value)
g_return_val_if_fail(gtype != G_TYPE_INVALID, NULL);
pyclass = (PyObject*)g_type_get_qdata(gtype, pygenum_class_key);
- g_assert(pyclass != NULL);
+ /* Fall back to int */
+ if (pyclass == NULL)
+ return PyInt_FromLong(value);
values = PyDict_GetItemString(((PyTypeObject *)pyclass)->tp_dict,
"__enum_values__");
diff --git a/gobject/pygflags.c b/gobject/pygflags.c
index 24d44bee..d2108505 100644
--- a/gobject/pygflags.c
+++ b/gobject/pygflags.c
@@ -156,7 +156,8 @@ pyg_flags_from_gtype (GType gtype, int value)
g_return_val_if_fail(gtype != G_TYPE_INVALID, NULL);
pyclass = (PyObject*)g_type_get_qdata(gtype, pygflags_class_key);
- g_assert(pyclass != NULL);
+ if (pyclass == NULL)
+ return PyInt_FromLong(value);
values = PyDict_GetItemString(((PyTypeObject *)pyclass)->tp_dict,
"__flags_values__");