aboutsummaryrefslogtreecommitdiffstats
path: root/composer
diff options
context:
space:
mode:
Diffstat (limited to 'composer')
-rw-r--r--composer/Makefile.am2
-rw-r--r--composer/e-composer-header-table.c3
-rw-r--r--composer/e-composer-private.c23
-rw-r--r--composer/e-composer-spell-header.c75
-rw-r--r--composer/e-composer-spell-header.h68
-rw-r--r--composer/e-composer-text-header.c31
-rw-r--r--composer/e-composer-text-header.h2
7 files changed, 196 insertions, 8 deletions
diff --git a/composer/Makefile.am b/composer/Makefile.am
index c3ea743be9..59b316097d 100644
--- a/composer/Makefile.am
+++ b/composer/Makefile.am
@@ -18,6 +18,7 @@ libcomposerinclude_HEADERS = \
e-composer-name-header.h \
e-composer-post-header.h \
e-composer-private.h \
+ e-composer-spell-header.h \
e-composer-text-header.h \
e-msg-composer.h
@@ -51,6 +52,7 @@ libcomposer_la_SOURCES = \
e-composer-name-header.c \
e-composer-post-header.c \
e-composer-private.c \
+ e-composer-spell-header.c \
e-composer-text-header.c \
e-msg-composer.c
diff --git a/composer/e-composer-header-table.c b/composer/e-composer-header-table.c
index f2a9356a90..51a217d286 100644
--- a/composer/e-composer-header-table.c
+++ b/composer/e-composer-header-table.c
@@ -32,6 +32,7 @@
#include "e-composer-from-header.h"
#include "e-composer-name-header.h"
#include "e-composer-post-header.h"
+#include "e-composer-spell-header.h"
#include "e-composer-text-header.h"
#define E_COMPOSER_HEADER_TABLE_GET_PRIVATE(obj) \
@@ -808,7 +809,7 @@ composer_header_table_constructed (GObject *object)
composer_header_table_bind_header ("post-to", "changed", header);
table->priv->headers[E_COMPOSER_HEADER_POST_TO] = header;
- header = e_composer_text_header_new_label (_("S_ubject:"));
+ header = e_composer_spell_header_new_label (_("S_ubject:"));
composer_header_table_bind_header ("subject", "changed", header);
table->priv->headers[E_COMPOSER_HEADER_SUBJECT] = header;
diff --git a/composer/e-composer-private.c b/composer/e-composer-private.c
index 477aae4296..d5e9756494 100644
--- a/composer/e-composer-private.c
+++ b/composer/e-composer-private.c
@@ -22,6 +22,7 @@
#endif
#include "e-composer-private.h"
+#include "e-composer-spell-header.h"
#include "e-util/e-util-private.h"
/* Initial height of the picture gallery. */
@@ -122,6 +123,17 @@ composer_update_gallery_visibility (EMsgComposer *composer)
}
}
+static void
+composer_spell_languages_changed (EMsgComposer *composer,
+ GList *languages)
+{
+ EComposerHeader *header;
+ EComposerHeaderTable *table = e_msg_composer_get_header_table (composer);
+
+ header = e_composer_header_table_get_header (table, E_COMPOSER_HEADER_SUBJECT);
+ e_composer_spell_header_set_languages (E_COMPOSER_SPELL_HEADER (header), languages);
+}
+
void
e_composer_private_constructed (EMsgComposer *composer)
{
@@ -142,6 +154,7 @@ e_composer_private_constructed (EMsgComposer *composer)
gchar *filename, *gallery_path;
gint ii;
GError *error = NULL;
+ EComposerHeader *header;
editor = GTKHTML_EDITOR (composer);
ui_manager = gtkhtml_editor_get_ui_manager (editor);
@@ -280,6 +293,16 @@ e_composer_private_constructed (EMsgComposer *composer)
priv->header_table = g_object_ref (widget);
gtk_widget_show (widget);
+ header = e_composer_header_table_get_header (E_COMPOSER_HEADER_TABLE (widget),
+ E_COMPOSER_HEADER_SUBJECT);
+ g_object_bind_property (
+ shell_settings, "composer-inline-spelling",
+ header->input_widget, "checking-enabled",
+ G_BINDING_SYNC_CREATE);
+
+ g_signal_connect (G_OBJECT (composer), "spell-languages-changed",
+ G_CALLBACK (composer_spell_languages_changed), NULL);
+
/* Construct the attachment paned. */
if (small_screen_mode) {
diff --git a/composer/e-composer-spell-header.c b/composer/e-composer-spell-header.c
new file mode 100644
index 0000000000..223f863e5a
--- /dev/null
+++ b/composer/e-composer-spell-header.c
@@ -0,0 +1,75 @@
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <misc/e-spell-entry.h>
+
+#include "e-composer-spell-header.h"
+
+G_DEFINE_TYPE (
+ EComposerSpellHeader,
+ e_composer_spell_header,
+ E_TYPE_COMPOSER_TEXT_HEADER)
+
+static void
+e_composer_spell_header_class_init (EComposerSpellHeaderClass *class)
+{
+ EComposerTextHeaderClass *composer_text_header_class;
+
+ composer_text_header_class = E_COMPOSER_TEXT_HEADER_CLASS (class);
+ composer_text_header_class->entry_type = E_TYPE_SPELL_ENTRY;
+}
+
+static void
+e_composer_spell_header_init (EComposerSpellHeader *header)
+{
+}
+
+EComposerHeader *
+e_composer_spell_header_new_label (const gchar *label)
+{
+ return g_object_new (
+ E_TYPE_COMPOSER_SPELL_HEADER,
+ "label", label, "button", FALSE,
+ NULL);
+}
+
+EComposerHeader *
+e_composer_spell_header_new_button (const gchar *label)
+{
+ return g_object_new (
+ E_TYPE_COMPOSER_SPELL_HEADER,
+ "label", label, "button", TRUE,
+ NULL);
+}
+
+void
+e_composer_spell_header_set_languages (EComposerSpellHeader *spell_header,
+ GList *languages)
+{
+ ESpellEntry *spell_entry;
+
+ g_return_if_fail (spell_header != NULL);
+
+ spell_entry = E_SPELL_ENTRY (E_COMPOSER_HEADER (spell_header)->input_widget);
+ g_return_if_fail (spell_entry != NULL);
+
+ e_spell_entry_set_languages (spell_entry, languages);
+}
diff --git a/composer/e-composer-spell-header.h b/composer/e-composer-spell-header.h
new file mode 100644
index 0000000000..44ac8d165e
--- /dev/null
+++ b/composer/e-composer-spell-header.h
@@ -0,0 +1,68 @@
+/*
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#ifndef E_COMPOSER_SPELL_HEADER_H
+#define E_COMPOSER_SPELL_HEADER_H
+
+#include <composer/e-composer-text-header.h>
+
+/* Standard GObject macros */
+#define E_TYPE_COMPOSER_SPELL_HEADER \
+ (e_composer_spell_header_get_type ())
+#define E_COMPOSER_SPELL_HEADER(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_COMPOSER_SPELL_HEADER, EComposerSpellHeader))
+#define E_COMPOSER_SPELL_HEADER_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_COMPOSER_SPELL_HEADER, EComposerSpellHeaderClass))
+#define E_IS_COMPOSER_SPELL_HEADER(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_COMPOSER_SPELL_HEADER))
+#define E_IS_COMPOSER_SPELL_HEADER_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_COMPOSER_SPELL_HEADER))
+#define E_COMPOSER_SPELL_HEADER_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_COMPOSER_SPELL_HEADER, EComposerSpellHeaderClass))
+
+G_BEGIN_DECLS
+
+typedef struct _EComposerSpellHeader EComposerSpellHeader;
+typedef struct _EComposerSpellHeaderClass EComposerSpellHeaderClass;
+
+struct _EComposerSpellHeader {
+ EComposerTextHeader parent;
+};
+
+struct _EComposerSpellHeaderClass {
+ EComposerTextHeaderClass parent_class;
+
+ GType entry_type;
+};
+
+GType e_composer_spell_header_get_type (void);
+EComposerHeader * e_composer_spell_header_new_label (const gchar *label);
+EComposerHeader * e_composer_spell_header_new_button (const gchar *label);
+void e_composer_spell_header_set_languages (EComposerSpellHeader *spell_header,
+ GList *languages);
+
+G_END_DECLS
+
+#endif /* E_COMPOSER_SPELL_HEADER_H */
diff --git a/composer/e-composer-text-header.c b/composer/e-composer-text-header.c
index 39279237ab..8506541ef0 100644
--- a/composer/e-composer-text-header.c
+++ b/composer/e-composer-text-header.c
@@ -66,16 +66,17 @@ composer_text_header_query_tooltip_cb (GtkEntry *entry,
}
static void
-e_composer_text_header_class_init (EComposerTextHeaderClass *class)
-{
-}
-
-static void
-e_composer_text_header_init (EComposerTextHeader *header)
+e_composer_text_header_constructed (GObject *object)
{
GtkWidget *widget;
+ EComposerTextHeader *header;
+
+ G_OBJECT_CLASS (e_composer_text_header_parent_class)->constructed (object);
+
+ header = E_COMPOSER_TEXT_HEADER (object);
+ g_return_if_fail (header != NULL);
- widget = g_object_ref_sink (gtk_entry_new ());
+ widget = g_object_ref_sink (g_object_new (E_COMPOSER_TEXT_HEADER_GET_CLASS (header)->entry_type, NULL));
g_signal_connect (
widget, "changed",
G_CALLBACK (composer_text_header_changed_cb), header);
@@ -86,6 +87,22 @@ e_composer_text_header_init (EComposerTextHeader *header)
E_COMPOSER_HEADER (header)->input_widget = widget;
}
+static void
+e_composer_text_header_class_init (EComposerTextHeaderClass *class)
+{
+ GObjectClass *object_class;
+
+ class->entry_type = GTK_TYPE_ENTRY;
+
+ object_class = G_OBJECT_CLASS (class);
+ object_class->constructed = e_composer_text_header_constructed;
+}
+
+static void
+e_composer_text_header_init (EComposerTextHeader *header)
+{
+}
+
EComposerHeader *
e_composer_text_header_new_label (const gchar *label)
{
diff --git a/composer/e-composer-text-header.h b/composer/e-composer-text-header.h
index 860fcc3c61..af97e7a12c 100644
--- a/composer/e-composer-text-header.h
+++ b/composer/e-composer-text-header.h
@@ -53,6 +53,8 @@ struct _EComposerTextHeader {
struct _EComposerTextHeaderClass {
EComposerHeaderClass parent_class;
+
+ GType entry_type;
};
GType e_composer_text_header_get_type (void);