1 /* logjam - a GTK client for LiveJournal.
2 * Copyright (C) 2000-2003 Evan Martin <evan@livejournal.com>
4 * vim: tabstop=4 shiftwidth=4 noexpandtab :
14 #include <sys/types.h>
25 spawn_url(GtkWindow
*parent
, const char *url
) {
26 ShellExecute(NULL
, "open", url
, NULL
, NULL
, SW_SHOWNORMAL
);
30 /* http://lxr.mozilla.org/seamonkey/source/xpfe/bootstrap/nsAppRunner.cpp#1413
31 * when sending remote commands,
32 * mozilla returns 0 on success and nonzero on failure. */
33 const CommandList spawn_commands
[] = {
38 { "Debian (sensible-browser)",
39 "sensible-browser '%s'" },
43 "mozilla -remote 'openURL(%s, new-window)' || mozilla '%s'" },
45 "opera -remote 'openURL(%s,new-window)' || " /* note no space */
48 "kfmclient exec '%s'" },
50 "netscape -remote 'openURL(%s, new-window)' || netscape '%s'" },
55 spawn_url(GtkWindow
*parent
, const char *url
) {
58 char *argv
[4] = { "/bin/sh", "-c", NULL
, NULL
};
60 /* and now, a hack because I don't know how many %s's
61 * are in spawn_command. */
62 #define ARGS_HACK url,url,url,url,url,url
63 cmd
= g_strdup_printf(conf
.spawn_command
, ARGS_HACK
);
66 if (!g_spawn_async(NULL
, argv
, NULL
, 0, NULL
, NULL
, NULL
, &err
)) {
67 jam_warning(parent
, _("Error spawning URL '%s': %s\n"),
73 #endif /* G_OS_WIN32 */