GNOME Bugzilla – Bug 645258
Add gtk_text_iter_assign API
Last modified: 2011-08-15 13:37:42 UTC
Created attachment 183813 [details] [review] Add gtk_text_iter_assign Please consider adding gtk_text_iter_assign API which basicly does *iter = *other. Currently it is not possible to have introspected bindings that support iter assignment automatically. This for example breaks gedit python plugins that modify text in the insert-text handler (they must reinitialize the iter, but they can't). Patch attached.
Review of attachment 183813 [details] [review]: That seems silly. Whats next, g_int_assign ?
so in PyGObject 3 we are going to break that API anyway so that you just return the new iter and it should be correctly assigned to the out value. We need to break support for the static bindings to do that successfully and we ran out of time to fix in stable as today is the GNOME 3 freeze so might as well make it look like a workaround that will have to be updated when we release gi3. It sucks but we need another cycle to work out all the lowlevel GI edge cases as people start to use it more. Solution is to add the functionality you need to the GEdit typelib for now. Mattias, we should take a hard look at the binability of API that use a lot of opaque structs (iters, attrs and the like), at least as you guys start to develop GTK4.
Bug 481715 has background about why this was an important to emulate in pygtk. I don't think it's natural for a language binding to automatically implement a mutating-deep-assignment to an opaque boxed structure. Either we need to add this, or we are requiring every language binding to add overrides to the same purpose.
Ok, well, we'll go ahead and fix this in gedit typelib then.
Let's add the short-term hack to the gedit typelib for 3.0, but I am reassigning this to gtk since as Owen said if we do not provide it there we need to duplicate the hack in every binding.
Still not a fan, but if it helps bindings, go for it. It is a pretty harmless (if pointless) function, after all...
pushed