Updated Traditional Chinese translation.
[evolution.git] / mail / em-vfolder-editor.c
blob781a80bb19bb53c2f98d81b4943d03b519a6e7a6
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /*
3 * Copyright (C) 2001-2002 Ximian Inc.
5 * Authors: Not Zed <notzed@lostzed.mmc.com.au>
6 * Jeffrey Stedfast <fejj@ximian.com>
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of version 2 of the GNU General Public
10 * License as published by the Free Software Foundation.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
17 * You should have received a copy of the GNU General Public
18 * License along with this program; if not, write to the
19 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 * Boston, MA 02111-1307, USA.
23 #ifdef HAVE_CONFIG_H
24 #include <config.h>
25 #endif
27 #include <gtk/gtk.h>
28 #include <libgnome/gnome-i18n.h>
30 #include "em-vfolder-editor.h"
31 #include "em-vfolder-rule.h"
33 #define d(x)
35 static FilterRule *create_rule (RuleEditor *re);
37 static RuleEditorClass *parent_class = NULL;
40 static void
41 em_vfolder_editor_finalise (GObject *obj)
43 G_OBJECT_CLASS (parent_class)->finalize (obj);
46 static void
47 em_vfolder_editor_class_init (EMVFolderEditorClass *klass)
49 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
50 RuleEditorClass *re_class = (RuleEditorClass *) klass;
52 parent_class = g_type_class_ref (rule_editor_get_type ());
54 gobject_class->finalize = em_vfolder_editor_finalise;
56 /* override methods */
57 re_class->create_rule = create_rule;
60 static void
61 em_vfolder_editor_init (EMVFolderEditor *ve)
66 GtkType
67 em_vfolder_editor_get_type (void)
69 static GtkType type = 0;
71 if (!type) {
72 static const GTypeInfo info = {
73 sizeof (EMVFolderEditorClass),
74 NULL, /* base_class_init */
75 NULL, /* base_class_finalize */
76 (GClassInitFunc) em_vfolder_editor_class_init,
77 NULL, /* class_finalize */
78 NULL, /* class_data */
79 sizeof (EMVFolderEditor),
80 0, /* n_preallocs */
81 (GInstanceInitFunc) em_vfolder_editor_init,
84 type = g_type_register_static (RULE_TYPE_EDITOR, "EMVFolderEditor", &info, 0);
87 return type;
90 /**
91 * em_vfolder_editor_new:
93 * Create a new EMVFolderEditor object.
95 * Return value: A new #EMVFolderEditor object.
96 **/
97 EMVFolderEditor *
98 em_vfolder_editor_new (EMVFolderContext *vc)
100 EMVFolderEditor *ve = (EMVFolderEditor *) g_object_new (em_vfolder_editor_get_type(), NULL);
101 GladeXML *gui;
103 gui = glade_xml_new (EVOLUTION_GLADEDIR "/filter.glade", "rule_editor", NULL);
104 rule_editor_construct ((RuleEditor *) ve, (RuleContext *) vc, gui, "incoming", _("Search _Folders"));
105 gtk_widget_hide(glade_xml_get_widget (gui, "filter_source"));
106 g_object_unref (gui);
108 return ve;
111 static FilterRule *
112 create_rule (RuleEditor *re)
114 FilterRule *rule = filter_rule_new ();
115 FilterPart *part;
117 /* create a rule with 1 part in it */
118 rule = (FilterRule *) em_vfolder_rule_new ();
119 part = rule_context_next_part (re->context, NULL);
120 filter_rule_add_part (rule, filter_part_clone (part));
122 return rule;