From 353946a818a6e373773cdfcad543e9d6b65f042d Mon Sep 17 00:00:00 2001 From: Christopher James Lahey Date: Mon, 2 Jul 2001 04:54:22 +0000 Subject: Added related_contacts field. 2001-07-02 Christopher James Lahey * backend/ebook/e-card.c, backend/ebook/e-card.h: Added related_contacts field. * gui/component/select-names/e-select-names-model.c, gui/component/select-names/e-select-names-model.h (e_select_names_model_import_destinationv): Added this function. * gui/contact-editor/contact-editor.glade: Replaced the entry here for related contacts with a table which is filled in in the C code. * gui/contact-editor/e-contact-editor.c, gui/contact-editor/e-contact-editor.h (add_lists): Added a select names entry here for the related contacts field. * gui/widgets/Makefile.am: Removed all the test programs here since there are circular dependencies now. svn path=/trunk/; revision=10666 --- .../component/select-names/e-select-names-model.c | 81 ++++++++++++++-------- 1 file changed, 54 insertions(+), 27 deletions(-) (limited to 'addressbook/gui/component/select-names/e-select-names-model.c') 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 d562b40a64..8c10aa6035 100644 --- a/addressbook/gui/component/select-names/e-select-names-model.c +++ b/addressbook/gui/component/select-names/e-select-names-model.c @@ -202,6 +202,34 @@ e_select_names_model_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) } } + +static void +e_select_names_model_changed (ESelectNamesModel *model) +{ + g_free (model->priv->text); + model->priv->text = NULL; + + 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]); +} + /** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** **/ ESelectNamesModel * @@ -342,6 +370,32 @@ e_select_names_model_export_destinationv (ESelectNamesModel *model) return str; } +static +void send_changed (EDestination *dest, ECard *card, gpointer closure) +{ + ESelectNamesModel *model = closure; + e_select_names_model_changed (model); +} + +void +e_select_names_model_import_destinationv (ESelectNamesModel *model, + gchar *destinationv) +{ + EDestination **destv; + gint i; + + g_return_if_fail (model && E_IS_SELECT_NAMES_MODEL (model)); + + destv = e_destination_importv (destinationv); + + e_select_names_model_delete_all (model); + for (i = 0; destv[i]; i++) { + e_destination_use_card (destv[i], send_changed, model); + e_select_names_model_append (model, destv[i]); + } + g_free (destv); +} + ECard * e_select_names_model_get_card (ESelectNamesModel *model, gint index) { @@ -370,33 +424,6 @@ e_select_names_model_get_string (ESelectNamesModel *model, gint index) return dest ? e_destination_get_string (dest) : ""; } -static void -e_select_names_model_changed (ESelectNamesModel *model) -{ - g_free (model->priv->text); - model->priv->text = NULL; - - 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]); -} - void e_select_names_model_insert (ESelectNamesModel *model, gint index, EDestination *dest) { -- cgit v1.2.3