From 69e9359204f78d5145867f841caed0a6dc642478 Mon Sep 17 00:00:00 2001 From: Chris Toshok Date: Thu, 31 May 2001 22:27:56 +0000 Subject: add the EAddressbookModel* and change the ETableModel's name to "adapter". 2001-05-31 Chris Toshok * gui/component/select-names/e-select-names.h (struct _ESelectNames): add the EAddressbookModel* and change the ETableModel's name to "adapter". * gui/component/select-names/e-select-names.c (set_book), (addressbook_model_set_uri): these two things take an EAddressbookModel* instead of an ETableModel now. (e_addressbook_create_ebook_table): don't case the EAddressbookModel* to ETableModel*, create an EAddressbookTableAdapter on the EAddressbookModel instead. (e_select_names_init): set e_select_names->adapter. svn path=/trunk/; revision=10072 --- .../gui/component/select-names/e-select-names.c | 27 ++++++++++++++-------- .../gui/component/select-names/e-select-names.h | 5 +++- 2 files changed, 21 insertions(+), 11 deletions(-) (limited to 'addressbook/gui') diff --git a/addressbook/gui/component/select-names/e-select-names.c b/addressbook/gui/component/select-names/e-select-names.c index cfb88109f2..84ef76f9e0 100644 --- a/addressbook/gui/component/select-names/e-select-names.c +++ b/addressbook/gui/component/select-names/e-select-names.c @@ -29,6 +29,7 @@ #include #include +#include #include #include #include @@ -117,7 +118,7 @@ e_select_names_class_init (ESelectNamesClass *klass) GtkWidget *e_addressbook_create_ebook_table(char *name, char *string1, char *string2, int num1, int num2); static void -set_book(EBook *book, EBookStatus status, ETableModel *model) +set_book(EBook *book, EBookStatus status, EAddressbookModel *model) { gtk_object_set(GTK_OBJECT(model), "book", book, @@ -126,7 +127,7 @@ set_book(EBook *book, EBookStatus status, ETableModel *model) } static void -addressbook_model_set_uri(ETableModel *model, char *uri) +addressbook_model_set_uri(EAddressbookModel *model, char *uri) { EBook *book; book = e_book_new(); @@ -173,18 +174,15 @@ add_address(ETable *table, int row, int col, GdkEvent *event, ESelectNames *name GtkWidget * e_addressbook_create_ebook_table(char *name, char *string1, char *string2, int num1, int num2) { - ETableModel *model; + ETableModel *adapter; + EAddressbookModel *model; GtkWidget *table; char *filename; char *uri; char *spec; - model = E_TABLE_MODEL (e_addressbook_model_new()); - gtk_object_set(GTK_OBJECT(model), - "editable", FALSE, - "query", "(contains \"email\" \"\")", - NULL); - + model = e_addressbook_model_new (); + adapter = E_TABLE_MODEL (e_addressbook_table_adapter_new(model)); filename = gnome_util_prepend_user_home("evolution/local/Contacts/addressbook.db"); uri = g_strdup_printf("file://%s", filename); @@ -193,11 +191,19 @@ e_addressbook_create_ebook_table(char *name, char *string1, char *string2, int n g_free(uri); g_free(filename); + + gtk_object_set(GTK_OBJECT(model), + "editable", FALSE, + "query", "(contains \"email\" \"\")", + NULL); + spec = g_strdup_printf(SPEC, E_CARD_SIMPLE_FIELD_NAME_OR_ORG); - table = e_table_scrolled_new (model, NULL, spec, NULL); + table = e_table_scrolled_new (adapter, NULL, spec, NULL); g_free(spec); + gtk_object_set_data(GTK_OBJECT(table), "adapter", adapter); gtk_object_set_data(GTK_OBJECT(table), "model", model); + return table; } @@ -407,6 +413,7 @@ e_select_names_init (ESelectNames *e_select_names) e_select_names->table = E_TABLE_SCROLLED(glade_xml_get_widget(gui, "table-source")); e_select_names->model = gtk_object_get_data(GTK_OBJECT(e_select_names->table), "model"); + e_select_names->adapter = gtk_object_get_data(GTK_OBJECT(e_select_names->table), "adapter"); e_select_names->currently_selected = -1; diff --git a/addressbook/gui/component/select-names/e-select-names.h b/addressbook/gui/component/select-names/e-select-names.h index d059de453d..4f2cf7c8a4 100644 --- a/addressbook/gui/component/select-names/e-select-names.h +++ b/addressbook/gui/component/select-names/e-select-names.h @@ -30,6 +30,8 @@ #include #include +#include + #include "e-select-names-model.h" #include "e-util/e-list.h" #include "shell/evolution-storage-listener.h" @@ -66,7 +68,8 @@ struct _ESelectNames GHashTable *children; /* Of type char * to ESelectNamesChild */ int child_count; ETableScrolled *table; - ETableModel *model; + ETableModel *adapter; + EAddressbookModel *model; int currently_selected; EvolutionStorageListener *listener; GHashTable *folders; -- cgit