aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBertrand Guiheneuf <bertrand@src.gnome.org>1999-08-03 23:37:35 +0800
committerBertrand Guiheneuf <bertrand@src.gnome.org>1999-08-03 23:37:35 +0800
commitb9daf0016bc3d7244ced57dd88f63c1fd6debbac (patch)
treee18a41319d59b4243960952410456a97948748d3
parent382308f44a4ab93659f9f54c8dac2c2cc381a471 (diff)
downloadgsoc2013-evolution-b9daf0016bc3d7244ced57dd88f63c1fd6debbac.tar.gz
gsoc2013-evolution-b9daf0016bc3d7244ced57dd88f63c1fd6debbac.tar.zst
gsoc2013-evolution-b9daf0016bc3d7244ced57dd88f63c1fd6debbac.zip
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
-rw-r--r--ChangeLog25
-rw-r--r--camel/camel-folder.c92
-rw-r--r--camel/camel-folder.h8
-rw-r--r--camel/camel-store.c1
-rw-r--r--camel/providers/MH/camel-mh-folder.c21
-rw-r--r--camel/providers/MH/camel-mh-folder.h2
-rw-r--r--camel/providers/MH/camel-mh-store.c8
-rw-r--r--camel/providers/MH/camel-mh-store.h9
8 files changed, 116 insertions, 50 deletions
diff --git a/ChangeLog b/ChangeLog
index 1077502992..0d376c6d2c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,27 @@
-1999-08-03 root <guiheneu@jean.joudboeuf.fr>
-
-
1999-08-03 bertrand <Bertrand.Guiheneuf@aful.org>
+ * 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.
+
* camel/camel-mime-part.c (_set_content_object):
There is a probleme here. We can not allow mime part
content-type field and content_object mime-type to be
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
diff --git a/camel/camel-folder.h b/camel/camel-folder.h
index 2e6eaf2f85..69a082fe1f 100644
--- a/camel/camel-folder.h
+++ b/camel/camel-folder.h
@@ -59,7 +59,6 @@ struct _CamelFolder
{
GtkObject parent_object;
- GList *message_list;
gboolean can_hold_folders;
gboolean can_hold_messages;
gboolean exists_on_store;
@@ -82,7 +81,7 @@ typedef struct {
void (*open) (CamelFolder *object, CamelFolderOpenMode mode);
void (*close) (CamelFolder *folder, gboolean expunge);
void (*set_name) (CamelFolder *folder, const gchar *name);
- void (*set_full_name) (CamelFolder *folder, const gchar *name);
+/* void (*set_full_name) (CamelFolder *folder, const gchar *name); */
const gchar * (*get_name) (CamelFolder *folder);
const gchar * (*get_full_name) (CamelFolder *folder);
gboolean (*can_hold_folders) (CamelFolder *folder);
@@ -116,7 +115,10 @@ CamelStore *camel_folder_get_parent_store (CamelFolder *folder);
CamelFolderOpenMode camel_folder_get_mode(CamelFolder *folder);
GList *camel_folder_list_subfolders(CamelFolder *folder);
GList *camel_folder_expunge(CamelFolder *folder);
-
+void camel_folder_set_name (CamelFolder *folder, const gchar *name);
+const gchar *camel_folder_get_name (CamelFolder *folder);
+/* void camel_folder_set_full_name (CamelFolder *folder, const gchar *name); */
+const gchar *camel_folder_get_full_name (CamelFolder *folder);
#ifdef __cplusplus
diff --git a/camel/camel-store.c b/camel/camel-store.c
index c58f14c110..78706b1703 100644
--- a/camel/camel-store.c
+++ b/camel/camel-store.c
@@ -182,7 +182,6 @@ CamelFolder *
camel_store_get_folder (CamelStore *store, gchar *folder_name)
{
-#warning fill this part in.
return NULL;
}
diff --git a/camel/providers/MH/camel-mh-folder.c b/camel/providers/MH/camel-mh-folder.c
index e4fe3c5bd2..2db3a74e8e 100644
--- a/camel/providers/MH/camel-mh-folder.c
+++ b/camel/providers/MH/camel-mh-folder.c
@@ -33,7 +33,7 @@ static CamelFolderClass *parent_class=NULL;
#define CF_CLASS(so) CAMEL_FOLDER_CLASS (GTK_OBJECT(so)->klass)
#define CMHS_CLASS(so) CAMEL_STORE_CLASS (GTK_OBJECT(so)->klass)
-static void camel_mh_folder_set_name(CamelFolder *folder, GString *name);
+static void _set_name(CamelFolder *folder, const gchar *name);
static void
@@ -43,7 +43,7 @@ camel_mh_folder_class_init (CamelMhFolderClass *camel_mh_folder_class)
/* virtual method definition */
/* virtual method overload */
- CAMEL_FOLDER_CLASS(camel_mh_folder_class)->set_name = camel_mh_folder_set_name;
+ CAMEL_FOLDER_CLASS(camel_mh_folder_class)->set_name = _set_name;
}
@@ -86,10 +86,11 @@ camel_mh_folder_get_type (void)
*
**/
static void
-camel_mh_folder_set_name(CamelFolder *folder, GString *name)
+_set_name (CamelFolder *folder, const gchar *name)
{
- GString *root_dir_path;
- GString *full_dir_path;
+ const gchar *root_dir_path;
+ gchar *full_name;
+ const gchar *parent_full_name;
CamelMhFolder *mh_folder = CAMEL_MH_FOLDER(folder);
gchar separator;
@@ -100,16 +101,12 @@ camel_mh_folder_set_name(CamelFolder *folder, GString *name)
/* call default implementation */
parent_class->set_name (folder, name);
- if (mh_folder->directory_path) g_string_free (mh_folder->directory_path, 0);
+ if (mh_folder->directory_path) g_free (mh_folder->directory_path);
separator = camel_store_get_separator (folder->parent_store);
-
-
root_dir_path = camel_mh_store_get_toplevel_dir (CAMEL_MH_STORE(folder->parent_store));
- full_dir_path = g_string_clone(root_dir_path);
- g_string_append_c(full_dir_path, separator);
- g_string_append_g_string(full_dir_path, name);
- mh_folder->directory_path = full_dir_path;
+ mh_folder->directory_path = g_strdup_printf ("%s%c%s", root_dir_path, separator, folder->full_name);
}
+
diff --git a/camel/providers/MH/camel-mh-folder.h b/camel/providers/MH/camel-mh-folder.h
index 2e9fbb47f0..332698bdba 100644
--- a/camel/providers/MH/camel-mh-folder.h
+++ b/camel/providers/MH/camel-mh-folder.h
@@ -44,7 +44,7 @@ extern "C" {
typedef struct {
CamelFolder parent_object;
- GString *directory_path;
+ gchar *directory_path;
} CamelMhFolder;
diff --git a/camel/providers/MH/camel-mh-store.c b/camel/providers/MH/camel-mh-store.c
index 2a1258a7b9..efdb2b86e9 100644
--- a/camel/providers/MH/camel-mh-store.c
+++ b/camel/providers/MH/camel-mh-store.c
@@ -75,15 +75,15 @@ camel_mh_store_get_type (void)
/** These evil public functions are here for test only **/
void
-camel_mh_store_set_toplevel_dir(CamelMhStore *store, GString *toplevel)
+camel_mh_store_set_toplevel_dir (CamelMhStore *store, const gchar *toplevel)
{
- store->toplevel_dir = toplevel;
+ store->toplevel_dir = g_strdup (toplevel);
CAMEL_STORE(store)->separator = '/';
}
-GString *
-camel_mh_store_get_toplevel_dir(CamelMhStore *store)
+const gchar *
+camel_mh_store_get_toplevel_dir (CamelMhStore *store)
{
return store->toplevel_dir;
}
diff --git a/camel/providers/MH/camel-mh-store.h b/camel/providers/MH/camel-mh-store.h
index 058eb48c64..8aa4a9bca2 100644
--- a/camel/providers/MH/camel-mh-store.h
+++ b/camel/providers/MH/camel-mh-store.h
@@ -43,8 +43,7 @@ extern "C" {
typedef struct {
CamelStore parent_object;
- GString *toplevel_dir;
-
+ gchar *toplevel_dir;
} CamelMhStore;
@@ -61,11 +60,13 @@ typedef struct {
/* Standard Gtk function */
GtkType camel_mh_store_get_type (void);
-void camel_mh_store_set_toplevel_dir(CamelMhStore *store, GString *toplevel);
-GString *camel_mh_store_get_toplevel_dir(CamelMhStore *store);
+void camel_mh_store_set_toplevel_dir (CamelMhStore *store, const gchar *toplevel);
+const gchar *camel_mh_store_get_toplevel_dir (CamelMhStore *store);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* CAMEL_MH_STORE_H */
+
+