aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui
diff options
context:
space:
mode:
authorChris Toshok <toshok@ximian.com>2001-06-01 06:27:56 +0800
committerChris Toshok <toshok@src.gnome.org>2001-06-01 06:27:56 +0800
commit69e9359204f78d5145867f841caed0a6dc642478 (patch)
tree7aae384153d29acb13a63947c1620b74d1eea84a /addressbook/gui
parent6b6d9e32a4848b5fcb54ad83b681a828e6ed2a01 (diff)
downloadgsoc2013-evolution-69e9359204f78d5145867f841caed0a6dc642478.tar.gz
gsoc2013-evolution-69e9359204f78d5145867f841caed0a6dc642478.tar.zst
gsoc2013-evolution-69e9359204f78d5145867f841caed0a6dc642478.zip
add the EAddressbookModel* and change the ETableModel's name to "adapter".
2001-05-31 Chris Toshok <toshok@ximian.com> * 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
Diffstat (limited to 'addressbook/gui')
-rw-r--r--addressbook/gui/component/select-names/e-select-names.c27
-rw-r--r--addressbook/gui/component/select-names/e-select-names.h5
2 files changed, 21 insertions, 11 deletions
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 <gal/widgets/e-font.h>
#include <addressbook/gui/widgets/e-addressbook-model.h>
+#include <addressbook/gui/widgets/e-addressbook-table-adapter.h>
#include <addressbook/gui/component/e-cardlist-model.h>
#include <addressbook/backend/ebook/e-book.h>
#include <addressbook/gui/component/addressbook-component.h>
@@ -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 <gal/e-table/e-table.h>
#include <gal/e-table/e-table-scrolled.h>
+#include <addressbook/gui/widgets/e-addressbook-model.h>
+
#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;