diff options
author | Srinivasa Ragavan <sragavan@src.gnome.org> | 2006-02-24 16:15:43 +0800 |
---|---|---|
committer | Srinivasa Ragavan <sragavan@src.gnome.org> | 2006-02-24 16:15:43 +0800 |
commit | e58a0e749818ebb5719afd03843d066d1aaa723d (patch) | |
tree | 32967e652f28c66bb1d92b877cbf42f5bf90e0ad /composer | |
parent | ca852ba2dea7c1716d22aa919dab07ca0b76d8ee (diff) | |
download | gsoc2013-evolution-e58a0e749818ebb5719afd03843d066d1aaa723d.tar gsoc2013-evolution-e58a0e749818ebb5719afd03843d066d1aaa723d.tar.gz gsoc2013-evolution-e58a0e749818ebb5719afd03843d066d1aaa723d.tar.bz2 gsoc2013-evolution-e58a0e749818ebb5719afd03843d066d1aaa723d.tar.lz gsoc2013-evolution-e58a0e749818ebb5719afd03843d066d1aaa723d.tar.xz gsoc2013-evolution-e58a0e749818ebb5719afd03843d066d1aaa723d.tar.zst gsoc2013-evolution-e58a0e749818ebb5719afd03843d066d1aaa723d.zip |
Committing Rohini's patch for bug #324742.
svn path=/trunk/; revision=31576
Diffstat (limited to 'composer')
-rw-r--r-- | composer/ChangeLog | 8 | ||||
-rw-r--r-- | composer/e-msg-composer.c | 36 |
2 files changed, 37 insertions, 7 deletions
diff --git a/composer/ChangeLog b/composer/ChangeLog index 268fa641bc..e786c66347 100644 --- a/composer/ChangeLog +++ b/composer/ChangeLog @@ -1,3 +1,11 @@ +2006-02-16 Rohini S <srohini@novell.com> + + ** Fixes bug #324742 + + * e-msg-composer.c (drop_action) (attachment_guess_mime_type): + Modified to add images in plain text mode and other files in both + html and plain text mode as attachment during DnD. + 2006-02-16 Tor Lillqvist <tml@novell.com> * e-msg-composer-hdrs.c (e_msg_composer_hdrs_get_to) diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c index 008c583b00..5d9c6bc4f4 100644 --- a/composer/e-msg-composer.c +++ b/composer/e-msg-composer.c @@ -2884,10 +2884,30 @@ e_msg_composer_get_remote_download_count (EMsgComposer *composer) (E_ATTACHMENT_BAR (p->attachment_bar)); } +static char * +attachment_guess_mime_type (const char *file_name) +{ + GnomeVFSFileInfo *info; + GnomeVFSResult result; + char *type = NULL; + + info = gnome_vfs_file_info_new (); + result = gnome_vfs_get_file_info (file_name, info, + GNOME_VFS_FILE_INFO_GET_MIME_TYPE | + GNOME_VFS_FILE_INFO_FORCE_SLOW_MIME_TYPE | + GNOME_VFS_FILE_INFO_FOLLOW_LINKS); + if (result == GNOME_VFS_OK) + type = g_strdup (gnome_vfs_file_info_get_mime_type (info)); + + gnome_vfs_file_info_unref (info); + + return type; +} + static void drop_action(EMsgComposer *composer, GdkDragContext *context, guint32 action, GtkSelectionData *selection, guint info, guint time) { - char *tmp, *str, **urls; + char *tmp, *str, **urls, *type; CamelMimePart *mime_part; CamelStream *stream; CamelURL *url; @@ -2939,12 +2959,14 @@ drop_action(EMsgComposer *composer, GdkDragContext *context, guint32 action, Gtk continue; } - if (!g_ascii_strcasecmp (url->protocol, "file")) - e_attachment_bar_attach - (E_ATTACHMENT_BAR (p->attachment_bar), - url->path, - "attachment"); - else { + if (!g_ascii_strcasecmp (url->protocol, "file")) { + type=attachment_guess_mime_type (str); + if (strncmp (type, "image", 5) || (!p->send_html && !strncmp (type, "image", 5))) + e_attachment_bar_attach + (E_ATTACHMENT_BAR (p->attachment_bar), + url->path, + "attachment"); + } else { e_attachment_bar_attach_remote_file (E_ATTACHMENT_BAR (p->attachment_bar), str); |