diff options
author | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2006-11-14 05:26:15 +0000 |
---|---|---|
committer | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2006-11-14 05:26:15 +0000 |
commit | f6f2d72eb62b4bf5b79dc19ccdcbf532d8cab784 (patch) | |
tree | f9a4a46916c45268981416f4d69d396eda420e19 | |
parent | 12b9a5ea34d808ff94ed0b0f63d042b9d05c9182 (diff) |
made the default directory of file selection dialog document folder.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@1300 ee746299-78ed-0310-b773-934348b2243d
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | ChangeLog.ja | 7 | ||||
-rw-r--r-- | libsylph/utils.c | 35 | ||||
-rw-r--r-- | libsylph/utils.h | 1 | ||||
-rw-r--r-- | src/filesel.c | 2 |
5 files changed, 52 insertions, 1 deletions
@@ -1,5 +1,13 @@ 2006-11-14 + * libsylph/utils.[ch]: added get_document_dir() which returns the + document directory (in Win32, it is 'My Documents'. In Unix, it is + home directory). + * src/filesel.c: filesel_select_file_full(): made the default directory + document folder. + +2006-11-14 + * src/addressadd.c: removed statusbar. 2006-11-13 diff --git a/ChangeLog.ja b/ChangeLog.ja index c1a02402..539bcaaa 100644 --- a/ChangeLog.ja +++ b/ChangeLog.ja @@ -1,5 +1,12 @@ 2006-11-14 + * libsylph/utils.[ch]: ドキュメントディレクトリを返す get_document_dir() + を追加(Win32 では 'マイ ドキュメント'、 Unix ではホームディレクトリ)。 + * src/filesel.c: filesel_select_file_full(): デフォルトのディレクトリを + ドキュメントフォルダにした。 + +2006-11-14 + * src/addressadd.c: ステータスバーを削除。 2006-11-13 diff --git a/libsylph/utils.c b/libsylph/utils.c index 9992de51..5e21fa60 100644 --- a/libsylph/utils.c +++ b/libsylph/utils.c @@ -46,6 +46,7 @@ # include <wchar.h> # include <direct.h> # include <io.h> +# include <shlobj.h> #endif #include "utils.h" @@ -1832,6 +1833,40 @@ const gchar *get_home_dir(void) #endif } +const gchar *get_document_dir(void) +{ +#ifdef G_OS_WIN32 + static const gchar *document_dir = NULL; + HRESULT hr; + + if (!document_dir) { + if (G_WIN32_HAVE_WIDECHAR_API()) { + wchar_t path[MAX_PATH + 1]; + hr = SHGetFolderPathW(NULL, CSIDL_PERSONAL, NULL, 0, + path); + if (hr == S_OK) { + document_dir = g_utf16_to_utf8 + (path, -1, NULL, NULL, NULL); + } + } else { + gchar path[MAX_PATH + 1]; + hr = SHGetFolderPathA(NULL, CSIDL_PERSONAL, NULL, 0, + path); + if (hr == S_OK) { + document_dir = g_locale_to_utf8 + (path, -1, NULL, NULL, NULL); + } + } + if (!document_dir) + document_dir = get_home_dir(); + } + + return document_dir; +#else + return get_home_dir(); +#endif +} + const gchar *get_rc_dir(void) { if (!rc_dir) { diff --git a/libsylph/utils.h b/libsylph/utils.h index 1f358ca1..4e699a1d 100644 --- a/libsylph/utils.h +++ b/libsylph/utils.h @@ -368,6 +368,7 @@ void set_rc_dir (const gchar *dir); /* return static strings */ const gchar *get_startup_dir (void); const gchar *get_home_dir (void); +const gchar *get_document_dir (void); const gchar *get_rc_dir (void); const gchar *get_old_rc_dir (void); const gchar *get_mail_base_dir (void); diff --git a/src/filesel.c b/src/filesel.c index d300b7ff..5de4103d 100644 --- a/src/filesel.c +++ b/src/filesel.c @@ -85,7 +85,7 @@ static GSList *filesel_select_file_full(const gchar *title, const gchar *file, if ((cwd = g_hash_table_lookup(path_table, title)) != NULL) change_dir(cwd); else - change_dir(get_startup_dir()); + change_dir(get_document_dir()); dialog = filesel_create(title, action); |