changeset 25352:48cf0a545621

Revert the URL scheme passing changes, keeping the miscellaneous other stuff that was thrown in with that commit.
author Richard Laager <rlaager@wiktel.com>
date Mon, 01 Dec 2008 19:37:11 +0000
parents 5dedfe149cb3
children b6f2c637a3d9
files pidgin/gtkimhtml.c pidgin/gtkimhtml.h pidgin/gtkutils.c
diffstat 3 files changed, 18 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/gtkimhtml.c	Mon Dec 01 19:23:23 2008 +0000
+++ b/pidgin/gtkimhtml.c	Mon Dec 01 19:37:11 2008 +0000
@@ -5749,16 +5749,13 @@
 {
 	GtkIMHtmlClass *klass;
 	GtkIMHtmlProtocol *proto;
-	char *protocol;
 
 	g_return_val_if_fail(name, FALSE);
 
 	klass = g_type_class_ref(GTK_TYPE_IMHTML);
 	g_return_val_if_fail(klass, FALSE);
 
-	protocol = g_strdup_printf("%s:", name);
-	if ((proto = imhtml_find_protocol(protocol))) {
-		g_free(protocol);
+	if ((proto = imhtml_find_protocol(name))) {
 		g_return_val_if_fail(!activate, FALSE);
 		g_free(proto->name);
 		g_free(proto);
@@ -5769,8 +5766,8 @@
 	}
 
 	proto = g_new0(GtkIMHtmlProtocol, 1);
-	proto->name = protocol;
-	proto->length = strlen(protocol);
+	proto->name = g_strdup(name);
+	proto->length = strlen(name);
 	proto->activate = activate;
 	proto->context_menu = context_menu;
 	klass->protocols = g_list_prepend(klass->protocols, proto);
--- a/pidgin/gtkimhtml.h	Mon Dec 01 19:23:23 2008 +0000
+++ b/pidgin/gtkimhtml.h	Mon Dec 01 19:37:11 2008 +0000
@@ -892,7 +892,7 @@
  * Register a protocol with the GtkIMHtml widget. Registering a protocol would
  * allow certain text to be clickable.
  *
- * @param name      The name of the protocol (e.g. http)
+ * @param name      The name of the protocol (e.g. http://)
  * @param activate  The callback to trigger when the protocol text is clicked.
  *                  Removes any current protocol definition if @c NULL. The
  *                  callback should return @c TRUE if the link was activated
--- a/pidgin/gtkutils.c	Mon Dec 01 19:23:23 2008 +0000
+++ b/pidgin/gtkutils.c	Mon Dec 01 19:37:11 2008 +0000
@@ -3621,12 +3621,10 @@
 				}
 
 				start += sizeof("/desktop/gnome/url-handlers/") - 1;
-				protocol = g_strdup(start);
+				protocol = g_strdup_printf("%s:", start);
 				gnome_url_handlers = g_list_prepend(gnome_url_handlers, protocol);
 
-				purple_debug_info("url-handlers", "Registering handler for %s.\n", protocol);
-
-				if (!strcmp(protocol, "mailto"))
+				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);
@@ -3640,22 +3638,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)
@@ -3671,10 +3669,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);
 }