diff options
-rw-r--r-- | addressbook/ChangeLog | 8 | ||||
-rw-r--r-- | addressbook/gui/component/addressbook-component.c | 28 |
2 files changed, 27 insertions, 9 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index 33c8cb16f3..68c8a37405 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,3 +1,11 @@ +2004-01-19 Hans Petter Jansson <hpj@ximian.com> + + * gui/component/addressbook-component.c + (get_primary_source): Implement. + (load_primary_selection): Use get_primary_source (). + (impl_requestCreateItem): Use get_primary_source (), fixing a crash + when we're asked to create a new item and we don't have the controls. + 2004-01-16 Hans Petter Jansson <hpj@ximian.com> * gui/component/addressbook.c (load_source_auth_cb): Don't run diff --git a/addressbook/gui/component/addressbook-component.c b/addressbook/gui/component/addressbook-component.c index d08ce5bb20..77190f99c0 100644 --- a/addressbook/gui/component/addressbook-component.c +++ b/addressbook/gui/component/addressbook-component.c @@ -118,8 +118,8 @@ save_primary_selection (AddressbookComponent *addressbook_component) e_source_peek_uid (source), NULL); } -static void -load_primary_selection (AddressbookComponent *addressbook_component) +static ESource * +get_primary_source (AddressbookComponent *addressbook_component) { AddressbookComponentPrivate *priv; ESource *source; @@ -133,16 +133,26 @@ load_primary_selection (AddressbookComponent *addressbook_component) if (uid) { source = e_source_list_peek_source_by_uid (priv->source_list, uid); g_free (uid); - - e_source_selector_set_primary_selection (E_SOURCE_SELECTOR (priv->source_selector), source); } else { - ESource *source; - /* Try to create a default if there isn't one */ source = find_first_source (priv->source_list); - if (source) - e_source_selector_set_primary_selection (E_SOURCE_SELECTOR (priv->source_selector), source); } + + return source; +} + +static void +load_primary_selection (AddressbookComponent *addressbook_component) +{ + AddressbookComponentPrivate *priv; + ESource *source; + char *uid; + + priv = addressbook_component->priv; + + source = get_primary_source (addressbook_component); + if (source) + e_source_selector_set_primary_selection (E_SOURCE_SELECTOR (priv->source_selector), source); } /* Folder popup menu callbacks */ @@ -358,7 +368,7 @@ impl_requestCreateItem (PortableServer_Servant servant, priv = addressbook_component->priv; - selected_source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (priv->source_selector)); + selected_source = get_primary_source (addressbook_component); if (!selected_source) { CORBA_exception_set (ev, CORBA_USER_EXCEPTION, ex_GNOME_Evolution_Component_Failed, NULL); return; |