[evolution] Spell checking for 'Summary' in Event/Task/Memo editors



commit 3c6919a70c6653c9306900b97f2896fdeed3375a
Author: Milan Crha <mcrha redhat com>
Date:   Thu May 10 17:59:21 2012 +0200

    Spell checking for 'Summary' in Event/Task/Memo editors

 calendar/gui/dialogs/event-page.c  |   13 ++++++++
 calendar/gui/dialogs/event-page.ui |    2 +-
 calendar/gui/dialogs/memo-page.c   |   22 +++++++++++++
 calendar/gui/dialogs/memo-page.ui  |    2 +-
 calendar/gui/dialogs/task-editor.c |   58 ++++++++++++++++++------------------
 calendar/gui/dialogs/task-page.c   |   17 ++++++++++
 calendar/gui/dialogs/task-page.ui  |    2 +-
 7 files changed, 84 insertions(+), 32 deletions(-)
---
diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c
index 28f54be..32f7edd 100644
--- a/calendar/gui/dialogs/event-page.c
+++ b/calendar/gui/dialogs/event-page.c
@@ -50,6 +50,7 @@
 
 #include <misc/e-dateedit.h>
 #include <misc/e-send-options.h>
+#include <misc/e-spell-entry.h>
 #include <misc/e-buffer-tagger.h>
 
 #include "../e-alarm-list.h"
@@ -2618,6 +2619,17 @@ get_widgets (EventPage *epage)
 	gtk_entry_set_completion (GTK_ENTRY (priv->categories), completion);
 	g_object_unref (completion);
 
