statusicon: Only add autostart control when supported

This commit is contained in:
Jon Lund Steffensen
2017-07-30 20:21:52 -07:00
parent 7e9886cd68
commit d84e7b1b3f
+11 -10
View File
@@ -87,16 +87,17 @@ class RedshiftStatusIcon(object):
self.status_menu.append(suspend_menu_item)
# Add autostart option
autostart_item = Gtk.CheckMenuItem.new_with_label(_('Autostart'))
try:
autostart_item.set_active(utils.get_autostart())
except IOError as strerror:
print(strerror)
autostart_item.set_property('sensitive', False)
else:
autostart_item.connect('toggled', self.autostart_cb)
finally:
self.status_menu.append(autostart_item)
if utils.supports_autostart():
autostart_item = Gtk.CheckMenuItem.new_with_label(_('Autostart'))
try:
autostart_item.set_active(utils.get_autostart())
except IOError as strerror:
print(strerror)
autostart_item.set_property('sensitive', False)
else:
autostart_item.connect('toggled', self.autostart_cb)
finally:
self.status_menu.append(autostart_item)
# Add info action
info_item = Gtk.MenuItem.new_with_label(_('Info'))