From a17a25e3496d7ce1bbd57a763076c446b78bdb70 Mon Sep 17 00:00:00 2001 From: Chris Toshok Date: Sat, 19 Apr 2003 22:16:41 +0000 Subject: [ fixes #40694 ] just grab focus if @activate == TRUE. we'll do all 2003-04-16 Chris Toshok [ fixes #40694 ] * gui/component/select-names/e-select-names-bonobo.c (control_activate_cb): just grab focus if @activate == TRUE. we'll do all merging/unmerging in the focus handler. (widget_focus_cb): handle the merging here. (e_bonobo_control_automerge_ui): store off the widget (so we can grab focus on it) and connect to "activate". svn path=/trunk/; revision=20897 --- addressbook/ChangeLog | 10 +++++++++ .../component/select-names/e-select-names-bonobo.c | 24 ++++++++++++++-------- 2 files changed, 25 insertions(+), 9 deletions(-) (limited to 'addressbook') diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index fda34513c9..8743cd24a9 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,3 +1,13 @@ +2003-04-16 Chris Toshok + + [ fixes #40694 ] + * gui/component/select-names/e-select-names-bonobo.c + (control_activate_cb): just grab focus if @activate == TRUE. + we'll do all merging/unmerging in the focus handler. + (widget_focus_cb): handle the merging here. + (e_bonobo_control_automerge_ui): store off the widget (so we can + grab focus on it) and connect to "activate". + 2003-04-18 Rodney Dawes * gui/component/select-names/Makefile.am: Add missing -DPREFIX diff --git a/addressbook/gui/component/select-names/e-select-names-bonobo.c b/addressbook/gui/component/select-names/e-select-names-bonobo.c index b722baec6f..10fc9caee7 100644 --- a/addressbook/gui/component/select-names/e-select-names-bonobo.c +++ b/addressbook/gui/component/select-names/e-select-names-bonobo.c @@ -346,6 +346,7 @@ static BonoboUIVerb verbs [] = { }; typedef struct { + GtkWidget *widget; BonoboControl *control; Bonobo_UIContainer remote_ui_container; char *ui_xml_path; @@ -403,22 +404,24 @@ static void control_activate_cb (BonoboControl *control, gboolean activate, ControlUIClosure *closure) +{ + if (activate) + gtk_widget_grab_focus (closure->widget); /* the ECanvas */ +} + +static gboolean +widget_focus_cb (GtkWidget *w, GdkEventFocus *focus, ControlUIClosure *closure) { BonoboUIComponent *uic; - uic = bonobo_control_get_ui_component (control); + uic = bonobo_control_get_ui_component (closure->control); - if (activate) { - merge_menu_items (control, uic, closure); + if (GTK_WIDGET_HAS_FOCUS (w)) { + merge_menu_items (closure->control, uic, closure); } else { - unmerge_menu_items (control, uic, closure); + unmerge_menu_items (closure->control, uic, closure); } -} -static gboolean -widget_focus_cb (GtkWidget *w, GdkEventFocus *focus, ControlUIClosure *closure) -{ - control_activate_cb (closure->control, GTK_WIDGET_HAS_FOCUS (w), closure); return FALSE; } @@ -440,6 +443,7 @@ e_bonobo_control_automerge_ui (GtkWidget *w, closure = g_new (ControlUIClosure, 1); + closure->widget = w; closure->control = control; closure->ui_xml_path = g_strdup (ui_xml_path); closure->app_name = g_strdup (app_name); @@ -450,6 +454,8 @@ e_bonobo_control_automerge_ui (GtkWidget *w, G_CALLBACK (widget_focus_cb), closure); g_signal_connect (w, "focus_out_event", G_CALLBACK (widget_focus_cb), closure); + g_signal_connect (control, "activate", + G_CALLBACK (control_activate_cb), closure); g_signal_connect (control, "set_frame", G_CALLBACK (control_set_frame_cb), closure); -- cgit v1.2.3