pidgin.next.minor: 5801ff7a: Finish up the GNOME URL handler code:

rlaager at pidgin.im rlaager at pidgin.im
Mon Dec 1 12:25:47 EST 2008


-----------------------------------------------------------------
Revision: 5801ff7aebb624cf66810f2a775683d8a175924c
Ancestor: 2762868b2443ad2402678378a59277332eb684f0
Author: rlaager at pidgin.im
Date: 2008-11-28T00:42:22
Branch: im.pidgin.pidgin.next.minor
URL: http://d.pidgin.im/viewmtn/revision/info/5801ff7aebb624cf66810f2a775683d8a175924c

Modified files:
        pidgin/gtkutils.c

ChangeLog: 

Finish up the GNOME URL handler code:
  - Properly capture (and ignore) stderr.
  - If there exists a /desktop/gnome/url-handlers/PROTOCOL/enabled flag,
    honor it.
Fixes #5715

-------------- next part --------------
============================================================
--- pidgin/gtkutils.c	081c0bfe7a0ef4a4ab6eb375cf2ff60a5e505d54
+++ pidgin/gtkutils.c	0e691068dc109c650bcf23d24bca246fc459e581
@@ -3573,6 +3573,7 @@ register_gnome_url_handlers()
 register_gnome_url_handlers()
 {
 	char *tmp;
+	char *err;
 	char *c;
 	char *start;
 
@@ -3582,8 +3583,13 @@ register_gnome_url_handlers()
 
 	tmp = NULL;
 	if (!g_spawn_command_line_sync("gconftool-2 --all-dirs /desktop/gnome/url-handlers",
-	                               &tmp, NULL, NULL, NULL))
+	                               &tmp, &err, NULL, NULL))
+	{
+		g_free(err);
 		g_return_val_if_reached(FALSE);
+	}
+	g_free(err);
+	err = NULL;
 
 	for (c = start = tmp ; *c ; c++)
 	{
@@ -3595,8 +3601,25 @@ register_gnome_url_handlers()
 			*c = '\0';
 			if (g_str_has_prefix(start, "/desktop/gnome/url-handlers/"))
 			{
+				char *cmd;
+				char *tmp2 = NULL;
 				char *protocol;
 
+				/* If there is an enabled boolean, honor it. */
+				cmd = g_strdup_printf("gconftool-2 -g %s/enabled", start);
+				if (g_spawn_command_line_sync(cmd, &tmp2, &err, NULL, NULL))
+				{
+					g_free(err);
+					if (!strcmp(tmp2, "false\n"))
+					{
+						g_free(tmp2);
+						start = c + 1;
+						continue;
+					}
+					else
+						g_free(tmp2);
+				}
+
 				start += sizeof("/desktop/gnome/url-handlers/") - 1;
 				protocol = g_strdup_printf("%s:", start);
 				gnome_url_handlers = g_list_prepend(gnome_url_handlers, protocol);


More information about the Commits mailing list