diff pidgin/gtkutils.c @ 25351:5dedfe149cb3

Pass only the URL scheme to gtkimhtml and let it add the colon automatically.
author Richard Laager <rlaager@wiktel.com>
date Mon, 01 Dec 2008 19:23:23 +0000
parents 291b84bf4f8b
children 48cf0a545621
line wrap: on
line diff
--- a/pidgin/gtkutils.c	Mon Dec 01 17:05:40 2008 +0000
+++ b/pidgin/gtkutils.c	Mon Dec 01 19:23:23 2008 +0000
@@ -3569,7 +3569,7 @@
 	return TRUE;
 }
 
-gboolean
+static gboolean
 register_gnome_url_handlers()
 {
 	char *tmp;
@@ -3621,10 +3621,12 @@
 				}
 
 				start += sizeof("/desktop/gnome/url-handlers/") - 1;
-				protocol = g_strdup_printf("%s:", start);
+				protocol = g_strdup(start);
 				gnome_url_handlers = g_list_prepend(gnome_url_handlers, protocol);
 
-				if (!strcmp(protocol, "mailto:"))
+				purple_debug_info("url-handlers", "Registering handler for %s.\n", protocol);
+
+				if (!strcmp(protocol, "mailto"))
 					gtk_imhtml_class_register_protocol(protocol, url_clicked_cb, copy_email_address);
 				else
 					gtk_imhtml_class_register_protocol(protocol, url_clicked_cb, link_context_menu);
@@ -3638,22 +3640,22 @@
 
 void pidgin_utils_init(void)
 {
-	gtk_imhtml_class_register_protocol("open://", open_dialog, dummy);
+	gtk_imhtml_class_register_protocol("open", open_dialog, dummy);
 
 	/* If we're under GNOME, try registering the system URL handlers. */
 	if (purple_running_gnome() && register_gnome_url_handlers())
 		return;
 
-	gtk_imhtml_class_register_protocol("http://", url_clicked_cb, link_context_menu);
-	gtk_imhtml_class_register_protocol("https://", url_clicked_cb, link_context_menu);
-	gtk_imhtml_class_register_protocol("ftp://", url_clicked_cb, link_context_menu);
-	gtk_imhtml_class_register_protocol("gopher://", url_clicked_cb, link_context_menu);
-	gtk_imhtml_class_register_protocol("mailto:", url_clicked_cb, copy_email_address);
+	gtk_imhtml_class_register_protocol("http",   url_clicked_cb, link_context_menu);
+	gtk_imhtml_class_register_protocol("https",  url_clicked_cb, link_context_menu);
+	gtk_imhtml_class_register_protocol("ftp",    url_clicked_cb, link_context_menu);
+	gtk_imhtml_class_register_protocol("gopher", url_clicked_cb, link_context_menu);
+	gtk_imhtml_class_register_protocol("mailto", url_clicked_cb, copy_email_address);
 }
 
 void pidgin_utils_uninit(void)
 {
-	gtk_imhtml_class_register_protocol("open://", NULL, NULL);
+	gtk_imhtml_class_register_protocol("open", NULL, NULL);
 
 	/* If we have GNOME handlers registered, unregister them. */
 	if (gnome_url_handlers)
@@ -3669,10 +3671,10 @@
 		return;
 	}
 
-	gtk_imhtml_class_register_protocol("http://", NULL, NULL);
-	gtk_imhtml_class_register_protocol("https://", NULL, NULL);
-	gtk_imhtml_class_register_protocol("ftp://", NULL, NULL);
-	gtk_imhtml_class_register_protocol("mailto:", NULL, NULL);
-	gtk_imhtml_class_register_protocol("gopher://", NULL, NULL);
+	gtk_imhtml_class_register_protocol("http",   NULL, NULL);
+	gtk_imhtml_class_register_protocol("https",  NULL, NULL);
+	gtk_imhtml_class_register_protocol("ftp",    NULL, NULL);
+	gtk_imhtml_class_register_protocol("mailto", NULL, NULL);
+	gtk_imhtml_class_register_protocol("gopher", NULL, NULL);
 }