From 212887cb7478d45b4a4b8146a9617d1d88e99eae Mon Sep 17 00:00:00 2001 From: hiro Date: Fri, 25 Feb 2011 08:10:00 +0000 Subject: OS X: changed the location of settings to ~/Library/Application Support/Sylpheed . git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@2848 ee746299-78ed-0310-b773-934348b2243d --- ChangeLog | 7 +++++++ libsylph/defs.h | 2 +- libsylph/utils.c | 16 +++++++++++++++- src/main.c | 9 +++++++-- 4 files changed, 30 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 97ee1086..ff08592d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2011-02-25 + + * libsylph/defs.h + libsylph/utils.c + src/main.c: OS X: changed the location of settings to + ~/Library/Application Support/Sylpheed . + 2011-02-25 * libsylph/utils.c diff --git a/libsylph/defs.h b/libsylph/defs.h index 8901b9c9..75c13a6d 100644 --- a/libsylph/defs.h +++ b/libsylph/defs.h @@ -44,7 +44,7 @@ #define DRAFT_DIR "draft" #define TRASH_DIR "trash" #define JUNK_DIR "junk" -#ifdef G_OS_WIN32 +#if defined(G_OS_WIN32) || defined(__APPLE__) # define RC_DIR "Sylpheed" #else # define RC_DIR ".sylpheed-2.0" diff --git a/libsylph/utils.c b/libsylph/utils.c index 3b1301a8..ac51271c 100644 --- a/libsylph/utils.c +++ b/libsylph/utils.c @@ -2204,6 +2204,15 @@ const gchar *get_document_dir(void) document_dir = get_home_dir(); } + return document_dir; +#elif defined(__APPLE__) + static const gchar *document_dir = NULL; + + if (!document_dir) { + document_dir = g_strconcat(get_home_dir(), G_DIR_SEPARATOR_S, + "Documents", NULL); + } + return document_dir; #else return get_home_dir(); @@ -2224,6 +2233,11 @@ const gchar *get_rc_dir(void) rc_dir = g_strconcat(get_home_dir(), G_DIR_SEPARATOR_S, RC_DIR, NULL); g_free(appdata); +#elif defined(__APPLE__) + rc_dir = g_strconcat(get_home_dir(), G_DIR_SEPARATOR_S, + "Library", G_DIR_SEPARATOR_S, + "Application Support", G_DIR_SEPARATOR_S, + RC_DIR, NULL); #else rc_dir = g_strconcat(get_home_dir(), G_DIR_SEPARATOR_S, RC_DIR, NULL); @@ -2246,7 +2260,7 @@ const gchar *get_old_rc_dir(void) const gchar *get_mail_base_dir(void) { -#ifdef G_OS_WIN32 +#if defined(G_OS_WIN32) || defined(__APPLE__) static gchar *mail_base_dir = NULL; if (!mail_base_dir) diff --git a/src/main.c b/src/main.c index 755397c9..7db5de67 100644 --- a/src/main.c +++ b/src/main.c @@ -175,7 +175,10 @@ static gboolean lock_socket_input_cb (GIOChannel *source, gpointer data); static void remote_command_exec (void); + +#if !defined(G_OS_WIN32) && !defined(__APPLE__) static void migrate_old_config (void); +#endif static void open_compose_new (const gchar *address, GPtrArray *attach_files); @@ -746,7 +749,7 @@ static void parse_gtkrc_files(void) static void setup_rc_dir(void) { -#ifndef G_OS_WIN32 +#if !defined(G_OS_WIN32) && !defined(__APPLE__) CHDIR_EXIT_IF_FAIL(get_home_dir(), 1); /* backup if old rc file exists */ @@ -786,7 +789,7 @@ static void setup_rc_dir(void) if (is_dir_exist(OLD_RC_DIR)) migrate_old_config(); } -#endif /* !G_OS_WIN32 */ +#endif /* !G_OS_WIN32 && !__APPLE__ */ syl_setup_rc_dir(); } @@ -1697,6 +1700,7 @@ static void remote_command_exec(void) } } +#if !defined(G_OS_WIN32) && !defined(__APPLE__) static void migrate_old_config(void) { GDir *dir; @@ -1774,6 +1778,7 @@ static void migrate_old_config(void) g_pattern_spec_free(pspec); g_dir_close(dir); } +#endif /* !G_OS_WIN32 && !__APPLE__ */ static void open_compose_new(const gchar *address, GPtrArray *attach_files) { -- cgit v1.2.3