+	if (priv->summary) {
+		EShellSettings *shell_settings;
+
+		shell_settings = e_shell_get_shell_settings (shell);
+
+		g_object_bind_property (
+			shell_settings, "composer-inline-spelling",
+			priv->summary, "checking-enabled",
+			G_BINDING_SYNC_CREATE);
+	}
+
 	return (priv->summary
 		&& priv->location
 		&& priv->start_time
@@ -3557,6 +3569,7 @@ event_page_construct (EventPage *epage,
 	 * GType before we load the GtkBuilder definition file. */
 	E_TYPE_DATE_EDIT;
 	E_TYPE_TIMEZONE_ENTRY;
+	E_TYPE_SPELL_ENTRY;
 
 	priv->builder = gtk_builder_new ();
 	e_load_ui_builder_definition (priv->builder, "event-page.ui");
diff --git a/calendar/gui/dialogs/event-page.ui b/calendar/gui/dialogs/event-page.ui
index 9377c83..c2e291f 100644
--- a/calendar/gui/dialogs/event-page.ui
+++ b/calendar/gui/dialogs/event-page.ui
@@ -343,7 +343,7 @@
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkEntry" id="summary">
+                  <object class="ESpellEntry" id="summary">
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="editable">True</property>
diff --git a/calendar/gui/dialogs/memo-page.c b/calendar/gui/dialogs/memo-page.c
index 00bf1cc..dcc3c94 100644
--- a/calendar/gui/dialogs/memo-page.c
+++ b/calendar/gui/dialogs/memo-page.c
@@ -47,6 +47,7 @@
 #include <e-util/e-util-private.h>
 
 #include <misc/e-dateedit.h>
+#include <misc/e-spell-entry.h>
 #include <misc/e-buffer-tagger.h>
 
 #include <libemail-utils/e-account-utils.h>
@@ -893,6 +894,22 @@ get_widgets (MemoPage *mpage)
 	gtk_entry_set_completion (GTK_ENTRY (priv->categories), completion);
 	g_object_unref (completion);
 
+	if (priv->summary_entry) {
+		EShell *shell;
+		EShellSettings *shell_settings;
+		CompEditor *editor;
+
+		editor = comp_editor_page_get_editor (page);
+		shell = comp_editor_get_shell (editor);
+		shell_settings = e_shell_get_shell_settings (shell);
+
+		g_object_bind_property (
+			shell_settings, "composer-inline-spelling",
+			priv->summary_entry, "checking-enabled",
+			G_BINDING_SYNC_CREATE);
+	}
+
+
 	return (priv->memo_content
 		&& priv->categories_btn
 		&& priv->categories
@@ -1234,6 +1251,11 @@ memo_page_construct (MemoPage *mpage)
 	editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (mpage));
 	flags = comp_editor_get_flags (editor);
 
+	/* Make sure our custom widget classes are registered with
+	 * GType before we load the GtkBuilder definition file. */
+	E_TYPE_DATE_EDIT;
+	E_TYPE_SPELL_ENTRY;
+
 	priv->builder = gtk_builder_new ();
 	e_load_ui_builder_definition (priv->builder, "memo-page.ui");
 
diff --git a/calendar/gui/dialogs/memo-page.ui b/calendar/gui/dialogs/memo-page.ui
index f10dec4..d30aecf 100644
--- a/calendar/gui/dialogs/memo-page.ui
+++ b/calendar/gui/dialogs/memo-page.ui
@@ -349,7 +349,7 @@
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkEntry" id="sum-entry">
+                  <object class="ESpellEntry" id="sum-entry">
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="editable">True</property>
diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c
index 927913c..378aea5 100644
--- a/calendar/gui/dialogs/task-editor.c
+++ b/calendar/gui/dialogs/task-editor.c
@@ -147,6 +147,7 @@ task_editor_constructor (GType type,
 	CompEditor *editor;
 	CompEditorFlags flags;
 	TaskEditorPrivate *priv;
+	GtkWidget *content_area;
 	GtkActionGroup *action_group;
 	ECalClient *client;
 	gboolean is_assigned;
@@ -160,10 +161,37 @@ task_editor_constructor (GType type,
 
 	client = comp_editor_get_client (editor);
 	flags = comp_editor_get_flags (editor);
-	action_group = comp_editor_get_action_group (editor, "coordinated");
+
+	priv->task_page = task_page_new (priv->model, editor);
+	comp_editor_append_page (
+		editor, COMP_EDITOR_PAGE (priv->task_page),
+		_("Task"), TRUE);
+
+	priv->task_details_window = gtk_dialog_new_with_buttons (
+		_("Task Details"), GTK_WINDOW (object), GTK_DIALOG_MODAL,
+		GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, NULL);
+	g_signal_connect (
+		priv->task_details_window, "response",
+		G_CALLBACK (gtk_widget_hide), NULL);
+	g_signal_connect (
+		priv->task_details_window, "delete-event",
+		G_CALLBACK (gtk_widget_hide), NULL);
+
+	priv->task_details_page = task_details_page_new (editor);
+	content_area = gtk_dialog_get_content_area (
+		GTK_DIALOG (priv->task_details_window));
+	gtk_container_add (
+		GTK_CONTAINER (content_area),
+		comp_editor_page_get_widget (
+		(CompEditorPage *) priv->task_details_page));
+	gtk_widget_show_all (
+		gtk_bin_get_child (GTK_BIN (priv->task_details_window)));
+	comp_editor_append_page (
+		editor, COMP_EDITOR_PAGE (priv->task_details_page), NULL, FALSE);
 
 	is_assigned = flags & COMP_EDITOR_IS_ASSIGNED;
 
+	action_group = comp_editor_get_action_group (editor, "coordinated");
 	task_page_set_assignment (priv->task_page, is_assigned);
 	gtk_action_group_set_visible (action_group, is_assigned);
 
@@ -305,7 +333,6 @@ task_editor_init (TaskEditor *te)
 	CompEditor *editor = COMP_EDITOR (te);
 	GtkUIManager *ui_manager;
 	GtkActionGroup *action_group;
-	GtkWidget *content_area;
 	GtkAction *action;
 	const gchar *id;
 	GError *error = NULL;
@@ -315,33 +342,6 @@ task_editor_init (TaskEditor *te)
 	te->priv->assignment_shown = TRUE;
 	te->priv->updating = FALSE;
 
-	te->priv->task_page = task_page_new (te->priv->model, editor);
-	comp_editor_append_page (
-		editor, COMP_EDITOR_PAGE (te->priv->task_page),
-		_("Task"), TRUE);
-
-	te->priv->task_details_window = gtk_dialog_new_with_buttons (
-		_("Task Details"), GTK_WINDOW (te), GTK_DIALOG_MODAL,
-		GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, NULL);
-	g_signal_connect (
-		te->priv->task_details_window, "response",
-		G_CALLBACK (gtk_widget_hide), NULL);
-	g_signal_connect (
-		te->priv->task_details_window, "delete-event",
-		G_CALLBACK (gtk_widget_hide), NULL);
-
-	te->priv->task_details_page = task_details_page_new (editor);
-	content_area = gtk_dialog_get_content_area (
-		GTK_DIALOG (te->priv->task_details_window));
-	gtk_container_add (
-		GTK_CONTAINER (content_area),
-		comp_editor_page_get_widget (
-		(CompEditorPage *) te->priv->task_details_page));
-	gtk_widget_show_all (
-		gtk_bin_get_child (GTK_BIN (te->priv->task_details_window)));
-	comp_editor_append_page (
-		editor, COMP_EDITOR_PAGE (te->priv->task_details_page), NULL, FALSE);
-
 	action_group = comp_editor_get_action_group (editor, "individual");
 	gtk_action_group_add_actions (
 		action_group, task_entries,
diff --git a/calendar/gui/dialogs/task-page.c b/calendar/gui/dialogs/task-page.c
index 27be3bd..8b2bd1f 100644
--- a/calendar/gui/dialogs/task-page.c
+++ b/calendar/gui/dialogs/task-page.c
@@ -39,6 +39,7 @@
 #include <libedataserverui/e-source-combo-box.h>
 
 #include <misc/e-dateedit.h>
+#include <misc/e-spell-entry.h>
 #include <misc/e-buffer-tagger.h>
 
 #include <e-util/e-categories-config.h>
@@ -1516,6 +1517,21 @@ get_widgets (TaskPage *tpage)
 	gtk_entry_set_completion (GTK_ENTRY (priv->categories), completion);
 	g_object_unref (completion);
 
+	if (priv->summary) {
+		EShell *shell;
+		EShellSettings *shell_settings;
+		CompEditor *editor;
+
+		editor = comp_editor_page_get_editor (page);
+		shell = comp_editor_get_shell (editor);
+		shell_settings = e_shell_get_shell_settings (shell);
+
+		g_object_bind_property (
+			shell_settings, "composer-inline-spelling",
+			priv->summary, "checking-enabled",
+			G_BINDING_SYNC_CREATE);
+	}
+
 	return (priv->summary
 		&& priv->summary_label
 		&& priv->due_date
@@ -2143,6 +2159,7 @@ task_page_construct (TaskPage *tpage,
 	E_TYPE_DATE_EDIT;
 	E_TYPE_TIMEZONE_ENTRY;
 	E_TYPE_SOURCE_COMBO_BOX;
+	E_TYPE_SPELL_ENTRY;
 
 	priv->builder = gtk_builder_new ();
 	e_load_ui_builder_definition (priv->builder, "task-page.ui");
diff --git a/calendar/gui/dialogs/task-page.ui b/calendar/gui/dialogs/task-page.ui
index 32faa1f..f3f85f5 100644
--- a/calendar/gui/dialogs/task-page.ui
+++ b/calendar/gui/dialogs/task-page.ui
@@ -254,7 +254,7 @@
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkEntry" id="summary">
+                  <object class="ESpellEntry" id="summary">
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                   </object>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]