Fix GNOME Terminal profile loading. Patch from Y W Sing. Closes LP #304016

This commit is contained in:
Chris Jones 2009-01-14 22:57:24 +00:00
parent 45e83bd4b5
commit 2d57b7888d
1 changed files with 18 additions and 8 deletions

View File

@ -333,7 +333,7 @@ class TerminatorConfValuestoreGConf (TerminatorConfValuestore):
client = None client = None
cache = {} cache = {}
def __init__ (self, profile = None): def __init__ (self, profileName = None):
self.type = "GConf" self.type = "GConf"
self.inactive = False self.inactive = False
@ -345,15 +345,22 @@ class TerminatorConfValuestoreGConf (TerminatorConfValuestore):
self._gt_dir = Defaults['gt_dir'] self._gt_dir = Defaults['gt_dir']
self._profile_dir = Defaults['profile_dir'] self._profile_dir = Defaults['profile_dir']
dbg ('VSGConf: Profile requested is: "%s"'%profile) dbg ('VSGConf: Profile bet on is: "%s"'%profileName)
if not profile:
profile = self.client.get_string (self._gt_dir + '/global/default_profile')
dbg ('VSGConf: Profile bet on is: "%s"'%profile)
profiles = self.client.get_list (self._gt_dir + '/global/profile_list','string') profiles = self.client.get_list (self._gt_dir + '/global/profile_list','string')
dbg ('VSGConf: Found profiles: "%s"'%profiles) dbg ('VSGConf: Found profiles: "%s"'%profiles)
#set up the active encoding list dbg ('VSGConf: Profile requested is: "%s"'%profileName)
self.active_encodings = self.client.get_list (self._gt_dir + '/global/active_encodings', 'string') if not profileName:
profile = self.client.get_string (self._gt_dir + '/global/default_profile')
else:
profile = profileName
# In newer gnome-terminal, the profile keys are named Profile0/1 etc.
# We have to match using visible_name instead
for p in profiles:
profileName2 = self.client.get_string (
self._profile_dir + '/' + p + '/visible_name')
if profileName == profileName2:
profile = p
#need to handle the list of Gconf.value #need to handle the list of Gconf.value
if profile in profiles: if profile in profiles:
@ -369,6 +376,9 @@ class TerminatorConfValuestoreGConf (TerminatorConfValuestore):
self.inactive = True self.inactive = True
return return
#set up the active encoding list
self.active_encodings = self.client.get_list (self._gt_dir + '/global/active_encodings', 'string')
self.client.add_dir (self.profile, gconf.CLIENT_PRELOAD_RECURSIVE) self.client.add_dir (self.profile, gconf.CLIENT_PRELOAD_RECURSIVE)
if self.on_gconf_notify: if self.on_gconf_notify:
self.client.notify_add (self.profile, self.on_gconf_notify) self.client.notify_add (self.profile, self.on_gconf_notify)