From f1b8cb078f610e99084a62a6dbcdd63c6e4967b9 Mon Sep 17 00:00:00 2001 From: Ettore Perazzoli Date: Sat, 8 Jul 2000 12:01:12 +0000 Subject: Added code for initializing the values of the fields in the message composer. Unfortunately the ESelectNames crashes when you do this... svn path=/trunk/; revision=3975 --- addressbook/ChangeLog | 5 ++ .../component/select-names/e-select-names-bonobo.c | 26 +++++++- composer/ChangeLog | 15 +++++ composer/e-msg-composer-hdrs.c | 70 +++++++++++++++------- composer/e-msg-composer.c | 2 + 5 files changed, 96 insertions(+), 22 deletions(-) diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index 45057c9fea..8ddeb1e85a 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,3 +1,8 @@ +2000-07-08 Ettore Perazzoli + + * gui/component/select-names/e-select-names-bonobo.c + (entry_get_property_fn): New function to set the properties. + 2000-07-08 Ettore Perazzoli * gui/component/addressbook-factory.c (main): Start up the factory 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 bacba26df3..a7b8f5b11f 100644 --- a/addressbook/gui/component/select-names/e-select-names-bonobo.c +++ b/addressbook/gui/component/select-names/e-select-names-bonobo.c @@ -74,6 +74,27 @@ entry_get_property_fn (BonoboPropertyBag *bag, } } +static void +entry_set_property_fn (BonoboPropertyBag *bag, + const BonoboArg *arg, + guint arg_id, + gpointer user_data) +{ + GtkWidget *widget; + const char *text; + + widget = GTK_WIDGET (user_data); + + switch (arg_id) { + case ENTRY_PROPERTY_ID_TEXT: + text = BONOBO_ARG_GET_STRING (arg); + gtk_object_set (GTK_OBJECT (widget), "text", text, NULL); + break; + default: + break; + } +} + /* CORBA interface implementation. */ @@ -148,9 +169,10 @@ impl_SelectNames_get_entry_for_section (PortableServer_Servant servant, control = bonobo_control_new (entry_widget); - property_bag = bonobo_property_bag_new (entry_get_property_fn, NULL, entry_widget); + property_bag = bonobo_property_bag_new (entry_get_property_fn, entry_set_property_fn, entry_widget); bonobo_property_bag_add (property_bag, "text", ENTRY_PROPERTY_ID_TEXT, - BONOBO_ARG_STRING, NULL, NULL, BONOBO_PROPERTY_READABLE); + BONOBO_ARG_STRING, NULL, NULL, + BONOBO_PROPERTY_READABLE | BONOBO_PROPERTY_WRITEABLE); bonobo_control_set_property_bag (control, property_bag); diff --git a/composer/ChangeLog b/composer/ChangeLog index 9c778989dd..5053da1894 100644 --- a/composer/ChangeLog +++ b/composer/ChangeLog @@ -1,3 +1,18 @@ +2000-07-08 Ettore Perazzoli + + * e-msg-composer-hdrs.c (set_entry): New. + (e_msg_composer_hdrs_set_to): Use it. + (e_msg_composer_hdrs_set_cc): Likewise + (e_msg_composer_hdrs_set_bcc): Likewise. + (e_msg_composer_hdrs_get_to): Replace implementation with a + `g_assert_not_reached()'. + (e_msg_composer_hdrs_get_cc): Likewise. + (e_msg_composer_hdrs_get_bcc): Likewise. + + * e-msg-composer.c: Get rid of cut/copy/paste/undo as they + duplicate the editor toolbar and cannot be made to work for all + the widgets anyway. + 2000-07-08 Ettore Perazzoli * e-msg-composer-hdrs.c: New member `corba_select_names' in diff --git a/composer/e-msg-composer-hdrs.c b/composer/e-msg-composer-hdrs.c index b40934f487..0a29724d98 100644 --- a/composer/e-msg-composer-hdrs.c +++ b/composer/e-msg-composer-hdrs.c @@ -190,11 +190,25 @@ add_header (EMsgComposerHdrs *hdrs, entry = gtk_entry_new (); if (entry != NULL) { - gtk_table_attach (GTK_TABLE (hdrs), entry, + GtkWidget *widget_to_attach; + + /* The entries we get from ::SelectNames don't have a frame. + FIXME: They should. */ + if (GTK_IS_ENTRY (entry)) { + widget_to_attach = entry; + } else { + widget_to_attach = gtk_frame_new (NULL); + gtk_frame_set_shadow_type (GTK_FRAME (widget_to_attach), GTK_SHADOW_IN); + gtk_container_add (GTK_CONTAINER (widget_to_attach), entry); + gtk_widget_show (widget_to_attach); + } + + gtk_widget_show (entry); + + gtk_table_attach (GTK_TABLE (hdrs), widget_to_attach, 1, 2, priv->num_hdrs, priv->num_hdrs + 1, GTK_FILL | GTK_EXPAND, GTK_FILL, 2, 2); - gtk_widget_show (entry); gtk_tooltips_set_tip (hdrs->priv->tooltips, entry, tip, tip_private); } @@ -447,43 +461,53 @@ e_msg_composer_hdrs_to_message (EMsgComposerHdrs *hdrs, } +static void +set_entry (BonoboWidget *bonobo_widget, + const GList *list) +{ + GString *string; + const GList *p; + + string = g_string_new (NULL); + for (p = list; p != NULL; p = p->next) { + if (string->str[0] != '\0') + g_string_append (string, ", "); + g_string_append (string, p->data); + } + + bonobo_widget_set_property (BONOBO_WIDGET (bonobo_widget), "text", string->str, NULL); + + g_string_free (string, TRUE); +} + void e_msg_composer_hdrs_set_to (EMsgComposerHdrs *hdrs, const GList *to_list) { - EMsgComposerAddressEntry *entry; - g_return_if_fail (hdrs != NULL); g_return_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs)); - entry = E_MSG_COMPOSER_ADDRESS_ENTRY (hdrs->priv->to_entry); - e_msg_composer_address_entry_set_list (entry, to_list); + set_entry (BONOBO_WIDGET (hdrs->priv->to_entry), to_list); } void e_msg_composer_hdrs_set_cc (EMsgComposerHdrs *hdrs, const GList *cc_list) { - EMsgComposerAddressEntry *entry; - g_return_if_fail (hdrs != NULL); g_return_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs)); - entry = E_MSG_COMPOSER_ADDRESS_ENTRY (hdrs->priv->cc_entry); - e_msg_composer_address_entry_set_list (entry, cc_list); + set_entry (BONOBO_WIDGET (hdrs->priv->cc_entry), cc_list); } void e_msg_composer_hdrs_set_bcc (EMsgComposerHdrs *hdrs, const GList *bcc_list) { - EMsgComposerAddressEntry *entry; - g_return_if_fail (hdrs != NULL); g_return_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs)); - entry = E_MSG_COMPOSER_ADDRESS_ENTRY (hdrs->priv->bcc_entry); - e_msg_composer_address_entry_set_list (entry, bcc_list); + set_entry (BONOBO_WIDGET (hdrs->priv->bcc_entry), bcc_list); } void @@ -501,34 +525,40 @@ e_msg_composer_hdrs_set_subject (EMsgComposerHdrs *hdrs, } +/* FIXME this is currently unused and broken. */ GList * e_msg_composer_hdrs_get_to (EMsgComposerHdrs *hdrs) { g_return_val_if_fail (hdrs != NULL, NULL); g_return_val_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs), NULL); - return e_msg_composer_address_entry_get_addresses - (E_MSG_COMPOSER_ADDRESS_ENTRY (hdrs->priv->to_entry)); + g_assert_not_reached (); + + return NULL; } +/* FIXME this is currently unused and broken. */ GList * e_msg_composer_hdrs_get_cc (EMsgComposerHdrs *hdrs) { g_return_val_if_fail (hdrs != NULL, NULL); g_return_val_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs), NULL); - return e_msg_composer_address_entry_get_addresses - (E_MSG_COMPOSER_ADDRESS_ENTRY (hdrs->priv->cc_entry)); + g_assert_not_reached (); + + return NULL; } +/* FIXME this is currently unused and broken. */ GList * e_msg_composer_hdrs_get_bcc (EMsgComposerHdrs *hdrs) { g_return_val_if_fail (hdrs != NULL, NULL); g_return_val_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs), NULL); - return e_msg_composer_address_entry_get_addresses - (E_MSG_COMPOSER_ADDRESS_ENTRY (hdrs->priv->bcc_entry)); + g_assert_not_reached (); + + return NULL; } const char * diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c index 06363a0eb5..6c4ea73270 100644 --- a/composer/e-msg-composer.c +++ b/composer/e-msg-composer.c @@ -745,11 +745,13 @@ create_menubar (EMsgComposer *composer) static GnomeUIInfo toolbar_info[] = { GNOMEUIINFO_ITEM_STOCK (N_("Send"), N_("Send this message"), send_cb, GNOME_STOCK_PIXMAP_MAIL_SND), +#if 0 GNOMEUIINFO_SEPARATOR, GNOMEUIINFO_ITEM_STOCK (N_("Cut"), N_("Cut selected region into the clipboard"), NULL, GNOME_STOCK_PIXMAP_CUT), GNOMEUIINFO_ITEM_STOCK (N_("Copy"), N_("Copy selected region into the clipboard"), NULL, GNOME_STOCK_PIXMAP_COPY), GNOMEUIINFO_ITEM_STOCK (N_("Paste"), N_("Paste selected region into the clipboard"), NULL, GNOME_STOCK_PIXMAP_PASTE), GNOMEUIINFO_ITEM_STOCK (N_("Undo"), N_("Undo last operation"), NULL, GNOME_STOCK_PIXMAP_UNDO), +#endif GNOMEUIINFO_SEPARATOR, GNOMEUIINFO_ITEM_STOCK (N_("Attach"), N_("Attach a file"), add_attachment_cb, GNOME_STOCK_PIXMAP_ATTACH), GNOMEUIINFO_END -- cgit v1.2.3