diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2009-04-28 03:36:19 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2009-04-28 03:36:19 +0800 |
commit | 4449a34101406bffe508dd40b8b653f7c7d14c7d (patch) | |
tree | e9fb2ce7efd3901cf1090040666f0ce15ad70554 /mail | |
parent | e377ea5e61171e57f9e892652d0fd1f77953eda8 (diff) | |
download | gsoc2013-evolution-4449a34101406bffe508dd40b8b653f7c7d14c7d.tar gsoc2013-evolution-4449a34101406bffe508dd40b8b653f7c7d14c7d.tar.gz gsoc2013-evolution-4449a34101406bffe508dd40b8b653f7c7d14c7d.tar.bz2 gsoc2013-evolution-4449a34101406bffe508dd40b8b653f7c7d14c7d.tar.lz gsoc2013-evolution-4449a34101406bffe508dd40b8b653f7c7d14c7d.tar.xz gsoc2013-evolution-4449a34101406bffe508dd40b8b653f7c7d14c7d.tar.zst gsoc2013-evolution-4449a34101406bffe508dd40b8b653f7c7d14c7d.zip |
Commit the rest of the attachment UI rewrite
Oops, last commit only included the -new- files.
This also removes EExpander, which is no longer used.
Diffstat (limited to 'mail')
-rw-r--r-- | mail/Makefile.am | 4 | ||||
-rw-r--r-- | mail/em-filter-i18n.h | 2 | ||||
-rw-r--r-- | mail/em-format-html-display.c | 615 | ||||
-rw-r--r-- | mail/em-format-html-display.h | 2 | ||||
-rw-r--r-- | mail/em-popup.c | 123 | ||||
-rw-r--r-- | mail/em-popup.h | 35 | ||||
-rw-r--r-- | mail/mail-component.c | 5 |
7 files changed, 123 insertions, 663 deletions
diff --git a/mail/Makefile.am b/mail/Makefile.am index 23778d569c..2a567ec042 100644 --- a/mail/Makefile.am +++ b/mail/Makefile.am @@ -54,6 +54,7 @@ idl_DATA = $(MAIL_IDL) # plugin mail api mailinclude_HEADERS = \ $(MAIL_IDL_GENERATED_H) \ + e-mail-attachment-bar.h \ em-composer-utils.h \ em-config.h \ em-event.h \ @@ -93,6 +94,9 @@ mailinclude_HEADERS = \ libevolution_mail_la_SOURCES = \ $(MAIL_IDL_GENERATED) \ $(mailinclude_HEADERS) \ + e-attachment-handler-mail.c \ + e-attachment-handler-mail.h \ + e-mail-attachment-bar.c \ e-searching-tokenizer.c \ e-searching-tokenizer.h \ em-account-editor.c \ diff --git a/mail/em-filter-i18n.h b/mail/em-filter-i18n.h index 8b8d0c3323..c0b2925cc2 100644 --- a/mail/em-filter-i18n.h +++ b/mail/em-filter-i18n.h @@ -26,6 +26,7 @@ char *s = N_("Exist"); char *s = N_("exists"); char *s = N_("Expression"); char *s = N_("Follow Up"); +char *s = N_("Forward to"); char *s = N_("Important"); char *s = N_("is"); char *s = N_("is after"); @@ -46,6 +47,7 @@ char *s = N_("Message Body"); char *s = N_("Message Header"); char *s = N_("Message is Junk"); char *s = N_("Message is not Junk"); +char *s = N_("Message Location"); char *s = N_("Move to Folder"); char *s = N_("Pipe to Program"); char *s = N_("Play Sound"); diff --git a/mail/em-format-html-display.c b/mail/em-format-html-display.c index ad72ee8bdd..789705879d 100644 --- a/mail/em-format-html-display.c +++ b/mail/em-format-html-display.c @@ -80,14 +80,15 @@ #include "mail-config.h" +#include "e-mail-attachment-bar.h" #include "em-format-html-display.h" #include "e-searching-tokenizer.h" #include "em-icon-stream.h" #include "em-utils.h" #include "em-popup.h" -#include "e-attachment.h" -#include "e-attachment-bar.h" #include "e-icon-entry.h" +#include "widgets/misc/e-attachment-button.h" +#include "widgets/misc/e-attachment-view.h" #ifdef G_OS_WIN32 /* Undefine the similar macro from <pthread.h>,it doesn't check if @@ -113,18 +114,7 @@ struct _EMFormatHTMLDisplayPrivate { int search_wrap; /* are we doing a wrap search */ gboolean search_active; /* if the search is active */ - /* for Attachment bar */ - GtkWidget *attachment_bar; - GtkWidget *attachment_box; - GtkWidget *label; - GtkWidget *save_txt; - GtkWidget *arrow; - GtkWidget *forward; - GtkWidget *down; - GtkWidget *attachment_area; - gboolean show_bar; - GHashTable *files; - gboolean updated; + GtkWidget *attachment_view; /* weak reference */ }; static int efhd_html_button_press_event (GtkWidget *widget, GdkEventButton *event, EMFormatHTMLDisplay *efh); @@ -134,8 +124,6 @@ static void efhd_html_on_url (GtkHTML *html, const char *url, EMFormatHTMLDispla static void efhd_attachment_frame(EMFormat *emf, CamelStream *stream, EMFormatPURI *puri); static gboolean efhd_attachment_image(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObject *pobject); static void efhd_message_add_bar(EMFormat *emf, CamelStream *stream, CamelMimePart *part, const EMFormatHandler *info); -static void efhd_message_update_bar(EMFormat *emf, CamelStream *stream, CamelMimePart *part, const EMFormatHandler *info); -static void efhd_attachment_bar_refresh (EMFormatHTMLDisplay *efhd); struct _attach_puri { EMFormatPURI puri; @@ -186,7 +174,6 @@ static void efhd_format_attachment(EMFormat *, CamelStream *, CamelMimePart *, c static void efhd_format_optional(EMFormat *, CamelStream *, CamelMimePart *, CamelStream *); static void efhd_format_secure(EMFormat *emf, CamelStream *stream, CamelMimePart *part, CamelCipherValidity *valid); static void efhd_complete(EMFormat *); -gboolean efhd_mnemonic_show_bar (GtkWidget *widget, gboolean focus, GtkWidget *efhd); static gboolean efhd_bonobo_object(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObject *pobject); static gboolean efhd_use_component(const char *mime_type); @@ -279,9 +266,6 @@ efhd_init(GObject *o) #undef efh efhd->nobar = getenv("EVOLUTION_NO_BAR") != NULL; - - efhd->priv->show_bar = FALSE; - efhd->priv->files = NULL; } static void @@ -291,9 +275,6 @@ efhd_finalise(GObject *o) /* check pending stuff */ - if (efhd->priv->files) - g_hash_table_destroy(efhd->priv->files); - g_free(efhd->priv->search_text); g_free(efhd->priv); @@ -431,12 +412,6 @@ void em_format_html_display_set_caret_mode(EMFormatHTMLDisplay *efhd, gboolean s gtk_html_set_caret_mode(((EMFormatHTML *)efhd)->html, state); } -EAttachmentBar * -em_format_html_display_get_bar (EMFormatHTMLDisplay *efhd) -{ - return E_ATTACHMENT_BAR (efhd->priv->attachment_bar); -} - void em_format_html_display_set_search(EMFormatHTMLDisplay *efhd, int type, GSList *strings) { @@ -933,11 +908,6 @@ efhd_complete(EMFormat *emf) if (efhd->priv->search_dialog && efhd->priv->search_active) efhd_update_matches(efhd); - - if (efhd->priv->files) { - g_hash_table_destroy (efhd->priv->files); - efhd->priv->files = NULL; - } } /* ********************************************************************** */ @@ -1293,9 +1263,7 @@ static EMFormatHandler type_builtin_table[] = { { "image/pjpeg", (EMFormatFunc)efhd_image }, { "x-evolution/message/prefix", (EMFormatFunc)efhd_message_prefix }, - { "x-evolution/message/post-header", (EMFormatFunc)efhd_message_add_bar }, - { "x-evolution/message/post-header-closure", (EMFormatFunc)efhd_message_update_bar }, - + { "x-evolution/message/post-header", (EMFormatFunc)efhd_message_add_bar } }; static void @@ -1343,15 +1311,8 @@ static const EMFormatHandler *efhd_find_handler(EMFormat *emf, const char *mime_ static void efhd_format_clone(EMFormat *emf, CamelFolder *folder, const char *uid, CamelMimeMessage *msg, EMFormat *src) { - EMFormatHTMLDisplay *efhd = (EMFormatHTMLDisplay *) emf; - - if (emf != src) { - if (src) - efhd->priv->show_bar = ((EMFormatHTMLDisplay *)src)->priv->show_bar; - else - efhd->priv->show_bar = FALSE; + if (emf != src) ((EMFormatHTML *) emf)->header_wrap_flags = 0; - } ((EMFormatClass *)efhd_parent)->format_clone(emf, folder, uid, msg, src); } @@ -1467,12 +1428,14 @@ efhd_attachment_show(EPopup *ep, EPopupItem *item, void *data) } static void -efhd_attachment_button_show(GtkWidget *w, void *data) +efhd_attachment_button_expanded (GtkWidget *widget, + GParamSpec *pspec, + struct _attach_puri *info) { - if (!efhd_can_process_attachment (w)) + if (!efhd_can_process_attachment (widget)) return; - efhd_attachment_show(NULL, NULL, data); + efhd_attachment_show (NULL, NULL, info); } static void @@ -1811,16 +1774,12 @@ static gboolean efhd_attachment_button(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObject *pobject) { EMFormatHTMLDisplay *efhd = (EMFormatHTMLDisplay *)efh; - EAttachment *new; struct _attach_puri *info; - GtkWidget *hbox, *w, *button, *mainbox; - char *simple_type, *tmp, *new_file = NULL; - const char *file; - GtkTargetEntry drag_types[] = { - { NULL, 0, 0 }, - { "text/uri-list", 0, 1 }, - }; - AtkObject *a11y; + EAttachmentView *view; + EAttachmentStore *store; + EAttachment *attachment; + GtkWidget *widget; + gpointer parent; /* FIXME: handle default shown case */ d(printf("adding attachment button/content\n")); @@ -1832,139 +1791,36 @@ efhd_attachment_button(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObje return TRUE; } - if (efhd->priv->attachment_bar) { - file = camel_mime_part_get_filename(info->puri.part); - - new = info->attachment; - - if (!file) { - file = "attachment.dat"; - new->file_name = g_strdup(file); - } - - tmp = g_hash_table_lookup (efhd->priv->files, file); - if (tmp) { - guint count = GPOINTER_TO_UINT(tmp); - char *ext; - char *tmp_file = g_strdup (file); - - if ((ext = strrchr(tmp_file, '.'))) { - ext[0] = 0; - new_file = g_strdup_printf("%s(%d).%s", tmp_file, count++, ext+1); - } else { - new_file = g_strdup_printf("%s(%d)", tmp_file, count++); - } - - g_free (tmp_file); - g_hash_table_insert (efhd->priv->files, g_strdup(file), GUINT_TO_POINTER(count)); - g_free (new->file_name); - new->file_name = new_file; - } else { - g_hash_table_insert (efhd->priv->files, g_strdup(file), GUINT_TO_POINTER(1)); - } - - /* Store the status of encryption / signature on the attachment for emblem display - * FIXME: May not work well always - */ - new->sign = info->sign; - new->encrypt = info->encrypt; - - /* Add the attachment to the bar.*/ - e_attachment_bar_add_attachment_silent (E_ATTACHMENT_BAR(efhd->priv->attachment_bar), new); - efhd_attachment_bar_refresh(efhd); - } - - mainbox = gtk_hbox_new(FALSE, 0); - - button = gtk_button_new(); - - if (info->handle) { - g_signal_connect(button, "clicked", G_CALLBACK(efhd_attachment_button_show), info); - g_object_set_data (G_OBJECT (button), "efh", efh); - } else { - gtk_widget_set_sensitive(button, FALSE); - GTK_WIDGET_UNSET_FLAGS(button, GTK_CAN_FOCUS); - } - - hbox = gtk_hbox_new(FALSE, 2); - info->forward = gtk_image_new_from_stock(GTK_STOCK_GO_FORWARD, GTK_ICON_SIZE_BUTTON); - gtk_box_pack_start((GtkBox *)hbox, info->forward, TRUE, TRUE, 0); - if (info->handle) { - info->down = gtk_image_new_from_stock(GTK_STOCK_GO_DOWN, GTK_ICON_SIZE_BUTTON); - gtk_box_pack_start((GtkBox *)hbox, info->down, TRUE, TRUE, 0); - } - - w = gtk_image_new(); - gtk_widget_set_size_request(w, 24, 24); - gtk_box_pack_start((GtkBox *)hbox, w, TRUE, TRUE, 0); - gtk_container_add((GtkContainer *)button, hbox); - gtk_box_pack_start((GtkBox *)mainbox, button, TRUE, TRUE, 0); - - /* Check for snooped type to get the right icon/processing */ - if (info->snoop_mime_type) - simple_type = g_strdup(info->snoop_mime_type); - else - simple_type = camel_content_type_simple (((CamelDataWrapper *)pobject->part)->mime_type); - camel_strdown(simple_type); - - /* FIXME: offline parts, just get icon */ - if (camel_content_type_is(((CamelDataWrapper *)pobject->part)->mime_type, "image", "*")) { - EMFormatHTMLJob *job; - GdkPixbuf *mini; - char *key; - - key = pobject->classid; - mini = em_icon_stream_get_image(key, 24, 24); - if (mini) { - d(printf("got image from cache '%s'\n", key)); - gtk_image_set_from_pixbuf((GtkImage *)w, mini); - g_object_unref(mini); - } else { - d(printf("need to create icon image '%s'\n", key)); - job = em_format_html_job_new(efh, efhd_write_icon_job, pobject); - job->stream = (CamelStream *)em_icon_stream_new((GtkImage *)w, key, 24, 24, FALSE); - em_format_html_job_queue(efh, job); - } - } else { - GdkPixbuf *pixbuf, *mini; - - if ((pixbuf = e_icon_for_mime_type (simple_type, 24))) { - if ((mini = e_icon_factory_pixbuf_scale (pixbuf, 24, 24))) { - gtk_image_set_from_pixbuf ((GtkImage *) w, mini); - g_object_unref (mini); - } - g_object_unref (pixbuf); - } - } - - drag_types[0].target = simple_type; - gtk_drag_source_set(button, GDK_BUTTON1_MASK, drag_types, sizeof(drag_types)/sizeof(drag_types[0]), GDK_ACTION_COPY); - g_signal_connect(button, "drag-data-get", G_CALLBACK(efhd_drag_data_get), pobject); - g_signal_connect (button, "drag-data-delete", G_CALLBACK(efhd_drag_data_delete), pobject); - g_free(simple_type); + attachment = info->attachment; + e_attachment_set_shown (attachment, info->shown); + e_attachment_set_signed (attachment, info->sign); + e_attachment_set_encrypted (attachment, info->encrypt); + e_attachment_set_can_show (attachment, info->handle != NULL); - button = gtk_button_new(); - /*GTK_WIDGET_UNSET_FLAGS(button, GTK_CAN_FOCUS);*/ - gtk_container_add((GtkContainer *)button, gtk_arrow_new(GTK_ARROW_DOWN, GTK_SHADOW_NONE)); + parent = gtk_widget_get_toplevel (GTK_WIDGET (efh->html)); + parent = GTK_WIDGET_TOPLEVEL (parent) ? parent : NULL; - a11y = gtk_widget_get_accessible (button); - atk_object_set_name (a11y, _("Attachment")); + view = E_ATTACHMENT_VIEW (efhd->priv->attachment_view); + gtk_widget_show (efhd->priv->attachment_view); - g_signal_connect(button, "button_press_event", G_CALLBACK(efhd_attachment_popup), info); - g_signal_connect(button, "popup_menu", G_CALLBACK(efhd_attachment_popup_menu), info); - g_signal_connect(button, "clicked", G_CALLBACK(efhd_attachment_popup_menu), info); - gtk_box_pack_start((GtkBox *)mainbox, button, TRUE, TRUE, 0); + store = e_attachment_view_get_store (view); + e_attachment_store_add_attachment (store, info->attachment); - g_object_set_data (G_OBJECT (button), "efh", efh); + e_attachment_load_async ( + info->attachment, (GAsyncReadyCallback) + e_attachment_load_handle_error, parent); - gtk_widget_show_all(mainbox); + widget = e_attachment_button_new (view); + e_attachment_button_set_attachment ( + E_ATTACHMENT_BUTTON (widget), attachment); + gtk_container_add (GTK_CONTAINER (eb), widget); + gtk_widget_show (widget); - if (info->shown) - gtk_widget_hide(info->forward); - else if (info->down) - gtk_widget_hide(info->down); + g_object_set_data (G_OBJECT (widget), "efh", efh); - gtk_container_add((GtkContainer *)eb, mainbox); + g_signal_connect ( + widget, "notify::expanded", + G_CALLBACK (efhd_attachment_button_expanded), info); return TRUE; } @@ -2138,330 +1994,57 @@ type_ok: } static void -attachment_bar_arrow_clicked(GtkWidget *w, EMFormatHTMLDisplay *efhd) +efhd_bar_resize (EMFormatHTML *efh, + GtkAllocation *event) { + EMFormatHTMLDisplay *efhd = (EMFormatHTMLDisplay *) efh; + GtkWidget *widget; + gint width; - efhd->priv->show_bar = !efhd->priv->show_bar; + widget = GTK_WIDGET (efh->html); + width = widget->allocation.width - 12; - if (efhd->priv->show_bar) { - gtk_widget_show(efhd->priv->attachment_box); - gtk_widget_show(efhd->priv->down); - gtk_widget_hide(efhd->priv->forward); - } else { - gtk_widget_hide(efhd->priv->attachment_box); - gtk_widget_show(efhd->priv->forward); - gtk_widget_hide(efhd->priv->down); + if (width > 0) { + widget = efhd->priv->attachment_view; + gtk_widget_set_size_request (widget, width, -1); } } -static void -attachments_save_all_clicked (GtkWidget *widget, EMFormatHTMLDisplay *efhd) -{ - GSList *attachment_parts; - guint n_attachment_parts; - - attachment_parts = e_attachment_bar_get_parts ( - E_ATTACHMENT_BAR (efhd->priv->attachment_bar)); - n_attachment_parts = g_slist_length (attachment_parts); - g_return_if_fail (n_attachment_parts > 0); - - if (n_attachment_parts == 1) - em_utils_save_part ( - widget, _("Save attachment as"), - attachment_parts->data); - else - em_utils_save_parts ( - widget, _("Select folder to save all attachments"), - attachment_parts); - - g_slist_free (attachment_parts); -} - -static void -efhd_bar_popup_position(GtkMenu *menu, int *x, int *y, gboolean *push_in, gpointer user_data) -{ - EAttachmentBar *bar = user_data; - GnomeIconList *icon_list = user_data; - GList *selection; - GnomeCanvasPixbuf *image; - - gdk_window_get_origin (((GtkWidget*) bar)->window, x, y); - - selection = gnome_icon_list_get_selection (icon_list); - if (selection == NULL) - return; - - image = gnome_icon_list_get_icon_pixbuf_item (icon_list, GPOINTER_TO_INT(selection->data)); - if (image == NULL) - return; - - /* Put menu to the center of icon. */ - *x += (int)(image->item.x1 + image->item.x2) / 2; - *y += (int)(image->item.y1 + image->item.y2) / 2; -} - -static void -efhd_bar_save_selected(EPopup *ep, EPopupItem *item, void *data) -{ - EMFormatHTMLDisplay *efhd = (EMFormatHTMLDisplay *)data; - GSList *attachment_parts, *tmp; - GSList *parts = NULL; - - attachment_parts = e_attachment_bar_get_selected(E_ATTACHMENT_BAR(efhd->priv->attachment_bar)); - - for (tmp = attachment_parts; tmp; tmp=tmp->next) - parts = g_slist_prepend(parts, ((EAttachment *)tmp->data)->body); - - parts = g_slist_reverse(parts); - em_utils_save_parts(efhd->priv->attachment_bar, _("Select folder to save selected attachments..."), parts); - g_slist_free (parts); - - g_slist_foreach(attachment_parts, (GFunc)g_object_unref, NULL); - g_slist_free (attachment_parts); -} - -static EPopupItem efhd_bar_menu_items[] = { - { E_POPUP_BAR, "05.display", }, - { E_POPUP_ITEM, "05.display.01", N_("_Save Selected..."), efhd_bar_save_selected, NULL, NULL, EM_POPUP_ATTACHMENTS_MULTIPLE}, -}; - -static gboolean -efhd_bar_button_press_event(EAttachmentBar *bar, GdkEventButton *event, EMFormat *emf) -{ - GtkMenu *menu; - GSList *list=NULL; - EPopupTarget *target; - EMPopup *emp; - GSList *menus = NULL; - int i; - - if (event && event->button != 3) - return FALSE; - - /** @HookPoint-EMPopup: Attachment Bar Context Menu - * @Id: org.gnome.evolution.mail.attachments.popup - * @Class: org.gnome.evolution.mail.popup:1.0 - * @Target: EMPopupTargetPart - * - * This is the drop-down menu shown when a user clicks on the attachment bar - * when attachments are selected. - */ - emp = em_popup_new("org.gnome.evolution.mail.attachments.popup"); - - /* Add something like save-selected, foward selected attachments in a mail etc....*/ - list = e_attachment_bar_get_selected(bar); - - /* Lets not propagate any more the r-click which is intended to us*/ - if ( g_slist_length (list) == 0) - return TRUE; - - target = (EPopupTarget *)em_popup_target_new_attachments(emp, list); - for (i=0; i<2; i++) - menus = g_slist_prepend(menus, &efhd_bar_menu_items[i]); - e_popup_add_items((EPopup *)emp, menus, NULL, efhd_menu_items_free, emf); - - ((EMPopupTargetPart *)target)->target.widget = (GtkWidget *)bar; - menu = e_popup_create_menu_once((EPopup *)emp, (EPopupTarget *)target, 0); - if (event) - gtk_menu_popup(menu, NULL, NULL, NULL, NULL, event->button, event->time); - else - gtk_menu_popup(menu, NULL, NULL, (GtkMenuPositionFunc)efhd_bar_popup_position, bar, 0, gtk_get_current_event_time()); - - return TRUE; -} - static gboolean -efhd_bar_popup_menu_event (EAttachmentBar *bar, EMFormat *emf) -{ - return efhd_bar_button_press_event(bar, NULL, emf); -} - -static void -efhd_attachment_bar_refresh (EMFormatHTMLDisplay *efhd) -{ - int nattachments; - - if (!efhd->priv->attachment_bar) - return; - - nattachments = e_attachment_bar_get_num_attachments (E_ATTACHMENT_BAR(efhd->priv->attachment_bar)); - if (nattachments) { - char *txt; - - /* Cant i put in the number of attachments here ?*/ - txt = g_strdup_printf(ngettext("%d at_tachment", "%d at_tachments", nattachments), nattachments); - gtk_label_set_text_with_mnemonic ((GtkLabel *)efhd->priv->label, txt); - g_free (txt); - - /* Show the bar even when the first attachment is added */ - if (nattachments == 1) { - gtk_widget_show_all (efhd->priv->attachment_area); - gtk_label_set_text_with_mnemonic ((GtkLabel *)efhd->priv->save_txt, _("S_ave")); - - if (efhd->priv->show_bar) { - gtk_widget_show(efhd->priv->down); - gtk_widget_hide(efhd->priv->forward); - } else { - gtk_widget_show(efhd->priv->forward); - gtk_widget_hide(efhd->priv->down); - gtk_widget_hide(efhd->priv->attachment_box); - } - } else if (nattachments > 1) { - gtk_label_set_text_with_mnemonic ((GtkLabel *)efhd->priv->save_txt, _("S_ave All")); - } - } -} - -static void -efhd_bar_resize(GtkWidget *w, GtkAllocation *event, EMFormatHTML *efh) +efhd_add_bar (EMFormatHTML *efh, + GtkHTMLEmbedded *eb, + EMFormatHTMLPObject *pobject) { - int width; - GtkRequisition req; EMFormatHTMLDisplay *efhd = (EMFormatHTMLDisplay *) efh; + GtkWidget *widget; - gtk_widget_size_request (efhd->priv->attachment_bar, &req); - width = ((GtkWidget *) efh->html)->allocation.width - 16; - - /* Update the width of the bar when the width is greater than 1*/ - if (width > 0) - e_attachment_bar_set_width(E_ATTACHMENT_BAR(efhd->priv->attachment_bar), width); -} - -static gboolean -efhd_bar_scroll_event(GtkWidget *w, GdkEventScroll *event, EMFormatHTMLDisplay *efhd) -{ - gboolean ret; - - /* Emulate the scroll over the attachment bar, as if it is scrolled in the window. - * It doesnt go automatically since the GnomeIconList is a layout by itself - */ - g_signal_emit_by_name (gtk_widget_get_parent((GtkWidget *)efhd->formathtml.html), "scroll_event", event, &ret); - - return TRUE; -} - -gboolean -efhd_mnemonic_show_bar (GtkWidget *widget, gboolean focus, GtkWidget *efhd) -{ - attachment_bar_arrow_clicked (NULL, (EMFormatHTMLDisplay *)efhd); - - return TRUE; -} - -static gboolean -efhd_update_bar(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObject *pobject) -{ - EMFormatHTMLDisplay *efhd = (EMFormatHTMLDisplay *)efh; - struct _EMFormatHTMLDisplayPrivate *priv = efhd->priv; - - if (priv->attachment_bar) - e_attachment_bar_refresh (E_ATTACHMENT_BAR (priv->attachment_bar)); - - return TRUE; -} - -static gboolean -efhd_add_bar(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObject *pobject) -{ - EMFormatHTMLDisplay *efhd = (EMFormatHTMLDisplay *)efh; - struct _EMFormatHTMLDisplayPrivate *priv = efhd->priv; - GtkWidget *hbox1, *hbox2, *hbox3, *vbox, *txt, *image, *save, *scroll; - int width, height, bar_width; - - priv->attachment_bar = e_attachment_bar_new(NULL); - scroll = gtk_scrolled_window_new (NULL, NULL); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); - ((EAttachmentBar *)priv->attachment_bar)->expand = TRUE; - - priv->forward = gtk_arrow_new(GTK_ARROW_RIGHT, GTK_SHADOW_NONE); - priv->down = gtk_arrow_new(GTK_ARROW_DOWN, GTK_SHADOW_NONE); - hbox3 = gtk_hbox_new (FALSE, 0); - gtk_box_pack_start ((GtkBox *)hbox3, priv->forward, FALSE, FALSE, 0); - gtk_box_pack_start ((GtkBox *)hbox3, priv->down, FALSE, FALSE, 0); - priv->arrow = (GtkWidget *)gtk_tool_button_new(hbox3, NULL); - g_signal_connect (priv->arrow, "mnemonic_activate", G_CALLBACK (efhd_mnemonic_show_bar), efh); - atk_object_set_name (gtk_widget_get_accessible (priv->arrow), _("Show Attachments")); - - priv->label = gtk_label_new(_("No Attachment")); - gtk_label_set_mnemonic_widget (GTK_LABEL (priv->label), priv->arrow); - save = gtk_button_new(); - image = gtk_image_new_from_stock ("gtk-save", GTK_ICON_SIZE_BUTTON); - txt = gtk_label_new_with_mnemonic(_("S_ave")); - priv->save_txt = txt; - hbox1 = gtk_hbox_new(FALSE, 0); - gtk_box_pack_start((GtkBox *)hbox1, image, FALSE, FALSE, 2); - gtk_box_pack_start((GtkBox *)hbox1, txt, FALSE, FALSE, 0); - - gtk_container_add((GtkContainer *)save, hbox1); - - hbox2 = gtk_hbox_new (FALSE, 0); - gtk_box_pack_start ((GtkBox *)hbox2, priv->arrow, FALSE, FALSE, 0); - gtk_box_pack_start ((GtkBox *)hbox2, priv->label, FALSE, FALSE, 2); - gtk_box_pack_start ((GtkBox *)hbox2, save, FALSE, FALSE, 2); - - priv->attachment_box = scroll; - gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scroll), GTK_SHADOW_IN); - gtk_container_add ((GtkContainer *)priv->attachment_box, priv->attachment_bar); - - gtk_widget_get_size_request(priv->attachment_bar, &width, &height); - - /* FIXME: What if the text is more?. Should we reduce the text with appending ...? - * or resize the bar? How to figure out that, it needs more space? */ - bar_width = ((GtkWidget *)efh->html)->parent->allocation.width - /* FIXME */16; - gtk_widget_set_size_request (priv->attachment_bar, - bar_width > 0 ? bar_width : 0, - 84 /* FIXME: Default show only one row, Dont hardcode size*/); - - vbox = gtk_vbox_new (FALSE, 0); - gtk_box_pack_start ((GtkBox *)vbox, hbox2, FALSE, FALSE, 2); - gtk_box_pack_start ((GtkBox *)vbox, priv->attachment_box, TRUE, TRUE, 2); - - gtk_container_add ((GtkContainer *)eb, vbox); - gtk_widget_show ((GtkWidget *)eb); - - /* Lets hide it by default and show only when there are attachments */ - priv->attachment_area = vbox; - gtk_widget_hide_all (priv->attachment_area); + widget = e_mail_attachment_bar_new (); + gtk_container_add (GTK_CONTAINER (eb), widget); + efhd->priv->attachment_view = widget; + gtk_widget_hide (widget); - g_signal_connect (priv->arrow, "clicked", G_CALLBACK(attachment_bar_arrow_clicked), efh); - g_signal_connect (priv->attachment_bar, "button_press_event", G_CALLBACK(efhd_bar_button_press_event), efhd); - g_signal_connect (priv->attachment_bar, "popup-menu", G_CALLBACK(efhd_bar_popup_menu_event), efhd); - g_signal_connect (save, "clicked", G_CALLBACK(attachments_save_all_clicked), efh); - g_signal_connect (eb, "size_allocate", G_CALLBACK (efhd_bar_resize), efh); - g_signal_connect (priv->attachment_bar, "scroll_event", G_CALLBACK(efhd_bar_scroll_event), efhd); + g_signal_connect_swapped ( + eb, "size-allocate", + G_CALLBACK (efhd_bar_resize), efh); return TRUE; } -static void -efhd_message_update_bar(EMFormat *emf, CamelStream *stream, CamelMimePart *part, const EMFormatHandler *info) -{ - EMFormatHTMLDisplay *efhd = (EMFormatHTMLDisplay *) emf; - const char *classid = "attachment-bar-refresh"; - - if (efhd->nobar || efhd->priv->updated) - return; - - efhd->priv->files = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); - efhd->priv->updated = TRUE; - em_format_html_add_pobject((EMFormatHTML *)emf, sizeof(EMFormatHTMLPObject), classid, part, efhd_update_bar); - camel_stream_printf(stream, "<td><object classid=\"%s\"></object></td>", classid); - -} static void -efhd_message_add_bar(EMFormat *emf, CamelStream *stream, CamelMimePart *part, const EMFormatHandler *info) +efhd_message_add_bar (EMFormat *emf, + CamelStream *stream, + CamelMimePart *part, + const EMFormatHandler *info) { - EMFormatHTMLDisplay *efhd = (EMFormatHTMLDisplay *) emf; const char *classid = "attachment-bar"; - if (efhd->nobar || efhd->priv->files) - return; + em_format_html_add_pobject ( + (EMFormatHTML *) emf, + sizeof (EMFormatHTMLPObject), + classid, part, efhd_add_bar); - efhd->priv->files = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); - efhd->priv->updated = FALSE; - - em_format_html_add_pobject((EMFormatHTML *)emf, sizeof(EMFormatHTMLPObject), classid, part, efhd_add_bar); - camel_stream_printf(stream, "<td><object classid=\"%s\"></object></td>", classid); + camel_stream_printf ( + stream, "<td><object classid=\"%s\"></object></td>", classid); } static void @@ -2470,43 +2053,50 @@ efhd_format_attachment(EMFormat *emf, CamelStream *stream, CamelMimePart *part, char *classid, *text, *html; struct _attach_puri *info; - classid = g_strdup_printf("attachment%s", emf->part_id->str); - info = (struct _attach_puri *)em_format_add_puri(emf, sizeof(*info), classid, part, efhd_attachment_frame); - em_format_html_add_pobject((EMFormatHTML *)emf, sizeof(EMFormatHTMLPObject), classid, part, efhd_attachment_button); + classid = g_strdup_printf ("attachment%s", emf->part_id->str); + info = (struct _attach_puri *)em_format_add_puri ( + emf, sizeof (*info), classid, part, efhd_attachment_frame); + em_format_html_add_pobject ( + (EMFormatHTML *) emf, sizeof (EMFormatHTMLPObject), + classid, part, efhd_attachment_button); info->handle = handle; - info->shown = em_format_is_inline(emf, info->puri.part_id, info->puri.part, handle); + info->shown = em_format_is_inline ( + emf, info->puri.part_id, info->puri.part, handle); info->snoop_mime_type = emf->snoop_mime_type; - info->attachment = e_attachment_new_from_mime_part (info->puri.part); - e_attachment_bar_create_attachment_cache (info->attachment); + info->attachment = e_attachment_new (); + e_attachment_set_mime_part (info->attachment, info->puri.part); if (emf->valid) { info->sign = emf->valid->sign.status; info->encrypt = emf->valid->encrypt.status; } - camel_stream_write_string(stream, - EM_FORMAT_HTML_VPAD - "<table cellspacing=0 cellpadding=0><tr><td>" - "<table width=10 cellspacing=0 cellpadding=0>" - "<tr><td></td></tr></table></td>"); + camel_stream_write_string ( + stream, EM_FORMAT_HTML_VPAD + "<table cellspacing=0 cellpadding=0><tr><td>" + "<table width=10 cellspacing=0 cellpadding=0>" + "<tr><td></td></tr></table></td>"); - camel_stream_printf(stream, "<td><object classid=\"%s\"></object></td>", classid); + camel_stream_printf ( + stream, "<td><object classid=\"%s\"></object></td>", classid); - camel_stream_write_string(stream, - "<td><table width=3 cellspacing=0 cellpadding=0>" - "<tr><td></td></tr></table></td><td><font size=-1>"); + camel_stream_write_string ( + stream, "<td><table width=3 cellspacing=0 cellpadding=0>" + "<tr><td></td></tr></table></td><td><font size=-1>"); /* output some info about it */ /* FIXME: should we look up mime_type from object again? */ - text = em_format_describe_part(part, mime_type); - html = camel_text_to_html(text, ((EMFormatHTML *)emf)->text_html_flags & CAMEL_MIME_FILTER_TOHTML_CONVERT_URLS, 0); - camel_stream_write_string(stream, html); - g_free(html); - g_free(text); - - camel_stream_write_string(stream, - "</font></td></tr><tr></table>\n" - EM_FORMAT_HTML_VPAD); + text = em_format_describe_part (part, mime_type); + html = camel_text_to_html ( + text, ((EMFormatHTML *)emf)->text_html_flags & + CAMEL_MIME_FILTER_TOHTML_CONVERT_URLS, 0); + camel_stream_write_string (stream, html); + g_free (html); + g_free (text); + + camel_stream_write_string ( + stream, "</font></td></tr><tr></table>\n" + EM_FORMAT_HTML_VPAD); if (handle) { if (info->shown) @@ -2653,7 +2243,8 @@ efhd_format_optional(EMFormat *emf, CamelStream *fstream, CamelMimePart *part, C info->handle = em_format_find_handler(emf, "text/plain"); info->shown = FALSE; info->snoop_mime_type = "text/plain"; - info->attachment = e_attachment_new_from_mime_part (info->puri.part); + info->attachment = e_attachment_new (); + e_attachment_set_mime_part (info->attachment, info->puri.part); info->mstream = (CamelStreamMem *)mstream; if (emf->valid) { info->sign = emf->valid->sign.status; diff --git a/mail/em-format-html-display.h b/mail/em-format-html-display.h index 651b981364..4e2e7c1f83 100644 --- a/mail/em-format-html-display.h +++ b/mail/em-format-html-display.h @@ -26,7 +26,6 @@ #define _EM_FORMAT_HTML_DISPLAY_H #include "mail/em-format-html.h" -#include "widgets/misc/e-attachment-bar.h" typedef struct _EMFormatHTMLDisplay EMFormatHTMLDisplay; typedef struct _EMFormatHTMLDisplayClass EMFormatHTMLDisplayClass; @@ -82,7 +81,6 @@ void em_format_html_display_paste (EMFormatHTMLDisplay *efhd); void em_format_html_display_zoom_in (EMFormatHTMLDisplay *efhd); void em_format_html_display_zoom_out (EMFormatHTMLDisplay *efhd); void em_format_html_display_zoom_reset (EMFormatHTMLDisplay *efhd); -EAttachmentBar *em_format_html_display_get_bar (EMFormatHTMLDisplay *efhd); gboolean em_format_html_display_popup_menu (EMFormatHTMLDisplay *efhd); diff --git a/mail/em-popup.c b/mail/em-popup.c index 91e6ed6280..debad8cb56 100644 --- a/mail/em-popup.c +++ b/mail/em-popup.c @@ -100,12 +100,6 @@ emp_target_free(EPopup *ep, EPopupTarget *t) g_free(s->uri); break; } - case EM_POPUP_TARGET_ATTACHMENTS: { - EMPopupTargetAttachments *s = (EMPopupTargetAttachments *)t; - - g_slist_foreach(s->attachments, (GFunc)g_object_unref, NULL); - g_slist_free(s->attachments); - break; } } ((EPopupClass *)emp_parent)->target_free(ep, t); @@ -361,42 +355,6 @@ done: return t; } -/** - * em_popup_target_new_attachments: - * @emp: - * @attachments: A list of EMsgComposerAttachment objects, reffed for - * the list. Will be unreff'd once finished with. - * - * Owns the list @attachments and their items after they're passed in. - * - * Return value: - **/ -EMPopupTargetAttachments * -em_popup_target_new_attachments(EMPopup *emp, GSList *attachments) -{ - EMPopupTargetAttachments *t = e_popup_target_new(&emp->popup, EM_POPUP_TARGET_ATTACHMENTS, sizeof(*t)); - guint32 mask = ~0; - int len = g_slist_length(attachments); - - t->attachments = attachments; - if (len > 0) - mask &= ~ EM_POPUP_ATTACHMENTS_MANY; - if (len == 1 && ((EAttachment *)attachments->data)->is_available_local) { - - if (camel_content_type_is(((CamelDataWrapper *) ((EAttachment *) attachments->data)->body)->mime_type, "image", "*")) - mask &= ~ EM_POPUP_ATTACHMENTS_IMAGE; - if (CAMEL_IS_MIME_MESSAGE(camel_medium_get_content_object((CamelMedium *) ((EAttachment *) attachments->data)->body))) - mask &= ~EM_POPUP_ATTACHMENTS_MESSAGE; - - mask &= ~ EM_POPUP_ATTACHMENTS_ONE; - } - if (len > 1) - mask &= ~ EM_POPUP_ATTACHMENTS_MULTIPLE; - t->target.mask = mask; - - return t; -} - /* ********************************************************************** */ static void @@ -405,11 +363,7 @@ emp_part_popup_saveas(EPopup *ep, EPopupItem *item, void *data) EPopupTarget *t = ep->target; CamelMimePart *part = NULL; - /* If it is of type EM_POPUP_TARGET_ATTACHMENTS, we can assume the length is one. */ - if (t->type == EM_POPUP_TARGET_ATTACHMENTS) - part = ((EAttachment *) ((EMPopupTargetAttachments *) t)->attachments->data)->body; - else - part = ((EMPopupTargetPart *) t)->part; + part = ((EMPopupTargetPart *) t)->part; em_utils_save_part(ep->target->widget, _("Save As..."), part); } @@ -423,10 +377,7 @@ emp_part_popup_set_background(EPopup *ep, EPopupItem *item, void *data) unsigned int i=1; CamelMimePart *part = NULL; - if (t->type == EM_POPUP_TARGET_ATTACHMENTS) - part = ((EAttachment *) ((EMPopupTargetAttachments *) t)->attachments->data)->body; - else - part = ((EMPopupTargetPart *) t)->part; + part = ((EMPopupTargetPart *) t)->part; if (!part) return; @@ -497,10 +448,7 @@ emp_part_popup_reply_sender(EPopup *ep, EPopupItem *item, void *data) CamelMimeMessage *message; CamelMimePart *part; - if (t->type == EM_POPUP_TARGET_ATTACHMENTS) - part = ((EAttachment *) ((EMPopupTargetAttachments *) t)->attachments->data)->body; - else - part = ((EMPopupTargetPart *) t)->part; + part = ((EMPopupTargetPart *) t)->part; message = (CamelMimeMessage *)camel_medium_get_content_object((CamelMedium *)part); em_utils_reply_to_message(NULL, NULL, message, REPLY_MODE_SENDER, NULL); @@ -513,10 +461,7 @@ emp_part_popup_reply_list (EPopup *ep, EPopupItem *item, void *data) CamelMimeMessage *message; CamelMimePart *part; - if (t->type == EM_POPUP_TARGET_ATTACHMENTS) - part = ((EAttachment *) ((EMPopupTargetAttachments *) t)->attachments->data)->body; - else - part = ((EMPopupTargetPart *) t)->part; + part = ((EMPopupTargetPart *) t)->part; message = (CamelMimeMessage *)camel_medium_get_content_object((CamelMedium *)part); em_utils_reply_to_message(NULL, NULL, message, REPLY_MODE_LIST, NULL); @@ -529,10 +474,7 @@ emp_part_popup_reply_all (EPopup *ep, EPopupItem *item, void *data) CamelMimeMessage *message; CamelMimePart *part; - if (t->type == EM_POPUP_TARGET_ATTACHMENTS) - part = ((EAttachment *) ((EMPopupTargetAttachments *) t)->attachments->data)->body; - else - part = ((EMPopupTargetPart *) t)->part; + part = ((EMPopupTargetPart *) t)->part; message = (CamelMimeMessage *)camel_medium_get_content_object((CamelMedium *)part); em_utils_reply_to_message(NULL, NULL, message, REPLY_MODE_ALL, NULL); @@ -545,10 +487,7 @@ emp_part_popup_forward (EPopup *ep, EPopupItem *item, void *data) CamelMimeMessage *message; CamelMimePart *part; - if (t->type == EM_POPUP_TARGET_ATTACHMENTS) - part = ((EAttachment *) ((EMPopupTargetAttachments *) t)->attachments->data)->body; - else - part = ((EMPopupTargetPart *) t)->part; + part = ((EMPopupTargetPart *) t)->part; /* TODO: have a emfv specific override so we can get the parent folder uri */ message = (CamelMimeMessage *)camel_medium_get_content_object((CamelMedium *) part); @@ -566,17 +505,6 @@ static EMPopupItem emp_standard_object_popups[] = { { E_POPUP_ITEM, "20.part.00", N_("_Forward"), emp_part_popup_forward, NULL, "mail-forward", EM_POPUP_PART_MESSAGE }, }; -static EMPopupItem emp_attachment_object_popups[] = { - { E_POPUP_ITEM, "00.attach.00", N_("_Save As..."), emp_part_popup_saveas, NULL, "document-save-as", 0 }, - { E_POPUP_ITEM, "00.attach.10", N_("Set as _Background"), emp_part_popup_set_background, NULL, NULL, EM_POPUP_ATTACHMENTS_IMAGE }, - { E_POPUP_BAR, "05.attach", NULL, NULL, NULL, NULL, EM_POPUP_ATTACHMENTS_MESSAGE }, - { E_POPUP_ITEM, "05.attach.00", N_("_Reply to sender"), emp_part_popup_reply_sender, NULL, "mail-reply-sender" , EM_POPUP_ATTACHMENTS_MESSAGE }, - { E_POPUP_ITEM, "05.attach.01", N_("Reply to _List"), emp_part_popup_reply_list, NULL, NULL, EM_POPUP_ATTACHMENTS_MESSAGE}, - { E_POPUP_ITEM, "05.attach.03", N_("Reply to _All"), emp_part_popup_reply_all, NULL, "mail-reply-all", EM_POPUP_ATTACHMENTS_MESSAGE}, - { E_POPUP_BAR, "05.attach.10", NULL, NULL, NULL, NULL, EM_POPUP_ATTACHMENTS_MESSAGE }, - { E_POPUP_ITEM, "05.attach.15", N_("_Forward"), emp_part_popup_forward, NULL, "mail-forward", EM_POPUP_ATTACHMENTS_MESSAGE }, -}; - static const EPopupItem emp_standard_part_apps_bar = { E_POPUP_BAR, "99.object" }; /* ********************************************************************** */ @@ -634,10 +562,7 @@ emp_apps_open_in(EPopup *ep, EPopupItem *item, void *data) EPopupTarget *target = ep->target; CamelMimePart *part; - if (target->type == EM_POPUP_TARGET_ATTACHMENTS) - part = ((EAttachment *) ((EMPopupTargetAttachments *) target)->attachments->data)->body; - else - part = ((EMPopupTargetPart *) target)->part; + part = ((EMPopupTargetPart *) target)->part; path = em_utils_temp_save_part(target->widget, part, TRUE); if (path) { @@ -705,10 +630,7 @@ emp_add_vcard (EPopup *ep, EPopupItem *item, void *data) CamelStreamMem *mem; - if (target->type == EM_POPUP_TARGET_ATTACHMENTS) - part = ((EAttachment *) ((EMPopupTargetAttachments *) target)->attachments->data)->body; - else - part = ((EMPopupTargetPart *) target)->part; + part = ((EMPopupTargetPart *) target)->part; if (!part) return; @@ -762,25 +684,6 @@ emp_standard_menu_factory(EPopup *emp, void *data) items = emp_standard_object_popups; len = LEN(emp_standard_object_popups); break; } - case EM_POPUP_TARGET_ATTACHMENTS: { - EMPopupTargetAttachments *t = (EMPopupTargetAttachments *)emp->target; - GSList *list = t->attachments; - EAttachment *attachment; - - if (g_slist_length(list) != 1 || !((EAttachment *)list->data)->is_available_local) { - items = NULL; - len = 0; - break; - } - - /* Only one attachment selected */ - attachment = list->data; - mime_type = camel_data_wrapper_get_mime_type((CamelDataWrapper *)attachment->body); - filename = camel_mime_part_get_filename(attachment->body); - - items = emp_attachment_object_popups; - len = LEN(emp_attachment_object_popups); - break; } default: items = NULL; len = 0; @@ -942,21 +845,11 @@ static const EPopupHookTargetMask emph_folder_masks[] = { { NULL } }; -static const EPopupHookTargetMask emph_attachments_masks[] = { - { "one", EM_POPUP_ATTACHMENTS_ONE }, - { "many", EM_POPUP_ATTACHMENTS_MANY }, - { "multiple", EM_POPUP_ATTACHMENTS_MULTIPLE }, - { "image", EM_POPUP_ATTACHMENTS_IMAGE }, - { "message", EM_POPUP_ATTACHMENTS_MESSAGE }, - { NULL } -}; - static const EPopupHookTargetMap emph_targets[] = { { "select", EM_POPUP_TARGET_SELECT, emph_select_masks }, { "uri", EM_POPUP_TARGET_URI, emph_uri_masks }, { "part", EM_POPUP_TARGET_PART, emph_part_masks }, { "folder", EM_POPUP_TARGET_FOLDER, emph_folder_masks }, - { "attachments", EM_POPUP_TARGET_ATTACHMENTS, emph_attachments_masks }, { NULL } }; diff --git a/mail/em-popup.h b/mail/em-popup.h index fbe41a310a..77f80e5599 100644 --- a/mail/em-popup.h +++ b/mail/em-popup.h @@ -43,7 +43,6 @@ typedef struct _EMPopupClass EMPopupClass; * @EM_POPUP_TARGET_URI: A URI. * @EM_POPUP_TARGET_PART: A CamelMimePart message part. * @EM_POPUP_TARGET_FOLDER: A folder URI. - * @EM_POPUP_TARGET_ATTACHMENTS: A list of attachments. * * Defines the value of the targetid for all EMPopup target types. **/ @@ -51,8 +50,7 @@ enum _em_popup_target_t { EM_POPUP_TARGET_SELECT, EM_POPUP_TARGET_URI, EM_POPUP_TARGET_PART, - EM_POPUP_TARGET_FOLDER, - EM_POPUP_TARGET_ATTACHMENTS, + EM_POPUP_TARGET_FOLDER }; /** @@ -158,26 +156,10 @@ enum _em_popup_target_folder_t { EM_POPUP_FOLDER_NONSTATIC = 1<<6, /* Except static folders like Outbox.*/ }; -/** - * enum _em_popup_target_attachments_t - EMPopupTargetAttachments qualifiers. - * - * @EM_POPUP_ATTACHMENTS_ONE: There is one and only one attachment selected. - * @EM_POPUP_ATTACHMENTS_MANY: There is one or more attachments selected. - * - **/ -enum _em_popup_target_attachments_t { - EM_POPUP_ATTACHMENTS_ONE = 1<<0, /* only 1 selected */ - EM_POPUP_ATTACHMENTS_MANY = 1<<1, /* one or more selected */ - EM_POPUP_ATTACHMENTS_MULTIPLE = 1<<2, /* More than 1 selected */ - EM_POPUP_ATTACHMENTS_IMAGE = 1<<3, /* Image selected */ - EM_POPUP_ATTACHMENTS_MESSAGE = 1<<4 /* Message selected */ -}; - typedef struct _EMPopupTargetSelect EMPopupTargetSelect; typedef struct _EMPopupTargetURI EMPopupTargetURI; typedef struct _EMPopupTargetPart EMPopupTargetPart; typedef struct _EMPopupTargetFolder EMPopupTargetFolder; -typedef struct _EMPopupTargetAttachments EMPopupTargetAttachments; /** * struct _EMPopupTargetURI - An inline URI. @@ -241,20 +223,6 @@ struct _EMPopupTargetFolder { char *uri; }; -/** - * struct _EMPopupTargetAttachments - A list of composer attachments. - * - * @target: Superclass. - * @attachments: A GSList list of EMsgComposer attachments. - * - * This target is used to represent a selected list of attachments in - * the message composer attachment area. - **/ -struct _EMPopupTargetAttachments { - EPopupTarget target; - GSList *attachments; -}; - typedef struct _EPopupItem EMPopupItem; /* The object */ @@ -276,7 +244,6 @@ EMPopupTargetURI *em_popup_target_new_uri(EMPopup *emp, const char *uri); EMPopupTargetSelect *em_popup_target_new_select(EMPopup *emp, struct _CamelFolder *folder, const char *folder_uri, GPtrArray *uids); EMPopupTargetPart *em_popup_target_new_part(EMPopup *emp, struct _CamelMimePart *part, const char *mime_type); EMPopupTargetFolder *em_popup_target_new_folder(EMPopup *emp, const char *uri, guint32 info_flags, guint32 popup_flags); -EMPopupTargetAttachments *em_popup_target_new_attachments(EMPopup *emp, GSList *attachments); /* ********************************************************************** */ diff --git a/mail/mail-component.c b/mail/mail-component.c index 3b67c43ad4..556715d662 100644 --- a/mail/mail-component.c +++ b/mail/mail-component.c @@ -92,6 +92,8 @@ #include "e-util/e-non-intrusive-error-dialog.h" +#include "e-attachment-handler-mail.h" + #define MAILER_ERROR_LEVEL_KEY "/apps/evolution/mail/display/error_level" #define MAILER_ERROR_TIME_OUT_KEY "/apps/evolution/mail/display/error_timeout" @@ -1259,6 +1261,9 @@ mail_component_class_init (MailComponentClass *class) epv->setLineStatus = impl_setLineStatus; mepv->test = impl_mail_test; + + /* Register attachment handler types. */ + e_attachment_handler_mail_get_type (); } static void |