diff options
author | Pixel <pixel@nobis-crew.org> | 2009-11-04 11:56:41 -0800 |
---|---|---|
committer | Pixel <pixel@nobis-crew.org> | 2009-11-04 11:59:33 -0800 |
commit | d577d991b97ae2b5ee1af23641bcffc3f83af5b2 (patch) | |
tree | 590639d50205d1bcfaff2a7d2dc6ebf3f373c7ed /iup/src/gtk/iupgtk_help.c |
Initial import. Contains the im, cd and iup librairies, and a "working" Makefile for them under linux.
Diffstat (limited to 'iup/src/gtk/iupgtk_help.c')
-rwxr-xr-x | iup/src/gtk/iupgtk_help.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/iup/src/gtk/iupgtk_help.c b/iup/src/gtk/iupgtk_help.c new file mode 100755 index 0000000..270677f --- /dev/null +++ b/iup/src/gtk/iupgtk_help.c @@ -0,0 +1,52 @@ +/** \file + * \brief GTK Driver IupHelp for non Windows systems + * + * See Copyright Notice in "iup.h" + */ + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> + +#include <glib.h> + +#include "iup.h" + +#include "iup_str.h" + +int IupHelp(const char *url) +{ + GError *error = NULL; + gchar *argv[3]; + int ret; + char *browser = getenv("IUP_HELPAPP"); + if (!browser) + browser = IupGetGlobal("HELPAPP"); + + if (!browser) + { + char* system = IupGetGlobal("SYSTEM"); + if (iupStrEqualNoCase(system, "Linux") || + iupStrEqualNoCase(system, "FreeBSD")) + browser = "firefox"; + else if (iupStrEqualNoCase(system, "Darwin")) + browser = "safari"; + else if (iupStrEqualPartial(system, "CYGWIN")) + browser = "iexplore"; + else + browser = "netscape"; + } + + argv[0] = browser; + argv[1] = (gchar*)url; + argv[2] = NULL; + + ret = g_spawn_async(NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, &error); + + if (error) + g_error_free(error); + + if (!ret) + return -1; + return 1; +} |