Renamed return_*Err macros
parent
3d305c7c09
commit
050552a817
|
@ -43,13 +43,13 @@ _wrap_moo_python_plugin_register (G_GNUC_UNUSED PyObject *self, PyObject *args)
|
|||
return NULL;
|
||||
|
||||
if (!PyType_Check (plugin_type))
|
||||
return_TypeErr ("argument must be a type");
|
||||
return_TypeError ("argument must be a type");
|
||||
|
||||
if (win_plugin_type && win_plugin_type != Py_None && !PyType_Check (win_plugin_type))
|
||||
return_TypeErr ("argument must be a type");
|
||||
return_TypeError ("argument must be a type");
|
||||
|
||||
if (doc_plugin_type && doc_plugin_type != Py_None && !PyType_Check (doc_plugin_type))
|
||||
return_TypeErr ("argument must be a type");
|
||||
return_TypeError ("argument must be a type");
|
||||
|
||||
if (win_plugin_type == Py_None)
|
||||
win_plugin_type = NULL;
|
||||
|
@ -251,7 +251,7 @@ _wrap_moo_text_search_forward (G_GNUC_UNUSED PyObject *self, PyObject *args)
|
|||
if (pyg_boxed_check (py_start, GTK_TYPE_TEXT_ITER))
|
||||
start = pyg_boxed_get (py_start, GtkTextIter);
|
||||
else
|
||||
return_TypeErr ("start should be a GtkTextIter");
|
||||
return_TypeError ("start should be a GtkTextIter");
|
||||
|
||||
if (pyg_flags_get_value (MOO_TYPE_TEXT_SEARCH_FLAGS, py_flags, &flags))
|
||||
return NULL;
|
||||
|
@ -259,7 +259,7 @@ _wrap_moo_text_search_forward (G_GNUC_UNUSED PyObject *self, PyObject *args)
|
|||
if (pyg_boxed_check(py_end, GTK_TYPE_TEXT_ITER))
|
||||
end = pyg_boxed_get(py_end, GtkTextIter);
|
||||
else if (py_end != Py_None)
|
||||
return_TypeErr ("end should be a GtkTextIter or None");
|
||||
return_TypeError ("end should be a GtkTextIter or None");
|
||||
|
||||
if (moo_text_search_forward (start, str, flags, &match_start, &match_end, end))
|
||||
{
|
||||
|
@ -290,7 +290,7 @@ _wrap_moo_text_search_backward (G_GNUC_UNUSED PyObject *self, PyObject *args)
|
|||
if (pyg_boxed_check (py_start, GTK_TYPE_TEXT_ITER))
|
||||
start = pyg_boxed_get (py_start, GtkTextIter);
|
||||
else
|
||||
return_TypeErr ("start should be a GtkTextIter");
|
||||
return_TypeError ("start should be a GtkTextIter");
|
||||
|
||||
if (pyg_flags_get_value (MOO_TYPE_TEXT_SEARCH_FLAGS, py_flags, &flags))
|
||||
return NULL;
|
||||
|
@ -298,7 +298,7 @@ _wrap_moo_text_search_backward (G_GNUC_UNUSED PyObject *self, PyObject *args)
|
|||
if (pyg_boxed_check(py_end, GTK_TYPE_TEXT_ITER))
|
||||
end = pyg_boxed_get(py_end, GtkTextIter);
|
||||
else if (py_end != Py_None)
|
||||
return_TypeErr ("end should be a GtkTextIter or None");
|
||||
return_TypeError ("end should be a GtkTextIter or None");
|
||||
|
||||
if (moo_text_search_backward (start, str, flags, &match_start, &match_end, end))
|
||||
{
|
||||
|
@ -322,7 +322,7 @@ _wrap_moo_edit_class_add_action (G_GNUC_UNUSED PyObject *self, PyObject *args)
|
|||
MooEditClass *klass;
|
||||
|
||||
if (PyTuple_GET_SIZE (args) < 3)
|
||||
return_TypeErr ("at least three arguments required");
|
||||
return_TypeError ("at least three arguments required");
|
||||
|
||||
py_type = PyTuple_GET_ITEM (args, 0);
|
||||
py_id = PyTuple_GET_ITEM (args, 1);
|
||||
|
@ -335,13 +335,13 @@ _wrap_moo_edit_class_add_action (G_GNUC_UNUSED PyObject *self, PyObject *args)
|
|||
return NULL;
|
||||
|
||||
if (!g_type_is_a (type, MOO_TYPE_EDIT))
|
||||
return_TypeErr ("type must be derived from MooEdit");
|
||||
return_TypeError ("type must be derived from MooEdit");
|
||||
|
||||
if (!g_type_is_a (action_type, MOO_TYPE_EDIT_ACTION))
|
||||
return_TypeErr ("action_type must be derived from MooEditAction");
|
||||
return_TypeError ("action_type must be derived from MooEditAction");
|
||||
|
||||
if (!PyString_Check (py_id))
|
||||
return_TypeErr ("id must be a string");
|
||||
return_TypeError ("id must be a string");
|
||||
|
||||
klass = g_type_class_ref (type);
|
||||
|
||||
|
@ -370,7 +370,7 @@ _wrap_moo_edit_class_remove_action (G_GNUC_UNUSED PyObject *self, PyObject *args
|
|||
return NULL;
|
||||
|
||||
if (!g_type_is_a (type, MOO_TYPE_EDIT))
|
||||
return_TypeErr ("type must be derived from MooEdit");
|
||||
return_TypeError ("type must be derived from MooEdit");
|
||||
|
||||
klass = g_type_class_ref (type);
|
||||
moo_edit_class_remove_action (klass, action_id);
|
||||
|
@ -413,7 +413,7 @@ _wrap_moo_edit_window_set_action_langs (G_GNUC_UNUSED PyObject *self, PyObject *
|
|||
Py_DECREF (py_langs);
|
||||
g_slist_foreach (langs, (GFunc) g_free, NULL);
|
||||
g_slist_free (langs);
|
||||
return_TypeErr ("langs must be a sequence of strings");
|
||||
return_TypeError ("langs must be a sequence of strings");
|
||||
}
|
||||
|
||||
lang_id = moo_lang_id_from_name (PyString_AS_STRING (lang));
|
||||
|
@ -472,7 +472,7 @@ _wrap_moo_plugin_call_method (PyGObject *self, PyObject *args)
|
|||
guint i;
|
||||
|
||||
if (!args || !PyTuple_GET_SIZE (args))
|
||||
return_TypeErr ("Plugin.call_method takes at least 1 argument");
|
||||
return_TypeError ("Plugin.call_method takes at least 1 argument");
|
||||
|
||||
name = PyString_AsString (PyTuple_GET_ITEM (args, 0));
|
||||
|
||||
|
|
|
@ -245,7 +245,7 @@ _wrap_moo_term_set_colors (PyGObject *self, PyObject *args)
|
|||
return NULL;
|
||||
|
||||
if (!PySequence_Check (py_colors))
|
||||
return_TypeErr ("colors must be a list or tuple");
|
||||
return_TypeError ("colors must be a list or tuple");
|
||||
|
||||
n_colors = PySequence_Size (py_colors);
|
||||
|
||||
|
@ -282,7 +282,7 @@ static int
|
|||
_wrap_moo_term_text_attr_tp_setattr (PyGBoxed *self, char *attr, PyObject *value)
|
||||
{
|
||||
if (!value)
|
||||
return_TypeErrInt ("can't delete attributes");
|
||||
return_TypeErrorInt ("can't delete attributes");
|
||||
|
||||
if (!strcmp (attr, "foreground") || !strcmp (attr, "background"))
|
||||
{
|
||||
|
@ -319,7 +319,7 @@ static int
|
|||
_wrap_moo_term_iter_tp_setattr (PyGBoxed *self, char *attr, PyObject *value)
|
||||
{
|
||||
if (!value)
|
||||
return_TypeErrInt ("can't delete attributes");
|
||||
return_TypeErrorInt ("can't delete attributes");
|
||||
|
||||
if (!strcmp (attr, "row") || !strcmp (attr, "col"))
|
||||
{
|
||||
|
@ -384,10 +384,10 @@ _wrap_moo_term_command_new (PyGBoxed *self, PyObject *args, PyObject *kwargs)
|
|||
return -1;
|
||||
|
||||
if (!argv || !cmd_line)
|
||||
return_ValueErrInt ("Term.__init__: either argv or cmd_line must be given");
|
||||
return_ValueErrorInt ("Term.__init__: either argv or cmd_line must be given");
|
||||
|
||||
if (argv && cmd_line)
|
||||
return_ValueErrInt ("Term.__init__: only one of argv or cmd_line may be given");
|
||||
return_ValueErrorInt ("Term.__init__: only one of argv or cmd_line may be given");
|
||||
|
||||
self->gtype = MOO_TYPE_TERM_COMMAND;
|
||||
self->free_on_dealloc = FALSE;
|
||||
|
@ -398,7 +398,7 @@ _wrap_moo_term_command_new (PyGBoxed *self, PyObject *args, PyObject *kwargs)
|
|||
self->boxed = moo_term_command_new_command_line (cmd_line, working_dir, envp);
|
||||
|
||||
if (!self->boxed)
|
||||
return_RuntimeErrInt ("could not create MooTermCommand object");
|
||||
return_RuntimeErrorInt ("could not create MooTermCommand object");
|
||||
|
||||
self->free_on_dealloc = TRUE;
|
||||
return 0;
|
||||
|
|
|
@ -31,7 +31,7 @@ static PyObject *
|
|||
pyobj_from_gval (const GValue *value)
|
||||
{
|
||||
if (!G_VALUE_HOLDS (value, MOO_TYPE_PY_OBJECT))
|
||||
return_RuntimeErr ("invalid value passed");
|
||||
return_RuntimeError ("invalid value passed");
|
||||
return moo_py_object_ref (g_value_get_boxed (value));
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@ static int
|
|||
gval_from_pyobj (GValue *value, PyObject *obj)
|
||||
{
|
||||
if (!G_VALUE_HOLDS (value, MOO_TYPE_PY_OBJECT))
|
||||
return_RuntimeErrInt ("invalid value passed");
|
||||
return_RuntimeErrorInt ("invalid value passed");
|
||||
g_value_set_boxed (value, obj);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -122,7 +122,7 @@ _wrap_moo_window_class_add_action (G_GNUC_UNUSED PyObject *self, PyObject *args)
|
|||
extra = PyTuple_GET_SIZE (args) - 3;
|
||||
|
||||
if (extra < 0)
|
||||
return_TypeErr ("at least three arguments required");
|
||||
return_TypeError ("at least three arguments required");
|
||||
|
||||
py_type = PyTuple_GET_ITEM (args, 0);
|
||||
py_id = PyTuple_GET_ITEM (args, 1);
|
||||
|
@ -134,13 +134,13 @@ _wrap_moo_window_class_add_action (G_GNUC_UNUSED PyObject *self, PyObject *args)
|
|||
return NULL;
|
||||
|
||||
if (!g_type_is_a (type, MOO_TYPE_WINDOW))
|
||||
return_TypeErr ("type must be derived from MooWindow");
|
||||
return_TypeError ("type must be derived from MooWindow");
|
||||
|
||||
if (!PyString_Check (py_id))
|
||||
return_TypeErr ("id must be a string");
|
||||
return_TypeError ("id must be a string");
|
||||
|
||||
if (!PyCallable_Check (py_factory_func))
|
||||
return_TypeErr ("factory_func must be callable");
|
||||
return_TypeError ("factory_func must be callable");
|
||||
|
||||
klass = g_type_class_ref (type);
|
||||
|
||||
|
@ -184,7 +184,7 @@ _wrap_moo_window_class_remove_action (G_GNUC_UNUSED PyObject *self, PyObject *ar
|
|||
return NULL;
|
||||
|
||||
if (!g_type_is_a (type, MOO_TYPE_WINDOW))
|
||||
return_TypeErr ("type must be derived from MooWindow");
|
||||
return_TypeError ("type must be derived from MooWindow");
|
||||
|
||||
klass = g_type_class_ref (type);
|
||||
moo_window_class_remove_action (klass, action_id);
|
||||
|
@ -233,12 +233,12 @@ _wrap_moo_closure_new (G_GNUC_UNUSED PyObject *self, PyObject *args)
|
|||
MooPyClosure *closure;
|
||||
|
||||
if (!args)
|
||||
return_TypeErr ("function argument required");
|
||||
return_TypeError ("function argument required");
|
||||
|
||||
py_func = PyTuple_GET_ITEM (args, 0);
|
||||
|
||||
if (!PyCallable_Check (py_func))
|
||||
return_TypeErr ("function must be callable");
|
||||
return_TypeError ("function must be callable");
|
||||
|
||||
if (PyTuple_GET_SIZE (args) > 1)
|
||||
{
|
||||
|
@ -345,23 +345,23 @@ _wrap_moo_prefs_notify_connect (G_GNUC_UNUSED PyObject *self, PyObject *args)
|
|||
guint id;
|
||||
|
||||
if (!args)
|
||||
return_TypeErr ("arguments required");
|
||||
return_TypeError ("arguments required");
|
||||
|
||||
if (PyTuple_GET_SIZE (args) < 3)
|
||||
return_TypeErr ("three arguments required");
|
||||
return_TypeError ("three arguments required");
|
||||
|
||||
py_pattern = PyTuple_GET_ITEM (args, 0);
|
||||
py_match_type = PyTuple_GET_ITEM (args, 1);
|
||||
py_func = PyTuple_GET_ITEM (args, 2);
|
||||
|
||||
if (!PyString_Check (py_pattern))
|
||||
return_TypeErr ("pattern must be a string");
|
||||
return_TypeError ("pattern must be a string");
|
||||
|
||||
if (!PyInt_Check (py_match_type))
|
||||
return_TypeErr ("match_type must be an integer");
|
||||
return_TypeError ("match_type must be an integer");
|
||||
|
||||
if (!PyCallable_Check (py_func))
|
||||
return_TypeErr ("function must be callable");
|
||||
return_TypeError ("function must be callable");
|
||||
|
||||
if (PyTuple_GET_SIZE (args) > 1)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue