After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 645258 - Add gtk_text_iter_assign API
Add gtk_text_iter_assign API
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: GtkTextView
3.1.x
Other Linux
: Normal normal
: Small API
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2011-03-19 20:00 UTC by jessevdk@gmail.com
Modified: 2011-08-15 13:37 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Add gtk_text_iter_assign (1.50 KB, patch)
2011-03-19 20:00 UTC, jessevdk@gmail.com
none Details | Review

Description jessevdk@gmail.com 2011-03-19 20:00:58 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.
Comment 1 Matthias Clasen 2011-03-21 11:41:55 UTC
Review of attachment 183813 [details] [review]:

That seems silly. Whats next, g_int_assign ?
Comment 2 johnp 2011-03-21 15:08:17 UTC
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.
Comment 3 Owen Taylor 2011-03-21 15:15:20 UTC
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.
Comment 4 jessevdk@gmail.com 2011-03-22 13:49:33 UTC
Ok, well, we'll go ahead and fix this in gedit typelib then.
Comment 5 Paolo Borelli 2011-03-22 15:02:04 UTC
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.
Comment 6 Matthias Clasen 2011-08-15 13:01:29 UTC
Still not a fan, but if it helps bindings, go for it.
It is a pretty harmless (if pointless) function, after all...
Comment 7 Paolo Borelli 2011-08-15 13:37:42 UTC
pushed