Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix todo in redshift-gtk: toggle_item is checkbox that follows the icon #40

Closed
wants to merge 1 commit into from

Conversation

maandree
Copy link
Contributor

I have made toggle_item into a CheckMenuItem with the label "Enabled".
Whenever the status is updated toggle_item's active state is set accordingly.
This lead to an loop where setting the active status of toggle_item triggered
the active event that calls toggle_cb which changes the status.
I resolved adding a semaphore (which a thread cannot enter multiple times
concurrently) that is acquired when change the active status if toggle_item,
but also — non-blockingly — around the instructions in toggle_cb.

Signed-off-by: Mattias Andrée <maandree@operamail.com>
@jonls jonls closed this in 3eac705 Mar 22, 2014
@jonls
Copy link
Owner

jonls commented Mar 23, 2014

Thanks, I merged an altered version though. I don't think using semaphores was entirely appropriate when the state could just be checked in toggle_cb().

@maandree maandree deleted the toggle_item branch March 23, 2014 04:33
@maandree
Copy link
Contributor Author

@jonls While your modification does work, I get an error:

ERROR:root:Could not find any typelib for AppIndicator3
Traceback (most recent call last):
  File "/usr/lib/python3.4/site-packages/redshift_gtk/statusicon.py", line 219, in toggle_cb
    if self.is_enabled() != widget.get_active():
AttributeError: 'StatusIcon' object has no attribute 'get_active'

As indicated by the first line, I do not have AppIndicator,
but I do not think that make a difference.

@jonls
Copy link
Owner

jonls commented Apr 10, 2014

Good catch. widget should be self.toggle_item since the callback is also called when the StatusIcon is activated.

@hartwork
Copy link

@jonls
For the traceback reported by @maandree: is there a patch I can apply or a new release made shortly? Either would help me fixing redshift 1.9 in Gentoo Linux.

@maandree
Copy link
Contributor Author

Use commit 9426e9f rather than tag v1.9
when fetching the source code tarball.

Or simply apply the diff you get when you click on that link.

@jonls
Copy link
Owner

jonls commented Apr 13, 2014

@hartwork You can use this as a patch 9426e9f . I'd like to do a 1.9.1 with a few bug fixes, and I think it will be out tomorrow if I can get it done.

@hartwork
Copy link

@jonis
Thanks, the patch looks just like what I wanted. Fixed in Gentoo. No extra hurry for a release from my side any more; don't let that stop you though :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants