aboutsummaryrefslogtreecommitdiffstats
path: root/camel
diff options
context:
space:
mode:
authorbertrand <Bertrand.Guiheneuf@inria.fr>1999-04-26 05:58:27 +0800
committerBertrand Guiheneuf <bertrand@src.gnome.org>1999-04-26 05:58:27 +0800
commitd224d1aaad9aca13a716278df6f81b96e9d58aea (patch)
treeec269e529e97d904e3bae5487c7a1d702f2b2cd2 /camel
parentf9595bb213b103bf071e97ea2f93886767aa7f64 (diff)
downloadgsoc2013-evolution-d224d1aaad9aca13a716278df6f81b96e9d58aea.tar
gsoc2013-evolution-d224d1aaad9aca13a716278df6f81b96e9d58aea.tar.gz
gsoc2013-evolution-d224d1aaad9aca13a716278df6f81b96e9d58aea.tar.bz2
gsoc2013-evolution-d224d1aaad9aca13a716278df6f81b96e9d58aea.tar.lz
gsoc2013-evolution-d224d1aaad9aca13a716278df6f81b96e9d58aea.tar.xz
gsoc2013-evolution-d224d1aaad9aca13a716278df6f81b96e9d58aea.tar.zst
gsoc2013-evolution-d224d1aaad9aca13a716278df6f81b96e9d58aea.zip
initialize folder object.
1999-04-25 bertrand <Bertrand.Guiheneuf@inria.fr> * camel/camel-session.c (camel_session_get_store_from_provider): initialize folder object. * camel/camel-store.c (init): new method. called by session object at instantiation time. * camel/camel-store.h (struct _CamelStore): new fields : session and url_name svn path=/trunk/; revision=879
Diffstat (limited to 'camel')
-rw-r--r--camel/Makefile.am2
-rw-r--r--camel/camel-session.c7
-rw-r--r--camel/camel-session.h5
-rw-r--r--camel/camel-store.c53
-rw-r--r--camel/camel-store.h8
5 files changed, 51 insertions, 24 deletions
diff --git a/camel/Makefile.am b/camel/Makefile.am
index 7edbc279f6..30e267e9c9 100644
--- a/camel/Makefile.am
+++ b/camel/Makefile.am
@@ -16,6 +16,7 @@ libcamel_la_SOURCES = \
camel-folder.c \
camel-provider.c \
camel-service.c \
+ camel-session.c \
camel-store.c \
gstring-util.c \
url-util.c
@@ -25,6 +26,7 @@ libcamelinclude_HEADERS = \
camel-folder.h \
camel-provider.h \
camel-service.h \
+ camel-session.h \
camel-store.h \
gstring-util.h \
url-util.h
diff --git a/camel/camel-session.c b/camel/camel-session.c
index 6acde38d79..a5d48a69ab 100644
--- a/camel/camel-session.c
+++ b/camel/camel-session.c
@@ -46,8 +46,8 @@ 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);
+ session->store_provider_list = g_hash_table_new (g_str_hash, g_str_equal);
+ session->transport_provider_list = g_hash_table_new (g_str_hash, g_str_equal);
}
@@ -126,6 +126,7 @@ camel_session_get_store_from_provider (CamelSession *session, CamelProvider *pro
g_assert(provider);
store = gtk_object_new (provider->object_type, NULL);
-#warning add session initialisation on object
+#warning set the url to a useful value.
+ camel_store_init(store, session, NULL);
return store;
}
diff --git a/camel/camel-session.h b/camel/camel-session.h
index d6242182cd..0fb881ea72 100644
--- a/camel/camel-session.h
+++ b/camel/camel-session.h
@@ -32,7 +32,11 @@ extern "C" {
#endif /* __cplusplus }*/
#include <gtk/gtk.h>
+
+typedef struct _CamelSession CamelSession;
+
#include "camel-provider.h"
+#include "camel-store.h"
#define CAMEL_SESSION_TYPE (camel_session_get_type ())
#define CAMEL_SESSION(obj) (GTK_CHECK_CAST((obj), CAMEL_SESSION_TYPE, CamelSession))
@@ -41,7 +45,6 @@ extern "C" {
-typedef struct _CamelSession CamelSession;
struct _CamelSession
{
diff --git a/camel/camel-store.c b/camel/camel-store.c
index a5ade87053..ba709916b0 100644
--- a/camel/camel-store.c
+++ b/camel/camel-store.c
@@ -31,6 +31,7 @@ static GtkObjectClass *parent_class=NULL;
static void camel_store_set_separator(CamelStore *store, gchar sep);
static CamelFolder *camel_store_get_root_folder(CamelStore *store);
static CamelFolder *camel_store_get_default_folder(CamelStore *store);
+static void __camel_store_init(CamelStore *store, CamelSession *session, GString *url_name);
@@ -40,6 +41,7 @@ camel_store_class_init (CamelStoreClass *camel_store_class)
parent_class = gtk_type_class (camel_service_get_type ());
/* virtual method definition */
+ camel_store_class->init = __camel_store_init;
camel_store_class->set_separator = camel_store_set_separator;
camel_store_class->get_separator = camel_store_get_separator;
camel_store_class->get_folder = camel_store_get_folder;
@@ -83,33 +85,48 @@ camel_store_get_type (void)
/**
- * camel_store_new: create a new store from an URL
- * @url: The url representing this store
+ * camel_store_init: call store's init method
+ * @store: the store to initialize
+ * @session: session which instantiates the store
+ * @url_name: URL defining the store
+ *
+ * This routine is called by the session object from which this
+ * store is created. It must not be called directly.
*
- * This routine creates a store from an URL name.
- * The URL may be for example:
- * pop3://user:passwd@host
+ **/
+void
+camel_store_init(CamelStore *store, CamelSession *session, GString *url_name)
+{
+ g_assert(store);
+ CS_CLASS(store)->init(store, session, url_name);
+}
+
+
+/**
+ * init: method called by a session object to
+ * initialize a store object
+ * @store: the store to initialize
+ * @session: session which instantiates the store
+ * @url_name: URL defining the store
*
- * WARNING : THIS METHOD DEFINITION IS SUBJECT TO
- * CHANGES.
+ * This routine is called by the session object from which this
+ * store is created.
*
- * Return value: the newly created store
**/
-CamelStore *
-camel_store_new(GString *url)
+static void
+__camel_store_init(CamelStore *store, CamelSession *session, GString *url_name)
{
- /* this method must be overloaded by providers */
- CamelStore *store;
-#warning must fill this
- /* here si what will happen here :
- In fact the method will take a Session object as a supplemental
- argument. From this object and from the url protocol
- (pop/mh/mbox ...) the correct provider will be selected an the
- corresponding store object will be created */
+
+ g_assert(session);
+ g_assert(url_name);
+
+ store->session = session;
+ store->url_name = url_name;
}
+
/**
* camel_store_set_separator: set the character which separates this folder
* path from the folders names in a lower level of hierarchy.
diff --git a/camel/camel-store.h b/camel/camel-store.h
index 55401577d0..df8409f92e 100644
--- a/camel/camel-store.h
+++ b/camel/camel-store.h
@@ -37,6 +37,7 @@ typedef struct _CamelStore CamelStore;
#include "camel-folder.h"
#include "camel-service.h"
+#include "camel-session.h"
#define CAMEL_STORE_TYPE (camel_store_get_type ())
#define CAMEL_STORE(obj) (GTK_CHECK_CAST((obj), CAMEL_STORE_TYPE, CamelStore))
@@ -48,6 +49,8 @@ struct _CamelStore
{
CamelService parent_object;
+ CamelSession *session;
+ GString *url_name;
gchar separator;
};
@@ -55,7 +58,8 @@ struct _CamelStore
typedef struct {
CamelServiceClass parent_class;
-
+
+ void (*init) (CamelStore *store, CamelSession *session, GString *url_name);
void (*set_separator) (CamelStore *store, gchar sep);
gchar (*get_separator) (CamelStore *store);
CamelFolder * (*get_folder) (CamelStore *store, GString *folder_name);
@@ -70,7 +74,7 @@ typedef struct {
/* Standard Gtk function */
GtkType camel_store_get_type (void);
-CamelStore *camel_store_new(GString *url);
+void camel_store_init(CamelStore *store, CamelSession *session, GString *url_name);
CamelFolder *camel_store_get_folder(CamelStore *store, GString *folder_name);
gchar camel_store_get_separator(CamelStore *store);