No issues found
1 /*
2 * This program is free software; you can redistribute it and/or
3 * modify it under the terms of the GNU Lesser General Public
4 * License as published by the Free Software Foundation; either
5 * version 2 of the License, or (at your option) version 3.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10 * Lesser General Public License for more details.
11 *
12 * You should have received a copy of the GNU Lesser General Public
13 * License along with the program; if not, see <http://www.gnu.org/licenses/>
14 *
15 * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
16 */
17
18 #ifdef HAVE_CONFIG_H
19 #include <config.h>
20 #endif
21
22 #include <misc/e-spell-entry.h>
23
24 #include "e-composer-spell-header.h"
25
26 G_DEFINE_TYPE (
27 EComposerSpellHeader,
28 e_composer_spell_header,
29 E_TYPE_COMPOSER_TEXT_HEADER)
30
31 static void
32 e_composer_spell_header_class_init (EComposerSpellHeaderClass *class)
33 {
34 EComposerTextHeaderClass *composer_text_header_class;
35
36 composer_text_header_class = E_COMPOSER_TEXT_HEADER_CLASS (class);
37 composer_text_header_class->entry_type = E_TYPE_SPELL_ENTRY;
38 }
39
40 static void
41 e_composer_spell_header_init (EComposerSpellHeader *header)
42 {
43 }
44
45 EComposerHeader *
46 e_composer_spell_header_new_label (ESourceRegistry *registry,
47 const gchar *label)
48 {
49 g_return_val_if_fail (E_IS_SOURCE_REGISTRY (registry), NULL);
50
51 return g_object_new (
52 E_TYPE_COMPOSER_SPELL_HEADER,
53 "label", label, "button", FALSE,
54 "registry", registry, NULL);
55 }
56
57 EComposerHeader *
58 e_composer_spell_header_new_button (ESourceRegistry *registry,
59 const gchar *label)
60 {
61 g_return_val_if_fail (E_IS_SOURCE_REGISTRY (registry), NULL);
62
63 return g_object_new (
64 E_TYPE_COMPOSER_SPELL_HEADER,
65 "label", label, "button", TRUE,
66 "registry", registry, NULL);
67 }
68
69 void
70 e_composer_spell_header_set_languages (EComposerSpellHeader *header,
71 GList *languages)
72 {
73 ESpellEntry *spell_entry;
74
75 g_return_if_fail (header != NULL);
76
77 spell_entry = E_SPELL_ENTRY (E_COMPOSER_HEADER (header)->input_widget);
78 g_return_if_fail (spell_entry != NULL);
79
80 e_spell_entry_set_languages (spell_entry, languages);
81 }