diff options
author | Dan Winship <danw@src.gnome.org> | 2000-02-22 02:38:58 +0800 |
---|---|---|
committer | Dan Winship <danw@src.gnome.org> | 2000-02-22 02:38:58 +0800 |
commit | d3d2adb98ce84c89f5e2c648329764d55d8ec412 (patch) | |
tree | df745b058ae76662cef56e168c7afae7a912b045 /camel/providers/mbox | |
parent | a81eaf4588c2ed0d126e8294e83c0e914e5fb91c (diff) | |
download | gsoc2013-evolution-d3d2adb98ce84c89f5e2c648329764d55d8ec412.tar gsoc2013-evolution-d3d2adb98ce84c89f5e2c648329764d55d8ec412.tar.gz gsoc2013-evolution-d3d2adb98ce84c89f5e2c648329764d55d8ec412.tar.bz2 gsoc2013-evolution-d3d2adb98ce84c89f5e2c648329764d55d8ec412.tar.lz gsoc2013-evolution-d3d2adb98ce84c89f5e2c648329764d55d8ec412.tar.xz gsoc2013-evolution-d3d2adb98ce84c89f5e2c648329764d55d8ec412.tar.zst gsoc2013-evolution-d3d2adb98ce84c89f5e2c648329764d55d8ec412.zip |
add CamelExceptions to several functions. Use camel_session_new to
* camel-session.h:
* camel-session.c: add CamelExceptions to several functions. Use
camel_session_new to initialize the session and URL fields of
created CamelStores as appropriate.
* camel-store.h:
* camel-store.c
* camel-service.h:
* camel-service.c: Move the session and url (and associated
functions) from CamelStore to CamelService. Add url_flags to
CamelService so subclasses can specify which URL components
are mandatory for them. Add camel_session_new for
camel_session_get_store* to use.
* providers/mbox/camel-mbox-folder.c:
* providers/mbox/camel-mbox-store.c:
* providers/mbox/camel-mbox-store.h: Update for above changes.
svn path=/trunk/; revision=1888
Diffstat (limited to 'camel/providers/mbox')
-rw-r--r-- | camel/providers/mbox/camel-mbox-folder.c | 4 | ||||
-rw-r--r-- | camel/providers/mbox/camel-mbox-store.c | 55 | ||||
-rw-r--r-- | camel/providers/mbox/camel-mbox-store.h | 5 |
3 files changed, 12 insertions, 52 deletions
diff --git a/camel/providers/mbox/camel-mbox-folder.c b/camel/providers/mbox/camel-mbox-folder.c index fb5c5a9299..ad899090dc 100644 --- a/camel/providers/mbox/camel-mbox-folder.c +++ b/camel/providers/mbox/camel-mbox-folder.c @@ -362,7 +362,7 @@ _set_name (CamelFolder *folder, const gchar *name, CamelException *ex) g_free (mbox_folder->index_file_path); separator = camel_store_get_separator (folder->parent_store, ex); - root_dir_path = camel_mbox_store_get_toplevel_dir (CAMEL_MBOX_STORE(folder->parent_store), ex); + root_dir_path = camel_mbox_store_get_toplevel_dir (CAMEL_MBOX_STORE(folder->parent_store)); CAMEL_LOG_FULL_DEBUG ("CamelMboxFolder::set_name full_name is %s\n", folder->full_name); CAMEL_LOG_FULL_DEBUG ("CamelMboxFolder::set_name root_dir_path is %s\n", root_dir_path); @@ -1112,7 +1112,7 @@ _get_message_by_uid (CamelFolder *folder, const gchar *uid, CamelException *ex) } - message = camel_mime_message_new_with_session (camel_store_get_session (parent_store, ex)); + message = camel_mime_message_new_with_session (camel_service_get_session (CAMEL_SERVICE (parent_store))); camel_data_wrapper_construct_from_stream (CAMEL_DATA_WRAPPER (message), message_stream); diff --git a/camel/providers/mbox/camel-mbox-store.c b/camel/providers/mbox/camel-mbox-store.c index 12923b1b5a..9c5e889aa7 100644 --- a/camel/providers/mbox/camel-mbox-store.c +++ b/camel/providers/mbox/camel-mbox-store.c @@ -23,16 +23,14 @@ #include "camel-mbox-store.h" #include "camel-mbox-folder.h" +#include "camel-exception.h" #include "url-util.h" -static CamelStoreClass *parent_class=NULL; - /* Returns the class for a CamelMboxStore */ #define CMBOXS_CLASS(so) CAMEL_MBOX_STORE_CLASS (GTK_OBJECT(so)->klass) #define CF_CLASS(so) CAMEL_FOLDER_CLASS (GTK_OBJECT(so)->klass) #define CMBOXF_CLASS(so) CAMEL_MBOX_FOLDER_CLASS (GTK_OBJECT(so)->klass) -static void _init (CamelStore *store, CamelSession *session, const gchar *url_name, CamelException *ex); static CamelFolder *_get_folder (CamelStore *store, const gchar *folder_name, CamelException *ex); @@ -40,12 +38,8 @@ static void camel_mbox_store_class_init (CamelMboxStoreClass *camel_mbox_store_class) { CamelStoreClass *camel_store_class = CAMEL_STORE_CLASS (camel_mbox_store_class); - - parent_class = gtk_type_class (camel_store_get_type ()); - /* virtual method definition */ /* virtual method overload */ - camel_store_class->init = _init; camel_store_class->get_folder = _get_folder; } @@ -55,8 +49,10 @@ static void camel_mbox_store_init (gpointer object, gpointer klass) { CamelStore *store = CAMEL_STORE (object); - + CamelService *service = CAMEL_SERVICE (object); + store->separator = '/'; + service->url_flags = CAMEL_SERVICE_URL_NEED_PATH; } @@ -87,50 +83,17 @@ camel_mbox_store_get_type (void) } - - -/* These evil public functions are here for test only */ -void -camel_mbox_store_set_toplevel_dir (CamelMboxStore *store, const gchar *toplevel, CamelException *ex) -{ - store->toplevel_dir = g_strdup (toplevel); - CAMEL_STORE(store)->separator = '/'; -} - - const gchar * -camel_mbox_store_get_toplevel_dir (CamelMboxStore *store, CamelException *ex) +camel_mbox_store_get_toplevel_dir (CamelMboxStore *store) { - return store->toplevel_dir; -} - + Gurl *url = CAMEL_SERVICE (store)->url; - -static void -_init (CamelStore *store, CamelSession *session, const gchar *url_name, CamelException *ex) -{ - CamelMboxStore *mbox_store = CAMEL_MBOX_STORE (store); - Gurl *store_url; - - g_assert (url_name); - /* call parent implementation */ - parent_class->init (store, session, url_name, ex); - - - /* find the path in the URL*/ - store_url = g_url_new (url_name); - - g_return_if_fail (store_url); - g_return_if_fail (store_url->path); - - mbox_store->toplevel_dir = g_strdup (store_url->path); - g_url_free (store_url); - - - + g_assert(url != NULL); + return url->path; } + static CamelFolder * _get_folder (CamelStore *store, const gchar *folder_name, CamelException *ex) { diff --git a/camel/providers/mbox/camel-mbox-store.h b/camel/providers/mbox/camel-mbox-store.h index a5aea965e2..e33688066f 100644 --- a/camel/providers/mbox/camel-mbox-store.h +++ b/camel/providers/mbox/camel-mbox-store.h @@ -43,7 +43,6 @@ extern "C" { typedef struct { CamelStore parent_object; - gchar *toplevel_dir; } CamelMboxStore; @@ -51,7 +50,6 @@ typedef struct { typedef struct { CamelStoreClass parent_class; - } CamelMboxStoreClass; @@ -60,8 +58,7 @@ typedef struct { /* Standard Gtk function */ GtkType camel_mbox_store_get_type (void); -void camel_mbox_store_set_toplevel_dir (CamelMboxStore *store, const gchar *toplevel, CamelException *ex); -const gchar *camel_mbox_store_get_toplevel_dir (CamelMboxStore *store, CamelException *ex); +const gchar *camel_mbox_store_get_toplevel_dir (CamelMboxStore *store); #ifdef __cplusplus } |