changeset 29431:2fc38fb61418

Make the "Execute a command" buddy pounce action use ShellExecute() on Windows so that it can open files of all types (e.g. MP3s) with their default associated application. Fixes #11333.
author Daniel Atallah <daniel.atallah@gmail.com>
date Sun, 14 Feb 2010 06:57:53 +0000
parents f6cc97902049
children 89858e3a0464
files pidgin/gtkpounce.c pidgin/win32/gtkwin32dep.c
diffstat 2 files changed, 3 insertions(+), 47 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/gtkpounce.c	Sun Feb 14 05:55:46 2010 +0000
+++ b/pidgin/gtkpounce.c	Sun Feb 14 06:57:53 2010 +0000
@@ -1546,53 +1546,7 @@
 				g_free(localecmd);
 			}
 #else /* !_WIN32 */
-			PROCESS_INFORMATION pi;
-			BOOL retval;
-			gchar *message = NULL;
-
-			memset(&pi, 0, sizeof(pi));
-
-			if (G_WIN32_HAVE_WIDECHAR_API ()) {
-				STARTUPINFOW si;
-				wchar_t *wc_cmd = g_utf8_to_utf16(command,
-						-1, NULL, NULL, NULL);
-
-				memset(&si, 0 , sizeof(si));
-				si.cb = sizeof(si);
-
-				retval = CreateProcessW(NULL, wc_cmd, NULL,
-						NULL, 0, 0, NULL, NULL,
-						&si, &pi);
-				g_free(wc_cmd);
-			} else {
-				STARTUPINFOA si;
-				char *l_cmd = g_locale_from_utf8(command,
-						-1, NULL, NULL, NULL);
-
-				memset(&si, 0 , sizeof(si));
-				si.cb = sizeof(si);
-
-				retval = CreateProcessA(NULL, l_cmd, NULL,
-						NULL, 0, 0, NULL, NULL,
-						&si, &pi);
-				g_free(l_cmd);
-			}
-
-			if (retval) {
-				CloseHandle(pi.hProcess);
-				CloseHandle(pi.hThread);
-			} else {
-				message = g_win32_error_message(GetLastError());
-			}
-
-			purple_debug_info("pounce",
-					"Pounce execute command called for: "
-					"%s\n%s%s%s",
-						command,
-						retval ? "" : "Error: ",
-						retval ? "" : message,
-						retval ? "" : "\n");
-			g_free(message);
+			winpidgin_shell_execute(command, "open", NULL);
 #endif /* !_WIN32 */
 		}
 	}
--- a/pidgin/win32/gtkwin32dep.c	Sun Feb 14 05:55:46 2010 +0000
+++ b/pidgin/win32/gtkwin32dep.c	Sun Feb 14 06:57:53 2010 +0000
@@ -157,6 +157,7 @@
 		wsinfo.lpVerb = w_verb;
 		wsinfo.lpFile = w_uri;
 		wsinfo.nShow = SW_SHOWNORMAL;
+		wsinfo.fMask |= SEE_MASK_FLAG_NO_UI;
 		if (clazz != NULL) {
 			w_clazz = g_utf8_to_utf16(clazz, -1, NULL, NULL, NULL);
 			wsinfo.fMask |= SEE_MASK_CLASSNAME;
@@ -181,6 +182,7 @@
 		sinfo.lpVerb = verb;
 		sinfo.lpFile = locale_uri;
 		sinfo.nShow = SW_SHOWNORMAL;
+		sinfo.fMask |= SEE_MASK_FLAG_NO_UI;
 		if (clazz != NULL) {
 			sinfo.fMask |= SEE_MASK_CLASSNAME;
 			sinfo.lpClass = clazz;