From 3c310a60ee2720d520f1da2a7a911ad4f8c0d2d2 Mon Sep 17 00:00:00 2001 From: Chris Toshok Date: Tue, 30 Mar 2004 23:21:34 +0000 Subject: [ fixes bug #53544 ] 2004-03-30 Chris Toshok [ fixes bug #53544 ] * gui/component/addressbook-component.c (impl__get_userCreatableItems): add "address_book" to the user creatable items list. complete with incorrect accelerator and shortcut! (impl_requestCreateItem): handle "address_book" here, and plug a memory leak. svn path=/trunk/; revision=25253 --- addressbook/gui/component/addressbook-component.c | 25 ++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) (limited to 'addressbook/gui/component/addressbook-component.c') diff --git a/addressbook/gui/component/addressbook-component.c b/addressbook/gui/component/addressbook-component.c index 429a991134..b066b94b3e 100644 --- a/addressbook/gui/component/addressbook-component.c +++ b/addressbook/gui/component/addressbook-component.c @@ -541,7 +541,7 @@ impl__get_userCreatableItems (PortableServer_Servant servant, { GNOME_Evolution_CreatableItemTypeList *list = GNOME_Evolution_CreatableItemTypeList__alloc (); - list->_length = 2; + list->_length = 3; list->_maximum = list->_length; list->_buffer = GNOME_Evolution_CreatableItemTypeList_allocbuf (list->_length); @@ -561,6 +561,13 @@ impl__get_userCreatableItems (PortableServer_Servant servant, list->_buffer[1].menuShortcut = 'l'; list->_buffer[1].iconName = "contact-list-16.png"; + list->_buffer[2].id = "address_book"; + list->_buffer[2].description = _("New Addressbook Book"); + list->_buffer[2].menuDescription = _("_Address Book"); + list->_buffer[2].tooltip = _("Create a new address book"); + list->_buffer[2].menuShortcut = 'a'; + list->_buffer[2].iconName = "evolution-contacts-mini.png"; + return list; } @@ -572,12 +579,17 @@ impl_requestCreateItem (PortableServer_Servant servant, AddressbookComponent *addressbook_component = ADDRESSBOOK_COMPONENT (bonobo_object_from_servant (servant)); AddressbookComponentPrivate *priv; EBook *book; - EContact *contact = e_contact_new (); + EContact *contact; ESource *selected_source; gchar *uri; priv = addressbook_component->priv; + if (!strcmp (item_type_name, "address_book")) { + addressbook_config_create_new_source (NULL); + return; + } + selected_source = get_primary_source (addressbook_component); if (!selected_source) { CORBA_exception_set (ev, CORBA_USER_EXCEPTION, ex_GNOME_Evolution_Component_Failed, NULL); @@ -602,11 +614,14 @@ impl_requestCreateItem (PortableServer_Servant servant, if (!item_type_name) { CORBA_exception_set (ev, CORBA_USER_EXCEPTION, ex_GNOME_Evolution_Component_UnknownType, NULL); - } else if (!strcmp (item_type_name, "contact")) { + } + else if (!strcmp (item_type_name, "contact")) { eab_show_contact_editor (book, contact, TRUE, TRUE); - } else if (!strcmp (item_type_name, "contact_list")) { + } + else if (!strcmp (item_type_name, "contact_list")) { eab_show_contact_list_editor (book, contact, TRUE, TRUE); - } else { + } + else { CORBA_exception_set (ev, CORBA_USER_EXCEPTION, ex_GNOME_Evolution_Component_UnknownType, NULL); } -- cgit v1.2.3