blob: 2576c87e6b01cc4deb692c99af547818e50cf8db (
plain) (
tree)
|
|
#include <gnome.h>
#include <e-card.h>
#define TEST_VCARD \
"BEGIN:VCARD
" \
"FN:Nat
" \
"N:Friedman;Nat;D;Mr.
" \
"BDAY:1977-08-06
" \
"TEL;WORK:617 679 1984
" \
"TEL;CELL:123 456 7890
" \
"EMAIL;INTERNET:nat@nat.org
" \
"EMAIL;INTERNET:nat@helixcode.com
" \
"END:VCARD
" \
"
"
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)
{
char *cardstr;
ECard *card;
gnome_init ("TestCard", "0.0", argc, argv);
cardstr = NULL;
if (argc == 2)
cardstr = read_file (argv [1]);
if (cardstr == NULL)
cardstr = TEST_VCARD;
card = e_card_new (cardstr);
gtk_object_unref (GTK_OBJECT (card));
return 0;
}
|