Re: launching web browser
- From: John Cupitt <jcupitt gmail com>
- To: Gyözö Both <gyboth bygfoot com>
- Cc: "gtk-app-devel-list @ gnome. org" <gtk-app-devel-list gnome org>
- Subject: Re: launching web browser
- Date: Sat, 21 May 2005 13:07:27 +0100
On 5/21/05, Gyözö Both <gyboth bygfoot com> wrote:
is there a good (and easy) way to launch the system's default web
browser with a given url from my gtk program?
If you're interested in cross-platform, the windows and mac
equivalents to gnome-url I've discovered are:
#ifdef WIN32
char url2[FILENAME_MAX];
int v;
expand_variables( url, url2 );
v = (int) ShellExecute( NULL, "open", url2, NULL, NULL, SW_SHOWNORMAL );
if( v <= 32 ) {
error_top( _( "Unable to open location." ) );
error_sub( _( "Unable to open URL \"%s\", "
"windows error code = %d." ), url, v );
box_alert( par );
}
#elif defined MAC_OSX
static gboolean shown = FALSE;
(void) systemf( "open %s", url );
if( !shown ) {
box_info( par, _( "Browser window opened." ),
_( "Opened window for URL:\n"
" %s\n"
"This may take a few seconds." ), url );
shown = TRUE;
}
#else /*unix-y*/
gnome-stuff
#endif
(experts probably know something better)
John
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]