aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-session.c
diff options
context:
space:
mode:
authorbertrand <Bertrand.Guiheneuf@inria.fr>1999-04-25 19:21:33 +0800
committerBertrand Guiheneuf <bertrand@src.gnome.org>1999-04-25 19:21:33 +0800
commitf9595bb213b103bf071e97ea2f93886767aa7f64 (patch)
treece3cef62fd99fbc4202f0fef13df729ac688b347 /camel/camel-session.c
parent8fa0292a20436587037ed5b63867563f6c26e3e0 (diff)
downloadgsoc2013-evolution-f9595bb213b103bf071e97ea2f93886767aa7f64.tar
gsoc2013-evolution-f9595bb213b103bf071e97ea2f93886767aa7f64.tar.gz
gsoc2013-evolution-f9595bb213b103bf071e97ea2f93886767aa7f64.tar.bz2
gsoc2013-evolution-f9595bb213b103bf071e97ea2f93886767aa7f64.tar.lz
gsoc2013-evolution-f9595bb213b103bf071e97ea2f93886767aa7f64.tar.xz
gsoc2013-evolution-f9595bb213b103bf071e97ea2f93886767aa7f64.tar.zst
gsoc2013-evolution-f9595bb213b103bf071e97ea2f93886767aa7f64.zip
new method to set the default provider for a protocol.
1999-04-25 bertrand <Bertrand.Guiheneuf@inria.fr> * camel/camel-session.c (camel_session_set_provider): new method to set the default provider for a protocol. (camel_session_get_store_from_provider): new method to instantiate a folder from a provider. * camel/camel-provider.h: s/GString/gchar/g + typo fix. svn path=/trunk/; revision=878
Diffstat (limited to 'camel/camel-session.c')
-rw-r--r--camel/camel-session.c62
1 files changed, 61 insertions, 1 deletions
diff --git a/camel/camel-session.c b/camel/camel-session.c
index cbc363662e..6acde38d79 100644
--- a/camel/camel-session.c
+++ b/camel/camel-session.c
@@ -43,6 +43,13 @@ camel_session_class_init (CamelSessionClass *camel_session_class)
+static void
+camel_session_init (CamelSession *session)
+{
+ store_provider_list = g_hash_table_new (g_str_hash, g_str_equal);
+ transport_provider_list = g_hash_table_new (g_str_hash, g_str_equal);
+}
+
GtkType
@@ -57,7 +64,7 @@ camel_session_get_type (void)
sizeof (CamelSession),
sizeof (CamelSessionClass),
(GtkClassInitFunc) camel_session_class_init,
- (GtkObjectInitFunc) NULL,
+ (GtkObjectInitFunc) camel_session_init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL,
@@ -69,3 +76,56 @@ camel_session_get_type (void)
return camel_session_type;
}
+
+/**
+ * camel_session_set_provider: set the default provider for a protocol
+ * @session: session object for wich the provider will the default
+ * @provider: provider object
+ *
+ * Set the default implementation for a protocol. The protocol
+ * is determined by provider->protocol field (See CamelProtocol).
+ * It overrides the default provider for this protocol.
+ *
+ **/
+void
+camel_session_set_provider (CamelSession *session, CamelProvider *provider)
+{
+ GHashTable *table;
+
+ g_assert(session);
+ g_assert(provider);
+
+ if (provider->provider_type == PROVIDER_STORE)
+ table = session->store_provider_list;
+ else
+ table = session->transport_provider_list;
+
+ g_hash_table_insert (table, (gpointer)(provider->protocol), (gpointer)(provider));
+
+}
+
+
+
+
+
+/**
+ * camel_session_get_store_from_provider: create a folder instance for a given provider
+ * @session: session object the folder will be initialized with
+ * @provider: provider folder to instantiate
+ *
+ *
+ *
+ * Return value: the newly instantiated folder
+ **/
+CamelStore *
+camel_session_get_store_from_provider (CamelSession *session, CamelProvider *provider)
+{
+ CamelStore *store;
+
+ g_assert(session);
+ g_assert(provider);
+
+ store = gtk_object_new (provider->object_type, NULL);
+#warning add session initialisation on object
+ return store;
+}