diff options
author | Chris Toshok <toshok@ximian.com> | 2004-04-10 01:29:51 +0800 |
---|---|---|
committer | Chris Toshok <toshok@src.gnome.org> | 2004-04-10 01:29:51 +0800 |
commit | e68394b0d08bd873b39829da8a54ba08177b76e8 (patch) | |
tree | 2ad52a40cb1cd9912e883fe96a9055ed8faaa14a /addressbook/gui/component/select-names | |
parent | 97634e4d349969c7309b96cdbd4466d743ee9afb (diff) | |
download | gsoc2013-evolution-e68394b0d08bd873b39829da8a54ba08177b76e8.tar.gz gsoc2013-evolution-e68394b0d08bd873b39829da8a54ba08177b76e8.tar.zst gsoc2013-evolution-e68394b0d08bd873b39829da8a54ba08177b76e8.zip |
use the new e_destination_export_to_vcard_attribute call to build up the
2004-04-09 Chris Toshok <toshok@ximian.com>
* importers/evolution-ldif-importer.c (resolve_list_card): use the
new e_destination_export_to_vcard_attribute call to build up the
attributes.
* importers/evolution-vcard-importer.c (process_item_fn): if we're
importing a vcard that we wrote out previously containing xml in
the EMAIL attributes, DTRT and strip it out and use
e_destination_export_to_vcard_attribute to build up the proper
attribute.
* util/Makefile.am (libeabutil_la_SOURCES): remove
eab-destination.[ch] and add e-destination.[ch].
* printing/e-contact-print.c (e_contact_print_contact): we don't
have to worry about the "<?xml..." EMAIL fields anymore.
* gui/widgets/eab-gui-util.c (eab_send_contact_list): just use the
value as the address (since that's what it is) in the list case.
* gui/widgets/eab-contact-display.c (render_contact_list): remove
the EABDestination stuff from here.
(eab_contact_display_render_compact): same.
* gui/widgets/e-minicard.c (activiate_editor): fix warnings - use
EAB_EDITOR instead of G_OBJECT.
(add_field): we don't have to worry about the "<?xml..." EMAIL
fields anymore.
(remodel): same.
* gui/widgets/e-addressbook-treeview-adapter.c
(adapter_get_value): we don't have to worry about the "<?xml..."
EMAIL fields anymore.
* gui/widgets/e-addressbook-table-adapter.c
(addressbook_value_at): we don't have to worry about the
"<?xml..." EMAIL fields anymore.
* gui/contact-list-editor/e-contact-list-model.c
(contact_list_value_at): eab->e.
(contact_list_model_dispose): we're not a GtkObject, we're a
GObject. rename _destroy to _dispose, and chain up to the parent
class's ::dispose.
(e_contact_list_model_class_init): GtkObject -> GObject, and
destroy -> dispose.
(e_contact_list_model_init): GtkObject -> GObject, and EAB -> E.
(e_contact_list_model_add_destination): EAB -> E.
(e_contact_list_model_add_email): same.
(e_contact_list_model_add_contact): same.
(e_contact_list_model_get_destination): same.
* gui/contact-list-editor/e-contact-list-editor.c
(table_drag_data_received_cb): add email num arg to
e_contact_list_model_add_contact.
(extract_info): fill in the vcard attributes instead of just
generating xml.
(fill_in_info): extract the values from the vcard attributes.
* gui/component/select-names/e-select-names-text-model.c
(e_select_names_text_model_insert_length): eab->e, and don't
sometimes copy, sometimes ::new. always ::new.
(e_select_names_text_model_delete): same.
(e_select_names_text_model_obj_count): same.
(nth_obj_index): same.
* gui/component/select-names/e-select-names-table-model.c
(fill_in_info): eab -> e.
* gui/component/select-names/e-select-names-popup.c
(make_contact_editor_cb): eab -> e.
(change_email_num_cb): same.
(toggle_html_mail_cb): same.
(populate_popup_contact): same, and remove code that checks for
<?xml, then imports the EDestination.
(quick_add_cb): eab -> e.
(populate_popup_nocontact): same.
(e_select_names_populate_popup): same.
* gui/component/select-names/e-select-names-model.h: eab -> e, and
remove prototypes for nuked functions.
* gui/component/select-names/e-select-names-model.c
(destination_changed_proxy, send_changed, connect_destination,
disconnect_destination): nuke.
(e_select_names_model_duplicate): EAB -> E.
(e_select_names_model_get_textification): same.
(e_select_names_model_get_address_text): same.
(e_select_names_model_get_destination): same.
(e_select_names_model_export_destinationv): same.
(send_changed): same.
(e_select_names_model_import_destinationv): same.
(e_select_names_model_get_contact): same.
(e_select_names_model_contains): same.
(e_select_names_model_insert): same, and remove call to
connect_destination.
(e_select_names_model_append): same.
(e_select_names_model_replace): same, and remove call to
disconnect/connect_destination.
(e_select_names_model_delete): same.
(delete_all_iter): nuke.
(e_select_names_model_delete_all): use g_object_unref for the
foreach call.
(e_select_names_model_merge): EAB -> E.
(e_select_names_model_name_pos): same.
(e_select_names_model_name_pos): same.
(e_select_names_model_load_all_contacts): nuke.
(e_select_names_model_cancel_all_contact_load): nuke.
* gui/component/select-names/e-select-names-manager.c
(clean_cb, focus_in_cb, focus_out_cb, completion_popup_cb): nuke.
(completion_handler): EAB -> E, and the signals are gone.
* gui/component/select-names/e-select-names-completion.c: in
general, s/eab_dest/e_dest and s/EABDest/EDest.
(e_select_names_completion_got_book_view_cb): move the
e_book_view_start to below the assignment of
sequence_complete_received, just to put my mind at ease.
(e_select_names_completion_stop_query): un-#if notyet the call to
e_book_cancel.
(e_select_names_completion_start_query): free the waiting_query
before assigning to it.
* gui/component/select-names/e-select-names-bonobo.c
(entry_set_property_fn): remove calls to
e_select_names_model_load_all_contacts, since that function is
dead.
* gui/component/addressbook-migrate.c (setup_progress_dialog):
take the label to display to the user as an arg.
(migrate_contact_lists_for_local_folders): loop over all contacts
in all local addressbooks looking for ones that have <?xml in
their EMAIL attributes. for the ones we find, call
e_destination_export_to_vcard_attribute to build up the proper
attribute.
(addressbook_migrate): add in a clause for all versions under
1.5.7 to convert contact lists. also, move the unrefs of the
sources/groups to outside the if, as they're created outside it.
* gui/component/Makefile.am (INCLUDES): remove the
addressbook/backend/ dirs, since libebook isn't there anymore
(nothing is, actually). Add addressbook/util/.
svn path=/trunk/; revision=25390
Diffstat (limited to 'addressbook/gui/component/select-names')
9 files changed, 145 insertions, 313 deletions
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); |