diff options
author | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2011-02-25 06:34:07 +0000 |
---|---|---|
committer | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2011-02-25 06:34:07 +0000 |
commit | 070e412f18875b74e329d932d65b2917d8d81bd7 (patch) | |
tree | 9a892d712cf507a9bcef1df2a65481020c3b9427 /libsylph | |
parent | b81cb2016a3fb6bb6f297a057516aac13e5bcf42 (diff) |
use 'open' command on OS X.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@2847 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'libsylph')
-rw-r--r-- | libsylph/defs.h | 6 | ||||
-rw-r--r-- | libsylph/utils.c | 14 |
2 files changed, 17 insertions, 3 deletions
diff --git a/libsylph/defs.h b/libsylph/defs.h index 8786fb27..8901b9c9 100644 --- a/libsylph/defs.h +++ b/libsylph/defs.h @@ -98,7 +98,11 @@ /* #define DEFAULT_INC_PATH "/usr/bin/imget" */ /* #define DEFAULT_INC_PROGRAM "imget" */ #define DEFAULT_SENDMAIL_CMD "/usr/sbin/sendmail -t -i" -#define DEFAULT_BROWSER_CMD "xdg-open '%s'" +#ifdef __APPLE__ +# define DEFAULT_BROWSER_CMD "open '%s'" +#else +# define DEFAULT_BROWSER_CMD "xdg-open '%s'" +#endif #ifdef _PATH_MAILDIR # define DEFAULT_SPOOL_PATH _PATH_MAILDIR diff --git a/libsylph/utils.c b/libsylph/utils.c index 8026cc28..3b1301a8 100644 --- a/libsylph/utils.c +++ b/libsylph/utils.c @@ -4097,9 +4097,9 @@ gint execute_command_line_async_wait(const gchar *cmdline) gint execute_open_file(const gchar *file, const gchar *content_type) { +#ifdef G_OS_WIN32 g_return_val_if_fail(file != NULL, -1); -#ifdef G_OS_WIN32 log_print("opening %s - %s\n", file, content_type ? content_type : ""); if (G_WIN32_HAVE_WIDECHAR_API()) { @@ -4127,7 +4127,17 @@ gint execute_open_file(const gchar *file, const gchar *content_type) return 0; } +#elif defined(__APPLE__) + const gchar *argv[3] = {"open", NULL, NULL}; + + g_return_val_if_fail(file != NULL, -1); + + log_print("opening %s - %s\n", file, content_type ? content_type : ""); + + argv[1] = file; + execute_async(argv); #endif + return 0; } @@ -4192,7 +4202,7 @@ gint open_uri(const gchar *uri, const gchar *cmdline) g_return_val_if_fail(uri != NULL, -1); -#ifdef G_OS_WIN32 +#if defined(G_OS_WIN32) || defined(__APPLE__) if (!cmdline || cmdline[0] == '\0') return execute_open_file(uri, NULL); #endif |