From c9150be94f0e3be05785e12d581fee16c23f3b0d Mon Sep 17 00:00:00 2001 From: Federico Mena Quintero Date: Thu, 11 Sep 2003 20:46:28 +0000 Subject: Added an entry_uic field for a BonoboUIComponent for the non-control 2003-09-11 Federico Mena Quintero * e-msg-composer.h (EMsgComposer): Added an entry_uic field for a BonoboUIComponent for the non-control entries (e.g. the Subject line). * e-msg-composer.c (create_composer): Set autoactivate to true on the HTML control's BonoboControlFrame. (setup_ui): Create the composer->entry_uic. (destroy): Free the composer->entry_uic. (entry_verbs): New array of verbs for the non-control entries. Moved the Edit* verbs to here, as they should not be part of the main set. (composer_entry_focus_in_event_cb): Load evolution-composer-entries.xml here for the non-control entries' UI. (composer_entry_focus_out_event_cb): Remove the menu items. svn path=/trunk/; revision=22531 --- composer/ChangeLog | 17 +++++++++++++++ composer/e-msg-composer.c | 53 +++++++++++++++++++++++++++++++++++++---------- composer/e-msg-composer.h | 4 ++++ 3 files changed, 63 insertions(+), 11 deletions(-) (limited to 'composer') diff --git a/composer/ChangeLog b/composer/ChangeLog index e8b01d63b7..a3d9af8b29 100644 --- a/composer/ChangeLog +++ b/composer/ChangeLog @@ -1,3 +1,20 @@ +2003-09-11 Federico Mena Quintero + + * e-msg-composer.h (EMsgComposer): Added an entry_uic field for a + BonoboUIComponent for the non-control entries (e.g. the Subject + line). + + * e-msg-composer.c (create_composer): Set autoactivate to true on + the HTML control's BonoboControlFrame. + (setup_ui): Create the composer->entry_uic. + (destroy): Free the composer->entry_uic. + (entry_verbs): New array of verbs for the non-control entries. + Moved the Edit* verbs to here, as they should not be part of the + main set. + (composer_entry_focus_in_event_cb): Load + evolution-composer-entries.xml here for the non-control entries' UI. + (composer_entry_focus_out_event_cb): Remove the menu items. + 2003-08-22 Antonio Xu * e-msg-composer-attachment.c (): Connect response signal to diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c index c15dedd7df..8d2698c5eb 100644 --- a/composer/e-msg-composer.c +++ b/composer/e-msg-composer.c @@ -1956,11 +1956,6 @@ static BonoboUIVerb verbs [] = { BONOBO_UI_VERB ("FileSend", menu_file_send_cb), - BONOBO_UI_VERB ("EditCut", menu_edit_cut_cb), - BONOBO_UI_VERB ("EditCopy", menu_edit_copy_cb), - BONOBO_UI_VERB ("EditPaste", menu_edit_paste_cb), - BONOBO_UI_VERB ("SelectAll", menu_edit_select_all_cb), - BONOBO_UI_VERB ("DeleteAll", menu_edit_delete_all_cb), BONOBO_UI_VERB_END @@ -2223,6 +2218,10 @@ setup_ui (EMsgComposer *composer) mail_config_signature_register_client ((MailConfigSignatureClient) sig_event_client, composer); bonobo_ui_component_thaw (composer->uic, NULL); + + /* Create the UIComponent for the non-control entries */ + + composer->entry_uic = bonobo_ui_component_new_default (); } @@ -2464,6 +2463,11 @@ destroy (GtkObject *object) bonobo_object_unref (BONOBO_OBJECT (composer->uic)); composer->uic = NULL; } + + if (composer->entry_uic) { + bonobo_object_unref (BONOBO_OBJECT (composer->entry_uic)); + composer->entry_uic = NULL; + } /* FIXME? I assume the Bonobo widget will get destroyed normally? */ @@ -2850,15 +2854,36 @@ composer_key_pressed (GtkWidget *widget, GdkEventKey *event, gpointer user_data) return FALSE; /* Not handled. */ } +/* Verbs for non-control entries */ +static BonoboUIVerb entry_verbs [] = { + BONOBO_UI_VERB ("EditCut", menu_edit_cut_cb), + BONOBO_UI_VERB ("EditCopy", menu_edit_copy_cb), + BONOBO_UI_VERB ("EditPaste", menu_edit_paste_cb), + BONOBO_UI_VERB ("EditSelectAll", menu_edit_select_all_cb), + BONOBO_UI_VERB_END +}; /* All this snot is so that Cut/Copy/Paste work. */ static gboolean composer_entry_focus_in_event_cb (GtkWidget *widget, GdkEventFocus *event, gpointer user_data) { EMsgComposer *composer = user_data; - + BonoboUIContainer *container; + composer->focused_entry = widget; - bonobo_ui_component_add_verb_list_with_data (composer->uic, verbs, composer); + + container = bonobo_window_get_ui_container (BONOBO_WINDOW (composer)); + bonobo_ui_component_set_container (composer->entry_uic, bonobo_object_corba_objref (BONOBO_OBJECT (container)), NULL); + + bonobo_ui_component_add_verb_list_with_data (composer->entry_uic, entry_verbs, composer); + + bonobo_ui_component_freeze (composer->entry_uic, NULL); + + bonobo_ui_util_set_ui (composer->entry_uic, PREFIX, + EVOLUTION_UIDIR "/evolution-composer-entries.xml", + "evolution-composer-entries", NULL); + + bonobo_ui_component_thaw (composer->entry_uic, NULL); return FALSE; } @@ -2870,6 +2895,8 @@ composer_entry_focus_out_event_cb (GtkWidget *widget, GdkEventFocus *event, gpoi g_assert (composer->focused_entry == widget); composer->focused_entry = NULL; + + bonobo_ui_component_unset_container (composer->entry_uic, NULL); return FALSE; } @@ -2883,12 +2910,12 @@ setup_cut_copy_paste (EMsgComposer *composer) hdrs = (EMsgComposerHdrs *) composer->hdrs; entry = e_msg_composer_hdrs_get_subject_entry (hdrs); - g_signal_connect (entry, "focus-in-event", G_CALLBACK (composer_entry_focus_in_event_cb), composer); - g_signal_connect (entry, "focus-out-event", G_CALLBACK (composer_entry_focus_out_event_cb), composer); + g_signal_connect (entry, "focus_in_event", G_CALLBACK (composer_entry_focus_in_event_cb), composer); + g_signal_connect (entry, "focus_out_event", G_CALLBACK (composer_entry_focus_out_event_cb), composer); entry = e_msg_composer_hdrs_get_reply_to_entry (hdrs); - g_signal_connect (entry, "focus-in-event", G_CALLBACK (composer_entry_focus_in_event_cb), composer); - g_signal_connect (entry, "focus-out-event", G_CALLBACK (composer_entry_focus_out_event_cb), composer); + g_signal_connect (entry, "focus_in_event", G_CALLBACK (composer_entry_focus_in_event_cb), composer); + g_signal_connect (entry, "focus_out_event", G_CALLBACK (composer_entry_focus_out_event_cb), composer); } static void @@ -2922,6 +2949,7 @@ create_composer (int visible_mask) CORBA_Environment ev; GConfClient *gconf; int vis; + BonoboControlFrame *control_frame; composer = g_object_new (E_TYPE_MSG_COMPOSER, "win_name", _("Compose a message"), NULL); gtk_window_set_title ((GtkWindow *) composer, _("Compose a message")); @@ -2992,6 +3020,9 @@ create_composer (int visible_mask) gtk_object_destroy (GTK_OBJECT (composer)); return NULL; } + + control_frame = bonobo_widget_get_control_frame (BONOBO_WIDGET (composer->editor)); + bonobo_control_frame_set_autoactivate (control_frame, TRUE); /* let the editor know which mode we are in */ bonobo_widget_set_property (BONOBO_WIDGET (composer->editor), diff --git a/composer/e-msg-composer.h b/composer/e-msg-composer.h index 5c1e12bbbb..e28d8981d5 100644 --- a/composer/e-msg-composer.h +++ b/composer/e-msg-composer.h @@ -54,7 +54,11 @@ extern "C" { struct _EMsgComposer { BonoboWindow parent; + /* Main UIComponent */ BonoboUIComponent *uic; + + /* UIComponent for the non-control GtkEntries */ + BonoboUIComponent *entry_uic; GtkWidget *hdrs; GPtrArray *extra_hdr_names, *extra_hdr_values; -- cgit v1.2.3