aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers/MH
diff options
context:
space:
mode:
authorbertrand <Bertrand.Guiheneuf@inria.fr>1999-04-22 06:45:49 +0800
committerBertrand Guiheneuf <bertrand@src.gnome.org>1999-04-22 06:45:49 +0800
commited6323e9781d6a38bdb6151a77f79b1326fbb6ba (patch)
tree97ff422dea7fad35372848ec51c840ebb433ba9f /camel/providers/MH
parentb23f36ba14259a3f4e3d3811158a7a59260dc495 (diff)
downloadgsoc2013-evolution-ed6323e9781d6a38bdb6151a77f79b1326fbb6ba.tar
gsoc2013-evolution-ed6323e9781d6a38bdb6151a77f79b1326fbb6ba.tar.gz
gsoc2013-evolution-ed6323e9781d6a38bdb6151a77f79b1326fbb6ba.tar.bz2
gsoc2013-evolution-ed6323e9781d6a38bdb6151a77f79b1326fbb6ba.tar.lz
gsoc2013-evolution-ed6323e9781d6a38bdb6151a77f79b1326fbb6ba.tar.xz
gsoc2013-evolution-ed6323e9781d6a38bdb6151a77f79b1326fbb6ba.tar.zst
gsoc2013-evolution-ed6323e9781d6a38bdb6151a77f79b1326fbb6ba.zip
more test implementation.
1999-04-22 bertrand <Bertrand.Guiheneuf@inria.fr> * camel/providers/MH/camel-mh-store.c: more test implementation. * camel/camel-store.c (camel_store_get_type): typo fix A lot of small adds and corrections. svn path=/trunk/; revision=867
Diffstat (limited to 'camel/providers/MH')
-rw-r--r--camel/providers/MH/Makefile.am6
-rw-r--r--camel/providers/MH/camel-mh-folder.c51
-rw-r--r--camel/providers/MH/camel-mh-folder.h3
-rw-r--r--camel/providers/MH/camel-mh-store.c89
-rw-r--r--camel/providers/MH/camel-mh-store.h71
5 files changed, 212 insertions, 8 deletions
diff --git a/camel/providers/MH/Makefile.am b/camel/providers/MH/Makefile.am
index 9946650188..0f52c9fb40 100644
--- a/camel/providers/MH/Makefile.am
+++ b/camel/providers/MH/Makefile.am
@@ -12,10 +12,12 @@ INCLUDES = -I.. -I$(srcdir)/.. -I$(includedir) \
$(GTK_INCLUDEDIR) -I$(top_srcdir)/camel
libcamelmh_la_SOURCES = \
- camel-mh-folder.c
+ camel-mh-folder.c \
+ camel-mh-store.c
libcamelmhinclude_HEADERS = \
- camel-mh-folder.h
+ camel-mh-folder.h \
+ camel-mh-store.h
libcamelmh_la_LDFLAGS = -version-info 0:0:0 -rpath $(libdir)
diff --git a/camel/providers/MH/camel-mh-folder.c b/camel/providers/MH/camel-mh-folder.c
index abaf638df8..d875182564 100644
--- a/camel/providers/MH/camel-mh-folder.c
+++ b/camel/providers/MH/camel-mh-folder.c
@@ -23,19 +23,24 @@
#include "camel-mh-folder.h"
-static CamelMhFolderClass *camel_mh_folder_parent_class=NULL;
+static CamelFolderClass *parent_class=NULL;
/* Returns the class for a CamelMhFolder */
#define CMHF_CLASS(so) CAMEL_MH_FOLDER_CLASS (GTK_OBJECT(so)->klass)
+#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
camel_mh_folder_class_init (CamelMhFolderClass *camel_mh_folder_class)
{
- camel_mh_folder_parent_class = gtk_type_class (camel_folder_get_type ());
+ parent_class = gtk_type_class (camel_folder_get_type ());
/* virtual method definition */
/* virtual method overload */
+ CAMEL_FOLDER_CLASS(camel_mh_folder_class)->set_name = camel_mh_folder_set_name;
}
@@ -53,8 +58,8 @@ camel_mh_folder_get_type (void)
GtkTypeInfo camel_mh_folder_info =
{
"CamelMhFolder",
- sizeof (CamelFolder),
- sizeof (CamelFolderClass),
+ sizeof (CamelMhFolder),
+ sizeof (CamelMhFolderClass),
(GtkClassInitFunc) camel_mh_folder_class_init,
(GtkObjectInitFunc) NULL,
/* reserved_1 */ NULL,
@@ -62,10 +67,46 @@ camel_mh_folder_get_type (void)
(GtkClassInitFunc) NULL,
};
- camel_mh_folder_type = gtk_type_unique (gtk_object_get_type (), &camel_mh_folder_info);
+ camel_mh_folder_type = gtk_type_unique (CAMEL_FOLDER_TYPE, &camel_mh_folder_info);
}
return camel_mh_folder_type;
}
+/**
+ * camel_mh_folder_set_name: set the name of an MH folder
+ * @folder: the folder to set the name
+ * @name: a string representing the (short) name
+ *
+ *
+ *
+ **/
+static void
+camel_mh_folder_set_name(CamelFolder *folder, GString *name)
+{
+ GString *root_dir_path;
+ GString *full_dir_path;
+ CamelMhFolder *mh_folder = CAMEL_MH_FOLDER(folder);
+ gchar separator;
+
+ g_assert(folder);
+ g_assert(name);
+ g_assert(folder->parent_store);
+
+ /* call default implementation */
+ parent_class->set_name (folder, name);
+
+ if (mh_folder->directory_path) g_string_free (mh_folder->directory_path, 0);
+
+ 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;
+
+
+}
diff --git a/camel/providers/MH/camel-mh-folder.h b/camel/providers/MH/camel-mh-folder.h
index 41650c9cf1..2e9fbb47f0 100644
--- a/camel/providers/MH/camel-mh-folder.h
+++ b/camel/providers/MH/camel-mh-folder.h
@@ -44,7 +44,8 @@ extern "C" {
typedef struct {
CamelFolder parent_object;
-
+ GString *directory_path;
+
} CamelMhFolder;
diff --git a/camel/providers/MH/camel-mh-store.c b/camel/providers/MH/camel-mh-store.c
new file mode 100644
index 0000000000..2a1258a7b9
--- /dev/null
+++ b/camel/providers/MH/camel-mh-store.c
@@ -0,0 +1,89 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/* camel-mh-store.c : class for an mh store */
+
+/*
+ *
+ * Copyright (C) 1999 Bertrand Guiheneuf <Bertrand.Guiheneuf@inria.fr> .
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA
+ */
+
+#include "camel-mh-store.h"
+#include "camel-mh-folder.h"
+
+static GtkObjectClass *parent_class=NULL;
+
+/* Returns the class for a CamelMhStore */
+#define CS_CLASS(so) CAMEL_MH_STORE_CLASS (GTK_OBJECT(so)->klass)
+
+
+
+static void
+camel_mh_store_class_init (CamelMhStoreClass *camel_mh_store_class)
+{
+ parent_class = gtk_type_class (camel_store_get_type ());
+
+ /* virtual method definition */
+ /* virtual method overload */
+}
+
+
+
+
+
+
+
+GtkType
+camel_mh_store_get_type (void)
+{
+ static GtkType camel_mh_store_type = 0;
+
+ if (!camel_mh_store_type) {
+ GtkTypeInfo camel_mh_store_info =
+ {
+ "CamelMhStore",
+ sizeof (CamelMhStore),
+ sizeof (CamelMhStoreClass),
+ (GtkClassInitFunc) camel_mh_store_class_init,
+ (GtkObjectInitFunc) NULL,
+ /* reserved_1 */ NULL,
+ /* reserved_2 */ NULL,
+ (GtkClassInitFunc) NULL,
+ };
+
+ camel_mh_store_type = gtk_type_unique (CAMEL_FOLDER_TYPE, &camel_mh_store_info);
+ }
+
+ return camel_mh_store_type;
+}
+
+
+
+
+/** These evil public functions are here for test only **/
+void
+camel_mh_store_set_toplevel_dir(CamelMhStore *store, GString *toplevel)
+{
+ store->toplevel_dir = toplevel;
+ CAMEL_STORE(store)->separator = '/';
+}
+
+
+GString *
+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
new file mode 100644
index 0000000000..058eb48c64
--- /dev/null
+++ b/camel/providers/MH/camel-mh-store.h
@@ -0,0 +1,71 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/* camel-mhstore.h : class for an mh store */
+
+/*
+ *
+ * Copyright (C) 1999 Bertrand Guiheneuf <Bertrand.Guiheneuf@inria.fr> .
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA
+ */
+
+
+#ifndef CAMEL_MH_STORE_H
+#define CAMEL_MH_STORE_H 1
+
+
+#ifdef __cplusplus
+extern "C" {
+#pragma }
+#endif /* __cplusplus }*/
+
+#include <gtk/gtk.h>
+#include "camel-store.h"
+
+#define CAMEL_MH_STORE_TYPE (camel_mh_store_get_type ())
+#define CAMEL_MH_STORE(obj) (GTK_CHECK_CAST((obj), CAMEL_MH_STORE_TYPE, CamelMhStore))
+#define CAMEL_MH_STORE_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), CAMEL_MH_STORE_TYPE, CamelMhStoreClass))
+#define IS_CAMEL_MH_STORE(o) (GTK_CHECK_TYPE((o), CAMEL_MH_STORE_TYPE))
+
+
+typedef struct {
+ CamelStore parent_object;
+
+ GString *toplevel_dir;
+
+} CamelMhStore;
+
+
+
+typedef struct {
+ CamelStoreClass parent_class;
+
+
+} CamelMhStoreClass;
+
+
+/* public methods */
+
+/* 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);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* CAMEL_MH_STORE_H */