[evolution/wip/webkit-composer: 941/966] When restoring focus on composer restore selection as well
- From: Tomas Popela <tpopela src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/wip/webkit-composer: 941/966] When restoring focus on composer restore selection as well
- Date: Wed, 23 Apr 2014 11:12:32 +0000 (UTC)
commit 836bf19759d7167a790ae954c68497fc30bd8692
Author: Tomas Popela <tpopela redhat com>
Date: Fri Mar 28 08:06:44 2014 +0100
When restoring focus on composer restore selection as well
composer/e-composer-private.h | 3 +++
composer/e-msg-composer.c | 39 ++++++++++++++++++++++++++++++++++++---
2 files changed, 39 insertions(+), 3 deletions(-)
---
diff --git a/composer/e-composer-private.h b/composer/e-composer-private.h
index 8e4c7b8..3ed8ce5 100644
--- a/composer/e-composer-private.h
+++ b/composer/e-composer-private.h
@@ -101,6 +101,9 @@ struct _EMsgComposerPrivate {
* This is used to restore the previous editable state. */
gboolean saved_editable;
gboolean set_signature_from_message;
+
+ gint focused_entry_selection_start;
+ gint focused_entry_selection_end;
};
void e_composer_private_constructed (EMsgComposer *composer);
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
index 79e15e5..0df2b46 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -5003,10 +5003,28 @@ e_msg_composer_is_from_new_message (EMsgComposer *composer,
void
e_msg_composer_save_focused_widget (EMsgComposer *composer)
{
+ GtkWidget *widget;
+
g_return_if_fail (E_IS_MSG_COMPOSER (composer));
- composer->priv->focused_entry =
- gtk_window_get_focus (GTK_WINDOW (composer));
+ widget = gtk_window_get_focus (GTK_WINDOW (composer));
+ composer->priv->focused_entry = widget;
+
+ if (E_IS_HTML_EDITOR_VIEW (widget)) {
+ EEditorSelection *selection;
+
+ selection = e_html_editor_view_get_selection (
+ E_HTML_EDITOR_VIEW (widget));
+
+ e_editor_selection_save (selection);
+ }
+
+ if (GTK_IS_EDITABLE (widget)) {
+ gtk_editable_get_selection_bounds (
+ GTK_EDITABLE (widget),
+ &composer->priv->focused_entry_selection_start,
+ &composer->priv->focused_entry_selection_end);
+ }
}
void
@@ -5021,8 +5039,23 @@ e_msg_composer_restore_focus_on_composer (EMsgComposer *composer)
gtk_window_set_focus (GTK_WINDOW (composer), widget);
- if (E_IS_HTML_EDITOR_VIEW (widget))
+ if (GTK_IS_EDITABLE (widget)) {
+ gtk_editable_select_region (
+ GTK_EDITABLE (widget),
+ composer->priv->focused_entry_selection_start,
+ composer->priv->focused_entry_selection_end);
+ }
+
+ if (E_IS_HTML_EDITOR_VIEW (widget)) {
+ EEditorSelection *selection;
+
e_html_editor_view_force_spell_check (E_HTML_EDITOR_VIEW (widget));
+ selection = e_html_editor_view_get_selection (
+ E_HTML_EDITOR_VIEW (widget));
+
+ e_editor_selection_restore (selection);
+ }
+
composer->priv->focused_entry = NULL;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]