aboutsummaryrefslogtreecommitdiffstats
path: root/filter/filter-code.c
diff options
context:
space:
mode:
authorNot Zed <NotZed@HelixCode.com>2000-07-30 11:23:41 +0800
committerMichael Zucci <zucchi@src.gnome.org>2000-07-30 11:23:41 +0800
commita44d1c188b0bc166e5966ae3854a1c0bc8c44afd (patch)
treedf30c85510f2b55384f95f184ae4768eedc0bac7 /filter/filter-code.c
parent4f1ecbb64b04048e1765f25e65799830316021d1 (diff)
downloadgsoc2013-evolution-a44d1c188b0bc166e5966ae3854a1c0bc8c44afd.tar
gsoc2013-evolution-a44d1c188b0bc166e5966ae3854a1c0bc8c44afd.tar.gz
gsoc2013-evolution-a44d1c188b0bc166e5966ae3854a1c0bc8c44afd.tar.bz2
gsoc2013-evolution-a44d1c188b0bc166e5966ae3854a1c0bc8c44afd.tar.lz
gsoc2013-evolution-a44d1c188b0bc166e5966ae3854a1c0bc8c44afd.tar.xz
gsoc2013-evolution-a44d1c188b0bc166e5966ae3854a1c0bc8c44afd.tar.zst
gsoc2013-evolution-a44d1c188b0bc166e5966ae3854a1c0bc8c44afd.zip
** Almost a total rewrite of every file, except for filter-driver which
2000-07-30 Not Zed <NotZed@HelixCode.com> ** Almost a total rewrite of every file, except for filter-driver which just had minor updates. The rule format has changed. svn path=/trunk/; revision=4418
Diffstat (limited to 'filter/filter-code.c')
-rw-r--r--filter/filter-code.c121
1 files changed, 121 insertions, 0 deletions
diff --git a/filter/filter-code.c b/filter/filter-code.c
new file mode 100644
index 0000000000..cbab60359e
--- /dev/null
+++ b/filter/filter-code.c
@@ -0,0 +1,121 @@
+/*
+ * Copyright (C) 2000 Helix Code Inc.
+ *
+ * Authors: Not Zed <notzed@lostzed.mmc.com.au>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library 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 Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <gtk/gtk.h>
+#include <gnome.h>
+
+#include "filter-code.h"
+
+static void build_code(FilterElement *fe, GString *out, struct _FilterPart *ff);
+static void format_sexp(FilterElement *, GString *);
+
+static void filter_code_class_init (FilterCodeClass *class);
+static void filter_code_init (FilterCode *gspaper);
+static void filter_code_finalise (GtkObject *obj);
+
+static FilterInputClass *parent_class;
+
+guint
+filter_code_get_type (void)
+{
+ static guint type = 0;
+
+ if (!type) {
+ GtkTypeInfo type_info = {
+ "FilterCode",
+ sizeof(FilterCode),
+ sizeof(FilterCodeClass),
+ (GtkClassInitFunc)filter_code_class_init,
+ (GtkObjectInitFunc)filter_code_init,
+ (GtkArgSetFunc)NULL,
+ (GtkArgGetFunc)NULL
+ };
+
+ type = gtk_type_unique(filter_input_get_type (), &type_info);
+ }
+
+ return type;
+}
+
+static void
+filter_code_class_init (FilterCodeClass *class)
+{
+ GtkObjectClass *object_class;
+ FilterElementClass *filter_element = (FilterElementClass *)class;
+
+ object_class = (GtkObjectClass *)class;
+ parent_class = gtk_type_class(filter_input_get_type ());
+
+ filter_element->build_code = build_code;
+ filter_element->format_sexp = format_sexp;
+
+ object_class->finalize = filter_code_finalise;
+ /* override methods */
+
+}
+
+static void
+filter_code_init (FilterCode *o)
+{
+ ((FilterInput *)o)->type = g_strdup("code");
+}
+
+static void
+filter_code_finalise(GtkObject *obj)
+{
+ FilterCode *o = (FilterCode *)obj;
+
+ o = o;
+
+ ((GtkObjectClass *)(parent_class))->finalize(obj);
+}
+
+/**
+ * filter_code_new:
+ *
+ * Create a new FilterCode object.
+ *
+ * Return value: A new #FilterCode object.
+ **/
+FilterCode *
+filter_code_new(void)
+{
+ FilterCode *o = (FilterCode *)gtk_type_new(filter_code_get_type ());
+ return o;
+}
+
+/* here, the string IS the code */
+static void build_code(FilterElement *fe, GString *out, struct _FilterPart *ff)
+{
+ GList *l;
+ FilterInput *fi = (FilterInput *)fe;
+
+ l = fi->values;
+ while (l) {
+ g_string_append(out, (char *)l->data);
+ l = g_list_next(l);
+ }
+}
+
+/* and we have no value */
+static void format_sexp(FilterElement *fe, GString *out)
+{
+ return;
+}