diff options
author | Jon Trowbridge <trow@ximian.com> | 2001-07-01 08:41:13 +0800 |
---|---|---|
committer | Jon Trowbridge <trow@src.gnome.org> | 2001-07-01 08:41:13 +0800 |
commit | fe0499e1d95e45291b655f1d068430014b5971db (patch) | |
tree | 7eb421b701f33b5a82bfd07a286240fa58789766 /mail/mail-display.c | |
parent | 0d23a1ac2a2dfcc05e6540becf471c42aaa68313 (diff) | |
download | gsoc2013-evolution-fe0499e1d95e45291b655f1d068430014b5971db.tar gsoc2013-evolution-fe0499e1d95e45291b655f1d068430014b5971db.tar.gz gsoc2013-evolution-fe0499e1d95e45291b655f1d068430014b5971db.tar.bz2 gsoc2013-evolution-fe0499e1d95e45291b655f1d068430014b5971db.tar.lz gsoc2013-evolution-fe0499e1d95e45291b655f1d068430014b5971db.tar.xz gsoc2013-evolution-fe0499e1d95e45291b655f1d068430014b5971db.tar.zst gsoc2013-evolution-fe0499e1d95e45291b655f1d068430014b5971db.zip |
Changed to return the created window. (find_socket): Added. Copied from
2001-06-30 Jon Trowbridge <trow@ximian.com>
* mail-display.c (make_popup_window): Changed to return the
created window.
(find_socket): Added. Copied from e-shell-view.c. The fact
that I'm copying this bit of code all over isn't cool.
(html_button_press_event): Properly destroy the popup window when
the widget inside the control is destroyed.
* mail-callbacks.c (addrbook_sender): Added. Implements
the "Add sender to addressbook" right-click. (Bug #3645)
(find_socket): Added. Copied from e-shell-view.c.
* folder-browser.c: Added "Add sender to addressbook" to
context_menu[].
* mail-display.c: (handle_embedded_address_object): Removed.
(on_object_requested): Removed handling for embedded address
objects. (Which was obsolete crap.)
svn path=/trunk/; revision=10643
Diffstat (limited to 'mail/mail-display.c')
-rw-r--r-- | mail/mail-display.c | 72 |
1 files changed, 39 insertions, 33 deletions
diff --git a/mail/mail-display.c b/mail/mail-display.c index 816e5b49e8..78fe4f2022 100644 --- a/mail/mail-display.c +++ b/mail/mail-display.c @@ -25,6 +25,7 @@ #include <bonobo/bonobo-stream-memory.h> #include <bonobo/bonobo-ui-toolbar-icon.h> #include <bonobo/bonobo-widget.h> +#include <bonobo/bonobo-socket.h> #include <gdk-pixbuf/gdk-pixbuf.h> #include <gdk-pixbuf/gdk-pixbuf-loader.h> #include <gal/util/e-util.h> @@ -640,32 +641,6 @@ get_embedded_for_component (const char *iid, MailDisplay *md) return embedded; } -static void -handle_embedded_address_object (GtkHTMLEmbedded *eb) -{ - const gchar *name, *email; - GtkWidget *w; - - w = bonobo_widget_new_control ("OAFIID:GNOME_Evolution_Addressbook_AddressWidget", - CORBA_OBJECT_NIL); - - name = gtk_html_embedded_get_parameter (eb, "name"); - email = gtk_html_embedded_get_parameter (eb, "email"); - - bonobo_widget_set_property (BONOBO_WIDGET (w), - "name", name, - "email", email, - /* Hackish: this is the bg color defined for the HTML table - in mail-format.c. If you change it there, you'd better - change it here as well. */ - "background_rgb", 0xeeeeee, - NULL); - - gtk_widget_show (w); - gtk_container_add (GTK_CONTAINER (eb), w); - - gtk_html_embedded_set_descent (eb, 0); -} static gboolean on_object_requested (GtkHTML *html, GtkHTMLEmbedded *eb, gpointer data) @@ -686,11 +661,6 @@ on_object_requested (GtkHTML *html, GtkHTMLEmbedded *eb, gpointer data) cid = eb->classid; - if (!strcmp (cid, "address")) { - handle_embedded_address_object (eb); - return TRUE; - } - if (!strncmp (cid, "popup:", 6)) cid += 6; if (strncmp (cid, "cid:", 4) != 0) @@ -1431,7 +1401,7 @@ popup_size_allocate_cb (GtkWidget *widget, GtkAllocation *alloc, gpointer user_d } -static void +static GtkWidget * make_popup_window (GtkWidget *w) { PopupInfo *pop = g_new0 (PopupInfo, 1); @@ -1479,6 +1449,30 @@ make_popup_window (GtkWidget *w) gtk_widget_show (w); gtk_widget_show (fr); gtk_widget_show (pop->win); + + return pop->win; +} + +/* Copied from e-shell-view.c */ +static GtkWidget * +find_socket (GtkContainer *container) +{ + GList *children, *tmp; + + children = gtk_container_children (container); + while (children) { + if (BONOBO_IS_SOCKET (children->data)) + return children->data; + else if (GTK_IS_CONTAINER (children->data)) { + GtkWidget *socket = find_socket (children->data); + if (socket) + return socket; + } + tmp = children->next; + g_list_free_1 (children); + children = tmp; + } + return NULL; } static int @@ -1491,7 +1485,9 @@ html_button_press_event (GtkWidget *widget, GdkEventButton *event, MailDisplay * if (event->button == 3) { HTMLEngine *e; HTMLPoint *point; + GtkWidget *socket; GtkWidget *popup_thing; + GtkWidget *win; e = GTK_HTML (widget)->engine; point = html_engine_get_point_at (e, event->x + e->x_offset, event->y + e->y_offset, FALSE); @@ -1506,10 +1502,20 @@ html_button_press_event (GtkWidget *widget, GdkEventButton *event, MailDisplay * popup_thing = bonobo_widget_new_control ("OAFIID:GNOME_Evolution_Addressbook_AddressPopup", CORBA_OBJECT_NIL); + socket = find_socket (GTK_CONTAINER (popup_thing)); + bonobo_widget_set_property (BONOBO_WIDGET (popup_thing), "email", url+7, NULL); - make_popup_window (popup_thing); + + win = make_popup_window (popup_thing); + gtk_signal_connect_object (GTK_OBJECT (socket), + "destroy", + GTK_SIGNAL_FUNC (gtk_widget_destroy), + GTK_OBJECT (win)); + + + } else if (url) { |