Since gnome-terminal now seems to set a global key with the list of profiles it knows about, we don't need to walk the profile directory ourselves, which seems like a good plan

This commit is contained in:
Chris Jones 2007-12-16 17:11:22 +00:00
parent ec51a1e865
commit 71f07637ac
1 changed files with 9 additions and 5 deletions

View File

@ -38,7 +38,8 @@ class TerminatorTerm:
# Our settings # Our settings
# FIXME: Add commandline and/or gconf options to change these # FIXME: Add commandline and/or gconf options to change these
defaults = { defaults = {
'profile_dir' : '/apps/gnome-terminal/profiles', 'gt_dir' : '/apps/gnome-terminal',
'_profile_dir' : '%s/profiles',
'allow_bold' : True, 'allow_bold' : True,
'audible_bell' : False, 'audible_bell' : False,
'background' : None, 'background' : None,
@ -69,16 +70,19 @@ class TerminatorTerm:
matches = {} matches = {}
def __init__ (self, term, profile): def __init__ (self, term, profile):
self.defaults['profile_dir'] = self.defaults['_profile_dir']%(self.defaults['gt_dir'])
self.defaults['link_user'] = self.defaults['_link_user']%(self.defaults['link_userchars'], self.defaults['link_passchars']) self.defaults['link_user'] = self.defaults['_link_user']%(self.defaults['link_userchars'], self.defaults['link_passchars'])
self.term = term self.term = term
self.gconf_client = gconf.client_get_default () self.gconf_client = gconf.client_get_default ()
self.profile = None self.profile = None
for dir in self.gconf_client.all_dirs(self.defaults['profile_dir']): profiles = self.gconf_client.get_list (self.defaults['gt_dir'] + '/global/profile_list', 'string')
if self.gconf_client.get_string (dir + "/visible_name") == profile:
self.profile = dir for item in profiles:
break if item == profile:
self.profile = '%s/%s'%(self.defaults['profile_dir'], item)
break
if self.profile == None: if self.profile == None:
print "Error, unable to find profile " + profile print "Error, unable to find profile " + profile