diff options
author | Marco Pesenti Gritti <marco@localhost.localdomain> | 2006-10-12 13:49:11 (GMT) |
---|---|---|
committer | Marco Pesenti Gritti <marco@localhost.localdomain> | 2006-10-12 13:49:11 (GMT) |
commit | 3cfa9c40bd2d79e740cd511c2f23054a76917bfb (patch) | |
tree | 894e6eaf6a686b4f7dccee8c80e480df00926636 /lib/python | |
parent | 62a46ff92b234d07437f9f36efea576996eb84e2 (diff) |
First go at progress in the entry.
Diffstat (limited to 'lib/python')
-rw-r--r-- | lib/python/Makefile.am | 1 | ||||
-rw-r--r-- | lib/python/_sugar.c | 72 | ||||
-rw-r--r-- | lib/python/_sugar.defs | 7 | ||||
-rw-r--r-- | lib/python/_sugar.override | 2 |
4 files changed, 79 insertions, 3 deletions
diff --git a/lib/python/Makefile.am b/lib/python/Makefile.am index eb6b85c..c687e9b 100644 --- a/lib/python/Makefile.am +++ b/lib/python/Makefile.am @@ -26,6 +26,7 @@ EXTRA_DIST = _sugar.override _sugar.defs .defs.c: (cd $(srcdir)\ && $(PYGTK_CODEGEN) \ + --register $(PYGTK_DEFSDIR)/gtk-types.defs \ --register $(GNOMEPYTHONEXTRAS_DEFSDIR)/gtkmozembed.defs \ --override $*.override \ --prefix py$* $*.defs) > gen-$*.c \ diff --git a/lib/python/_sugar.c b/lib/python/_sugar.c index 1938322..585cd0d 100644 --- a/lib/python/_sugar.c +++ b/lib/python/_sugar.c @@ -10,22 +10,26 @@ #include "pygobject.h" #include "gecko-browser.h" #include "sugar-key-grabber.h" +#include "sugar-address-entry.h" -#line 15 "_sugar.c" +#line 16 "_sugar.c" /* ---------- types from other modules ---------- */ static PyTypeObject *_PyGObject_Type; #define PyGObject_Type (*_PyGObject_Type) +static PyTypeObject *_PyGtkEntry_Type; +#define PyGtkEntry_Type (*_PyGtkEntry_Type) static PyTypeObject *_PyGtkMozEmbed_Type; #define PyGtkMozEmbed_Type (*_PyGtkMozEmbed_Type) /* ---------- forward type declarations ---------- */ PyTypeObject G_GNUC_INTERNAL PyGeckoBrowser_Type; +PyTypeObject G_GNUC_INTERNAL PySugarAddressEntry_Type; PyTypeObject G_GNUC_INTERNAL PySugarKeyGrabber_Type; -#line 29 "_sugar.c" +#line 33 "_sugar.c" @@ -216,6 +220,55 @@ __GeckoBrowser_class_init(gpointer gclass, PyTypeObject *pyclass) } +/* ----------- SugarAddressEntry ----------- */ + +PyTypeObject G_GNUC_INTERNAL PySugarAddressEntry_Type = { + PyObject_HEAD_INIT(NULL) + 0, /* ob_size */ + "gecko.AddressEntry", /* tp_name */ + sizeof(PyGObject), /* tp_basicsize */ + 0, /* tp_itemsize */ + /* methods */ + (destructor)0, /* tp_dealloc */ + (printfunc)0, /* tp_print */ + (getattrfunc)0, /* tp_getattr */ + (setattrfunc)0, /* tp_setattr */ + (cmpfunc)0, /* tp_compare */ + (reprfunc)0, /* tp_repr */ + (PyNumberMethods*)0, /* tp_as_number */ + (PySequenceMethods*)0, /* tp_as_sequence */ + (PyMappingMethods*)0, /* tp_as_mapping */ + (hashfunc)0, /* tp_hash */ + (ternaryfunc)0, /* tp_call */ + (reprfunc)0, /* tp_str */ + (getattrofunc)0, /* tp_getattro */ + (setattrofunc)0, /* tp_setattro */ + (PyBufferProcs*)0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + NULL, /* Documentation string */ + (traverseproc)0, /* tp_traverse */ + (inquiry)0, /* tp_clear */ + (richcmpfunc)0, /* tp_richcompare */ + offsetof(PyGObject, weakreflist), /* tp_weaklistoffset */ + (getiterfunc)0, /* tp_iter */ + (iternextfunc)0, /* tp_iternext */ + (struct PyMethodDef*)NULL, /* tp_methods */ + (struct PyMemberDef*)0, /* tp_members */ + (struct PyGetSetDef*)0, /* tp_getset */ + NULL, /* tp_base */ + NULL, /* tp_dict */ + (descrgetfunc)0, /* tp_descr_get */ + (descrsetfunc)0, /* tp_descr_set */ + offsetof(PyGObject, inst_dict), /* tp_dictoffset */ + (initproc)0, /* tp_init */ + (allocfunc)0, /* tp_alloc */ + (newfunc)0, /* tp_new */ + (freefunc)0, /* tp_free */ + (inquiry)0 /* tp_is_gc */ +}; + + + /* ----------- SugarKeyGrabber ----------- */ static int @@ -354,12 +407,25 @@ py_sugar_register_classes(PyObject *d) "could not import gtkmozembed"); return ; } + if ((module = PyImport_ImportModule("gtk")) != NULL) { + _PyGtkEntry_Type = (PyTypeObject *)PyObject_GetAttrString(module, "Entry"); + if (_PyGtkEntry_Type == NULL) { + PyErr_SetString(PyExc_ImportError, + "cannot import name Entry from gtk"); + return ; + } + } else { + PyErr_SetString(PyExc_ImportError, + "could not import gtk"); + return ; + } -#line 360 "_sugar.c" +#line 425 "_sugar.c" pygobject_register_class(d, "GeckoBrowser", GECKO_TYPE_BROWSER, &PyGeckoBrowser_Type, Py_BuildValue("(O)", &PyGtkMozEmbed_Type)); pyg_set_object_has_new_constructor(GECKO_TYPE_BROWSER); pyg_register_class_init(GECKO_TYPE_BROWSER, __GeckoBrowser_class_init); + pygobject_register_class(d, "SugarAddressEntry", SUGAR_TYPE_ADDRESS_ENTRY, &PySugarAddressEntry_Type, Py_BuildValue("(O)", &PyGtkEntry_Type)); pygobject_register_class(d, "SugarKeyGrabber", SUGAR_TYPE_KEY_GRABBER, &PySugarKeyGrabber_Type, Py_BuildValue("(O)", &PyGObject_Type)); pyg_set_object_has_new_constructor(SUGAR_TYPE_KEY_GRABBER); } diff --git a/lib/python/_sugar.defs b/lib/python/_sugar.defs index 011bf71..bdf51a8 100644 --- a/lib/python/_sugar.defs +++ b/lib/python/_sugar.defs @@ -7,6 +7,13 @@ (gtype-id "GECKO_TYPE_BROWSER") ) +(define-object AddressEntry + (in-module "Sugar") + (parent "GtkEntry") + (c-name "SugarAddressEntry") + (gtype-id "SUGAR_TYPE_ADDRESS_ENTRY") +) + ;; Enumerations and flags ... diff --git a/lib/python/_sugar.override b/lib/python/_sugar.override index e439186..4f9b9d7 100644 --- a/lib/python/_sugar.override +++ b/lib/python/_sugar.override @@ -6,11 +6,13 @@ headers #include "pygobject.h" #include "gecko-browser.h" #include "sugar-key-grabber.h" +#include "sugar-address-entry.h" %% modulename gecko %% import gobject.GObject as PyGObject_Type +import gtk.Entry as PyGtkEntry_Type import gtkmozembed.MozEmbed as PyGtkMozEmbed_Type %% ignore-glob |