aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/backend/ebook
diff options
context:
space:
mode:
Diffstat (limited to 'addressbook/backend/ebook')
-rw-r--r--addressbook/backend/ebook/e-card-list-iterator.h4
-rw-r--r--addressbook/backend/ebook/test-client.c38
2 files changed, 37 insertions, 5 deletions
diff --git a/addressbook/backend/ebook/e-card-list-iterator.h b/addressbook/backend/ebook/e-card-list-iterator.h
index cdc7a312b1..67d56cfb9c 100644
--- a/addressbook/backend/ebook/e-card-list-iterator.h
+++ b/addressbook/backend/ebook/e-card-list-iterator.h
@@ -26,14 +26,14 @@ typedef struct _ECardListIterator ECardListIterator;
typedef struct _ECardListIteratorClass ECardListIteratorClass;
struct _ECardListIterator {
- GtkObject object;
+ ECardIterator parent;
ECardList *list;
GList *iterator;
};
struct _ECardListIteratorClass {
- GtkObjectClass parent_class;
+ ECardIteratorClass parent_class;
};
ECardIterator *e_card_list_iterator_new (ECardList *list);
diff --git a/addressbook/backend/ebook/test-client.c b/addressbook/backend/ebook/test-client.c
index f535d2db1a..15c5410146 100644
--- a/addressbook/backend/ebook/test-client.c
+++ b/addressbook/backend/ebook/test-client.c
@@ -30,8 +30,9 @@
"
"
-CORBA_Environment ev;
-CORBA_ORB orb;
+static CORBA_Environment ev;
+static CORBA_ORB orb;
+static char *cardstr;
static void
init_bonobo (int argc, char **argv)
@@ -99,7 +100,7 @@ add_card_cb (EBook *book, EBookStatus status, const gchar *id, gpointer closure)
static void
book_open_cb (EBook *book, EBookStatus status, gpointer closure)
{
- e_book_add_vcard(book, TEST_VCARD, add_card_cb, NULL);
+ e_book_add_vcard(book, cardstr, add_card_cb, NULL);
}
static guint
@@ -125,6 +126,30 @@ ebook_create (void)
return FALSE;
}
+static char *
+read_file (char *name)
+{
+ int len;
+ char buff[65536];
+ char line[1024];
+ FILE *f;
+
+ f = fopen (name, "r");
+ if (f == NULL)
+ g_error ("Unable to open %s!\n", name);
+
+ len = 0;
+ while (fgets (line, sizeof (line), f) != NULL) {
+ strcpy (buff + len, line);
+ len += strlen (line);
+ }
+
+ fclose (f);
+
+ return g_strdup (buff);
+}
+
+
int
main (int argc, char **argv)
{
@@ -132,6 +157,13 @@ main (int argc, char **argv)
CORBA_exception_init (&ev);
init_bonobo (argc, argv);
+ cardstr = NULL;
+ if (argc == 2)
+ cardstr = read_file (argv [1]);
+
+ if (cardstr == NULL)
+ cardstr = TEST_VCARD;
+
gtk_idle_add ((GtkFunction) ebook_create, NULL);
bonobo_main ();