GNOME Bugzilla – Bug 684515
GTK: Cannot edit some fields at GtkStockItem
Last modified: 2012-09-21 09:07:43 UTC
Just trying to create a StockItem from scratch I got a similar error, now I identified I can't change some fields. Here you can see the possible bug: Python 2.7.3 (default, Jul 24 2012, 10:05:38) [GCC 4.7.0 20120507 (Red Hat 4.7.0-5)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from gi.repository import Gtk >>> add = Gtk.stock_lookup('gtk-add') >>> add.keyval 0L >>> add.keyval = 1 >>> add.keyval 1L >>> add.label '_Add' >>> add.label = "other-text" Traceback (most recent call last):
+ Trace 230881
>>>
Confirmed. Analysis: pygobject attempts to do the right thing but it comes down to g_field_info_set_field not working for strings, see: http://developer.gnome.org/gi/stable/gi-GIFieldInfo.html#g-field-info-set-field Code in: gi/pygi-info.c:_wrap_g_field_info_set_value The docs say any field which requires memory management needs a specific setter. This basically cannot work unless one of the following happens: 1. A new method for setting a StockItems label field is created with annotations. 2. An attempt could be made to fix this generically with gi in which fields could be annotated to specify memory management. 3. Hack it using ctypes
A request was already logged in gtk+ for adding s gtk_stock_item_new function: https://bugzilla.gnome.org/show_bug.cgi?id=652697
Resolving as there is not anything we can do on the pygobject side of things. *** This bug has been marked as a duplicate of bug 652697 ***