def save(self): # Update daemon config file # Make a new Config object fileConfig = Config(self.fileName, load=False) # Copy values that could be changed to the new Config object and convert representation ro = self.get('read-only', False) fileConfig['read-only'] = '' if ro else None fileConfig['overwrite'] = '' if self.get('overwrite', False) and ro else None fileConfig['startonstartofindicator'] = self.get( 'startonstartofindicator', True) fileConfig['stoponexitfromindicator'] = self.get( 'stoponexitfromindicator', False) exList = self.get('exclude-dirs', None) fileConfig['exclude-dirs'] = (None if exList is None else ', '.join(v for v in CVal(exList))) # Store changed values fileConfig.save() self.changed = False
# Remove daemon if it is in the current list if args.rcfg: args.rcfg = expanduser(args.rcfg) if args.rcfg in daemons: daemons.remove(args.rcfg) APPCONF.changed = True # Check that at least one daemon is in the daemons list if not daemons: sysExit( _('No daemons specified.\nCheck correctness of -r and -c options.') ) # Update config if daemons list has been changed if APPCONF.changed: APPCONF['daemons'] = CVal(daemons).get() # Update configuration file APPCONF.save() # Make indicator objects for each daemon in daemons list APPINDICATORS = [] for dm in daemons: APPINDICATORS.append( Indicator( dm, _('#%d ') % len(APPINDICATORS) if len(daemons) > 1 else '')) # Register the SIGINT/SIGTERM handler for graceful exit when indicator is killed unix_signal_add(PRIORITY_HIGH, SIGINT, appExit) unix_signal_add(PRIORITY_HIGH, SIGTERM, appExit) # Start GTK Main loop Gtk.main()