aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/backend/ebook
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@helixcode.com>2000-04-05 04:58:46 +0800
committerChris Lahey <clahey@src.gnome.org>2000-04-05 04:58:46 +0800
commitd8db781adee587ed1fc5b948a68d1d0a7c2952c2 (patch)
treee2003adb7f8e6dbf4ec917adf95c7f594113ce39 /addressbook/backend/ebook
parent2d75a701029288c953a84ba0a696675f5a7eb77f (diff)
downloadgsoc2013-evolution-d8db781adee587ed1fc5b948a68d1d0a7c2952c2.tar.gz
gsoc2013-evolution-d8db781adee587ed1fc5b948a68d1d0a7c2952c2.tar.zst
gsoc2013-evolution-d8db781adee587ed1fc5b948a68d1d0a7c2952c2.zip
Changed this to backend to an ebook.
2000-04-04 Christopher James Lahey <clahey@helixcode.com> * addressbook/demo/e-test-model.c, addressbook/demo/e-test-model.h, addressbook/demo/Makefile.am: Changed this to backend to an ebook. * addressbook/backend/ebook/e-card-iterator.c, addressbook/backend/ebook/e-card-iterator.h, addressbook/backend/ebook/e-card-list-iterator.c, addressbook/backend/ebook/e-card-list.c, addressbook/backend/ebook/e-card-list.h, addressbook/backend/ebook/e-card.c, addressbook/backend/ebook/e-card.h: Fixed const correctness and changed a couple of functions to be external. * addressbook/Makefile.am: Fixed subdir ordering. svn path=/trunk/; revision=2287
Diffstat (limited to 'addressbook/backend/ebook')
-rw-r--r--addressbook/backend/ebook/e-card-iterator.c4
-rw-r--r--addressbook/backend/ebook/e-card-iterator.h22
-rw-r--r--addressbook/backend/ebook/e-card-list-iterator.c10
-rw-r--r--addressbook/backend/ebook/e-card-list.c4
-rw-r--r--addressbook/backend/ebook/e-card-list.h6
-rw-r--r--addressbook/backend/ebook/e-card.c33
-rw-r--r--addressbook/backend/ebook/e-card.h6
7 files changed, 43 insertions, 42 deletions
diff --git a/addressbook/backend/ebook/e-card-iterator.c b/addressbook/backend/ebook/e-card-iterator.c
index df4cb5a4a4..0d666e649f 100644
--- a/addressbook/backend/ebook/e-card-iterator.c
+++ b/addressbook/backend/ebook/e-card-iterator.c
@@ -100,7 +100,7 @@ e_card_iterator_init (ECardIterator *card)
/*
* Virtual functions:
*/
-void *
+const void *
e_card_iterator_get (ECardIterator *iterator)
{
if (ECI_CLASS(iterator)->get)
@@ -143,7 +143,7 @@ e_card_iterator_delete (ECardIterator *iterator)
void
e_card_iterator_set (ECardIterator *iterator,
- void *object)
+ const void *object)
{
if (ECI_CLASS(iterator)->set)
ECI_CLASS(iterator)->set(iterator, object);
diff --git a/addressbook/backend/ebook/e-card-iterator.h b/addressbook/backend/ebook/e-card-iterator.h
index 4b5aaf55b7..9d657e03ef 100644
--- a/addressbook/backend/ebook/e-card-iterator.h
+++ b/addressbook/backend/ebook/e-card-iterator.h
@@ -31,26 +31,26 @@ struct _ECardIteratorClass {
GtkObjectClass parent_class;
/* Signals */
- void (*invalidate) (ECardIterator *iterator);
+ void (*invalidate) (ECardIterator *iterator);
/* Virtual functions */
- void * (*get) (ECardIterator *iterator);
- void (*reset) (ECardIterator *iterator);
- gboolean (*next) (ECardIterator *iterator);
- gboolean (*prev) (ECardIterator *iterator);
- void (*delete) (ECardIterator *iterator);
- void (*set) (ECardIterator *iterator,
- void *object);
- gboolean (*is_valid) (ECardIterator *iterator);
+ const void * (*get) (ECardIterator *iterator);
+ void (*reset) (ECardIterator *iterator);
+ gboolean (*next) (ECardIterator *iterator);
+ gboolean (*prev) (ECardIterator *iterator);
+ void (*delete) (ECardIterator *iterator);
+ void (*set) (ECardIterator *iterator,
+ const void *object);
+ gboolean (*is_valid) (ECardIterator *iterator);
};
-void *e_card_iterator_get (ECardIterator *iterator);
+const void *e_card_iterator_get (ECardIterator *iterator);
void e_card_iterator_reset (ECardIterator *iterator);
gboolean e_card_iterator_next (ECardIterator *iterator);
gboolean e_card_iterator_prev (ECardIterator *iterator);
void e_card_iterator_delete (ECardIterator *iterator);
void e_card_iterator_set (ECardIterator *iterator,
- void *object);
+ const void *object);
gboolean e_card_iterator_is_valid (ECardIterator *iterator);
void e_card_iterator_invalidate (ECardIterator *iterator);
diff --git a/addressbook/backend/ebook/e-card-list-iterator.c b/addressbook/backend/ebook/e-card-list-iterator.c
index e6d9a9c040..e3426ddc3b 100644
--- a/addressbook/backend/ebook/e-card-list-iterator.c
+++ b/addressbook/backend/ebook/e-card-list-iterator.c
@@ -19,12 +19,12 @@ static void e_card_list_iterator_class_init (ECardListIteratorClass *klass);
static void e_card_list_iterator_invalidate (ECardIterator *iterator);
static gboolean e_card_list_iterator_is_valid (ECardIterator *iterator);
static void e_card_list_iterator_set (ECardIterator *iterator,
- void *object);
+ const void *object);
static void e_card_list_iterator_delete (ECardIterator *iterator);
static gboolean e_card_list_iterator_prev (ECardIterator *iterator);
static gboolean e_card_list_iterator_next (ECardIterator *iterator);
static void e_card_list_iterator_reset (ECardIterator *iterator);
-static void *e_card_list_iterator_get (ECardIterator *iterator);
+static const void *e_card_list_iterator_get (ECardIterator *iterator);
static void e_card_list_iterator_destroy (GtkObject *object);
#define PARENT_TYPE (e_card_iterator_get_type ())
@@ -120,7 +120,7 @@ e_card_list_iterator_destroy (GtkObject *object)
gtk_object_unref(GTK_OBJECT(iterator->list));
}
-static void *
+static const void *
e_card_list_iterator_get (ECardIterator *_iterator)
{
ECardListIterator *iterator = E_CARD_LIST_ITERATOR(_iterator);
@@ -171,7 +171,7 @@ e_card_list_iterator_delete (ECardIterator *_iterator)
static void
e_card_list_iterator_set (ECardIterator *_iterator,
- void *object)
+ const void *object)
{
ECardListIterator *iterator = E_CARD_LIST_ITERATOR(_iterator);
if (iterator->iterator) {
@@ -180,7 +180,7 @@ e_card_list_iterator_set (ECardIterator *_iterator,
if (iterator->list->copy)
iterator->iterator->data = iterator->list->copy(object, iterator->list->closure);
else
- iterator->iterator->data = object;
+ iterator->iterator->data = (void *) object;
}
}
diff --git a/addressbook/backend/ebook/e-card-list.c b/addressbook/backend/ebook/e-card-list.c
index 641f5b1f0a..d4965b77d5 100644
--- a/addressbook/backend/ebook/e-card-list.c
+++ b/addressbook/backend/ebook/e-card-list.c
@@ -96,13 +96,13 @@ e_card_list_get_iterator (ECardList *list)
}
void
-e_card_list_append (ECardList *list, void *data)
+e_card_list_append (ECardList *list, const void *data)
{
e_card_list_invalidate_iterators(list, NULL);
if (list->copy)
list->list = g_list_append(list->list, list->copy(data, list->closure));
else
- list->list = g_list_append(list->list, data);
+ list->list = g_list_append(list->list, (void *) data);
}
void
diff --git a/addressbook/backend/ebook/e-card-list.h b/addressbook/backend/ebook/e-card-list.h
index 123d890e88..7ceeef1993 100644
--- a/addressbook/backend/ebook/e-card-list.h
+++ b/addressbook/backend/ebook/e-card-list.h
@@ -21,8 +21,8 @@
#define E_IS_CARD_LIST(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_CARD_LIST))
#define E_IS_CARD_LIST_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), E_TYPE_CARD_LIST))
-typedef void *(*ECardListCopyFunc) (void *data, void *closure);
-typedef void *(*ECardListFreeFunc) (void *data, void *closure);
+typedef void *(*ECardListCopyFunc) (const void *data, void *closure);
+typedef void (*ECardListFreeFunc) (void *data, void *closure);
typedef struct _ECardList ECardList;
typedef struct _ECardListClass ECardListClass;
@@ -45,7 +45,7 @@ ECardList *e_card_list_new (ECardListCopyFunc copy,
void *closure);
ECardIterator *e_card_list_get_iterator (ECardList *list);
void e_card_list_append (ECardList *list,
- void *data);
+ const void *data);
/* For iterators to call. */
void e_card_list_invalidate_iterators (ECardList *list,
diff --git a/addressbook/backend/ebook/e-card.c b/addressbook/backend/ebook/e-card.c
index ba55ffc2f7..0ec6105a95 100644
--- a/addressbook/backend/ebook/e-card.c
+++ b/addressbook/backend/ebook/e-card.c
@@ -62,11 +62,6 @@ static void set_phone_flags (VObject *vobj, ECardPhoneFlags flags);
static ECardAddressFlags get_address_flags (VObject *vobj);
static void set_address_flags (VObject *vobj, ECardAddressFlags flags);
-static void e_card_phone_free (ECardPhone *phone);
-static ECardPhone *e_card_phone_copy (ECardPhone *phone);
-static void e_card_delivery_address_free (ECardDeliveryAddress *addr);
-static ECardDeliveryAddress *e_card_delivery_address_copy (ECardDeliveryAddress *addr);
-
typedef void (* ParsePropertyFunc) (ECard *card, VObject *object);
struct {
@@ -502,7 +497,7 @@ e_card_class_init (ECardClass *klass)
object_class->set_arg = e_card_set_arg;
}
-static void
+void
e_card_phone_free (ECardPhone *phone)
{
if ( phone ) {
@@ -512,8 +507,8 @@ e_card_phone_free (ECardPhone *phone)
}
}
-static ECardPhone *
-e_card_phone_copy (ECardPhone *phone)
+ECardPhone *
+e_card_phone_copy (const ECardPhone *phone)
{
if ( phone ) {
ECardPhone *phone_copy = g_new(ECardPhone, 1);
@@ -524,7 +519,7 @@ e_card_phone_copy (ECardPhone *phone)
return NULL;
}
-static void
+void
e_card_delivery_address_free (ECardDeliveryAddress *addr)
{
if ( addr ) {
@@ -546,8 +541,8 @@ e_card_delivery_address_free (ECardDeliveryAddress *addr)
}
}
-static ECardDeliveryAddress *
-e_card_delivery_address_copy (ECardDeliveryAddress *addr)
+ECardDeliveryAddress *
+e_card_delivery_address_copy (const ECardDeliveryAddress *addr)
{
if ( addr ) {
ECardDeliveryAddress *addr_copy = g_new(ECardDeliveryAddress, 1);
@@ -642,17 +637,17 @@ e_card_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
GTK_VALUE_OBJECT(*arg) = GTK_OBJECT(card->address);
break;
case ARG_PHONE:
- if (!card->address)
- card->address = e_card_list_new((ECardListCopyFunc) e_card_phone_copy,
- (ECardListFreeFunc) e_card_phone_free,
- NULL);
+ if (!card->phone)
+ card->phone = e_card_list_new((ECardListCopyFunc) e_card_phone_copy,
+ (ECardListFreeFunc) e_card_phone_free,
+ NULL);
GTK_VALUE_OBJECT(*arg) = GTK_OBJECT(card->phone);
break;
case ARG_EMAIL:
- if (!card->address)
- card->address = e_card_list_new((ECardListCopyFunc) g_strdup,
- (ECardListFreeFunc) g_free,
- NULL);
+ if (!card->email)
+ card->email = e_card_list_new((ECardListCopyFunc) g_strdup,
+ (ECardListFreeFunc) g_free,
+ NULL);
GTK_VALUE_OBJECT(*arg) = GTK_OBJECT(card->email);
break;
case ARG_BIRTH_DATE:
diff --git a/addressbook/backend/ebook/e-card.h b/addressbook/backend/ebook/e-card.h
index 3d2af18c55..a8e1324b20 100644
--- a/addressbook/backend/ebook/e-card.h
+++ b/addressbook/backend/ebook/e-card.h
@@ -90,6 +90,12 @@ char *e_card_get_id (ECard *card);
void e_card_set_id (ECard *card, const gchar *character);
char *e_card_get_vcard (ECard *card);
+void e_card_phone_free (ECardPhone *phone);
+ECardPhone *e_card_phone_copy (const ECardPhone *phone);
+void e_card_delivery_address_free (ECardDeliveryAddress *addr);
+ECardDeliveryAddress *e_card_delivery_address_copy (const ECardDeliveryAddress *addr);
+
+
/* Standard Gtk function */
GtkType e_card_get_type (void);