From c9b0abf61022d55866bba65302708dfda65a57d1 Mon Sep 17 00:00:00 2001 From: Francesco Marella Date: Tue, 22 Jun 2010 12:46:45 +0200 Subject: Disable autostart menu item when the desktop file can't be found --- src/gtk-redshift/statusicon.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/gtk-redshift/statusicon.py') diff --git a/src/gtk-redshift/statusicon.py b/src/gtk-redshift/statusicon.py index 24f02da..8019ad4 100644 --- a/src/gtk-redshift/statusicon.py +++ b/src/gtk-redshift/statusicon.py @@ -67,9 +67,15 @@ def run(): status_menu.append(toggle_item) autostart_item = gtk.CheckMenuItem(_('Autostart')) - autostart_item.set_active(utils.get_autostart()) - autostart_item.connect('activate', autostart_cb) - status_menu.append(autostart_item) + try: + autostart_item.set_active(utils.get_autostart()) + except IOError as strerror: + print strerror + autostart_item.set_property('sensitive', False) + else: + autostart_item.connect('activate', autostart_cb) + finally: + status_menu.append(autostart_item) quit_item = gtk.ImageMenuItem(gtk.STOCK_QUIT) quit_item.connect('activate', destroy_cb) -- cgit v1.2.3-70-g09d2