Just use gnome_vfs_get_mime_type_from_name() so we can forget all the crap
2003-02-03 Jeffrey Stedfast <fejj@ximian.com> * mail-identify.c (mail_identify_mime_part): Just use gnome_vfs_get_mime_type_from_name() so we can forget all the crap I implemented before. 2003-02-01 Jeffrey Stedfast <fejj@ximian.com> * mail-display.c (on_link_clicked): Pass in the *address* of the GError to gnome_url_show(), otherwise bad things happen :-) svn path=/trunk/; revision=19711
This commit is contained in:
committed by
Jeffrey Stedfast
parent
aa078aa5fc
commit
d2f0410b09
@ -1,3 +1,14 @@
|
||||
2003-02-03 Jeffrey Stedfast <fejj@ximian.com>
|
||||
|
||||
* mail-identify.c (mail_identify_mime_part): Just use
|
||||
gnome_vfs_get_mime_type_from_name() so we can forget all the crap
|
||||
I implemented before.
|
||||
|
||||
2003-02-01 Jeffrey Stedfast <fejj@ximian.com>
|
||||
|
||||
* mail-display.c (on_link_clicked): Pass in the *address* of the
|
||||
GError to gnome_url_show(), otherwise bad things happen :-)
|
||||
|
||||
2003-01-31 Jeffrey Stedfast <fejj@ximian.com>
|
||||
|
||||
* mail-config.c (mail_config_get_labels): New function to return a
|
||||
|
||||
@ -303,8 +303,9 @@ on_link_clicked (GtkHTML *html, const char *url, MailDisplay *md)
|
||||
mail_display_jump_to_anchor (md, url);
|
||||
} else {
|
||||
GError *err = NULL;
|
||||
gnome_url_show (url, err);
|
||||
|
||||
|
||||
gnome_url_show (url, &err);
|
||||
|
||||
if (err) {
|
||||
g_warning ("gnome_url_show: %s", err->message);
|
||||
g_error_free (err);
|
||||
@ -319,7 +320,7 @@ save_part (CamelMimePart *part)
|
||||
char *filename, *dir, *base;
|
||||
GConfClient *gconf;
|
||||
|
||||
camel_object_ref (CAMEL_OBJECT (part));
|
||||
camel_object_ref (part);
|
||||
|
||||
gconf = gconf_client_get_default ();
|
||||
dir = gconf_client_get_string (gconf, "/apps/evolution/mail/save_dir", NULL);
|
||||
@ -349,7 +350,7 @@ save_part (CamelMimePart *part)
|
||||
static void
|
||||
save_cb (GtkWidget *widget, gpointer user_data)
|
||||
{
|
||||
CamelMimePart *part = g_object_get_data((user_data), "CamelMimePart");
|
||||
CamelMimePart *part = g_object_get_data ((GObject *) user_data, "CamelMimePart");
|
||||
|
||||
save_part (part);
|
||||
}
|
||||
@ -368,7 +369,7 @@ launch_cb (GtkWidget *widget, gpointer user_data)
|
||||
g_return_if_fail (handler != NULL && handler->applications != NULL);
|
||||
|
||||
/* Yum. Too bad EPopupMenu doesn't allow per-item closures. */
|
||||
children = gtk_container_get_children(GTK_CONTAINER (widget->parent));
|
||||
children = gtk_container_get_children (GTK_CONTAINER (widget->parent));
|
||||
g_return_if_fail (children != NULL && children->next != NULL && children->next->next != NULL);
|
||||
|
||||
for (c = children->next->next, apps = handler->applications; c && apps; c = c->next, apps = apps->next) {
|
||||
@ -379,7 +380,7 @@ launch_cb (GtkWidget *widget, gpointer user_data)
|
||||
g_return_if_fail (c != NULL && apps != NULL);
|
||||
app = apps->data;
|
||||
|
||||
tmpdir = e_mkdtemp ("evolution.XXXXXX");
|
||||
tmpdir = e_mkdtemp ("app-launcher-XXXXXX");
|
||||
|
||||
if (!tmpdir) {
|
||||
GtkWidget *dialog;
|
||||
@ -539,6 +540,7 @@ pixmap_press (GtkWidget *widget, GdkEventButton *event, gpointer user_data)
|
||||
for (i = 1; i < nitems; i++)
|
||||
g_free (menu[i].name);
|
||||
g_free (menu);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
@ -53,7 +53,6 @@ mail_identify_mime_part (CamelMimePart *part, MailDisplay *md)
|
||||
const char *filename, *magic_type = NULL;
|
||||
CamelDataWrapper *data;
|
||||
char *name_type = NULL;
|
||||
char *uri;
|
||||
|
||||
filename = camel_mime_part_get_filename (part);
|
||||
if (filename) {
|
||||
@ -61,15 +60,13 @@ mail_identify_mime_part (CamelMimePart *part, MailDisplay *md)
|
||||
if (!strcmp (filename, "winmail.dat"))
|
||||
return g_strdup ("application/vnd.ms-tnef");
|
||||
|
||||
uri = gnome_vfs_get_uri_from_local_path (filename);
|
||||
name_type = gnome_vfs_get_mime_type (uri);
|
||||
g_free (uri);
|
||||
name_type = gnome_vfs_get_mime_type_from_name (filename);
|
||||
}
|
||||
|
||||
|
||||
data = camel_medium_get_content_object (CAMEL_MEDIUM (part));
|
||||
if (!camel_data_wrapper_is_offline (data))
|
||||
magic_type = identify_by_magic (data, md);
|
||||
|
||||
|
||||
if (magic_type && name_type) {
|
||||
/* If GNOME-VFS doesn't recognize the data by magic, but it
|
||||
* contains English words, it will call it text/plain. If the
|
||||
@ -78,31 +75,31 @@ mail_identify_mime_part (CamelMimePart *part, MailDisplay *md)
|
||||
*/
|
||||
if (!strcmp (magic_type, "text/plain"))
|
||||
return name_type;
|
||||
|
||||
|
||||
/* If if returns "application/octet-stream" try to
|
||||
* do better with the filename check.
|
||||
*/
|
||||
if (!strcmp (magic_type, "application/octet-stream"))
|
||||
return name_type;
|
||||
}
|
||||
|
||||
|
||||
/* If the MIME part data was online, and the magic check
|
||||
* returned something, use that, since it's more reliable.
|
||||
*/
|
||||
if (magic_type) {
|
||||
g_free(name_type);
|
||||
g_free (name_type);
|
||||
return g_strdup (magic_type);
|
||||
}
|
||||
|
||||
|
||||
/* Otherwise try guessing based on the filename */
|
||||
if (name_type)
|
||||
return name_type;
|
||||
|
||||
|
||||
/* Another possibility to try is the x-mac-type / x-mac-creator
|
||||
* parameter to Content-Type used by some Mac email clients. That
|
||||
* would require a Mac type to mime type conversion table.
|
||||
*/
|
||||
|
||||
|
||||
#if 0
|
||||
/* If the data part is offline, then we didn't try magic
|
||||
* before, so force it to be loaded so we can try again later.
|
||||
@ -114,7 +111,7 @@ mail_identify_mime_part (CamelMimePart *part, MailDisplay *md)
|
||||
if (camel_data_wrapper_is_offline (data))
|
||||
mail_content_loaded (data, md, TRUE, NULL, NULL, NULL);
|
||||
#endif
|
||||
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user