diff --git a/src/common/gajim.py b/src/common/gajim.py index f037453c0..7d5cc02e1 100644 --- a/src/common/gajim.py +++ b/src/common/gajim.py @@ -54,16 +54,19 @@ if os.name == 'nt': LOGPATH = os.path.join(os.environ['appdata'], 'Gajim', 'Logs') # deprecated VCARD_PATH = os.path.join(os.environ['appdata'], 'Gajim', 'Vcards') AVATAR_PATH = os.path.join(os.environ['appdata'], 'Gajim', 'Avatars') + MY_EMOTS_PATH = os.path.join(os.environ['appdata'], 'Gajim', 'Emoticons') except KeyError: # win9x, in cwd LOGPATH = 'Logs' # deprecated VCARD_PATH = 'Vcards' AVATAR_PATH = 'Avatars' + MY_EMOTS_PATH = 'Emoticons' else: # Unices DATA_DIR = '../data' LOGPATH = os.path.expanduser('~/.gajim/logs') # deprecated VCARD_PATH = os.path.expanduser('~/.gajim/vcards') AVATAR_PATH = os.path.expanduser('~/.gajim/avatars') + MY_EMOTS_PATH = os.path.expanduser('~/.gajim/emoticons') HOME_DIR = os.path.expanduser('~') TMP = tempfile.gettempdir() @@ -73,6 +76,7 @@ try: VCARD_PATH = VCARD_PATH.decode(sys.getfilesystemencoding()) TMP = TMP.decode(sys.getfilesystemencoding()) AVATAR_PATH = AVATAR_PATH.decode(sys.getfilesystemencoding()) + MY_EMOTS_PATH = MY_EMOTS_PATH.decode(sys.getfilesystemencoding()) except: pass diff --git a/src/config.py b/src/config.py index b374cd6ae..2a9a6b7d2 100644 --- a/src/config.py +++ b/src/config.py @@ -115,23 +115,24 @@ class PreferencesWindow: # emoticons emoticons_combobox = self.xml.get_widget('emoticons_combobox') emoticons_list = os.listdir(os.path.join(gajim.DATA_DIR, 'emoticons')) + # user themes + if os.path.isdir(gajim.MY_EMOTS_PATH): + emoticons_list += os.listdir(gajim.MY_EMOTS_PATH) renderer_text = gtk.CellRendererText() emoticons_combobox.pack_start(renderer_text, True) emoticons_combobox.add_attribute(renderer_text, 'text', 0) model = gtk.ListStore(str) emoticons_combobox.set_model(model) - l = ['Disabled'] for dir in emoticons_list: if dir != '.svn': l.append(dir) - print l + l.append('Disabled') for i in xrange(len(l)): - print l[i] model.append([l[i]]) if gajim.config.get('emoticons_theme') == l[i]: emoticons_combobox.set_active(i) if not gajim.config.get('emoticons_theme'): - emoticons_combobox.set_active(0) + emoticons_combobox.set_active(len(l)) #iconset iconsets_list = os.listdir(os.path.join(gajim.DATA_DIR, 'iconsets')) diff --git a/src/gajim.py b/src/gajim.py index ee3ee30b9..612a0a367 100755 --- a/src/gajim.py +++ b/src/gajim.py @@ -1419,6 +1419,11 @@ class Interface: if not emot_theme: return path = os.path.join(gajim.DATA_DIR, 'emoticons', emot_theme) + if not os.path.exists(path): + # It's maybe a user theme + path = os.path.join(gajim.MY_EMOTS_PATH, emot_theme) + if not os.path.exists(path): # theme doesn't exists + return sys.path.append(path) from emoticons import emoticons as emots for emot in emots: