aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui/component/select-names/e-select-names-model.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-model.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-model.c')
-rw-r--r--addressbook/gui/component/select-names/e-select-names-model.c164
1 files changed, 42 insertions, 122 deletions
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 74bda7a74b..506eb40124 100644
--- a/addressbook/gui/component/select-names/e-select-names-model.c
+++ b/addressbook/gui/component/select-names/e-select-names-model.c
@@ -41,7 +41,7 @@ struct _ESelectNamesModelPrivate {
gchar *id;
gchar *title;
- GList *data; /* of EABDestination */
+ GList *data; /* of EDestination */
gint limit;
@@ -157,12 +157,6 @@ e_select_names_model_changed (ESelectNamesModel *model)
}
}
-static void
-destination_changed_proxy (EABDestination *dest, gpointer closure)
-{
- e_select_names_model_changed (E_SELECT_NAMES_MODEL (closure));
-}
-
/** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** **/
ESelectNamesModel *
@@ -183,7 +177,7 @@ e_select_names_model_duplicate (ESelectNamesModel *old)
model->priv->title = g_strdup (old->priv->title);
for (iter = old->priv->data; iter != NULL; iter = g_list_next (iter)) {
- EABDestination *dup = eab_destination_copy (EAB_DESTINATION (iter->data));
+ EDestination *dup = e_destination_copy (E_DESTINATION (iter->data));
e_select_names_model_append (model, dup);
}
@@ -211,8 +205,8 @@ e_select_names_model_get_textification (ESelectNamesModel *model, const char *se
GList *iter = model->priv->data;
while (iter) {
- EABDestination *dest = EAB_DESTINATION (iter->data);
- strv[i] = (gchar *) eab_destination_get_textrep (dest, FALSE);
+ EDestination *dest = E_DESTINATION (iter->data);
+ strv[i] = (gchar *) e_destination_get_textrep (dest, FALSE);
++i;
iter = g_list_next (iter);
}
@@ -251,8 +245,8 @@ e_select_names_model_get_address_text (ESelectNamesModel *model, const char *sep
GList *iter = model->priv->data;
while (iter) {
- EABDestination *dest = EAB_DESTINATION (iter->data);
- strv[i] = (gchar *) eab_destination_get_address (dest);
+ EDestination *dest = E_DESTINATION (iter->data);
+ strv[i] = (gchar *) e_destination_get_address (dest);
if (strv[i])
++i;
iter = g_list_next (iter);
@@ -303,57 +297,51 @@ e_select_names_model_at_limit (ESelectNamesModel *model)
return model->priv->limit >= 0 && g_list_length (model->priv->data) >= model->priv->limit;
}
-const EABDestination *
+const EDestination *
e_select_names_model_get_destination (ESelectNamesModel *model, gint index)
{
g_return_val_if_fail (model && E_IS_SELECT_NAMES_MODEL (model), NULL);
g_return_val_if_fail (0 <= index, NULL);
g_return_val_if_fail (index < g_list_length (model->priv->data), NULL);
- return EAB_DESTINATION (g_list_nth_data (model->priv->data, index));
+ return E_DESTINATION (g_list_nth_data (model->priv->data, index));
}
gchar *
e_select_names_model_export_destinationv (ESelectNamesModel *model)
{
- EABDestination **destv;
+ EDestination **destv;
gchar *str;
gint i, len = 0;
GList *j;
g_return_val_if_fail (model && E_IS_SELECT_NAMES_MODEL (model), NULL);
len = g_list_length (model->priv->data);
- destv = g_new0 (EABDestination *, len+1);
+ destv = g_new0 (EDestination *, len+1);
for (i=0, j = model->priv->data; j != NULL; j = g_list_next (j)) {
- EABDestination *dest = EAB_DESTINATION (j->data);
+ EDestination *dest = E_DESTINATION (j->data);
if (dest)
destv[i++] = dest;
}
- str = eab_destination_exportv (destv);
+ str = e_destination_exportv (destv);
g_free (destv);
return str;
}
-static void send_changed (EABDestination *dest, EContact *contact, gpointer closure)
-{
- ESelectNamesModel *model = closure;
- e_select_names_model_changed (model);
-}
-
void
e_select_names_model_import_destinationv (ESelectNamesModel *model,
gchar *destinationv)
{
- EABDestination **destv;
+ EDestination **destv;
gint i;
g_return_if_fail (model && E_IS_SELECT_NAMES_MODEL (model));
- destv = eab_destination_importv (destinationv);
+ destv = e_destination_importv (destinationv);
e_select_names_model_delete_all (model);
@@ -361,7 +349,6 @@ e_select_names_model_import_destinationv (ESelectNamesModel *model,
return;
for (i = 0; destv[i]; i++) {
- eab_destination_use_contact (destv[i], send_changed, model);
e_select_names_model_append (model, destv[i]);
}
g_free (destv);
@@ -370,21 +357,21 @@ e_select_names_model_import_destinationv (ESelectNamesModel *model,
EContact *
e_select_names_model_get_contact (ESelectNamesModel *model, gint index)
{
- const EABDestination *dest;
+ const EDestination *dest;
g_return_val_if_fail (model && E_IS_SELECT_NAMES_MODEL (model), NULL);
g_return_val_if_fail (0 <= index, NULL);
g_return_val_if_fail (index < g_list_length (model->priv->data), NULL);
dest = e_select_names_model_get_destination (model, index);
- return dest ? eab_destination_get_contact (dest) : NULL;
+ return dest ? e_destination_get_contact (dest) : NULL;
}
const gchar *
e_select_names_model_get_string (ESelectNamesModel *model, gint index)
{
- const EABDestination *dest;
+ const EDestination *dest;
g_return_val_if_fail (model && E_IS_SELECT_NAMES_MODEL (model), NULL);
g_return_val_if_fail (0 <= index, NULL);
@@ -392,34 +379,19 @@ e_select_names_model_get_string (ESelectNamesModel *model, gint index)
dest = e_select_names_model_get_destination (model, index);
- return dest ? eab_destination_get_textrep (dest, FALSE) : "";
-}
-
-static void
-connect_destination (ESelectNamesModel *model, EABDestination *dest)
-{
- g_signal_connect (dest,
- "changed",
- G_CALLBACK (destination_changed_proxy),
- model);
-}
-
-static void
-disconnect_destination (ESelectNamesModel *model, EABDestination *dest)
-{
- g_signal_handlers_disconnect_by_func (dest, destination_changed_proxy, model);
+ return dest ? e_destination_get_textrep (dest, FALSE) : "";
}
gboolean
-e_select_names_model_contains (ESelectNamesModel *model, const EABDestination *dest)
+e_select_names_model_contains (ESelectNamesModel *model, const EDestination *dest)
{
GList *iter;
g_return_val_if_fail (E_IS_SELECT_NAMES_MODEL (model), FALSE);
- g_return_val_if_fail (EAB_IS_DESTINATION (dest), FALSE);
+ g_return_val_if_fail (E_IS_DESTINATION (dest), FALSE);
for (iter = model->priv->data; iter != NULL; iter = g_list_next (iter)) {
- if (iter->data != NULL && eab_destination_equal (dest, EAB_DESTINATION (iter->data)))
+ if (iter->data != NULL && e_destination_equal (dest, E_DESTINATION (iter->data)))
return TRUE;
}
@@ -427,12 +399,12 @@ e_select_names_model_contains (ESelectNamesModel *model, const EABDestination *d
}
void
-e_select_names_model_insert (ESelectNamesModel *model, gint index, EABDestination *dest)
+e_select_names_model_insert (ESelectNamesModel *model, gint index, EDestination *dest)
{
g_return_if_fail (model != NULL);
g_return_if_fail (E_IS_SELECT_NAMES_MODEL (model));
g_return_if_fail (0 <= index && index <= g_list_length (model->priv->data));
- g_return_if_fail (dest && EAB_IS_DESTINATION (dest));
+ g_return_if_fail (dest && E_IS_DESTINATION (dest));
if (e_select_names_model_at_limit (model)) {
/* FIXME: This is bad. */
@@ -440,8 +412,6 @@ e_select_names_model_insert (ESelectNamesModel *model, gint index, EABDestinatio
return;
}
- connect_destination (model, dest);
-
model->priv->data = g_list_insert (model->priv->data, dest, index);
g_object_ref (dest);
@@ -450,10 +420,10 @@ e_select_names_model_insert (ESelectNamesModel *model, gint index, EABDestinatio
}
void
-e_select_names_model_append (ESelectNamesModel *model, EABDestination *dest)
+e_select_names_model_append (ESelectNamesModel *model, EDestination *dest)
{
g_return_if_fail (model && E_IS_SELECT_NAMES_MODEL (model));
- g_return_if_fail (dest && EAB_IS_DESTINATION (dest));
+ g_return_if_fail (dest && E_IS_DESTINATION (dest));
if (e_select_names_model_at_limit (model)) {
/* FIXME: This is bad. */
@@ -461,8 +431,6 @@ e_select_names_model_append (ESelectNamesModel *model, EABDestination *dest)
return;
}
- connect_destination (model, dest);
-
model->priv->data = g_list_append (model->priv->data, dest);
g_object_ref (dest);
@@ -471,7 +439,7 @@ e_select_names_model_append (ESelectNamesModel *model, EABDestination *dest)
}
void
-e_select_names_model_replace (ESelectNamesModel *model, gint index, EABDestination *dest)
+e_select_names_model_replace (ESelectNamesModel *model, gint index, EDestination *dest)
{
GList *node;
const gchar *new_str, *old_str;
@@ -480,15 +448,13 @@ e_select_names_model_replace (ESelectNamesModel *model, gint index, EABDestinati
g_return_if_fail (model != NULL);
g_return_if_fail (E_IS_SELECT_NAMES_MODEL (model));
g_return_if_fail (model->priv->data == NULL || (0 <= index && index < g_list_length (model->priv->data)));
- g_return_if_fail (dest && EAB_IS_DESTINATION (dest));
+ g_return_if_fail (dest && E_IS_DESTINATION (dest));
- new_str = eab_destination_get_textrep (dest, FALSE);
+ new_str = e_destination_get_textrep (dest, FALSE);
new_strlen = new_str ? strlen (new_str) : 0;
if (model->priv->data == NULL) {
- connect_destination (model, dest);
-
model->priv->data = g_list_append (model->priv->data, dest);
g_object_ref (dest);
@@ -498,10 +464,7 @@ e_select_names_model_replace (ESelectNamesModel *model, gint index, EABDestinati
if (node->data != dest) {
- disconnect_destination (model, EAB_DESTINATION (node->data));
- connect_destination (model, dest);
-
- old_str = eab_destination_get_textrep (EAB_DESTINATION (node->data), FALSE);
+ old_str = e_destination_get_textrep (E_DESTINATION (node->data), FALSE);
old_strlen = old_str ? strlen (old_str) : 0;
g_object_unref (node->data);
@@ -521,16 +484,15 @@ void
e_select_names_model_delete (ESelectNamesModel *model, gint index)
{
GList *node;
- EABDestination *dest;
+ EDestination *dest;
g_return_if_fail (model != NULL);
g_return_if_fail (E_IS_SELECT_NAMES_MODEL (model));
g_return_if_fail (0 <= index && index < g_list_length (model->priv->data));
node = g_list_nth (model->priv->data, index);
- dest = EAB_DESTINATION (node->data);
+ dest = E_DESTINATION (node->data);
- disconnect_destination (model, dest);
g_object_unref (dest);
model->priv->data = g_list_remove_link (model->priv->data, node);
@@ -550,20 +512,18 @@ e_select_names_model_clean (ESelectNamesModel *model, gboolean clean_last_entry)
iter = model->priv->data;
while (iter) {
- EABDestination *dest;
+ EDestination *dest;
next = g_list_next (iter);
if (next == NULL && !clean_last_entry)
break;
- dest = iter->data ? EAB_DESTINATION (iter->data) : NULL;
+ dest = iter->data ? E_DESTINATION (iter->data) : NULL;
- if (dest == NULL || eab_destination_is_empty (dest)) {
- if (dest) {
- disconnect_destination (model, dest);
+ if (dest == NULL || e_destination_empty (dest)) {
+ if (dest)
g_object_unref (dest);
- }
model->priv->data = g_list_remove_link (model->priv->data, iter);
g_list_free_1 (iter);
changed = TRUE;
@@ -576,19 +536,12 @@ e_select_names_model_clean (ESelectNamesModel *model, gboolean clean_last_entry)
e_select_names_model_changed (model);
}
-static void
-delete_all_iter (gpointer data, gpointer closure)
-{
- disconnect_destination (E_SELECT_NAMES_MODEL (closure), EAB_DESTINATION (data));
- g_object_unref (data);
-}
-
void
e_select_names_model_delete_all (ESelectNamesModel *model)
{
g_return_if_fail (model != NULL && E_IS_SELECT_NAMES_MODEL (model));
- g_list_foreach (model->priv->data, delete_all_iter, model);
+ g_list_foreach (model->priv->data, (GFunc)g_object_unref, model);
g_list_free (model->priv->data);
model->priv->data = NULL;
@@ -609,9 +562,9 @@ e_select_names_model_overwrite_copy (ESelectNamesModel *dest, ESelectNamesModel
e_select_names_model_delete_all (dest);
len = e_select_names_model_count (src);
for (i = 0; i < len; ++i) {
- const EABDestination *d = e_select_names_model_get_destination (src, i);
+ const EDestination *d = e_select_names_model_get_destination (src, i);
if (d)
- e_select_names_model_append (dest, eab_destination_copy (d));
+ e_select_names_model_append (dest, e_destination_copy (d));
}
}
@@ -628,9 +581,9 @@ e_select_names_model_merge (ESelectNamesModel *dest, ESelectNamesModel *src)
len = e_select_names_model_count (src);
for (i = 0; i < len; ++i) {
- const EABDestination *d = e_select_names_model_get_destination (src, i);
+ const EDestination *d = e_select_names_model_get_destination (src, i);
if (d && !e_select_names_model_contains (dest, d))
- e_select_names_model_append (dest, eab_destination_copy (d));
+ e_select_names_model_append (dest, e_destination_copy (d));
}
}
@@ -648,7 +601,7 @@ e_select_names_model_name_pos (ESelectNamesModel *model, gint seplen, gint index
iter = model->priv->data;
while (iter && i <= index) {
rp += len + (i > 0 ? seplen : 0);
- str = eab_destination_get_textrep (EAB_DESTINATION (iter->data), FALSE);
+ str = e_destination_get_textrep (E_DESTINATION (iter->data), FALSE);
len = str ? g_utf8_strlen (str, -1) : 0;
++i;
iter = g_list_next (iter);
@@ -678,7 +631,7 @@ e_select_names_model_text_pos (ESelectNamesModel *model, gint seplen, gint pos,
iter = model->priv->data;
while (iter != NULL) {
- str = eab_destination_get_textrep (EAB_DESTINATION (iter->data), FALSE);
+ str = e_destination_get_textrep (E_DESTINATION (iter->data), FALSE);
len = str ? g_utf8_strlen (str, -1) : 0;
if (sp <= pos && pos <= sp + len + adj) {
@@ -717,39 +670,6 @@ e_select_names_model_text_pos (ESelectNamesModel *model, gint seplen, gint pos,
}
void
-e_select_names_model_load_all_contacts (ESelectNamesModel *model, EBook *book)
-{
- GList *iter;
-
- g_return_if_fail (E_IS_SELECT_NAMES_MODEL (model));
- g_return_if_fail (book == NULL || E_IS_BOOK (book));
-
- for (iter = model->priv->data; iter != NULL; iter = g_list_next (iter)) {
- EABDestination *dest = EAB_DESTINATION (iter->data);
- if (!eab_destination_is_empty (dest)) {
-
- eab_destination_load_contact (dest, book);
- }
- }
-}
-
-void
-e_select_names_model_cancel_all_contact_load (ESelectNamesModel *model)
-{
- GList *iter;
-
- g_return_if_fail (E_IS_SELECT_NAMES_MODEL (model));
-
- for (iter = model->priv->data; iter != NULL; iter = g_list_next (iter)) {
- EABDestination *dest = EAB_DESTINATION (iter->data);
- if (!eab_destination_is_empty (dest)) {
-
- eab_destination_cancel_contact_load (dest);
- }
- }
-}
-
-void
e_select_names_model_freeze (ESelectNamesModel *model)
{
g_return_if_fail (E_IS_SELECT_NAMES_MODEL (model));