diff options
author | Ettore Perazzoli <ettore@src.gnome.org> | 2003-10-22 02:49:34 +0800 |
---|---|---|
committer | Ettore Perazzoli <ettore@src.gnome.org> | 2003-10-22 02:49:34 +0800 |
commit | 653cfffc0e00dfb59b36813c1b45c53d3f773c65 (patch) | |
tree | 9b486d5e383ec1391d60973d9cc548be0ef6d9d5 /addressbook/gui/widgets/e-addressbook-model.c | |
parent | 0fb08f3ff81575a4749d851404233f34252dd2f2 (diff) | |
download | gsoc2013-evolution-653cfffc0e00dfb59b36813c1b45c53d3f773c65.tar.gz gsoc2013-evolution-653cfffc0e00dfb59b36813c1b45c53d3f773c65.tar.zst gsoc2013-evolution-653cfffc0e00dfb59b36813c1b45c53d3f773c65.zip |
Merge new-ui-branch to the trunk.
svn path=/trunk/; revision=22965
Diffstat (limited to 'addressbook/gui/widgets/e-addressbook-model.c')
-rw-r--r-- | addressbook/gui/widgets/e-addressbook-model.c | 382 |
1 files changed, 185 insertions, 197 deletions
diff --git a/addressbook/gui/widgets/e-addressbook-model.c b/addressbook/gui/widgets/e-addressbook-model.c index 10af915ecf..e8a1e76a38 100644 --- a/addressbook/gui/widgets/e-addressbook-model.c +++ b/addressbook/gui/widgets/e-addressbook-model.c @@ -8,25 +8,24 @@ */ #include <config.h> -#include "e-addressbook-marshal.h" +#include "eab-marshal.h" #include "e-addressbook-model.h" #include <libxml/tree.h> #include <libxml/parser.h> #include <libxml/xmlmemory.h> #include <gnome.h> #include <gal/widgets/e-gui-utils.h> -#include "e-addressbook-util.h" -#include "e-addressbook-marshal.h" +#include "eab-gui-util.h" #define PARENT_TYPE G_TYPE_OBJECT static GObjectClass *parent_class; /* - * EAddressbookModel callbacks + * EABModel callbacks * These are the callbacks that define the behavior of our custom model. */ -static void e_addressbook_model_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); -static void e_addressbook_model_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); +static void eab_model_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); +static void eab_model_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); enum { @@ -42,21 +41,19 @@ enum { SEARCH_STARTED, SEARCH_RESULT, FOLDER_BAR_MESSAGE, - CARD_ADDED, - CARD_REMOVED, - CARD_CHANGED, + CONTACT_ADDED, + CONTACT_REMOVED, + CONTACT_CHANGED, MODEL_CHANGED, STOP_STATE_CHANGED, BACKEND_DIED, LAST_SIGNAL }; -#define COLS (E_CARD_SIMPLE_FIELD_LAST) - -static guint e_addressbook_model_signals [LAST_SIGNAL] = {0, }; +static guint eab_model_signals [LAST_SIGNAL] = {0, }; static void -free_data (EAddressbookModel *model) +free_data (EABModel *model) { if (model->data) { int i; @@ -73,17 +70,17 @@ free_data (EAddressbookModel *model) } static void -remove_book_view(EAddressbookModel *model) +remove_book_view(EABModel *model) { - if (model->book_view && model->create_card_id) + if (model->book_view && model->create_contact_id) g_signal_handler_disconnect (model->book_view, - model->create_card_id); - if (model->book_view && model->remove_card_id) + model->create_contact_id); + if (model->book_view && model->remove_contact_id) g_signal_handler_disconnect (model->book_view, - model->remove_card_id); - if (model->book_view && model->modify_card_id) + model->remove_contact_id); + if (model->book_view && model->modify_contact_id) g_signal_handler_disconnect (model->book_view, - model->modify_card_id); + model->modify_contact_id); if (model->book_view && model->status_message_id) g_signal_handler_disconnect (model->book_view, model->status_message_id); @@ -91,9 +88,9 @@ remove_book_view(EAddressbookModel *model) g_signal_handler_disconnect (model->book_view, model->sequence_complete_id); - model->create_card_id = 0; - model->remove_card_id = 0; - model->modify_card_id = 0; + model->create_contact_id = 0; + model->remove_contact_id = 0; + model->modify_contact_id = 0; model->status_message_id = 0; model->sequence_complete_id = 0; @@ -109,12 +106,7 @@ remove_book_view(EAddressbookModel *model) static void addressbook_dispose(GObject *object) { - EAddressbookModel *model = E_ADDRESSBOOK_MODEL(object); - - if (model->get_view_idle) { - g_source_remove(model->get_view_idle); - model->get_view_idle = 0; - } + EABModel *model = EAB_MODEL(object); remove_book_view(model); free_data (model); @@ -135,7 +127,7 @@ addressbook_dispose(GObject *object) } if (model->query) { - g_free (model->query); + e_book_query_unref (model->query); model->query = NULL; } @@ -144,7 +136,7 @@ addressbook_dispose(GObject *object) } static void -update_folder_bar_message (EAddressbookModel *model) +update_folder_bar_message (EABModel *model) { int count; char *message; @@ -153,67 +145,68 @@ update_folder_bar_message (EAddressbookModel *model) switch (count) { case 0: - message = g_strdup (_("No cards")); + message = g_strdup (_("No contacts")); break; case 1: - message = g_strdup (_("1 card")); + message = g_strdup (_("1 contact")); break; default: - message = g_strdup_printf (_("%d cards"), count); + message = g_strdup_printf (_("%d contacts"), count); break; } g_signal_emit (model, - e_addressbook_model_signals [FOLDER_BAR_MESSAGE], 0, + eab_model_signals [FOLDER_BAR_MESSAGE], 0, message); g_free (message); } static void -create_card(EBookView *book_view, - const GList *cards, - EAddressbookModel *model) +create_contact(EBookView *book_view, + const GList *contacts, + EABModel *model) { int old_count = model->data_count; - int length = g_list_length ((GList *)cards); + int length = g_list_length ((GList *)contacts); if (model->data_count + length > model->allocated_count) { while (model->data_count + length > model->allocated_count) model->allocated_count = model->allocated_count * 2 + 1; - model->data = g_renew(ECard *, model->data, model->allocated_count); + model->data = g_renew(EContact *, model->data, model->allocated_count); } - for ( ; cards; cards = cards->next) { - model->data[model->data_count++] = cards->data; - g_object_ref (cards->data); + for ( ; contacts; contacts = contacts->next) { + model->data[model->data_count++] = contacts->data; + g_object_ref (contacts->data); } g_signal_emit (model, - e_addressbook_model_signals [CARD_ADDED], 0, + eab_model_signals [CONTACT_ADDED], 0, old_count, model->data_count - old_count); update_folder_bar_message (model); } static void -remove_card(EBookView *book_view, - GList *ids, - EAddressbookModel *model) +remove_contact(EBookView *book_view, + GList *ids, + EABModel *model) { + /* XXX we should keep a hash around instead of this O(n*m) loop */ int i = 0; GList *l; for (l = ids; l; l = l->next) { char *id = l->data; for ( i = 0; i < model->data_count; i++) { - if ( !strcmp(e_card_get_id(model->data[i]), id) ) { + if ( !strcmp(e_contact_get_const (model->data[i], E_CONTACT_UID), id) ) { g_object_unref (model->data[i]); - memmove(model->data + i, model->data + i + 1, (model->data_count - i - 1) * sizeof (ECard *)); + memmove(model->data + i, model->data + i + 1, (model->data_count - i - 1) * sizeof (EContact *)); model->data_count--; g_signal_emit (model, - e_addressbook_model_signals [CARD_REMOVED], 0, + eab_model_signals [CONTACT_REMOVED], 0, i); break; @@ -225,18 +218,19 @@ remove_card(EBookView *book_view, } static void -modify_card(EBookView *book_view, - const GList *cards, - EAddressbookModel *model) +modify_contact(EBookView *book_view, + const GList *contacts, + EABModel *model) { - for ( ; cards; cards = cards->next) { + for ( ; contacts; contacts = contacts->next) { int i; for ( i = 0; i < model->data_count; i++) { - if ( !strcmp(e_card_get_id(model->data[i]), e_card_get_id(E_CARD(cards->data))) ) { + if ( !strcmp(e_contact_get_const(model->data[i], E_CONTACT_UID), + e_contact_get_const(E_CONTACT(contacts->data), E_CONTACT_UID)) ) { g_object_unref (model->data[i]); - model->data[i] = e_card_duplicate(E_CARD(cards->data)); + model->data[i] = e_contact_duplicate(E_CONTACT(contacts->data)); g_signal_emit (model, - e_addressbook_model_signals [CARD_CHANGED], 0, + eab_model_signals [CONTACT_CHANGED], 0, i); break; } @@ -247,57 +241,57 @@ modify_card(EBookView *book_view, static void status_message (EBookView *book_view, char* status, - EAddressbookModel *model) + EABModel *model) { g_signal_emit (model, - e_addressbook_model_signals [STATUS_MESSAGE], 0, + eab_model_signals [STATUS_MESSAGE], 0, status); } static void sequence_complete (EBookView *book_view, EBookViewStatus status, - EAddressbookModel *model) + EABModel *model) { model->search_in_progress = FALSE; status_message (book_view, NULL, model); g_signal_emit (model, - e_addressbook_model_signals [SEARCH_RESULT], 0, + eab_model_signals [SEARCH_RESULT], 0, status); g_signal_emit (model, - e_addressbook_model_signals [STOP_STATE_CHANGED], 0); + eab_model_signals [STOP_STATE_CHANGED], 0); } static void writable_status (EBook *book, gboolean writable, - EAddressbookModel *model) + EABModel *model) { if (!model->editable_set) { model->editable = writable; g_signal_emit (model, - e_addressbook_model_signals [WRITABLE_STATUS], 0, + eab_model_signals [WRITABLE_STATUS], 0, writable); } } static void backend_died (EBook *book, - EAddressbookModel *model) + EABModel *model) { g_signal_emit (model, - e_addressbook_model_signals [BACKEND_DIED], 0); + eab_model_signals [BACKEND_DIED], 0); } static void -e_addressbook_model_class_init (GObjectClass *object_class) +eab_model_class_init (GObjectClass *object_class) { parent_class = g_type_class_ref (PARENT_TYPE); object_class->dispose = addressbook_dispose; - object_class->set_property = e_addressbook_model_set_property; - object_class->get_property = e_addressbook_model_get_property; + object_class->set_property = eab_model_set_property; + object_class->get_property = eab_model_get_property; g_object_class_install_property (object_class, PROP_BOOK, g_param_spec_object ("book", @@ -320,119 +314,118 @@ e_addressbook_model_class_init (GObjectClass *object_class) FALSE, G_PARAM_READWRITE)); - e_addressbook_model_signals [WRITABLE_STATUS] = + eab_model_signals [WRITABLE_STATUS] = g_signal_new ("writable_status", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EAddressbookModelClass, writable_status), + G_STRUCT_OFFSET (EABModelClass, writable_status), NULL, NULL, - e_addressbook_marshal_NONE__BOOL, + eab_marshal_NONE__BOOL, G_TYPE_NONE, 1, G_TYPE_BOOLEAN); - e_addressbook_model_signals [STATUS_MESSAGE] = + eab_model_signals [STATUS_MESSAGE] = g_signal_new ("status_message", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EAddressbookModelClass, status_message), + G_STRUCT_OFFSET (EABModelClass, status_message), NULL, NULL, - e_addressbook_marshal_NONE__POINTER, + eab_marshal_NONE__POINTER, G_TYPE_NONE, 1, G_TYPE_POINTER); - e_addressbook_model_signals [SEARCH_STARTED] = + eab_model_signals [SEARCH_STARTED] = g_signal_new ("search_started", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EAddressbookModelClass, search_started), + G_STRUCT_OFFSET (EABModelClass, search_started), NULL, NULL, - e_addressbook_marshal_NONE__NONE, + eab_marshal_NONE__NONE, G_TYPE_NONE, 0); - e_addressbook_model_signals [SEARCH_RESULT] = + eab_model_signals [SEARCH_RESULT] = g_signal_new ("search_result", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EAddressbookModelClass, search_result), + G_STRUCT_OFFSET (EABModelClass, search_result), NULL, NULL, - e_addressbook_marshal_NONE__INT, + eab_marshal_NONE__INT, G_TYPE_NONE, 1, G_TYPE_INT); - e_addressbook_model_signals [FOLDER_BAR_MESSAGE] = + eab_model_signals [FOLDER_BAR_MESSAGE] = g_signal_new ("folder_bar_message", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EAddressbookModelClass, folder_bar_message), + G_STRUCT_OFFSET (EABModelClass, folder_bar_message), NULL, NULL, - e_addressbook_marshal_NONE__POINTER, + eab_marshal_NONE__POINTER, G_TYPE_NONE, 1, G_TYPE_POINTER); - e_addressbook_model_signals [CARD_ADDED] = - g_signal_new ("card_added", + eab_model_signals [CONTACT_ADDED] = + g_signal_new ("contact_added", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EAddressbookModelClass, card_added), + G_STRUCT_OFFSET (EABModelClass, contact_added), NULL, NULL, - e_addressbook_marshal_NONE__INT_INT, + eab_marshal_NONE__INT_INT, G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT); - e_addressbook_model_signals [CARD_REMOVED] = - g_signal_new ("card_removed", + eab_model_signals [CONTACT_REMOVED] = + g_signal_new ("contact_removed", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EAddressbookModelClass, card_removed), + G_STRUCT_OFFSET (EABModelClass, contact_removed), NULL, NULL, - e_addressbook_marshal_NONE__INT, + eab_marshal_NONE__INT, G_TYPE_NONE, 1, G_TYPE_INT); - e_addressbook_model_signals [CARD_CHANGED] = - g_signal_new ("card_changed", + eab_model_signals [CONTACT_CHANGED] = + g_signal_new ("contact_changed", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EAddressbookModelClass, card_changed), + G_STRUCT_OFFSET (EABModelClass, contact_changed), NULL, NULL, - e_addressbook_marshal_NONE__INT, + eab_marshal_NONE__INT, G_TYPE_NONE, 1, G_TYPE_INT); - e_addressbook_model_signals [MODEL_CHANGED] = + eab_model_signals [MODEL_CHANGED] = g_signal_new ("model_changed", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EAddressbookModelClass, model_changed), + G_STRUCT_OFFSET (EABModelClass, model_changed), NULL, NULL, - e_addressbook_marshal_NONE__NONE, + eab_marshal_NONE__NONE, G_TYPE_NONE, 0); - e_addressbook_model_signals [STOP_STATE_CHANGED] = + eab_model_signals [STOP_STATE_CHANGED] = g_signal_new ("stop_state_changed", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EAddressbookModelClass, stop_state_changed), + G_STRUCT_OFFSET (EABModelClass, stop_state_changed), NULL, NULL, - e_addressbook_marshal_NONE__NONE, + eab_marshal_NONE__NONE, G_TYPE_NONE, 0); - e_addressbook_model_signals [BACKEND_DIED] = + eab_model_signals [BACKEND_DIED] = g_signal_new ("backend_died", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EAddressbookModelClass, backend_died), + G_STRUCT_OFFSET (EABModelClass, backend_died), NULL, NULL, - e_addressbook_marshal_NONE__NONE, + eab_marshal_NONE__NONE, G_TYPE_NONE, 0); } static void -e_addressbook_model_init (GObject *object) +eab_model_init (GObject *object) { - EAddressbookModel *model = E_ADDRESSBOOK_MODEL(object); + EABModel *model = EAB_MODEL(object); model->book = NULL; - model->query = g_strdup("(contains \"x-evolution-any-field\" \"\")"); + model->query = e_book_query_any_field_contains (""); model->book_view = NULL; - model->get_view_idle = 0; - model->create_card_id = 0; - model->remove_card_id = 0; - model->modify_card_id = 0; + model->create_contact_id = 0; + model->remove_contact_id = 0; + model->modify_contact_id = 0; model->status_message_id = 0; model->writable_status_id = 0; model->backend_died_id = 0; @@ -449,30 +442,28 @@ e_addressbook_model_init (GObject *object) static void book_view_loaded (EBook *book, EBookStatus status, EBookView *book_view, gpointer closure) { - EAddressbookModel *model = closure; + EABModel *model = closure; - remove_book_view(model); - - if (status != E_BOOK_STATUS_SUCCESS) { - e_addressbook_error_dialog (_("Error getting book view"), status); + if (status != E_BOOK_ERROR_OK) { + eab_error_dialog (_("Error getting book view"), status); return; } model->book_view = book_view; if (model->book_view) g_object_ref (model->book_view); - model->create_card_id = g_signal_connect(model->book_view, - "card_added", - G_CALLBACK (create_card), - model); - model->remove_card_id = g_signal_connect(model->book_view, - "card_removed", - G_CALLBACK (remove_card), - model); - model->modify_card_id = g_signal_connect(model->book_view, - "card_changed", - G_CALLBACK(modify_card), - model); + model->create_contact_id = g_signal_connect(model->book_view, + "contacts_added", + G_CALLBACK (create_contact), + model); + model->remove_contact_id = g_signal_connect(model->book_view, + "contacts_removed", + G_CALLBACK (remove_contact), + model); + model->modify_contact_id = g_signal_connect(model->book_view, + "contacts_changed", + G_CALLBACK(modify_contact), + model); model->status_message_id = g_signal_connect(model->book_view, "status_message", G_CALLBACK(status_message), @@ -482,70 +473,65 @@ book_view_loaded (EBook *book, EBookStatus status, EBookView *book_view, gpointe G_CALLBACK(sequence_complete), model); - free_data (model); - model->search_in_progress = TRUE; g_signal_emit (model, - e_addressbook_model_signals [MODEL_CHANGED], 0); + eab_model_signals [MODEL_CHANGED], 0); g_signal_emit (model, - e_addressbook_model_signals [SEARCH_STARTED], 0); + eab_model_signals [SEARCH_STARTED], 0); g_signal_emit (model, - e_addressbook_model_signals [STOP_STATE_CHANGED], 0); + eab_model_signals [STOP_STATE_CHANGED], 0); + + e_book_view_start (model->book_view); } -static gboolean -get_view (EAddressbookModel *model) +static void +get_view (EABModel *model) { + gboolean success; + if (model->book && model->query) { + char *query_string = e_book_query_to_string (model->query); + + remove_book_view(model); + free_data (model); + if (model->first_get_view) { + model->first_get_view = FALSE; + if (e_book_check_static_capability (model->book, "do-initial-query")) { - e_book_get_book_view (model->book, model->query, book_view_loaded, model); + success = e_book_async_get_book_view (model->book, query_string, book_view_loaded, model); } else { - remove_book_view(model); - free_data (model); g_signal_emit (model, - e_addressbook_model_signals [MODEL_CHANGED], 0); + eab_model_signals [MODEL_CHANGED], 0); g_signal_emit (model, - e_addressbook_model_signals [STOP_STATE_CHANGED], 0); + eab_model_signals [STOP_STATE_CHANGED], 0); + g_free (query_string); + return; } - model->first_get_view = FALSE; } else - e_book_get_book_view (model->book, model->query, book_view_loaded, model); - } + success = e_book_async_get_book_view (model->book, query_string, book_view_loaded, model); - model->get_view_idle = 0; - return FALSE; -} - -ECard * -e_addressbook_model_get_card(EAddressbookModel *model, - int row) -{ - if (model->data && 0 <= row && row < model->data_count) { - ECard *card; - card = e_card_duplicate (model->data[row]); - return card; + g_free (query_string); } - return NULL; } -const ECard * -e_addressbook_model_peek_card(EAddressbookModel *model, - int row) +EContact * +eab_model_get_contact(EABModel *model, + int row) { if (model->data && 0 <= row && row < model->data_count) { - return model->data[row]; + return e_contact_duplicate (model->data[row]); } return NULL; } static void -e_addressbook_model_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) +eab_model_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { - EAddressbookModel *model; + EABModel *model; - model = E_ADDRESSBOOK_MODEL (object); + model = EAB_MODEL (object); switch (prop_id){ case PROP_BOOK: @@ -564,10 +550,11 @@ e_addressbook_model_set_property (GObject *object, guint prop_id, const GValue * } model->book = E_BOOK(g_value_get_object (value)); if (model->book) { + if (!model->editable_set) + model->editable = e_book_is_writable (model->book); model->first_get_view = TRUE; g_object_ref (model->book); - if (model->get_view_idle == 0) - model->get_view_idle = g_idle_add((GSourceFunc)get_view, model); + get_view (model); g_signal_connect (model->book, "writable_status", G_CALLBACK (writable_status), model); @@ -578,10 +565,9 @@ e_addressbook_model_set_property (GObject *object, guint prop_id, const GValue * break; case PROP_QUERY: if (model->query) - g_free(model->query); - model->query = g_strdup(g_value_get_string (value)); - if (model->get_view_idle == 0) - model->get_view_idle = g_idle_add((GSourceFunc)get_view, model); + e_book_query_unref (model->query); + model->query = e_book_query_from_string (g_value_get_string (value)); + get_view (model); break; case PROP_EDITABLE: model->editable = g_value_get_boolean (value); @@ -594,21 +580,23 @@ e_addressbook_model_set_property (GObject *object, guint prop_id, const GValue * } static void -e_addressbook_model_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) +eab_model_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { - EAddressbookModel *e_addressbook_model; + EABModel *eab_model; - e_addressbook_model = E_ADDRESSBOOK_MODEL (object); + eab_model = EAB_MODEL (object); switch (prop_id) { case PROP_BOOK: - g_value_set_object (value, e_addressbook_model->book); + g_value_set_object (value, eab_model->book); break; - case PROP_QUERY: - g_value_set_string (value, g_strdup(e_addressbook_model->query)); + case PROP_QUERY: { + char *query_string = e_book_query_to_string (eab_model->query); + g_value_set_string (value, query_string); break; + } case PROP_EDITABLE: - g_value_set_boolean (value, e_addressbook_model->editable); + g_value_set_boolean (value, eab_model->editable); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); @@ -617,81 +605,81 @@ e_addressbook_model_get_property (GObject *object, guint prop_id, GValue *value, } GType -e_addressbook_model_get_type (void) +eab_model_get_type (void) { static GType type = 0; if (!type) { static const GTypeInfo info = { - sizeof (EAddressbookModelClass), + sizeof (EABModelClass), NULL, /* base_init */ NULL, /* base_finalize */ - (GClassInitFunc) e_addressbook_model_class_init, + (GClassInitFunc) eab_model_class_init, NULL, /* class_finalize */ NULL, /* class_data */ - sizeof (EAddressbookModel), + sizeof (EABModel), 0, /* n_preallocs */ - (GInstanceInitFunc) e_addressbook_model_init, + (GInstanceInitFunc) eab_model_init, }; - type = g_type_register_static (PARENT_TYPE, "EAddressbookModel", &info, 0); + type = g_type_register_static (PARENT_TYPE, "EABModel", &info, 0); } return type; } -EAddressbookModel* -e_addressbook_model_new (void) +EABModel* +eab_model_new (void) { - EAddressbookModel *et; + EABModel *et; - et = g_object_new (E_TYPE_ADDRESSBOOK_MODEL, NULL); + et = g_object_new (EAB_TYPE_MODEL, NULL); return et; } -void e_addressbook_model_stop (EAddressbookModel *model) +void eab_model_stop (EABModel *model) { remove_book_view(model); g_signal_emit (model, - e_addressbook_model_signals [STOP_STATE_CHANGED], 0); + eab_model_signals [STOP_STATE_CHANGED], 0); g_signal_emit (model, - e_addressbook_model_signals [STATUS_MESSAGE], 0, + eab_model_signals [STATUS_MESSAGE], 0, "Search Interrupted."); } gboolean -e_addressbook_model_can_stop (EAddressbookModel *model) +eab_model_can_stop (EABModel *model) { return model->search_in_progress; } void -e_addressbook_model_force_folder_bar_message (EAddressbookModel *model) +eab_model_force_folder_bar_message (EABModel *model) { update_folder_bar_message (model); } int -e_addressbook_model_card_count (EAddressbookModel *model) +eab_model_contact_count (EABModel *model) { return model->data_count; } -ECard * -e_addressbook_model_card_at (EAddressbookModel *model, int index) +const EContact * +eab_model_contact_at (EABModel *model, int index) { return model->data[index]; } gboolean -e_addressbook_model_editable (EAddressbookModel *model) +eab_model_editable (EABModel *model) { return model->editable; } EBook * -e_addressbook_model_get_ebook (EAddressbookModel *model) +eab_model_get_ebook (EABModel *model) { return model->book; } |