diff options
-rw-r--r-- | .gitignore | 5 | ||||
-rw-r--r-- | src/redshift-gtk/statusicon.py | 14 |
2 files changed, 13 insertions, 6 deletions
@@ -1,3 +1,7 @@ +# Backup files +*~ +\#*\# + # Object files *.o *.ko @@ -40,6 +44,7 @@ src/redshift-gtk/defs.py src/redshift-gtk/redshift-gtk contrib/redshift.spec src/redshift +src/redshift-gtk/__pycache__/ # gettext /po/POTFILES 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'))) |