Pyrox
Pyrox

Reputation: 569

GTK+ opening link in about dialog fails on Windows

I am writing a C/GTK+ application and this should be targeted for both Linux and Windows.

I have encountered a problem when I open the website link in the about dialog: the expected behaviour would be the browser to open and show the relative webpage (and this works correctly on Linux), but right after clicking on it a popup comes up displaying "It's impossible to show the link because no application to handle it is installed" (roughly translated, I don't see it in english, but in my native language).

How could I fix this? I thought to set a specific handler for the link only for Windows, but I don't know how to get the "link" object in the about dialog. The only thing I found in the documentation is gtk_about_dialog_get_website_label, but it returns a string, so I don't think the handler would work.

Upvotes: 3

Views: 606

Answers (1)

Elias Van Ootegem
Elias Van Ootegem

Reputation: 76433

When the website label is clicked in a GtkAboutDialog object, the default behavior is to invoke gtk_show_uri. The latter uses GIO to handle the uri itself, which only handles local files. If you want to handle urls (http[s]://, or ftp[s]:// and such), you'll have to install gvfs.
An alternative approach is to connect a callback to the activate-link signal which is emitted when a uri is activated. You can then handle the event, and work some magic depending on what system your application is running on.

The links from my comment that back my claims up (and are useful references in general) are:

Upvotes: 2

Related Questions