aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@helixcode.com>2000-05-07 08:41:35 +0800
committerChris Lahey <clahey@src.gnome.org>2000-05-07 08:41:35 +0800
commit51aa4cb7c216c9518516e0bada53ae97849a2bd0 (patch)
treef39f505d25dd132e0cbf5701a4663145bfac47e4 /addressbook
parent7c90b45149b4a77de70db43a773a92f8977fdf48 (diff)
downloadgsoc2013-evolution-51aa4cb7c216c9518516e0bada53ae97849a2bd0.tar.gz
gsoc2013-evolution-51aa4cb7c216c9518516e0bada53ae97849a2bd0.tar.zst
gsoc2013-evolution-51aa4cb7c216c9518516e0bada53ae97849a2bd0.zip
Made a NULL callback just mean to not call back.
2000-05-07 Christopher James Lahey <clahey@helixcode.com> * backend/ebook/e-book.c: Made a NULL callback just mean to not call back. * backend/ebook/e-card-simple.c, backend/ebook/e-card-simple.h: Reordered fields. Added a get_const function to get a constant string that persists until the simple is destroyed. * gui/component/Makefile.am: Added e-addressbook-model.c and e-addressbook-model.h and all of the libraries and includes that they are dependent on. * gui/component/addressbook-factory.c: Initialize e cursors. * gui/component/addressbook.c: Added inactive code to display an ETable view of the addressbook. svn path=/trunk/; revision=2844
Diffstat (limited to 'addressbook')
-rw-r--r--addressbook/ChangeLog18
-rw-r--r--addressbook/backend/ebook/e-book.c23
-rw-r--r--addressbook/backend/ebook/e-card-simple.c60
-rw-r--r--addressbook/backend/ebook/e-card-simple.h72
-rw-r--r--addressbook/gui/component/Makefile.am4
-rw-r--r--addressbook/gui/component/addressbook-factory.c3
-rw-r--r--addressbook/gui/component/addressbook.c197
7 files changed, 268 insertions, 109 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index 0cc40898fd..da05fe368e 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,3 +1,21 @@
+2000-05-07 Christopher James Lahey <clahey@helixcode.com>
+
+ * backend/ebook/e-book.c: Made a NULL callback just mean to not
+ call back.
+
+ * backend/ebook/e-card-simple.c, backend/ebook/e-card-simple.h:
+ Reordered fields. Added a get_const function to get a constant
+ string that persists until the simple is destroyed.
+
+ * gui/component/Makefile.am: Added e-addressbook-model.c and
+ e-addressbook-model.h and all of the libraries and includes that
+ they are dependent on.
+
+ * gui/component/addressbook-factory.c: Initialize e cursors.
+
+ * gui/component/addressbook.c: Added inactive code to display an
+ ETable view of the addressbook.
+
2000-05-06 Christopher James Lahey <clahey@helixcode.com>
* backend/ebook/e-card-simple.c, backend/ebook/e-card-simple.h:
diff --git a/addressbook/backend/ebook/e-book.c b/addressbook/backend/ebook/e-book.c
index 4acd15cba0..ce1c663073 100644
--- a/addressbook/backend/ebook/e-book.c
+++ b/addressbook/backend/ebook/e-book.c
@@ -118,7 +118,8 @@ e_book_do_response_create_card (EBook *book,
return;
}
- ((EBookIdCallback) op->cb) (book, resp->status, resp->id, op->closure);
+ if (op->cb)
+ ((EBookIdCallback) op->cb) (book, resp->status, resp->id, op->closure);
g_free (resp->id);
g_free (op);
}
@@ -136,7 +137,8 @@ e_book_do_response_generic (EBook *book,
"in local op queue!\n");
}
- ((EBookCallback) op->cb) (book, resp->status, op->closure);
+ if (op->cb)
+ ((EBookCallback) op->cb) (book, resp->status, op->closure);
g_free (op);
}
@@ -159,7 +161,8 @@ e_book_do_response_get_cursor (EBook *book,
cursor = e_card_cursor_new(resp->cursor);
- ((EBookCursorCallback) op->cb) (book, resp->status, cursor, op->closure);
+ if (op->cb)
+ ((EBookCursorCallback) op->cb) (book, resp->status, cursor, op->closure);
/*
* Release the remote Evolution_Book in the PAS.
@@ -206,8 +209,9 @@ e_book_do_response_get_view (EBook *book,
}
book_view = e_book_view_new(resp->book_view, op->listener);
-
- ((EBookBookViewCallback) op->cb) (book, resp->status, book_view, op->closure);
+
+ if (op->cb)
+ ((EBookBookViewCallback) op->cb) (book, resp->status, book_view, op->closure);
/*
* Release the remote Evolution_Book in the PAS.
@@ -257,7 +261,8 @@ e_book_do_response_open (EBook *book,
return;
}
- ((EBookCallback) op->cb) (book, resp->status, op->closure);
+ if (op->cb)
+ ((EBookCallback) op->cb) (book, resp->status, op->closure);
g_free (op);
}
@@ -576,7 +581,6 @@ e_book_remove_card (EBook *book,
g_return_val_if_fail (E_IS_BOOK (book), FALSE);
g_return_val_if_fail (card != NULL, FALSE);
g_return_val_if_fail (E_IS_CARD (card), FALSE);
- g_return_val_if_fail (cb != NULL, FALSE);
if (book->priv->load_state != URILoaded) {
g_warning ("e_book_remove_card: No URI loaded!\n");
@@ -604,7 +608,6 @@ e_book_remove_card_by_id (EBook *book,
g_return_val_if_fail (book != NULL, FALSE);
g_return_val_if_fail (E_IS_BOOK (book), FALSE);
g_return_val_if_fail (id != NULL, FALSE);
- g_return_val_if_fail (cb != NULL, FALSE);
if (book->priv->load_state != URILoaded) {
g_warning ("e_book_remove_card_by_id: No URI loaded!\n");
@@ -649,7 +652,6 @@ e_book_add_card (EBook *book,
g_return_val_if_fail (E_IS_BOOK (book), FALSE);
g_return_val_if_fail (card != NULL, FALSE);
g_return_val_if_fail (E_IS_CARD (card), FALSE);
- g_return_val_if_fail (cb != NULL, FALSE);
if (book->priv->load_state != URILoaded) {
g_warning ("e_book_add_card: No URI loaded!\n");
@@ -684,7 +686,6 @@ e_book_add_vcard (EBook *book,
g_return_val_if_fail (book != NULL, FALSE);
g_return_val_if_fail (E_IS_BOOK (book), FALSE);
g_return_val_if_fail (vcard != NULL, FALSE);
- g_return_val_if_fail (cb != NULL, FALSE);
if (book->priv->load_state != URILoaded) {
g_warning ("e_book_add_vcard: No URI loaded!\n");
@@ -727,7 +728,6 @@ e_book_commit_card (EBook *book,
g_return_val_if_fail (E_IS_BOOK (book), FALSE);
g_return_val_if_fail (card != NULL, FALSE);
g_return_val_if_fail (E_IS_CARD (card), FALSE);
- g_return_val_if_fail (cb != NULL, FALSE);
if (book->priv->load_state != URILoaded) {
g_warning ("e_book_commit_card: No URI loaded!\n");
@@ -763,7 +763,6 @@ e_book_commit_vcard (EBook *book,
g_return_val_if_fail (book != NULL, FALSE);
g_return_val_if_fail (E_IS_BOOK (book), FALSE);
g_return_val_if_fail (vcard != NULL, FALSE);
- g_return_val_if_fail (cb != NULL, FALSE);
if (book->priv->load_state != URILoaded) {
g_warning ("e_book_commit_vcard: No URI loaded!\n");
diff --git a/addressbook/backend/ebook/e-card-simple.c b/addressbook/backend/ebook/e-card-simple.c
index cd3d75f957..f2bcaaabc4 100644
--- a/addressbook/backend/ebook/e-card-simple.c
+++ b/addressbook/backend/ebook/e-card-simple.c
@@ -75,9 +75,26 @@ static ECardSimpleFieldData field_data[] =
{
{ E_CARD_SIMPLE_FIELD_FILE_AS, "file_as", "File As", "", 0, E_CARD_SIMPLE_INTERNAL_TYPE_STRING },
{ E_CARD_SIMPLE_FIELD_FULL_NAME, "full_name", "Name", "Name", 0, E_CARD_SIMPLE_INTERNAL_TYPE_STRING },
- { E_CARD_SIMPLE_FIELD_BIRTH_DATE, "birth_date", "Birth Date", "", 0, E_CARD_SIMPLE_INTERNAL_TYPE_DATE },
- { E_CARD_SIMPLE_FIELD_URL, "url", "Web Site", "Url", 0, E_CARD_SIMPLE_INTERNAL_TYPE_STRING },
+ { E_CARD_SIMPLE_FIELD_EMAIL, "", "Email", "Email", E_CARD_SIMPLE_EMAIL_ID_EMAIL, E_CARD_SIMPLE_INTERNAL_TYPE_EMAIL },
+ { E_CARD_SIMPLE_FIELD_PHONE_PRIMARY, "", "Primary", "Prim", E_CARD_SIMPLE_PHONE_ID_PRIMARY, E_CARD_SIMPLE_INTERNAL_TYPE_PHONE },
+ { E_CARD_SIMPLE_FIELD_PHONE_BUSINESS, "", "Business", "Bus", E_CARD_SIMPLE_PHONE_ID_BUSINESS, E_CARD_SIMPLE_INTERNAL_TYPE_PHONE },
+ { E_CARD_SIMPLE_FIELD_PHONE_HOME, "", "Home", "Home", E_CARD_SIMPLE_PHONE_ID_HOME, E_CARD_SIMPLE_INTERNAL_TYPE_PHONE },
{ E_CARD_SIMPLE_FIELD_ORG, "org", "Organization", "Org", 0, E_CARD_SIMPLE_INTERNAL_TYPE_STRING },
+ { E_CARD_SIMPLE_FIELD_ADDRESS_BUSINESS, "", "Business", "Bus", E_CARD_SIMPLE_ADDRESS_ID_HOME, E_CARD_SIMPLE_INTERNAL_TYPE_ADDRESS },
+ { E_CARD_SIMPLE_FIELD_ADDRESS_HOME, "", "Home", "Home", E_CARD_SIMPLE_ADDRESS_ID_BUSINESS, E_CARD_SIMPLE_INTERNAL_TYPE_ADDRESS },
+ { E_CARD_SIMPLE_FIELD_PHONE_MOBILE, "", "Mobile", "Mobile", E_CARD_SIMPLE_PHONE_ID_MOBILE, E_CARD_SIMPLE_INTERNAL_TYPE_PHONE },
+ { E_CARD_SIMPLE_FIELD_PHONE_CAR, "", "Car", "Car", E_CARD_SIMPLE_PHONE_ID_CAR, E_CARD_SIMPLE_INTERNAL_TYPE_PHONE },
+ { E_CARD_SIMPLE_FIELD_PHONE_BUSINESS_FAX, "", "Business Fax", "Bus Fax", E_CARD_SIMPLE_PHONE_ID_BUSINESS_FAX, E_CARD_SIMPLE_INTERNAL_TYPE_PHONE },
+ { E_CARD_SIMPLE_FIELD_PHONE_HOME_FAX, "", "Home Fax", "Home Fax", E_CARD_SIMPLE_PHONE_ID_HOME_FAX, E_CARD_SIMPLE_INTERNAL_TYPE_PHONE },
+ { E_CARD_SIMPLE_FIELD_PHONE_BUSINESS_2, "", "Business 2", "Bus 2", E_CARD_SIMPLE_PHONE_ID_BUSINESS_2, E_CARD_SIMPLE_INTERNAL_TYPE_PHONE },
+ { E_CARD_SIMPLE_FIELD_PHONE_HOME_2, "", "Home 2", "Home 2", E_CARD_SIMPLE_PHONE_ID_HOME_2, E_CARD_SIMPLE_INTERNAL_TYPE_PHONE },
+ { E_CARD_SIMPLE_FIELD_PHONE_ISDN, "", "ISDN", "ISDN", E_CARD_SIMPLE_PHONE_ID_ISDN, E_CARD_SIMPLE_INTERNAL_TYPE_PHONE },
+ { E_CARD_SIMPLE_FIELD_PHONE_OTHER, "", "Other", "Other", E_CARD_SIMPLE_PHONE_ID_OTHER, E_CARD_SIMPLE_INTERNAL_TYPE_PHONE },
+ { E_CARD_SIMPLE_FIELD_PHONE_PAGER, "", "Pager", "Pager", E_CARD_SIMPLE_PHONE_ID_PAGER, E_CARD_SIMPLE_INTERNAL_TYPE_PHONE },
+ { E_CARD_SIMPLE_FIELD_ADDRESS_OTHER, "", "Other", "Other", E_CARD_SIMPLE_ADDRESS_ID_OTHER, E_CARD_SIMPLE_INTERNAL_TYPE_ADDRESS },
+ { E_CARD_SIMPLE_FIELD_EMAIL_2, "", "Email 2", "Email 2", E_CARD_SIMPLE_EMAIL_ID_EMAIL_2, E_CARD_SIMPLE_INTERNAL_TYPE_EMAIL },
+ { E_CARD_SIMPLE_FIELD_EMAIL_3, "", "Email 3", "Email 3", E_CARD_SIMPLE_EMAIL_ID_EMAIL_3, E_CARD_SIMPLE_INTERNAL_TYPE_EMAIL },
+ { E_CARD_SIMPLE_FIELD_URL, "url", "Web Site", "Url", 0, E_CARD_SIMPLE_INTERNAL_TYPE_STRING },
{ E_CARD_SIMPLE_FIELD_ORG_UNIT, "org_unit", "Department", "Dep", 0, E_CARD_SIMPLE_INTERNAL_TYPE_STRING },
{ E_CARD_SIMPLE_FIELD_OFFICE, "office", "Office", "Off", 0, E_CARD_SIMPLE_INTERNAL_TYPE_STRING },
{ E_CARD_SIMPLE_FIELD_TITLE, "title", "Title", "Title", 0, E_CARD_SIMPLE_INTERNAL_TYPE_STRING },
@@ -86,27 +103,10 @@ static ECardSimpleFieldData field_data[] =
{ E_CARD_SIMPLE_FIELD_ASSISTANT, "assistant", "Assistant", "Ass", 0, E_CARD_SIMPLE_INTERNAL_TYPE_STRING },
{ E_CARD_SIMPLE_FIELD_NICKNAME, "nickname", "Nickname", "Nick", 0, E_CARD_SIMPLE_INTERNAL_TYPE_STRING },
{ E_CARD_SIMPLE_FIELD_SPOUSE, "spouse", "Spouse", "Spouse", 0, E_CARD_SIMPLE_INTERNAL_TYPE_STRING },
- { E_CARD_SIMPLE_FIELD_ANNIVERSARY, "anniversary", "Anniversary", "Anniv", 0, E_CARD_SIMPLE_INTERNAL_TYPE_DATE },
- { E_CARD_SIMPLE_FIELD_FBURL, "fburl", "Free-busy URL", "FBUrl", 0, E_CARD_SIMPLE_INTERNAL_TYPE_STRING },
{ E_CARD_SIMPLE_FIELD_NOTE, "note", "Note", "Note", 0, E_CARD_SIMPLE_INTERNAL_TYPE_STRING },
- { E_CARD_SIMPLE_FIELD_PHONE_BUSINESS, "", "Business", "Bus", E_CARD_SIMPLE_PHONE_ID_BUSINESS, E_CARD_SIMPLE_INTERNAL_TYPE_PHONE },
- { E_CARD_SIMPLE_FIELD_PHONE_BUSINESS_2, "", "Business 2", "Bus 2", E_CARD_SIMPLE_PHONE_ID_BUSINESS_2, E_CARD_SIMPLE_INTERNAL_TYPE_PHONE },
- { E_CARD_SIMPLE_FIELD_PHONE_BUSINESS_FAX, "", "Business Fax", "Bus Fax", E_CARD_SIMPLE_PHONE_ID_BUSINESS_FAX, E_CARD_SIMPLE_INTERNAL_TYPE_PHONE },
- { E_CARD_SIMPLE_FIELD_PHONE_CAR, "", "Car", "Car", E_CARD_SIMPLE_PHONE_ID_CAR, E_CARD_SIMPLE_INTERNAL_TYPE_PHONE },
- { E_CARD_SIMPLE_FIELD_PHONE_HOME, "", "Home", "Home", E_CARD_SIMPLE_PHONE_ID_HOME, E_CARD_SIMPLE_INTERNAL_TYPE_PHONE },
- { E_CARD_SIMPLE_FIELD_PHONE_HOME_2, "", "Home 2", "Home 2", E_CARD_SIMPLE_PHONE_ID_HOME_2, E_CARD_SIMPLE_INTERNAL_TYPE_PHONE },
- { E_CARD_SIMPLE_FIELD_PHONE_HOME_FAX, "", "Home Fax", "Home Fax", E_CARD_SIMPLE_PHONE_ID_HOME_FAX, E_CARD_SIMPLE_INTERNAL_TYPE_PHONE },
- { E_CARD_SIMPLE_FIELD_PHONE_ISDN, "", "ISDN", "ISDN", E_CARD_SIMPLE_PHONE_ID_ISDN, E_CARD_SIMPLE_INTERNAL_TYPE_PHONE },
- { E_CARD_SIMPLE_FIELD_PHONE_MOBILE, "", "Mobile", "Mobile", E_CARD_SIMPLE_PHONE_ID_MOBILE, E_CARD_SIMPLE_INTERNAL_TYPE_PHONE },
- { E_CARD_SIMPLE_FIELD_PHONE_OTHER, "", "Other", "Other", E_CARD_SIMPLE_PHONE_ID_OTHER, E_CARD_SIMPLE_INTERNAL_TYPE_PHONE },
- { E_CARD_SIMPLE_FIELD_PHONE_PAGER, "", "Pager", "Pager", E_CARD_SIMPLE_PHONE_ID_PAGER, E_CARD_SIMPLE_INTERNAL_TYPE_PHONE },
- { E_CARD_SIMPLE_FIELD_PHONE_PRIMARY, "", "Primary", "Prim", E_CARD_SIMPLE_PHONE_ID_PRIMARY, E_CARD_SIMPLE_INTERNAL_TYPE_PHONE },
- { E_CARD_SIMPLE_FIELD_ADDRESS_HOME, "", "Home", "Home", E_CARD_SIMPLE_ADDRESS_ID_BUSINESS, E_CARD_SIMPLE_INTERNAL_TYPE_ADDRESS },
- { E_CARD_SIMPLE_FIELD_ADDRESS_BUSINESS, "", "Business", "Bus", E_CARD_SIMPLE_ADDRESS_ID_HOME, E_CARD_SIMPLE_INTERNAL_TYPE_ADDRESS },
- { E_CARD_SIMPLE_FIELD_ADDRESS_OTHER, "", "Other", "Other", E_CARD_SIMPLE_ADDRESS_ID_OTHER, E_CARD_SIMPLE_INTERNAL_TYPE_ADDRESS },
- { E_CARD_SIMPLE_FIELD_EMAIL, "", "Email", "Email", E_CARD_SIMPLE_EMAIL_ID_EMAIL, E_CARD_SIMPLE_INTERNAL_TYPE_EMAIL },
- { E_CARD_SIMPLE_FIELD_EMAIL_2, "", "Email 2", "Email 2", E_CARD_SIMPLE_EMAIL_ID_EMAIL_2, E_CARD_SIMPLE_INTERNAL_TYPE_EMAIL },
- { E_CARD_SIMPLE_FIELD_EMAIL_3, "", "Email 3", "Email 3", E_CARD_SIMPLE_EMAIL_ID_EMAIL_3, E_CARD_SIMPLE_INTERNAL_TYPE_EMAIL },
+ { E_CARD_SIMPLE_FIELD_FBURL, "fburl", "Free-busy URL", "FBUrl", 0, E_CARD_SIMPLE_INTERNAL_TYPE_STRING },
+ { E_CARD_SIMPLE_FIELD_ANNIVERSARY, "anniversary", "Anniversary", "Anniv", 0, E_CARD_SIMPLE_INTERNAL_TYPE_DATE },
+ { E_CARD_SIMPLE_FIELD_BIRTH_DATE, "birth_date", "Birth Date", "", 0, E_CARD_SIMPLE_INTERNAL_TYPE_DATE },
};
static void e_card_simple_init (ECardSimple *simple);
@@ -373,6 +373,9 @@ e_card_simple_destroy (GtkObject *object)
if (simple->card)
gtk_object_unref(GTK_OBJECT(simple->card));
+ g_list_foreach(simple->temp_fields, (GFunc) g_free, NULL);
+ g_list_free(simple->temp_fields);
+ simple->temp_fields = NULL;
}
@@ -388,6 +391,9 @@ e_card_simple_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
case ARG_CARD:
if (simple->card)
gtk_object_unref(GTK_OBJECT(simple->card));
+ g_list_foreach(simple->temp_fields, (GFunc) g_free, NULL);
+ g_list_free(simple->temp_fields);
+ simple->temp_fields = NULL;
if (GTK_VALUE_OBJECT(*arg))
simple->card = E_CARD(GTK_VALUE_OBJECT(*arg));
else
@@ -614,6 +620,7 @@ e_card_simple_init (ECardSimple *simple)
simple->email[i] = NULL;
for(i = 0; i < E_CARD_SIMPLE_ADDRESS_ID_LAST; i++)
simple->address[i] = NULL;
+ simple->temp_fields = NULL;
}
static void
@@ -829,6 +836,15 @@ void e_card_simple_set_address (ECardSimple *simple,
simple->address[id] = e_card_address_label_copy(address);
}
+const char *e_card_simple_get_const (ECardSimple *simple,
+ ECardSimpleField field)
+{
+ char *ret_val = e_card_simple_get(simple, field);
+ if (ret_val)
+ simple->temp_fields = g_list_prepend(simple->temp_fields, ret_val);
+ return ret_val;
+}
+
char *e_card_simple_get (ECardSimple *simple,
ECardSimpleField field)
{
diff --git a/addressbook/backend/ebook/e-card-simple.h b/addressbook/backend/ebook/e-card-simple.h
index f0bb6cb541..1949518286 100644
--- a/addressbook/backend/ebook/e-card-simple.h
+++ b/addressbook/backend/ebook/e-card-simple.h
@@ -77,40 +77,40 @@ enum _ECardSimpleType {
enum _ECardSimpleField {
E_CARD_SIMPLE_FIELD_FILE_AS,
- E_CARD_SIMPLE_FIELD_FULL_NAME,
- E_CARD_SIMPLE_FIELD_BIRTH_DATE,
- E_CARD_SIMPLE_FIELD_URL,
- E_CARD_SIMPLE_FIELD_ORG,
- E_CARD_SIMPLE_FIELD_ORG_UNIT,
- E_CARD_SIMPLE_FIELD_OFFICE,
- E_CARD_SIMPLE_FIELD_TITLE,
- E_CARD_SIMPLE_FIELD_ROLE,
- E_CARD_SIMPLE_FIELD_MANAGER,
- E_CARD_SIMPLE_FIELD_ASSISTANT,
- E_CARD_SIMPLE_FIELD_NICKNAME,
- E_CARD_SIMPLE_FIELD_SPOUSE,
- E_CARD_SIMPLE_FIELD_ANNIVERSARY,
- E_CARD_SIMPLE_FIELD_FBURL,
- E_CARD_SIMPLE_FIELD_NOTE,
- E_CARD_SIMPLE_FIELD_PHONE_BUSINESS,
- E_CARD_SIMPLE_FIELD_PHONE_BUSINESS_2,
- E_CARD_SIMPLE_FIELD_PHONE_BUSINESS_FAX,
- E_CARD_SIMPLE_FIELD_PHONE_CAR,
- E_CARD_SIMPLE_FIELD_PHONE_HOME,
- E_CARD_SIMPLE_FIELD_PHONE_HOME_2,
- E_CARD_SIMPLE_FIELD_PHONE_HOME_FAX,
- E_CARD_SIMPLE_FIELD_PHONE_ISDN,
- E_CARD_SIMPLE_FIELD_PHONE_MOBILE,
- E_CARD_SIMPLE_FIELD_PHONE_OTHER,
- E_CARD_SIMPLE_FIELD_PHONE_PAGER,
- E_CARD_SIMPLE_FIELD_PHONE_PRIMARY,
- E_CARD_SIMPLE_FIELD_ADDRESS_HOME,
- E_CARD_SIMPLE_FIELD_ADDRESS_BUSINESS,
- E_CARD_SIMPLE_FIELD_ADDRESS_OTHER,
- E_CARD_SIMPLE_FIELD_EMAIL,
- E_CARD_SIMPLE_FIELD_EMAIL_2,
- E_CARD_SIMPLE_FIELD_EMAIL_3,
- E_CARD_SIMPLE_FIELD_LAST
+ E_CARD_SIMPLE_FIELD_FULL_NAME,
+ E_CARD_SIMPLE_FIELD_EMAIL,
+ E_CARD_SIMPLE_FIELD_PHONE_PRIMARY,
+ E_CARD_SIMPLE_FIELD_PHONE_BUSINESS,
+ E_CARD_SIMPLE_FIELD_PHONE_HOME,
+ E_CARD_SIMPLE_FIELD_ORG,
+ E_CARD_SIMPLE_FIELD_ADDRESS_BUSINESS,
+ E_CARD_SIMPLE_FIELD_ADDRESS_HOME,
+ E_CARD_SIMPLE_FIELD_PHONE_MOBILE,
+ E_CARD_SIMPLE_FIELD_PHONE_CAR,
+ E_CARD_SIMPLE_FIELD_PHONE_BUSINESS_FAX,
+ E_CARD_SIMPLE_FIELD_PHONE_HOME_FAX,
+ E_CARD_SIMPLE_FIELD_PHONE_BUSINESS_2,
+ E_CARD_SIMPLE_FIELD_PHONE_HOME_2,
+ E_CARD_SIMPLE_FIELD_PHONE_ISDN,
+ E_CARD_SIMPLE_FIELD_PHONE_OTHER,
+ E_CARD_SIMPLE_FIELD_PHONE_PAGER,
+ E_CARD_SIMPLE_FIELD_ADDRESS_OTHER,
+ E_CARD_SIMPLE_FIELD_EMAIL_2,
+ E_CARD_SIMPLE_FIELD_EMAIL_3,
+ E_CARD_SIMPLE_FIELD_URL,
+ E_CARD_SIMPLE_FIELD_ORG_UNIT,
+ E_CARD_SIMPLE_FIELD_OFFICE,
+ E_CARD_SIMPLE_FIELD_TITLE,
+ E_CARD_SIMPLE_FIELD_ROLE,
+ E_CARD_SIMPLE_FIELD_MANAGER,
+ E_CARD_SIMPLE_FIELD_ASSISTANT,
+ E_CARD_SIMPLE_FIELD_NICKNAME,
+ E_CARD_SIMPLE_FIELD_SPOUSE,
+ E_CARD_SIMPLE_FIELD_NOTE,
+ E_CARD_SIMPLE_FIELD_FBURL,
+ E_CARD_SIMPLE_FIELD_ANNIVERSARY,
+ E_CARD_SIMPLE_FIELD_BIRTH_DATE,
+ E_CARD_SIMPLE_FIELD_LAST
};
typedef struct _ECardSimple ECardSimple;
@@ -120,6 +120,8 @@ struct _ECardSimple {
GtkObject object;
ECard *card;
+ GList *temp_fields;
+
ECardPhone *phone[E_CARD_SIMPLE_PHONE_ID_LAST];
char *email[E_CARD_SIMPLE_EMAIL_ID_LAST];
ECardAddrLabel *address[E_CARD_SIMPLE_ADDRESS_ID_LAST];
@@ -139,6 +141,8 @@ ECardSimple *e_card_simple_duplicate (ECardSimple *simple);
char *e_card_simple_get (ECardSimple *simple,
ECardSimpleField field);
+const char *e_card_simple_get_const (ECardSimple *simple,
+ ECardSimpleField field);
void e_card_simple_set (ECardSimple *simple,
ECardSimpleField field,
const char *data);
diff --git a/addressbook/gui/component/Makefile.am b/addressbook/gui/component/Makefile.am
index 931394f6b1..5a42c7e002 100644
--- a/addressbook/gui/component/Makefile.am
+++ b/addressbook/gui/component/Makefile.am
@@ -7,6 +7,7 @@ INCLUDES = \
$(GNOME_INCLUDEDIR) \
-I$(top_srcdir) \
-I$(top_srcdir)/widgets/e-text \
+ -I$(top_srcdir)/widgets/e-table \
-I$(top_srcdir)/addressbook/gui/minicard \
-I$(top_srcdir)/addressbook/contact-editor \
-I$(top_srcdir)/addressbook/backend \
@@ -23,6 +24,8 @@ bin_PROGRAMS = \
evolution_addressbook_SOURCES = \
e-ldap-server-dialog.c \
+ e-addressbook-model.c \
+ e-addressbook-model.h \
addressbook-factory.c \
addressbook.c \
addressbook.h
@@ -32,6 +35,7 @@ evolution_addressbook_LDADD = \
$(BONOBO_HTML_GNOME_LIBS) \
$(top_builddir)/addressbook/gui/minicard/libeminicard.a \
$(top_builddir)/widgets/e-text/libetext.a \
+ $(top_builddir)/widgets/e-table/libetable.a \
$(top_builddir)/e-util/libeutil.la \
$(top_builddir)/addressbook/backend/ebook/libebook.la \
$(top_builddir)/addressbook/ename/libename.la \
diff --git a/addressbook/gui/component/addressbook-factory.c b/addressbook/gui/component/addressbook-factory.c
index aa6214786c..4761f9aa7a 100644
--- a/addressbook/gui/component/addressbook-factory.c
+++ b/addressbook/gui/component/addressbook-factory.c
@@ -12,6 +12,7 @@
#include <gnome.h>
#include <bonobo.h>
#include <glade/glade.h>
+#include <e-util/e-cursors.h>
#include "addressbook.h"
@@ -66,6 +67,8 @@ main (int argc, char **argv)
addressbook_factory_init ();
+ e_cursors_init();
+
bonobo_main ();
return 0;
diff --git a/addressbook/gui/component/addressbook.c b/addressbook/gui/component/addressbook.c
index f86a58a005..89753b5e2a 100644
--- a/addressbook/gui/component/addressbook.c
+++ b/addressbook/gui/component/addressbook.c
@@ -20,6 +20,11 @@
#include <e-util/e-canvas.h>
#include <e-util/e-util.h>
#include "e-minicard-view.h"
+
+#include <e-table.h>
+#include <e-cell-text.h>
+
+#include <e-addressbook-model.h>
#include "e-contact-editor.h"
#include "e-ldap-server-dialog.h"
@@ -33,6 +38,17 @@
#define PROPERTY_FOLDER_URI_IDX 1
+typedef struct {
+ GtkWidget *canvas;
+ GnomeCanvasItem *view;
+ GnomeCanvasItem *rect;
+ GtkWidget *table;
+ ETableModel *model;
+ GtkAllocation last_alloc;
+ BonoboPropertyBag *properties;
+ char *uri;
+} AddressbookView;
+
static void
control_deactivate (BonoboControl *control, BonoboUIHandler *uih)
{
@@ -64,12 +80,17 @@ new_contact_cb (BonoboUIHandler *uih, void *user_data, const char *path)
gint result;
GtkWidget* contact_editor =
e_contact_editor_new(e_card_new(""));
- EMinicardView *minicard_view = E_MINICARD_VIEW (user_data);
EBook *book;
-
+ AddressbookView *view = (AddressbookView *) user_data;
+ GtkObject *object;
GtkWidget* dlg = gnome_dialog_new ("Contact Editor", "Save", "Cancel", NULL);
- gtk_object_get(GTK_OBJECT(minicard_view), "book", &book, NULL);
+ if (view->view)
+ object = GTK_OBJECT(view->view);
+ else
+ object = GTK_OBJECT(view->model);
+ gtk_object_get(object, "book", &book, NULL);
+
g_assert (E_IS_BOOK (book));
@@ -110,10 +131,11 @@ null_cb (EBook *book, EBookStatus status, gpointer closure)
static void
new_server_cb (BonoboUIHandler *uih, void *user_data, const char *path)
{
- EMinicardView *minicard_view = E_MINICARD_VIEW (user_data);
ELDAPServer server;
char *uri;
EBook *book;
+ AddressbookView *view = (AddressbookView *) user_data;
+ GtkObject *object;
/* fill in the defaults */
server.host = g_strdup("");
@@ -123,7 +145,11 @@ new_server_cb (BonoboUIHandler *uih, void *user_data, const char *path)
e_ldap_server_editor_show (&server);
- gtk_object_get(GTK_OBJECT(minicard_view), "book", &book, NULL);
+ if (view->view)
+ object = GTK_OBJECT(view->view);
+ else
+ object = GTK_OBJECT(view->model);
+ gtk_object_get(object, "book", &book, NULL);
g_assert (E_IS_BOOK (book));
/* XXX write out the new server info */
@@ -144,12 +170,17 @@ find_contact_cb (BonoboUIHandler *uih, void *user_data, const char *path)
{
gint result;
GtkWidget* search_entry = gtk_entry_new();
- EMinicardView *minicard_view = E_MINICARD_VIEW (user_data);
gchar* search_text;
-
+ AddressbookView *view = (AddressbookView *) user_data;
+ GtkObject *object;
GtkWidget* dlg = gnome_dialog_new ("Search Contacts", "Find", "Cancel", NULL);
- gtk_object_get (GTK_OBJECT(minicard_view), "query", &search_text, NULL);
+ if (view->view)
+ object = GTK_OBJECT(view->view);
+ else
+ object = GTK_OBJECT(view->model);
+
+ gtk_object_get (object, "query", &search_text, NULL);
gtk_entry_set_text(GTK_ENTRY(search_entry), search_text);
g_free (search_text);
@@ -164,7 +195,7 @@ find_contact_cb (BonoboUIHandler *uih, void *user_data, const char *path)
/* If the user clicks "okay"...*/
if (result == 0) {
search_text = gtk_entry_get_text(GTK_ENTRY(search_entry));
- gtk_object_set (GTK_OBJECT(minicard_view), "query", search_text, NULL);
+ gtk_object_set (object, "query", search_text, NULL);
}
}
@@ -178,9 +209,9 @@ card_deleted_cb (EBook* book, EBookStatus status, gpointer user_data)
static void
delete_contact_cb (BonoboUIHandler *uih, void *user_data, const char *path)
{
- EMinicardView *minicard_view = E_MINICARD_VIEW (user_data);
-
- e_minicard_view_remove_selection (minicard_view, card_deleted_cb, NULL);
+ AddressbookView *view = (AddressbookView *) user_data;
+ if (view->view)
+ e_minicard_view_remove_selection (E_MINICARD_VIEW(view->view), card_deleted_cb, NULL);
}
static GnomeUIInfo gnome_toolbar [] = {
@@ -196,10 +227,17 @@ static GnomeUIInfo gnome_toolbar [] = {
};
static void
-search_entry_activated (GtkWidget* widget, EMinicardView* minicard_view)
+search_entry_activated (GtkWidget* widget, gpointer user_data)
{
char* search_word = gtk_entry_get_text(GTK_ENTRY(widget));
char* search_query;
+ AddressbookView *view = (AddressbookView *) user_data;
+ GtkObject *object;
+
+ if (view->view)
+ object = GTK_OBJECT(view->view);
+ else
+ object = GTK_OBJECT(view->model);
if (search_word && strlen (search_word))
search_query = g_strdup_printf (
@@ -209,8 +247,9 @@ search_entry_activated (GtkWidget* widget, EMinicardView* minicard_view)
search_query = g_strdup (
"(contains \"full_name\" \"\")");
- gtk_object_set (GTK_OBJECT(minicard_view), "query",
- search_query, NULL);
+ gtk_object_set (object,
+ "query", search_query,
+ NULL);
g_free (search_query);
}
@@ -240,7 +279,7 @@ make_quick_search_widget (GtkSignalFunc start_search_func,
static void
control_activate (BonoboControl *control, BonoboUIHandler *uih,
- EMinicardView *minicard_view)
+ AddressbookView *view)
{
Bonobo_UIHandler remote_uih;
GtkWidget *toolbar;
@@ -256,7 +295,7 @@ control_activate (BonoboControl *control, BonoboUIHandler *uih,
NULL, -1,
BONOBO_UI_HANDLER_PIXMAP_NONE, NULL,
0, 0, new_contact_cb,
- (gpointer)minicard_view);
+ (gpointer)view);
#ifdef HAVE_LDAP
bonobo_ui_handler_menu_new_item (uih, "/Actions/New Directory Server",
@@ -264,7 +303,7 @@ control_activate (BonoboControl *control, BonoboUIHandler *uih,
NULL, -1,
BONOBO_UI_HANDLER_PIXMAP_NONE, NULL,
0, 0, new_server_cb,
- (gpointer)minicard_view);
+ (gpointer)view);
#endif
toolbar = gtk_toolbar_new (GTK_ORIENTATION_HORIZONTAL,
@@ -272,14 +311,14 @@ control_activate (BonoboControl *control, BonoboUIHandler *uih,
gnome_app_fill_toolbar_with_data (GTK_TOOLBAR (toolbar),
gnome_toolbar,
- NULL, minicard_view);
+ NULL, view);
gtk_box_pack_start (GTK_BOX (hbox), toolbar, FALSE, TRUE, 0);
/* add the search_vbox to the hbox which will be our toolbar */
quick_search_widget = make_quick_search_widget (
- search_entry_activated, minicard_view);
+ search_entry_activated, view);
gtk_box_pack_start (GTK_BOX (hbox),
quick_search_widget,
@@ -300,7 +339,7 @@ control_activate (BonoboControl *control, BonoboUIHandler *uih,
static void
control_activate_cb (BonoboControl *control,
gboolean activate,
- EMinicardView* minicard_view)
+ AddressbookView *view)
{
BonoboUIHandler *uih;
@@ -308,20 +347,11 @@ control_activate_cb (BonoboControl *control,
g_assert (uih);
if (activate)
- control_activate (control, uih, minicard_view);
+ control_activate (control, uih, view);
else
control_deactivate (control, uih);
}
-typedef struct {
- GtkWidget *canvas;
- GnomeCanvasItem *view;
- GnomeCanvasItem *rect;
- GtkAllocation last_alloc;
- BonoboPropertyBag *properties;
- char *uri;
-} AddressbookView;
-
static void
addressbook_view_free(AddressbookView *view)
{
@@ -336,9 +366,9 @@ book_open_cb (EBook *book, EBookStatus status, gpointer closure)
{
AddressbookView *view = closure;
if (status == E_BOOK_STATUS_SUCCESS)
- gnome_canvas_item_set(view->view,
- "book", book,
- NULL);
+ gtk_object_set(view->view ? GTK_OBJECT(view->view) : GTK_OBJECT(view->model),
+ "book", book,
+ NULL);
}
static EBook *
@@ -480,21 +510,46 @@ set_prop (BonoboPropertyBag *bag,
}
}
+#define SPEC "<?xml version=\"1.0\"?> \
+<ETableSpecification> \
+ <columns-shown> \
+ <column>0</column> \
+ <column>1</column> \
+ <column>2</column> \
+ <column>3</column> \
+ <column>4</column> \
+ <column>5</column> \
+ <column>6</column> \
+ <column>7</column> \
+ <column>8</column> \
+ <column>9</column> \
+ <column>10</column> \
+ <column>11</column> \
+ <column>12</column> \
+ <column>13</column> \
+ </columns-shown> \
+ <grouping> \
+ <leaf column=\"2\" ascending=\"1\"/> \
+ </grouping> \
+</ETableSpecification>"
+
+
static BonoboObject *
addressbook_factory (BonoboGenericFactory *Factory, void *closure)
{
BonoboControl *control;
EBook *book;
- GtkWidget *vbox, *scrollbar;
AddressbookView *view;
+#if 1
+ GtkWidget *vbox, *scrollbar;
+
gtk_widget_push_visual (gdk_rgb_get_visual ());
gtk_widget_push_colormap (gdk_rgb_get_cmap ());
view = g_new (AddressbookView, 1);
vbox = gtk_vbox_new(FALSE, 0);
-
view->canvas = e_canvas_new();
view->rect = gnome_canvas_item_new(
gnome_canvas_root( GNOME_CANVAS( view->canvas ) ),
@@ -520,6 +575,8 @@ addressbook_factory (BonoboGenericFactory *Factory, void *closure)
gnome_canvas_set_scroll_region ( GNOME_CANVAS( view->canvas ),
0, 0,
100, 100 );
+ view->table = NULL;
+ view->model = NULL;
gtk_box_pack_start(GTK_BOX(vbox), view->canvas, TRUE, TRUE, 0);
@@ -536,17 +593,73 @@ addressbook_factory (BonoboGenericFactory *Factory, void *closure)
gtk_signal_connect( GTK_OBJECT( view->canvas ), "size_allocate",
GTK_SIGNAL_FUNC( allocate_callback ),
( gpointer ) view );
-
gtk_widget_show_all( vbox );
+
+ /* Create the control. */
+ control = bonobo_control_new(vbox);
+
#if 0
gdk_window_set_back_pixmap(
GTK_LAYOUT(view->canvas)->bin_window, NULL, FALSE);
#endif
- book = ebook_create(view);
+#else
+ ECell *cell_left_just;
+ ETableHeader *e_table_header;
+ int i;
+ ECardSimple *simple = e_card_simple_new(NULL);
- /* Create the control. */
- control = bonobo_control_new(vbox);
+ view = g_new (AddressbookView, 1);
+
+ view->view = NULL;
+ view->model = e_addressbook_model_new();
+
+ /*
+ Next we create a header. The ETableHeader is used in two
+ different way. The first is the full_header. This is the
+ list of possible columns in the view. The second use is
+ completely internal. Many of the ETableHeader functions are
+ for that purpose. The only functions we really need are
+ e_table_header_new and e_table_header_add_col.
+
+ First we create the header. */
+ e_table_header = e_table_header_new ();
+
+ /* Next we have to build renderers for all of the columns.
+ Since all our columns are text columns, we can simply use
+ the same renderer over and over again. If we had different
+ types of columns, we could use a different renderer for
+ each column. */
+ cell_left_just = e_cell_text_new (view->model, NULL, GTK_JUSTIFY_LEFT);
+
+ /* Next we create a column object for each view column and add
+ them to the header. We don't create a column object for
+ the importance column since it will not be shown. */
+ for (i = 0; i < E_CARD_SIMPLE_FIELD_LAST - 1; i++){
+ /* Create the column. */
+ ETableCol *ecol = e_table_col_new (
+ i, e_card_simple_get_name(simple, i+1),
+ 80, 20, cell_left_just,
+ g_str_compare, TRUE);
+ /* Add it to the header. */
+ e_table_header_add_column (e_table_header, ecol, i);
+ }
+
+ /* Here we create the table. We give it the three pieces of
+ the table we've created, the header, the model, and the
+ initial layout. It does the rest. */
+ view->table = e_table_new (e_table_header, E_TABLE_MODEL(view->model), SPEC);
+
+ gtk_signal_connect( GTK_OBJECT( view->table ), "destroy",
+ GTK_SIGNAL_FUNC( destroy_callback ),
+ ( gpointer ) view );
+
+ gtk_widget_show_all( GTK_WIDGET(view->table) );
+
+ control = bonobo_control_new(view->table);
+#endif
+
+ book = ebook_create(view);
view->properties = bonobo_property_bag_new (get_prop, set_prop, view);
@@ -560,10 +673,12 @@ addressbook_factory (BonoboGenericFactory *Factory, void *closure)
view->uri = NULL;
gtk_signal_connect (GTK_OBJECT (control), "activate",
- control_activate_cb, view->view);
+ control_activate_cb, view);
+#if 0
gtk_widget_pop_visual ();
gtk_widget_pop_colormap ();
+#endif
return BONOBO_OBJECT (control);
}