From 6b431c0e47b33d6076e5b6cfb7b0be6f33065c89 Mon Sep 17 00:00:00 2001 From: Rodrigo Moya Date: Tue, 9 Oct 2001 18:14:21 +0000 Subject: deal correctly with URIs to be inserted into the hash table, so that we 2001-10-09 Rodrigo Moya * pcs/cal-factory.c (lookup_backend, add_backend): deal correctly with URIs to be inserted into the hash table, so that we don't add the same backend over and over because the URI strings were different (although refering to the same backend) svn path=/trunk/; revision=13523 --- calendar/pcs/cal-factory.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'calendar/pcs/cal-factory.c') diff --git a/calendar/pcs/cal-factory.c b/calendar/pcs/cal-factory.c index 9b4bc2fc67..a404ee49f4 100644 --- a/calendar/pcs/cal-factory.c +++ b/calendar/pcs/cal-factory.c @@ -103,10 +103,20 @@ lookup_backend (CalFactory *factory, const char *uristr) { CalFactoryPrivate *priv; CalBackend *backend; + EUri *uri; + char *tmp; priv = factory->priv; - backend = g_hash_table_lookup (priv->backends, uristr); + uri = e_uri_new (uristr); + if (!uri) + return NULL; + + tmp = e_uri_to_string (uri, FALSE); + backend = g_hash_table_lookup (priv->backends, tmp); + g_free (tmp); + e_uri_free (uri); + return backend; } @@ -152,10 +162,18 @@ static void add_backend (CalFactory *factory, const char *uristr, CalBackend *backend) { CalFactoryPrivate *priv; + EUri *uri; + char *tmp; priv = factory->priv; - g_hash_table_insert (priv->backends, g_strdup (uristr), backend); + uri = e_uri_new (uristr); + if (!uri) + return; + + tmp = e_uri_to_string (uri, FALSE); + g_hash_table_insert (priv->backends, tmp, backend); + e_uri_free (uri); gtk_signal_connect (GTK_OBJECT (backend), "last_client_gone", GTK_SIGNAL_FUNC (backend_last_client_gone_cb), -- cgit v1.2.3