aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon Trowbridge <trow@ximian.com>2001-03-23 17:39:37 +0800
committerJon Trowbridge <trow@src.gnome.org>2001-03-23 17:39:37 +0800
commit4f26eac120fd30b1f8199a6aec29c436bfb558a4 (patch)
tree71ee7b80b87d7e47e5ead203ad7a8b63c2d33826
parente4affa9382419295eb9911d5528c1b9e38cb6283 (diff)
downloadgsoc2013-evolution-4f26eac120fd30b1f8199a6aec29c436bfb558a4.tar
gsoc2013-evolution-4f26eac120fd30b1f8199a6aec29c436bfb558a4.tar.gz
gsoc2013-evolution-4f26eac120fd30b1f8199a6aec29c436bfb558a4.tar.bz2
gsoc2013-evolution-4f26eac120fd30b1f8199a6aec29c436bfb558a4.tar.lz
gsoc2013-evolution-4f26eac120fd30b1f8199a6aec29c436bfb558a4.tar.xz
gsoc2013-evolution-4f26eac120fd30b1f8199a6aec29c436bfb558a4.tar.zst
gsoc2013-evolution-4f26eac120fd30b1f8199a6aec29c436bfb558a4.zip
Added. Call me old-fashioned, but I just prefer to have a real API rather
2001-03-23 Jon Trowbridge <trow@ximian.com> * gui/widgets/e-minicard-widget.c (e_minicard_widget_set_card): Added. Call me old-fashioned, but I just prefer to have a real API rather than doing everything via gtk_object_get/set-type calls. (e_minicard_widget_set_arg): Changed to call e_minicard_widget_set_card. * backend/ebook/e-book-util.c: Small changes to get rid of compiler warnings. (Casting out const, removed unused variables, etc.) Removed some debugging messages. * gui/component/addressbook-factory.c (main): Added call to e_address_popup_factory_init. * gui/component/e-address-popup.c: Added. A popup gadget that is invoked (as a bonobo control) when an address is left-clicked in the mailer. The addressbook is queries, and the address is either displayed as a minicard (if it already exists) or in a "generic format". A button is provided for editting/adding the contact. Some of the semantics of this widget are a bit... non-standard, because of bonobo issues. I can't really seem to replicate popup-menu behavior because of how bonobo propogates events, etc. so I've tried to produce something that I think is non-annoying. YMMV. 2001-03-23 Jon Trowbridge <trow@ximian.com> * mail-display.c (handle_embedded_address_object): #ifdef away some code I don't quite want to delete yet. (html_button_press_event): Remove some of Radek's placeholder code, replace it with code to create my AddressPopup bonobo control. * mail-format.c: Remove some obsolete code that if #ifdef-ed out a while ago. * mail-ops.c (send_queue_send): Strip out the X-Evolution-Identity header when sending. 2001-03-23 Jon Trowbridge <trow@ximian.com> * camel-filter-driver.c (camel_filter_driver_filter_message): Don't call camel_mime_message_set_identity. (The call is commented out, left over from some earlier experimentation that I want to be able to remember later...) * camel-mime-message.c (camel_mime_message_set_identity): Added. A function to set the X-Evolution-Identity header. svn path=/trunk/; revision=8916
-rw-r--r--addressbook/ChangeLog27
-rw-r--r--addressbook/backend/ebook/e-book-util.c6
-rw-r--r--addressbook/gui/component/GNOME_Evolution_Addressbook.oaf.in27
-rw-r--r--addressbook/gui/component/Makefile.am4
-rw-r--r--addressbook/gui/component/addressbook-factory.c2
-rw-r--r--addressbook/gui/component/e-address-popup.c521
-rw-r--r--addressbook/gui/component/e-address-popup.h86
-rw-r--r--addressbook/gui/component/e-address-widget.c1
-rw-r--r--addressbook/gui/component/e-address-widget.h2
-rw-r--r--addressbook/gui/widgets/e-minicard-widget.c38
-rw-r--r--addressbook/gui/widgets/e-minicard-widget.h2
-rw-r--r--camel/ChangeLog10
-rw-r--r--camel/camel-filter-driver.c4
-rw-r--r--camel/camel-mime-message.c7
-rw-r--r--camel/camel-mime-message.h4
-rw-r--r--mail/ChangeLog14
-rw-r--r--mail/mail-display.c34
-rw-r--r--mail/mail-format.c28
-rw-r--r--mail/mail-ops.c8
-rw-r--r--mail/mail-send-recv.c2
20 files changed, 755 insertions, 72 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index 5ede0f8bfd..747c89f897 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,3 +1,30 @@
+2001-03-23 Jon Trowbridge <trow@ximian.com>
+
+ * gui/widgets/e-minicard-widget.c (e_minicard_widget_set_card):
+ Added. Call me old-fashioned, but I just prefer to have a real
+ API rather than doing everything via gtk_object_get/set-type
+ calls.
+ (e_minicard_widget_set_arg): Changed to call
+ e_minicard_widget_set_card.
+
+ * backend/ebook/e-book-util.c: Small changes to get rid of
+ compiler warnings. (Casting out const, removed unused variables,
+ etc.) Removed some debugging messages.
+
+ * gui/component/addressbook-factory.c (main): Added call
+ to e_address_popup_factory_init.
+
+ * gui/component/e-address-popup.c: Added. A popup gadget that is
+ invoked (as a bonobo control) when an address is left-clicked in
+ the mailer. The addressbook is queries, and the address is either
+ displayed as a minicard (if it already exists) or in a "generic
+ format". A button is provided for editting/adding the contact.
+ Some of the semantics of this widget are a bit... non-standard,
+ because of bonobo issues. I can't really seem to replicate
+ popup-menu behavior because of how bonobo propogates events, etc.
+ so I've tried to produce something that I think is non-annoying.
+ YMMV.
+
2001-03-22 Iain Holmes <iain@ximian.com>
* backend/ebook/evolution-gnomecard-importer.c: Update to the new
diff --git a/addressbook/backend/ebook/e-book-util.c b/addressbook/backend/ebook/e-book-util.c
index 1d1106e8f2..1c79ea5d71 100644
--- a/addressbook/backend/ebook/e-book-util.c
+++ b/addressbook/backend/ebook/e-book-util.c
@@ -151,8 +151,6 @@ simple_query_new (EBook *book, const char *query, EBookSimpleQueryCallback cb, g
static void
simple_query_free (SimpleQueryInfo *sq)
{
- GList *i;
-
/* Remove ourselves from the EBook's pending list. */
book_remove_simple_query (sq->book, sq);
@@ -271,7 +269,7 @@ e_book_simple_query (EBook *book, const char *query, EBookSimpleQueryCallback cb
#ifdef USE_WORKAROUND
gtk_timeout_add (50, WORKAROUND_try_queue, NULL);
#else
- e_book_get_book_view (book, query, simple_query_book_view_cb, sq);
+ e_book_get_book_view (book, (gchar *) query, simple_query_book_view_cb, sq);
#endif
return sq->tag;
@@ -426,8 +424,6 @@ e_book_name_and_email_query (EBook *book,
} else
return 0;
- g_message ("query: %s", query);
-
info = g_new0 (NameEmailQueryInfo, 1);
info->name = g_strdup (name);
info->email = g_strdup (email);
diff --git a/addressbook/gui/component/GNOME_Evolution_Addressbook.oaf.in b/addressbook/gui/component/GNOME_Evolution_Addressbook.oaf.in
index 2e604862af..7350b4925e 100644
--- a/addressbook/gui/component/GNOME_Evolution_Addressbook.oaf.in
+++ b/addressbook/gui/component/GNOME_Evolution_Addressbook.oaf.in
@@ -117,4 +117,31 @@
</oaf_server>
+<oaf_server iid="OAFIID:GNOME_Evolution_Addressbook_AddressPopupFactory"
+ type="exe"
+ location="evolution-addressbook">
+
+ <oaf_attribute name="repo_ids" type="stringv">
+ <item value="IDL:GNOME/ObjectFactory:1.0"/>
+ </oaf_attribute>
+
+ <oaf_attribute name="description" type="string"
+ _value="Factory for the Addressbook's address popup"/>
+
+</oaf_server>
+
+<oaf_server iid="OAFIID:GNOME_Evolution_Addressbook_AddressPopup"
+ type="factory"
+ location="OAFIID:GNOME_Evolution_Addressbook_AddressPopupFactory">
+
+ <oaf_attribute name="repo_ids" type="stringv">
+ <item value="IDL:BonoboControl/address-widget:1.0"/>
+ <item value="IDL:GNOME/Control:1.0"/>
+ </oaf_attribute>
+
+ <oaf_attribute name="description" type="string"
+ _value="A Bonobo control for an address popup."/>
+
+</oaf_server>
+
</oaf_info>
diff --git a/addressbook/gui/component/Makefile.am b/addressbook/gui/component/Makefile.am
index 59b1d4c394..3089f53901 100644
--- a/addressbook/gui/component/Makefile.am
+++ b/addressbook/gui/component/Makefile.am
@@ -38,7 +38,9 @@ evolution_addressbook_SOURCES = \
e-cardlist-model.c \
e-cardlist-model.h \
e-address-widget.h \
- e-address-widget.c
+ e-address-widget.c \
+ e-address-popup.h \
+ e-address-popup.c
evolution_addressbook_LDADD = \
select-names/libeselectnames.la \
diff --git a/addressbook/gui/component/addressbook-factory.c b/addressbook/gui/component/addressbook-factory.c
index 51ccb27168..7078a774ef 100644
--- a/addressbook/gui/component/addressbook-factory.c
+++ b/addressbook/gui/component/addressbook-factory.c
@@ -19,6 +19,7 @@
#include "addressbook.h"
#include "addressbook-component.h"
#include "e-address-widget.h"
+#include "e-address-popup.h"
#include "addressbook/gui/widgets/e-minicard-control.h"
#include "select-names/e-select-names-factory.h"
@@ -65,6 +66,7 @@ main (int argc, char **argv)
e_minicard_control_factory_init ();
e_address_widget_factory_init ();
+ e_address_popup_factory_init ();
e_cursors_init();
diff --git a/addressbook/gui/component/e-address-popup.c b/addressbook/gui/component/e-address-popup.c
new file mode 100644
index 0000000000..19afd29baf
--- /dev/null
+++ b/addressbook/gui/component/e-address-popup.c
@@ -0,0 +1,521 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ * e-address-popup.c
+ *
+ * Copyright (C) 2001 Ximian, Inc.
+ *
+ * Developed by Jon Trowbridge <trow@ximian.com>
+ */
+
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA.
+ */
+
+#include <config.h>
+#include "e-address-popup.h"
+#include <bonobo/bonobo-control.h>
+#include <bonobo/bonobo-property-bag.h>
+#include <bonobo/bonobo-generic-factory.h>
+#include <gal/widgets/e-popup-menu.h>
+#include <addressbook/backend/ebook/e-book.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 <addressbook/gui/widgets/e-minicard-widget.h>
+
+static GtkObjectClass *parent_class;
+static EBook *common_book = NULL; /* still sort of lame */
+
+static void e_address_popup_destroy (GtkObject *);
+static void e_address_popup_realize (GtkWidget *);
+static gint e_address_popup_button_press_event (GtkWidget *, GdkEventButton *ev);
+static gint e_address_popup_enter_notify_event (GtkWidget *, GdkEventCrossing *ev);
+static gint e_address_popup_leave_notify_event (GtkWidget *, GdkEventCrossing *ev);
+
+static void e_address_popup_query (EAddressPopup *);
+
+
+static void
+e_address_popup_class_init (EAddressPopupClass *klass)
+{
+ GtkObjectClass *object_class = (GtkObjectClass *) klass;
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+ parent_class = GTK_OBJECT_CLASS (gtk_type_class (gtk_event_box_get_type ()));
+
+ object_class->destroy = e_address_popup_destroy;
+
+ widget_class->realize = e_address_popup_realize;
+ widget_class->button_press_event = e_address_popup_button_press_event;
+ widget_class->enter_notify_event = e_address_popup_enter_notify_event;
+ widget_class->leave_notify_event = e_address_popup_leave_notify_event;
+}
+
+static void
+e_address_popup_init (EAddressPopup *pop)
+{
+
+}
+
+static void
+e_address_popup_destroy (GtkObject *obj)
+{
+ EAddressPopup *pop = E_ADDRESS_POPUP (obj);
+
+ if (pop->card)
+ gtk_object_unref (GTK_OBJECT (pop->card));
+
+ if (pop->leave_timeout_tag)
+ gtk_timeout_remove (pop->leave_timeout_tag);
+
+ g_free (pop->name);
+ g_free (pop->email);
+
+ if (GTK_OBJECT_CLASS (parent_class)->destroy)
+ GTK_OBJECT_CLASS (parent_class)->destroy (obj);
+}
+
+static void
+e_address_popup_realize (GtkWidget *w)
+{
+ EAddressPopup *pop = E_ADDRESS_POPUP (w);
+
+ if (GTK_WIDGET_CLASS (parent_class)->realize)
+ GTK_WIDGET_CLASS (parent_class)->realize (w);
+
+ /* Start the death count. */
+ pop->leave_timeout_tag = gtk_timeout_add (10000, (GtkFunction) gtk_widget_destroy, pop);
+}
+
+static gint
+e_address_popup_button_press_event (GtkWidget *w, GdkEventButton *ev)
+{
+ gtk_widget_destroy (w);
+ return FALSE;
+}
+
+static gint
+e_address_popup_enter_notify_event (GtkWidget *w, GdkEventCrossing *ev)
+{
+ EAddressPopup *pop = E_ADDRESS_POPUP (w);
+
+ if (pop->leave_timeout_tag) {
+ gtk_timeout_remove (pop->leave_timeout_tag);
+ pop->leave_timeout_tag = 0;
+ }
+
+ return FALSE;
+}
+
+static gint
+e_address_popup_leave_notify_event (GtkWidget *w, GdkEventCrossing *ev)
+{
+ EAddressPopup *pop = E_ADDRESS_POPUP (w);
+ const gint slack=5;
+ gint x, y;
+
+ /* Manually check our "leave" events to avoid weird erroneous leaves
+ that seem related to bonobo... */
+ gdk_window_get_pointer (w->window, &x, &y, NULL);
+ if (slack <= x && x < w->allocation.width-slack && slack <= y && y < w->allocation.height-slack)
+ return FALSE;
+
+ if (pop->leave_timeout_tag == 0)
+ pop->leave_timeout_tag = gtk_timeout_add (1000, (GtkFunction) gtk_widget_destroy, pop);
+
+ return FALSE;
+}
+
+GtkType
+e_address_popup_get_type (void)
+{
+ static GtkType pop_type = 0;
+
+ if (!pop_type) {
+ GtkTypeInfo pop_info = {
+ "EAddressPopup",
+ sizeof (EAddressPopup),
+ sizeof (EAddressPopupClass),
+ (GtkClassInitFunc) e_address_popup_class_init,
+ (GtkObjectInitFunc) e_address_popup_init,
+ NULL, NULL,
+ (GtkClassInitFunc) NULL
+ };
+
+ pop_type = gtk_type_unique (gtk_event_box_get_type (), &pop_info);
+ }
+
+ return pop_type;
+}
+
+static void
+e_address_popup_refresh_names (EAddressPopup *pop)
+{
+ if (pop->name_widget) {
+ if (pop->name && *pop->name) {
+ gtk_label_set_text (GTK_LABEL (pop->name_widget), pop->name);
+ gtk_widget_show (pop->name_widget);
+ } else {
+ gtk_widget_hide (pop->name_widget);
+ }
+ }
+
+ if (pop->email_widget) {
+ if (pop->email && *pop->email) {
+ gtk_label_set_text (GTK_LABEL (pop->email_widget), pop->email);
+ gtk_widget_show (pop->email_widget);
+ } else {
+ gtk_widget_hide (pop->email_widget);
+ }
+ }
+
+ e_address_popup_query (pop);
+}
+
+void
+e_address_popup_set_name (EAddressPopup *pop, const gchar *name)
+{
+ g_return_if_fail (pop && E_IS_ADDRESS_POPUP (pop));
+
+ g_free (pop->name);
+ pop->name = g_strdup (name);
+ g_strstrip (pop->name);
+
+ ++pop->set_count;
+
+ if (pop->set_count >= 2)
+ e_address_popup_refresh_names (pop);
+}
+
+void
+e_address_popup_set_email (EAddressPopup *pop, const gchar *email)
+{
+ g_return_if_fail (pop && E_IS_ADDRESS_POPUP (pop));
+
+ g_free (pop->email);
+ pop->email = g_strdup (email);
+ g_strstrip (pop->email);
+
+ ++pop->set_count;
+
+ if (pop->set_count >= 2)
+ e_address_popup_refresh_names (pop);
+}
+
+void
+e_address_popup_construct (EAddressPopup *pop)
+{
+ GtkWidget *vbox, *name_holder;
+ GdkColor color = { 0x0, 0xffff, 0xffff, 0xffff };
+
+ g_return_if_fail (pop && E_IS_ADDRESS_POPUP (pop));
+
+ pop->main_vbox = gtk_vbox_new (FALSE, 0);
+
+ /* Build Generic View */
+
+ name_holder = gtk_event_box_new ();
+ vbox = gtk_vbox_new (FALSE, 2);
+ pop->name_widget = gtk_label_new ("");
+ pop->email_widget = gtk_label_new ("");
+
+ gtk_box_pack_start (GTK_BOX (vbox), pop->name_widget, TRUE, TRUE, 2);
+ gtk_box_pack_start (GTK_BOX (vbox), pop->email_widget, TRUE, TRUE, 2);
+ gtk_container_add (GTK_CONTAINER (name_holder), GTK_WIDGET (vbox));
+
+ if (gdk_colormap_alloc_color (gtk_widget_get_colormap (GTK_WIDGET (name_holder)), &color, FALSE, TRUE)) {
+ GtkStyle *style = gtk_style_copy (gtk_widget_get_style (GTK_WIDGET (name_holder)));
+ style->bg[0] = color;
+ gtk_widget_set_style (GTK_WIDGET (name_holder), style);
+ }
+
+ pop->generic_view = gtk_frame_new (NULL);
+ gtk_container_add (GTK_CONTAINER (pop->generic_view), name_holder);
+ gtk_box_pack_start (GTK_BOX (pop->main_vbox), pop->generic_view, TRUE, TRUE, 0);
+ gtk_widget_show_all (pop->generic_view);
+
+ pop->query_msg = gtk_label_new ("Querying Addressbook...");
+ gtk_box_pack_start (GTK_BOX (pop->main_vbox), pop->query_msg, TRUE, TRUE, 0);
+ gtk_widget_show (pop->query_msg);
+
+ /* Build Minicard View */
+ pop->minicard_view = e_minicard_widget_new ();
+ gtk_box_pack_start (GTK_BOX (pop->main_vbox), pop->minicard_view, TRUE, TRUE, 0);
+
+
+ /* Final assembly */
+
+ gtk_container_add (GTK_CONTAINER (pop), pop->main_vbox);
+ gtk_widget_show (pop->main_vbox);
+
+ gtk_container_set_border_width (GTK_CONTAINER (vbox), 3);
+ gtk_container_set_border_width (GTK_CONTAINER (pop), 2);
+}
+
+GtkWidget *
+e_address_popup_new (void)
+{
+ EAddressPopup *pop = gtk_type_new (E_ADDRESS_POPUP_TYPE);
+ e_address_popup_construct (pop);
+ return GTK_WIDGET (pop);
+}
+
+static GtkWidget *
+e_address_popup_popup (EAddressPopup *pop)
+{
+ GtkWidget *win, *fr;
+ gint x, y;
+
+ win = gtk_window_new (GTK_WINDOW_POPUP);
+ fr = gtk_frame_new (NULL);
+ gtk_container_add (GTK_CONTAINER (win), fr);
+ gtk_container_add (GTK_CONTAINER (fr), GTK_WIDGET (pop));
+
+ gtk_window_set_policy (GTK_WINDOW (win), FALSE, FALSE, FALSE);
+
+ gdk_window_get_pointer (NULL, &x, &y, NULL);
+ x = MAX (x-10, 0);
+ y = MAX (y-10, 0);
+ gtk_widget_set_uposition (win, x, y);
+
+ gtk_signal_connect_object (GTK_OBJECT (pop),
+ "destroy",
+ GTK_SIGNAL_FUNC(gtk_widget_destroy),
+ GTK_OBJECT (win));
+
+ gtk_widget_show (GTK_WIDGET (pop));
+ gtk_widget_show (fr);
+ gtk_widget_show (win);
+
+ return win;
+}
+
+static void
+found_fields_cb (EBook *book, EBookStatus status, EList *writable_fields, gpointer closure)
+{
+ EAddressPopup *pop = E_ADDRESS_POPUP (closure);
+ EContactEditor *ce = e_contact_editor_new (pop->card, FALSE, writable_fields, FALSE);
+ e_contact_editor_raise (ce);
+ gtk_widget_destroy (GTK_WIDGET (pop));
+}
+
+static void
+edit_contact_info_cb (EAddressPopup *pop)
+{
+ e_book_get_supported_fields (common_book, found_fields_cb, pop);
+}
+
+static void
+e_address_popup_cardify (EAddressPopup *pop, ECard *card)
+{
+ GtkWidget *b;
+
+ g_return_if_fail (pop && E_IS_ADDRESS_POPUP (pop));
+ g_return_if_fail (card && E_IS_CARD (card));
+ g_return_if_fail (pop->card == NULL);
+
+ pop->card = card;
+ gtk_object_ref (GTK_OBJECT (pop->card));
+
+ e_minicard_widget_set_card (E_MINICARD_WIDGET (pop->minicard_view), card);
+ gtk_widget_show (pop->minicard_view);
+ gtk_widget_hide (pop->generic_view);
+
+ b = gtk_button_new_with_label ("Edit Contact Info");
+ gtk_box_pack_start (GTK_BOX (pop->main_vbox), b, TRUE, TRUE, 0);
+ gtk_signal_connect_object (GTK_OBJECT (b),
+ "clicked",
+ GTK_SIGNAL_FUNC (edit_contact_info_cb),
+ GTK_OBJECT (pop));
+ gtk_widget_show (b);
+}
+
+static void
+add_contacts_cb (EAddressPopup *pop)
+{
+ e_contact_quick_add (pop->name, pop->email, NULL, NULL);
+ gtk_widget_destroy (GTK_WIDGET (pop));
+}
+
+static void
+e_address_popup_no_matches (EAddressPopup *pop)
+{
+ GtkWidget *b;
+
+ g_return_if_fail (pop && E_IS_ADDRESS_POPUP (pop));
+
+ b = gtk_button_new_with_label ("Add to Contacts");
+ gtk_box_pack_start (GTK_BOX (pop->main_vbox), b, TRUE, TRUE, 0);
+ gtk_signal_connect_object (GTK_OBJECT (b),
+ "clicked",
+ GTK_SIGNAL_FUNC (add_contacts_cb),
+ GTK_OBJECT (pop));
+ gtk_widget_show (b);
+}
+
+static void
+e_address_popup_multiple_matches (EAddressPopup *pop)
+{
+
+}
+
+
+/** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** **/
+
+/*
+ * Addressbook Query Fun
+ */
+
+static void
+query_cb (EBook *book, EBookSimpleQueryStatus status, const GList *cards, gpointer closure)
+{
+ EAddressPopup *pop;
+
+ if (status != E_BOOK_SIMPLE_QUERY_STATUS_SUCCESS)
+ return;
+
+ pop = E_ADDRESS_POPUP (closure);
+
+ pop->have_queried = TRUE;
+ gtk_widget_hide (pop->query_msg);
+
+ if (cards == NULL) {
+
+ e_address_popup_no_matches (pop);
+
+ } else {
+ if (g_list_length ((GList *) cards) == 1)
+ e_address_popup_cardify (pop, E_CARD (cards->data));
+ else
+ e_address_popup_multiple_matches (pop);
+ }
+
+ pop->query_tag = 0;
+}
+
+static void
+start_query (EAddressPopup *pop)
+{
+ g_assert (common_book != NULL);
+ g_return_if_fail (pop && E_IS_ADDRESS_POPUP (pop));
+
+ if (pop->query_tag)
+ e_book_simple_query_cancel (common_book, pop->query_tag);
+
+ pop->query_tag = e_book_name_and_email_query (common_book, pop->name, pop->email, query_cb, pop);
+}
+
+static void
+loaded_book_cb (EBook *book, EBookStatus status, gpointer closure)
+{
+ g_return_if_fail (status == E_BOOK_STATUS_SUCCESS);
+ g_return_if_fail (book != NULL);
+
+ if (common_book == NULL) {
+ common_book = book;
+ gtk_object_ref (GTK_OBJECT (common_book));
+ }
+
+ start_query (E_ADDRESS_POPUP (closure));
+}
+
+static void
+e_address_popup_query (EAddressPopup *pop)
+{
+ g_return_if_fail (pop && E_IS_ADDRESS_POPUP (pop));
+
+ if (common_book == NULL) {
+ EBook *book = e_book_new ();
+ e_book_load_local_address_book (book, loaded_book_cb, pop);
+ } else {
+ start_query (pop);
+ }
+}
+
+/** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** **/
+
+enum {
+ PROPERTY_NAME,
+ PROPERTY_EMAIL
+};
+
+static void
+set_prop (BonoboPropertyBag *bag, const BonoboArg *arg, guint arg_id, CORBA_Environment *ev, gpointer user_data)
+{
+ EAddressPopup *pop = E_ADDRESS_POPUP (user_data);
+
+ switch (arg_id) {
+
+ case PROPERTY_NAME:
+ e_address_popup_set_name (pop, BONOBO_ARG_GET_STRING (arg));
+ break;
+
+ case PROPERTY_EMAIL:
+ e_address_popup_set_email (pop, BONOBO_ARG_GET_STRING (arg));
+ break;
+
+ default:
+ g_assert_not_reached ();
+ }
+
+}
+
+static BonoboControl *
+e_address_popup_factory_new_control (void)
+{
+ BonoboControl *control;
+ BonoboPropertyBag *bag;
+ GtkWidget *w;
+
+ w = e_address_popup_new ();
+ control = bonobo_control_new (e_address_popup_popup (E_ADDRESS_POPUP (w)));
+
+ bag = bonobo_property_bag_new (NULL, set_prop, w);
+ bonobo_property_bag_add (bag, "name", PROPERTY_NAME,
+ BONOBO_ARG_STRING, NULL, NULL,
+ BONOBO_PROPERTY_WRITEABLE);
+
+ bonobo_property_bag_add (bag, "email", PROPERTY_EMAIL,
+ BONOBO_ARG_STRING, NULL, NULL,
+ BONOBO_PROPERTY_WRITEABLE);
+
+ bonobo_control_set_properties (control, bag);
+ bonobo_object_unref (BONOBO_OBJECT (bag));
+
+ return control;
+}
+
+static BonoboObject *
+e_address_popup_factory (BonoboGenericFactory *factory, gpointer user_data)
+{
+ return BONOBO_OBJECT (e_address_popup_factory_new_control ());
+}
+
+void
+e_address_popup_factory_init (void)
+{
+ static BonoboGenericFactory *factory = NULL;
+
+ if (factory != NULL)
+ return;
+
+ factory = bonobo_generic_factory_new ("OAFIID:GNOME_Evolution_Addressbook_AddressPopupFactory",
+ e_address_popup_factory, NULL);
+
+ if (factory == NULL)
+ g_error ("I could not register an AddressPopup factory.");
+}
diff --git a/addressbook/gui/component/e-address-popup.h b/addressbook/gui/component/e-address-popup.h
new file mode 100644
index 0000000000..cac060fb4a
--- /dev/null
+++ b/addressbook/gui/component/e-address-popup.h
@@ -0,0 +1,86 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+/*
+ * e-address-popup.h
+ *
+ * Copyright (C) 2001 Ximian, Inc.
+ *
+ * Developed by Jon Trowbridge <trow@ximian.com>
+ */
+
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA.
+ */
+
+#ifndef __E_ADDRESS_POPUP_H__
+#define __E_ADDRESS_POPUP_H__
+
+#include <gtk/gtk.h>
+#include <libgnome/gnome-defs.h>
+#include <addressbook/backend/ebook/e-card.h>
+
+BEGIN_GNOME_DECLS
+
+#define E_ADDRESS_POPUP_TYPE (e_address_popup_get_type ())
+#define E_ADDRESS_POPUP(o) (GTK_CHECK_CAST ((o), E_ADDRESS_POPUP_TYPE, EAddressPopup))
+#define E_ADDRESS_POPUP_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), E_ADDRESS_POPUP_TYPE, EAddressPopupClass))
+#define E_IS_ADDRESS_POPUP(o) (GTK_CHECK_TYPE ((o), E_ADDRESS_POPUP_TYPE))
+#define E_IS_ADDRESS_POPUP_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_ADDRESS_POPUP_TYPE))
+
+typedef struct _EAddressPopup EAddressPopup;
+typedef struct _EAddressPopupClass EAddressPopupClass;
+
+struct _EAddressPopup {
+ GtkEventBox parent;
+
+ guint leave_timeout_tag;
+ gboolean grabbed;
+
+ gint set_count;
+ gchar *name;
+ gchar *email;
+
+ GtkWidget *name_widget;
+ GtkWidget *email_widget;
+ GtkWidget *query_msg;
+
+ GtkWidget *main_vbox;
+ GtkWidget *generic_view;
+ GtkWidget *minicard_view;
+
+ guint query_tag;
+ gboolean have_queried, multiple_matches;
+ ECard *card;
+};
+
+struct _EAddressPopupClass {
+ GtkEventBoxClass parent_class;
+};
+
+GtkType e_address_popup_get_type (void);
+
+void e_address_popup_set_name (EAddressPopup *, const gchar *name);
+void e_address_popup_set_email (EAddressPopup *, const gchar *email);
+
+void e_address_popup_construct (EAddressPopup *);
+GtkWidget *e_address_popup_new (void);
+
+void e_address_popup_factory_init (void);
+
+END_GNOME_DECLS
+
+#endif /* __E_ADDRESS_POPUP_H__ */
+
diff --git a/addressbook/gui/component/e-address-widget.c b/addressbook/gui/component/e-address-widget.c
index 92b0b9337c..f69ce5c58d 100644
--- a/addressbook/gui/component/e-address-widget.c
+++ b/addressbook/gui/component/e-address-widget.c
@@ -213,7 +213,6 @@ e_address_widget_construct (EAddressWidget *addr)
gtk_box_pack_start (GTK_BOX (box), addr->spacer, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (box), addr->email_widget, FALSE, FALSE, 0);
-
gtk_container_add (GTK_CONTAINER (addr), box);
gtk_widget_show (box);
diff --git a/addressbook/gui/component/e-address-widget.h b/addressbook/gui/component/e-address-widget.h
index 2b0b6073c5..a85ed90d8b 100644
--- a/addressbook/gui/component/e-address-widget.h
+++ b/addressbook/gui/component/e-address-widget.h
@@ -63,7 +63,7 @@ struct _EAddressWidget {
};
struct _EAddressWidgetClass {
- GtkHBoxClass parent_class;
+ GtkEventBoxClass parent_class;
};
GtkType e_address_widget_get_type (void);
diff --git a/addressbook/gui/widgets/e-minicard-widget.c b/addressbook/gui/widgets/e-minicard-widget.c
index 3f765425e4..3712d5e306 100644
--- a/addressbook/gui/widgets/e-minicard-widget.c
+++ b/addressbook/gui/widgets/e-minicard-widget.c
@@ -196,21 +196,12 @@ static void
e_minicard_widget_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
{
EMinicardWidget *emw = E_MINICARD_WIDGET(object);
+ gpointer ptr;
switch (arg_id){
case ARG_CARD:
- if (emw->card)
- gtk_object_unref(GTK_OBJECT(emw->card));
- if (GTK_VALUE_OBJECT(*arg)) {
- emw->card = E_CARD(GTK_VALUE_OBJECT(*arg));
- gtk_object_ref(GTK_OBJECT(emw->card));
- }
- else
- emw->card = NULL;
- if (emw->item)
- gtk_object_set(GTK_OBJECT(emw->item),
- "card", emw->card,
- NULL);
+ ptr = GTK_VALUE_POINTER (*arg);
+ e_minicard_widget_set_card (emw, ptr ? E_CARD (ptr) : NULL);
break;
default:
break;
@@ -234,3 +225,26 @@ e_minicard_widget_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
break;
}
}
+
+void
+e_minicard_widget_set_card (EMinicardWidget *emw, ECard *card)
+{
+ g_return_if_fail (emw && E_IS_MINICARD_WIDGET (emw));
+ g_return_if_fail (card == NULL || E_IS_CARD (card));
+
+ if (card != emw->card) {
+
+ if (emw->card)
+ gtk_object_unref (GTK_OBJECT (emw->card));
+
+ emw->card = card;
+
+ if (emw->card)
+ gtk_object_ref (GTK_OBJECT (emw->card));
+
+ if (emw->item)
+ gtk_object_set (GTK_OBJECT (emw->item),
+ "card", emw->card,
+ NULL);
+ }
+}
diff --git a/addressbook/gui/widgets/e-minicard-widget.h b/addressbook/gui/widgets/e-minicard-widget.h
index 95b56cf3de..3eb544c15e 100644
--- a/addressbook/gui/widgets/e-minicard-widget.h
+++ b/addressbook/gui/widgets/e-minicard-widget.h
@@ -68,6 +68,8 @@ struct _EMinicardWidgetClass
GtkWidget *e_minicard_widget_new(void);
GtkType e_minicard_widget_get_type (void);
+void e_minicard_widget_set_card (EMinicardWidget *, ECard *);
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
diff --git a/camel/ChangeLog b/camel/ChangeLog
index a4a45ed7dc..c531d8da68 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,13 @@
+2001-03-23 Jon Trowbridge <trow@ximian.com>
+
+ * camel-filter-driver.c (camel_filter_driver_filter_message):
+ Don't call camel_mime_message_set_identity. (The call is
+ commented out, left over from some earlier experimentation that I
+ want to be able to remember later...)
+
+ * camel-mime-message.c (camel_mime_message_set_identity): Added.
+ A function to set the X-Evolution-Identity header.
+
2001-03-22 Dan Winship <danw@ximian.com>
* providers/imap/camel-imap-command.c (imap_read_response): Don't
diff --git a/camel/camel-filter-driver.c b/camel/camel-filter-driver.c
index 794b105efa..17e7d92629 100644
--- a/camel/camel-filter-driver.c
+++ b/camel/camel-filter-driver.c
@@ -814,7 +814,7 @@ camel_filter_driver_filter_message (CamelFilterDriver *driver, CamelMimeMessage
struct _filter_rule *node;
gboolean freeinfo = FALSE;
gboolean filtered = FALSE;
-
+
if (info == NULL) {
struct _header_raw *h = CAMEL_MIME_PART (message)->headers;
@@ -833,6 +833,8 @@ camel_filter_driver_filter_message (CamelFilterDriver *driver, CamelMimeMessage
p->info = info;
p->uid = uid;
p->source = source;
+
+ /* camel_mime_message_set_identity (message, source_url); */
node = (struct _filter_rule *)p->rules.head;
while (node->next) {
diff --git a/camel/camel-mime-message.c b/camel/camel-mime-message.c
index 9e0fb7de11..4799627fd5 100644
--- a/camel/camel-mime-message.c
+++ b/camel/camel-mime-message.c
@@ -398,6 +398,13 @@ camel_mime_message_set_recipients(CamelMimeMessage *mime_message, const char *ty
g_free(text);
}
+void
+camel_mime_message_set_identity(CamelMimeMessage *mime_message, const char *identity)
+{
+ g_assert (mime_message);
+ camel_medium_add_header (CAMEL_MEDIUM (mime_message), "X-Evolution-Identity", identity);
+}
+
const CamelInternetAddress *
camel_mime_message_get_recipients(CamelMimeMessage *mime_message, const char *type)
{
diff --git a/camel/camel-mime-message.h b/camel/camel-mime-message.h
index 0ab406c27e..8d24245638 100644
--- a/camel/camel-mime-message.h
+++ b/camel/camel-mime-message.h
@@ -115,6 +115,10 @@ void camel_mime_message_set_recipients (CamelMimeMess
const char *type,
const CamelInternetAddress *r);
+void camel_mime_message_set_identity (CamelMimeMessage *mime_message,
+ const char *identity);
+
+
/* utility functions */
gboolean camel_mime_message_has_8bit_parts (CamelMimeMessage *mime_message);
void camel_mime_message_set_best_encoding (CamelMimeMessage *msg,
diff --git a/mail/ChangeLog b/mail/ChangeLog
index a5a02daec5..ccde26d72c 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,17 @@
+2001-03-23 Jon Trowbridge <trow@ximian.com>
+
+ * mail-display.c (handle_embedded_address_object): #ifdef away
+ some code I don't quite want to delete yet.
+ (html_button_press_event): Remove some of Radek's placeholder
+ code, replace it with code to create my AddressPopup bonobo
+ control.
+
+ * mail-format.c: Remove some obsolete code that if #ifdef-ed out
+ a while ago.
+
+ * mail-ops.c (send_queue_send): Strip out the X-Evolution-Identity
+ header when sending.
+
2001-03-23 Christopher James Lahey <clahey@ximian.com>
* message-list.c: Turned on BROKEN_ETREE.
diff --git a/mail/mail-display.c b/mail/mail-display.c
index 12f9711826..df3ead97db 100644
--- a/mail/mail-display.c
+++ b/mail/mail-display.c
@@ -1038,18 +1038,6 @@ mail_display_class_init (GtkObjectClass *object_class)
}
static void
-add_to_addressbook (GtkWidget *w, MailDisplay *mail_display)
-{
- g_print ("FIXME\n");
-}
-
-static void
-open_in_addressbook (GtkWidget *w, MailDisplay *mail_display)
-{
- g_print ("FIXME\n");
-}
-
-static void
link_open_in_browser (GtkWidget *w, MailDisplay *mail_display)
{
g_print ("FIXME\n");
@@ -1070,15 +1058,6 @@ link_copy_location (GtkWidget *w, MailDisplay *mail_display)
#define SEPARATOR { "", NULL, (NULL), NULL, 0 }
#define TERMINATOR { NULL, NULL, (NULL), NULL, 0 }
-static EPopupMenu address_menu [] = {
- { N_("Add to addressbook (FIXME)"), NULL,
- GTK_SIGNAL_FUNC (add_to_addressbook), NULL, 0 },
- { N_("Open in addressbook (FIXME)"), NULL,
- GTK_SIGNAL_FUNC (open_in_addressbook), NULL, 0 },
-
- TERMINATOR
-};
-
static EPopupMenu link_menu [] = {
{ N_("Open link in browser (FIXME)"), NULL,
GTK_SIGNAL_FUNC (link_open_in_browser), NULL, 0 },
@@ -1100,6 +1079,7 @@ html_button_press_event (GtkWidget *widget, GdkEventButton *event, MailDisplay *
if (event->button == 3) {
HTMLEngine *e;
HTMLPoint *point;
+ GtkWidget *popup_thing;
const gchar *email;
const gchar *name;
const gchar *link;
@@ -1110,8 +1090,16 @@ html_button_press_event (GtkWidget *widget, GdkEventButton *event, MailDisplay *
email = (const gchar *) html_object_get_data (point->object, "email");
if (email) {
name = (const gchar *) html_object_get_data (point->object, "name");
- g_print ("address: %s name: %s\n", email, name);
- e_popup_menu_run (address_menu, (GdkEvent *) event, 0, 0, mail_display);
+
+ popup_thing = bonobo_widget_new_control ("OAFIID:GNOME_Evolution_Addressbook_AddressPopup",
+ CORBA_OBJECT_NIL);
+
+ bonobo_widget_set_property (BONOBO_WIDGET (popup_thing),
+ "name", name,
+ "email", email,
+ NULL);
+ gtk_widget_show (popup_thing);
+
} else if ((link = html_object_get_url (point->object))) {
e_popup_menu_run (link_menu, (GdkEvent *) event, 0, 0, mail_display);
}
diff --git a/mail/mail-format.c b/mail/mail-format.c
index fc46526b9c..83c15ece17 100644
--- a/mail/mail-format.c
+++ b/mail/mail-format.c
@@ -623,32 +623,6 @@ write_subject (const char *subject, int flags, GtkHTML *html, GtkHTMLStream *str
g_free (encoded_subj);
}
-#ifdef USE_OBSOLETE_UNUSED_STUFF_AND_GET_COMPILER_WARNINGS
-static void
-write_field_to_stream(const char *description, const char *value, int flags, GtkHTML *html, GtkHTMLStream *stream)
-{
- char *encoded_desc, *encoded_value, *embedded_object;
- int bold = (flags&WRITE_BOLD) == WRITE_BOLD;
-
- /* The description comes from gettext... */
- encoded_desc = e_utf8_from_gtk_string (GTK_WIDGET (html), description);
-
- if (value)
- encoded_value = e_text_to_html (value, E_TEXT_TO_HTML_CONVERT_NL|E_TEXT_TO_HTML_CONVERT_URLS);
- else
- encoded_value = "";
-
- mail_html_write(html, stream,
- "<tr valign=top><%s align=right>%s</%s>"
- "<td> %s </td></tr>", bold ? "th" : "td",
- encoded_desc, bold ? "th" : "td", encoded_value);
- g_free (encoded_desc);
- g_free (embedded_object);
- if (value)
- g_free(encoded_value);
-}
-#endif
-
static void
write_address(MailDisplay *md, const CamelInternetAddress *addr, const char *field_name, int flags)
{
@@ -665,6 +639,7 @@ write_address(MailDisplay *md, const CamelInternetAddress *addr, const char *fie
while (camel_internet_address_get (addr, i, &name, &email)) {
if ((name && *name) || (email && *email)) {
+
/* we need these <B> </B> to separate HTMLText objects */
mail_html_write (md->html, md->stream, i ? ",<B> </B> " : "<td>");
mail_html_write (md->html, md->stream, " ");
@@ -682,6 +657,7 @@ write_address(MailDisplay *md, const CamelInternetAddress *addr, const char *fie
email);
mail_set = TRUE;
}
+
if (name && *name)
mail_html_write (md->html, md->stream, "%s ", name);
if (email && *email)
diff --git a/mail/mail-ops.c b/mail/mail-ops.c
index 17314ceee8..0334ab564a 100644
--- a/mail/mail-ops.c
+++ b/mail/mail-ops.c
@@ -643,6 +643,12 @@ send_queue_send(struct _mail_msg *mm)
if (camel_exception_is_set (&mm->ex))
break;
+ /* Remove the X-Evolution header so we don't send our flags too ;-) */
+ camel_medium_remove_header (CAMEL_MEDIUM (message), "X-Evolution");
+
+ /* We also don't want to send our identity header. */
+ camel_medium_remove_header (CAMEL_MEDIUM (message), "X-Evolution-Identity");
+
/* Get the preferred transport URI */
destination = (char *)camel_medium_get_header (CAMEL_MEDIUM (message), "X-Evolution-Transport");
if (destination) {
@@ -754,7 +760,7 @@ static char *append_mail_desc(struct _mail_msg *mm, int done)
static void append_mail_append(struct _mail_msg *mm)
{
struct _append_msg *m = (struct _append_msg *)mm;
-
+
camel_mime_message_set_date(m->message, CAMEL_MESSAGE_DATE_CURRENT, 0);
camel_folder_append_message(m->folder, m->message, m->info, &mm->ex);
}
diff --git a/mail/mail-send-recv.c b/mail/mail-send-recv.c
index b9f51b65ac..360198e141 100644
--- a/mail/mail-send-recv.c
+++ b/mail/mail-send-recv.c
@@ -601,7 +601,7 @@ void mail_send_receive(void)
gtk_signal_connect((GtkObject *)gd, "destroy", gtk_widget_destroyed, &gd);
while (scan) {
struct _send_info *info = scan->data;
-
+
switch(info->type) {
case SEND_RECEIVE:
mail_fetch_mail(info->uri, info->keep,