aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui/contact-list-editor/e-contact-list-editor.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/contact-list-editor/e-contact-list-editor.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/contact-list-editor/e-contact-list-editor.c')
-rw-r--r--addressbook/gui/contact-list-editor/e-contact-list-editor.c83
1 files changed, 61 insertions, 22 deletions
diff --git a/addressbook/gui/contact-list-editor/e-contact-list-editor.c b/addressbook/gui/contact-list-editor/e-contact-list-editor.c
index 0c762ff982..22dccfcb67 100644
--- a/addressbook/gui/contact-list-editor/e-contact-list-editor.c
+++ b/addressbook/gui/contact-list-editor/e-contact-list-editor.c
@@ -23,9 +23,12 @@
#include "e-contact-list-editor.h"
#include <string.h>
-#include <glib.h>
+
#include <libgnome/gnome-i18n.h>
#include <libgnomeui/gnome-window-icon.h>
+#include <gtk/gtkentry.h>
+#include <gtk/gtktogglebutton.h>
+
#include <bonobo/bonobo-ui-container.h>
#include <bonobo/bonobo-ui-util.h>
#include <bonobo/bonobo-window.h>
@@ -868,7 +871,8 @@ table_drag_data_received_cb (ETable *table, int row, int col,
if (!e_contact_get (contact, E_CONTACT_IS_LIST)) {
e_contact_list_model_add_contact (E_CONTACT_LIST_MODEL (editor->model),
- contact);
+ contact,
+ 0 /* Hard-wired for default e-mail */);
changed = TRUE;
}
@@ -916,7 +920,6 @@ extract_info(EContactListEditor *editor)
EContact *contact = editor->contact;
if (contact) {
int i;
- GList *email_list;
char *image_data;
gsize image_data_len;
char *string = gtk_editable_get_chars(GTK_EDITABLE (editor->list_name_entry), 0, -1);
@@ -932,19 +935,19 @@ extract_info(EContactListEditor *editor)
e_contact_set (contact, E_CONTACT_LIST_SHOW_ADDRESSES,
GINT_TO_POINTER (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(editor->visible_addrs_checkbutton))));
- email_list = NULL;
+ e_vcard_remove_attributes (E_VCARD (contact), "", EVC_EMAIL);
+
/* then refill it from the contact list model */
for (i = 0; i < e_table_model_row_count (editor->model); i ++) {
- const EABDestination *dest = e_contact_list_model_get_destination (E_CONTACT_LIST_MODEL (editor->model), i);
- gchar *dest_xml = eab_destination_export (dest);
- if (dest_xml)
- email_list = g_list_append (email_list, dest_xml);
- }
+ const EDestination *dest = e_contact_list_model_get_destination (E_CONTACT_LIST_MODEL (editor->model), i);
+ EVCardAttribute *attr;
- e_contact_set (contact, E_CONTACT_EMAIL, email_list);
+ attr = e_vcard_attribute_new (NULL, EVC_EMAIL);
- g_list_foreach (email_list, (GFunc) g_free, NULL);
- g_list_free (email_list);
+ e_vcard_add_attribute (E_VCARD (contact), attr);
+
+ e_destination_export_to_vcard_attribute (dest, attr);
+ }
if (editor->image_set
&& e_image_chooser_get_image_data (E_IMAGE_CHOOSER (editor->list_image),
@@ -976,7 +979,7 @@ fill_in_info(EContactListEditor *editor)
GList *iter;
file_as = e_contact_get_const (editor->contact, E_CONTACT_FILE_AS);
- email_list = e_contact_get (editor->contact, E_CONTACT_EMAIL);
+ email_list = e_contact_get_attributes (editor->contact, E_CONTACT_EMAIL);
is_evolution_list = GPOINTER_TO_INT (e_contact_get (editor->contact, E_CONTACT_IS_LIST));
show_addresses = GPOINTER_TO_INT (e_contact_get (editor->contact, E_CONTACT_LIST_SHOW_ADDRESSES));
@@ -992,18 +995,54 @@ fill_in_info(EContactListEditor *editor)
e_contact_list_model_remove_all (E_CONTACT_LIST_MODEL (editor->model));
for (iter = email_list; iter; iter = iter->next) {
- char *dest_xml = iter->data;
- EABDestination *dest;
-
- /* g_message ("incoming xml: [%s]", dest_xml); */
- dest = eab_destination_import (dest_xml);
-
- if (dest != NULL) {
- e_contact_list_model_add_destination (E_CONTACT_LIST_MODEL (editor->model), dest);
+ EVCardAttribute *attr = iter->data;
+ GList *p;
+ EDestination *list_dest = e_destination_new ();
+ char *contact_uid = NULL;
+ char *email = NULL;
+ char *name = NULL;
+ int email_num = -1;
+ gboolean html_pref = FALSE;
+
+ for (p = e_vcard_attribute_get_params (attr); p; p = p->next) {
+ EVCardAttributeParam *param = p->data;
+ const char *param_name = e_vcard_attribute_param_get_name (param);
+ if (!g_ascii_strcasecmp (param_name,
+ EVC_X_DEST_CONTACT_UID)) {
+ GList *v = e_vcard_attribute_param_get_values (param);
+ contact_uid = v ? v->data : NULL;
+ }
+ else if (!g_ascii_strcasecmp (param_name,
+ EVC_X_DEST_EMAIL_NUM)) {
+ GList *v = e_vcard_attribute_param_get_values (param);
+ email_num = v ? atoi (v->data) : -1;
+ }
+ else if (!g_ascii_strcasecmp (param_name,
+ EVC_X_DEST_NAME)) {
+ GList *v = e_vcard_attribute_param_get_values (param);
+ name = v ? v->data : NULL;
+ }
+ else if (!g_ascii_strcasecmp (param_name,
+ EVC_X_DEST_EMAIL)) {
+ GList *v = e_vcard_attribute_param_get_values (param);
+ email = v ? v->data : NULL;
+ }
+ else if (!g_ascii_strcasecmp (param_name,
+ EVC_X_DEST_HTML_MAIL)) {
+ GList *v = e_vcard_attribute_param_get_values (param);
+ html_pref = v ? !g_ascii_strcasecmp (v->data, "true") : FALSE;
+ }
}
+
+ if (contact_uid) e_destination_set_contact_uid (list_dest, contact_uid, email_num);
+ if (name) e_destination_set_name (list_dest, name);
+ if (email) e_destination_set_email (list_dest, email);
+ e_destination_set_html_mail_pref (list_dest, html_pref);
+
+ e_contact_list_model_add_destination (E_CONTACT_LIST_MODEL (editor->model), list_dest);
}
- g_list_foreach (email_list, (GFunc) g_free, NULL);
+ g_list_foreach (email_list, (GFunc) e_vcard_attribute_free, NULL);
g_list_free (email_list);
photo = e_contact_get (editor->contact, E_CONTACT_LOGO);