diff -Naur linphone-1.7.0-orig/gtk/interface.c linphone-1.7.0-uri_handler/gtk/interface.c --- linphone-1.7.0-orig/gtk/interface.c 2007-04-15 22:41:22.000000000 +0200 +++ linphone-1.7.0-uri_handler/gtk/interface.c 2007-04-16 18:01:31.000000000 +0200 @@ -18,6 +18,7 @@ #include "callbacks.h" #include "interface.h" #include "support.h" +#include "uri_handler.h" #define GLADE_HOOKUP_OBJECT(component,widget,name) \ g_object_set_data_full (G_OBJECT (component), name, \ @@ -824,6 +825,24 @@ return app1; } +/** Called when URL in About dialog is invoked */ +static void +url_about_handler (GtkAboutDialog *about, const gchar *link, gpointer data) +{ + uri_handler(link); +} + + +/** Called when e-mail link in About dialog is invoked */ +static void +email_about_handler (GtkAboutDialog *about, const gchar *link, gpointer data) +{ + gchar mailto_uri[MAX_URI_LENGTH]; + snprintf(mailto_uri, MAX_URI_LENGTH, "mailto:%s", link); + uri_handler(mailto_uri); +} + + GtkWidget* create_about2 (void) { @@ -842,6 +861,9 @@ gchar *translators = "it: Alberto Zanoni\nde: Jean Jacques Sarton\nfr: Simon Morlat\nes: Jesus Benitez\nja: Yamaguchi Yoshiya\npl: obert Nasiadek \npt_BR: Rafael Caesar Lenzi \nsv: Daniel Nylander "; GdkPixbuf *about2_logo_pixbuf; + gtk_about_dialog_set_url_hook (url_about_handler, NULL, NULL); + gtk_about_dialog_set_email_hook (email_about_handler, NULL, NULL); + about2 = gtk_about_dialog_new (); gtk_container_set_border_width (GTK_CONTAINER (about2), 5); gtk_window_set_destroy_with_parent (GTK_WINDOW (about2), TRUE); diff -Naur linphone-1.7.0-orig/gtk/Makefile.am linphone-1.7.0-uri_handler/gtk/Makefile.am --- linphone-1.7.0-orig/gtk/Makefile.am 2007-04-15 22:41:22.000000000 +0200 +++ linphone-1.7.0-uri_handler/gtk/Makefile.am 2007-04-16 17:58:58.000000000 +0200 @@ -9,7 +9,9 @@ presence.c presence.h \ propertybox.c propertybox.h \ addressbook.c addressbook.h \ - friends.c friends.h + friends.c friends.h \ + uri_handler.c uri_handler.h + if BUILD_GTK diff -Naur linphone-1.7.0-orig/gtk/uri_handler.c linphone-1.7.0-uri_handler/gtk/uri_handler.c --- linphone-1.7.0-orig/gtk/uri_handler.c 1970-01-01 01:00:00.000000000 +0100 +++ linphone-1.7.0-uri_handler/gtk/uri_handler.c 2007-04-16 18:04:29.000000000 +0200 @@ -0,0 +1,16 @@ +#include +#include + +/** + * Handle any URI using external application. + * TODO: make handler configurable ("url_handler.sh" from mutt/urlview now) + * @param uri The handled URI. E.g. "mailto:address@hidden" + */ +void uri_handler(const char *uri) { + const char handler[]="url_handler.sh"; + if (uri) { + if (!fork()) { + execlp(handler, handler, uri, NULL); + } + } +} diff -Naur linphone-1.7.0-orig/gtk/uri_handler.h linphone-1.7.0-uri_handler/gtk/uri_handler.h --- linphone-1.7.0-orig/gtk/uri_handler.h 1970-01-01 01:00:00.000000000 +0100 +++ linphone-1.7.0-uri_handler/gtk/uri_handler.h 2007-04-16 18:04:29.000000000 +0200 @@ -0,0 +1,15 @@ +#ifndef __URI_HANDLER +#define __URI_HANDLER + +/** + * Handle any URI using external application. + * TODO: make handler configurable (now "url_handler.sh") + * @param uri The handled URI. E.g. "mailto:address@hidden" + */ +void uri_handler(const char *uri); + +/* Maximal length of URI string. Adjust it if you preffer another value. + * TODO: Has been something similar already defined here in Linphone? */ +#define MAX_URI_LENGTH 4096 + +#endif