diff options
author | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2005-10-25 08:43:05 +0000 |
---|---|---|
committer | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2005-10-25 08:43:05 +0000 |
commit | 97fe8bb5863e75e62afcb6c2b6cac10299920e9c (patch) | |
tree | d45a60052e8c56c27edb0670afe3b542b547c207 /libsylph/utils.c | |
parent | 749d0bd1eb364a5efc52d2f0a0b4b7731c9332ba (diff) |
win32: use ShellExecute() on print.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@680 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'libsylph/utils.c')
-rw-r--r-- | libsylph/utils.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/libsylph/utils.c b/libsylph/utils.c index 84b3bf2f..80b6545c 100644 --- a/libsylph/utils.c +++ b/libsylph/utils.c @@ -3147,6 +3147,43 @@ gint execute_open_file(const gchar *file, const gchar *content_type) return 0; } +gint execute_print_file(const gchar *file) +{ + g_return_val_if_fail(file != NULL, -1); + +#ifdef G_OS_WIN32 + log_print("printing %s\n", file); + + if (G_WIN32_HAVE_WIDECHAR_API()) { + wchar_t *wpath; + + wpath = g_utf8_to_utf16(file, -1, NULL, NULL, NULL); + if (wpath == NULL) + return -1; + + ShellExecuteW(NULL, L"print", wpath, NULL, NULL, SW_SHOWNORMAL); + + g_free(wpath); + + return 0; + } else { + gchar *cp_path; + + cp_path = g_locale_from_utf8(file, -1, NULL, NULL, NULL); + if (cp_path == NULL) + return -1; + + ShellExecuteA(NULL, "print", cp_path, NULL, NULL, + SW_SHOWNORMAL); + + g_free(cp_path); + + return 0; + } +#endif + return 0; +} + gchar *get_command_output(const gchar *cmdline) { gchar *child_stdout; |