diff options
Diffstat (limited to 'addressbook/backend')
-rw-r--r-- | addressbook/backend/ebook/e-card-compare.c | 4 | ||||
-rw-r--r-- | addressbook/backend/ebook/e-card-simple.c | 60 |
2 files changed, 38 insertions, 26 deletions
diff --git a/addressbook/backend/ebook/e-card-compare.c b/addressbook/backend/ebook/e-card-compare.c index fc80d5e6c6..f249c1727b 100644 --- a/addressbook/backend/ebook/e-card-compare.c +++ b/addressbook/backend/ebook/e-card-compare.c @@ -419,7 +419,7 @@ use_common_book_cb (EBook *book, gpointer closure) /* Build up our full query from the parts. */ - + query_parts[p] = NULL; qj = g_strjoinv (" ", query_parts); if (p > 0) { query = g_strdup_printf ("(or %s)", qj); @@ -446,7 +446,7 @@ e_card_locate_match (ECard *card, ECardMatchQueryCallback cb, gpointer closure) info = g_new (MatchSearchInfo, 1); info->card = card; - gtk_object_unref (GTK_OBJECT (card)); + gtk_object_ref (GTK_OBJECT (card)); info->cb = cb; info->closure = closure; diff --git a/addressbook/backend/ebook/e-card-simple.c b/addressbook/backend/ebook/e-card-simple.c index f7550017a0..ed10a56685 100644 --- a/addressbook/backend/ebook/e-card-simple.c +++ b/addressbook/backend/ebook/e-card-simple.c @@ -727,15 +727,21 @@ char *e_card_simple_get (ECardSimple *simple, ECardName *name; switch(type) { case E_CARD_SIMPLE_INTERNAL_TYPE_STRING: - gtk_object_get(GTK_OBJECT(simple->card), - field_data[field].ecard_field, &string, - NULL); - return g_strdup(string); + if (simple->card) { + gtk_object_get(GTK_OBJECT(simple->card), + field_data[field].ecard_field, &string, + NULL); + return g_strdup(string); + } else + return NULL; case E_CARD_SIMPLE_INTERNAL_TYPE_DATE: - gtk_object_get(GTK_OBJECT(simple->card), - field_data[field].ecard_field, &date, - NULL); - return NULL; /* FIXME!!!! */ + if (simple->card) { + gtk_object_get(GTK_OBJECT(simple->card), + field_data[field].ecard_field, &date, + NULL); + return NULL; /* FIXME!!!! */ + } else + return NULL; case E_CARD_SIMPLE_INTERNAL_TYPE_ADDRESS: addr = e_card_simple_get_address(simple, field_data[field].list_type_index); @@ -757,24 +763,30 @@ char *e_card_simple_get (ECardSimple *simple, case E_CARD_SIMPLE_INTERNAL_TYPE_SPECIAL: switch (field) { case E_CARD_SIMPLE_FIELD_NAME_OR_ORG: - gtk_object_get(GTK_OBJECT(simple->card), - "full_name", &string, - NULL); - if (string && *string) + if (simple->card) { + gtk_object_get(GTK_OBJECT(simple->card), + "full_name", &string, + NULL); + if (string && *string) + return g_strdup(string); + gtk_object_get(GTK_OBJECT(simple->card), + "org", &string, + NULL); + if (string && *string) + return g_strdup(string); + string = e_card_simple_get_email(simple, + E_CARD_SIMPLE_EMAIL_ID_EMAIL); return g_strdup(string); - gtk_object_get(GTK_OBJECT(simple->card), - "org", &string, - NULL); - if (string && *string) - return g_strdup(string); - string = e_card_simple_get_email(simple, - E_CARD_SIMPLE_EMAIL_ID_EMAIL); - return g_strdup(string); + } else + return NULL; case E_CARD_SIMPLE_FIELD_FAMILY_NAME: - gtk_object_get (GTK_OBJECT(simple->card), - "name", &name, - NULL); - return g_strdup (name->family); + if (simple->card) { + gtk_object_get (GTK_OBJECT(simple->card), + "name", &name, + NULL); + return g_strdup (name->family); + } else + return NULL; default: return NULL; } |