aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRodrigo Moya <rodrigo@ximian.com>2001-10-10 02:14:21 +0800
committerRodrigo Moya <rodrigo@src.gnome.org>2001-10-10 02:14:21 +0800
commit6b431c0e47b33d6076e5b6cfb7b0be6f33065c89 (patch)
treee03b99618d19e1229a2fae94c32bf52bf3c9719d
parentbeaba25d506b981d39340bb071dcb58baf106265 (diff)
downloadgsoc2013-evolution-6b431c0e47b33d6076e5b6cfb7b0be6f33065c89.tar.gz
gsoc2013-evolution-6b431c0e47b33d6076e5b6cfb7b0be6f33065c89.tar.zst
gsoc2013-evolution-6b431c0e47b33d6076e5b6cfb7b0be6f33065c89.zip
deal correctly with URIs to be inserted into the hash table, so that we
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) svn path=/trunk/; revision=13523
-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),