diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2009-09-07 07:23:57 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2009-09-09 02:53:45 +0800 |
commit | fa9051e04051156a9e11e2af72a0d7342f4ea2e4 (patch) | |
tree | 0d064bddb366257c660722359dc33f5ef3c610c7 /mail | |
parent | c9e7aa7aee6b407659843131cc8becdafa71992a (diff) | |
download | gsoc2013-evolution-fa9051e04051156a9e11e2af72a0d7342f4ea2e4.tar.gz gsoc2013-evolution-fa9051e04051156a9e11e2af72a0d7342f4ea2e4.tar.zst gsoc2013-evolution-fa9051e04051156a9e11e2af72a0d7342f4ea2e4.zip |
Finish killing Bonobo.
Diffstat (limited to 'mail')
-rw-r--r-- | mail/e-mail-browser.c | 19 | ||||
-rw-r--r-- | mail/e-mail-display.c | 753 | ||||
-rw-r--r-- | mail/e-mail-display.h | 36 | ||||
-rw-r--r-- | mail/e-mail-reader.c | 80 | ||||
-rw-r--r-- | mail/e-mail-search-bar.c | 96 | ||||
-rw-r--r-- | mail/e-mail-search-bar.h | 6 | ||||
-rw-r--r-- | mail/em-utils.c | 92 | ||||
-rw-r--r-- | mail/em-utils.h | 3 |
8 files changed, 157 insertions, 928 deletions
diff --git a/mail/e-mail-browser.c b/mail/e-mail-browser.c index ea860c016f..69199bfa1a 100644 --- a/mail/e-mail-browser.c +++ b/mail/e-mail-browser.c @@ -123,22 +123,20 @@ static GtkActionEntry mail_browser_entries[] = { static void mail_browser_menu_item_select_cb (EMailBrowser *browser, - GtkWidget *menu_item) + GtkWidget *widget) { GtkAction *action; GtkStatusbar *statusbar; - gchar *tooltip = NULL; + const gchar *tooltip; guint context_id; gpointer data; - action = g_object_get_data (G_OBJECT (menu_item), "action"); - g_return_if_fail (GTK_IS_ACTION (action)); + action = gtk_widget_get_action (widget); + tooltip = gtk_action_get_tooltip (action); - data = g_object_get_data (G_OBJECT (menu_item), "context-id"); + data = g_object_get_data (G_OBJECT (widget), "context-id"); context_id = GPOINTER_TO_UINT (data); - g_object_get (action, "tooltip", &tooltip, NULL); - if (tooltip == NULL) return; @@ -175,11 +173,6 @@ mail_browser_connect_proxy_cb (EMailBrowser *browser, statusbar = GTK_STATUSBAR (browser->priv->statusbar); context_id = gtk_statusbar_get_context_id (statusbar, G_STRFUNC); - g_object_set_data_full ( - G_OBJECT (proxy), - "action", g_object_ref (action), - (GDestroyNotify) g_object_unref); - g_object_set_data ( G_OBJECT (proxy), "context-id", GUINT_TO_POINTER (context_id)); @@ -440,7 +433,7 @@ mail_browser_constructed (GObject *object) priv->statusbar = g_object_ref (widget); gtk_widget_show (widget); - widget = e_mail_search_bar_new (EM_FORMAT_HTML (html_display)->html); + widget = e_mail_search_bar_new (E_WEB_VIEW (html)); gtk_box_pack_end (GTK_BOX (container), widget, FALSE, FALSE, 0); priv->search_bar = g_object_ref (widget); gtk_widget_hide (widget); diff --git a/mail/e-mail-display.c b/mail/e-mail-display.c index c29328b36b..df65c256f7 100644 --- a/mail/e-mail-display.c +++ b/mail/e-mail-display.c @@ -22,7 +22,6 @@ #include "e-mail-display.h" #include <config.h> -#include <string.h> #include <glib/gi18n.h> #include "e-util/e-util.h" @@ -36,162 +35,30 @@ struct _EMailDisplayPrivate { EMFormatHTML *formatter; - GtkUIManager *ui_manager; - gchar *selected_uri; }; enum { PROP_0, - PROP_ANIMATE, - PROP_CARET_MODE, - PROP_FORMATTER, - PROP_SELECTED_URI -}; - -enum { - POPUP_EVENT, - STATUS_MESSAGE, - LAST_SIGNAL + PROP_FORMATTER }; static gpointer parent_class; -static guint signals[LAST_SIGNAL]; static const gchar *ui = "<ui>" " <popup name='context'>" -" <menuitem action='http-open'/>" -" <menuitem action='send-message'/>" -" <menuitem action='uri-copy'/>" -" <menuitem action='add-to-address-book'/>" -" <menuitem action='mailto-copy'/>" -" <menu action='search-folder-menu'>" -" <menuitem action='search-folder-sender'/>" -" <menuitem action='search-folder-recipient'/>" -" </menu>" +" <placeholder name='custom-actions-1'>" +" <menuitem action='add-to-address-book'/>" +" </placeholder>" +" <placeholder name='custom-actions-3'>" +" <menu action='search-folder-menu'>" +" <menuitem action='search-folder-recipient'/>" +" <menuitem action='search-folder-sender'/>" +" </menu>" +" </placeholder>" " </popup>" "</ui>"; -static void -action_add_to_address_book_cb (GtkAction *action, - EMailDisplay *display) -{ - CamelURL *curl; - const gchar *uri; - gpointer parent; - - parent = gtk_widget_get_toplevel (GTK_WIDGET (display)); - parent = GTK_WIDGET_TOPLEVEL (parent) ? parent : NULL; - - uri = e_mail_display_get_selected_uri (display); - g_return_if_fail (uri != NULL); - - /* This should work because we checked it in update_actions(). */ - curl = camel_url_new (uri, NULL); - g_return_if_fail (curl != NULL); - - if (curl->path != NULL && *curl->path != '\0') - em_utils_add_address (parent, curl->path); - - camel_url_free (curl); -} - -static void -action_http_open_cb (GtkAction *action, - EMailDisplay *display) -{ - const gchar *uri; - gpointer parent; - - parent = gtk_widget_get_toplevel (GTK_WIDGET (display)); - parent = GTK_WIDGET_TOPLEVEL (parent) ? parent : NULL; - - uri = e_mail_display_get_selected_uri (display); - g_return_if_fail (uri != NULL); - - e_show_uri (parent, uri); -} - -static void -action_mailto_copy_cb (GtkAction *action, - EMailDisplay *display) -{ - CamelURL *curl; - CamelInternetAddress *inet_addr; - GtkClipboard *clipboard; - const gchar *uri; - gchar *text; - - clipboard = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD); - uri = e_mail_display_get_selected_uri (display); - g_return_if_fail (uri != NULL); - - /* This should work because we checked it in update_actions(). */ - curl = camel_url_new (uri, NULL); - g_return_if_fail (curl != NULL); - - inet_addr = camel_internet_address_new (); - camel_address_decode (CAMEL_ADDRESS (inet_addr), curl->path); - text = camel_address_encode (CAMEL_ADDRESS (inet_addr)); - if (text == NULL || *text == '\0') - text = g_strdup (uri + strlen ("mailto:")); - - camel_object_unref (inet_addr); - camel_url_free (curl); - - gtk_clipboard_set_text (clipboard, text, -1); - gtk_clipboard_store (clipboard); - - g_free (text); -} - -static void -action_send_message_cb (GtkAction *action, - EMailDisplay *display) -{ - const gchar *uri; - - uri = e_mail_display_get_selected_uri (display); - g_return_if_fail (uri != NULL); - - em_utils_compose_new_message_with_mailto (uri, NULL); -} - -static void -action_uri_copy_cb (GtkAction *action, - EMailDisplay *display) -{ - GtkClipboard *clipboard; - const gchar *uri; - - clipboard = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD); - uri = e_mail_display_get_selected_uri (display); - g_return_if_fail (uri != NULL); - - gtk_clipboard_set_text (clipboard, uri, -1); - gtk_clipboard_store (clipboard); -} - -static GtkActionEntry uri_entries[] = { - - { "uri-copy", - GTK_STOCK_COPY, - N_("_Copy Link Location"), - NULL, - NULL, /* XXX Add a tooltip! */ - G_CALLBACK (action_uri_copy_cb) }, -}; - -static GtkActionEntry http_entries[] = { - - { "http-open", - "emblem-web", - N_("_Open Link in Browser"), - NULL, - NULL, /* XXX Add a tooltip! */ - G_CALLBACK (action_http_open_cb) }, -}; - static GtkActionEntry mailto_entries[] = { { "add-to-address-book", @@ -199,14 +66,7 @@ static GtkActionEntry mailto_entries[] = { N_("_Add to Address Book..."), NULL, NULL, /* XXX Add a tooltip! */ - G_CALLBACK (action_add_to_address_book_cb) }, - - { "mailto-copy", - GTK_STOCK_COPY, - N_("_Copy Email Address"), - NULL, - NULL, /* XXX Add a tooltip! */ - G_CALLBACK (action_mailto_copy_cb) }, + NULL /* Handled by EMailReader */ }, { "search-folder-recipient", NULL, @@ -222,13 +82,6 @@ static GtkActionEntry mailto_entries[] = { NULL, /* XXX Add a tooltip! */ NULL /* Handled by EMailReader */ }, - { "send-message", - "mail-message-new", - N_("_Send New Message To..."), - NULL, - NULL, /* XXX Add a tooltip! */ - G_CALLBACK (action_send_message_cb) }, - /*** Menus ***/ { "search-folder-menu", @@ -239,123 +92,6 @@ static GtkActionEntry mailto_entries[] = { NULL } }; -static gboolean -mail_display_emit_popup_event (EMailDisplay *display, - GdkEventButton *event, - const gchar *uri, - EMFormatPURI *puri) -{ - CamelMimePart *mime_part; - gboolean stop_handlers = FALSE; - - mime_part = (puri != NULL) ? puri->part : NULL; - - g_signal_emit ( - display, signals[POPUP_EVENT], 0, - event, uri, mime_part, &stop_handlers); - - return stop_handlers; -} - -static void -mail_display_emit_status_message (EMailDisplay *display, - const gchar *status_message) -{ - g_signal_emit (display, signals[STATUS_MESSAGE], 0, status_message); -} - -static void -mail_display_get_uri_puri (EMailDisplay *display, - GdkEventButton *event, - GtkHTML *html, - gchar **uri, - EMFormatPURI **puri) -{ - EMFormat *formatter; - gchar *text_uri; - gchar *image_uri; - gboolean is_cid; - - formatter = EM_FORMAT (display->priv->formatter); - - if (event != NULL) { - text_uri = gtk_html_get_url_at (html, event->x, event->y); - image_uri = gtk_html_get_image_src_at (html, event->x, event->y); - } else { - text_uri = gtk_html_get_cursor_url (html); - image_uri = gtk_html_get_cursor_image_src (html); - } - - is_cid = (image_uri != NULL) && - (g_ascii_strncasecmp (image_uri, "cid:", 4) == 0); - - if (image_uri != NULL) { - if (strstr (image_uri, "://") == NULL && !is_cid) { - gchar *temp; - - temp = g_strconcat ("file://", image_uri, NULL); - g_free (image_uri); - image_uri = temp; - } - } - - if (puri != NULL) { - if (text_uri != NULL) - *puri = em_format_find_puri (formatter, text_uri); - - if (*puri == NULL && image_uri != NULL) - *puri = em_format_find_puri (formatter, image_uri); - } - - if (uri != NULL) { - *uri = NULL; - if (is_cid) { - if (text_uri != NULL) - *uri = g_strdup_printf ( - "%s\n%s", text_uri, image_uri); - else { - *uri = image_uri; - image_uri = NULL; - } - } else { - *uri = text_uri; - text_uri = NULL; - } - } - - g_free (text_uri); - g_free (image_uri); -} - -static gboolean -mail_display_button_press_event_cb (EMailDisplay *display, - GdkEventButton *event, - GtkHTML *html) -{ - EMFormatPURI *puri = NULL; - gboolean finished = TRUE; - gchar *uri = NULL; - - /* The GtkHTML object may be the EMailDisplay itself - * or an inner iframe. */ - - if (event->button != 3) - return FALSE; - - mail_display_get_uri_puri (display, event, html, &uri, &puri); - - if (uri == NULL || g_str_has_prefix (uri, "##")) { - g_free (uri); - return FALSE; - } - - finished = mail_display_emit_popup_event (display, event, uri, puri); - - g_free (uri); - - return finished; -} - static void mail_display_update_formatter_colors (EMailDisplay *display) { @@ -404,29 +140,11 @@ mail_display_set_property (GObject *object, GParamSpec *pspec) { switch (property_id) { - case PROP_ANIMATE: - e_mail_display_set_animate ( - E_MAIL_DISPLAY (object), - g_value_get_boolean (value)); - return; - - case PROP_CARET_MODE: - e_mail_display_set_caret_mode ( - E_MAIL_DISPLAY (object), - g_value_get_boolean (value)); - return; - case PROP_FORMATTER: e_mail_display_set_formatter ( E_MAIL_DISPLAY (object), g_value_get_object (value)); return; - - case PROP_SELECTED_URI: - e_mail_display_set_selected_uri ( - E_MAIL_DISPLAY (object), - g_value_get_string (value)); - return; } G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); @@ -439,29 +157,11 @@ mail_display_get_property (GObject *object, GParamSpec *pspec) { switch (property_id) { - case PROP_ANIMATE: - g_value_set_boolean ( - value, e_mail_display_get_animate ( - E_MAIL_DISPLAY (object))); - return; - - case PROP_CARET_MODE: - g_value_set_boolean ( - value, e_mail_display_get_caret_mode ( - E_MAIL_DISPLAY (object))); - return; - case PROP_FORMATTER: g_value_set_object ( value, e_mail_display_get_formatter ( E_MAIL_DISPLAY (object))); return; - - case PROP_SELECTED_URI: - g_value_set_string ( - value, e_mail_display_get_selected_uri ( - E_MAIL_DISPLAY (object))); - return; } G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); @@ -479,11 +179,6 @@ mail_display_dispose (GObject *object) priv->formatter = NULL; } - if (priv->ui_manager) { - g_object_unref (priv->ui_manager); - priv->ui_manager = NULL; - } - /* Chain up to parent's dispose() method. */ G_OBJECT_CLASS (parent_class)->dispose (object); } @@ -512,39 +207,13 @@ mail_display_style_set (GtkWidget *widget, em_format_redraw (EM_FORMAT (priv->formatter)); } -static gboolean -mail_display_button_press_event (GtkWidget *widget, - GdkEventButton *event) -{ - EMailDisplay *display = E_MAIL_DISPLAY (widget); - GtkHTML *html = GTK_HTML (widget); - - if (mail_display_button_press_event_cb (display, event, html)) - return TRUE; - - /* Chain up to parent's button_press_event() method. */ - return GTK_WIDGET_CLASS (parent_class)-> - button_press_event (widget, event); -} - -static gboolean -mail_display_scroll_event (GtkWidget *widget, - GdkEventScroll *event) +static void +mail_display_url_requested (GtkHTML *html, + const gchar *uri, + GtkHTMLStream *stream) { - if (event->state & GDK_CONTROL_MASK) { - switch (event->direction) { - case GDK_SCROLL_UP: - gtk_html_zoom_in (GTK_HTML (widget)); - return TRUE; - case GDK_SCROLL_DOWN: - gtk_html_zoom_out (GTK_HTML (widget)); - return TRUE; - default: - break; - } - } - - return FALSE; + /* XXX Sadly, we must block the default method + * until EMFormatHTML is made asynchronous. */ } static void @@ -591,89 +260,12 @@ mail_display_link_clicked (GtkHTML *html, /* ignore */ ; else { - gpointer parent; - - parent = gtk_widget_get_toplevel (GTK_WIDGET (html)); - parent = GTK_WIDGET_TOPLEVEL (parent) ? parent : NULL; - - e_show_uri (parent, uri); + /* Chain up to parent's link_clicked() method. */ + GTK_HTML_CLASS (parent_class)->link_clicked (html, uri); } } static void -mail_display_on_url (GtkHTML *html, - const gchar *uri) -{ - EMailDisplay *display; - CamelInternetAddress *address; - CamelURL *curl; - const gchar *format = NULL; - gchar *message = NULL; - gchar *who; - - display = E_MAIL_DISPLAY (html); - - if (uri == NULL || *uri == '\0') - goto exit; - - if (g_str_has_prefix (uri, "mailto:")) - format = _("Click to mail %s"); - else if (g_str_has_prefix (uri, "callto:")) - format = _("Click to call %s"); - else if (g_str_has_prefix (uri, "h323:")) - format = _("Click to call %s"); - else if (g_str_has_prefix (uri, "sip:")) - format = _("Click to call %s"); - else if (g_str_has_prefix (uri, "##")) - message = g_strdup (_("Click to hide/unhide addresses")); - else - message = g_strdup_printf (_("Click to open %s"), uri); - - if (format == NULL) - goto exit; - - curl = camel_url_new (uri, NULL); - address = camel_internet_address_new (); - camel_address_decode (CAMEL_ADDRESS (address), curl->path); - who = camel_address_format (CAMEL_ADDRESS (address)); - camel_object_unref (address); - camel_url_free (curl); - - if (who == NULL) - who = g_strdup (strchr (uri, ':') + 1); - - message = g_strdup_printf (format, who); - - g_free (who); - -exit: - mail_display_emit_status_message (display, message); - - g_free (message); -} - -static void -mail_display_iframe_created (GtkHTML *html, - GtkHTML *iframe) -{ - g_signal_connect_swapped ( - iframe, "button-press-event", - G_CALLBACK (mail_display_button_press_event_cb), html); -} - -static gboolean -mail_display_popup_event (EMailDisplay *display, - GdkEventButton *event, - const gchar *uri, - EMFormatPURI *puri) -{ - e_mail_display_set_selected_uri (display, uri); - e_mail_display_show_popup_menu (display, event, NULL, NULL); - - return TRUE; -} - -static void mail_display_class_init (EMailDisplayClass *class) { GObjectClass *object_class; @@ -691,35 +283,10 @@ mail_display_class_init (EMailDisplayClass *class) widget_class = GTK_WIDGET_CLASS (class); widget_class->realize = mail_display_realize; widget_class->style_set = mail_display_style_set; - widget_class->button_press_event = mail_display_button_press_event; - widget_class->scroll_event = mail_display_scroll_event; html_class = GTK_HTML_CLASS (class); + html_class->url_requested = mail_display_url_requested; html_class->link_clicked = mail_display_link_clicked; - html_class->on_url = mail_display_on_url; - html_class->iframe_created = mail_display_iframe_created; - - class->popup_event = mail_display_popup_event; - - g_object_class_install_property ( - object_class, - PROP_ANIMATE, - g_param_spec_boolean ( - "animate", - "Animate Images", - NULL, - FALSE, - G_PARAM_READWRITE)); - - g_object_class_install_property ( - object_class, - PROP_CARET_MODE, - g_param_spec_boolean ( - "caret-mode", - "Caret Mode", - NULL, - FALSE, - G_PARAM_READWRITE)); g_object_class_install_property ( object_class, @@ -730,67 +297,27 @@ mail_display_class_init (EMailDisplayClass *class) NULL, EM_TYPE_FORMAT_HTML, G_PARAM_READWRITE)); - - g_object_class_install_property ( - object_class, - PROP_SELECTED_URI, - g_param_spec_string ( - "selected-uri", - "Selected URI", - NULL, - NULL, - G_PARAM_READWRITE)); - - signals[POPUP_EVENT] = g_signal_new ( - "popup-event", - G_TYPE_FROM_CLASS (class), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (EMailDisplayClass, popup_event), - g_signal_accumulator_true_handled, NULL, - e_marshal_BOOLEAN__BOXED_POINTER_POINTER, - G_TYPE_BOOLEAN, 3, - GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE, - G_TYPE_POINTER, - G_TYPE_POINTER); - - signals[STATUS_MESSAGE] = g_signal_new ( - "status-message", - G_TYPE_FROM_CLASS (class), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (EMailDisplayClass, status_message), - NULL, NULL, - g_cclosure_marshal_VOID__STRING, - G_TYPE_NONE, 1, - G_TYPE_STRING); } static void mail_display_init (EMailDisplay *display) { + EWebView *web_view; GtkUIManager *ui_manager; GtkActionGroup *action_group; - const gchar *id; GError *error = NULL; - display->priv = E_MAIL_DISPLAY_GET_PRIVATE (display); - - ui_manager = gtk_ui_manager_new (); - display->priv->ui_manager = ui_manager; - - action_group = e_mail_display_add_action_group (display, "uri"); + web_view = E_WEB_VIEW (display); - gtk_action_group_add_actions ( - action_group, uri_entries, - G_N_ELEMENTS (uri_entries), display); - - action_group = e_mail_display_add_action_group (display, "http"); - - gtk_action_group_add_actions ( - action_group, http_entries, - G_N_ELEMENTS (http_entries), display); + display->priv = E_MAIL_DISPLAY_GET_PRIVATE (display); - action_group = e_mail_display_add_action_group (display, "mailto"); + /* EWebView's action groups are added during its instance + * initialization function (like what we're in now), so it + * is safe to fetch them this early in construction. */ + action_group = e_web_view_get_action_group (web_view, "mailto"); + /* We don't actually handle the actions we're adding. + * EMailReader handles them. How devious is that? */ gtk_action_group_add_actions ( action_group, mailto_entries, G_N_ELEMENTS (mailto_entries), display); @@ -798,13 +325,10 @@ mail_display_init (EMailDisplay *display) /* Because we are loading from a hard-coded string, there is * no chance of I/O errors. Failure here implies a malformed * UI definition. Full stop. */ + ui_manager = e_web_view_get_ui_manager (web_view); gtk_ui_manager_add_ui_from_string (ui_manager, ui, -1, &error); if (error != NULL) g_error ("%s", error->message); - - id = "org.gnome.evolution.mail.display"; - e_plugin_ui_register_manager (ui_manager, id, display); - e_plugin_ui_enable_manager (ui_manager, id); } GType @@ -827,64 +351,12 @@ e_mail_display_get_type (void) }; type = g_type_register_static ( - GTK_TYPE_HTML, "EMailDisplay", &type_info, 0); + E_TYPE_WEB_VIEW, "EMailDisplay", &type_info, 0); } return type; } -gboolean -e_mail_display_get_animate (EMailDisplay *display) -{ - /* XXX This is just here to maintain symmetry - * with e_mail_display_set_animate(). */ - - g_return_val_if_fail (E_IS_MAIL_DISPLAY (display), FALSE); - - return gtk_html_get_animate (GTK_HTML (display)); -} - -void -e_mail_display_set_animate (EMailDisplay *display, - gboolean animate) -{ - /* XXX GtkHTML does not utilize GObject properties as well - * as it could. This just wraps gtk_html_set_animate() - * so we can get a "notify::animate" signal. */ - - g_return_if_fail (E_IS_MAIL_DISPLAY (display)); - - gtk_html_set_animate (GTK_HTML (display), animate); - - g_object_notify (G_OBJECT (display), "animate"); -} - -gboolean -e_mail_display_get_caret_mode (EMailDisplay *display) -{ - /* XXX This is just here to maintain symmetry - * with e_mail_display_set_caret_mode(). */ - - g_return_val_if_fail (E_IS_MAIL_DISPLAY (display), FALSE); - - return gtk_html_get_caret_mode (GTK_HTML (display)); -} - -void -e_mail_display_set_caret_mode (EMailDisplay *display, - gboolean caret_mode) -{ - /* XXX GtkHTML does not utilize GObject properties as well - * as it could. This just wraps gtk_html_set_caret_mode() - * so we can get a "notify::caret-mode" signal. */ - - g_return_if_fail (E_IS_MAIL_DISPLAY (display)); - - gtk_html_set_caret_mode (GTK_HTML (display), caret_mode); - - g_object_notify (G_OBJECT (display), "caret-mode"); -} - EMFormatHTML * e_mail_display_get_formatter (EMailDisplay *display) { @@ -907,166 +379,3 @@ e_mail_display_set_formatter (EMailDisplay *display, g_object_notify (G_OBJECT (display), "formatter"); } - -const gchar * -e_mail_display_get_selected_uri (EMailDisplay *display) -{ - g_return_val_if_fail (E_IS_MAIL_DISPLAY (display), NULL); - - return display->priv->selected_uri; -} - -void -e_mail_display_set_selected_uri (EMailDisplay *display, - const gchar *selected_uri) -{ - g_return_if_fail (E_IS_MAIL_DISPLAY (display)); - - g_free (display->priv->selected_uri); - display->priv->selected_uri = g_strdup (selected_uri); - - g_object_notify (G_OBJECT (display), "selected-uri"); -} - -GtkAction * -e_mail_display_get_action (EMailDisplay *display, - const gchar *action_name) -{ - GtkUIManager *ui_manager; - - g_return_val_if_fail (E_IS_MAIL_DISPLAY (display), NULL); - g_return_val_if_fail (action_name != NULL, NULL); - - ui_manager = e_mail_display_get_ui_manager (display); - - return e_lookup_action (ui_manager, action_name); -} - -GtkActionGroup * -e_mail_display_add_action_group (EMailDisplay *display, - const gchar *group_name) -{ - GtkActionGroup *action_group; - GtkUIManager *ui_manager; - const gchar *domain; - - g_return_val_if_fail (E_IS_MAIL_DISPLAY (display), NULL); - g_return_val_if_fail (group_name != NULL, NULL); - - ui_manager = e_mail_display_get_ui_manager (display); - domain = GETTEXT_PACKAGE; - - action_group = gtk_action_group_new (group_name); - gtk_action_group_set_translation_domain (action_group, domain); - gtk_ui_manager_insert_action_group (ui_manager, action_group, 0); - g_object_unref (action_group); - - return action_group; -} - -GtkActionGroup * -e_mail_display_get_action_group (EMailDisplay *display, - const gchar *group_name) -{ - GtkUIManager *ui_manager; - - g_return_val_if_fail (E_IS_MAIL_DISPLAY (display), NULL); - g_return_val_if_fail (group_name != NULL, NULL); - - ui_manager = e_mail_display_get_ui_manager (display); - - return e_lookup_action_group (ui_manager, group_name); -} - -GtkWidget * -e_mail_display_get_popup_menu (EMailDisplay *display) -{ - GtkUIManager *ui_manager; - GtkWidget *menu; - - g_return_val_if_fail (E_IS_MAIL_DISPLAY (display), NULL); - - ui_manager = e_mail_display_get_ui_manager (display); - menu = gtk_ui_manager_get_widget (ui_manager, "/context"); - g_return_val_if_fail (GTK_IS_MENU (menu), NULL); - - return menu; -} - -GtkUIManager * -e_mail_display_get_ui_manager (EMailDisplay *display) -{ - EMailDisplayPrivate *priv; - - g_return_val_if_fail (E_IS_MAIL_DISPLAY (display), NULL); - - priv = E_MAIL_DISPLAY_GET_PRIVATE (display); - - return priv->ui_manager; -} - -void -e_mail_display_show_popup_menu (EMailDisplay *display, - GdkEventButton *event, - GtkMenuPositionFunc func, - gpointer user_data) -{ - GtkWidget *menu; - - g_return_if_fail (E_IS_MAIL_DISPLAY (display)); - - e_mail_display_update_actions (display); - - menu = e_mail_display_get_popup_menu (display); - - if (event != NULL) - gtk_menu_popup ( - GTK_MENU (menu), NULL, NULL, func, - user_data, event->button, event->time); - else - gtk_menu_popup ( - GTK_MENU (menu), NULL, NULL, func, - user_data, 0, gtk_get_current_event_time ()); -} - -void -e_mail_display_update_actions (EMailDisplay *display) -{ - CamelURL *curl; - GtkActionGroup *action_group; - gboolean scheme_is_http; - gboolean scheme_is_mailto; - gboolean uri_is_valid; - gboolean visible; - const gchar *uri; - - g_return_if_fail (E_IS_MAIL_DISPLAY (display)); - - uri = e_mail_display_get_selected_uri (display); - g_return_if_fail (uri != NULL); - - /* Parse the URI early so we know if the actions will work. */ - curl = camel_url_new (uri, NULL); - uri_is_valid = (curl != NULL); - camel_url_free (curl); - - scheme_is_http = - (g_ascii_strncasecmp (uri, "http:", 5) == 0) || - (g_ascii_strncasecmp (uri, "https:", 6) == 0); - - scheme_is_mailto = - (g_ascii_strncasecmp (uri, "mailto:", 7) == 0); - - /* Allow copying the URI even if it's malformed. */ - visible = !scheme_is_mailto; - action_group = e_mail_display_get_action_group (display, "uri"); - gtk_action_group_set_visible (action_group, visible); - - visible = uri_is_valid && scheme_is_http; - action_group = e_mail_display_get_action_group (display, "http"); - gtk_action_group_set_visible (action_group, visible); - - visible = uri_is_valid && scheme_is_mailto; - action_group = e_mail_display_get_action_group (display, "mailto"); - gtk_action_group_set_visible (action_group, visible); -} diff --git a/mail/e-mail-display.h b/mail/e-mail-display.h index 9f273fb26f..1b71a9db7f 100644 --- a/mail/e-mail-display.h +++ b/mail/e-mail-display.h @@ -22,8 +22,8 @@ #ifndef E_MAIL_DISPLAY_H #define E_MAIL_DISPLAY_H -#include <gtkhtml/gtkhtml.h> #include <mail/em-format-html.h> +#include <misc/e-web-view.h> /* Standard GObject macros */ #define E_TYPE_MAIL_DISPLAY \ @@ -51,48 +51,18 @@ typedef struct _EMailDisplayClass EMailDisplayClass; typedef struct _EMailDisplayPrivate EMailDisplayPrivate; struct _EMailDisplay { - GtkHTML parent; + EWebView parent; EMailDisplayPrivate *priv; }; struct _EMailDisplayClass { - GtkHTMLClass parent_class; - - /* Signals */ - gboolean (*popup_event) (EMailDisplay *display, - GdkEventButton *event, - const gchar *uri, - EMFormatPURI *puri); - void (*status_message) (EMailDisplay *display, - const gchar *status_message); + EWebViewClass parent_class; }; GType e_mail_display_get_type (void); -gboolean e_mail_display_get_animate (EMailDisplay *display); -void e_mail_display_set_animate (EMailDisplay *display, - gboolean animate); -gboolean e_mail_display_get_caret_mode (EMailDisplay *display); -void e_mail_display_set_caret_mode (EMailDisplay *display, - gboolean caret_mode); EMFormatHTML * e_mail_display_get_formatter (EMailDisplay *display); void e_mail_display_set_formatter (EMailDisplay *display, EMFormatHTML *formatter); -const gchar * e_mail_display_get_selected_uri (EMailDisplay *display); -void e_mail_display_set_selected_uri (EMailDisplay *display, - const gchar *uri); -GtkAction * e_mail_display_get_action (EMailDisplay *display, - const gchar *action_name); -GtkActionGroup *e_mail_display_add_action_group (EMailDisplay *display, - const gchar *group_name); -GtkActionGroup *e_mail_display_get_action_group (EMailDisplay *display, - const gchar *group_name); -GtkWidget * e_mail_display_get_popup_menu (EMailDisplay *display); -GtkUIManager * e_mail_display_get_ui_manager (EMailDisplay *display); -void e_mail_display_show_popup_menu (EMailDisplay *display, - GdkEventButton *event, - GtkMenuPositionFunc func, - gpointer user_data); -void e_mail_display_update_actions (EMailDisplay *display); G_END_DECLS diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c index 72f79181f8..d3a845c125 100644 --- a/mail/e-mail-reader.c +++ b/mail/e-mail-reader.c @@ -67,15 +67,16 @@ static void action_mail_add_sender_cb (GtkAction *action, EMailReader *reader) { + EShell *shell; + EShellBackend *shell_backend; MessageList *message_list; CamelMessageInfo *info; CamelFolder *folder; - GtkWindow *window; GPtrArray *uids; const gchar *address; message_list = e_mail_reader_get_message_list (reader); - window = e_mail_reader_get_window (reader); + shell_backend = e_mail_reader_get_shell_backend (reader); folder = message_list->folder; uids = message_list_get_selected (message_list); @@ -91,13 +92,52 @@ action_mail_add_sender_cb (GtkAction *action, if (address == NULL || *address == '\0') goto exit; - em_utils_add_address (window, address); + /* XXX EBookShellBackend should be listening for this + * event. Kind of kludgey, but works for now. */ + shell = e_shell_backend_get_shell (shell_backend); + e_shell_event (shell, "contact-quick-add-email", (gpointer) address); exit: em_utils_uids_free (uids); } static void +action_add_to_address_book_cb (GtkAction *action, + EMailReader *reader) +{ + EShell *shell; + EShellBackend *shell_backend; + EMFormatHTMLDisplay *html_display; + EWebView *web_view; + CamelURL *curl; + const gchar *uri; + + /* This action is defined in EMailDisplay. */ + + html_display = e_mail_reader_get_html_display (reader); + shell_backend = e_mail_reader_get_shell_backend (reader); + + web_view = E_WEB_VIEW (EM_FORMAT_HTML (html_display)->html); + + uri = e_web_view_get_selected_uri (web_view); + g_return_if_fail (uri != NULL); + + curl = camel_url_new (uri, NULL); + g_return_if_fail (curl != NULL); + + if (curl->path == NULL || *curl->path == '\0') + goto exit; + + /* XXX EBookShellBackend should be listening for this + * event. Kind of kludgey, but works for now. */ + shell = e_shell_backend_get_shell (shell_backend); + e_shell_event (shell, "contact-quick-add-email", curl->path); + +exit: + camel_url_free (curl); +} + +static void action_mail_charset_cb (GtkRadioAction *action, GtkRadioAction *current, EMailReader *reader) @@ -955,7 +995,7 @@ action_search_folder_recipient_cb (GtkAction *action, { EMFormatHTMLDisplay *html_display; MessageList *message_list; - EMailDisplay *display; + EWebView *web_view; CamelURL *curl; const gchar *uri; @@ -964,9 +1004,9 @@ action_search_folder_recipient_cb (GtkAction *action, html_display = e_mail_reader_get_html_display (reader); message_list = e_mail_reader_get_message_list (reader); - display = E_MAIL_DISPLAY (EM_FORMAT_HTML (html_display)->html); + web_view = E_WEB_VIEW (EM_FORMAT_HTML (html_display)->html); - uri = e_mail_display_get_selected_uri (display); + uri = e_web_view_get_selected_uri (web_view); g_return_if_fail (uri != NULL); curl = camel_url_new (uri, NULL); @@ -996,7 +1036,7 @@ action_search_folder_sender_cb (GtkAction *action, { EMFormatHTMLDisplay *html_display; MessageList *message_list; - EMailDisplay *display; + EWebView *web_view; CamelURL *curl; const gchar *uri; @@ -1005,9 +1045,9 @@ action_search_folder_sender_cb (GtkAction *action, html_display = e_mail_reader_get_html_display (reader); message_list = e_mail_reader_get_message_list (reader); - display = E_MAIL_DISPLAY (EM_FORMAT_HTML (html_display)->html); + web_view = E_WEB_VIEW (EM_FORMAT_HTML (html_display)->html); - uri = e_mail_display_get_selected_uri (display); + uri = e_web_view_get_selected_uri (web_view); g_return_if_fail (uri != NULL); curl = camel_url_new (uri, NULL); @@ -2252,7 +2292,7 @@ e_mail_reader_init (EMailReader *reader) EShellBackend *shell_backend; EShellSettings *shell_settings; EMFormatHTMLDisplay *html_display; - EMailDisplay *display; + EWebView *web_view; GtkActionGroup *action_group; MessageList *message_list; GConfBridge *bridge; @@ -2270,7 +2310,7 @@ e_mail_reader_init (EMailReader *reader) shell = e_shell_backend_get_shell (shell_backend); shell_settings = e_shell_get_shell_settings (shell); - display = E_MAIL_DISPLAY (EM_FORMAT_HTML (html_display)->html); + web_view = E_WEB_VIEW (EM_FORMAT_HTML (html_display)->html); gtk_action_group_add_actions ( action_group, mail_reader_entries, @@ -2320,14 +2360,20 @@ e_mail_reader_init (EMailReader *reader) action = e_mail_reader_get_action (reader, action_name); g_object_set (action, "short-label", _("Reply"), NULL); + action_name = "add-to-address-book"; + action = e_web_view_get_action (web_view, action_name); + g_signal_connect ( + action, "activate", + G_CALLBACK (action_add_to_address_book_cb), reader); + action_name = "search-folder-recipient"; - action = e_mail_display_get_action (display, action_name); + action = e_web_view_get_action (web_view, action_name); g_signal_connect ( action, "activate", G_CALLBACK (action_search_folder_recipient_cb), reader); action_name = "search-folder-sender"; - action = e_mail_display_get_action (display, action_name); + action = e_web_view_get_action (web_view, action_name); g_signal_connect ( action, "activate", G_CALLBACK (action_search_folder_sender_cb), reader); @@ -2350,7 +2396,7 @@ e_mail_reader_init (EMailReader *reader) e_binding_new ( shell_settings, "mail-show-animated-images", - display, "animate"); + web_view, "animate"); e_binding_new ( shell_settings, "mail-show-sender-photo", @@ -2361,16 +2407,16 @@ e_mail_reader_init (EMailReader *reader) e_mutual_binding_new ( action, "active", - display, "caret-mode"); + web_view, "caret-mode"); /* Connect signals. */ g_signal_connect_swapped ( - display, "button-release-event", + web_view, "button-release-event", G_CALLBACK (mail_reader_button_release_event_cb), reader); g_signal_connect_swapped ( - display, "key-press-event", + web_view, "key-press-event", G_CALLBACK (mail_reader_key_press_event_cb), reader); g_signal_connect_swapped ( diff --git a/mail/e-mail-search-bar.c b/mail/e-mail-search-bar.c index d068eb1123..bfd4270cb9 100644 --- a/mail/e-mail-search-bar.c +++ b/mail/e-mail-search-bar.c @@ -32,7 +32,7 @@ ((obj), E_TYPE_MAIL_SEARCH_BAR, EMailSearchBarPrivate)) struct _EMailSearchBarPrivate { - GtkHTML *html; + EWebView *web_view; GtkWidget *entry; GtkWidget *case_sensitive_button; GtkWidget *wrapped_next_box; @@ -48,8 +48,8 @@ struct _EMailSearchBarPrivate { enum { PROP_0, PROP_CASE_SENSITIVE, - PROP_HTML, - PROP_TEXT + PROP_TEXT, + PROP_WEB_VIEW }; enum { @@ -108,14 +108,14 @@ static void mail_search_bar_find (EMailSearchBar *search_bar, gboolean search_forward) { - GtkHTML *html; + EWebView *web_view; GtkWidget *widget; gboolean case_sensitive; gboolean new_search; gboolean wrapped = FALSE; gchar *text; - html = e_mail_search_bar_get_html (search_bar); + web_view = e_mail_search_bar_get_web_view (search_bar); case_sensitive = e_mail_search_bar_get_case_sensitive (search_bar); text = e_mail_search_bar_get_text (search_bar); @@ -146,20 +146,23 @@ mail_search_bar_find (EMailSearchBar *search_bar, mail_search_bar_update_tokenizer (search_bar); } else if (search_bar->priv->rerun_search) { gtk_html_engine_search ( - html, search_bar->priv->active_search, + GTK_HTML (web_view), + search_bar->priv->active_search, case_sensitive, search_forward, FALSE); search_bar->priv->rerun_search = FALSE; g_free (text); } else { - gtk_html_engine_search_set_forward (html, search_forward); - if (!gtk_html_engine_search_next (html)) + gtk_html_engine_search_set_forward ( + GTK_HTML (web_view), search_forward); + if (!gtk_html_engine_search_next (GTK_HTML (web_view))) wrapped = TRUE; g_free (text); } if (new_search || wrapped) gtk_html_engine_search ( - html, search_bar->priv->active_search, + GTK_HTML (web_view), + search_bar->priv->active_search, case_sensitive, search_forward, FALSE); /* Update wrapped label visibility. */ @@ -218,15 +221,17 @@ mail_search_bar_toggled_cb (EMailSearchBar *search_bar) } static void -mail_search_bar_set_html (EMailSearchBar *search_bar, - GtkHTML *html) +mail_search_bar_set_web_view (EMailSearchBar *search_bar, + EWebView *web_view) { + GtkHTML *html; ESearchingTokenizer *tokenizer; - g_return_if_fail (search_bar->priv->html == NULL); + g_return_if_fail (search_bar->priv->web_view == NULL); - search_bar->priv->html = g_object_ref (html); + search_bar->priv->web_view = g_object_ref (web_view); + html = GTK_HTML (web_view); tokenizer = e_mail_search_bar_get_tokenizer (search_bar); gtk_html_set_tokenizer (html, HTML_TOKENIZER (tokenizer)); } @@ -244,17 +249,17 @@ mail_search_bar_set_property (GObject *object, g_value_get_boolean (value)); return; - case PROP_HTML: - mail_search_bar_set_html ( - E_MAIL_SEARCH_BAR (object), - g_value_get_object (value)); - return; - case PROP_TEXT: e_mail_search_bar_set_text ( E_MAIL_SEARCH_BAR (object), g_value_get_string (value)); return; + + case PROP_WEB_VIEW: + mail_search_bar_set_web_view ( + E_MAIL_SEARCH_BAR (object), + g_value_get_object (value)); + return; } G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); @@ -273,17 +278,17 @@ mail_search_bar_get_property (GObject *object, E_MAIL_SEARCH_BAR (object))); return; - case PROP_HTML: - g_value_set_object ( - value, e_mail_search_bar_get_html ( - E_MAIL_SEARCH_BAR (object))); - return; - case PROP_TEXT: g_value_take_string ( value, e_mail_search_bar_get_text ( E_MAIL_SEARCH_BAR (object))); return; + + case PROP_WEB_VIEW: + g_value_set_object ( + value, e_mail_search_bar_get_web_view ( + E_MAIL_SEARCH_BAR (object))); + return; } G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); @@ -296,9 +301,9 @@ mail_search_bar_dispose (GObject *object) priv = E_MAIL_SEARCH_BAR_GET_PRIVATE (object); - if (priv->html != NULL) { - g_object_unref (priv->html); - priv->html = NULL; + if (priv->web_view != NULL) { + g_object_unref (priv->web_view); + priv->web_view = NULL; } if (priv->entry != NULL) { @@ -450,17 +455,6 @@ mail_search_bar_class_init (EMailSearchBarClass *class) g_object_class_install_property ( object_class, - PROP_HTML, - g_param_spec_object ( - "html", - "HTML Display", - NULL, - GTK_TYPE_HTML, - G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY)); - - g_object_class_install_property ( - object_class, PROP_TEXT, g_param_spec_string ( "text", @@ -469,6 +463,17 @@ mail_search_bar_class_init (EMailSearchBarClass *class) NULL, G_PARAM_READWRITE)); + g_object_class_install_property ( + object_class, + PROP_WEB_VIEW, + g_param_spec_object ( + "web-view", + "Web View", + NULL, + E_TYPE_WEB_VIEW, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT_ONLY)); + signals[CHANGED] = g_signal_new ( "changed", G_TYPE_FROM_CLASS (class), @@ -676,11 +681,12 @@ e_mail_search_bar_get_type (void) } GtkWidget * -e_mail_search_bar_new (GtkHTML *html) +e_mail_search_bar_new (EWebView *web_view) { - g_return_val_if_fail (GTK_IS_HTML (html), NULL); + g_return_val_if_fail (E_IS_WEB_VIEW (web_view), NULL); - return g_object_new (E_TYPE_MAIL_SEARCH_BAR, "html", html, NULL); + return g_object_new ( + E_TYPE_MAIL_SEARCH_BAR, "web-view", web_view, NULL); } void @@ -699,12 +705,12 @@ e_mail_search_bar_changed (EMailSearchBar *search_bar) g_signal_emit (search_bar, signals[CHANGED], 0); } -GtkHTML * -e_mail_search_bar_get_html (EMailSearchBar *search_bar) +EWebView * +e_mail_search_bar_get_web_view (EMailSearchBar *search_bar) { g_return_val_if_fail (E_IS_MAIL_SEARCH_BAR (search_bar), NULL); - return search_bar->priv->html; + return search_bar->priv->web_view; } ESearchingTokenizer * diff --git a/mail/e-mail-search-bar.h b/mail/e-mail-search-bar.h index f4748c77ad..1ad343777b 100644 --- a/mail/e-mail-search-bar.h +++ b/mail/e-mail-search-bar.h @@ -23,8 +23,8 @@ #define E_MAIL_SEARCH_BAR_H #include <gtk/gtk.h> -#include <gtkhtml/gtkhtml.h> #include <mail/e-searching-tokenizer.h> +#include <misc/e-web-view.h> /* Standard GObject macros */ #define E_TYPE_MAIL_SEARCH_BAR \ @@ -65,10 +65,10 @@ struct _EMailSearchBarClass { }; GType e_mail_search_bar_get_type (void); -GtkWidget * e_mail_search_bar_new (GtkHTML *html); +GtkWidget * e_mail_search_bar_new (EWebView *web_view); void e_mail_search_bar_clear (EMailSearchBar *search_bar); void e_mail_search_bar_changed (EMailSearchBar *search_bar); -GtkHTML * e_mail_search_bar_get_html (EMailSearchBar *search_bar); +EWebView * e_mail_search_bar_get_web_view (EMailSearchBar *search_bar); ESearchingTokenizer * e_mail_search_bar_get_tokenizer (EMailSearchBar *search_bar); gboolean e_mail_search_bar_get_case_sensitive diff --git a/mail/em-utils.c b/mail/em-utils.c index 0a55ea842d..4ee9110ae5 100644 --- a/mail/em-utils.c +++ b/mail/em-utils.c @@ -48,10 +48,6 @@ #include "em-filter-editor.h" -#include <bonobo/bonobo-listener.h> -#include <bonobo/bonobo-widget.h> -#include <bonobo/bonobo-event-source.h> - #include <glib/gi18n.h> #include <gio/gio.h> @@ -661,94 +657,6 @@ em_utils_save_messages (GtkWindow *parent, CamelFolder *folder, GPtrArray *uids) } /* ********************************************************************** */ - -static void -emu_add_address_cb(BonoboListener *listener, const gchar *name, const CORBA_any *any, CORBA_Environment *ev, gpointer data) -{ - gchar *type = bonobo_event_subtype(name); - - if (!strcmp(type, "Destroy")) - gtk_widget_destroy((GtkWidget *)data); - - g_free(type); -} - -/* one of email or vcard should be always NULL, never both of them */ -static void -emu_add_address_or_vcard (GtkWindow *parent, const gchar *email, const gchar *vcard) -{ - GtkWidget *win; - GtkWidget *control; - /*GtkWidget *socket;*/ - gchar *email_buf = NULL; - - if (email) { - CamelInternetAddress *cia; - - cia = camel_internet_address_new (); - if (camel_address_decode ((CamelAddress *) cia, email) == -1) { - camel_object_unref (cia); - return; - } - - email_buf = camel_address_format ((CamelAddress *) cia); - camel_object_unref (cia); - } - - win = gtk_window_new(GTK_WINDOW_TOPLEVEL); - gtk_window_set_title((GtkWindow *)win, _("Add address")); - - gtk_window_set_transient_for ((GtkWindow *)win, parent); - - gtk_window_set_position((GtkWindow *)win, GTK_WIN_POS_CENTER_ON_PARENT); - gtk_window_set_type_hint((GtkWindow *)win, GDK_WINDOW_TYPE_HINT_DIALOG); - - control = bonobo_widget_new_control("OAFIID:GNOME_Evolution_Addressbook_AddressPopup:" BASE_VERSION, CORBA_OBJECT_NIL); - - if (email_buf) - bonobo_widget_set_property ((BonoboWidget *) control, "email", TC_CORBA_string, email_buf, NULL); - else - bonobo_widget_set_property ((BonoboWidget *) control, "vcard", TC_CORBA_string, vcard, NULL); - - g_free (email_buf); - - bonobo_event_source_client_add_listener(bonobo_widget_get_objref((BonoboWidget *)control), emu_add_address_cb, NULL, NULL, win); - - /*socket = find_socket (GTK_CONTAINER (control)); - g_object_weak_ref ((GObject *) socket, (GWeakNotify) gtk_widget_destroy, win);*/ - - gtk_container_add((GtkContainer *)win, control); - gtk_widget_show_all(win); -} - -/** - * em_utils_add_address: - * @parent: - * @email: - * - * Add address @email to the addressbook. - **/ -void -em_utils_add_address (GtkWindow *parent, const gchar *email) -{ - g_return_if_fail (GTK_IS_WINDOW (parent)); - - emu_add_address_or_vcard (parent, email, NULL); -} - -/** - * em_utils_add_vcard: - * Adds whole vCard to the addressbook. - **/ -void -em_utils_add_vcard (GtkWindow *parent, const gchar *vcard) -{ - g_return_if_fail (GTK_IS_WINDOW (parent)); - - emu_add_address_or_vcard (parent, NULL, vcard); -} - -/* ********************************************************************** */ /* Flag-for-Followup... */ /** diff --git a/mail/em-utils.h b/mail/em-utils.h index 14dc8cef23..e1064c520a 100644 --- a/mail/em-utils.h +++ b/mail/em-utils.h @@ -56,9 +56,6 @@ void em_utils_save_part(GtkWindow *parent, const gchar *prompt, CamelMimePart *p gboolean em_utils_save_part_to_file(GtkWindow *parent, const gchar *filename, CamelMimePart *part); void em_utils_save_messages (GtkWindow *parent, CamelFolder *folder, GPtrArray *uids); -void em_utils_add_address(GtkWindow *parent, const gchar *email); -void em_utils_add_vcard(GtkWindow *parent, const gchar *vcard); - void em_utils_flag_for_followup (EMailReader *reader, CamelFolder *folder, GPtrArray *uids); void em_utils_flag_for_followup_clear (GtkWindow *parent, CamelFolder *folder, GPtrArray *uids); void em_utils_flag_for_followup_completed (GtkWindow *parent, CamelFolder *folder, GPtrArray *uids); |