diff options
author | Jon Trowbridge <trow@ximian.com> | 2001-06-30 13:23:09 +0800 |
---|---|---|
committer | Jon Trowbridge <trow@src.gnome.org> | 2001-06-30 13:23:09 +0800 |
commit | 7c5dd95cd7aefa8243edac3c67bf1910fc905c4e (patch) | |
tree | 5c8dc3c28a6bac7d3e1643e9cdcfb0b75f28ebbc /addressbook/gui/component/select-names | |
parent | c187a911c8926429946cc385fd5f7c8f0932d3e3 (diff) | |
download | gsoc2013-evolution-7c5dd95cd7aefa8243edac3c67bf1910fc905c4e.tar.gz gsoc2013-evolution-7c5dd95cd7aefa8243edac3c67bf1910fc905c4e.tar.zst gsoc2013-evolution-7c5dd95cd7aefa8243edac3c67bf1910fc905c4e.zip |
Make the standard for considering two cards to be match stricter.
2001-06-30 Jon Trowbridge <trow@ximian.com>
* gui/merging/e-card-merging.c (match_query_callback): Make the
standard for considering two cards to be match stricter.
* gui/component/select-names/e-select-names-completion.c
(make_match): Use the card's use-score to set the match's
sort_major value.
(match_name): Removed obsolete code.
(e_select_names_completion_begin): Added (double) cast to make
match->score calculation come out properly.
* backend/ebook/e-card.c: Added X-EVOLUTION-LAST-USE and
X-EVOLUTION-USE-SCORE to attribute_jump_array.
(e_card_get_today): Added. A convenience routine for getting
today's date and putting it in a GDate.
(e_card_get_use_score): Added. Compute the current, time-decayed,
use-score for the card.
(e_card_touch): Increment the use-score by one; update the last
used date.
(e_card_date_to_string): Added as a convenience routine, getting
rid of some code duplication.
(e_card_get_vobject): Add handlers for X-EVOLUTION-USE-SCORE and
X-EVOLUTION-LAST-USE.
(parse_last_use): Added.
(parse_use_score): Added.
(e_card_class_init): Added args for last-use and use-score.
(e_card_get_arg): Added handlers for last-use and use-score.
o
(e_card_set_arg): Added handlers for last-use and use-score.
* backend/ebook/e-destination.c: Added pending_card_id to
EDestinationPrivate struct.
(e_destination_copy): Copy the pending_card_id.
(e_destination_is_empty): Check for a pending_card_id. We are
non-empty if we have one.
(e_destination_clear_card): Clear pending_card_id.
(e_destination_set_card): Clear pending_card_id.
(e_destination_has_pending_card): Added.
(e_destination_use_card): Added. An asynchronous way to load a
pending card and then apply a callback to it.
(build_field): Be paranoid, map our special characters to '_'.
(e_destination_export): Use EXPORT_MAX_FIELDS symbol rather than a
hard-wired array size. Added the "card" entry.
(e_destination_import): Fix bug in handling of the "name" field.
Process the "card" field.
(e_destination_touch): "Touch" and commit the ECard corresponding
to the e-mail address in the destination. (A query against the
local addressbook is actually performed, in case the destination
isn't cardified.
* backend/ebook/e-card-compare.c (e_card_compare_name): Revamp the
way E_CARD_MATCH_FOO results are mapped to comparison results.
Report better matches when the family name is matched.
svn path=/trunk/; revision=10626
Diffstat (limited to 'addressbook/gui/component/select-names')
-rw-r--r-- | addressbook/gui/component/select-names/e-select-names-completion.c | 24 | ||||
-rw-r--r-- | addressbook/gui/component/select-names/e-select-names-model.c | 5 |
2 files changed, 12 insertions, 17 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 b4fb73cc9e..27cc598f5d 100644 --- a/addressbook/gui/component/select-names/e-select-names-completion.c +++ b/addressbook/gui/component/select-names/e-select-names-completion.c @@ -26,9 +26,12 @@ */ #include <config.h> +#include "e-select-names-completion.h" + #include <ctype.h> #include <stdio.h> #include <string.h> +#include <math.h> #include <gtk/gtksignal.h> #include <libgnome/gnome-defs.h> @@ -39,7 +42,7 @@ #include <addressbook/backend/ebook/e-book-util.h> #include <addressbook/backend/ebook/e-destination.h> #include <addressbook/backend/ebook/e-card-simple.h> -#include "e-select-names-completion.h" + struct _ESelectNamesCompletionPrivate { @@ -99,9 +102,12 @@ static ECompletionMatch * make_match (EDestination *dest, const gchar *menu_form, double score) { ECompletionMatch *match = g_new0 (ECompletionMatch, 1); + ECard *card = e_destination_get_card (dest); + e_completion_match_construct (match); e_completion_match_set_text (match, e_destination_get_name (dest), menu_form); + match->sort_major = card ? floor (e_card_get_use_score (card)) : 0; match->score = score; match->sort_minor = e_destination_get_email_num (dest); @@ -357,20 +363,6 @@ match_name (ESelectNamesCompletion *comp, EDestination *dest) score *= 100; } -#if 0 - /* This leads to some pretty counter-intuitive results, so I'm disabling it. */ - email = e_destination_get_email (dest); - if (email) { - /* Do the same for the email address. */ - gchar *at = strchr (email, '@'); - len = at ? at-email : strlen (email); - if ((card->name->given && !g_utf8_strncasecmp (card->name->given, email, MIN (strlen (card->name->given), len))) - || (card->name->family && !g_utf8_strncasecmp (card->name->family, email, MIN (strlen (card->name->family), len))) - || (card->name->additional && !g_utf8_strncasecmp (card->name->additional, email, MIN (strlen (card->name->additional), len)))) - score *= 100; - } -#endif - have_given = card->name->given && *card->name->given; have_additional = card->name->additional && *card->name->additional; have_family = card->name->family && *card->name->family; @@ -1048,7 +1040,7 @@ e_select_names_completion_begin (ECompletion *comp, const gchar *text, gint pos, ECompletionMatch *match = g_new (ECompletionMatch, 1); e_completion_match_construct (match); e_completion_match_set_text (match, text, override[j].text[k]); - match->score = 1 / (k + 1); + match->score = 1 / (double) (k + 1); e_completion_found_match (comp, match); } 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 74dfcb8158..d562b40a64 100644 --- a/addressbook/gui/component/select-names/e-select-names-model.c +++ b/addressbook/gui/component/select-names/e-select-names-model.c @@ -330,7 +330,10 @@ e_select_names_model_export_destinationv (ESelectNamesModel *model) destv = g_new0 (EDestination *, len+1); for (i=0, j = model->priv->data; j != NULL; j = g_list_next (j)) { - destv[i++] = E_DESTINATION (j->data); + EDestination *dest = E_DESTINATION (j->data); + + if (dest) + destv[i++] = dest; } str = e_destination_exportv (destv); |