[evolution/wip/webkit-composer: 938/966] Bug 726650: [webkit-composer] Draft save causes keyboard focus lost



commit 378264116a044f33c0c6d24552d781aa83dd1c7d
Author: Tomas Popela <tpopela redhat com>
Date:   Wed Mar 26 15:55:28 2014 +0100

    Bug 726650: [webkit-composer] Draft save causes keyboard focus lost

 composer/e-composer-private.c |    2 ++
 composer/e-msg-composer.c     |   27 +++++++++++++++++++++++++++
 composer/e-msg-composer.h     |    4 ++++
 3 files changed, 33 insertions(+), 0 deletions(-)
---
diff --git a/composer/e-composer-private.c b/composer/e-composer-private.c
index de8788a..f28e4a1 100644
--- a/composer/e-composer-private.c
+++ b/composer/e-composer-private.c
@@ -139,6 +139,8 @@ e_composer_private_constructed (EMsgComposer *composer)
        priv->busy = FALSE;
        priv->saved_editable= FALSE;
 
+       priv->focused_entry = NULL;
+
        e_composer_actions_init (composer);
 
        filename = e_composer_find_data_file ("evolution-composer.ui");
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
index 1c4e055..11fc187 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -4999,3 +4999,30 @@ e_msg_composer_is_from_new_message (EMsgComposer *composer,
 
        composer->priv->is_from_new_message = is_from_new_message;
 }
+
+void
+e_msg_composer_save_focused_widget (EMsgComposer *composer)
+{
+       g_return_if_fail (E_IS_MSG_COMPOSER (composer));
+
+       composer->priv->focused_entry =
+               gtk_window_get_focus (GTK_WINDOW (composer));
+}
+
+void
+e_msg_composer_restore_focus_on_composer (EMsgComposer *composer)
+{
+       GtkWidget *widget = composer->priv->focused_entry;
+
+       g_return_if_fail (E_IS_MSG_COMPOSER (composer));
+
+       if (!widget)
+               return;
+
+       gtk_window_set_focus (GTK_WINDOW (composer), widget);
+
+       if (E_IS_EDITOR_WIDGET (widget))
+               e_editor_widget_force_spell_check (E_EDITOR_WIDGET (widget));
+
+       composer->priv->focused_entry = NULL;
+}
diff --git a/composer/e-msg-composer.h b/composer/e-msg-composer.h
index 472032b..912c9f6 100644
--- a/composer/e-msg-composer.h
+++ b/composer/e-msg-composer.h
@@ -190,6 +190,10 @@ void               e_save_spell_languages          (const GList *spell_languages);
 void           e_msg_composer_is_from_new_message
                                                (EMsgComposer *composer,
                                                 gboolean is_from_new_message);
+void           e_msg_composer_save_focused_widget
+                                               (EMsgComposer *composer);
+void           e_msg_composer_restore_focus_on_composer
+                                               (EMsgComposer *composer);
 gboolean       e_msg_composer_is_busy          (EMsgComposer *composer);
 G_END_DECLS
 


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