+2005-09-07 [colin] 1.9.14cvs1
+
+ * src/compose.c
+ After saving draft, set modified to FALSE
+ * src/mimeview.c
+ * src/common/utils.c
+ * src/common/utils.h
+ Try to open mime parts using what is
+ indicated in ~/.mailcap or /etc/mailcap,
+ if possible.
+
2005-09-05 [paul] 1.9.14
1.9.14 released
( cvs diff -u -r 1.382.2.159 -r 1.382.2.160 src/compose.c; ) > 1.9.13cvs81.patchset
( cvs diff -u -r 1.382.2.160 -r 1.382.2.161 src/compose.c; ) > 1.9.13cvs82.patchset
( cvs diff -u -r 1.58.2.11 -r 1.58.2.12 po/de.po; cvs diff -u -r 1.60.2.12 -r 1.60.2.13 po/es.po; cvs diff -u -r 1.1.2.4 -r 1.1.2.5 po/fi.po; cvs diff -u -r 1.42.2.12 -r 1.42.2.13 po/fr.po; cvs diff -u -r 1.1.2.1 -r 1.1.2.2 po/nb.po; cvs diff -u -r 1.50.2.9 -r 1.50.2.10 po/pt_BR.po; cvs diff -u -r 1.17.2.12 -r 1.17.2.13 po/sr.po; ) > 1.9.13cvs83.patchset
+( cvs diff -u -r 1.382.2.161 -r 1.382.2.162 src/compose.c; cvs diff -u -r 1.83.2.38 -r 1.83.2.39 src/mimeview.c; cvs diff -u -r 1.36.2.42 -r 1.36.2.43 src/common/utils.c; cvs diff -u -r 1.20.2.23 -r 1.20.2.24 src/common/utils.h; ) > 1.9.14cvs1.patchset
MICRO_VERSION=14
INTERFACE_AGE=0
BINARY_AGE=0
-EXTRA_VERSION=0
+EXTRA_VERSION=1
EXTRA_RELEASE=
EXTRA_GTK2_VERSION=
return result;
}
+static gchar *mailcap_get_command_in_file(const gchar *path, const gchar *type)
+{
+ FILE *fp = fopen(path, "rb");
+ gchar buf[BUFFSIZE];
+ gchar *result = NULL;
+ if (!fp)
+ return NULL;
+ while (fgets(buf, sizeof (buf), fp) != NULL) {
+ gchar **parts = g_strsplit(buf, ";", -1);
+ gchar *trimmed = parts[0];
+ while (trimmed[0] == ' ')
+ trimmed++;
+ while (trimmed[strlen(trimmed)-1] == ' ')
+ trimmed[strlen(trimmed)-1] = '\0';
+
+ if (!strcmp(trimmed, type)) {
+ trimmed = parts[1];
+ while (trimmed[0] == ' ')
+ trimmed++;
+ while (trimmed[strlen(trimmed)-1] == ' ')
+ trimmed[strlen(trimmed)-1] = '\0';
+ while (trimmed[strlen(trimmed)-1] == '\n')
+ trimmed[strlen(trimmed)-1] = '\0';
+ while (trimmed[strlen(trimmed)-1] == '\r')
+ trimmed[strlen(trimmed)-1] = '\0';
+ result = g_strdup(trimmed);
+ g_strfreev(parts);
+ fclose(fp);
+ return result;
+ }
+ g_strfreev(parts);
+ }
+ fclose(fp);
+ return NULL;
+}
+gchar *mailcap_get_command_for_type(const gchar *type)
+{
+ gchar *result = NULL;
+ gchar *path = NULL;
+ path = g_strconcat(get_home_dir(), G_DIR_SEPARATOR_S, ".mailcap", NULL);
+ result = mailcap_get_command_in_file(path, type);
+ g_free(path);
+ if (result)
+ return result;
+ result = mailcap_get_command_in_file("/etc/mailcap", type);
+ return result;
+}
const gchar **bp, const gchar **ep);
gchar *make_email_string(const gchar *bp, const gchar *ep);
gchar *make_http_string(const gchar *bp, const gchar *ep);
+gchar *mailcap_get_command_for_type(const gchar *type);
#ifdef __cplusplus
}
!g_utf8_collate(gtk_entry_get_text(entry), mailto)) {
gtk_widget_ensure_style(GTK_WIDGET(entry));
if (!bold_style) {
- PangoFontDescription *font_desc = NULL;
gtkut_convert_int_to_gdk_color
(prefs_common.color_new, &bold_color);
bold_style = gtk_style_copy(gtk_widget_get_style
if (action == COMPOSE_AUTO_SAVE) {
compose->autosaved_draft = compose->targetinfo;
}
+ compose->modified = FALSE;
+ compose_set_title(compose);
}
}
MimeInfo *partinfo;
gchar *filename;
gchar *cmd;
+ gchar *mime_command = NULL;
+ gchar *content_type = NULL;
if (!mimeview->opened) return;
if (!mimeview->file) return;
prefs_common.mime_open_cmd_history =
add_history(NULL, prefs_common.mime_open_cmd);
+ content_type = procmime_get_content_type_str(partinfo->type,
+ partinfo->subtype);
+ mime_command = mailcap_get_command_for_type(content_type);
+ g_free(content_type);
cmd = input_dialog_combo
(_("Open with"),
_("Enter the command line to open file:\n"
"('%s' will be replaced with file name)"),
- prefs_common.mime_open_cmd,
+ mime_command ? mime_command : prefs_common.mime_open_cmd,
prefs_common.mime_open_cmd_history,
TRUE);
+ g_free(mime_command);
if (cmd) {
mimeview_view_file(filename, partinfo, cmd);
g_free(prefs_common.mime_open_cmd);