diff --git a/src/common/helpers.py b/src/common/helpers.py index 3571d0384..2a0ced5fc 100644 --- a/src/common/helpers.py +++ b/src/common/helpers.py @@ -1,17 +1,10 @@ ## common/helpers.py ## -## Contributors for this file: -## - Yann Le Boulanger -## - Nikos Kouremenos -## -## Copyright (C) 2003-2004 Yann Le Boulanger -## Vincent Hanquez -## Copyright (C) 2005 Yann Le Boulanger -## Vincent Hanquez -## Nikos Kouremenos +## Copyright (C) 2003-2006 Yann Le Boulanger +## Copyright (C) 2005-2006 Nikos Kouremenos +## Copyright (C) 2005 ## Dimitur Kirov ## Travis Shirk -## Norman Rasmussen ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published @@ -538,7 +531,7 @@ def decode_string(string): def get_windows_reg_env(varname, default=''): '''asks for paths commonly used but not exposed as ENVs - in Windows 2003 those are: + in english Windows 2003 those are: 'AppData' = %USERPROFILE%\Application Data (also an ENV) 'Desktop' = %USERPROFILE%\Desktop 'Favorites' = %USERPROFILE%\Favorites @@ -568,7 +561,7 @@ def get_windows_reg_env(varname, default=''): r'Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders') try: val = str(win32api.RegQueryValueEx(rkey, varname)[0]) - val = win32api.ExpandEnvironmentStrings(v) # expand using environ + val = win32api.ExpandEnvironmentStrings(val) # expand using environ except: pass finally: @@ -578,3 +571,17 @@ r'Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders') def get_my_pictures_path(): '''windows-only atm. [Unix lives in the past]''' return get_windows_reg_env('My Pictures') + +def get_desktop_path(): + if os.name == 'nt': + path = get_windows_reg_env('Desktop') + else: + path = os.path.join(os.path.expanduser('~'), 'Desktop') + return path + +def get_documents_path(): + if os.name == 'nt': + path = get_windows_reg_env('Personal') + else: + path = os.path.expanduser('~') + return path diff --git a/src/filetransfers_window.py b/src/filetransfers_window.py index e1c02e16d..104d04d1b 100644 --- a/src/filetransfers_window.py +++ b/src/filetransfers_window.py @@ -1,8 +1,6 @@ ## filetransfers_window.py ## -## ## Copyright (C) 2003-2006 Yann Le Boulanger -## Copyright (C) 2005-2006 Yann Le Boulanger ## Copyright (C) 2005-2006 Nikos Kouremenos ## Copyright (C) 2005 ## Dimitur Kirov @@ -253,7 +251,7 @@ _('Connection with peer cannot be established.')) if last_send_dir and os.path.isdir(last_send_dir): dialog.set_current_folder(last_send_dir) else: - dialog.set_current_folder(gajim.HOME_DIR) + dialog.set_current_folder(helpers.get_documents_path()) file_props = {} while True: response = dialog.run() @@ -343,10 +341,13 @@ _('Connection with peer cannot be established.')) dialog.connect('confirm-overwrite', self.confirm_overwrite_cb, file_props) gtk28 = True + print last_save_dir if last_save_dir and os.path.isdir(last_save_dir): dialog.set_current_folder(last_save_dir) + print 'set last save', last_save_dir else: - dialog.set_current_folder(gajim.HOME_DIR) + dialog.set_current_folder(helpers.get_desktop_path()) + print 'set desktop', helpers.get_desktop_path() while True: response = dialog.run() if response == gtk.RESPONSE_OK: diff --git a/src/vcard.py b/src/vcard.py index dc1518658..16198709d 100644 --- a/src/vcard.py +++ b/src/vcard.py @@ -1,17 +1,7 @@ ## vcard.py (has VcardWindow class) ## -## Contributors for this file: -## - Yann Le Boulanger -## - Nikos Kouremenos -## -## Copyright (C) 2003-2004 Yann Le Boulanger -## Vincent Hanquez -## Copyright (C) 2005 Yann Le Boulanger -## Vincent Hanquez -## Nikos Kouremenos -## Dimitur Kirov -## Travis Shirk -## Norman Rasmussen +## Copyright (C) 2003-2006 Yann Le Boulanger +## Copyright (C) 2005-2006 Nikos Kouremenos ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published