make sure we do not fail if path to iconset no longer exists. fixes #2444

This commit is contained in:
Nikos Kouremenos 2006-09-23 13:58:46 +00:00
parent 65fc27e573
commit 5851230084
2 changed files with 10 additions and 4 deletions

View File

@ -37,6 +37,8 @@ opt_bool = [ 'boolean', 0 ]
opt_color = [ 'color', '^(#[0-9a-fA-F]{6})|()$' ] opt_color = [ 'color', '^(#[0-9a-fA-F]{6})|()$' ]
opt_one_window_types = ['never', 'always', 'peracct', 'pertype'] opt_one_window_types = ['never', 'always', 'peracct', 'pertype']
DEFAULT_ICONSET = 'dcraven'
class Config: class Config:
__options = { __options = {
@ -67,7 +69,7 @@ class Config:
'last_status_msg_invisible': [ opt_str, '' ], 'last_status_msg_invisible': [ opt_str, '' ],
'last_status_msg_offline': [ opt_str, '' ], 'last_status_msg_offline': [ opt_str, '' ],
'trayicon': [ opt_bool, True, '', True ], 'trayicon': [ opt_bool, True, '', True ],
'iconset': [ opt_str, 'dcraven', '', True ], 'iconset': [ opt_str, DEFAULT_ICONSET, '', True ],
'use_transports_iconsets': [ opt_bool, True, '', True ], 'use_transports_iconsets': [ opt_bool, True, '', True ],
'inmsgcolor': [ opt_color, '#a34526', '', True ], 'inmsgcolor': [ opt_color, '#a34526', '', True ],
'outmsgcolor': [ opt_color, '#164e6f', '', True ], 'outmsgcolor': [ opt_color, '#164e6f', '', True ],

View File

@ -3129,9 +3129,13 @@ _('If "%s" accepts this request you will know his or her status.') % jid)
def make_jabber_state_images(self): def make_jabber_state_images(self):
'''initialise jabber_state_images dict''' '''initialise jabber_state_images dict'''
iconset = gajim.config.get('iconset') iconset = gajim.config.get('iconset')
if not iconset: if iconset:
iconset = 'dcraven' path = os.path.join(gajim.DATA_DIR, 'iconsets', iconset, '32x32')
path = os.path.join(gajim.DATA_DIR, 'iconsets', iconset, '32x32') if not os.path.exists(path):
iconset = DEFAULT_ICONSET
else:
iconset = DEFAULT_ICONSET
self.jabber_state_images['32'] = self.load_iconset(path) self.jabber_state_images['32'] = self.load_iconset(path)
path = os.path.join(gajim.DATA_DIR, 'iconsets', iconset, '16x16') path = os.path.join(gajim.DATA_DIR, 'iconsets', iconset, '16x16')