From 0c6cc80cdf8c85ee86b588c1d49d5cbd4fbe5e82 Mon Sep 17 00:00:00 2001 From: bertrand Date: Fri, 17 Dec 1999 19:19:59 +0000 Subject: use exception mechanism. (camel_folder_set_name): idem. 1999-12-17 bertrand * camel/camel-folder.c (_set_name): use exception mechanism. (camel_folder_set_name): idem. (camel_folder_set_full_name): idem. (_get_name): idem. (camel_folder_get_name): idem. (_get_full_name): idem. (camel_folder_get_full_name): idem. (_can_hold_folders): idem. (_can_hold_messages): idem. (_exists): idem. (camel_folder_exists): idem. (_is_open): idem. (_get_subfolder): idem. (camel_folder_get_subfolder): idem. * camel/camel-exception.c (camel_exception_clear): New function. Clear an exception. (camel_exception_get_id): New function. (camel_exception_get_description): New function. * camel/camel-folder.c (_set_name): Use the exception system. When the folder has no parent, don't set its full name field. svn path=/trunk/; revision=1499 --- camel/camel-exception.c | 74 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) (limited to 'camel/camel-exception.c') diff --git a/camel/camel-exception.c b/camel/camel-exception.c index 254b3046e9..961034cd78 100644 --- a/camel/camel-exception.c +++ b/camel/camel-exception.c @@ -46,6 +46,34 @@ camel_exception_new () return ex; } + +/** + * camel_exception_clear: Clear an exception + * @exception: the exception object + * + * Clear an exception, that is, set the + * exception ID to CAMEL_EXCEPTION_NONE and + * free the description text. + * If the exception is NULL, this funtion just + * returns. + **/ +void +camel_exception_clear (CamelException *exception) +{ + if (!exception) return; + + /* free the description text */ + if (exception->desc) + g_free (exception->desc); + exception->desc = NULL; + + /* set the Exception Id to NULL */ + exception->id = CAMEL_EXCEPTION_NONE; +} + + + + /** * camel_exception_free: Free an exception * @exception: The exception object to free @@ -122,3 +150,49 @@ camel_exception_xfer (CamelException *ex_dst, ex_src->desc = NULL; ex_src->id = CAMEL_EXCEPTION_NONE; } + + + + + + + +/** + * camel_exception_get_id: get the exception id + * @ex: The exception object + * + * Return the id of an exception. + * If @ex is NULL, return CAMEL_EXCEPTION_NONE; + * + * Return value: Exception ID. + **/ +ExceptionId +camel_exception_get_id (CamelException *ex) +{ + if (ex) + return ex->id; + else + return CAMEL_EXCEPTION_NONE; +} + + + + +/** + * camel_exception_get_description: get the description of an exception. + * @ex: The exception object + * + * Return the exception description text. + * If @ex is NULL, return NULL; + * + * + * Return value: Exception description text. + **/ +const gchar * +camel_exception_get_description (CamelException *ex) +{ + if (ex) + return ex->desc; + else + return NULL; +} -- cgit v1.2.3