3 * This program is free software; you can redistribute it and/or modify it
4 * under the terms of the GNU Lesser General Public License as published by
5 * the Free Software Foundation.
7 * This program is distributed in the hope that it will be useful, but
8 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
9 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * You should have received a copy of the GNU Lesser General Public License
13 * along with this program; if not, see <http://www.gnu.org/licenses/>.
17 * Not Zed <notzed@lostzed.mmc.com.au>
18 * Jeffrey Stedfast <fejj@ximian.com>
21 * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
30 #include <glib/gi18n.h>
32 #include "e-util/e-util.h"
33 #include "e-util/e-util-private.h"
35 #include "em-vfolder-editor.h"
36 #include "em-vfolder-editor-rule.h"
44 vfolder_editor_create_rule (ERuleEditor
*rule_editor
)
46 EMVFolderEditorContext
*context
;
47 EMailSession
*session
;
51 context
= EM_VFOLDER_EDITOR_CONTEXT (rule_editor
->context
);
52 session
= em_vfolder_editor_context_get_session (context
);
54 /* create a rule with 1 part in it */
55 rule
= em_vfolder_editor_rule_new (session
);
56 part
= e_rule_context_next_part (rule_editor
->context
, NULL
);
57 e_filter_rule_add_part (rule
, e_filter_part_clone (part
));
63 em_vfolder_editor_class_init (EMVFolderEditorClass
*class)
65 ERuleEditorClass
*rule_editor_class
;
67 rule_editor_class
= E_RULE_EDITOR_CLASS (class);
68 rule_editor_class
->create_rule
= vfolder_editor_create_rule
;
72 em_vfolder_editor_init (EMVFolderEditor
*vfolder_editor
)
74 gtk_window_set_default_size (GTK_WINDOW (vfolder_editor
), 400, 650);
77 GTK_WINDOW (vfolder_editor
),
78 "/org/gnome/evolution/mail/vfolder-window",
79 E_RESTORE_WINDOW_SIZE
);
83 * em_vfolder_editor_new:
85 * Create a new EMVFolderEditor object.
87 * Returns: a new #EMVFolderEditor
90 em_vfolder_editor_new (EMVFolderContext
*context
)
92 EMVFolderEditor
*editor
;
95 g_return_val_if_fail (EM_IS_VFOLDER_CONTEXT (context
), NULL
);
97 editor
= g_object_new (EM_TYPE_VFOLDER_EDITOR
, NULL
);
99 builder
= gtk_builder_new ();
100 e_load_ui_builder_definition (builder
, "filter.ui");
102 e_rule_editor_construct (
103 E_RULE_EDITOR (editor
), E_RULE_CONTEXT (context
),
104 builder
, "incoming", _("Search _Folders"));
105 gtk_widget_hide (e_builder_get_widget (builder
, "label17"));
106 gtk_widget_hide (e_builder_get_widget (builder
, "filter_source_combobox"));
107 g_object_unref (builder
);
109 return GTK_WIDGET (editor
);