Skip to content

Commit

Permalink
44_open_url
Browse files Browse the repository at this point in the history
from debian

added error handling, see #467458.
  • Loading branch information
??? authored and youknowone committed Jun 4, 2013
1 parent 74aed26 commit bbc7f2a
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/fe-gtk/fe-gtk.c
Original file line number Diff line number Diff line change
Expand Up @@ -925,33 +925,44 @@ try_browser (const char *browser, const char *arg, const char *url)
static void
fe_open_url_inner (const char *url)
{
char buf[256];

#ifdef WIN32
ShellExecute (0, "open", url, NULL, NULL, SW_SHOWNORMAL);
#else
/* universal desktop URL opener (from xdg-utils). Supports gnome,kde,xfce4. */
if (try_browser ("xdg-open", NULL, url))
return;
fprintf( stderr, "fe_open_url_inner: failed to open %s with xdg-open\n", url );

/* try to detect GNOME */
if (g_getenv ("GNOME_DESKTOP_SESSION_ID"))
{
if (try_browser ("gnome-open", NULL, url)) /* Gnome 2.4+ has this */
return;
fprintf( stderr, "fe_open_url_inner: failed to open %s with gnome-open\n", url );
}

/* try to detect KDE */
if (g_getenv ("KDE_FULL_SESSION"))
{
if (try_browser ("kfmclient", "exec", url))
return;
fprintf( stderr, "fe_open_url_inner: failed to open %s with kfmclient\n", url );
}

/* everything failed, what now? just try firefox */
if (try_browser ("firefox", NULL, url))
return;
fprintf( stderr, "fe_open_url_inner: failed to open %s with firefox\n", url );

if (try_browser ("mozilla", NULL, url))
return;
fprintf( stderr, "fe_open_url_inner: failed to open %s with mozilla\n", url );

/* fresh out of ideas... */
try_browser ("mozilla", NULL, url);
snprintf (buf, sizeof (buf), "Failed to open url:\n\n%s", url);
fe_message (buf, FE_MSG_ERROR);
#endif
}

Expand Down

0 comments on commit bbc7f2a

Please sign in to comment.