summaryrefslogtreecommitdiffstats
path: root/gobject/pygobject.h
Commit message (Collapse)AuthorAgeFilesLines
...
* Reworking of Arjan Molenaar's (arjanmolenaar@hetnet.nl) patch from bugPYGTK_1_99_11James Henstridge2002-07-091-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2002-07-09 James Henstridge <james@daa.com.au> Reworking of Arjan Molenaar's (arjanmolenaar@hetnet.nl) patch from bug 71435. * gtk/libglade.override (connect_one): watch the closure. (connect_many): watch the closure. * gtk/gtk.override (_wrap_gtk_toolbar_append_item): watch closure for signal. (_wrap_gtk_toolbar_prepend_item): same here. (_wrap_gtk_toolbar_insert_item): same here. (_wrap_gtk_toolbar_insert_stock): same here. (_wrap_gtk_toolbar_append_element): same here. (_wrap_gtk_toolbar_prepend_element): same here. (_wrap_gtk_toolbar_insert_element): same here. * pygobject.h (_PyGObject_Functions): add pygobject_watch_closure to the list of exported functions. * pygobject.c (pygobject_watch_closure): new function to watch a closure. We perform cyclic garbage collection on watched closures. The closure will automatically be unwatched when it gets invalidated. (pygobject_traverse): traverse watched closures as well. (pygobject_clear): invalidate all watched closures (pygobject_dealloc): invalidate watched closures on dealloc too. (PyGObject_Type): register the invalidate handler. (pygobject_connect): watch the closure we connect here. (pygobject_connect_after): same here.. (pygobject_connect_object): same here. (pygobject_connect_object_after): same here. * pygtype.c (pyg_closure_new): clean up closure on invalidate, rather than finalize (on invalidate, we break references). * pygobject.h (PyGObject): add closures member to store references to PyGClosures.
* copy boxed arguments.James Henstridge2002-06-231-1/+1
| | | | | | | | | | | | | | | | | | | | 2002-06-23 James Henstridge <james@daa.com.au> * gtk/gtk.override (_wrap_gtk_tree_sortable_get_sort_column_id): copy boxed arguments. * pygobject.h: fix up prototypes. * gobjectmodule.c (pyg_object_set_property): copy boxed arguments. * pygobject.c (pygobject_get_property): copy boxed arguments here. (pygobject_emit): same here. (pygobject_chain_from_overridden): same here. * pygtype.c (pyg_value_as_pyobject): add "copy_boxed" argument to this function. (pyg_closure_marshal): pass FALSE for copy_boxed argument. (pyg_signal_class_closure_marshal): same here.
* register pointer types as well.James Henstridge2002-02-051-1/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2002-02-05 James Henstridge <james@daa.com.au> * codegen/codegen.py (register_types): register pointer types as well. * codegen/argtypes.py (PointerArg): handling for pointer arg types. (ArgMatcher.register_pointer): add function to register pointer types. * gtk/gtk.override (_wrap_gtk_ctree__get_selection): GtkCTreeNode is not a boxed type. (_wrap_gtk_ctree_base_nodes): same. (_wrap_gtk_ctree_insert_node): same. (_wrap_gtk_ctree_find_by_row_data): same. (_wrap_gtk_ctree_find_all_by_row_data): same. (_wrap_gtk_ctree_node_get_text): same. (_wrap_gtk_ctree_node_get_pixmap): same. (_wrap_gtk_ctree_node_get_pixtext): same. (_wrap_gtk_ctree_get_node_info): same. (_wrap_gtk_ctree_node_set_row_data): same. (_wrap_gtk_ctree_node_get_row_data): same here. (_wrap_gtk_ctree_getattr): same here. * codegen/codegen.py (write_source): register pointer types as pointers. * pango.override (_wrap_pango_font_description_new): ignore some private (well, pango module API) functions. * gtk/gtk-types.defs (CTreeNode): make this a pointer type. * codegen/codegen.py (write_pointer_method): new method to write methods for GPointer types. (write_pointer_constructor): new function for writing constructor for GPointer types. (write_pointer_getsets): new function for writing getters for pointer objects (this should be merged with the GObject and GBoxed versions ...). (write_pointer): add new function, which calls all the GPointer related functions. (write_source): write pointer types. * gobjectmodule.c (initgobject): actually ready the GPointer type. * gtk/gtk-types.defs (CTreeNode): get rid of fields here. They will be covered by the custom getattr() function, so no need to duplicate. * codegen/codegen.py (write_boxed_getsets): convert to use getsets for boxed objects. (write_boxed): use write_boxed_getsets() to write the getsets, while allowing boxed objects to specify a getattr() function. 2002-02-04 James Henstridge <james@daa.com.au> * gobjectmodule.c (initgobject): add GPointer to the module dict. (pygobject_api_functions): and to the API vtable. * pygobject.h (pyg_constant_strip_prefix): and add it to the public header. * pygobject-private.h (pyg_pointer_new): add stuff to private header ... * pygboxed.c (PyGPointer): add code to handle base GPointer type. * codegen/defsparser.py (DefsParser.__init__): add self.pointers attribute. (DefsParser.define_pointer): handle (define-pointer ...). (DefsParser.write_defs): handle pointer types. * codegen/definitions.py (PointerDef): new definition type for G_TYPE_POINTER subclasses.
* add overriden implementation that allows threads while waiting, so someJames Henstridge2002-01-071-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2002-01-07 James Henstridge <james@daa.com.au> * gtk/gdk.override (_wrap_gdk_threads_enter): add overriden implementation that allows threads while waiting, so some other thread has a chance to give up the gdk lock. * gtk/gtkmodule.c (functions): remove stuff. * gtk/pygtk-private.h: remove definitions here as well. * gtk/pygtk.h (_PyGtk_FunctionStruct): remove destroy notify and thread block stuff. * gtk/gtkobject-support.c: remove pygtk_destroy_notify. * gtk/gtk.override (pygtk_tree_foreach_marshal): move this function here from gtkobject-support.c, and don't bother blocking threads. (_wrap_gtk_tree_selection_selected_foreach): same here -- don't need to unblock threads. (pygtk_tree_selection_marshal): move this function here from gtkobject-support.c. Convert to use pyg_block_threads. (_wrap_gtk_dialog_run): add overriden implementation that unblocks threads. (_wrap_gtk_main): use pyg_block_threads (_wrap_gtk_main_iteration): same. (_wrap_gtk_item_factory_create_items): same here. (_wrap_gtk_menu_popup): same here. (_wrap_gtk_clist_set_row_data): use pyg_destroy_notify (_wrap_gtk_timeout_add): same here. (_wrap_gtk_idle_add): same here. (_wrap_gtk_quit_add): same here. (_wrap_gtk_input_add_full): same here. (_wrap_gtk_ctree_node_set_row_data): same here. * gtk/gtkobject-support.c: remove PyGTK_BLOCK_THREADS and PyGTK_UNBLOCK_THREADS macros. (pygtk_destroy_notify): use pyg_block_threads. (pygtk_custom_destroy_notify): same. (pygtk_handler_marshal): same. (pygtk_input_marshal): same. * gtk/gdk.override (_wrap_gdk_threads_init): register gdk lock based recursive threads block/unblock functions. If threading was disabled at compile time, then this function will error out. * gtk/gdk.defs (threads_enter, threads_leave, threads_leave): add functions. * gobjectmodule.c (functions): add destroy_notify here as well. * pygobject.h: add destroy_notify to the PyGObject_Functions vtable.
* handler for registering thread block/unblock funcs.James Henstridge2002-01-071-0/+19
| | | | | | | | | | | | | | | 2002-01-07 James Henstridge <james@daa.com.au> * gobjectmodule.c (pyg_set_thread_block_funcs): handler for registering thread block/unblock funcs. (pygobject_destroy_notify): block threads during DECREF call. (pyg_closure_destroy): block threads during closure DECREF. (pyg_closure_marshal): block threads when calling function. (pyg_signal_class_closure_marshal): block threads. (functions): add extra functions to vtable. * pygobject.h (struct _PyGObject_Functions): add thread block/unblock slots to the API table.
* always print and clear the exceptions in callback marshalers. People whoMatt Wilson2001-12-131-5/+0
| | | | | | | | | | | | | | | | | | | | | | | | 2001-12-12 Matt Wilson <msw@redhat.com> * gobjectmodule.c (pyg_closure_marshal, pyg_signal_class_closure_marshal): always print and clear the exceptions in callback marshalers. People who want to catch these exceptions and make them fatal should use sys.excepthook. (pyg_fatal_exceptions_notify, pyg_fatal_exceptions_notify_add, pyg_fatal_exceptions_remove): remove now unused functions. Also remove them from the PyGObject_API. * gtk/pygtk.h (PyGtk_FatalExceptions): remove. * gtk/pygtk-private.h (PyGtk_FatalExceptions): remove. * gtk/gtkmodule.c (init_gtk): don't bother with PYGTK_FATAL_EXCEPTIONS. (pygtk_main_quit): remove unused code. * gtk/gtk.override (_wrap_gtk_item_factory_create_items, _wrap_gtk_menu_popup): likewise, always print and clear the exception.
* use pyg_error_check to raise the exception. Now the domain and codeJames Henstridge2001-12-021-0/+3
| | | | | | | | | | | | | | | 2001-12-02 James Henstridge <james@daa.com.au> * codegen/argtypes.py (GTypeArg.write_return): use pyg_error_check to raise the exception. Now the domain and code elements of the GError are available. (GtkTreePathArg.write_param): add to codeafter in order to free the tree path we created, fixing a leak. * gobjectmodule.c (initgobject): create a gobject.GError exception. (pyg_error_check): function for converting a GError into a gobject.GError python exception.
* added start of atk wrapperMatt Wilson2001-11-271-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2001-11-27 Matt Wilson <msw@redhat.com> * atk.defs, atk.override, atkmodule.c: added start of atk wrapper * gtk/Makefile.am (DISTCLEANFILES): remove generated files ($(srcdir)/gtk.c): modify targets to output generated files in the builddir, not the srcdir. ($(srcdir)/gdk.c): likewise. ($(srcdir)/libglade.c): likewise. * codegen/h2def.py (define_func): add check to workaround broken string.replace semantics on python 1.5 * codegen/codegen.py (write_enums): if the enum or flag doesn't have a GType, just add those enum values listed in the defs file by hand. * codegen/argtypes.py (ArgMatcher.register_enum): if defs file doesn't specify a GType for the enum, use G_TYPE_NONE. (ArgMatcher.register_flag): likewise. * gobjectmodule.c (pyg_enum_get_value): allow enums to pass G_TYPE_NONE in as the type, disabling the string to value conversion. (pyg_flags_get_value): likewise. (pyg_constant_strip_prefix): new function to combine common codepath. (pyg_enum_add_constants): use pyg_constant_strip_prefix (pyg_flags_add_constants): likewise. (functions): make pyg_constant_strip_prefix available to users of pygobject * pygobject.h: added pyg_constant_strip_prefix wrapper * configure.in: added ATK test, subst for ATK_CFLAGS and ATK_LIBS. * Makefile.am (%.c): added generic codegen target for pango and atk. Added DISTCLEANFILES so that generated files will be removed. Added atk targets, cflags, ldflags.
* added PyGFatalExceptionFunc typedef, API wrapper forMatt Wilson2001-11-151-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2001-11-15 Matt Wilson <msw@redhat.com> * pygobject.h: added PyGFatalExceptionFunc typedef, API wrapper for pyg_fatal_exceptions_{add,remove}. * gobjectmodule.c (pyg_boxed_new): return NULL on assertion failures, #62814 (pyg_closure_new): actually assign swap_data to the closure. (pyg_fatal_exceptions_notify, pyg_fatal_exceptions_notify_add, pyg_fatal_exceptions_remove): added mechanism for gobjectmodule using modules to get a function called when a fatal exception happens in closures, etc. (pyg_closure_marshal, pyg_signal_class_closure_marshal): return NULL if a gobjectmodule using module registered a fatal exception function. * gtk/pygtk-private.h: added declarations for pygtk_custom_destroy_notify, pygtk_tree_selection_marshal, pygtk_tree_foreach_marshal. Added typedef for PyGtkCustomNotify. #62814 * gtk/gtkmodule.c (init_gtk): register stock items, #62814. Set up fatal exception stuff if PYGTK_FATAL_EXCEPTIONS is set. This isn't 100% done yet, gtk mainloop specific functions still need work. * gtk/gtkobject-support.c (pygtk_tree_selection_marshal): added, #62814 (pygtk_tree_foreach_marshal): added, #62814 (pygtk_custom_destroy_notify): added, #62814 * gtk/gtk.override (_wrap_gtk_tree_selection_set_select_function): added, #62814 (_wrap_gtk_tree_selection_selected_foreach): added, #62814
* use pyg_type_from_object instead. Based on patch from Elliot.James Henstridge2001-09-281-9/+8
| | | | | | | | | | | | 2001-09-29 James Henstridge <james@daa.com.au> * gtk/pygtktreemodel.c (pygtk_tree_model_get_column_type): use pyg_type_from_object instead. Based on patch from Elliot. * gtk/gtk.override (_wrap_gtk_selection_data__get_data): convert getter to a function to match codegen changes. * : merge in python22-branch (see changelog entries below).
* uncomment this now it has a boxed type.python22-branch-anchorJames Henstridge2001-09-201-1/+1
| | | | | | | | | | 2001-09-20 James Henstridge <james@daa.com.au> * pango.defs (FontMetrics): uncomment this now it has a boxed type. * gtk/Makefile.am (EXTRA_DIST): add gdk.override to dist. * configure.in: update version number.
* rename from new, so that the header is includable in C++ programs.PYGTK_1_99_1James Henstridge2001-09-201-2/+2
| | | | | | | 2001-09-20 James Henstridge <james@daa.com.au> * pygobject.h (_PyGObject_Functions.newgobj): rename from new, so that the header is includable in C++ programs.
* export this function.James Henstridge2001-09-181-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2001-09-18 James Henstridge <james@daa.com.au> * pygobject.h (pyg_type_wrapper_new): export this function. * codegen/argtypes.py (GTypeArg.write_return): wrap GType return values as PyGTypeWrappers rather than ints. * codegen/codegen.py (write_source): pass the typecode macros to pygobject_register_class and pyg_register_interface rather than references to the get_type functions. * pygobject.h (_PyGObject_Functions): fix up prototypes. * gobjectmodule.c (check_bases): check if the base class is an extensionclass before poking around in class->bases. (pyg_type_*): don't bother storing the _get_type() function for lazy initialisation. Instead, just store the GType. Also, remove code for coercing them into numbers. (pygobject_register_class): take the type, rather that get_type routine as an argument. (pyg_register_interface): same here. (pyg_type_from_object): don't accept types that convert to ints as being equivalent to GTypes. (pyg_register_boxed): set the __gtype__ attribute to a PyGTypeWrapper. (pyg_type_register): set __gtype__ to a PyGTypeWrapper. (pyg_type_name): use pyg_type_from_name (pyg_type_from_name): return a PyGTypeWrapper object. (pyg_type_parent): update. (pyg_type_is_a): update. (pyg_type_children): update. (pyg_type_interfaces): update. (initgobject): set __gtype__ attributes to PyGTypeWrapper objects. (initgobject): make type constants PyGTypeWrapper objects.
* add test use of add_constants.James Henstridge2001-09-141-0/+7
| | | | | | | | | | | | | 2001-09-15 James Henstridge <james@daa.com.au> * gtk/gtkmodule.c (init_gtk): add test use of add_constants. * pygobject.h (_PyGObject_Functions): add new functions to header. * gobjectmodule.c (pyg_enum_add_constants): new function for adding constants to a module dictionary from a particular GType. (pyg_flags_add_constants): similar for flag types. (functions): add to export function vtable.
* same change.James Henstridge2001-09-141-2/+2
| | | | | | | | | 2001-09-14 James Henstridge <james@daa.com.au> * pygobject.h (pyg_register_boxed_custom): same change. * gobjectmodule.c (pyg_register_boxed_custom): rename from pyg_boxed_register to avoid confusion.
* remove dead code for GtkArg handling, etc. (also tidied up references toJames Henstridge2001-06-251-0/+3
| | | | | | | | | | | | | 2001-06-25 James Henstridge <james@daa.com.au> * gtk/gtkobject-support.c: remove dead code for GtkArg handling, etc. (also tidied up references to it in other files). 2001-06-24 James Henstridge <james@daa.com.au> * gtk/gtk-types.c: removed all traces of GdkFont. * gtk/gdk.defs (Font): add boxed type for font.
* more fixups to use pyg_type_from_object.James Henstridge2001-06-231-1/+4
| | | | | | | | | | | | | | | | | | | | | | 2001-06-23 James Henstridge <james@daa.com.au> * gobjectmodule.c (pyg_signal_new): more fixups to use pyg_type_from_object. * gtk/gtk.override (_wrap_gtk_accel_group_new): don't use PyGtkAccelGroup_New (not sure why I am fixing this -- will change soon anyway). (_wrap_gtk_tree_store_set_value): use pyg_type_from_object here. (_wrap_gtk_list_store_set_value): same here. * codegen/argtypes.py (CustomBoxedArg): rename from BoxedArg. (BoxedArg): new code for standardised PyGBoxed handling. (ArgMatcher.register_custom_boxed): rename from register_boxed (ArgMatcher.register_boxed): new function for PyGBoxed types. (arg): use ArgMatcher.register_boxed to register GtkAccelGroup. * pygobject.h (pyg_boxed_check): change macro to check against the typecode, rather than python wrapper type.
* new arg type for GType and GtkType args that uses pyg_type_from_object.James Henstridge2001-06-221-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | 2001-06-22 James Henstridge <james@daa.com.au> * codegen/argtypes.py (GTypeArg.write_param): new arg type for GType and GtkType args that uses pyg_type_from_object. * gobjectmodule.c (pyg_type_from_object): new function to get a type code from various types of python objects (currently, integer like objects, strings and other objects that have a __gtype__ attribute). (pygobject__init__): use pyg_type_from_object to get the object type. (pyg_signal_new): same here. 2001-06-21 James Henstridge <james@daa.com.au> * gobjectmodule.c (pyg_boxed_getattro): allow getattr to work on PyGBoxed types (while not overloading tp_getattr). We fall back to tp_getattr if provided by the boxed type. (pyg_register_boxed): make sure tp_getattro is set correctly. * gtk/gtk-types.c (_pygtk_register_boxed_types): convert GtkAccelGroup to a PyGBoxed type.
* function to register a new boxed type ExtensionClass. (pyg_boxed_new): newJames Henstridge2001-06-081-1/+20
| | | | | | | | | | | | | | | | | | | | | 2001-06-08 James Henstridge <james@daa.com.au> * gobjectmodule.c (pyg_register_boxed): function to register a new boxed type ExtensionClass. (pyg_boxed_new): new function to create wrapper instances for a particular boxed type (given its typecode). 2001-06-07 James Henstridge <james@daa.com.au> * pygobject.h (pyg_boxed_get): add prototypes for a PyGBoxed type that will be used for all boxed types in pygtk (well, I can hope :) * gobjectmodule.c (pyg_register_interface): new function to register interfaces with. Makes sure I don't accidentally give the interface a parent class :). Also adds a __gtype__ class attribute similar to GObject classes. May also make interfaces subclasses of GInterface at some point.
* Still broken. Needs more updatingJames Henstridge2001-03-181-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | 2001-03-18 James Henstridge <james@daa.com.au> * gtk/pygtktreemodel.c (pygtk_tree_model_class_init): signals are now created in the gtktreemodel.c, so we don't need to. * gtk/gtk.defs (Adjustment): make parent GtkObject, as GtkData is gone. (GtkText): remove from binding. * codegen/codegen.py (write_source): pass in the get_type function when registering classes. (gettypetmpl): remove template. (write_class): remove get_type method generator. Handled by __gtype__ * gobjectmodule.c (initgobject): add argument to g_type_init call. (pyg_value_from_pyobject): use G_VALUE_HOLDS_* rather than G_IS_VALUE_*. (pyg_value_as_pyobject): same here. (pygobject_register_class): add an argument that takes the get_type function for the GObject. This is used to add a __gtype__ attribute to the class (the get_type function is not actually called until __gtype__ is accessed).
* change code generator to pass bases in as a tuple rather than a singleJames Henstridge2000-11-091-1/+1
| | | | | | | | | | | | | 2000-11-09 James Henstridge <james@daa.com.au> * codegen/codegen.py (write_source): change code generator to pass bases in as a tuple rather than a single PyExtensionClass structure. * pygobject.h: change prototype. * gobjectmodule.c (pygobject_register_class): allow for registerin a type with multiple base classes.
* new function for registering functions to marshal boxed GValues to/fromJames Henstridge2000-10-261-9/+13
| | | | | | | | | | | | | | | | | | 2000-10-26 James Henstridge <james@daa.com.au> * gobjectmodule.c (pyg_boxed_register): new function for registering functions to marshal boxed GValues to/from their python wrappers. (pyg_value_from_pyobject): add boxed support. (pyg_value_as_pyobject): add boxed support. (pyg_closure_new): new function to create a python GClosure. (pyg_closure_destroy): cleanup function for a PyGClosure. (pyg_closure_marshal): marshaler for PyGClosure. (pyg_value_as_pyobject): add const to GValue argument. * pygobject.h: export a pyg_boxed_register function to register new boxed types for use with pyg_value_from_pyobject and pyg_value_as_pyobject.
* include <glib-object.h> rather than <gobject/...>James Henstridge2000-10-251-1/+1
|
* actually initialise the gobject stuff for gtk._gtk.James Henstridge2000-07-031-2/+2
| | | | | | | | | | | 2000-07-03 James Henstridge <james@daa.com.au> * gtk/gtkmodule.c (init_gtk): actually initialise the gobject stuff for gtk._gtk. * pygobject.h (pygobject_check): call the correct ExtensionClass check macro. (init_pygobject): small fixup here.
* call the correct ExtensionClass check macro.James Henstridge2000-07-031-1/+1
| | | | | | | | | | | | 2000-07-03 James Henstridge <james@daa.com.au> * pygobject.h (pygobject_check): call the correct ExtensionClass check macro. * codegen/codegen.py (consttmpl): use pygobject_register_wrapper. (getattrtmpl): make the getattr function raise an exception on unhandled attributes. I will use a tp_getattro function to bind all the getattr functions of base classes together.
* use PyGObject rather than PyGtk_Object.James Henstridge2000-07-021-0/+1
| | | | | | | | | | 2000-07-03 James Henstridge <james@daa.com.au> * codegen/argtypes.py (ObjectArg.write_param): use PyGObject rather than PyGtk_Object. * pygobject.h (pygobject_check): add check function. Just a wrapper around ExtensionClassSubclassInstance.
* use pygobject.h.James Henstridge2000-06-291-0/+69
2000-06-29 James Henstridge <james@daa.com.au> * gobjectmodule.c: use pygobject.h. * pygobject.h: header for modules that want to use GObject.