Re: launching web-browser

2005-05-22 Thread Olivier Sessink
On Sat, 21 May 2005 14:51:05 +0200
Gyözö Both <[EMAIL PROTECTED]> wrote:

> thanks for your answers. if possible, i'd like to have a solution that
> only uses gtk/glib, i wouldn't want to have a gnome-dependency in my
> app. is there a way?

http://developer.gnome.org/doc/API/2.0/glib/glib-Spawning-Processes.html#g-spawn-async-with-pipes

is pretty much portable.

a command string like 
/bin/sh -c mozilla -remote 'openURL(%s, new-window)' || mozilla %s&
will work on unix 

regards,
Olivier

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: launching web-browser

2005-05-21 Thread John Cupitt
On 5/21/05, Peter Bloomfield <[EMAIL PROTECTED]> wrote:
> On 05/21/2005 08:51:05 AM, Gyözö Both wrote:
> > thanks for your answers. if possible, i'd like to have a
> > solution that only uses gtk/glib, i wouldn't want to have a
> > gnome-dependency in my app. is there a way?

I use this as a fallback: it just runs a commmand with an argument
which can be set from my application's preferences. The default is
"mozilla" for the command and "-remote 'openURL(%s)'" for the
argument. Very stupid, but it does sort-of work.

static gboolean shown = FALSE;

BufInfo buf;
char txt[512];
BufInfo buf2;
char txt2[512];
 
char url2[FILENAME_MAX];

expand_variables( url, url2 );

buf_init_static( &buf, txt, 512 );
buf_appendf( &buf, "%s %s", BOX_BROWSER, BOX_BROWSER_REMOTE );
buf_init_static( &buf2, txt2, 512 );
buf_appendf( &buf2, buf_all( &buf ), url2 );

if( systemf( "%s", buf_all( &buf2 ) ) ) {
error_top( _( "Unable to open location." ) );
error_sub( _(
"Attempted to launch browser with command:\n"
"  %s\n"
"You can change this command in Preferences." ),
buf_all( &buf2 ) );
box_alert( par );
}
else if( !shown ) {
box_info( par, 
_( "Browser window opened." ),
_( "Opened window for URL:\n"
"  %s\n"
"You may need to switch desktops to see the "
"new window." ),
url2 );

/* Only show 1st time.
 */
shown = TRUE;
}
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: launching web-browser

2005-05-21 Thread Peter Bloomfield

On 05/21/2005 08:51:05 AM, Gyözö Both wrote:
thanks for your answers. if possible, i'd like to have a  
solution that only uses gtk/glib, i wouldn't want to have a  
gnome-dependency in my app. is there a way?


gyözö


So would I--if you find one, please be sure to post it!

Peter
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: launching web-browser

2005-05-21 Thread Gyözö Both
thanks for your answers. if possible, i'd like to have a solution that
only uses gtk/glib, i wouldn't want to have a gnome-dependency in my
app. is there a way?

gyözö

-- 
A new koan:

If you have some ice cream, I will give it to you.

If you have no ice cream, I will take it away from you.

It is an ice cream koan.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: launching web browser

2005-05-21 Thread John Cupitt
On 5/21/05, Gyözö Both <[EMAIL PROTECTED]> 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
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: launching web browser

2005-05-21 Thread Peter Bloomfield

On 05/21/2005 03:15:48 AM, Gyözö Both wrote:

hi,

is there a good (and easy) way to launch the system's default  
web browser with a given url from my gtk program?


See  
.

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


launching web browser

2005-05-21 Thread Gyözö Both
hi,

is there a good (and easy) way to launch the system's default web
browser with a given url from my gtk program?

gyözö

-- 
Brooke's Law:
Whenever a system becomes completely defined, some damn fool
discovers something which either abolishes the system or expands it
beyond recognition.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list