Don't set image on button if it is still the same
It fixes also a strange behavior of GTK that doesn't display any images if the icon is changed before it is realized. issue3191 review1451002 (transplanted from 4bc44691dc89dfd7802c9d84bbb466f98038bb75)
This commit is contained in:
1 parent
89c98fd899
commit
45f4acf858
1 file changed
+5
@@ -17,6 +17,11 @@ class Button(gtk.Button):
|
||||
self._set_icon(attrs.get('icon'))
|
||||
|
||||
def _set_icon(self, stock):
|
||||
image = self.get_image()
|
||||
if not image and not stock:
|
||||
return
|
||||
elif image and image.get_stock()[0] == stock:
|
||||
return
|
||||
if not stock:
|
||||
self.set_image(gtk.Image())
|
||||
return
|
||||
|
||||
Reference in new issue
Block a user