Mercurial > dwindows
diff gtk/dw.c @ 1118:63dd52ba9a8f
Added support for attempting to launch a browser using a
newly discovered feature gtk_show_uri(). This function
requires gvfs to be installed... if it isn't we will
fall back to using DW_BROWSE or just firefox.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Thu, 25 Aug 2011 19:33:40 +0000 |
parents | 36773e04245c |
children | fb92778105b2 |
line wrap: on
line diff
--- a/gtk/dw.c Wed Aug 10 02:36:32 2011 +0000 +++ b/gtk/dw.c Thu Aug 25 19:33:40 2011 +0000 @@ -11163,16 +11163,28 @@ */ int dw_browse(char *url) { - /* Is there a way to find the webbrowser in Unix? */ - char *execargs[3], *browser = "firefox", *tmp; - - tmp = getenv( "DW_BROWSER" ); - if(tmp) browser = tmp; - execargs[0] = browser; - execargs[1] = url; - execargs[2] = NULL; - - return dw_exec(browser, DW_EXEC_GUI, execargs); +#if GTK_CHECK_VERSION(2,14,0) + /* If possible load the URL/URI using gvfs... */ + if(gtk_show_uri(gdk_screen_get_default(), url, GDK_CURRENT_TIME, NULL)) + { + return DW_ERROR_NONE; + } + else +#endif + { + /* Otherwise just fall back to executing firefox... + * or the browser defined by the DW_BROWSER variable. + */ + char *execargs[3], *browser = "firefox", *tmp; + + tmp = getenv( "DW_BROWSER" ); + if(tmp) browser = tmp; + execargs[0] = browser; + execargs[1] = url; + execargs[2] = NULL; + + return dw_exec(browser, DW_EXEC_GUI, execargs); + } } /*