aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui/component/select-names/e-select-names-completion.c
diff options
context:
space:
mode:
authorChris Toshok <toshok@ximian.com>2004-04-10 01:29:51 +0800
committerChris Toshok <toshok@src.gnome.org>2004-04-10 01:29:51 +0800
commite68394b0d08bd873b39829da8a54ba08177b76e8 (patch)
tree2ad52a40cb1cd9912e883fe96a9055ed8faaa14a /addressbook/gui/component/select-names/e-select-names-completion.c
parent97634e4d349969c7309b96cdbd4466d743ee9afb (diff)
downloadgsoc2013-evolution-e68394b0d08bd873b39829da8a54ba08177b76e8.tar
gsoc2013-evolution-e68394b0d08bd873b39829da8a54ba08177b76e8.tar.gz
gsoc2013-evolution-e68394b0d08bd873b39829da8a54ba08177b76e8.tar.bz2
gsoc2013-evolution-e68394b0d08bd873b39829da8a54ba08177b76e8.tar.lz
gsoc2013-evolution-e68394b0d08bd873b39829da8a54ba08177b76e8.tar.xz
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/e-select-names-completion.c')
-rw-r--r--addressbook/gui/component/select-names/e-select-names-completion.c79
1 files changed, 38 insertions, 41 deletions
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);
-
}
}