Okay, so GNOME/GTK+ doesn’t show icons on buttons anymore unless they are part of a toolbar or you specifically request that they show up. The problem is that because of this, PiTiVi’s play/pause button would end up not showing anything at all. Thus, back then Alessandro inserted this piece of code to force displaying icons on all buttons in PiTiVi.
Being willing to forego my initial disagreement with GNOME’s decision to remove button icons, I’ve been revisiting this problem recently in the hope of better integrating with the rest of the desktop. The problem remained, however, that simply reverting that commit would leave me with some broken buttons in PiTiVi such as the play/pause button and the “clear” buttons in effect properties or the preferences dialog, so I set out to fix that.
Except that my fix for it seems like an ugly hack. This is what I attempted at first:
But then I ran into some sort of silly bug where:
- The “play” icon would not show (I triple-checked the stock icon name, my icon theme, how I was calling it, etc.). Instead of the “play” icon, I’d get the dreaded “image missing” icon.
- The “pause” icon would show without any problems.
- What was even more puzzling: using the “stop” (“STOCK_MEDIA_STOP”) icon instead of the “STOCK_MEDIA_PLAY” icon would work fine.
I ended up finding a way to do what I wanted, but it looks like a stupid hack to me:
Destroying and recreating icons every time? Is there really no better way to do it?
Having been unable to find someone to answer this nerve-racking question on IRC, I now turn to the collective wisdom of the Planet to point out whether or not I’m Doing It Wrong™ and if there is a more elegant way to achieve these results. How would you do it?
Latest posts by Jeff (see all)
- Painting two old friends—Tintin vs Sephiroth - June 11, 2017
- Defence against the Dark Arts involves controlling your hardware - March 18, 2017
- Reviewing the Librem 15 - January 10, 2017