From b9daf0016bc3d7244ced57dd88f63c1fd6debbac Mon Sep 17 00:00:00 2001 From: Bertrand Guiheneuf Date: Tue, 3 Aug 1999 15:37:35 +0000 Subject: new public functions (_set_name): set full_path. * camel/camel-folder.c (camel_folder_set_name): (camel_folder_get_name): new public functions (_set_name): set full_path. (_set_full_name): (camel_folder_set_full_name): commented out this functions def. It would make things very difficult to handle, and would not be very useful. * camel/providers/MH/camel-mh-store.h: * camel/providers/MH/camel-mh-store.c (camel_mh_store_set_toplevel_dir): (camel_mh_store_get_toplevel_dir): * camel/providers/MH/camel-mh-folder.c (_set_name): * camel/providers/MH/camel-mh-folder.h: use (gchar *) instead of (GString *) everywhere. use const when necessary. * camel/camel-folder.h (struct _CamelFolder): removed unused message_list field. svn path=/trunk/; revision=1072 --- camel/camel-folder.c | 92 +++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 70 insertions(+), 22 deletions(-) (limited to 'camel/camel-folder.c') diff --git a/camel/camel-folder.c b/camel/camel-folder.c index 7211ba63f6..db3e7f9f8a 100644 --- a/camel/camel-folder.c +++ b/camel/camel-folder.c @@ -33,7 +33,7 @@ static void _init_with_store (CamelFolder *folder, CamelStore *parent_store); static void _open (CamelFolder *folder, CamelFolderOpenMode mode); static void _close (CamelFolder *folder, gboolean expunge); static void _set_name (CamelFolder *folder, const gchar *name); -static void _set_full_name (CamelFolder *folder, const gchar *name); +/* static void _set_full_name (CamelFolder *folder, const gchar *name); */ static const gchar *_get_name (CamelFolder *folder); static const gchar *_get_full_name (CamelFolder *folder); static gboolean _can_hold_folders (CamelFolder *folder); @@ -137,7 +137,7 @@ _init_with_store (CamelFolder *folder, CamelStore *parent_store) * **/ static void -_open( CamelFolder *folder, CamelFolderOpenMode mode) +_open (CamelFolder *folder, CamelFolderOpenMode mode) { folder->open_state = FOLDER_OPEN; folder->open_mode = mode; @@ -162,32 +162,54 @@ _close (CamelFolder *folder, gboolean expunge) -/** - * _set_name:set the (short) name of the folder - * @folder: folder - * @name: new name of the folder - * - * set the name of the folder. - * - * - **/ + static void _set_name(CamelFolder *folder, const gchar *name) { + gchar separator; + gchar *full_name; + const gchar *parent_full_name; + + g_assert (folder); + g_assert (name); + g_assert (folder->parent_store); + if (folder->name) g_free(folder->name); + if (folder->full_name) g_free (folder->full_name); + + separator = camel_store_get_separator (folder->parent_store); + + if (folder->parent_folder) { + parent_full_name = camel_folder_get_full_name (folder->parent_folder); + full_name = g_strdup_printf ("%s%d%s", parent_full_name, separator, name); + + } else { + full_name = g_strdup (name); + } + folder->name = g_strdup (name); -} + folder->full_name = full_name; +} /** - * _set_full_name:set the (full) name of the folder + * camel_folder_set_name:set the (short) name of the folder * @folder: folder * @name: new name of the folder * * set the name of the folder. * + * **/ +void +camel_folder_set_name (CamelFolder *folder, const gchar *name) +{ + CF_CLASS(folder)->set_name (folder, name); +} + + +#if 0 static void _set_full_name (CamelFolder *folder, const gchar *name) { @@ -196,10 +218,30 @@ _set_full_name (CamelFolder *folder, const gchar *name) } +/** + * camel_folder_set_full_name:set the (full) name of the folder + * @folder: folder + * @name: new name of the folder + * + * set the name of the folder. + * + **/ +void +camel_folder_set_full_name (CamelFolder *folder, const gchar *name) +{ + CF_CLASS(folder)->set_full_name (folder, name); +} +#endif + +static const gchar * +_get_name (CamelFolder *folder) +{ + return folder->name; +} /** - * _get_name: get the (short) name of the folder + * camel_folder_get_name: get the (short) name of the folder * @folder: * * get the name of the folder. The fully qualified name @@ -207,29 +249,35 @@ _set_full_name (CamelFolder *folder, const gchar *name) * * Return value: name of the folder **/ -static const gchar * -_get_name (CamelFolder *folder) +const gchar * +camel_folder_get_name (CamelFolder *folder) { - return folder->name; + return CF_CLASS(folder)->get_name (folder); } + +static const gchar * +_get_full_name (CamelFolder *folder) +{ + return folder->full_name; +} + /** - * _get_full_name:get the (full) name of the folder + * camel_folder_get_full_name:get the (full) name of the folder * @folder: folder to get the name * * get the name of the folder. * * Return value: full name of the folder **/ -static const gchar * -_get_full_name (CamelFolder *folder) +const gchar * +camel_folder_get_full_name (CamelFolder *folder) { - return folder->full_name; + return CF_CLASS(folder)->get_full_name (folder); } - /** * _can_hold_folders: tests if the folder can contain other folders * @folder: The folder object -- cgit