# HG changeset patch # User Sadrul Habib Chowdhury # Date 1185827044 0 # Node ID bfa12b00f54b6174a416cc5fa88c636b48c0e7dd # Parent 401c53d7702cc1f59eb7c5533f161c15f5e80b5c Export gnt_widget_get_size for pygnt. I tried to export _register_action, but it doesn't work. diff -r 401c53d7702c -r bfa12b00f54b finch/libgnt/pygnt/Makefile.am --- a/finch/libgnt/pygnt/Makefile.am Sun Jul 29 19:00:49 2007 +0000 +++ b/finch/libgnt/pygnt/Makefile.am Mon Jul 30 20:24:04 2007 +0000 @@ -9,7 +9,8 @@ gnt.override \ gntbox.override \ gntfilesel.override \ - gnttree.override + gnttree.override \ + gntwidget.override gnt_la_SOURCES = gnt.c common.c common.h gntmodule.c diff -r 401c53d7702c -r bfa12b00f54b finch/libgnt/pygnt/gnt.override --- a/finch/libgnt/pygnt/gnt.override Sun Jul 29 19:00:49 2007 +0000 +++ b/finch/libgnt/pygnt/gnt.override Mon Jul 30 20:24:04 2007 +0000 @@ -32,6 +32,7 @@ gntbox.override gntfilesel.override gnttree.override + gntwidget.override %% modulename gnt %% @@ -92,4 +93,32 @@ return list; } +%% +override gnt_register_action +static GHashTable *actions; + + +static PyObject * +_wrap_gnt_register_action(PyGObject *self, PyObject *args, PyObject *kwargs) +{ + static char *kwlist[] = {"name", "callback", NULL}; + PyGObject *callback; + GClosure *closure; + char *name; + + if (!PyArg_ParseTuple(args, "sO:gnt.gnt_register_action", &name, &callback)) { + return NULL; + } + + if (!PyCallable_Check(callback)) { + PyErr_SetString(PyExc_TypeError, "the callback must be callable ... doh!"); + return NULL; + } + + gnt_register_action(name, callback->obj); + + Py_INCREF(Py_None); + return Py_None; +} + diff -r 401c53d7702c -r bfa12b00f54b finch/libgnt/pygnt/gntwidget.override --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/finch/libgnt/pygnt/gntwidget.override Mon Jul 30 20:24:04 2007 +0000 @@ -0,0 +1,36 @@ +/** + * pygnt- Python bindings for the GNT toolkit. + * Copyright (C) 2007 Sadrul Habib Chowdhury + * + * gntwidget.override: overrides for generic widgets. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA + */ +%% +override gnt_widget_get_size args +static PyObject * +_wrap_gnt_widget_get_size(PyGObject *self) +{ + PyObject *list = PyList_New(0); + int x = 0, y = 0; + + gnt_widget_get_size(GNT_WIDGET(self->obj), &x, &y); + PyList_Append(list, PyInt_FromLong((long)x)); + PyList_Append(list, PyInt_FromLong((long)y)); + + return list; +} +