Updated Hungarian translation
[evolution.git] / mail / em-vfolder-editor.c
blobc026f4a6b90972348bf2f04535fbc4f476c56b9a
1 /*
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
10 * for more details.
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/>.
16 * Authors:
17 * Not Zed <notzed@lostzed.mmc.com.au>
18 * Jeffrey Stedfast <fejj@ximian.com>
21 * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
25 #ifdef HAVE_CONFIG_H
26 #include <config.h>
27 #endif
29 #include <gtk/gtk.h>
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"
38 G_DEFINE_TYPE (
39 EMVFolderEditor,
40 em_vfolder_editor,
41 E_TYPE_RULE_EDITOR)
43 static EFilterRule *
44 vfolder_editor_create_rule (ERuleEditor *rule_editor)
46 EMVFolderEditorContext *context;
47 EMailSession *session;
48 EFilterRule *rule;
49 EFilterPart *part;
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));
59 return rule;
62 static void
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;
71 static void
72 em_vfolder_editor_init (EMVFolderEditor *vfolder_editor)
74 gtk_window_set_default_size (GTK_WINDOW (vfolder_editor), 400, 650);
76 e_restore_window (
77 GTK_WINDOW (vfolder_editor),
78 "/org/gnome/evolution/mail/vfolder-window",
79 E_RESTORE_WINDOW_SIZE);
82 /**
83 * em_vfolder_editor_new:
85 * Create a new EMVFolderEditor object.
87 * Returns: a new #EMVFolderEditor
88 **/
89 GtkWidget *
90 em_vfolder_editor_new (EMVFolderContext *context)
92 EMVFolderEditor *editor;
93 GtkBuilder *builder;
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);