Stage two of rerolling the gconf handling. Now we have a proper abstract function that can grab arbitrary values (lists and other types TBC). It just needs to be used directly instead of via the type specific helpers

This commit is contained in:
Chris Jones 2008-01-29 15:18:33 +00:00
parent b0fcd80594
commit cd510b7c78
1 changed files with 35 additions and 7 deletions

View File

@ -68,7 +68,7 @@ class TerminatorTerm:
'background_type' : 'solid', 'background_type' : 'solid',
'backspace_binding' : 'ascii-del', 'backspace_binding' : 'ascii-del',
'delete_binding' : 'delete-sequence', 'delete_binding' : 'delete-sequence',
'cursor_blinks' : False, 'cursor_blink' : False,
'emulation' : 'xterm', 'emulation' : 'xterm',
'font_name' : 'Serif 10', 'font_name' : 'Serif 10',
'foreground_color' : '#AAAAAA', 'foreground_color' : '#AAAAAA',
@ -86,7 +86,7 @@ class TerminatorTerm:
'link_userchars' : '-A-Za-z0-9', 'link_userchars' : '-A-Za-z0-9',
'link_passchars' : '-A-Za-z0-9,?;.:/!%$^*&~"#\'', 'link_passchars' : '-A-Za-z0-9,?;.:/!%$^*&~"#\'',
'_palette' : '%s/palette', '_palette' : '%s/palette',
'default_palette' : '', 'default_palette' : '#000000000000:#CDCD00000000:#0000CDCD0000:#CDCDCDCD0000:#30BF30BFA38E:#A53C212FA53C:#0000CDCDCDCD:#FAFAEBEBD7D7:#404040404040:#FFFF00000000:#0000FFFF0000:#FFFFFFFF0000:#00000000FFFF:#FFFF0000FFFF:#0000FFFFFFFF:#FFFFFFFFFFFF',
'word_chars' : '-A-Za-z0-9,./?%&#:_', 'word_chars' : '-A-Za-z0-9,./?%&#:_',
'mouse_autohide' : True, 'mouse_autohide' : True,
} }
@ -181,17 +181,44 @@ class TerminatorTerm:
self._vte.fork_command (command = shell, argv = args, envv = [], loglastlog = login, logwtmp = update_records, logutmp = update_records) self._vte.fork_command (command = shell, argv = args, envv = [], loglastlog = login, logwtmp = update_records, logutmp = update_records)
def reconf (self, property):
value = self.gconf_client.get ('%s/%s'%(self.profile, property))
ret = None
if not value:
try:
ret = self.defaults[property]
except:
pass
else:
if value.type == gconf.VALUE_STRING:
print "string"
ret = value.get_string ()
elif value.type == gconf.VALUE_INT:
print "int"
ret = value.get_int ()
elif value.type == gconf.VALUE_FLOAT:
print "float"
ret = value.get_float ()
elif value.type == gconf.VALUE_BOOL:
print "bool"
ret = value.get_bool ()
if ret == None:
print _('Unknown value requested. Unable to find in gconf profile or default settings: ') + property
sys.exit (1)
return ret
def reconf_s (self, property): def reconf_s (self, property):
return self.gconf_client.get_string (self.profile + "/" + property) or self.defaults[property] return self.reconf (property)
def reconf_b (self, property): def reconf_b (self, property):
return self.gconf_client.get_bool (self.profile + "/" + property) or self.defaults[property] return self.reconf (property)
def reconf_i (self, property): def reconf_i (self, property):
return self.gconf_client.get_int (self.profile + "/" + property) or self.defaults[property] return self.reconf (property)
def reconf_f (self, property): def reconf_f (self, property):
return self.gconf_client.get_float (self.profile + "/" + property) or self.defaults[property] return self.reconf (property)
def reconfigure_vte (self): def reconfigure_vte (self):
# Set our emulation # Set our emulation
@ -240,6 +267,7 @@ class TerminatorTerm:
self._vte.set_allow_bold (self.reconf_b ('allow_bold')) self._vte.set_allow_bold (self.reconf_b ('allow_bold'))
# Set our color scheme, preferably from gconf settings # Set our color scheme, preferably from gconf settings
# FIXME: This is wrong, we should be pulling 'palette' out of gconf, but reverting to self.defaults['default_palette'] which means we need to reorganise self.defaults to make this available under the same name as gconf
palette = self.reconf_s ('default_palette') palette = self.reconf_s ('default_palette')
if (not self.profile) or self.gconf_client.get_bool (self.profile + "/use_theme_colors"): if (not self.profile) or self.gconf_client.get_bool (self.profile + "/use_theme_colors"):
fg_color = self._vte.get_style ().text[gtk.STATE_NORMAL] fg_color = self._vte.get_style ().text[gtk.STATE_NORMAL]
@ -270,7 +298,7 @@ class TerminatorTerm:
self._vte.set_colors (fg_color, bg_color, palette) self._vte.set_colors (fg_color, bg_color, palette)
# Set our cursor blinkiness # Set our cursor blinkiness
self._vte.set_cursor_blinks = (self.reconf_b ('cursor_blinks')) self._vte.set_cursor_blinks = (self.reconf_b ('cursor_blink'))
# Set our audible belliness # Set our audible belliness
# FIXME: What on earth are we doing here. We should match the profile setting name and try not to set things this way # FIXME: What on earth are we doing here. We should match the profile setting name and try not to set things this way