Use gnome_vfs_mime_type_from_name rather than gnome_vfs_mime_info, since

* e-msg-composer-attachment.c (update_mime_type): Use
	gnome_vfs_mime_type_from_name rather than gnome_vfs_mime_info,
	since the entered filename doesn't have to be a real file on disk.
	Deal with it returning NULL too.
	(e_msg_composer_attachment_edit): Select the right item in the
	inline/attachment menu.

	* e-msg-composer-hdrs.c: s/Pair/EMsgComposerHdrPair/. Namespace!

svn path=/trunk/; revision=8673
This commit is contained in:
Dan Winship
2001-03-13 17:23:14 +00:00
parent 43c6731edc
commit 14538bdee1
3 changed files with 28 additions and 8 deletions

View File

@ -1,3 +1,14 @@
2001-03-13 Dan Winship <danw@ximian.com>
* e-msg-composer-attachment.c (update_mime_type): Use
gnome_vfs_mime_type_from_name rather than gnome_vfs_mime_info,
since the entered filename doesn't have to be a real file on disk.
Deal with it returning NULL too.
(e_msg_composer_attachment_edit): Select the right item in the
inline/attachment menu.
* e-msg-composer-hdrs.c: s/Pair/EMsgComposerHdrPair/. Namespace!
2001-03-12 Jeffrey Stedfast <fejj@ximian.com>
* e-msg-composer.h: Added view_replyto member.

View File

@ -32,6 +32,7 @@
#include <gnome.h>
#include <camel/camel.h>
#include <gal/widgets/e-unicode.h>
#include <libgnomevfs/gnome-vfs-mime.h>
#include "e-msg-composer.h"
#include "e-msg-composer-attachment.h"
@ -253,10 +254,11 @@ update_mime_type (DialogData *data)
return;
file_name = e_utf8_gtk_entry_get_text (data->file_name_entry);
mime_type = e_msg_composer_guess_mime_type (file_name);
mime_type = gnome_vfs_mime_type_from_name_or_default (file_name, NULL);
g_free (file_name);
e_utf8_gtk_entry_set_text (data->mime_type_entry, mime_type);
if (mime_type)
e_utf8_gtk_entry_set_text (data->mime_type_entry, mime_type);
}
static void
@ -432,6 +434,7 @@ e_msg_composer_attachment_edit (EMsgComposerAttachment *attachment,
if (attachment != NULL) {
CamelContentType *content_type;
char *type;
const char *disposition;
set_entry (editor_gui, "file_name_entry",
camel_mime_part_get_filename (attachment->body));
@ -441,6 +444,12 @@ e_msg_composer_attachment_edit (EMsgComposerAttachment *attachment,
type = header_content_type_simple (content_type);
set_entry (editor_gui, "mime_type_entry", type);
g_free (type);
disposition = camel_mime_part_get_disposition (attachment->body);
if (disposition && !g_strcasecmp (disposition, "inline"))
gtk_option_menu_set_history (dialog_data->disposition_option, 1);
else
gtk_option_menu_set_history (dialog_data->disposition_option, 0);
}
connect_widget (editor_gui, "ok_button", "clicked", ok_cb, dialog_data);

View File

@ -55,7 +55,7 @@
typedef struct {
GtkWidget *label;
GtkWidget *entry;
} Pair;
} EMsgComposerHdrPair;
struct _EMsgComposerHdrsPrivate {
GNOME_Evolution_Addressbook_SelectNames corba_select_names;
@ -66,7 +66,7 @@ struct _EMsgComposerHdrsPrivate {
GSList *from_options;
/* Standard headers. */
Pair from, reply_to, to, cc, bcc, subject;
EMsgComposerHdrPair from, reply_to, to, cc, bcc, subject;
};
@ -292,11 +292,11 @@ create_addressbook_entry (EMsgComposerHdrs *hdrs,
return control_widget;
}
static Pair
static EMsgComposerHdrPair
header_new_recipient (EMsgComposerHdrs *hdrs, const gchar *name, const gchar *tip)
{
EMsgComposerHdrsPrivate *priv;
Pair ret;
EMsgComposerHdrPair ret;
priv = hdrs->priv;
@ -388,7 +388,7 @@ create_headers (EMsgComposerHdrs *hdrs)
}
static void
attach_couple (EMsgComposerHdrs *hdrs, Pair *pair, int line)
attach_couple (EMsgComposerHdrs *hdrs, EMsgComposerHdrPair *pair, int line)
{
int pad;
@ -424,7 +424,7 @@ attach_headers (EMsgComposerHdrs *hdrs)
}
static void
set_pair_visibility (EMsgComposerHdrs *h, Pair *pair, gboolean visible)
set_pair_visibility (EMsgComposerHdrs *h, EMsgComposerHdrPair *pair, gboolean visible)
{
if (visible){
gtk_widget_show (pair->label);