summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohan Dahlin <johan@gnome.org>2008-07-21 17:51:32 +0000
committerJohan Dahlin <johan@src.gnome.org>2008-07-21 17:51:32 +0000
commit6594b6f890693c19dfeed20889b0db4c6217c31f (patch)
treee7242781cb780c8e864e3275265b1acfcb202edd
parentbf49647a03923975eb24ce634dae8254553db8de (diff)
downloadpygobject-6594b6f890693c19dfeed20889b0db4c6217c31f.tar.gz
Mark as static, rename from pyg_* -> pyglib_*. Fill in api struct, rename
2008-07-21 Johan Dahlin <johan@gnome.org> * glib/glibmodule.c (pyglib_idle_add), (pyglib_timeout_add), (pyglib_timeout_add_seconds), (pyglib_io_add_watch), (pyglib_source_remove), (pyglib_child_watch_add), (pyglib_markup_escape_text), (pyglib_get_current_time), (pyglib_main_depth), (pyglib_filename_display_name), (pyglib_filename_display_basename), (pyglib_filename_from_utf8), (pyglib_get_application_name), (pyglib_set_application_name), (pyglib_get_prgname), (pyglib_set_prgname), (pyglib_register_api), (pyglib_register_error): Mark as static, rename from pyg_* -> pyglib_*. Fill in api struct, rename struct and remove function suffix. svn path=/trunk/; revision=847
-rw-r--r--ChangeLog14
-rw-r--r--glib/glibmodule.c96
2 files changed, 61 insertions, 49 deletions
diff --git a/ChangeLog b/ChangeLog
index 0df01220..cd03916e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
2008-07-21 Johan Dahlin <johan@gnome.org>
+ * glib/glibmodule.c (pyglib_idle_add), (pyglib_timeout_add),
+ (pyglib_timeout_add_seconds), (pyglib_io_add_watch),
+ (pyglib_source_remove), (pyglib_child_watch_add),
+ (pyglib_markup_escape_text), (pyglib_get_current_time),
+ (pyglib_main_depth), (pyglib_filename_display_name),
+ (pyglib_filename_display_basename), (pyglib_filename_from_utf8),
+ (pyglib_get_application_name), (pyglib_set_application_name),
+ (pyglib_get_prgname), (pyglib_set_prgname), (pyglib_register_api),
+ (pyglib_register_error):
+ Mark as static, rename from pyg_* -> pyglib_*. Fill in api struct,
+ rename struct and remove function suffix.
+
+2008-07-21 Johan Dahlin <johan@gnome.org>
+
* glib/Makefile.am:
* glib/glibmodule.c (pyg_idle_add), (pyg_timeout_add),
(pyg_timeout_add_seconds), (pyg_io_add_watch),
diff --git a/glib/glibmodule.c b/glib/glibmodule.c
index 0281524d..42de2158 100644
--- a/glib/glibmodule.c
+++ b/glib/glibmodule.c
@@ -28,7 +28,6 @@
#include <Python.h>
#include <glib.h>
#include "pyglib.h"
-
#include "pyglib-private.h"
#include "pygiochannel.h"
#include "pygmaincontext.h"
@@ -43,6 +42,11 @@
/* ---------------- glib module functions -------------------- */
+struct _PyGChildData {
+ PyObject *func;
+ PyObject *data;
+};
+
static gint
get_handler_priority(gint *priority, PyObject *kwargs)
{
@@ -84,7 +88,7 @@ get_handler_priority(gint *priority, PyObject *kwargs)
}
static PyObject *
-pyg_idle_add(PyObject *self, PyObject *args, PyObject *kwargs)
+pyglib_idle_add(PyObject *self, PyObject *args, PyObject *kwargs)
{
PyObject *first, *callback, *cbargs = NULL, *data;
gint len, priority = G_PRIORITY_DEFAULT_IDLE;
@@ -123,7 +127,7 @@ pyg_idle_add(PyObject *self, PyObject *args, PyObject *kwargs)
static PyObject *
-pyg_timeout_add(PyObject *self, PyObject *args, PyObject *kwargs)
+pyglib_timeout_add(PyObject *self, PyObject *args, PyObject *kwargs)
{
PyObject *first, *callback, *cbargs = NULL, *data;
gint len, priority = G_PRIORITY_DEFAULT;
@@ -162,7 +166,7 @@ pyg_timeout_add(PyObject *self, PyObject *args, PyObject *kwargs)
}
static PyObject *
-pyg_timeout_add_seconds(PyObject *self, PyObject *args, PyObject *kwargs)
+pyglib_timeout_add_seconds(PyObject *self, PyObject *args, PyObject *kwargs)
{
PyObject *first, *callback, *cbargs = NULL, *data;
gint len, priority = G_PRIORITY_DEFAULT;
@@ -243,7 +247,7 @@ iowatch_marshal(GIOChannel *source,
}
static PyObject *
-pyg_io_add_watch(PyObject *self, PyObject *args, PyObject *kwargs)
+pyglib_io_add_watch(PyObject *self, PyObject *args, PyObject *kwargs)
{
PyObject *first, *pyfd, *callback, *cbargs = NULL, *data;
gint fd, priority = G_PRIORITY_DEFAULT, condition;
@@ -291,7 +295,7 @@ pyg_io_add_watch(PyObject *self, PyObject *args, PyObject *kwargs)
}
static PyObject *
-pyg_source_remove(PyObject *self, PyObject *args)
+pyglib_source_remove(PyObject *self, PyObject *args)
{
guint tag;
@@ -307,11 +311,6 @@ pyglib_main_context_default(PyObject *unused)
return pyglib_main_context_new(g_main_context_default());
}
-struct _PyGChildData {
- PyObject *func;
- PyObject *data;
-};
-
static void
child_watch_func(GPid pid, gint status, gpointer data)
{
@@ -345,7 +344,7 @@ child_watch_dnotify(gpointer data)
static PyObject *
-pyg_child_watch_add(PyObject *unused, PyObject *args, PyObject *kwargs)
+pyglib_child_watch_add(PyObject *unused, PyObject *args, PyObject *kwargs)
{
static char *kwlist[] = { "pid", "function", "data", "priority", NULL };
guint id;
@@ -376,7 +375,7 @@ pyg_child_watch_add(PyObject *unused, PyObject *args, PyObject *kwargs)
}
static PyObject *
-pyg_markup_escape_text(PyObject *unused, PyObject *args, PyObject *kwargs)
+pyglib_markup_escape_text(PyObject *unused, PyObject *args, PyObject *kwargs)
{
static char *kwlist[] = { "text", NULL };
char *text_in, *text_out;
@@ -395,7 +394,7 @@ pyg_markup_escape_text(PyObject *unused, PyObject *args, PyObject *kwargs)
}
static PyObject *
-pyg_get_current_time(PyObject *unused)
+pyglib_get_current_time(PyObject *unused)
{
GTimeVal timeval;
double ret;
@@ -406,13 +405,13 @@ pyg_get_current_time(PyObject *unused)
}
static PyObject *
-pyg_main_depth(PyObject *unused)
+pyglib_main_depth(PyObject *unused)
{
return PyInt_FromLong(g_main_depth());
}
static PyObject *
-pyg_filename_display_name(PyObject *self, PyObject *args)
+pyglib_filename_display_name(PyObject *self, PyObject *args)
{
PyObject *py_display_name;
char *filename, *display_name;
@@ -428,7 +427,7 @@ pyg_filename_display_name(PyObject *self, PyObject *args)
}
static PyObject *
-pyg_filename_display_basename(PyObject *self, PyObject *args)
+pyglib_filename_display_basename(PyObject *self, PyObject *args)
{
PyObject *py_display_basename;
char *filename, *display_basename;
@@ -444,7 +443,7 @@ pyg_filename_display_basename(PyObject *self, PyObject *args)
}
static PyObject *
-pyg_filename_from_utf8(PyObject *self, PyObject *args)
+pyglib_filename_from_utf8(PyObject *self, PyObject *args)
{
char *filename, *utf8string;
Py_ssize_t utf8string_len;
@@ -467,8 +466,8 @@ pyg_filename_from_utf8(PyObject *self, PyObject *args)
}
-PyObject*
-pyg_get_application_name(PyObject *self)
+static PyObject*
+pyglib_get_application_name(PyObject *self)
{
const char *name;
@@ -480,8 +479,8 @@ pyg_get_application_name(PyObject *self)
return PyString_FromString(name);
}
-PyObject*
-pyg_set_application_name(PyObject *self, PyObject *args)
+static PyObject*
+pyglib_set_application_name(PyObject *self, PyObject *args)
{
char *s;
@@ -492,8 +491,8 @@ pyg_set_application_name(PyObject *self, PyObject *args)
return Py_None;
}
-PyObject*
-pyg_get_prgname(PyObject *self)
+static PyObject*
+pyglib_get_prgname(PyObject *self)
{
char *name;
@@ -505,8 +504,8 @@ pyg_get_prgname(PyObject *self)
return PyString_FromString(name);
}
-PyObject*
-pyg_set_prgname(PyObject *self, PyObject *args)
+static PyObject*
+pyglib_set_prgname(PyObject *self, PyObject *args)
{
char *s;
@@ -523,49 +522,48 @@ static PyMethodDef pyglib_functions[] = {
(PyCFunction)pyglib_spawn_async, METH_VARARGS|METH_KEYWORDS },
{ "main_context_default",
(PyCFunction)pyglib_main_context_default, METH_NOARGS },
-
{ "idle_add",
- (PyCFunction)pyg_idle_add, METH_VARARGS|METH_KEYWORDS },
+ (PyCFunction)pyglib_idle_add, METH_VARARGS|METH_KEYWORDS },
{ "timeout_add",
- (PyCFunction)pyg_timeout_add, METH_VARARGS|METH_KEYWORDS },
+ (PyCFunction)pyglib_timeout_add, METH_VARARGS|METH_KEYWORDS },
{ "timeout_add_seconds",
- (PyCFunction)pyg_timeout_add_seconds, METH_VARARGS|METH_KEYWORDS },
+ (PyCFunction)pyglib_timeout_add_seconds, METH_VARARGS|METH_KEYWORDS },
{ "io_add_watch",
- (PyCFunction)pyg_io_add_watch, METH_VARARGS|METH_KEYWORDS },
+ (PyCFunction)pyglib_io_add_watch, METH_VARARGS|METH_KEYWORDS },
{ "source_remove",
- pyg_source_remove, METH_VARARGS },
+ (PyCFunction)pyglib_source_remove, METH_VARARGS },
{ "child_watch_add",
- (PyCFunction)pyg_child_watch_add, METH_VARARGS|METH_KEYWORDS },
+ (PyCFunction)pyglib_child_watch_add, METH_VARARGS|METH_KEYWORDS },
{ "markup_escape_text",
- (PyCFunction)pyg_markup_escape_text, METH_VARARGS|METH_KEYWORDS },
+ (PyCFunction)pyglib_markup_escape_text, METH_VARARGS|METH_KEYWORDS },
{ "get_current_time",
- (PyCFunction)pyg_get_current_time, METH_NOARGS },
+ (PyCFunction)pyglib_get_current_time, METH_NOARGS },
{ "filename_display_name",
- (PyCFunction)pyg_filename_display_name, METH_VARARGS },
+ (PyCFunction)pyglib_filename_display_name, METH_VARARGS },
{ "filename_display_basename",
- (PyCFunction)pyg_filename_display_basename, METH_VARARGS },
+ (PyCFunction)pyglib_filename_display_basename, METH_VARARGS },
{ "filename_from_utf8",
- (PyCFunction)pyg_filename_from_utf8, METH_VARARGS },
+ (PyCFunction)pyglib_filename_from_utf8, METH_VARARGS },
{ "get_application_name",
- (PyCFunction)pyg_get_application_name, METH_NOARGS },
+ (PyCFunction)pyglib_get_application_name, METH_NOARGS },
{ "set_application_name",
- (PyCFunction)pyg_set_application_name, METH_VARARGS },
+ (PyCFunction)pyglib_set_application_name, METH_VARARGS },
{ "get_prgname",
- (PyCFunction)pyg_get_prgname, METH_NOARGS },
+ (PyCFunction)pyglib_get_prgname, METH_NOARGS },
{ "set_prgname",
- (PyCFunction)pyg_set_prgname, METH_VARARGS },
+ (PyCFunction)pyglib_set_prgname, METH_VARARGS },
{ "main_depth",
- (PyCFunction)pyg_main_depth, METH_NOARGS },
-
-
+ (PyCFunction)pyglib_main_depth, METH_NOARGS },
{ NULL, NULL, 0 }
};
/* ----------------- glib module initialisation -------------- */
-struct _PyGLib_Functions pyglib_api_functions = {
+static struct _PyGLib_Functions pyglib_api = {
FALSE, /* threads_enabled */
- NULL /* gerror_exception */
+ NULL, /* gerror_exception */
+ NULL, /* block_threads */
+ NULL /* unblock_threads */
};
static void
@@ -575,7 +573,7 @@ pyglib_register_api(PyObject *d)
/* for addon libraries ... */
PyDict_SetItemString(d, "_PyGLib_API",
- o=PyCObject_FromVoidPtr(&pyglib_api_functions,NULL));
+ o=PyCObject_FromVoidPtr(&pyglib_api,NULL));
Py_DECREF(o);
pyglib_init_internal(o);
@@ -596,7 +594,7 @@ pyglib_register_error(PyObject *d)
Py_DECREF(dict);
PyDict_SetItemString(d, "GError", gerror_class);
- pyglib_api_functions.gerror_exception = gerror_class;
+ pyglib_api.gerror_exception = gerror_class;
}
static void