ability to load transport iconsets from ~/.gajim/iconsets/transports. Fixes #3390

This commit is contained in:
Yann Leboulanger 2007-08-22 22:46:31 +00:00
parent 77eabc215d
commit 2419bd509c
4 changed files with 44 additions and 31 deletions

View File

@ -1050,3 +1050,11 @@ def get_iconset_path(iconset):
return os.path.join(gajim.DATA_DIR, 'iconsets', iconset)
elif os.path.isdir(os.path.join(gajim.MY_ICONSETS_PATH, iconset)):
return os.path.join(gajim.MY_ICONSETS_PATH, iconset)
def get_transport_path(transport):
if os.path.isdir(os.path.join(gajim.DATA_DIR, 'iconsets', 'transports',
transport)):
return os.path.join(gajim.DATA_DIR, 'iconsets', 'transports', transport)
elif os.path.isdir(os.path.join(gajim.MY_ICONSETS_PATH, 'transports',
transport)):
return os.path.join(gajim.MY_ICONSETS_PATH, 'transports', transport)

View File

@ -191,12 +191,12 @@ def notify(event, jid, account, parameters, advanced_notif_num = None):
transport_name = gajim.get_transport_name_from_jid(jid)
img = None
if transport_name:
img = os.path.join(gajim.DATA_DIR, 'iconsets',
'transports', transport_name, '48x48', show_image)
img = os.path.join(helpers.get_transport_path(transport_name),
'48x48', show_image)
if not img or not os.path.isfile(img):
iconset = gajim.config.get('iconset')
img = os.path.join(gajim.DATA_DIR, 'iconsets',
iconset, '48x48', show_image)
img = os.path.join(helpers.get_iconset_path(iconset), '48x48',
show_image)
path = gtkgui_helpers.get_path_to_generic_or_avatar(img,
jid = jid, suffix = suffix)
if event == 'status_change':

View File

@ -4439,10 +4439,13 @@ class RosterWindow:
# standard transport iconsets are loaded one time in init()
t_path = os.path.join(gajim.DATA_DIR, 'iconsets', 'transports')
folders = os.listdir(t_path)
t_path = os.path.join(gajim.MY_ICONSETS_PATH, 'transports')
folders += os.listdir(t_path)
for transport in folders:
if transport == '.svn':
continue
folder = os.path.join(t_path, transport, '16x16')
folder = os.path.join(helpers.get_transport_path(transport),
'16x16')
self.transports_state_images['opened'][transport] = \
self.load_iconset(folder, pixo, transport = True)
self.transports_state_images['closed'][transport] = \
@ -5146,13 +5149,15 @@ class RosterWindow:
path = os.path.join(gajim.DATA_DIR, 'iconsets', 'transports')
folders = os.listdir(path)
path = os.path.join(gajim.MY_ICONSETS_PATH, 'transports')
folders += os.listdir(path)
for transport in folders:
if transport == '.svn':
continue
folder = os.path.join(path, transport, '32x32')
folder = os.path.join(helpers.get_transport_path(transport), '32x32')
self.transports_state_images['32'][transport] = self.load_iconset(
folder, transport = True)
folder = os.path.join(path, transport, '16x16')
folder = os.path.join(helpers.get_transport_path(transport), '16x16')
self.transports_state_images['16'][transport] = self.load_iconset(
folder, transport = True)

View File

@ -436,8 +436,8 @@ class RosterTooltip(NotificationAreaTooltip):
transport = gajim.get_transport_name_from_jid(
prim_contact.jid)
if transport:
file_path = os.path.join(gajim.DATA_DIR, 'iconsets',
'transports', transport , '16x16')
file_path = os.path.join(helpers.get_transport_path(transport),
'16x16')
else:
iconset = gajim.config.get('iconset')
if not iconset: