aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--calendar/ChangeLog5
-rw-r--r--calendar/pcs/cal-factory.c22
2 files changed, 25 insertions, 2 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 0522eeb65c..378e73b4e7 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,5 +1,10 @@
2001-10-09 Rodrigo Moya <rodrigo@ximian.com>
+ * 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)
+
* pcs/cal-backend-file.c (mail_account_*): moved to a common place
(cal_backend_file_open): check if "uristr != NULL" and not
"uri != NULL"
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),