summaryrefslogtreecommitdiffstats
path: root/gobject/pygobject.c
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix reference count of gtk.Window's from gobject.newGustavo J. A. M. Carneiro2005-07-311-4/+13
|
* Bug 311226: Metaclass registration causes breakage with old constructorsGustavo J. A. M. Carneiro2005-07-221-0/+6
|
* We have atomic ref counting in glib now, remove block/unblocking aroundJohan Dahlin2005-07-171-6/+0
| | | | | | | | | | | | | | * gobject/pygobject.c: (pygobject_new_full), (pygobject_dealloc), (pygobject_clear): * gtk/gdk.override: * gtk/gtk-types.c: (_pygtk_style_helper_new), (pygtk_style_helper_dealloc), (pygtk_style_helper_setitem), (pygtk_tree_model_row_dealloc), (pygtk_tree_model_row_iter_dealloc): * gtk/gtk.override: * gtk/gtkwidget.override: We have atomic ref counting in glib now, remove block/unblocking around reference counting.
* Raise an exception if a construct only property is set after constructionJohan Dahlin2005-07-101-29/+40
| | | | | | | | | * gobject/pygobject.c: (PyGProps_setattro), (pygobject_set_property): * tests/test_properties.py: Raise an exception if a construct only property is set after construction time. Refactor property setting code and add some more tests.
* Bug 161177: Allow creation of python classes from g_object_newGustavo J. A. M. Carneiro2005-07-091-7/+11
|
* correct PyGProps[Iter] sizesGustavo J. A. M. Carneiro2005-07-091-3/+3
|
* Add GObject support, patch mostly based on Iņaki and Gustavos work.Johan Dahlin2005-07-081-0/+345
| | | | | | | | | | | | | * gobject/gobjectmodule.c: (initgobject): * gobject/pygobject-private.h: * gobject/pygobject.c: (pyg_props_iter_dealloc), (pygobject_props_iter_next), (PyGProps_dealloc), (build_parameter_list), (PyGProps_getattro), (PyGProps_setattro), (pygobject_props_traverse), (pygobject_props_get_iter), (PyGProps_length), (pyg_props_descr_descr_get): * tests/Makefile.am: Add GObject support, patch mostly based on Iņaki and Gustavos work. Unittests added, fixes #81879
* Add support for specifying name for a GObject subclass, usingJohan Dahlin2005-07-051-7/+28
| | | | | | | | | | | * gobject/gobjectmodule.c: (_wrap_pyg_type_register), (get_type_name_for_class), (pyg_type_register): * gobject/pygobject-private.h: * gobject/pygobject.c: (pygobjectmeta_register), (pygobjectmeta_init): * tests/test_gtype.py: Add support for specifying name for a GObject subclass, using __gtype_name__. Add a unittest. Fixes #169498
* fix docstring typoJohan Dahlin2005-07-041-1/+1
|
* Fix typo in documentation string. Fixes #171910 (Tuure Laurinolli and GianJohan Dahlin2005-06-201-1/+1
| | | | | | * gobject/pygobject.c (pygobject_new_with_interfaces): Fix typo in documentation string. Fixes #171910 (Tuure Laurinolli and Gian Mario Tagliaretti)
* fix registration of already registered types through the gobject metaclassGustavo J. A. M. Carneiro2005-05-291-1/+8
|
* gquark initialization cleanupGustavo J. A. M. Carneiro2005-05-281-16/+0
|
* Bug 128765: GObject metaclassGustavo J. A. M. Carneiro2005-05-221-1/+62
|
* revert accidental commitGustavo J. A. M. Carneiro2005-05-221-39/+1
|
* Bug 165373: crash due to extra Py_XDECREF in gtk.TreeView.map_expanded_rowsGustavo J. A. M. Carneiro2005-05-221-1/+39
|
* Unbreak buildJohan Dahlin2004-11-271-1/+3
|
* Make sure type is a type and sinkfunc isn't NULL.Johan Dahlin2004-11-231-1/+4
| | | | | * gobject/pygobject.c (pygobject_register_sinkfunc): Make sure type is a type and sinkfunc isn't NULL.
* allow override of some more slotsGustavo J. A. M. Carneiro2004-08-201-7/+0
|
* make threading runtime optionalGustavo J. A. M. Carneiro2004-08-041-12/+12
|
* remove unused variableGustavo J. A. M. Carneiro2004-08-031-1/+0
|
* More minor threading fixesJohan Dahlin2004-08-031-4/+3
|
* Add better support for boolean type now when we can require 2.3. Fixes bugJohan Dahlin2004-08-031-5/+1
| | | | | | | | | | | | | | | | | * codegen/argtypes.py: * gobject/gobjectmodule.c: (pyg_source_remove): * gobject/pygmaincontext.c: (_wrap_g_main_context_iteration), (_wrap_g_main_context_pending): * gobject/pygmainloop.c: (_wrap_g_main_loop_is_running): * gobject/pygobject.c: (pygobject_handler_is_connected): * gobject/pygparamspec.c: (pyg_param_spec_getattr): * gobject/pygtype.c: (pyg_value_as_pyobject): * gtk/gdk.override: * gtk/gtk.override: * gtk/gtktextview.override: * gtk/gtkwidget.override: * pango.override: Add better support for boolean type now when we can require 2.3. Fixes bug 149121
* Clean up most functions here to have only one return path.Johan Dahlin2004-08-031-12/+19
| | | | | | | | | | | | | | | | | | * gtk/pygtktreemodel.c: Clean up most functions here to have only one return path. * gobject/pygobject.c (pygobject_emit): Protect g_value_unset by UNBLOCK/BLOCK_THREADS since it might call pygobject_free which will result in a deadlock. * gobject/gobjectmodule.c (pyg_thread_init): New function, move thread initalization stuff in here. * All over the place: Kill pyg_block/unblock_threads and use PyGILState and Py_BEGIN/END_ALLOW_THREADS. unblock [code] block calls are replaced by Py_BEGIN/END and block [code] unblock calls are replaced by PyGILState.
* Call PyEval_InitThreads. Perhaps its something that always should bePYGTK_2_3_95Johan Dahlin2004-08-021-0/+5
| | | | | | | | | | | | | | | | * gobject/gobjectmodule.c (initgobject): Call PyEval_InitThreads. Perhaps its something that always should be called. * README (Author): Add a requirements section * configure.in: Require Python 2.3 * setup.py (version): Ditto * gobject/pygtype.c, gobject/pygobject.h: Remove 2.2 compat. * All over the place: Add support for PyGILState.
* New gettersJohan Dahlin2004-07-181-10/+2
| | | | | | | | | | | * gobject/pygflags.c (pyg_flags_get_value_nicks) (pyg_flags_get_value_names): New getters * gobject/pygenum.c (pyg_enum_get_value_nick) (pyg_enum_get_value_name): New getters * gobject/gobjectmodule.c (pyg_param_spec_getattr): add enum_class and flags_class properties.
* New conversion functions that use GParamSpec's declarations of new paramJohn Ehresman2004-07-051-2/+2
| | | | | | | | | | | | | | | | | * pygtype.c (pyg_param_gvalue_from_pyobject, pyg_param_gvalue_as_pyobject): New conversion functions that use GParamSpec's * pygobject.h, pygobject-private.h: declarations of new param conversion functions * pygobject.c (pygobject_get_property, pygobject_set_property): Use param conversion functions * gobjectmodule.c (pyg_parse_constructor_args): reorder local variable declaration so it will compile with VC++ * tests/testconversion.py: tests for above
* fix bug #144135 (gtk.gdk.GC attributes not working)Gustavo J. A. M. Carneiro2004-06-201-0/+13
|
* Add a new example of subclassing a GtkWidget.Johan Dahlin2004-06-041-2/+9
| | | | | | | | * examples/gtk/widget.py: Add a new example of subclassing a GtkWidget. * Makefile.am (EXTRA_DIST): Add widget.py * pygobject.c (pygobject_new): guard object_ref call
* pygobject.c (pygobject_new_with_interfaces) Add new type to the moduleJohn Finlay2004-05-181-2/+36
| | | | | * pygobject.c (pygobject_new_with_interfaces) Add new type to the module dict as is done for built-in types.
* pygobject.c (pygobject_new) Bump refcount of types created byJohn Finlay2004-05-181-0/+5
| | | | | * pygobject.c (pygobject_new) Bump refcount of types created by pygobject_new_with_interfaces. Fixes #141042
* Prevent warnings in Python 2.3PYGTK_2_3_91Gustavo J. A. M. Carneiro2004-04-151-1/+1
|
* New function. (pygobject_lookup_class): Modify so we're not traversingJohan Dahlin2004-04-101-14/+96
| | | | | | | | | | | | | | * pygobject.c (pygobject_new_with_interfaces): New function. (pygobject_lookup_class): Modify so we're not traversing parents for unknown types but instead creating new types when they're not registered. We're also using pygobject_new_with_interfaces so interfaces gets attached correctly. Partial fix for bug 129032 * gobjectmodule.c: Add quark and attach the PyTypeObject for GInterfaces. * pygobject-private.h: Make PyGInterface_Type and pyginterface_type_key public
* Fixes for bug 132704, Patch by John Ehresman.Johan Dahlin2004-03-041-2/+5
| | | | | | * pygobject.c (pygobject_chain_from_overridden): * pygtype.c (pyg_signal_class_closure_marshal): Fixes for bug 132704, Patch by John Ehresman.
* signa->signalJohan Dahlin2004-02-241-1/+1
| | | | * pygobject.c (pygobject_chain_from_overridden): signa->signal
* explicitly check if the property is readable first, and raise an exceptionJames Henstridge2003-12-231-0/+10
| | | | | | | | | 2003-12-23 James Henstridge <james@daa.com.au> * pygobject.c (pygobject_get_property): explicitly check if the property is readable first, and raise an exception otherwise (pygobject_set_property): check if property is readable (fixes bug #121544).
* add wrapper (from bug #118676).pygtk-2-0-anchorPYGTK_2_0_0PYGTK_1_99_18PYGTK_1_99_17James Henstridge2003-07-311-0/+16
| | | | | | | 2003-07-31 James Henstridge <james@daa.com.au> * pygobject.c (pygobject_handler_is_connected): add wrapper (from bug #118676).
* add copyright notices, and update to LGPL 2.1.James Henstridge2003-06-261-1/+21
| | | | | | 2003-06-26 James Henstridge <james@daa.com.au> * (lots of stuff): add copyright notices, and update to LGPL 2.1.
* add doc comments.PYGTK_1_99_16James Henstridge2003-03-131-0/+71
| | | | | | | | | | 2003-03-13 James Henstridge <james@daa.com.au> * gobjectmodule.c: add doc comments. * pygobject.c: add doc comments. * pygboxed.c: add doc comments.
* the GObject should own a ref to the wrapper. (pygobject_new): get rid ofJames Henstridge2003-03-071-68/+49
| | | | | | | | | | | | | | | | | | | | 2003-03-06 James Henstridge <james@daa.com.au> * pygobject.c (pygobject_register_wrapper): the GObject should own a ref to the wrapper. (pygobject_new): get rid of the hasref code, and make sure that the GObject owns a ref to the wrapper if we create it. (pygobject_dealloc): get rid of the hasref code. If we get this far, the wrapper is dead. (pygobject_traverse): if the GObject's refcount == 1, then traverse to self. (pygobject_clear): clear self->obj and self->inst_dict. (pygobject_register_class): set tp_clear() so that things actually work. Without this, there was no tp_clear method for subclasses of GObject. * pygobject.h: remove hasref member, hopefully not needed if relying on cycle GC.
* Unblock threads before invalidating our closures, since this might triggerJon Trowbridge2003-03-041-0/+4
| | | | | | | | | | | | | | | | | | | 2003-03-04 Jon Trowbridge <trow@ximian.com> * pygobject.c (pygobject_dealloc): Unblock threads before invalidating our closures, since this might trigger a destructor that needs to execute python code. (pygobject_clear): Ditto. * pygboxed.c (pyg_boxed_dealloc): Unblock threads before freeing the boxed type, since the destructor may need to execute python code. (pyg_boxed_new): Block threads while we make our Py* calls. (pyg_pointer_new): Block threads while we make our Py* calls. * gobjectmodule.c (pyg_object_set_property): We need to block threads before our call to pygobject_new. (pyg_object_get_property): Ditto.
* In my fix for bug #102756 on 2003-01-08, I should have used calls toJon Trowbridge2003-01-171-5/+5
| | | | | | | | | | | | | | | | | 2003-01-17 Jon Trowbridge <trow@ximian.com> * pygobject.c (pygobject_dealloc): In my fix for bug #102756 on 2003-01-08, I should have used calls to pyg_unblock_threads()/ pyg_block_threads() instead of directly calling the Py_BEGIN_ALLOW_THREADS/Py_END_ALLOW_THREADS macros. The macros don't update our local thread lock counts, causing problems in cases where the finalization of one object triggers the finalization of another. (When I say "problems", I of course mean "horrible crashes and mysterious race conditions".) * gtk/gtk-types.c (pygtk_style_helper_dealloc, pygtk_style_helper_setitem, pygtk_tree_model_row_dealloc, pygtk_tree_model_row_iter_dealloc): See above.
* Wrap Py_BEGIN_ALLOW_THREADS/Py_END_ALLOW_THREADS around the call toJon Trowbridge2003-01-081-1/+7
| | | | | | | | | | | | | | | | | | | | | 2003-01-08 Jon Trowbridge <trow@ximian.com> * pygobject.c (pygobject_dealloc): Wrap Py_BEGIN_ALLOW_THREADS/Py_END_ALLOW_THREADS around the call to g_object_unref. We need to do this because the object finalizers might trigger other code that has to acquire the interpreter lock, causing a deadlock. Fixes #102756. * gtk/gtk-types.c (pygtk_style_helper_dealloc): Wrap the call to g_object_unref in Py_BEGIN_ALLOW_THREADS/Py_END_ALLOW_THREADS. This should let us avoid other instances of bug #102756. (pygtk_style_helper_setitem): Ditto. (pygtk_tree_model_row_dealloc): Ditto. (pygtk_tree_model_row_iter_dealloc): Ditto. * gtk/gdk.override (pygdk_unblock_threads, pygdk_unblock_threads): Restored David I Lehn's patch (#98380). His patch was fine --- it just caused bug #102756 to emerge.
* (pygobject_chain_from_overridden): check ifPYGTK_1_99_14James Henstridge2002-12-241-0/+6
| | | | g_signal_get_invocation_hint() returns NULL.
* add abstract type check here too. (pygobject_init): make this code moreJames Henstridge2002-12-241-59/+46
| | | | | | | | | | | | 2002-12-24 James Henstridge <james@daa.com.au> * pygobject.c (pygobject_init): add abstract type check here too. (pygobject_init): make this code more similar to pyg_object_new, so that it is easier to fix bugs in the future. * gobjectmodule.c (pyg_object_new): handle case of no keyword arguments. (pyg_object_new): refuse to instantiate an abstract type.
* set up closure correctly. Fix from bug #96922.James Henstridge2002-11-161-2/+2
| | | | | | | | 2002-11-16 James Henstridge <james@daa.com.au> * pygobject.c (pygobject_connect_object): set up closure correctly. Fix from bug #96922. (pygobject_connect_object_after): and here.
* don't need to manually sink. (_wrap_gtk_tree_view_column_new): same here.James Henstridge2002-08-181-3/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2002-08-18 James Henstridge <james@daa.com.au> * gtk/gtk.override (_wrap_gtk_clist_new_with_titles): don't need to manually sink. (_wrap_gtk_tree_view_column_new): same here. (_wrap_gtk_button_new): same here. (_wrap_gtk_toggle_button_new): same here. (_wrap_gtk_check_button_new): same here. (_wrap_gtk_radio_button_new): same here. (_wrap_gtk_list_item_new): same here. (_wrap_gtk_menu_item_new): same here. (_wrap_gtk_check_menu_item_new): same here. (_wrap_gtk_radio_menu_item_new): same here. (_wrap_gtk_image_menu_item_new): same here. (_wrap_gtk_ctree_new_with_titles): same here. (_wrap_gtk_dialog_new_with_buttons): same here. (_wrap_gtk_message_dialog_new): same here. (_wrap_gtk_progress_bar_new_with_adjustment): same here. * gtk/gtkmodule.c (sink_gtkobject): function to sink a GtkObject if it is floating. (init_gtk): register sink_gtkobject for sinking GtkObjects. * codegen/codegen.py (GObjectWrapper.get_initial_constructor_substdict): get rid of gtkobjectsink bit of code. * pygobject.c (pygobject_register_sinkfunc): new function to register a function to get rid of the floating reference from an object. (sink_object): run a sinkfunc for an object if it has been registered. (pygobject_new): call sink_object (pygobject_register_wrapper): call sink_object.
* These changes help with win32 compat.PYGTK_1_99_12James Henstridge2002-07-121-2/+2
| | | | | | | | | | | | | | | 2002-07-12 James Henstridge <james@daa.com.au> These changes help with win32 compat. * pygboxed.c (PyGBoxed_Type): set tp_alloc and tp_new to NULL. (PyGPointer_Type): same here. * gobjectmodule.c (PyGInterface_Type): set tp_alloc and tp_new to NULL. (initgobject): set tp_new and tp_alloc for various types. * pygobject.c (PyGObject_Type): set tp_alloc and tp_new to NULL.
* Reworking of Arjan Molenaar's (arjanmolenaar@hetnet.nl) patch from bugPYGTK_1_99_11James Henstridge2002-07-091-7/+92
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* apply another memory leak fix from Arjan (from bug #87413).James Henstridge2002-07-081-0/+4
| | | | | | | | | | 2002-07-08 James Henstridge <james@daa.com.au> * pygobject.c (pygobject_connect): apply another memory leak fix from Arjan (from bug #87413). (pygobject_connect_after): equivalent fix here. (pygobject_connect_object): and here. (pygobject_connect_object_after): and here.
* add __grefcount__ property.James Henstridge2002-07-071-1/+8
| | | | | | 2002-07-07 James Henstridge <james@daa.com.au> * pygobject.c (pygobject_get_refcount): add __grefcount__ property.