From f9e0870bb8f2cee522b1d74d8d430cd898a420e5 Mon Sep 17 00:00:00 2001 From: Jon Trowbridge Date: Sat, 7 Jul 2001 06:39:30 +0000 Subject: CVS is unhappy this evening. My commit keeps dying in the middle. svn path=/trunk/; revision=10883 --- .../select-names/e-select-names-completion.c | 27 +++++++++++-- .../component/select-names/e-select-names-model.c | 46 +++++++--------------- .../component/select-names/e-select-names-popup.c | 9 ++--- .../select-names/e-select-names-table-model.c | 4 +- .../select-names/e-select-names-text-model.c | 2 +- 5 files changed, 44 insertions(+), 44 deletions(-) (limited to 'addressbook/gui/component/select-names') 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 27cc598f5d..2590a8515b 100644 --- a/addressbook/gui/component/select-names/e-select-names-completion.c +++ b/addressbook/gui/component/select-names/e-select-names-completion.c @@ -127,7 +127,7 @@ emailify_match (ECompletionMatch *match) const gchar *email = e_destination_get_email (dest); const gchar *menu_txt = e_completion_match_get_menu_text (match); - if (card && card->email && e_list_length (card->email) > 1) { + if (card && card->email && e_list_length (card->email) > 1 && !e_card_evolution_list (card)) { if (email && strstr (menu_txt, email) == NULL) { gchar *tmp = g_strdup_printf ("%s <%s>", menu_txt, email); @@ -196,7 +196,9 @@ match_email (ESelectNamesCompletion *comp, EDestination *dest) const gchar *email = e_destination_get_email (dest); double score; - if (email && !g_utf8_strncasecmp (comp->priv->query_text, email, len)) { + if (email + && !g_utf8_strncasecmp (comp->priv->query_text, email, len) + && !e_destination_is_evolution_list (dest)) { gchar *name, *str; @@ -367,7 +369,11 @@ match_name (ESelectNamesCompletion *comp, EDestination *dest) have_additional = card->name->additional && *card->name->additional; have_family = card->name->family && *card->name->family; - if (first_match == MATCHED_GIVEN_NAME) { + if (first_match != MATCHED_NOTHING && e_card_evolution_list (card)) { + + menu_text = e_card_name_to_string (card->name); + + } else if (first_match == MATCHED_GIVEN_NAME) { if (have_family) menu_text = g_strdup_printf ("%s %s", card->name->given, card->name->family); @@ -535,7 +541,20 @@ book_query_process_card_list (ESelectNamesCompletion *comp, const GList *cards) while (cards) { ECard *card = E_CARD (cards->data); - if (card->email) { + if (e_card_evolution_list (card)) { + + EDestination *dest = e_destination_new (); + ECompletionMatch *match; + e_destination_set_card (dest, card, 0); + match = book_query_score (comp, dest); + if (match && match->score > 0) { + e_completion_found_match (E_COMPLETION (comp), match); + } else { + e_completion_match_unref (match); + } + gtk_object_unref (GTK_OBJECT (dest)); + + } else if (card->email) { gint i; for (i=0; iemail); ++i) { EDestination *dest = e_destination_new (); 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 8c10aa6035..3cdd5913a5 100644 --- a/addressbook/gui/component/select-names/e-select-names-model.c +++ b/addressbook/gui/component/select-names/e-select-names-model.c @@ -212,21 +212,6 @@ e_select_names_model_changed (ESelectNamesModel *model) g_free (model->priv->addr_text); model->priv->addr_text = NULL; -#if 0 - { - GList *i = model->priv->data; - gint j = 0; - g_print ("ESelectNamesModel state:\n"); - while (i) { - EDestination *dest = (EDestination *) i->data; - g_print ("%d: %s <%s>\n", j, e_destination_get_string (dest), e_destination_get_email (dest)); - i = g_list_next (i); - ++j; - } - g_print ("\n"); - } -#endif - gtk_signal_emit (GTK_OBJECT(model), e_select_names_model_signals[E_SELECT_NAMES_MODEL_CHANGED]); } @@ -276,9 +261,7 @@ e_select_names_model_get_textification (ESelectNamesModel *model) while (iter) { EDestination *dest = E_DESTINATION (iter->data); - strv[i] = (gchar *) e_destination_get_string (dest); - if (strv[i] == NULL) - strv[i] = ""; + strv[i] = (gchar *) e_destination_get_textrep (dest); ++i; iter = g_list_next (iter); } @@ -311,7 +294,7 @@ e_select_names_model_get_address_text (ESelectNamesModel *model) while (iter) { EDestination *dest = E_DESTINATION (iter->data); - strv[i] = (gchar *) e_destination_get_email_verbose (dest); + strv[i] = (gchar *) e_destination_get_address (dest); if (strv[i]) ++i; iter = g_list_next (iter); @@ -421,7 +404,7 @@ e_select_names_model_get_string (ESelectNamesModel *model, gint index) dest = e_select_names_model_get_destination (model, index); - return dest ? e_destination_get_string (dest) : ""; + return dest ? e_destination_get_textrep (dest) : ""; } void @@ -458,6 +441,7 @@ void e_select_names_model_replace (ESelectNamesModel *model, gint index, EDestination *dest) { GList *node; + const gchar *new_str, *old_str; gint old_strlen=0, new_strlen=0; g_return_if_fail (model != NULL); @@ -465,7 +449,8 @@ e_select_names_model_replace (ESelectNamesModel *model, gint index, EDestination g_return_if_fail (model->priv->data == NULL || (0 <= index && index < g_list_length (model->priv->data))); g_return_if_fail (dest && E_IS_DESTINATION (dest)); - new_strlen = e_destination_get_strlen (dest); + new_str = e_destination_get_textrep (dest); + new_strlen = new_str ? strlen (new_str) : 0; if (model->priv->data == NULL) { @@ -478,7 +463,9 @@ e_select_names_model_replace (ESelectNamesModel *model, gint index, EDestination node = g_list_nth (model->priv->data, index); if (node->data != dest) { - old_strlen = e_destination_get_strlen (E_DESTINATION (node->data)); + + old_str = e_destination_get_textrep (E_DESTINATION (node->data)); + old_strlen = old_str ? strlen (old_str) : 0; gtk_object_unref (GTK_OBJECT (node->data)); @@ -560,6 +547,7 @@ e_select_names_model_name_pos (ESelectNamesModel *model, gint index, gint *pos, { gint rp = 0, i, len = 0; GList *iter; + const gchar *str; g_return_if_fail (model != NULL); g_return_if_fail (E_IS_SELECT_NAMES_MODEL (model)); @@ -568,7 +556,8 @@ e_select_names_model_name_pos (ESelectNamesModel *model, gint index, gint *pos, iter = model->priv->data; while (iter && i <= index) { rp += len + (i > 0 ? SEPLEN : 0); - len = e_destination_get_strlen (E_DESTINATION (iter->data)); + str = e_destination_get_textrep (E_DESTINATION (iter->data)); + len = str ? strlen (str) : 0; ++i; iter = g_list_next (iter); } @@ -588,6 +577,7 @@ void e_select_names_model_text_pos (ESelectNamesModel *model, gint pos, gint *index, gint *start_pos, gint *length) { GList *iter; + const gchar *str; gint len = 0, i = 0, sp = 0, adj = 0; g_return_if_fail (model != NULL); @@ -596,16 +586,10 @@ e_select_names_model_text_pos (ESelectNamesModel *model, gint pos, gint *index, iter = model->priv->data; while (iter != NULL) { - len = e_destination_get_strlen (E_DESTINATION (iter->data)); - -#if 0 - g_print ("text_pos: %d %d %d %d\n", len, sp, pos, adj); -#endif + str = e_destination_get_textrep (E_DESTINATION (iter->data)); + len = str ? strlen (str) : 0; if (sp <= pos && pos <= sp + len + adj) { -#if 0 - g_print ("breaking\n"); -#endif break; } 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 fb05ff686a..aa668884c2 100644 --- a/addressbook/gui/component/select-names/e-select-names-popup.c +++ b/addressbook/gui/component/select-names/e-select-names-popup.c @@ -216,7 +216,6 @@ popup_menu_card (PopupInfo *info) gint i=0; GtkWidget *pop; EIterator *iterator; - gchar *name_str; gint html_toggle; /* @@ -227,10 +226,9 @@ popup_menu_card (PopupInfo *info) memset (radioinfo, 0, sizeof (radioinfo)); card = e_destination_get_card (info->dest); - name_str = e_card_name_to_string (card->name); uiinfo[i].type = GNOME_APP_UI_ITEM; - uiinfo[i].label = name_str; + uiinfo[i].label = (gchar *) e_destination_get_name (info->dest); ++i; uiinfo[i].type = GNOME_APP_UI_SEPARATOR; @@ -290,7 +288,6 @@ popup_menu_card (PopupInfo *info) */ pop = gnome_popup_menu_new (uiinfo); - g_free (name_str); if (using_radio) { gint n = e_destination_get_email_num (info->dest); @@ -311,7 +308,7 @@ static void quick_add_cb (GtkWidget *w, gpointer user_data) { PopupInfo *info = (PopupInfo *) user_data; - e_contact_quick_add_free_form (e_destination_get_string (info->dest), NULL, NULL); + e_contact_quick_add_free_form (e_destination_get_address (info->dest), NULL, NULL); } static GtkWidget * @@ -325,7 +322,7 @@ popup_menu_nocard (PopupInfo *info) memset (uiinfo, 0, sizeof (uiinfo)); - str = e_destination_get_string (info->dest); + str = e_destination_get_name (info->dest); uiinfo[i].type = GNOME_APP_UI_ITEM; uiinfo[i].label = (gchar *) str; 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 9d93305396..fee84ce071 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 @@ -129,8 +129,8 @@ fill_in_info (ESelectNamesTableModel *model) model->data[i].email = g_strdup(""); gtk_object_unref(GTK_OBJECT(simple)); } else { - model->data[i].name = g_strdup (e_destination_get_string (dest)); - model->data[i].email = g_strdup (model->data[i].name); + model->data[i].name = g_strdup (e_destination_get_name (dest)); + model->data[i].email = g_strdup (e_destination_get_email (dest)); } } } else { 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 7c87c887f5..50a09bd010 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 @@ -312,7 +312,7 @@ e_select_names_text_model_insert_length (ETextModel *model, gint pos, const gcha if (text[i] == ',' && index >= 0) { /* Is this a quoted or an unquoted comma we are dealing with? */ const EDestination *dest = e_select_names_model_get_destination (source, index); if (dest) { - const gchar *str = e_destination_get_string (dest); + const gchar *str = e_destination_get_textrep (dest); gint j; if (out) fprintf (out, "str=%s pos=%d\n", str, pos); -- cgit v1.2.3