diff options
author | Milan Crha <mcrha@redhat.com> | 2014-04-29 21:50:31 +0800 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2014-04-29 21:50:31 +0800 |
commit | c50cad0486bd3b4836a480faa2d4776f12b32393 (patch) | |
tree | 8f984fe4b8d27ebd6f71ccad55fcb107ef8749ce /addressbook/gui/contact-editor | |
parent | 07d7cdf0a5334ac24a2842f09d842838ddbf6f19 (diff) | |
download | gsoc2013-evolution-c50cad0486bd3b4836a480faa2d4776f12b32393.tar gsoc2013-evolution-c50cad0486bd3b4836a480faa2d4776f12b32393.tar.gz gsoc2013-evolution-c50cad0486bd3b4836a480faa2d4776f12b32393.tar.bz2 gsoc2013-evolution-c50cad0486bd3b4836a480faa2d4776f12b32393.tar.lz gsoc2013-evolution-c50cad0486bd3b4836a480faa2d4776f12b32393.tar.xz gsoc2013-evolution-c50cad0486bd3b4836a480faa2d4776f12b32393.tar.zst gsoc2013-evolution-c50cad0486bd3b4836a480faa2d4776f12b32393.zip |
EContactEditor: IM field is focused after editor open
Due to made widget changes in fill_in_all() the focus can change
from the full name entry elsewhere. Remembering focused widget and
restoring it at the end of the function makes the editor being
opened with full name entry instead, as expected.
Diffstat (limited to 'addressbook/gui/contact-editor')
-rw-r--r-- | addressbook/gui/contact-editor/e-contact-editor.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c index 8359e7e0b7..ab7557188b 100644 --- a/addressbook/gui/contact-editor/e-contact-editor.c +++ b/addressbook/gui/contact-editor/e-contact-editor.c @@ -3161,6 +3161,18 @@ sensitize_simple (EContactEditor *editor) static void fill_in_all (EContactEditor *editor) { + GtkWidget *focused_widget; + gpointer weak_pointer; + + /* Widget changes can cause focus widget change, thus remember the current + widget and restore it after the fill is done; some fill operations + can delete widgets, like the dyntable, thus do the weak_pointer as well. + */ + focused_widget = gtk_window_get_focus (eab_editor_get_window (EAB_EDITOR (editor))); + weak_pointer = focused_widget; + if (focused_widget) + g_object_add_weak_pointer (G_OBJECT (focused_widget), &weak_pointer); + fill_in_source_field (editor); fill_in_simple (editor); fill_in_email (editor); @@ -3168,6 +3180,11 @@ fill_in_all (EContactEditor *editor) fill_in_sip (editor); fill_in_im (editor); fill_in_address (editor); + + if (weak_pointer) { + g_object_remove_weak_pointer (G_OBJECT (focused_widget), &weak_pointer); + gtk_widget_grab_focus (focused_widget); + } } static void |