diff options
author | Christopher James Lahey <clahey@helixcode.com> | 2000-11-12 05:29:07 +0800 |
---|---|---|
committer | Chris Lahey <clahey@src.gnome.org> | 2000-11-12 05:29:07 +0800 |
commit | 618515cd0beaed45af59994d84592b5d513bd979 (patch) | |
tree | 2f90bf2897128f9e704b5927bba8bd86bd3bc2ab | |
parent | d99fd19df965c57878d55e7f5705ca5648604db0 (diff) | |
download | gsoc2013-evolution-618515cd0beaed45af59994d84592b5d513bd979.tar.gz gsoc2013-evolution-618515cd0beaed45af59994d84592b5d513bd979.tar.zst gsoc2013-evolution-618515cd0beaed45af59994d84592b5d513bd979.zip |
Link in composer bonobo code.
2000-11-11 Christopher James Lahey <clahey@helixcode.com>
* backend/ebook/Makefile.am: Link in composer bonobo code.
* backend/ebook/e-card.c, backend/ebook/e-card.h: Added code to
send mail to an ECard or send an ECard as a VCard attachment.
* contact-editor/e-contact-editor.c: Add verbs to send the contact
as a VCard or send mail to the contact.
* gui/search/e-addressbook-search-dialog.c: Removed some unused
variables.
* gui/widgets/e-addressbook-view.c, gui/widgets/e-minicard.c:
Added menu items to send the contact as a VCard or send mail to
the contact.
svn path=/trunk/; revision=6543
-rw-r--r-- | addressbook/ChangeLog | 17 | ||||
-rw-r--r-- | addressbook/backend/ebook/Makefile.am | 11 | ||||
-rw-r--r-- | addressbook/backend/ebook/e-card.c | 127 | ||||
-rw-r--r-- | addressbook/backend/ebook/e-card.h | 73 | ||||
-rw-r--r-- | addressbook/contact-editor/e-contact-editor.c | 32 | ||||
-rw-r--r-- | addressbook/gui/contact-editor/e-contact-editor.c | 32 | ||||
-rw-r--r-- | addressbook/gui/search/e-addressbook-search-dialog.c | 4 | ||||
-rw-r--r-- | addressbook/gui/widgets/e-addressbook-view.c | 26 | ||||
-rw-r--r-- | addressbook/gui/widgets/e-minicard.c | 36 |
9 files changed, 303 insertions, 55 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index c20e425c6f..48c37565d9 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,3 +1,20 @@ +2000-11-11 Christopher James Lahey <clahey@helixcode.com> + + * backend/ebook/Makefile.am: Link in composer bonobo code. + + * backend/ebook/e-card.c, backend/ebook/e-card.h: Added code to + send mail to an ECard or send an ECard as a VCard attachment. + + * contact-editor/e-contact-editor.c: Add verbs to send the contact + as a VCard or send mail to the contact. + + * gui/search/e-addressbook-search-dialog.c: Removed some unused + variables. + + * gui/widgets/e-addressbook-view.c, gui/widgets/e-minicard.c: + Added menu items to send the contact as a VCard or send mail to + the contact. + 2000-11-11 Matt Bissiri <bissiri@eecs.umich.edu> * gui/component/addressbook.oafinfo: diff --git a/addressbook/backend/ebook/Makefile.am b/addressbook/backend/ebook/Makefile.am index 1dc9618851..4262cb8394 100644 --- a/addressbook/backend/ebook/Makefile.am +++ b/addressbook/backend/ebook/Makefile.am @@ -6,15 +6,20 @@ CORBA_SOURCE = \ addressbook.h \ addressbook-common.c \ addressbook-stubs.c \ - addressbook-skels.c + addressbook-skels.c \ + Evolution-Composer.h \ + Evolution-Composer-common.c \ + Evolution-Composer-skels.c \ + Evolution-Composer-stubs.c idls = \ - $(srcdir)/../idl/addressbook.idl + $(srcdir)/../idl/addressbook.idl \ + $(srcdir)/../../../composer/Evolution-Composer.idl idl_flags = `$(GNOME_CONFIG) --cflags idl` -I $(datadir)/idl $(CORBA_SOURCE): $(idls) - $(ORBIT_IDL) -I $(srcdir) $(srcdir)/../idl/addressbook.idl $(idl_flags) + $(ORBIT_IDL) -I $(srcdir) $(idls) $(idl_flags) INCLUDES = \ -DGNOMELOCALEDIR=\""$(localedir)"\" \ diff --git a/addressbook/backend/ebook/e-card.c b/addressbook/backend/ebook/e-card.c index 37a35b05e2..62c407f871 100644 --- a/addressbook/backend/ebook/e-card.c +++ b/addressbook/backend/ebook/e-card.c @@ -22,6 +22,8 @@ #include <gal/util/e-util.h> +#include <bonobo/bonobo-object-client.h> + #define is_a_prop_of(obj,prop) (isAPropertyOf ((obj),(prop))) #define str_val(obj) (the_str = (vObjectValueType (obj))? fakeCString (vObjectUStringZValue (obj)) : calloc (1, 1)) #define has(obj,prop) (vo = isAPropertyOf ((obj), (prop))) @@ -3381,3 +3383,128 @@ set_address_flags (VObject *vobj, ECardAddressFlags flags) } } } + +#include <Evolution-Composer.h> + +#define COMPOSER_OAFID "OAFIID:evolution-composer:evolution-mail:cd8618ea-53e1-4b9e-88cf-ec578bdb903b" + +void +e_card_send (ECard *card, ECardDisposition disposition) +{ + BonoboObjectClient *bonobo_server; + Evolution_Composer composer_server; + CORBA_Environment ev; + + /* First, I obtain an object reference that represents the Composer. */ + bonobo_server = bonobo_object_activate (COMPOSER_OAFID, 0); + + g_return_if_fail (bonobo_server != NULL); + + composer_server = bonobo_object_corba_objref (BONOBO_OBJECT (bonobo_server)); + + CORBA_exception_init (&ev); + + if (disposition == E_CARD_DISPOSITION_AS_TO) { + Evolution_Composer_RecipientList *to_list, *cc_list, *bcc_list; + CORBA_char *subject; + char *name; + EList *email; + EIterator *iterator; + Evolution_Composer_Recipient *recipient; + /* Now I have to make a CORBA sequence that represents a recipient list with + one item, for the card. */ + to_list = Evolution_Composer_RecipientList__alloc (); + to_list->_maximum = 1; + to_list->_length = 1; + to_list->_buffer = CORBA_sequence_Evolution_Composer_Recipient_allocbuf (1); + + gtk_object_get(GTK_OBJECT(card), + "full_name", &name, + "email", &email, + NULL); + + recipient = &(to_list->_buffer[0]); + + iterator = e_list_get_iterator(email); + if (e_iterator_is_valid(iterator)) { + recipient->address = CORBA_string_dup(e_iterator_get(iterator)); + } else { + recipient->address = CORBA_string_dup(""); + } + gtk_object_unref(GTK_OBJECT(iterator)); + + recipient->name = CORBA_string_dup(name); + + cc_list = Evolution_Composer_RecipientList__alloc (); + cc_list->_maximum = cc_list->_length = 0; + bcc_list = Evolution_Composer_RecipientList__alloc (); + bcc_list->_maximum = bcc_list->_length = 0; + + subject = CORBA_string_dup (""); + + Evolution_Composer_set_headers (composer_server, to_list, cc_list, bcc_list, subject, &ev); + if (ev._major != CORBA_NO_EXCEPTION) { + g_printerr ("gui/e-meeting-edit.c: I couldn't set the composer headers via CORBA! Aagh.\n"); + CORBA_exception_free (&ev); + return; + } + + if (CORBA_sequence_get_release (to_list) != FALSE) + CORBA_free (to_list->_buffer); + + CORBA_free (to_list); + CORBA_free (cc_list); + CORBA_free (bcc_list); + CORBA_free (subject); + } + + if (disposition == E_CARD_DISPOSITION_AS_ATTACHMENT) { + CORBA_char *content_type, *filename, *description, *attach_data; + CORBA_boolean show_inline; + char *tempstr; + char *name; + + gtk_object_get(GTK_OBJECT(card), + "full_name", &name, + NULL); + + content_type = CORBA_string_dup ("text/vcard"); + filename = CORBA_string_dup (""); + + tempstr = g_strdup_printf ("VCard for %s", name); + description = CORBA_string_dup (tempstr); + g_free (tempstr); + + show_inline = FALSE; + + tempstr = e_card_get_vcard(card); + attach_data = CORBA_string_dup (tempstr); + g_free(tempstr); + + Evolution_Composer_attach_data (composer_server, + content_type, filename, description, + show_inline, attach_data, + &ev); + + if (ev._major != CORBA_NO_EXCEPTION) { + g_printerr ("gui/e-meeting-edit.c: I couldn't attach data to the composer via CORBA! Aagh.\n"); + CORBA_exception_free (&ev); + return; + } + + CORBA_free (content_type); + CORBA_free (filename); + CORBA_free (description); + CORBA_free (attach_data); + } + + Evolution_Composer_show (composer_server, &ev); + + if (ev._major != CORBA_NO_EXCEPTION) { + g_printerr ("gui/e-meeting-edit.c: I couldn't show the composer via CORBA! Aagh.\n"); + CORBA_exception_free (&ev); + return; + } + + CORBA_exception_free (&ev); +} diff --git a/addressbook/backend/ebook/e-card.h b/addressbook/backend/ebook/e-card.h index bad7b3068b..81473a28ed 100644 --- a/addressbook/backend/ebook/e-card.h +++ b/addressbook/backend/ebook/e-card.h @@ -107,42 +107,57 @@ struct _ECardClass { }; -ECard *e_card_new ( char *vcard); -char *e_card_get_id ( ECard *card); -void e_card_set_id ( ECard *card, - const char *character); -char *e_card_get_vcard ( ECard *card); -ECard *e_card_duplicate ( ECard *card); - -ECardPhone *e_card_phone_new (void); -ECardPhone *e_card_phone_copy (const ECardPhone *phone); -void e_card_phone_free ( ECardPhone *phone); - +/* Simple functions */ +ECard *e_card_new (char *vcard); +char *e_card_get_id (ECard *card); +void e_card_set_id (ECard *card, + const char *character); +char *e_card_get_vcard (ECard *card); +ECard *e_card_duplicate (ECard *card); + +/* ECardPhone manipulation */ +ECardPhone *e_card_phone_new (void); +ECardPhone *e_card_phone_copy (const ECardPhone *phone); +void e_card_phone_free (ECardPhone *phone); + +/* ECardDeliveryAddress manipulation */ ECardDeliveryAddress *e_card_delivery_address_new (void); ECardDeliveryAddress *e_card_delivery_address_copy (const ECardDeliveryAddress *addr); -void e_card_delivery_address_free ( ECardDeliveryAddress *addr); +void e_card_delivery_address_free (ECardDeliveryAddress *addr); gboolean e_card_delivery_address_is_empty (const ECardDeliveryAddress *addr); char *e_card_delivery_address_to_string (const ECardDeliveryAddress *addr); -ECardDeliveryAddress *e_card_delivery_address_from_label (const ECardAddrLabel *label); +ECardDeliveryAddress *e_card_delivery_address_from_label (const ECardAddrLabel *label); ECardAddrLabel *e_card_delivery_address_to_label (const ECardDeliveryAddress *addr); -ECardAddrLabel *e_card_address_label_new (void); -ECardAddrLabel *e_card_address_label_copy (const ECardAddrLabel *addr); -void e_card_address_label_free ( ECardAddrLabel *addr); - -ECardName *e_card_name_new (void); -ECardName *e_card_name_copy (const ECardName *name); -void e_card_name_free ( ECardName *name); -char *e_card_name_to_string (const ECardName *name); -ECardName *e_card_name_from_string (const char *full_name); - -ECardArbitrary *e_card_arbitrary_new (void); -ECardArbitrary *e_card_arbitrary_copy (const ECardArbitrary *arbitrary); -void e_card_arbitrary_free ( ECardArbitrary *arbitrary); - -GList *e_card_load_cards_from_file(const char *filename); +/* ECardAddrLabel manipulation */ +ECardAddrLabel *e_card_address_label_new (void); +ECardAddrLabel *e_card_address_label_copy (const ECardAddrLabel *addr); +void e_card_address_label_free (ECardAddrLabel *addr); + +/* ECardName manipulation */ +ECardName *e_card_name_new (void); +ECardName *e_card_name_copy (const ECardName *name); +void e_card_name_free (ECardName *name); +char *e_card_name_to_string (const ECardName *name); +ECardName *e_card_name_from_string (const char *full_name); + +/* ECardArbitrary manipulation */ +ECardArbitrary *e_card_arbitrary_new (void); +ECardArbitrary *e_card_arbitrary_copy (const ECardArbitrary *arbitrary); +void e_card_arbitrary_free (ECardArbitrary *arbitrary); + +/* Specialized functionality */ +GList *e_card_load_cards_from_file (const char *filename); + +enum _ECardDisposition { + E_CARD_DISPOSITION_AS_ATTACHMENT, + E_CARD_DISPOSITION_AS_TO, +}; +typedef enum _ECardDisposition ECardDisposition; +void e_card_send (ECard *card, + ECardDisposition disposition); /* Standard Gtk function */ -GtkType e_card_get_type (void); +GtkType e_card_get_type (void); #endif /* ! __E_CARD_H__ */ diff --git a/addressbook/contact-editor/e-contact-editor.c b/addressbook/contact-editor/e-contact-editor.c index c4e8ed8640..9e1afacb7b 100644 --- a/addressbook/contact-editor/e-contact-editor.c +++ b/addressbook/contact-editor/e-contact-editor.c @@ -662,6 +662,36 @@ file_save_as_cb (GtkWidget *widget, gpointer data) e_contact_save_as("Save as VCard", card); } +static void +file_send_as_cb (GtkWidget *widget, gpointer data) +{ + EContactEditor *ce; + ECard *card; + + ce = E_CONTACT_EDITOR (data); + + extract_info (ce); + e_card_simple_sync_card (ce->simple); + + card = ce->card; + e_card_send(card, E_CARD_DISPOSITION_AS_ATTACHMENT); +} + +static void +file_send_to_cb (GtkWidget *widget, gpointer data) +{ + EContactEditor *ce; + ECard *card; + + ce = E_CONTACT_EDITOR (data); + + extract_info (ce); + e_card_simple_sync_card (ce->simple); + + card = ce->card; + e_card_send(card, E_CARD_DISPOSITION_AS_TO); +} + gboolean e_contact_editor_confirm_delete(GtkWindow *parent) { @@ -744,6 +774,8 @@ BonoboUIVerb verbs [] = { BONOBO_UI_UNSAFE_VERB ("ContactEditorSave", file_save_cb), BONOBO_UI_UNSAFE_VERB ("ContactEditorSaveAs", file_save_as_cb), BONOBO_UI_UNSAFE_VERB ("ContactEditorSaveClose", tb_save_and_close_cb), + BONOBO_UI_UNSAFE_VERB ("ContactEditorSendAs", file_send_as_cb), + BONOBO_UI_UNSAFE_VERB ("ContactEditorSendTo", file_send_to_cb), BONOBO_UI_UNSAFE_VERB ("ContactEditorDelete", delete_cb), BONOBO_UI_UNSAFE_VERB ("ContactEditorPrint", print_cb), BONOBO_UI_UNSAFE_VERB ("ContactEditorPrintEnvelope", print_envelope_cb), diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c index c4e8ed8640..9e1afacb7b 100644 --- a/addressbook/gui/contact-editor/e-contact-editor.c +++ b/addressbook/gui/contact-editor/e-contact-editor.c @@ -662,6 +662,36 @@ file_save_as_cb (GtkWidget *widget, gpointer data) e_contact_save_as("Save as VCard", card); } +static void +file_send_as_cb (GtkWidget *widget, gpointer data) +{ + EContactEditor *ce; + ECard *card; + + ce = E_CONTACT_EDITOR (data); + + extract_info (ce); + e_card_simple_sync_card (ce->simple); + + card = ce->card; + e_card_send(card, E_CARD_DISPOSITION_AS_ATTACHMENT); +} + +static void +file_send_to_cb (GtkWidget *widget, gpointer data) +{ + EContactEditor *ce; + ECard *card; + + ce = E_CONTACT_EDITOR (data); + + extract_info (ce); + e_card_simple_sync_card (ce->simple); + + card = ce->card; + e_card_send(card, E_CARD_DISPOSITION_AS_TO); +} + gboolean e_contact_editor_confirm_delete(GtkWindow *parent) { @@ -744,6 +774,8 @@ BonoboUIVerb verbs [] = { BONOBO_UI_UNSAFE_VERB ("ContactEditorSave", file_save_cb), BONOBO_UI_UNSAFE_VERB ("ContactEditorSaveAs", file_save_as_cb), BONOBO_UI_UNSAFE_VERB ("ContactEditorSaveClose", tb_save_and_close_cb), + BONOBO_UI_UNSAFE_VERB ("ContactEditorSendAs", file_send_as_cb), + BONOBO_UI_UNSAFE_VERB ("ContactEditorSendTo", file_send_to_cb), BONOBO_UI_UNSAFE_VERB ("ContactEditorDelete", delete_cb), BONOBO_UI_UNSAFE_VERB ("ContactEditorPrint", print_cb), BONOBO_UI_UNSAFE_VERB ("ContactEditorPrintEnvelope", print_envelope_cb), diff --git a/addressbook/gui/search/e-addressbook-search-dialog.c b/addressbook/gui/search/e-addressbook-search-dialog.c index 60f92cfff4..c1cce6301a 100644 --- a/addressbook/gui/search/e-addressbook-search-dialog.c +++ b/addressbook/gui/search/e-addressbook-search-dialog.c @@ -72,12 +72,8 @@ static void e_addressbook_search_dialog_class_init (EAddressbookSearchDialogClass *klass) { GtkObjectClass *object_class; - GtkWidgetClass *widget_class; - ECanvasClass *canvas_class; object_class = (GtkObjectClass*) klass; - widget_class = GTK_WIDGET_CLASS (klass); - canvas_class = E_CANVAS_CLASS (klass); parent_class = gtk_type_class (PARENT_TYPE); diff --git a/addressbook/gui/widgets/e-addressbook-view.c b/addressbook/gui/widgets/e-addressbook-view.c index 3d081ab14c..d0d6984faf 100644 --- a/addressbook/gui/widgets/e-addressbook-view.c +++ b/addressbook/gui/widgets/e-addressbook-view.c @@ -417,6 +417,20 @@ save_as (GtkWidget *widget, CardAndBook *card_and_book) } static void +send_as (GtkWidget *widget, CardAndBook *card_and_book) +{ + e_card_send(card_and_book->card, E_CARD_DISPOSITION_AS_ATTACHMENT); + card_and_book_free(card_and_book); +} + +static void +send_to (GtkWidget *widget, CardAndBook *card_and_book) +{ + e_card_send(card_and_book->card, E_CARD_DISPOSITION_AS_TO); + card_and_book_free(card_and_book); +} + +static void print (GtkWidget *widget, CardAndBook *card_and_book) { gtk_widget_show(e_contact_print_card_dialog_new(card_and_book->card)); @@ -451,11 +465,13 @@ table_right_click(ETableScrolled *table, gint row, gint col, GdkEvent *event, EA CardAndBook *card_and_book; EPopupMenu menu[] = { - {"Save as VCard", NULL, GTK_SIGNAL_FUNC(save_as), 0}, - {"Print", NULL, GTK_SIGNAL_FUNC(print), 0}, - {"Print Envelope", NULL, GTK_SIGNAL_FUNC(print_envelope), 0}, - {"Delete", NULL, GTK_SIGNAL_FUNC(delete), 0}, - {NULL, NULL, NULL, 0} + {"Save as VCard", NULL, GTK_SIGNAL_FUNC(save_as), NULL, 0}, + {"Send contact to other", NULL, GTK_SIGNAL_FUNC(send_as), NULL, 0}, + {"Send message to contact", NULL, GTK_SIGNAL_FUNC(send_to), NULL, 0}, + {"Print", NULL, GTK_SIGNAL_FUNC(print), NULL, 0}, + {"Print Envelope", NULL, GTK_SIGNAL_FUNC(print_envelope), NULL, 0}, + {"Delete", NULL, GTK_SIGNAL_FUNC(delete), NULL, 0}, + {NULL, NULL, NULL, NULL, 0} }; card_and_book = g_new(CardAndBook, 1); diff --git a/addressbook/gui/widgets/e-minicard.c b/addressbook/gui/widgets/e-minicard.c index 4dda2cee1d..6bf1d57c9a 100644 --- a/addressbook/gui/widgets/e-minicard.c +++ b/addressbook/gui/widgets/e-minicard.c @@ -339,6 +339,20 @@ save_as (GtkWidget *widget, EMinicard *minicard) } static void +send_as (GtkWidget *widget, EMinicard *minicard) +{ + e_card_simple_sync_card(minicard->simple); + e_card_send(minicard->card, E_CARD_DISPOSITION_AS_ATTACHMENT); +} + +static void +send_to (GtkWidget *widget, EMinicard *minicard) +{ + e_card_simple_sync_card(minicard->simple); + e_card_send(minicard->card, E_CARD_DISPOSITION_AS_TO); +} + +static void delete (GtkWidget *widget, EMinicard *minicard) { EBook *book; @@ -483,20 +497,14 @@ e_minicard_event (GnomeCanvasItem *item, GdkEvent *event) if (event->button.button == 1) { e_canvas_item_grab_focus(item); } else if (event->button.button == 3) { - if (E_IS_MINICARD_VIEW(item->parent)) { - EPopupMenu menu[] = { {"Save as VCard", NULL, GTK_SIGNAL_FUNC(save_as), 0}, - {"Print", NULL, GTK_SIGNAL_FUNC(print), 0}, - {"Print Envelope", NULL, GTK_SIGNAL_FUNC(print_envelope), 0}, - {"Delete", NULL, GTK_SIGNAL_FUNC(delete), 0}, - {NULL, NULL, NULL, 0}}; - e_popup_menu_run (menu, (GdkEventButton *)event, 0, 0, e_minicard); - } else { - EPopupMenu menu[] = { {"Save as VCard", NULL, GTK_SIGNAL_FUNC(save_as), 0}, - {"Print Envelope", NULL, GTK_SIGNAL_FUNC(print_envelope), 0}, - {"Print", NULL, GTK_SIGNAL_FUNC(print), 0}, - {NULL, NULL, NULL, 0}}; - e_popup_menu_run (menu, (GdkEventButton *)event, 0, 0, e_minicard); - } + EPopupMenu menu[] = { {"Save as VCard", NULL, GTK_SIGNAL_FUNC(save_as), NULL, 0}, + {"Send contact to other", NULL, GTK_SIGNAL_FUNC(send_as), NULL, 0}, + {"Send message to contact", NULL, GTK_SIGNAL_FUNC(send_to), NULL, 0}, + {"Print", NULL, GTK_SIGNAL_FUNC(print), NULL, 0}, + {"Print Envelope", NULL, GTK_SIGNAL_FUNC(print_envelope), NULL, 0}, + {"Delete", NULL, GTK_SIGNAL_FUNC(delete), NULL, 1}, + {NULL, NULL, NULL, 0}}; + e_popup_menu_run (menu, (GdkEventButton *)event, 0, E_IS_MINICARD_VIEW(item->parent) ? 0 : 1, e_minicard); } break; |