bug with "enum" initalization
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
gDesklets |
Fix Released
|
Medium
|
Bjoern Koch |
Bug Description
I'm talking about config/
When the enum is being initialized, the code does this:
self.
self.
From what I understood, this code is meant to force a "change event", which will trigger the script callbacks.
According to gtk's manual [0], the "-1" position means "inactive".
But here is the problem:
If you look at the __on_change function (inside the same file), it has something like this:
value = self.__
BUT: get_active() returns "-1", so the last element on that list is returned (because in Python, the last element of a list has index "-1"). This is wrong, because the enum is inactive! The way it is now, when the enum is being initialized, its last option will always be "selected" before the correct option is set. And this behavior causes bugs in the applet I'm debugging.
The solution:
The __on_change function needs to check if the "enum" is active or inactive before doing anything, so, replace this line (inside __on_change function, same file):
if (self._
with this line:
if (self._
This way, when the item is changed to "inactive" (index -1), we won't act as if it was changed to the "last item".
[0]: http://
Thanks for the patch! Fix committed in revision 123.
Is there the same problem in ConfigList and ConfigToggle ?