aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui/component
diff options
context:
space:
mode:
Diffstat (limited to 'addressbook/gui/component')
-rw-r--r--addressbook/gui/component/Makefile.am3
-rw-r--r--addressbook/gui/component/addressbook-migrate.c123
-rw-r--r--addressbook/gui/component/select-names/e-select-names-bonobo.c2
-rw-r--r--addressbook/gui/component/select-names/e-select-names-completion.c79
-rw-r--r--addressbook/gui/component/select-names/e-select-names-manager.c77
-rw-r--r--addressbook/gui/component/select-names/e-select-names-model.c164
-rw-r--r--addressbook/gui/component/select-names/e-select-names-model.h15
-rw-r--r--addressbook/gui/component/select-names/e-select-names-popup.c60
-rw-r--r--addressbook/gui/component/select-names/e-select-names-table-model.c8
-rw-r--r--addressbook/gui/component/select-names/e-select-names-text-model.c44
-rw-r--r--addressbook/gui/component/select-names/e-select-names.c9
11 files changed, 248 insertions, 336 deletions
diff --git a/addressbook/gui/component/Makefile.am b/addressbook/gui/component/Makefile.am
index 938385802f..5bd4d381e4 100644
--- a/addressbook/gui/component/Makefile.am
+++ b/addressbook/gui/component/Makefile.am
@@ -7,11 +7,10 @@ INCLUDES = \
-I$(top_srcdir)/shell \
-I$(top_builddir)/shell \
-I$(top_srcdir)/widgets/misc \
+ -I$(top_srcdir)/addressbook/util \
-I$(top_srcdir)/addressbook/gui/contact-editor \
-I$(top_srcdir)/addressbook/gui/contact-list-editor \
-I$(top_srcdir)/addressbook/gui/widgets \
- -I$(top_srcdir)/addressbook/backend \
- -I$(top_builddir)/addressbook/backend \
-I$(top_builddir)/a11y/addressbook \
-DEVOLUTION_DATADIR=\""$(datadir)"\" \
-DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \
diff --git a/addressbook/gui/component/addressbook-migrate.c b/addressbook/gui/component/addressbook-migrate.c
index 1878b6504b..7c81a91d17 100644
--- a/addressbook/gui/component/addressbook-migrate.c
+++ b/addressbook/gui/component/addressbook-migrate.c
@@ -22,6 +22,7 @@
#include <glib.h>
#include <string.h>
#include "addressbook-migrate.h"
+#include "e-destination.h"
#include <libebook/e-book-async.h>
#include <libgnome/gnome-i18n.h>
#include <gal/util/e-util.h>
@@ -49,7 +50,7 @@ typedef struct {
} MigrationContext;
static void
-setup_progress_dialog (MigrationContext *context)
+setup_progress_dialog (MigrationContext *context, const char *str)
{
GtkWidget *vbox, *hbox, *w;
@@ -62,9 +63,7 @@ setup_progress_dialog (MigrationContext *context)
gtk_widget_show (vbox);
gtk_container_add (GTK_CONTAINER (context->window), vbox);
- w = gtk_label_new (_("The location and hierarchy of the Evolution contact "
- "folders has changed since Evolution 1.x.\n\nPlease be "
- "patient while Evolution migrates your folders..."));
+ w = gtk_label_new (str);
gtk_label_set_line_wrap (GTK_LABEL (w), TRUE);
gtk_widget_show (w);
gtk_box_pack_start_defaults (GTK_BOX (vbox), w);
@@ -735,6 +734,78 @@ migrate_completion_folders (MigrationContext *context)
return TRUE;
}
+static void
+migrate_contact_lists_for_local_folders (MigrationContext *context, ESourceGroup *on_this_computer)
+{
+ GSList *sources, *s;
+
+ sources = e_source_group_peek_sources (on_this_computer);
+ for (s = sources; s; s = s->next) {
+ ESource *source = s->data;
+ EBook *book;
+ EBookQuery *query;
+ GList *l, *contacts;
+ int num_contacts, num_converted;
+
+ book = e_book_new ();
+ if (!e_book_load_source (book, source, TRUE, NULL)) {
+ char *uri = e_source_get_uri (source);
+ g_warning ("failed to migrate contact lists for source %s", uri);
+ g_free (uri);
+ continue;
+ }
+
+ query = e_book_query_any_field_contains ("");
+
+ e_book_get_contacts (book, query, &contacts, NULL);
+
+ num_converted = 0;
+ num_contacts = g_list_length (contacts);
+ for (l = contacts; l; l = l->next) {
+ EContact *contact = l->data;
+ GError *e = NULL;
+ GList *attrs, *attr;
+ gboolean converted = FALSE;
+
+ attrs = e_contact_get_attributes (contact, E_CONTACT_EMAIL);
+ for (attr = attrs; attr; attr = attr->next) {
+ EVCardAttribute *a = attr->data;
+ GList *v = e_vcard_attribute_get_values (a);
+
+ if (v && v->data) {
+ if (!strncmp ((char*)v->data, "<?xml", 5)) {
+ EDestination *dest = e_destination_import ((char*)v->data);
+
+ e_destination_export_to_vcard_attribute (dest, a);
+
+ g_object_unref (dest);
+
+ converted = TRUE;
+ }
+ }
+ }
+
+ if (converted) {
+ e_contact_set_attributes (contact, E_CONTACT_EMAIL, attrs);
+
+ if (!e_book_commit_contact (book,
+ contact,
+ &e))
+ g_warning ("contact add failed: `%s'", e->message);
+ }
+
+ num_converted ++;
+
+ dialog_set_progress (context, (double)num_converted / num_contacts);
+ }
+
+ g_list_foreach (contacts, (GFunc)g_object_unref, NULL);
+ g_list_free (contacts);
+
+ g_object_unref (book);
+ }
+}
+
static MigrationContext*
migration_context_new (AddressbookComponent *component)
{
@@ -774,35 +845,45 @@ addressbook_migrate (AddressbookComponent *component, int major, int minor, int
groups/sources. */
create_groups (context, &on_this_computer, &on_ldap_servers, &personal_source);
- if (major <= 1) {
+ if (major == 1) {
- if (/* we're <= 1.5.2 */
- (major == 1
- && ((minor == 5 && revision <= 2)
- || (minor < 5)))
- ||
- /* we're 0.x */
- (major == 0)) {
+ if (minor < 5 || (minor == 5 && revision <= 2)) {
/* initialize our dialog */
- setup_progress_dialog (context);
+ setup_progress_dialog (context,
+ _("The location and hierarchy of the Evolution contact "
+ "folders has changed since Evolution 1.x.\n\nPlease be "
+ "patient while Evolution migrates your folders..."));
- if (on_this_computer) {
+ if (on_this_computer)
migrate_local_folders (context, on_this_computer, personal_source);
- g_object_unref (on_this_computer);
- }
- if (on_ldap_servers) {
+ if (on_ldap_servers)
migrate_ldap_servers (context, on_ldap_servers);
- g_object_unref (on_ldap_servers);
- }
- if (personal_source)
- g_object_unref (personal_source);
migrate_completion_folders (context);
dialog_close (context);
}
+
+ if (minor <= 5 || (minor == 5 && revision <= 6)) {
+ setup_progress_dialog (context,
+ _("The format of mailing list contacts has changed.\n\n"
+ "Please be patient while Evolution migrates your "
+ "folders..."));
+
+ migrate_contact_lists_for_local_folders (context, on_this_computer);
+
+ dialog_close (context);
+ }
}
+ if (on_this_computer)
+ g_object_unref (on_this_computer);
+ if (on_ldap_servers)
+ g_object_unref (on_ldap_servers);
+ if (personal_source)
+ g_object_unref (personal_source);
+
+
migration_context_free (context);
return TRUE;
diff --git a/addressbook/gui/component/select-names/e-select-names-bonobo.c b/addressbook/gui/component/select-names/e-select-names-bonobo.c
index 1977abe95f..871bb8b3f6 100644
--- a/addressbook/gui/component/select-names/e-select-names-bonobo.c
+++ b/addressbook/gui/component/select-names/e-select-names-bonobo.c
@@ -159,7 +159,6 @@ entry_set_property_fn (BonoboPropertyBag *bag,
g_assert (model != NULL);
e_entry_set_text (E_ENTRY (w), BONOBO_ARG_GET_STRING (arg));
- e_select_names_model_load_all_contacts (model, NULL);
break;
}
@@ -170,7 +169,6 @@ entry_set_property_fn (BonoboPropertyBag *bag,
g_assert (model != NULL);
e_select_names_model_import_destinationv (model, BONOBO_ARG_GET_STRING (arg));
- e_select_names_model_load_all_contacts (model, NULL);
break;
}
diff --git a/addressbook/gui/component/select-names/e-select-names-completion.c b/addressbook/gui/component/select-names/e-select-names-completion.c
index e3fa256dc8..2bf0341e40 100644
--- a/addressbook/gui/component/select-names/e-select-names-completion.c
+++ b/addressbook/gui/component/select-names/e-select-names-completion.c
@@ -36,7 +36,7 @@
#include <libebook/e-contact.h>
#include <addressbook/util/eab-book-util.h>
-#include <addressbook/util/eab-destination.h>
+#include <addressbook/util/e-destination.h>
#include <addressbook/gui/merging/eab-contact-compare.h>
#include <e-util/e-sexp.h>
@@ -97,7 +97,7 @@ static FILE *out;
*/
typedef gchar *(*BookQuerySExp) (ESelectNamesCompletion *);
-typedef ECompletionMatch *(*BookQueryMatchTester) (ESelectNamesCompletion *, EABDestination *);
+typedef ECompletionMatch *(*BookQueryMatchTester) (ESelectNamesCompletion *, EDestination *);
static int
utf8_casefold_collate_len (const gchar *str1, const gchar *str2, int len)
@@ -127,16 +127,16 @@ our_match_destroy (ECompletionMatch *match)
}
static ECompletionMatch *
-make_match (EABDestination *dest, const gchar *menu_form, double score)
+make_match (EDestination *dest, const gchar *menu_form, double score)
{
ECompletionMatch *match;
#if notyet
- EContact *contact = eab_destination_get_contact (dest);
+ EContact *contact = e_destination_get_contact (dest);
#endif
- match = e_completion_match_new (eab_destination_get_name (dest), menu_form, score);
+ match = e_completion_match_new (e_destination_get_name (dest), menu_form, score);
- e_completion_match_set_text (match, eab_destination_get_name (dest), menu_form);
+ e_completion_match_set_text (match, e_destination_get_name (dest), menu_form);
/* Reject any match that has null text fields. */
if (! (e_completion_match_get_match_text (match) && e_completion_match_get_menu_text (match))) {
@@ -152,10 +152,9 @@ make_match (EABDestination *dest, const gchar *menu_form, double score)
match->sort_major = 0;
#endif
- match->sort_minor = eab_destination_get_email_num (dest);
+ match->sort_minor = e_destination_get_email_num (dest);
- match->user_data = dest;
- g_object_ref (dest);
+ match->user_data = g_object_ref (dest);
match->destroy = our_match_destroy;
@@ -175,11 +174,11 @@ sexp_nickname (ESelectNamesCompletion *comp)
}
static ECompletionMatch *
-match_nickname (ESelectNamesCompletion *comp, EABDestination *dest)
+match_nickname (ESelectNamesCompletion *comp, EDestination *dest)
{
ECompletionMatch *match = NULL;
gint len;
- EContact *contact = eab_destination_get_contact (dest);
+ EContact *contact = e_destination_get_contact (dest);
double score;
const char *nickname;
@@ -197,11 +196,11 @@ match_nickname (ESelectNamesCompletion *comp, EABDestination *dest)
if (len == g_utf8_strlen (nickname, -1)) /* boost score on an exact match */
score *= 10;
- name = eab_destination_get_name (dest);
+ name = e_destination_get_name (dest);
if (name && *name)
- str = g_strdup_printf ("'%s' %s <%s>", nickname, name, eab_destination_get_email (dest));
+ str = g_strdup_printf ("'%s' %s <%s>", nickname, name, e_destination_get_email (dest));
else
- str = g_strdup_printf ("'%s' <%s>", nickname, eab_destination_get_email (dest));
+ str = g_strdup_printf ("'%s' <%s>", nickname, e_destination_get_email (dest));
match = make_match (dest, str, score);
g_free (str);
@@ -221,17 +220,17 @@ sexp_email (ESelectNamesCompletion *comp)
}
static ECompletionMatch *
-match_email (ESelectNamesCompletion *comp, EABDestination *dest)
+match_email (ESelectNamesCompletion *comp, EDestination *dest)
{
ECompletionMatch *match;
gint len = strlen (comp->priv->query_text);
- const gchar *name = eab_destination_get_name (dest);
- const gchar *email = eab_destination_get_email (dest);
+ const gchar *name = e_destination_get_name (dest);
+ const gchar *email = e_destination_get_email (dest);
double score;
if (email
&& !utf8_casefold_collate_len (comp->priv->query_text, email, len)
- && !eab_destination_is_evolution_list (dest)) {
+ && !e_destination_is_evolution_list (dest)) {
gchar *str;
@@ -306,7 +305,7 @@ sexp_name (ESelectNamesCompletion *comp)
}
static ECompletionMatch *
-match_name (ESelectNamesCompletion *comp, EABDestination *dest)
+match_name (ESelectNamesCompletion *comp, EDestination *dest)
{
ECompletionMatch *final_match = NULL;
gchar *menu_text = NULL;
@@ -319,13 +318,13 @@ match_name (ESelectNamesCompletion *comp, EABDestination *dest)
gboolean have_given, have_additional, have_family;
EContactName *contact_name;
- contact = eab_destination_get_contact (dest);
+ contact = e_destination_get_contact (dest);
contact_name = e_contact_get (contact, E_CONTACT_NAME);
if (!contact_name)
return NULL;
- email = eab_destination_get_email (dest);
+ email = e_destination_get_email (dest);
match = eab_contact_compare_name_to_string_full (contact, comp->priv->query_text, TRUE /* yes, allow partial matches */,
NULL, &first_match, &match_len);
@@ -411,7 +410,7 @@ sexp_file_as (ESelectNamesCompletion *comp)
}
static ECompletionMatch *
-match_file_as (ESelectNamesCompletion *comp, EABDestination *dest)
+match_file_as (ESelectNamesCompletion *comp, EDestination *dest)
{
const gchar *name;
const gchar *email;
@@ -420,8 +419,8 @@ match_file_as (ESelectNamesCompletion *comp, EABDestination *dest)
double score = 0.00001;
ECompletionMatch *match;
- name = eab_destination_get_name (dest);
- email = eab_destination_get_email (dest);
+ name = e_destination_get_name (dest);
+ email = e_destination_get_email (dest);
if (!(name && *name))
return NULL;
@@ -513,13 +512,13 @@ book_query_sexp (ESelectNamesCompletion *comp)
* string that applies to a given destination.
*/
static ECompletionMatch *
-book_query_score (ESelectNamesCompletion *comp, EABDestination *dest)
+book_query_score (ESelectNamesCompletion *comp, EDestination *dest)
{
ECompletionMatch *best_match = NULL;
gint i;
g_return_val_if_fail (E_IS_SELECT_NAMES_COMPLETION (comp), NULL);
- g_return_val_if_fail (EAB_IS_DESTINATION (dest), NULL);
+ g_return_val_if_fail (E_IS_DESTINATION (dest), NULL);
if (! (comp->priv->query_text && *comp->priv->query_text))
return NULL;
@@ -528,7 +527,7 @@ book_query_score (ESelectNamesCompletion *comp, EABDestination *dest)
ECompletionMatch *this_match = NULL;
- if (book_queries[i].tester && eab_destination_get_contact (dest)) {
+ if (book_queries[i].tester && e_destination_get_contact (dest)) {
this_match = book_queries[i].tester (comp, dest);
}
@@ -555,9 +554,9 @@ book_query_process_card_list (ESelectNamesCompletion *comp, const GList *contact
if (comp->priv->match_contact_lists) {
- EABDestination *dest = eab_destination_new ();
+ EDestination *dest = e_destination_new ();
ECompletionMatch *match;
- eab_destination_set_contact (dest, contact, 0);
+ e_destination_set_contact (dest, contact, 0);
match = book_query_score (comp, dest);
if (match && match->score > 0) {
e_completion_found_match (E_COMPLETION (comp), match);
@@ -575,11 +574,11 @@ book_query_process_card_list (ESelectNamesCompletion *comp, const GList *contact
GList *iter;
gint i;
for (i=0, iter = email; iter; ++i, iter = iter->next) {
- EABDestination *dest = eab_destination_new ();
+ EDestination *dest = e_destination_new ();
gchar *e;
ECompletionMatch *match;
- eab_destination_set_contact (dest, contact, i);
+ e_destination_set_contact (dest, contact, i);
e = iter->data;
if (e && *e) {
@@ -822,9 +821,9 @@ e_select_names_completion_got_book_view_cb (EBook *book, EBookStatus status, EBo
G_CALLBACK (e_select_names_completion_seq_complete_cb),
book_data);
- e_book_view_start (view);
-
book_data->sequence_complete_received = FALSE;
+
+ e_book_view_start (view);
}
static void
@@ -838,8 +837,7 @@ e_select_names_completion_contacts_added_cb (EBookView *book_view, const GList *
/* Save the list of matching cards. */
while (cards) {
- book_data->cached_cards = g_list_prepend (book_data->cached_cards, cards->data);
- g_object_ref (cards->data);
+ book_data->cached_cards = g_list_prepend (book_data->cached_cards, g_object_ref (cards->data));
cards = g_list_next (cards);
}
}
@@ -872,7 +870,9 @@ e_select_names_completion_seq_complete_cb (EBookView *book_view, EBookViewStatus
book_data->cache_complete = TRUE;
if (out)
- fprintf (out, "\tending search, book_data->cache_complete == %d\n", book_data->cache_complete);
+ fprintf (out, "\tending search, book_data->cache_complete == %d, cached_cards = %p\n",
+ book_data->cache_complete,
+ book_data->cached_cards);
if (!book_data->sequence_complete_received) {
book_data->sequence_complete_received = TRUE;
@@ -920,9 +920,7 @@ e_select_names_completion_stop_query (ESelectNamesCompletion *comp)
for (l = comp->priv->book_data; l; l = l->next) {
ESelectNamesCompletionBookData *book_data = l->data;
if (book_data->book_view_tag) {
-#if notyet
- e_book_cancel (book_data->book, book_data->book_view_tag);
-#endif
+ e_book_cancel (book_data->book, NULL);
book_data->book_view_tag = 0;
}
if (book_data->book_view) {
@@ -1035,9 +1033,8 @@ e_select_names_completion_start_query (ESelectNamesCompletion *comp, const gchar
comp->priv->query_text = NULL;
}
} else {
-
+ g_free (comp->priv->waiting_query);
comp->priv->waiting_query = g_strdup (query_text);
-
}
}
diff --git a/addressbook/gui/component/select-names/e-select-names-manager.c b/addressbook/gui/component/select-names/e-select-names-manager.c
index 1b7cbbb38e..d78ac0aef6 100644
--- a/addressbook/gui/component/select-names/e-select-names-manager.c
+++ b/addressbook/gui/component/select-names/e-select-names-manager.c
@@ -25,7 +25,7 @@
#include "e-select-names-completion.h"
#include "e-select-names-popup.h"
#include <addressbook/util/eab-book-util.h>
-#include <addressbook/util/eab-destination.h>
+#include <addressbook/util/e-destination.h>
#include "addressbook/gui/component/addressbook.h"
#include <bonobo/bonobo-object.h>
@@ -153,75 +153,19 @@ populate_popup_cb (EEntry *eentry, GdkEventButton *ev, gint pos, GtkWidget *menu
e_select_names_populate_popup (menu, text_model, ev, pos, GTK_WIDGET (eentry));
}
-#if 0
-static gboolean
-clean_cb (gpointer ptr)
-{
- ESelectNamesManagerEntry *entry = ptr;
-
- e_select_names_model_clean (entry->model, TRUE);
- entry->cleaning_tag = 0;
- return FALSE;
-}
-#endif
-
-static gint
-focus_in_cb (GtkWidget *w, GdkEventFocus *ev, gpointer user_data)
-{
- ESelectNamesManagerEntry *entry = user_data;
-
- if (entry->cleaning_tag) {
- g_source_remove (entry->cleaning_tag);
- entry->cleaning_tag = 0;
- }
-
- e_select_names_model_cancel_all_contact_load (entry->model);
-
- return FALSE;
-}
-
-static gint
-focus_out_cb (GtkWidget *w, GdkEventFocus *ev, gpointer user_data)
-{
-#if 0
- /* XXX fix me */
- ESelectNamesManagerEntry *entry = user_data;
- gboolean visible = e_entry_completion_popup_is_visible (entry->entry);
-
- if (! visible) {
- e_select_names_model_load_all_contacts (entry->model, entry->manager->completion_book, 100);
- if (entry->cleaning_tag == 0)
- entry->cleaning_tag = gtk_timeout_add (100, clean_cb, entry);
- }
-#endif
- return FALSE;
-}
-
-static void
-completion_popup_cb (EEntry *w, gint visible, gpointer user_data)
-{
-#if 0
- /* XXX fix me */
- ESelectNamesManagerEntry *entry = user_data;
-
- if (!visible && !GTK_WIDGET_HAS_FOCUS (GTK_WIDGET (entry->entry->canvas)))
- e_select_names_model_load_all_contacts (entry->model, entry->manager->completion_book, 0);
-#endif
-}
-
static void
completion_handler (EEntry *entry, ECompletionMatch *match)
{
ESelectNamesManagerEntry *mgr_entry;
ESelectNamesTextModel *text_model;
- EABDestination *dest;
+ EDestination *dest;
gint i, pos, start_pos, len;
if (match == NULL || match->user_data == NULL)
return;
mgr_entry = get_entry_info (entry);
- dest = EAB_DESTINATION (match->user_data);
+ dest = E_DESTINATION (match->user_data);
/* Sometimes I really long for garbage collection. Reference
counting makes you feel 31337, but sometimes it is just a
@@ -287,21 +231,6 @@ e_select_names_manager_entry_new (ESelectNamesManager *manager, ESelectNamesMode
G_CALLBACK (populate_popup_cb),
entry);
- g_signal_connect (entry->entry->canvas,
- "focus_in_event",
- G_CALLBACK (focus_in_cb),
- entry);
-
- g_signal_connect (entry->entry->canvas,
- "focus_out_event",
- G_CALLBACK (focus_out_cb),
- entry);
-
- g_signal_connect (entry->entry,
- "completion_popup",
- G_CALLBACK (completion_popup_cb),
- entry);
-
g_object_set_data (G_OBJECT (entry->entry), "entry_info", entry);
g_object_set_data (G_OBJECT (entry->entry), "select_names_model", model);
g_object_set_data (G_OBJECT (entry->entry), "select_names_text_model", text_model);
diff --git a/addressbook/gui/component/select-names/e-select-names-model.c b/addressbook/gui/component/select-names/e-select-names-model.c
index 74bda7a74b..506eb40124 100644
--- a/addressbook/gui/component/select-names/e-select-names-model.c
+++ b/addressbook/gui/component/select-names/e-select-names-model.c
@@ -41,7 +41,7 @@ struct _ESelectNamesModelPrivate {
gchar *id;
gchar *title;
- GList *data; /* of EABDestination */
+ GList *data; /* of EDestination */
gint limit;
@@ -157,12 +157,6 @@ e_select_names_model_changed (ESelectNamesModel *model)
}
}
-static void
-destination_changed_proxy (EABDestination *dest, gpointer closure)
-{
- e_select_names_model_changed (E_SELECT_NAMES_MODEL (closure));
-}
-
/** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** **/
ESelectNamesModel *
@@ -183,7 +177,7 @@ e_select_names_model_duplicate (ESelectNamesModel *old)
model->priv->title = g_strdup (old->priv->title);
for (iter = old->priv->data; iter != NULL; iter = g_list_next (iter)) {
- EABDestination *dup = eab_destination_copy (EAB_DESTINATION (iter->data));
+ EDestination *dup = e_destination_copy (E_DESTINATION (iter->data));
e_select_names_model_append (model, dup);
}
@@ -211,8 +205,8 @@ e_select_names_model_get_textification (ESelectNamesModel *model, const char *se
GList *iter = model->priv->data;
while (iter) {
- EABDestination *dest = EAB_DESTINATION (iter->data);
- strv[i] = (gchar *) eab_destination_get_textrep (dest, FALSE);
+ EDestination *dest = E_DESTINATION (iter->data);
+ strv[i] = (gchar *) e_destination_get_textrep (dest, FALSE);
++i;
iter = g_list_next (iter);
}
@@ -251,8 +245,8 @@ e_select_names_model_get_address_text (ESelectNamesModel *model, const char *sep
GList *iter = model->priv->data;
while (iter) {
- EABDestination *dest = EAB_DESTINATION (iter->data);
- strv[i] = (gchar *) eab_destination_get_address (dest);
+ EDestination *dest = E_DESTINATION (iter->data);
+ strv[i] = (gchar *) e_destination_get_address (dest);
if (strv[i])
++i;
iter = g_list_next (iter);
@@ -303,57 +297,51 @@ e_select_names_model_at_limit (ESelectNamesModel *model)
return model->priv->limit >= 0 && g_list_length (model->priv->data) >= model->priv->limit;
}
-const EABDestination *
+const EDestination *
e_select_names_model_get_destination (ESelectNamesModel *model, gint index)
{
g_return_val_if_fail (model && E_IS_SELECT_NAMES_MODEL (model), NULL);
g_return_val_if_fail (0 <= index, NULL);
g_return_val_if_fail (index < g_list_length (model->priv->data), NULL);
- return EAB_DESTINATION (g_list_nth_data (model->priv->data, index));
+ return E_DESTINATION (g_list_nth_data (model->priv->data, index));
}
gchar *
e_select_names_model_export_destinationv (ESelectNamesModel *model)
{
- EABDestination **destv;
+ EDestination **destv;
gchar *str;
gint i, len = 0;
GList *j;
g_return_val_if_fail (model && E_IS_SELECT_NAMES_MODEL (model), NULL);
len = g_list_length (model->priv->data);
- destv = g_new0 (EABDestination *, len+1);
+ destv = g_new0 (EDestination *, len+1);
for (i=0, j = model->priv->data; j != NULL; j = g_list_next (j)) {
- EABDestination *dest = EAB_DESTINATION (j->data);
+ EDestination *dest = E_DESTINATION (j->data);
if (dest)
destv[i++] = dest;
}
- str = eab_destination_exportv (destv);
+ str = e_destination_exportv (destv);
g_free (destv);
return str;
}
-static void send_changed (EABDestination *dest, EContact *contact, gpointer closure)
-{
- ESelectNamesModel *model = closure;
- e_select_names_model_changed (model);
-}
-
void
e_select_names_model_import_destinationv (ESelectNamesModel *model,
gchar *destinationv)
{
- EABDestination **destv;
+ EDestination **destv;
gint i;
g_return_if_fail (model && E_IS_SELECT_NAMES_MODEL (model));
- destv = eab_destination_importv (destinationv);
+ destv = e_destination_importv (destinationv);
e_select_names_model_delete_all (model);
@@ -361,7 +349,6 @@ e_select_names_model_import_destinationv (ESelectNamesModel *model,
return;
for (i = 0; destv[i]; i++) {
- eab_destination_use_contact (destv[i], send_changed, model);
e_select_names_model_append (model, destv[i]);
}
g_free (destv);
@@ -370,21 +357,21 @@ e_select_names_model_import_destinationv (ESelectNamesModel *model,
EContact *
e_select_names_model_get_contact (ESelectNamesModel *model, gint index)
{
- const EABDestination *dest;
+ const EDestination *dest;
g_return_val_if_fail (model && E_IS_SELECT_NAMES_MODEL (model), NULL);
g_return_val_if_fail (0 <= index, NULL);
g_return_val_if_fail (index < g_list_length (model->priv->data), NULL);
dest = e_select_names_model_get_destination (model, index);
- return dest ? eab_destination_get_contact (dest) : NULL;
+ return dest ? e_destination_get_contact (dest) : NULL;
}
const gchar *
e_select_names_model_get_string (ESelectNamesModel *model, gint index)
{
- const EABDestination *dest;
+ const EDestination *dest;
g_return_val_if_fail (model && E_IS_SELECT_NAMES_MODEL (model), NULL);
g_return_val_if_fail (0 <= index, NULL);
@@ -392,34 +379,19 @@ e_select_names_model_get_string (ESelectNamesModel *model, gint index)
dest = e_select_names_model_get_destination (model, index);
- return dest ? eab_destination_get_textrep (dest, FALSE) : "";
-}
-
-static void
-connect_destination (ESelectNamesModel *model, EABDestination *dest)
-{
- g_signal_connect (dest,
- "changed",
- G_CALLBACK (destination_changed_proxy),
- model);
-}
-
-static void
-disconnect_destination (ESelectNamesModel *model, EABDestination *dest)
-{
- g_signal_handlers_disconnect_by_func (dest, destination_changed_proxy, model);
+ return dest ? e_destination_get_textrep (dest, FALSE) : "";
}
gboolean
-e_select_names_model_contains (ESelectNamesModel *model, const EABDestination *dest)
+e_select_names_model_contains (ESelectNamesModel *model, const EDestination *dest)
{
GList *iter;
g_return_val_if_fail (E_IS_SELECT_NAMES_MODEL (model), FALSE);
- g_return_val_if_fail (EAB_IS_DESTINATION (dest), FALSE);
+ g_return_val_if_fail (E_IS_DESTINATION (dest), FALSE);
for (iter = model->priv->data; iter != NULL; iter = g_list_next (iter)) {
- if (iter->data != NULL && eab_destination_equal (dest, EAB_DESTINATION (iter->data)))
+ if (iter->data != NULL && e_destination_equal (dest, E_DESTINATION (iter->data)))
return TRUE;
}
@@ -427,12 +399,12 @@ e_select_names_model_contains (ESelectNamesModel *model, const EABDestination *d
}
void
-e_select_names_model_insert (ESelectNamesModel *model, gint index, EABDestination *dest)
+e_select_names_model_insert (ESelectNamesModel *model, gint index, EDestination *dest)
{
g_return_if_fail (model != NULL);
g_return_if_fail (E_IS_SELECT_NAMES_MODEL (model));
g_return_if_fail (0 <= index && index <= g_list_length (model->priv->data));
- g_return_if_fail (dest && EAB_IS_DESTINATION (dest));
+ g_return_if_fail (dest && E_IS_DESTINATION (dest));
if (e_select_names_model_at_limit (model)) {
/* FIXME: This is bad. */
@@ -440,8 +412,6 @@ e_select_names_model_insert (ESelectNamesModel *model, gint index, EABDestinatio
return;
}
- connect_destination (model, dest);
-
model->priv->data = g_list_insert (model->priv->data, dest, index);
g_object_ref (dest);
@@ -450,10 +420,10 @@ e_select_names_model_insert (ESelectNamesModel *model, gint index, EABDestinatio
}
void
-e_select_names_model_append (ESelectNamesModel *model, EABDestination *dest)
+e_select_names_model_append (ESelectNamesModel *model, EDestination *dest)
{
g_return_if_fail (model && E_IS_SELECT_NAMES_MODEL (model));
- g_return_if_fail (dest && EAB_IS_DESTINATION (dest));
+ g_return_if_fail (dest && E_IS_DESTINATION (dest));
if (e_select_names_model_at_limit (model)) {
/* FIXME: This is bad. */
@@ -461,8 +431,6 @@ e_select_names_model_append (ESelectNamesModel *model, EABDestination *dest)
return;
}
- connect_destination (model, dest);
-
model->priv->data = g_list_append (model->priv->data, dest);
g_object_ref (dest);
@@ -471,7 +439,7 @@ e_select_names_model_append (ESelectNamesModel *model, EABDestination *dest)
}
void
-e_select_names_model_replace (ESelectNamesModel *model, gint index, EABDestination *dest)
+e_select_names_model_replace (ESelectNamesModel *model, gint index, EDestination *dest)
{
GList *node;
const gchar *new_str, *old_str;
@@ -480,15 +448,13 @@ e_select_names_model_replace (ESelectNamesModel *model, gint index, EABDestinati
g_return_if_fail (model != NULL);
g_return_if_fail (E_IS_SELECT_NAMES_MODEL (model));
g_return_if_fail (model->priv->data == NULL || (0 <= index && index < g_list_length (model->priv->data)));
- g_return_if_fail (dest && EAB_IS_DESTINATION (dest));
+ g_return_if_fail (dest && E_IS_DESTINATION (dest));
- new_str = eab_destination_get_textrep (dest, FALSE);
+ new_str = e_destination_get_textrep (dest, FALSE);
new_strlen = new_str ? strlen (new_str) : 0;
if (model->priv->data == NULL) {
- connect_destination (model, dest);
-
model->priv->data = g_list_append (model->priv->data, dest);
g_object_ref (dest);
@@ -498,10 +464,7 @@ e_select_names_model_replace (ESelectNamesModel *model, gint index, EABDestinati
if (node->data != dest) {
- disconnect_destination (model, EAB_DESTINATION (node->data));
- connect_destination (model, dest);
-
- old_str = eab_destination_get_textrep (EAB_DESTINATION (node->data), FALSE);
+ old_str = e_destination_get_textrep (E_DESTINATION (node->data), FALSE);
old_strlen = old_str ? strlen (old_str) : 0;
g_object_unref (node->data);
@@ -521,16 +484,15 @@ void
e_select_names_model_delete (ESelectNamesModel *model, gint index)
{
GList *node;
- EABDestination *dest;
+ EDestination *dest;
g_return_if_fail (model != NULL);
g_return_if_fail (E_IS_SELECT_NAMES_MODEL (model));
g_return_if_fail (0 <= index && index < g_list_length (model->priv->data));
node = g_list_nth (model->priv->data, index);
- dest = EAB_DESTINATION (node->data);
+ dest = E_DESTINATION (node->data);
- disconnect_destination (model, dest);
g_object_unref (dest);
model->priv->data = g_list_remove_link (model->priv->data, node);
@@ -550,20 +512,18 @@ e_select_names_model_clean (ESelectNamesModel *model, gboolean clean_last_entry)
iter = model->priv->data;
while (iter) {
- EABDestination *dest;
+ EDestination *dest;
next = g_list_next (iter);
if (next == NULL && !clean_last_entry)
break;
- dest = iter->data ? EAB_DESTINATION (iter->data) : NULL;
+ dest = iter->data ? E_DESTINATION (iter->data) : NULL;
- if (dest == NULL || eab_destination_is_empty (dest)) {
- if (dest) {
- disconnect_destination (model, dest);
+ if (dest == NULL || e_destination_empty (dest)) {
+ if (dest)
g_object_unref (dest);
- }
model->priv->data = g_list_remove_link (model->priv->data, iter);
g_list_free_1 (iter);
changed = TRUE;
@@ -576,19 +536,12 @@ e_select_names_model_clean (ESelectNamesModel *model, gboolean clean_last_entry)
e_select_names_model_changed (model);
}
-static void
-delete_all_iter (gpointer data, gpointer closure)
-{
- disconnect_destination (E_SELECT_NAMES_MODEL (closure), EAB_DESTINATION (data));
- g_object_unref (data);
-}
-
void
e_select_names_model_delete_all (ESelectNamesModel *model)
{
g_return_if_fail (model != NULL && E_IS_SELECT_NAMES_MODEL (model));
- g_list_foreach (model->priv->data, delete_all_iter, model);
+ g_list_foreach (model->priv->data, (GFunc)g_object_unref, model);
g_list_free (model->priv->data);
model->priv->data = NULL;
@@ -609,9 +562,9 @@ e_select_names_model_overwrite_copy (ESelectNamesModel *dest, ESelectNamesModel
e_select_names_model_delete_all (dest);
len = e_select_names_model_count (src);
for (i = 0; i < len; ++i) {
- const EABDestination *d = e_select_names_model_get_destination (src, i);
+ const EDestination *d = e_select_names_model_get_destination (src, i);
if (d)
- e_select_names_model_append (dest, eab_destination_copy (d));
+ e_select_names_model_append (dest, e_destination_copy (d));
}
}
@@ -628,9 +581,9 @@ e_select_names_model_merge (ESelectNamesModel *dest, ESelectNamesModel *src)
len = e_select_names_model_count (src);
for (i = 0; i < len; ++i) {
- const EABDestination *d = e_select_names_model_get_destination (src, i);
+ const EDestination *d = e_select_names_model_get_destination (src, i);
if (d && !e_select_names_model_contains (dest, d))
- e_select_names_model_append (dest, eab_destination_copy (d));
+ e_select_names_model_append (dest, e_destination_copy (d));
}
}
@@ -648,7 +601,7 @@ e_select_names_model_name_pos (ESelectNamesModel *model, gint seplen, gint index
iter = model->priv->data;
while (iter && i <= index) {
rp += len + (i > 0 ? seplen : 0);
- str = eab_destination_get_textrep (EAB_DESTINATION (iter->data), FALSE);
+ str = e_destination_get_textrep (E_DESTINATION (iter->data), FALSE);
len = str ? g_utf8_strlen (str, -1) : 0;
++i;
iter = g_list_next (iter);
@@ -678,7 +631,7 @@ e_select_names_model_text_pos (ESelectNamesModel *model, gint seplen, gint pos,
iter = model->priv->data;
while (iter != NULL) {
- str = eab_destination_get_textrep (EAB_DESTINATION (iter->data), FALSE);
+ str = e_destination_get_textrep (E_DESTINATION (iter->data), FALSE);
len = str ? g_utf8_strlen (str, -1) : 0;
if (sp <= pos && pos <= sp + len + adj) {
@@ -717,39 +670,6 @@ e_select_names_model_text_pos (ESelectNamesModel *model, gint seplen, gint pos,
}
void
-e_select_names_model_load_all_contacts (ESelectNamesModel *model, EBook *book)
-{
- GList *iter;
-
- g_return_if_fail (E_IS_SELECT_NAMES_MODEL (model));
- g_return_if_fail (book == NULL || E_IS_BOOK (book));
-
- for (iter = model->priv->data; iter != NULL; iter = g_list_next (iter)) {
- EABDestination *dest = EAB_DESTINATION (iter->data);
- if (!eab_destination_is_empty (dest)) {
-
- eab_destination_load_contact (dest, book);
- }
- }
-}
-
-void
-e_select_names_model_cancel_all_contact_load (ESelectNamesModel *model)
-{
- GList *iter;
-
- g_return_if_fail (E_IS_SELECT_NAMES_MODEL (model));
-
- for (iter = model->priv->data; iter != NULL; iter = g_list_next (iter)) {
- EABDestination *dest = EAB_DESTINATION (iter->data);
- if (!eab_destination_is_empty (dest)) {
-
- eab_destination_cancel_contact_load (dest);
- }
- }
-}
-
-void
e_select_names_model_freeze (ESelectNamesModel *model)
{
g_return_if_fail (E_IS_SELECT_NAMES_MODEL (model));
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 0d21ee86b3..8bb8e3778b 100644
--- a/addressbook/gui/component/select-names/e-select-names-model.h
+++ b/addressbook/gui/component/select-names/e-select-names-model.h
@@ -16,7 +16,7 @@
#include <stdio.h>
#include <e-util/e-list.h>
#include <libebook/e-contact.h>
-#include <addressbook/util/eab-destination.h>
+#include <addressbook/util/e-destination.h>
#define E_TYPE_SELECT_NAMES_MODEL (e_select_names_model_get_type ())
#define E_SELECT_NAMES_MODEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_SELECT_NAMES_MODEL, ESelectNamesModel))
@@ -54,18 +54,18 @@ gint e_select_names_model_get_limit (ESelectNamesModel
void e_select_names_model_set_limit (ESelectNamesModel *model, gint limit);
gboolean e_select_names_model_at_limit (ESelectNamesModel *model);
-const EABDestination *e_select_names_model_get_destination (ESelectNamesModel *model, gint index);
+const EDestination *e_select_names_model_get_destination (ESelectNamesModel *model, gint index);
gchar *e_select_names_model_export_destinationv (ESelectNamesModel *model);
void e_select_names_model_import_destinationv (ESelectNamesModel *model,
gchar *destinationv);
EContact *e_select_names_model_get_contact (ESelectNamesModel *model, gint index);
const gchar *e_select_names_model_get_string (ESelectNamesModel *model, gint index);
-gboolean e_select_names_model_contains (ESelectNamesModel *model, const EABDestination *dest);
+gboolean e_select_names_model_contains (ESelectNamesModel *model, const EDestination *dest);
-void e_select_names_model_insert (ESelectNamesModel *model, gint index, EABDestination *dest);
-void e_select_names_model_append (ESelectNamesModel *model, EABDestination *dest);
-void e_select_names_model_replace (ESelectNamesModel *model, gint index, EABDestination *dest);
+void e_select_names_model_insert (ESelectNamesModel *model, gint index, EDestination *dest);
+void e_select_names_model_append (ESelectNamesModel *model, 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);
void e_select_names_model_overwrite_copy (ESelectNamesModel *dest, ESelectNamesModel *src);
@@ -76,9 +76,6 @@ void e_select_names_model_clean (ESelectNamesModel *model, gboolea
void e_select_names_model_name_pos (ESelectNamesModel *model, gint seplen, gint index, gint *pos, gint *length);
void e_select_names_model_text_pos (ESelectNamesModel *model, gint seplen, gint pos, gint *index, gint *start_pos, gint *length);
-void e_select_names_model_load_all_contacts (ESelectNamesModel *model, EBook *book);
-void e_select_names_model_cancel_all_contact_load (ESelectNamesModel *model);
-
/* This is a mildly annoying freeze/thaw pair, in that it only applies to the 'changed'
signal and not to 'resized'. This could cause unexpected results in some cases. */
void e_select_names_model_freeze (ESelectNamesModel *model);
diff --git a/addressbook/gui/component/select-names/e-select-names-popup.c b/addressbook/gui/component/select-names/e-select-names-popup.c
index eb7c7c5e88..0ad6fda909 100644
--- a/addressbook/gui/component/select-names/e-select-names-popup.c
+++ b/addressbook/gui/component/select-names/e-select-names-popup.c
@@ -36,7 +36,6 @@
#include <gtk/gtkcheckmenuitem.h>
#include <gtk/gtkradiomenuitem.h>
#include <gtk/gtkseparatormenuitem.h>
-#include <gtk/gtklabel.h>
#include <libgnome/gnome-i18n.h>
#include <addressbook/util/eab-book-util.h>
@@ -52,13 +51,13 @@
typedef struct _PopupInfo PopupInfo;
struct _PopupInfo {
ESelectNamesTextModel *text_model;
- EABDestination *dest;
+ EDestination *dest;
gint pos;
gint index;
};
static PopupInfo *
-popup_info_new (ESelectNamesTextModel *text_model, EABDestination *dest, gint pos, gint index)
+popup_info_new (ESelectNamesTextModel *text_model, EDestination *dest, gint pos, gint index)
{
PopupInfo *info = g_new0 (PopupInfo, 1);
info->text_model = text_model;
@@ -105,10 +104,10 @@ static void
make_contact_editor_cb (EBook *book, gpointer user_data)
{
if (book) {
- EABDestination *dest = EAB_DESTINATION (user_data);
+ EDestination *dest = E_DESTINATION (user_data);
EContact *contact;
- contact = (EContact *) eab_destination_get_contact (dest);
+ contact = (EContact *) e_destination_get_contact (dest);
if (e_contact_get (contact, E_CONTACT_IS_LIST)) {
EContactListEditor *ce;
ce = e_addressbook_show_contact_list_editor (book, contact, FALSE, TRUE);
@@ -140,7 +139,7 @@ change_email_num_cb (GtkWidget *w, gpointer user_data)
{
PopupInfo *info = (PopupInfo *) user_data;
gint n;
- EABDestination *dest;
+ EDestination *dest;
if (info == NULL)
return;
@@ -150,9 +149,9 @@ change_email_num_cb (GtkWidget *w, gpointer user_data)
n = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (w), "number"));
- if (n != eab_destination_get_email_num (info->dest)) {
- dest = eab_destination_new ();
- eab_destination_set_contact (dest, eab_destination_get_contact (info->dest), n);
+ if (n != e_destination_get_email_num (info->dest)) {
+ dest = e_destination_new ();
+ e_destination_set_contact (dest, e_destination_get_contact (info->dest), n);
e_select_names_model_replace (info->text_model->source, info->index, dest);
}
}
@@ -177,7 +176,7 @@ toggle_html_mail_cb (GtkWidget *w, gpointer user_data)
{
PopupInfo *info = (PopupInfo *) user_data;
GtkCheckMenuItem *item = GTK_CHECK_MENU_ITEM (w);
- const EABDestination *dest;
+ const EDestination *dest;
if (info == NULL)
return;
@@ -185,7 +184,7 @@ toggle_html_mail_cb (GtkWidget *w, gpointer user_data)
dest = info->dest;
item = GTK_CHECK_MENU_ITEM (item);
- eab_destination_set_html_mail_pref ((EABDestination *) dest, item->active);
+ e_destination_set_html_mail_pref ((EDestination *) dest, item->active);
}
#endif
@@ -197,7 +196,7 @@ populate_popup_contact (GtkWidget *pop, gboolean list, PopupInfo *info)
GtkWidget *menuitem;
GList *email_list;
- contact = eab_destination_get_contact (info->dest);
+ contact = e_destination_get_contact (info->dest);
#if TOO_MANY_MENU_ITEMS
menuitem = gtk_separator_menu_item_new();
@@ -227,7 +226,7 @@ populate_popup_contact (GtkWidget *pop, gboolean list, PopupInfo *info)
menuitem = gtk_check_menu_item_new_with_label (_("Send HTML Mail?"));
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menuitem),
- eab_destination_get_html_mail_pref (info->dest));
+ e_destination_get_html_mail_pref (info->dest));
g_signal_connect (menuitem, "toggled",
G_CALLBACK (toggle_html_mail_cb),
info);
@@ -245,23 +244,14 @@ populate_popup_contact (GtkWidget *pop, gboolean list, PopupInfo *info)
if (g_list_length (email_list) > 1) {
GList *l;
GSList *radiogroup = NULL;
- gint n = eab_destination_get_email_num (info->dest);
+ gint n = e_destination_get_email_num (info->dest);
gint j = g_list_length (email_list) - 1;
for (l = g_list_last (email_list); l; l = l->prev) {
char *email = l->data;
char *label = NULL;
- if (!strncmp (email, "<?xml", 5)) {
- EABDestination *dest = eab_destination_import (email);
- if (dest) {
- label = g_strdup (eab_destination_get_textrep (dest, TRUE));
- g_object_unref (dest);
- }
- }
- else {
- label = g_strdup (email);
- }
+ label = g_strdup (email);
if (list) {
menuitem = gtk_menu_item_new_with_label (label);
@@ -286,7 +276,7 @@ populate_popup_contact (GtkWidget *pop, gboolean list, PopupInfo *info)
g_free (label);
}
} else {
- menuitem = gtk_menu_item_new_with_label (eab_destination_get_email (info->dest));
+ menuitem = gtk_menu_item_new_with_label (e_destination_get_email (info->dest));
gtk_widget_show (menuitem);
gtk_menu_shell_prepend (GTK_MENU_SHELL (pop), menuitem);
}
@@ -303,7 +293,7 @@ populate_popup_contact (GtkWidget *pop, gboolean list, PopupInfo *info)
? EVOLUTION_IMAGESDIR "/" LIST_ICON_FILENAME
: EVOLUTION_IMAGESDIR "/" CONTACT_ICON_FILENAME);
gtk_widget_show (image);
- menuitem = gtk_image_menu_item_new_with_label (eab_destination_get_name (info->dest));
+ menuitem = gtk_image_menu_item_new_with_label (e_destination_get_name (info->dest));
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menuitem),
image);
gtk_widget_show (menuitem);
@@ -314,7 +304,7 @@ static void
quick_add_cb (GtkWidget *w, gpointer user_data)
{
PopupInfo *info = (PopupInfo *) user_data;
- e_contact_quick_add_free_form (eab_destination_get_address (info->dest), NULL, NULL);
+ e_contact_quick_add_free_form (e_destination_get_address (info->dest), NULL, NULL);
}
static void
@@ -337,7 +327,7 @@ populate_popup_nocontact (GtkWidget *pop, PopupInfo *info)
#if TOO_MANY_MENU_ITEMS
menuitem = gtk_check_menu_item_new_with_label (_("Send HTML Mail?"));
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menuitem),
- eab_destination_get_html_mail_pref (info->dest));
+ e_destination_get_html_mail_pref (info->dest));
g_signal_connect (menuitem, "toggled",
G_CALLBACK (toggle_html_mail_cb),
info);
@@ -349,9 +339,9 @@ populate_popup_nocontact (GtkWidget *pop, PopupInfo *info)
gtk_widget_show (menuitem);
gtk_menu_shell_prepend (GTK_MENU_SHELL (pop), menuitem);
- str = eab_destination_get_name (info->dest);
+ str = e_destination_get_name (info->dest);
if (! (str && *str))
- str = eab_destination_get_email (info->dest);
+ str = e_destination_get_email (info->dest);
if (! (str && *str))
str = _("Unnamed Contact");
@@ -366,7 +356,7 @@ e_select_names_populate_popup (GtkWidget *menu, ESelectNamesTextModel *text_mode
{
ESelectNamesModel *model;
PopupInfo *info;
- EABDestination *dest;
+ EDestination *dest;
gint index;
g_return_if_fail (GTK_IS_MENU_SHELL (menu));
@@ -381,14 +371,14 @@ e_select_names_populate_popup (GtkWidget *menu, ESelectNamesTextModel *text_mode
return;
/* XXX yuck, why does this return a const? */
- dest = (EABDestination *)e_select_names_model_get_destination (model, index);
- if (eab_destination_is_empty (dest))
+ dest = (EDestination *)e_select_names_model_get_destination (model, index);
+ if (e_destination_empty (dest))
return;
info = popup_info_new (text_model, dest, pos, index);
- if (eab_destination_get_contact (dest)) {
- populate_popup_contact (menu, eab_destination_is_evolution_list (dest), info);
+ if (e_destination_get_contact (dest)) {
+ populate_popup_contact (menu, e_destination_is_evolution_list (dest), info);
} else {
populate_popup_nocontact (menu, info);
}
diff --git a/addressbook/gui/component/select-names/e-select-names-table-model.c b/addressbook/gui/component/select-names/e-select-names-table-model.c
index 4ff3e3c41a..0072e7d9fd 100644
--- a/addressbook/gui/component/select-names/e-select-names-table-model.c
+++ b/addressbook/gui/component/select-names/e-select-names-table-model.c
@@ -117,8 +117,8 @@ fill_in_info (ESelectNamesTableModel *model)
model->data = g_new(ESelectNamesTableModelData, count);
for (i = 0; i < count; ++i) {
- const EABDestination *dest = e_select_names_model_get_destination (model->source, i);
- EContact *contact = dest ? eab_destination_get_contact (dest) : NULL;
+ const EDestination *dest = e_select_names_model_get_destination (model->source, i);
+ EContact *contact = dest ? e_destination_get_contact (dest) : NULL;
if (contact) {
model->data[i].name = e_contact_get(contact, E_CONTACT_FILE_AS);
@@ -128,8 +128,8 @@ fill_in_info (ESelectNamesTableModel *model)
if (model->data[i].email == 0)
model->data[i].email = g_strdup("");
} else {
- const gchar *name = eab_destination_get_name (dest);
- const gchar *email = eab_destination_get_email (dest);
+ const gchar *name = e_destination_get_name (dest);
+ const gchar *email = e_destination_get_email (dest);
model->data[i].name = g_strdup (name && *name ? name : email);
model->data[i].email = g_strdup (email);
diff --git a/addressbook/gui/component/select-names/e-select-names-text-model.c b/addressbook/gui/component/select-names/e-select-names-text-model.c
index e885de5bf6..c207e02d79 100644
--- a/addressbook/gui/component/select-names/e-select-names-text-model.c
+++ b/addressbook/gui/component/select-names/e-select-names-text-model.c
@@ -372,9 +372,9 @@ e_select_names_text_model_insert_length (ETextModel *model, gint pos, const gcha
/* Is this a quoted or an unquoted separator we are dealing with? */
if (ut == g_utf8_get_char(text_model->sep) && index >= 0) {
- const EABDestination *dest = e_select_names_model_get_destination (source, index);
+ const EDestination *dest = e_select_names_model_get_destination (source, index);
if (dest) {
- const gchar *str = eab_destination_get_textrep (dest, FALSE);
+ const gchar *str = e_destination_get_textrep (dest, FALSE);
int j;
const char *jp;
@@ -400,8 +400,8 @@ e_select_names_text_model_insert_length (ETextModel *model, gint pos, const gcha
if (index == -1) {
EReposAbsolute repos;
- e_select_names_model_insert (source, 0, eab_destination_new ());
- e_select_names_model_insert (source, 0, eab_destination_new ());
+ e_select_names_model_insert (source, 0, e_destination_new ());
+ e_select_names_model_insert (source, 0, e_destination_new ());
repos.model = model;
repos.pos = -1; /* At end */
@@ -420,7 +420,7 @@ e_select_names_text_model_insert_length (ETextModel *model, gint pos, const gcha
(e_select_names_model_get_string (source, ins_point) == NULL))
|| (ins_point > 0 && (e_select_names_model_get_string (source, ins_point-1) == NULL)))) {
- e_select_names_model_insert (source, ins_point, eab_destination_new ());
+ e_select_names_model_insert (source, ins_point, e_destination_new ());
repos.model = model;
repos.pos = pos;
@@ -435,10 +435,10 @@ e_select_names_text_model_insert_length (ETextModel *model, gint pos, const gcha
const gchar *str = e_select_names_model_get_string (source, index);
gchar *str1 = g_strndup (str, offset);
gchar *str2 = g_strdup (str+offset);
- EABDestination *d1 = eab_destination_new (), *d2 = eab_destination_new ();
+ EDestination *d1 = e_destination_new (), *d2 = e_destination_new ();
- eab_destination_set_raw (d1, str1);
- eab_destination_set_raw (d2, str2);
+ e_destination_set_raw (d1, str1);
+ e_destination_set_raw (d2, str2);
e_select_names_model_replace (source, index, d1);
e_select_names_model_insert (source, index+1, d2);
@@ -498,12 +498,10 @@ e_select_names_text_model_insert_length (ETextModel *model, gint pos, const gcha
if (new_str->len) {
- EABDestination *dest;
- dest = index >= 0 ? eab_destination_copy (e_select_names_model_get_destination (source, index)) : eab_destination_new ();
- eab_destination_set_raw (dest, new_str->str);
+ EDestination *dest;
+ dest = e_destination_new ();
+ e_destination_set_raw (dest, new_str->str);
e_select_names_model_replace (source, index, dest);
-
- /* e_select_names_model_replace (source, index, dest); */
if (this_length > 0) {
repos.model = model;
@@ -589,7 +587,7 @@ e_select_names_text_model_delete (ETextModel *model, gint pos, gint length)
if (index+1 < e_select_names_model_count (source)) {
EReposDeleteShift repos;
- EABDestination *new_dest;
+ EDestination *new_dest;
const gchar *str1 = e_select_names_model_get_string (source, index);
const gchar *str2 = e_select_names_model_get_string (source, index+1);
gchar *new_str;
@@ -613,8 +611,8 @@ e_select_names_text_model_delete (ETextModel *model, gint pos, gint length)
e_select_names_model_delete (source, index+1);
- new_dest = eab_destination_new ();
- eab_destination_set_raw (new_dest, new_str);
+ new_dest = e_destination_new ();
+ e_destination_set_raw (new_dest, new_str);
e_select_names_model_replace (source, index, new_dest);
g_free (new_str);
@@ -689,7 +687,7 @@ e_select_names_text_model_delete (ETextModel *model, gint pos, gint length)
char *np;
int i;
EReposDeleteShift repos;
- EABDestination *dest;
+ EDestination *dest;
new_str = g_new0 (char, strlen (str) * 6 + 1); /* worse case it can't be any longer than this */
@@ -718,8 +716,8 @@ e_select_names_text_model_delete (ETextModel *model, gint pos, gint length)
np = g_utf8_next_char (np);
}
- dest = index >= 0 ? eab_destination_copy (e_select_names_model_get_destination (source, index)) : eab_destination_new ();
- eab_destination_set_raw (dest, new_str);
+ dest = e_destination_new ();
+ e_destination_set_raw (dest, new_str);
e_select_names_model_replace (source, index, dest);
if (out)
@@ -764,10 +762,10 @@ e_select_names_text_model_obj_count (ETextModel *model)
count = i = e_select_names_model_count (source);
while (i > 0) {
- const EABDestination *dest;
+ const EDestination *dest;
--i;
dest = e_select_names_model_get_destination (source, i);
- if (eab_destination_get_contact (dest) == NULL)
+ if (e_destination_get_contact (dest) == NULL)
--count;
}
@@ -783,8 +781,8 @@ nth_obj_index (ESelectNamesModel *source, gint n)
N = e_select_names_model_count (source);
do {
- const EABDestination *dest = e_select_names_model_get_destination (source, i);
- if (eab_destination_get_contact (dest))
+ const EDestination *dest = e_select_names_model_get_destination (source, i);
+ if (e_destination_get_contact (dest))
--n;
++i;
} while (n >= 0 && i < N);
diff --git a/addressbook/gui/component/select-names/e-select-names.c b/addressbook/gui/component/select-names/e-select-names.c
index cd8a2141f3..94ccef34c8 100644
--- a/addressbook/gui/component/select-names/e-select-names.c
+++ b/addressbook/gui/component/select-names/e-select-names.c
@@ -21,7 +21,10 @@
#include <config.h>
#include <string.h>
#include <glib.h>
-#include <gtk/gtk.h>
+#include <gtk/gtkalignment.h>
+#include <gtk/gtkentry.h>
+#include <gtk/gtklabel.h>
+#include <gtk/gtkstock.h>
#include <libgnome/gnome-i18n.h>
#include <gal/e-table/e-table-simple.h>
@@ -214,7 +217,7 @@ real_add_address_cb (int model_row, gpointer closure)
ESelectNamesChild *child = closure;
ESelectNames *names = child->names;
const EContact *contact;
- EABDestination *dest = eab_destination_new ();
+ EDestination *dest = e_destination_new ();
gint mapped_row;
mapped_row = e_table_subset_view_to_model_row (E_TABLE_SUBSET (names->without), model_row);
@@ -222,7 +225,7 @@ real_add_address_cb (int model_row, gpointer closure)
contact = eab_model_contact_at (EAB_MODEL(names->model), mapped_row);
if (contact != NULL) {
- eab_destination_set_contact (dest, (EContact*)contact, 0);
+ e_destination_set_contact (dest, (EContact*)contact, 0);
e_select_names_model_append (child->source, dest);
e_select_names_model_clean (child->source, FALSE);