summaryrefslogtreecommitdiff
path: root/gi
Commit message (Collapse)AuthorAgeFilesLines
...
* Add overrides for Gtk.Button set/get_focus_on_clickDan Yeaw2020-04-171-0/+10
| | | | | | | | Fixes #371. Gtk.Button.set_focus_on_click and Gtk.Button.get_focus_on_click are deprecated since version 3.20. This override calls the Gtk.Widget methods so that users don't get a deprecation message. Signed-off-by: Dan Yeaw <dan@yeaw.me>
* gdk overrides: Fix wrapping of scroll eventsPovilas Kanapickas2020-04-171-0/+1
|
* gtktemplate: Do not crash on multiple init_template callsJean Felder2020-04-171-1/+1
| | | | | | | | | | | | | | | | | init_template method is automatically called when a widget is created and it is not supposed to be called multiple times. That is why this method is turned into a no-op after its first call via a lambda function. init_template can still be called after a widget creation (and it is supposed to do nothing). However, a second call will result in a crash because the lambda function has a parameter while init_template is not supposed to have any parameter. This issue is fixed by removing the parameter of the lambda function. A new test is also added to assert that a second init_template call does nothing.
* gtk overrides: Fix template hierarchy issueJean Felder2020-04-171-4/+9
| | | | | | | | | | | | | | | | | | | | When a widget is inside a template it is created through a g_object_new and does not have a python wrapper when pygobject__g_instance_init is called. In that case, a wrapper is created and the "__init__" method is called to instantiate it. Then, "init_template" is called to init its own template (if it exists). However, "init_template" needs to be called before the object constructor in order to create and instantiate all its children, signals and properties. This issue is fixed by calling init_template before the contructor if the python object has been created through g_object_new. A new test for the template hierarchy is added (based on an example from Marinus Schraal). Closes: #257, #386
* gimodule: Remove trailing whitespacesJean Felder2020-04-161-8/+8
|
* Rename PYGLIB_DEFINE_TYPE to PYGI_DEFINE_TYPEChristoph Reiter2020-04-1618-42/+42
| | | | This is a leftover from when things were split up
* Remove PYGOBJECT_REGISTER_GTYPEChristoph Reiter2020-04-166-31/+67
| | | | Less macro magic
* Remove PYGLIB_REGISTER_TYPEChristoph Reiter2020-04-166-16/+34
| | | | Less macro magic
* Remove all Python 2 C codeChristoph Reiter2020-04-1635-670/+346
|
* Remove all Python 2 Python codeChristoph Reiter2020-04-1515-144/+21
|
* Gtk overrides: make sure TreeModelSort.new_with_model and ↵Christoph Reiter2020-03-171-0/+12
| | | | | | | | | TreeModel.sort_new_with_model exist In https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/1134 the method was changed to a constructor which means the API is different between older and newer gtk. Add fallbacks for both in our overrides so both ways work all the time.
* gtk overrides: Drop Gtk.main for Gtk4Jean Felder2020-03-161-13/+11
| | | | | | | It has been removed (gtk commit 4dd780a96b1d37903ab88a4ae4536329cd9e164e) The associated tests are updated or skipped for Gtk 4.
* gtk overrides: Drop ToolButton for Gtk4Jean Felder2020-03-161-7/+7
| | | | | | | It has been removed (gtk commit 44e153d8a8679633681dd3ae2029735255e4f839). The associated test is removed.
* gtk overrides: Drop Menu, MenuItem for Gtk 4Marinus Schraal2020-01-211-8/+8
| | | | These API's have been removed (gtk commit 7ee5779efcf5).
* pygobject-object: Avoid checking whether NULL is floatingAlexandru Băluț2020-01-201-1/+3
| | | | This issue was introduced in a102f046a178472278522e3e9d7c0b40ecd52ade.
* CI: Use gnome-master for testing with gtk4Christoph Reiter2019-10-191-13/+15
| | | | | | | | This makes it easier to track upstream changes without us having to rebuild docker images. Downside is that we don't control it and API is still changing, so allow the job to fail.
* Port to g_object_new_with_properties()Christoph Reiter2019-10-043-37/+87
| | | | | | | | g_object_newv() and GParameter are deprecated now. Replace all GParameter usage with a separate GValue and char* array and add a compatibility function for g_object_new_with_properties() that also works with older glib and converts things back to GParameter.
* Avoid various new glib deprecation warningsChristoph Reiter2019-10-044-6/+18
| | | | | This should make things build with -Werror again once we port things to g_object_new_with_properties()
* Make pygobject_prepare_construct_properties() staticChristoph Reiter2019-10-042-5/+1
| | | | It's not used anywhere else atm
* Make PyGIDeprecationWarning always inherit from DeprecationWarningChristoph Reiter2019-08-181-10/+0
| | | | | | | | | | | To make deprecation warnings more visible we made it inherit from RuntimeWarning with unstable releases and DeprecationWarning for stabel releases. This is a bit confusing when being flooded with warnings when testing under jhbuild etc. Also recent pytest has changed to show deprecation warnings triggered during tests, so the warnings should be more visible now for devs using pytest. This changes it to inherit from DeprecationWarning always again.
* pygobject-object: fix refcount of floating return valuesMathieu Duponchelle2019-08-111-1/+8
| | | | | | | | | When g_signal_emitv returns a floating reference as the return value, which we end up ref_sinking, do not unset the GValue, as we've taken ownership from it and don't want it to drop its reference. Adds a test that highlights the issue
* pygobject: ignore GParameter deprecationsChristian Hergert2019-08-061-0/+2
| | | | | | | Consumers of this API will get GParameter notifications elsewhere in their code when using GParameter. Since it needs to be around for compatibility API, we can safely ignore it here and save consuming applications some duplicated deprecation warnings.
* variant: Create a tuple directlyMathieu Bridon2019-07-231-3/+2
| | | | | | This avoids iterating twice: once to create the list with a list-comprehension and a second time to transform that list into a tuple.
* variant: Define the LEAF_ACCESSORS globallyMathieu Bridon2019-07-231-17/+18
| | | | | | | | This saves a bit of work, instead of defining the dictionary every time the method is called. Unpacking many GVariants in a loop, this shaved roughly 17% of the total time.
* variant: Get the type string only once when unpackingMathieu Bridon2019-07-231-7/+9
| | | | | This saves a bit of work. Unpacking many GVariants in a loop, this shaved roughly 6% of the total time.
* Don't use PyTypeObject.tp_print with Python 3Christoph Reiter2019-06-071-1/+4
| | | | | | It was only used with Python 2 and unused/reserved with Python 3. Python 3.8 has renamed the slot and is now using it for something different which breaks our build.
* pygi-array: fix leak of transfer-full/container C arrays. Fixes #322Christoph Reiter2019-04-191-1/+1
| | | | | | We did not free the array passed to us after marshalling, only the helper garray. Patch by Tomasz Miąsko
* pygi_error_marshal_to_py: Fix error return handling. Fixes #315Christoph Reiter2019-03-251-14/+13
| | | | | | | | | It returned NULL in case no error was set or if creating the error result failed and this wasn't checked by the callers. Change it to return Py_None in case no error was set and NULL in case of an error. In pygi_error_check() we can't really forward the error, so just print it and raise RuntimeError instead.
* pygi-info: remove some dead code. Fixes #303Christoph Reiter2019-03-241-21/+6
| | | | | _pygi_g_registered_type_info_check_object() is never called with is_instance=FALSE.
* Add cairo_matrix_t converter to GValue.Renato Florentino Garcia2019-02-221-0/+34
|
* Add Cairo Pattern foreign struct.Renato Florentino Garcia2019-02-211-0/+53
|
* GTK+ -> GTKChristoph Reiter2019-02-132-5/+5
|
* gtk: raise in case Gtk.Window is instantiated after init failed. See #298Christoph Reiter2019-01-281-4/+12
| | | | | | | | | gtk crashes if gtk_init() fails and we can't do much about it. This assumes the Gtk.Window() is the first instantiated widget and raises an exception in case init failed. We already had such a check but it was removed in 86a37d67455d for some reason (maybe because it only helps in some cases)
* Merge branch 'warn-init-dbus-boxed-info-types' into 'master'Christoph Reiter2019-01-191-9/+68
|\ | | | | | | | | | | | | gio overrides: emit a warning when creating various dbus types without a constructor. Fixes #15 Closes #15 See merge request GNOME/pygobject!107
| * gio overrides: emit a warning when creating various dbus types without a ↵Christoph Reiter2019-01-181-9/+68
| | | | | | | | | | | | | | | | constructor. Fixes #15 We zero slice allocate them and the boxed copy/free functions don't handle that. They just use ref counting which leads to double free because we start with a zero refcount and the free funcs use g_free() while we allocate it with g_slice_alloc().
* | Value.get/set_value: use _gvalue_get/set in more casesChristoph Reiter2019-01-191-70/+23
| | | | | | | | | | | | | | It's a bit faster and is a good chance to make sure both marshalling paths behave the same and add some tests. No functional change intended.
* | Value.set_value: allow None for TYPE_STRINGChristoph Reiter2019-01-191-2/+2
| | | | | | | | set_string() allows it too
* | basic: allow None for boolean parametersChristoph Reiter2019-01-191-0/+2
| | | | | | | | | | It already allows everything which can be passed to bool() except None. I don't see a good reason for that so allow None as well.
* | GObject.Value: add a static helper for fetching the GTypeChristoph Reiter2019-01-184-5/+30
| | | | | | | | | | | | | | | | The field marshalling code is slow and doesn't do any caching at all which in turn makes accessing Value.g_type slow. Add a static helper function for fetching the GType and use that instead. This reduced the time for creating a GValue + setting it by ~30%
* | GObject.Value: deprecate calling get/set_boxed on a non-boxed valueChristoph Reiter2019-01-181-0/+6
|/ | | | | This wasn't documented but worked in most cases. Make sure no-one is depending on it in the long run.
* Remove GObject.Value.__del__Christoph Reiter2019-01-152-17/+4
| | | | | | We can move this into tp_dealloc now. Only call unset() in the slice allocate case since g_boxed_free() will do it anyway.
* boxed: remove __del__ implementation and free in tp_deallocChristoph Reiter2019-01-153-23/+24
| | | | | | | | | | | | This allows us to assume that the wrapper is always valid and remove the _is_valid attribute. One difference now is that g_boxed_free() is called when the wrapper can no longer be used and that breaks the custom glib sources where g_boxed_free() triggers the finalize callback which tries to call into a method of the wrapper. To work around this provide a _clear_boxed() method which allows the wrapper to free the underlying boxed in __del__ where the wrapper is still usable.
* boxed: don't look up the gtype in tp_dealloc, we already know itChristoph Reiter2019-01-151-3/+1
|
* boxed: hide the PyGIBoxed structChristoph Reiter2019-01-152-5/+7
|
* Merge branch 'wrap-struct-find' into 'master'Christoph Reiter2018-12-151-0/+14
|\ | | | | | | | | pygi-info: wrap g_struct_info_find_method() and g_struct_info_find_field() See merge request GNOME/pygobject!104
| * pygi-info: wrap g_struct_info_find_method() and g_struct_info_find_field()Christoph Reiter2018-12-121-0/+14
| | | | | | | | Because why not.
* | Merge branch 'use-struct-info-find-field' into 'master'Christoph Reiter2018-12-151-16/+6
|\ \ | | | | | | | | | | | | Start using g_struct_info_find_field() See merge request GNOME/pygobject!103
| * | Start using g_struct_info_find_field()Christoph Reiter2018-12-121-16/+6
| |/ | | | | | | | | | | | | Instead of iterating over the fields ourselves. g_struct_info_find_field() was added for libgirepository 1.46: https://gitlab.gnome.org/GNOME/gobject-introspection/commit/cf6ea68018 We now depend on 1.46 so start using it.
* | pygi-info: wrap g_union_info_get_alignment()Tomasz Miąsko2018-12-141-0/+7
|/ | | | | Aligment is useful when validating ABI against C. It is already wrapped for structs, wrap it for unions as well.
* gtk: Fix rows getting inserted on the wrong level if parent=None. Fixes #281Christoph Reiter2018-11-301-0/+4
| | | | | | | | | | TreeStore.insert_before allows passing parent as None in which case the parent is derived from the sibling. The new code using insert_with_values() didn't take this into account and simply passed the None along resulting in the row always getting added at the toplevel. Fix this by always passing a parent iter to insert_with_values() except when sibling is also None and we want to add to the toplevel anyway.