From 79265bbca3ba043df0a735ff6eab1ace879b7a08 Mon Sep 17 00:00:00 2001 From: Radek Doulik Date: Fri, 10 Aug 2001 07:17:54 +0000 Subject: new helper function, just setup idle callback to grab focus 2001-08-09 Radek Doulik * e-msg-composer.c (set_focus_to_editor): new helper function, just setup idle callback to grab focus (set_focus_to_editor_idle): grab focus for editor, before we have better solution, it run grab-focus command on editor control (e_msg_composer_construct): call prepare_engine here, set focus to editor svn path=/trunk/; revision=11875 --- composer/ChangeLog | 9 +++++++++ composer/e-msg-composer.c | 37 +++++++++++++++++++++++++------------ 2 files changed, 34 insertions(+), 12 deletions(-) diff --git a/composer/ChangeLog b/composer/ChangeLog index 7397b1a38d..850f605303 100644 --- a/composer/ChangeLog +++ b/composer/ChangeLog @@ -1,3 +1,12 @@ +2001-08-09 Radek Doulik + + * e-msg-composer.c (set_focus_to_editor): new helper function, + just setup idle callback to grab focus + (set_focus_to_editor_idle): grab focus for editor, before we have + better solution, it run grab-focus command on editor control + (e_msg_composer_construct): call prepare_engine here, set focus to + editor + 2001-08-10 Jeffrey Stedfast * e-msg-composer.c (autosave_manager_query_load_orphans): Don't diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c index 544adb9f5c..622c18ecb4 100644 --- a/composer/e-msg-composer.c +++ b/composer/e-msg-composer.c @@ -239,6 +239,24 @@ e_msg_composer_clear_inlined_table (EMsgComposer *composer) g_hash_table_foreach_remove (composer->inline_images, clear_inline_images, NULL); } +static guint +set_focus_to_editor_idle (EMsgComposer *composer) +{ + CORBA_Environment ev; + + CORBA_exception_init (&ev); + GNOME_GtkHTML_Editor_Engine_runCommand (composer->editor_engine, "grab-focus", &ev); + CORBA_exception_free (&ev); + + return FALSE; +} + +static inline void +set_focus_to_editor (EMsgComposer *composer) +{ + gtk_idle_add (set_focus_to_editor_idle, composer); +} + static void add_inlined_image (gpointer key, gpointer value, gpointer data) { @@ -2349,13 +2367,9 @@ e_msg_composer_construct (EMsgComposer *composer) gtk_widget_show (composer->editor); e_msg_composer_show_attachments (composer, FALSE); - - /* Set focus on the `To:' field. - - gtk_widget_grab_focus (e_msg_composer_hdrs_get_to_entry (E_MSG_COMPOSER_HDRS (composer->hdrs))); - GTK_WIDGET_SET_FLAGS (composer->editor, GTK_CAN_FOCUS); - gtk_window_set_focus (GTK_WINDOW (composer), composer->editor); */ - gtk_widget_grab_focus (composer->editor); + + prepare_engine (composer); + set_focus_to_editor (composer); } static EMsgComposer * @@ -2371,7 +2385,6 @@ create_composer (void) gtk_object_unref (GTK_OBJECT (new)); return NULL; } - prepare_engine (new); return new; } @@ -2412,7 +2425,7 @@ e_msg_composer_new_with_sig_file () e_msg_composer_set_send_html (new, mail_config_get_send_html ()); set_editor_text (new, ""); } - + return new; } @@ -2621,7 +2634,7 @@ e_msg_composer_new_with_message (CamelMimeMessage *msg) } e_msg_composer_set_headers (new, account_name, To, Cc, Bcc, subject); - + free_recipients (To); free_recipients (Cc); free_recipients (Bcc); @@ -2695,7 +2708,7 @@ e_msg_composer_new_with_message (CamelMimeMessage *msg) e_msg_composer_set_body_text (new, final_text); } } - + return new; } @@ -2829,7 +2842,7 @@ e_msg_composer_new_from_url (const char *url) } } } - + hdrs = E_MSG_COMPOSER_HDRS (composer->hdrs); e_msg_composer_hdrs_set_to (hdrs, to); free_recipients (to); -- cgit