aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRadek Doulik <rodo@helixcode.com>2000-11-15 16:45:22 +0800
committerRadek Doulik <rodo@src.gnome.org>2000-11-15 16:45:22 +0800
commitc9c591526f3104831f2ccefaf907cee6bd0ac2d5 (patch)
tree1434e4d3bde969171826a070c3bb54384ea765db
parent7384e82aa7369af5d6aa07afd856a5f9cf1f6841 (diff)
downloadgsoc2013-evolution-c9c591526f3104831f2ccefaf907cee6bd0ac2d5.tar.gz
gsoc2013-evolution-c9c591526f3104831f2ccefaf907cee6bd0ac2d5.tar.zst
gsoc2013-evolution-c9c591526f3104831f2ccefaf907cee6bd0ac2d5.zip
e_msg_composer_guess_mime_type renamed and moved
2000-11-15 Radek Doulik <rodo@helixcode.com> * e-msg-composer.h: e_msg_composer_guess_mime_type renamed and moved mime_guess_type_from_file_name from camel as it uses VFS svn path=/trunk/; revision=6579
-rw-r--r--composer/ChangeLog5
-rw-r--r--composer/e-msg-composer-attachment.c5
-rw-r--r--composer/e-msg-composer.c29
-rw-r--r--composer/e-msg-composer.h1
4 files changed, 35 insertions, 5 deletions
diff --git a/composer/ChangeLog b/composer/ChangeLog
index f7878e7b62..f2e303088c 100644
--- a/composer/ChangeLog
+++ b/composer/ChangeLog
@@ -1,3 +1,8 @@
+2000-11-15 Radek Doulik <rodo@helixcode.com>
+
+ * e-msg-composer.h: e_msg_composer_guess_mime_type renamed and
+ moved mime_guess_type_from_file_name from camel as it uses VFS
+
2000-11-14 Radek Doulik <rodo@helixcode.com>
* listener.c (reply_indent): rename command to runCommand
diff --git a/composer/e-msg-composer-attachment.c b/composer/e-msg-composer-attachment.c
index 8fd06f2afa..8483e318db 100644
--- a/composer/e-msg-composer-attachment.c
+++ b/composer/e-msg-composer-attachment.c
@@ -33,6 +33,7 @@
#include <camel/camel.h>
#include <gal/widgets/e-unicode.h>
+#include "e-msg-composer.h"
#include "e-msg-composer-attachment.h"
@@ -167,7 +168,7 @@ e_msg_composer_attachment_new (const gchar *file_name)
wrapper = camel_data_wrapper_new ();
camel_data_wrapper_construct_from_stream (wrapper, stream);
camel_object_unref (CAMEL_OBJECT (stream));
- mime_type = mime_guess_type_from_file_name (file_name);
+ mime_type = e_msg_composer_guess_mime_type (file_name);
if (mime_type) {
camel_data_wrapper_set_mime_type (wrapper, mime_type);
g_free (mime_type);
@@ -251,7 +252,7 @@ update_mime_type (DialogData *data)
return;
file_name = e_utf8_gtk_entry_get_text (data->file_name_entry);
- mime_type = mime_guess_type_from_file_name (file_name);
+ mime_type = e_msg_composer_guess_mime_type (file_name);
g_free (file_name);
e_utf8_gtk_entry_set_text (data->mime_type_entry, mime_type);
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
index 72c74ecc10..4472bae4eb 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -204,7 +204,7 @@ add_inlined_image (gpointer key, gpointer value, gpointer data)
camel_data_wrapper_construct_from_stream (wrapper, stream);
camel_object_unref (CAMEL_OBJECT (stream));
- mime_type = mime_guess_type_from_file_name (file_name);
+ mime_type = e_msg_composer_guess_mime_type (file_name);
camel_data_wrapper_set_mime_type (wrapper, mime_type ? mime_type : "application/octet-stream");
g_free (mime_type);
@@ -1394,9 +1394,12 @@ e_msg_composer_construct (EMsgComposer *composer)
e_msg_composer_show_attachments (composer, FALSE);
- /* Set focus on the `To:' field. */
+ /* Set focus on the `To:' field.
- gtk_widget_grab_focus (e_msg_composer_hdrs_get_to_entry (E_MSG_COMPOSER_HDRS (composer->hdrs)));
+ gtk_widget_grab_focus (e_msg_composer_hdrs_get_to_entry (E_MSG_COMPOSER_HDRS (composer->hdrs)));
+ GTK_WIDGET_SET_FLAGS (composer->editor, GTK_CAN_FOCUS);
+ gtk_window_set_focus (GTK_WINDOW (composer), composer->editor); */
+ gtk_widget_grab_focus (composer->editor);
}
static EMsgComposer *
@@ -2001,3 +2004,23 @@ e_msg_composer_get_send_html (EMsgComposer *composer)
return composer->send_html;
}
+
+
+gchar *
+e_msg_composer_guess_mime_type (const gchar *file_name)
+{
+ GnomeVFSFileInfo info;
+ GnomeVFSResult result;
+
+ result = gnome_vfs_get_file_info (file_name, &info,
+ GNOME_VFS_FILE_INFO_GET_MIME_TYPE |
+ GNOME_VFS_FILE_INFO_FOLLOW_LINKS);
+ if (result == GNOME_VFS_OK) {
+ gchar *type;
+
+ type = g_strdup (gnome_vfs_file_info_get_mime_type (&info));
+ gnome_vfs_file_info_unref (&info);
+ return type;
+ } else
+ return NULL;
+}
diff --git a/composer/e-msg-composer.h b/composer/e-msg-composer.h
index f5de97cbf2..4e8c611f66 100644
--- a/composer/e-msg-composer.h
+++ b/composer/e-msg-composer.h
@@ -112,6 +112,7 @@ void e_msg_composer_set_send_html (EMsgComposer *compose
gboolean send_html);
gboolean e_msg_composer_get_send_html (EMsgComposer *composer);
void e_msg_composer_clear_inlined_table (EMsgComposer *composer);
+gchar * e_msg_composer_guess_mime_type (const gchar *file_name);
#ifdef __cplusplus
}