aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui
diff options
context:
space:
mode:
authorHans Petter Jansson <hpj@ximian.com>2004-01-20 02:10:16 +0800
committerHans Petter <hansp@src.gnome.org>2004-01-20 02:10:16 +0800
commitaf85f887c25f8a6348bb43a39692bcca0e9cc421 (patch)
treec81fdfc1eedda6fcdea2480069302dca9e476745 /addressbook/gui
parentdc7bb04a140082d51765d29c2fbc7fefc5f83d68 (diff)
downloadgsoc2013-evolution-af85f887c25f8a6348bb43a39692bcca0e9cc421.tar.gz
gsoc2013-evolution-af85f887c25f8a6348bb43a39692bcca0e9cc421.tar.zst
gsoc2013-evolution-af85f887c25f8a6348bb43a39692bcca0e9cc421.zip
Implement. (load_primary_selection): Use get_primary_source ().
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. svn path=/trunk/; revision=24309
Diffstat (limited to 'addressbook/gui')
-rw-r--r--addressbook/gui/component/addressbook-component.c28
1 files changed, 19 insertions, 9 deletions
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;