comparison 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
comparison
equal deleted inserted replaced
1117:9ca5de2e59f8 1118:63dd52ba9a8f
11161 * Parameters: 11161 * Parameters:
11162 * url: Uniform resource locator. 11162 * url: Uniform resource locator.
11163 */ 11163 */
11164 int dw_browse(char *url) 11164 int dw_browse(char *url)
11165 { 11165 {
11166 /* Is there a way to find the webbrowser in Unix? */ 11166 #if GTK_CHECK_VERSION(2,14,0)
11167 char *execargs[3], *browser = "firefox", *tmp; 11167 /* If possible load the URL/URI using gvfs... */
11168 11168 if(gtk_show_uri(gdk_screen_get_default(), url, GDK_CURRENT_TIME, NULL))
11169 tmp = getenv( "DW_BROWSER" ); 11169 {
11170 if(tmp) browser = tmp; 11170 return DW_ERROR_NONE;
11171 execargs[0] = browser; 11171 }
11172 execargs[1] = url; 11172 else
11173 execargs[2] = NULL; 11173 #endif
11174 11174 {
11175 return dw_exec(browser, DW_EXEC_GUI, execargs); 11175 /* Otherwise just fall back to executing firefox...
11176 * or the browser defined by the DW_BROWSER variable.
11177 */
11178 char *execargs[3], *browser = "firefox", *tmp;
11179
11180 tmp = getenv( "DW_BROWSER" );
11181 if(tmp) browser = tmp;
11182 execargs[0] = browser;
11183 execargs[1] = url;
11184 execargs[2] = NULL;
11185
11186 return dw_exec(browser, DW_EXEC_GUI, execargs);
11187 }
11176 } 11188 }
11177 11189
11178 /* 11190 /*
11179 * Causes the embedded HTML widget to take action. 11191 * Causes the embedded HTML widget to take action.
11180 * Parameters: 11192 * Parameters: