comparison gtk3/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
comparison
equal deleted inserted replaced
1117:9ca5de2e59f8 1118:63dd52ba9a8f
9725 * Parameters: 9725 * Parameters:
9726 * url: Uniform resource locator. 9726 * url: Uniform resource locator.
9727 */ 9727 */
9728 int dw_browse(char *url) 9728 int dw_browse(char *url)
9729 { 9729 {
9730 /* Is there a way to find the webbrowser in Unix? */ 9730 /* If possible load the URL/URI using gvfs... */
9731 char *execargs[3], *browser = "firefox", *tmp; 9731 if(gtk_show_uri(gdk_screen_get_default(), url, GDK_CURRENT_TIME, NULL))
9732 9732 {
9733 tmp = getenv( "DW_BROWSER" ); 9733 return DW_ERROR_NONE;
9734 if(tmp) browser = tmp; 9734 }
9735 execargs[0] = browser; 9735 else
9736 execargs[1] = url; 9736 {
9737 execargs[2] = NULL; 9737 /* Otherwise just fall back to executing firefox...
9738 9738 * or the browser defined by the DW_BROWSER variable.
9739 return dw_exec(browser, DW_EXEC_GUI, execargs); 9739 */
9740 char *execargs[3], *browser = "firefox", *tmp;
9741
9742 tmp = getenv( "DW_BROWSER" );
9743 if(tmp) browser = tmp;
9744 execargs[0] = browser;
9745 execargs[1] = url;
9746 execargs[2] = NULL;
9747
9748 return dw_exec(browser, DW_EXEC_GUI, execargs);
9749 }
9740 } 9750 }
9741 9751
9742 /* 9752 /*
9743 * Causes the embedded HTML widget to take action. 9753 * Causes the embedded HTML widget to take action.
9744 * Parameters: 9754 * Parameters: