aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/backend/ebook/e-card-simple.c
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@ximian.com>2001-05-08 12:58:41 +0800
committerChris Lahey <clahey@src.gnome.org>2001-05-08 12:58:41 +0800
commit3c0c62e2958b5dccca490908145c534022a85563 (patch)
tree421d5332f2518c99cfd6ac6dd4aa325f1a0a1a84 /addressbook/backend/ebook/e-card-simple.c
parent5d4895eb431adfbf2c7895d4257fa20a28f474f9 (diff)
downloadgsoc2013-evolution-3c0c62e2958b5dccca490908145c534022a85563.tar
gsoc2013-evolution-3c0c62e2958b5dccca490908145c534022a85563.tar.gz
gsoc2013-evolution-3c0c62e2958b5dccca490908145c534022a85563.tar.bz2
gsoc2013-evolution-3c0c62e2958b5dccca490908145c534022a85563.tar.lz
gsoc2013-evolution-3c0c62e2958b5dccca490908145c534022a85563.tar.xz
gsoc2013-evolution-3c0c62e2958b5dccca490908145c534022a85563.tar.zst
gsoc2013-evolution-3c0c62e2958b5dccca490908145c534022a85563.zip
Removed e-card-pairs.h since we're not using it.
2001-05-08 Christopher James Lahey <clahey@ximian.com> * backend/ebook/Makefile.am (libebookinclude_HEADERS): Removed e-card-pairs.h since we're not using it. * backend/ebook/e-book-view.c (e_book_view_check_listener_queue): Added break; to default: case here. * backend/ebook/e-card-simple.c, backend/ebook/e-card-simple.h: Added changed variable so as to avoid sync_card when possible. (e_card_simple_destroy): Free all the data here properly. (e_card_simple_get_arg): Slight simplification here. (fill_in_info, e_card_simple_arbitrary_foreach, e_card_simple_get_arbitrary): Call e_card_free_empty_lists here to save a bit of memory. * backend/ebook/e-card.c, backend/ebook/e-card.h: Fixed up includes a bit. (e_card_list_get_vcard, e_card_list_send): Added these functions for acting on a group of cards. (parse_org): Cleaned up this function a bit. (e_card_free_empty_lists): Added this function to delete unnecessary ELists and save a bit of memory. (e_v_object_get_child_value): Made this return NULL if not found instead of g_strdup(""). * contact-editor/e-contact-save-as.c, contact-editor/e-contact-save-as.h (e_contact_list_save_as): Added this function to save multiple contacts. * gui/widgets/Makefile.am: Commented out reflow test. (libeminicard_a_SOURCES): Added e-minicard-view-model.c and e-minicard-view-model.h. * gui/widgets/e-minicard-view-model.c, gui/widgets/e-minicard-view-model.h: Model for use in EMinicardView. * gui/widgets/e-minicard-view.c, gui/widgets/e-minicard-view.h: Reworked this to use the new EReflow stuff. * gui/widgets/e-minicard.c (e_minicard_event): Doesn't handle right click menus now. Emits a signal on the parent canvas item instead. * printing/e-contact-print-envelope.c, printing/e-contact-print-envelope.h (e_contact_print_envelope_list_dialog_new): Added this function to print multiple envelopes (only prints first for now.) * printing/e-contact-print.c, printing/e-contact-print.h (e_contact_print_card_list_dialog_new): Added this function to print multiple cards. Only prints the first for now. svn path=/trunk/; revision=9711
Diffstat (limited to 'addressbook/backend/ebook/e-card-simple.c')
-rw-r--r--addressbook/backend/ebook/e-card-simple.c30
1 files changed, 22 insertions, 8 deletions
diff --git a/addressbook/backend/ebook/e-card-simple.c b/addressbook/backend/ebook/e-card-simple.c
index 6d5619d135..f7550017a0 100644
--- a/addressbook/backend/ebook/e-card-simple.c
+++ b/addressbook/backend/ebook/e-card-simple.c
@@ -326,11 +326,13 @@ e_card_simple_destroy (GtkObject *object)
simple->temp_fields = NULL;
for(i = 0; i < E_CARD_SIMPLE_PHONE_ID_LAST; i++)
- g_free(simple->phone[i]);
+ e_card_phone_free (simple->phone[i]);
for(i = 0; i < E_CARD_SIMPLE_EMAIL_ID_LAST; i++)
g_free(simple->email[i]);
for(i = 0; i < E_CARD_SIMPLE_ADDRESS_ID_LAST; i++)
- g_free(simple->address[i]);
+ e_card_address_label_free(simple->address[i]);
+ for(i = 0; i < E_CARD_SIMPLE_ADDRESS_ID_LAST; i++)
+ e_card_delivery_address_free(simple->delivery[i]);
}
@@ -373,10 +375,7 @@ e_card_simple_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
switch (arg_id) {
case ARG_CARD:
e_card_simple_sync_card(simple);
- if (simple->card)
- GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(simple->card);
- else
- GTK_VALUE_OBJECT (*arg) = NULL;
+ GTK_VALUE_OBJECT (*arg) = (GtkObject *) simple->card;
break;
default:
arg->type = GTK_TYPE_INVALID;
@@ -400,6 +399,8 @@ e_card_simple_init (ECardSimple *simple)
for(i = 0; i < E_CARD_SIMPLE_ADDRESS_ID_LAST; i++)
simple->address[i] = NULL;
simple->temp_fields = NULL;
+
+ simple->changed = TRUE;
}
static void
@@ -484,6 +485,7 @@ fill_in_info(ECardSimple *simple)
}
}
gtk_object_unref(GTK_OBJECT(iterator));
+ e_card_free_empty_lists (card);
}
}
@@ -491,7 +493,7 @@ void
e_card_simple_sync_card(ECardSimple *simple)
{
ECard *card = simple->card;
- if (card) {
+ if (card && simple->changed) {
EList *address_list;
EList *phone_list;
EList *email_list;
@@ -632,7 +634,10 @@ e_card_simple_sync_card(ECardSimple *simple)
}
}
fill_in_info(simple);
+ e_card_free_empty_lists (card);
}
+
+ simple->changed = FALSE;
}
const ECardPhone *e_card_simple_get_phone (ECardSimple *simple,
@@ -666,6 +671,7 @@ void e_card_simple_set_phone (ECardSimple *simple,
if (simple->phone[id])
e_card_phone_free(simple->phone[id]);
simple->phone[id] = e_card_phone_copy(phone);
+ simple->changed = TRUE;
}
void e_card_simple_set_email (ECardSimple *simple,
@@ -675,6 +681,7 @@ void e_card_simple_set_email (ECardSimple *simple,
if (simple->email[id])
g_free(simple->email[id]);
simple->email[id] = g_strdup(email);
+ simple->changed = TRUE;
}
void e_card_simple_set_address (ECardSimple *simple,
@@ -687,6 +694,7 @@ void e_card_simple_set_address (ECardSimple *simple,
if (simple->delivery[id])
e_card_delivery_address_free(simple->delivery[id]);
simple->delivery[id] = e_card_delivery_address_from_label(simple->address[id]);
+ simple->changed = TRUE;
}
void e_card_simple_set_delivery_address (ECardSimple *simple,
@@ -696,6 +704,7 @@ void e_card_simple_set_delivery_address (ECardSimple *simple
if (simple->delivery[id])
e_card_delivery_address_free(simple->delivery[id]);
simple->delivery[id] = e_card_delivery_address_copy(delivery);
+ simple->changed = TRUE;
}
const char *e_card_simple_get_const (ECardSimple *simple,
@@ -904,6 +913,7 @@ void e_card_simple_set (ECardSimple *simple,
ECardAddrLabel *address;
ECardPhone *phone;
int style;
+ simple->changed = TRUE;
switch (field) {
case E_CARD_SIMPLE_FIELD_FULL_NAME:
case E_CARD_SIMPLE_FIELD_ORG:
@@ -1005,6 +1015,7 @@ void e_card_simple_arbitrary_foreach (ECardSimple
if (callback)
(*callback) (arbitrary, closure);
}
+ e_card_free_empty_lists (simple->card);
}
}
@@ -1022,6 +1033,7 @@ const ECardArbitrary *e_card_simple_get_arbitrary (ECardSimple *sim
if (!strcasecmp(arbitrary->key, key))
return arbitrary;
}
+ e_card_free_empty_lists (simple->card);
}
return NULL;
}
@@ -1033,9 +1045,11 @@ void e_card_simple_set_arbitrary (ECardSimple *sim
const char *value)
{
if (simple->card) {
- ECardArbitrary *new_arb;
+ ECardArbitrary *new_arb;
EList *list;
EIterator *iterator;
+
+ simple->changed = TRUE;
gtk_object_get(GTK_OBJECT(simple->card),
"arbitrary", &list,
NULL);