aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui/component/select-names/e-select-names-popup.c
diff options
context:
space:
mode:
authorJon Trowbridge <trow@ximian.com>2001-05-18 15:10:04 +0800
committerJon Trowbridge <trow@src.gnome.org>2001-05-18 15:10:04 +0800
commit3ca3f79dbe4641478582cd0b78a6e377c3430b19 (patch)
tree2693ebef04b05fff098f38f00233e676caf6229e /addressbook/gui/component/select-names/e-select-names-popup.c
parentc8476fc1ff4887bde985382de708f248067ac7ba (diff)
downloadgsoc2013-evolution-3ca3f79dbe4641478582cd0b78a6e377c3430b19.tar.gz
gsoc2013-evolution-3ca3f79dbe4641478582cd0b78a6e377c3430b19.tar.zst
gsoc2013-evolution-3ca3f79dbe4641478582cd0b78a6e377c3430b19.zip
Return the serialized EDestinations (rather than just a string w/ e-mail
2001-05-18 Jon Trowbridge <trow@ximian.com> * gui/component/select-names/e-select-names-bonobo.c (entry_get_property_fn): Return the serialized EDestinations (rather than just a string w/ e-mail addresses) through the bonobo component's property bag. * gui/component/select-names/e-select-names-model.c (e_select_names_model_export_destinationv): Added. A convenience routine for serializing the model's EDestinations into a string. * gui/component/select-names/e-select-names-popup.c (add_html_mail): Added. Puts in a check menu item for whether or not the recipient wants HTML mail. (popup_menu_card): Add menu item for HTML mail. Enable edit contact info item. (popup_menu_nocard): Add menu item for HTML mail. Enable edit contact info item. * backend/ebook/e-book-util.c (e_book_use_local_address_book): Added. Fetches the local addressbook and caches it on the first call. This is meant to be an easy and efficient way to get at the local addressbook with the minimum of code. (e_book_query_address_locally): Added. Convenience code that does an e-mail only e_book_name_and_email_query against the local address book. * backend/ebook/e-destination.c (e_destination_set_html_mail_pref): Added. Allows the intended recipient's HTML mail preference to be manipulated. (e_destination_get_email_verbose): Added. Cleaned up to use e_destination_get_name. (e_destination_get_html_mail_pref): Added. Read the recipient's HTML mail preference. If the destination is linked to a card, the preference is taken from the card (unless it has been explicitly overridden by a called to e_destination_set_html_mail_pref). (e_destination_get_address_textv): Added. Form a unified address string from a NULL-terminated vector of EDestinations. (e_destination_export): Added. Serialize an EDestination to a string. (e_destination_import): Added. Unserialize a string to build an EDestination. (e_destination_exportv): Added. Serialize a NULL-terminated vector of EDestinations to a string. (e_destination_importv): Added. Unserialize a string to build a NULL-terminated vector of EDestinations. * gui/component/select-names/e-select-names-completion.c: Implemented local versions of g_strcasecmp and g_strncasecmp (which should really be in glib, I think...) for utf8, and used them to make this code utf8-safe. 2001-05-18 Jon Trowbridge <trow@ximian.com> * Makefile.am (evolution_mail_LDADD): Added libebook.la (which is now required by the composer.) 2001-05-18 Jon Trowbridge <trow@ximian.com> * e-msg-composer-hdrs.c (set_recipients): Properly unserialize the string returned by the "text" property of the bonobo control, convert it into EDestinations, and use them to get the e-mail addresses of our recipients. 22001-05-18 Jon Trowbridge <trow@ximian.com> * Makefile.am (SUBDIRS): Changed build order. Now addressbook gets built before mail. svn path=/trunk/; revision=9878
Diffstat (limited to 'addressbook/gui/component/select-names/e-select-names-popup.c')
-rw-r--r--addressbook/gui/component/select-names/e-select-names-popup.c93
1 files changed, 86 insertions, 7 deletions
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 f6164f0022..4f40093901 100644
--- a/addressbook/gui/component/select-names/e-select-names-popup.c
+++ b/addressbook/gui/component/select-names/e-select-names-popup.c
@@ -38,6 +38,8 @@
#include <libgnomeui/gnome-app-helper.h>
#include <libgnomeui/gnome-popup-menu.h>
+#include <addressbook/backend/ebook/e-book-util.h>
+#include <addressbook/contact-editor/e-contact-editor.h>
#include <addressbook/contact-editor/e-contact-quick-add.h>
#include "e-select-names-popup.h"
@@ -88,10 +90,38 @@ popup_info_cleanup (GtkWidget *w, gpointer info)
popup_info_free ((PopupInfo *) info);
}
+/* You are in a maze of twisty little callbacks, all alike... */
+
+static void
+found_fields_cb (EBook *book, EBookStatus status, EList *writable_fields, gpointer user_data)
+{
+ EDestination *dest = E_DESTINATION (user_data);
+ EContactEditor *ce;
+ ECard *card;
+
+ card = (ECard *) e_destination_get_card (dest);
+ ce = e_contact_editor_new (card, FALSE, writable_fields, FALSE);
+ e_contact_editor_raise (ce);
+ gtk_object_unref (GTK_OBJECT (dest));
+}
+
+static void
+edit_contact_info_have_book_cb (EBook *book, gpointer user_data)
+{
+ if (book) {
+ e_book_get_supported_fields (book, found_fields_cb, user_data);
+ }
+}
+
static void
-do_nothing (gpointer foo)
+edit_contact_info_cb (GtkWidget *w, gpointer user_data)
{
+ PopupInfo *info = (PopupInfo *) user_data;
+ if (info == NULL)
+ return;
+ gtk_object_ref (GTK_OBJECT (info->dest));
+ e_book_use_local_address_book (edit_contact_info_have_book_cb, info->dest);
}
static void
@@ -147,6 +177,39 @@ add_remove_all_recipients (GnomeUIInfo *uiinfo, PopupInfo *info)
uiinfo->moreinfo = remove_all_recipients_cb;
}
+static void
+toggle_html_mail_cb (GtkWidget *w, gpointer user_data)
+{
+ PopupInfo *info = (PopupInfo *) user_data;
+ GtkCheckMenuItem *item = GTK_CHECK_MENU_ITEM (w);
+ const EDestination *dest;
+
+ if (info == NULL)
+ return;
+
+ dest = info->dest;
+
+ item = GTK_CHECK_MENU_ITEM (item);
+ e_destination_set_html_mail_pref ((EDestination *) dest, item->active);
+}
+
+static void
+add_html_mail (GnomeUIInfo *uiinfo, PopupInfo *info)
+{
+ uiinfo->type = GNOME_APP_UI_TOGGLEITEM;
+ uiinfo->label = _("Send HTML Mail?");
+ uiinfo->moreinfo = toggle_html_mail_cb;
+}
+
+static void
+init_html_mail (GnomeUIInfo *uiinfo, PopupInfo *info)
+{
+ gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (uiinfo->widget),
+ e_destination_get_html_mail_pref (info->dest));
+ gtk_check_menu_item_set_show_toggle (GTK_CHECK_MENU_ITEM (uiinfo->widget), TRUE);
+
+}
+
#define ARBITRARY_UIINFO_LIMIT 64
static GtkWidget *
popup_menu_card (PopupInfo *info)
@@ -159,6 +222,7 @@ popup_menu_card (PopupInfo *info)
GtkWidget *pop;
EIterator *iterator;
gchar *name_str;
+ gint html_toggle;
/*
* Build up our GnomeUIInfo array.
@@ -184,11 +248,14 @@ popup_menu_card (PopupInfo *info)
iterator = e_list_get_iterator (card->email);
for (e_iterator_reset (iterator); e_iterator_is_valid (iterator); e_iterator_next (iterator)) {
+ gchar *label = (gchar *)e_iterator_get (iterator);
- radioinfo[j].type = GNOME_APP_UI_ITEM;
- radioinfo[j].label = (gchar *)e_iterator_get (iterator);
- radioinfo[j].moreinfo = change_email_num_cb;
- ++j;
+ if (label && *label) {
+ radioinfo[j].type = GNOME_APP_UI_ITEM;
+ radioinfo[j].label = label;
+ radioinfo[j].moreinfo = change_email_num_cb;
+ ++j;
+ }
}
radioinfo[j].type = GNOME_APP_UI_ENDOFINFO;
@@ -206,9 +273,13 @@ popup_menu_card (PopupInfo *info)
uiinfo[i].type = GNOME_APP_UI_SEPARATOR;
++i;
+ add_html_mail (&(uiinfo[i]), info);
+ html_toggle = i;
+ ++i;
+
uiinfo[i].type = GNOME_APP_UI_ITEM;
uiinfo[i].label = N_("Edit Contact Info");
- uiinfo[i].moreinfo = do_nothing;
+ uiinfo[i].moreinfo = edit_contact_info_cb;
++i;
add_remove_recipient (&(uiinfo[i]), info);
@@ -236,6 +307,8 @@ popup_menu_card (PopupInfo *info)
}
}
+ init_html_mail (&(uiinfo[html_toggle]), info);
+
return pop;
}
@@ -253,6 +326,7 @@ popup_menu_nocard (PopupInfo *info)
gint i=0;
GtkWidget *pop;
const gchar *str;
+ gint html_toggle;
memset (uiinfo, 0, sizeof (uiinfo));
@@ -265,6 +339,10 @@ popup_menu_nocard (PopupInfo *info)
uiinfo[i].type = GNOME_APP_UI_SEPARATOR;
++i;
+ add_html_mail (&(uiinfo[i]), info);
+ html_toggle = i;
+ ++i;
+
uiinfo[i].type = GNOME_APP_UI_ITEM;
uiinfo[i].label = _("Add to Contacts");
uiinfo[i].moreinfo = quick_add_cb;
@@ -279,11 +357,12 @@ popup_menu_nocard (PopupInfo *info)
uiinfo[i].type = GNOME_APP_UI_ENDOFINFO;
pop = gnome_popup_menu_new (uiinfo);
+
+ init_html_mail (&(uiinfo[html_toggle]), info);
return pop;
}
-
void
e_select_names_popup (ESelectNamesModel *model, GdkEventButton *ev, gint pos)
{