diff options
author | Mattias Andrée <maandree@operamail.com> | 2014-03-13 01:52:36 +0100 |
---|---|---|
committer | Jon Lund Steffensen <jonlst@gmail.com> | 2014-03-23 00:52:32 +0100 |
commit | 3eac70572da1c97ab1d98551b41752dd11d92465 (patch) | |
tree | d0ad6e10d5b1e2c66d2dfc8915bcde88b17df99f /src/redshift-gtk/statusicon.py | |
parent | Merge pull request #46 from maandree/gamma (diff) | |
download | redshift-ng-3eac70572da1c97ab1d98551b41752dd11d92465.tar.gz redshift-ng-3eac70572da1c97ab1d98551b41752dd11d92465.tar.bz2 redshift-ng-3eac70572da1c97ab1d98551b41752dd11d92465.tar.xz |
Fix #40: redshift-gtk: toggle_item is checkbox that follows the icon
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src/redshift-gtk/statusicon.py')
-rw-r--r-- | src/redshift-gtk/statusicon.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/redshift-gtk/statusicon.py b/src/redshift-gtk/statusicon.py index 6877eac..5685f08 100644 --- a/src/redshift-gtk/statusicon.py +++ b/src/redshift-gtk/statusicon.py @@ -78,9 +78,9 @@ class RedshiftStatusIcon(object): self.status_menu = Gtk.Menu() # Add toggle action - toggle_item = Gtk.MenuItem.new_with_label(_('Toggle')) - toggle_item.connect('activate', self.toggle_cb) - self.status_menu.append(toggle_item) + self.toggle_item = Gtk.CheckMenuItem.new_with_label(_('Enabled')) + self.toggle_item.connect('activate', self.toggle_cb) + self.status_menu.append(self.toggle_item) # Add suspend menu suspend_menu_item = Gtk.MenuItem.new_with_label(_('Suspend for')) @@ -215,8 +215,10 @@ class RedshiftStatusIcon(object): self.status_icon, button, time) def toggle_cb(self, widget, data=None): - self.remove_suspend_timer() - self.child_toggle_status() + # Only toggle if a change from current state was requested + if self.is_enabled() != widget.get_active(): + self.remove_suspend_timer() + self.child_toggle_status() # Info dialog callbacks def show_info_cb(self, widget, data=None): @@ -243,8 +245,8 @@ class RedshiftStatusIcon(object): def change_status(self, status): self._status = status - # TODO make toggle_item a checkbox and follow the state like the icon. self.update_status_icon() + self.toggle_item.set_active(self.is_enabled()) self.status_label.set_markup('<b>{}:</b> {}'.format(_('Status'), _('Enabled') if status else _('Disabled'))) |