Wrapped moo_get_data_dirs(), moo_get_data_subdirs(), moo_file_watch_monitor_*

master
Yevgen Muntyan 2006-06-17 00:54:35 -05:00
parent eb7132c9eb
commit 7bd0745ae8
2 changed files with 118 additions and 5 deletions

View File

@ -181,6 +181,18 @@
(release-func "moo_closure_unref")
)
(define-pointer FileWatchEvent
(in-module "Moo")
(c-name "MooFileWatchEvent")
(gtype-id "MOO_TYPE_FILE_WATCH_EVENT")
(fields
'("MooFileWatchEventCode" "code")
'("int" "monitor_id")
'("char*" "filename")
'("gpointer" "data")
)
)
;; Enumerations and flags ...
@ -557,11 +569,11 @@
(define-method monitor_directory
(of-object "MooFileWatch")
(c-name "moo_file_watch_monitor_directory")
(return-type "gboolean")
(return-type "int")
(parameters
'("const-char*" "filename")
'("gpointer" "data")
'("int*" "monitor_id")
'("GDestroyNotify" "data_notify")
'("GError**" "error")
)
)
@ -569,11 +581,11 @@
(define-method monitor_file
(of-object "MooFileWatch")
(c-name "moo_file_watch_monitor_file")
(return-type "gboolean")
(return-type "int")
(parameters
'("const-char*" "filename")
'("gpointer" "data")
'("int*" "monitor_id")
'("GDestroyNotify" "data_notify")
'("GError**" "error")
)
)
@ -2544,7 +2556,7 @@
(define-function get_data_dirs
(c-name "moo_get_data_dirs")
(return-type "char**")
(return-type "char*")
(parameters
'("MooDataDirType" "type")
'("guint*" "n_dirs")

View File

@ -416,3 +416,104 @@ _wrap_moo_file_dialog_get_filenames (PyGObject *self)
return ret;
}
%%
override moo_get_data_dirs varargs
static PyObject *
_wrap_moo_get_data_dirs (G_GNUC_UNUSED PyObject *self, PyObject *args)
{
int type;
PyObject *py_type = NULL;
PyObject *ret;
char **dirs;
guint n_dirs, i;
if (!PyArg_ParseTuple (args, (char*) "O:get_data_dirs", &py_type))
return NULL;
if (pyg_enum_get_value(MOO_TYPE_DATA_DIR_TYPE, py_type, &type))
return NULL;
dirs = moo_get_data_dirs (type, &n_dirs);
if (!dirs)
return_None;
ret = PyTuple_New (n_dirs);
g_return_val_if_fail (ret != NULL, NULL);
for (i = 0; i < n_dirs; ++i)
PyTuple_SET_ITEM (ret, i, PyString_FromString (dirs[i]));
g_strfreev (dirs);
return ret;
}
%%
override moo_get_data_subdirs varargs
static PyObject *
_wrap_moo_get_data_subdirs (G_GNUC_UNUSED PyObject *self, PyObject *args)
{
int type;
PyObject *py_type = NULL;
PyObject *ret;
char **dirs;
guint n_dirs, i;
char *subdir;
if (!PyArg_ParseTuple (args, (char*) "sO:get_data_dirs", &subdir, &py_type))
return NULL;
if (pyg_enum_get_value(MOO_TYPE_DATA_DIR_TYPE, py_type, &type))
return NULL;
dirs = moo_get_data_subdirs (subdir, type, &n_dirs);
if (!dirs)
return_None;
ret = PyTuple_New (n_dirs);
g_return_val_if_fail (ret != NULL, NULL);
for (i = 0; i < n_dirs; ++i)
PyTuple_SET_ITEM (ret, i, PyString_FromString (dirs[i]));
g_strfreev (dirs);
return ret;
}
%%
override moo_file_watch_monitor_directory kwargs
static PyObject *
_wrap_moo_file_watch_monitor_directory (PyGObject *self, PyObject *args, PyObject *kwargs)
{
static char *kwlist[] = { (char*) "filename", NULL };
char *filename;
int ret;
GError *error = NULL;
if (!PyArg_ParseTupleAndKeywords(args, kwargs,(char*) "s:MooFileWatch.monitor_directory", kwlist, &filename))
return NULL;
ret = moo_file_watch_monitor_directory (MOO_FILE_WATCH(self->obj), filename, NULL, &error);
if (pyg_error_check(&error))
return NULL;
return PyInt_FromLong (ret);
}
%%
override moo_file_watch_monitor_file kwargs
static PyObject *
_wrap_moo_file_watch_monitor_file (PyGObject *self, PyObject *args, PyObject *kwargs)
{
static char *kwlist[] = { (char*) "filename", NULL };
char *filename;
int ret;
GError *error = NULL;
if (!PyArg_ParseTupleAndKeywords(args, kwargs,(char*) "s:MooFileWatch.monitor_file", kwlist, &filename))
return NULL;
ret = moo_file_watch_monitor_file (MOO_FILE_WATCH (self->obj), filename, NULL, &error);
if (pyg_error_check(&error))
return NULL;
return PyInt_FromLong (ret);
}