aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui/component/select-names/e-select-names-model.h
diff options
context:
space:
mode:
authorJon Trowbridge <trow@ximian.com>2001-03-02 05:03:02 +0800
committerJon Trowbridge <trow@src.gnome.org>2001-03-02 05:03:02 +0800
commitce67772c53108003cd8ba2bf2130722ab17d5df8 (patch)
tree1b732c251e8cbf340ea060f8737fe504dadc7d77 /addressbook/gui/component/select-names/e-select-names-model.h
parentfae87e8d3d4e69f40b6c3e51ea2c8c8477995857 (diff)
downloadgsoc2013-evolution-ce67772c53108003cd8ba2bf2130722ab17d5df8.tar
gsoc2013-evolution-ce67772c53108003cd8ba2bf2130722ab17d5df8.tar.gz
gsoc2013-evolution-ce67772c53108003cd8ba2bf2130722ab17d5df8.tar.bz2
gsoc2013-evolution-ce67772c53108003cd8ba2bf2130722ab17d5df8.tar.lz
gsoc2013-evolution-ce67772c53108003cd8ba2bf2130722ab17d5df8.tar.xz
gsoc2013-evolution-ce67772c53108003cd8ba2bf2130722ab17d5df8.tar.zst
gsoc2013-evolution-ce67772c53108003cd8ba2bf2130722ab17d5df8.zip
Change for new EDestination/ESelectNamesModel API.
2001-03-01 Jon Trowbridge <trow@ximian.com> * gui/component/select-names/e-select-names-table-model.c (fill_in_info): Change for new EDestination/ESelectNamesModel API. * gui/component/select-names/e-select-names-manager.c (e_select_names_manager_get_source): Added. A function for looking up the ESelectNamesModel by id. (I didn't end up using this function, but it might come in handy later.) (e_select_names_manager_get_cards): #if 0/#endif out this function. (e_select_names_manager_create_entry): Modified to attach an ESelectNamesCompletion to the entry we create. (completion_handler): A post-completion handler for our EEntry, to take the completion's extra data (an EDestination) and properly stick it into our ESelectNamesModel. * gui/component/select-names/e-select-names.c (real_add_address_cb): Changed to operate on EDestinations rather than ECards and to use the new ESelectNamesModel API. This leads to a rather nice code simplication. (remove_address): Changed for new ESelectNamesModel API. * gui/component/select-names/e-select-names-bonobo.c (entry_get_property_fn): Rather than just passing the entry's text through the property bag, get the "address text" from the model. This returns a nice, verbose string of addresses with names expanded when the address is tied to an ECard (i.e. "Jon Trowbridge <trow@ximian.com>"). (impl_SelectNames_get_entry_for_section): Make the text property read-only. (entry_set_property_fn): ...and since it is read-only now, chop out the setter code. * gui/component/select-names/e-select-names-text-model.h: * gui/component/select-names/e-select-names-text-model.c: Again, this code has been (pretty much) totally rewritten to convert all text operations into changes on the ESelectNamesModel. This lets us give the associated EEntry some (IMHO) nice semantics regarding whitespace, etc. Includes object activation, so destinations tied to ECards are underlined and can be double-clicked to bring up a contact editor. * gui/component/select-names/e-select-names-model.h: * gui/component/select-names/e-select-names-model.c: I've heavily modified this object to both hide all implementation details (which the old version exposed a bit too much for my peculiar tastes) and to act as an EDestination container. The old code put the text model operations here. I've moved them all to ESelectNamesTextModel --- so the text model actions (insert, delete, etc.) are all done through the API rather than operating on ESelectNamesModel internals. * gui/component/select-names/e-select-names-completion.c: Added. A fairly complicated object derived from ECompletion that searches our local addressbook in various and sundry ways. * gui/component/select-names/e-select-names-completion.h: * backend/ebook/e-destination.h: * backend/ebook/e-destination.c: Added. This object encapsulates a place to sent an email to, which can either be just a address as a string ("trow@ximian.com"), a fancier string ("Jon Trowbridge <trow@ximian.com>"), or an ECard and a specific address within that ECard. svn path=/trunk/; revision=8459
Diffstat (limited to 'addressbook/gui/component/select-names/e-select-names-model.h')
-rw-r--r--addressbook/gui/component/select-names/e-select-names-model.h77
1 files changed, 23 insertions, 54 deletions
diff --git a/addressbook/gui/component/select-names/e-select-names-model.h b/addressbook/gui/component/select-names/e-select-names-model.h
index 576d5e6a9a..4b3413f983 100644
--- a/addressbook/gui/component/select-names/e-select-names-model.h
+++ b/addressbook/gui/component/select-names/e-select-names-model.h
@@ -1,9 +1,11 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
/*
* Authors:
- * Chris Lahey <clahey@helixcode.com>
+ * Chris Lahey <clahey@ximian.com>
+ * Jon Trowbridge <trow@ximian.com>
*
- * Copyright (C) 2000 Helix Code, Inc.
+ * Copyright (C) 2000, 2001 Ximian, Inc.
*/
#ifndef __E_SELECT_NAMES_MODEL_H__
@@ -14,6 +16,7 @@
#include <stdio.h>
#include <e-util/e-list.h>
#include <addressbook/backend/ebook/e-card.h>
+#include <addressbook/backend/ebook/e-destination.h>
#define E_TYPE_SELECT_NAMES_MODEL (e_select_names_model_get_type ())
#define E_SELECT_NAMES_MODEL(obj) (GTK_CHECK_CAST ((obj), E_TYPE_SELECT_NAMES_MODEL, ESelectNamesModel))
@@ -21,76 +24,42 @@
#define E_IS_SELECT_NAMES_MODEL(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_SELECT_NAMES_MODEL))
#define E_IS_SELECT_NAMES_MODEL_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), E_TYPE_SELECT_NAMES_MODEL))
-typedef enum _ESelectNamesModelDataType ESelectNamesModelDataType;
-typedef struct _ESelectNamesModelData ESelectNamesModelData;
typedef struct _ESelectNamesModel ESelectNamesModel;
typedef struct _ESelectNamesModelClass ESelectNamesModelClass;
-
-enum _ESelectNamesModelDataType {
- E_SELECT_NAMES_MODEL_DATA_TYPE_CARD,
- E_SELECT_NAMES_MODEL_DATA_TYPE_STRING_ADDRESS,
-};
-
-struct _ESelectNamesModelData {
- ESelectNamesModelDataType type;
- ECard *card;
- char *string;
-};
+struct _ESelectNamesModelPrivate;
struct _ESelectNamesModel {
GtkObject object;
-
- char *id;
- char *title;
- EList *data; /* Of type ESelectNamesModelData. */
+ struct _ESelectNamesModelPrivate *priv;
};
struct _ESelectNamesModelClass {
GtkObjectClass parent_class;
void (*changed) (ESelectNamesModel *model);
+ void (*resized) (ESelectNamesModel *model, gint index, gint old_len, gint new_len);
};
-ESelectNamesModel *e_select_names_model_new (void);
-ESelectNamesModel *e_select_names_model_duplicate (ESelectNamesModel *old);
+GtkType e_select_names_model_get_type (void);
-/* These lengths are allowed to go over objects and act just like the text model does. */
-void e_select_names_model_insert (ESelectNamesModel *model,
- EIterator *iterator, /* Must be one of the iterators in the model. */
- int index,
- char *data);
-void e_select_names_model_insert_length (ESelectNamesModel *model,
- EIterator *iterator, /* Must be one of the iterators in the model. */
- int index,
- char *data,
- int length);
-void e_select_names_model_delete (ESelectNamesModel *model,
- EIterator *iterator, /* Must be one of the iterators in the model. */
- int index,
- int length);
-void e_select_names_model_replace (ESelectNamesModel *model,
- EIterator *iterator, /* Must be one of the iterators in the model. */
- int index,
- int replacement_length,
- char *data);
+ESelectNamesModel *e_select_names_model_new (void);
+ESelectNamesModel *e_select_names_model_duplicate (ESelectNamesModel *old);
-void e_select_names_model_add_item (ESelectNamesModel *model,
- EIterator *iterator, /* NULL for at the beginning. */
- ESelectNamesModelData *data);
-void e_select_names_model_replace_item (ESelectNamesModel *model,
- EIterator *iterator,
- ESelectNamesModelData *data);
-void e_select_names_model_remove_item (ESelectNamesModel *model,
- EIterator *iterator);
+const gchar *e_select_names_model_get_textification (ESelectNamesModel *model);
+const gchar *e_select_names_model_get_address_text (ESelectNamesModel *model);
-/* Of type ECard */
-EList *e_select_names_model_get_cards (ESelectNamesModel *model);
+gint e_select_names_model_count (ESelectNamesModel *model);
+const EDestination *e_select_names_model_get_destination (ESelectNamesModel *model, gint index);
+ECard *e_select_names_model_get_card (ESelectNamesModel *model, gint index);
+const gchar *e_select_names_model_get_string (ESelectNamesModel *model, gint index);
-/* Of type ESelectNamesModelData */
-EList *e_select_names_model_get_data (ESelectNamesModel *model);
+void e_select_names_model_insert (ESelectNamesModel *model, gint index, EDestination *dest);
+void e_select_names_model_replace (ESelectNamesModel *model, gint index, EDestination *dest);
+void e_select_names_model_delete (ESelectNamesModel *model, gint index);
+void e_select_names_model_delete_all (ESelectNamesModel *model);
-/* Standard Gtk function */
-GtkType e_select_names_model_get_type (void);
+void e_select_names_model_name_pos (ESelectNamesModel *model, gint index, gint *pos, gint *length);
+void e_select_names_model_text_pos (ESelectNamesModel *model, gint pos, gint *index, gint *start_pos, gint *length);
#endif /* ! __E_SELECT_NAMES_MODEL_H__ */