2005-09-07 [colin] 1.9.14cvs1
authorColin Leroy <colin@colino.net>
Wed, 7 Sep 2005 06:41:01 +0000 (06:41 +0000)
committerColin Leroy <colin@colino.net>
Wed, 7 Sep 2005 06:41:01 +0000 (06:41 +0000)
* 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.

ChangeLog-gtk2.claws
PATCHSETS
configure.ac
src/common/utils.c
src/common/utils.h
src/compose.c
src/mimeview.c

index bcae59517b6068e0df8347ce0850554b3fd7f654..0e4bf03549ae1c1655b0f1061533102749295c2e 100644 (file)
@@ -1,3 +1,14 @@
+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
index e7f210924c6d5c07432b234c4b9b58bb6d9e0553..2683c711758e9f8d4dd20465b628f400c9b217d9 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( 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
index 2eb03747387f73d4d2272853517143f0cdd884e0..da2d36dfa70cb768da50c5440161d67a283afbd9 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=9
 MICRO_VERSION=14
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=0
+EXTRA_VERSION=1
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index e82871728cc6fa634e06b1a5851912e8420b21c2..556bf3cf0be83125e9bce6d0a8aa131a31fdcfdc 100644 (file)
@@ -4386,3 +4386,50 @@ gchar *make_http_string(const gchar *bp, const gchar *ep)
        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;
+}
index b1ee4539f3582939b8400183c3a24c1d8c9e10ef..13f58ac24bbdcbfdb9a1630b7c1880a5c2cd4da1 100644 (file)
@@ -546,6 +546,7 @@ gboolean get_email_part(const gchar *start, const gchar *scanpos,
                               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
 }
index c472236959457fab3065a9cf15e6abef690b375e..4a9368ff2f7e49713df05baf4d9c6ef7a2d56758 100644 (file)
@@ -1705,7 +1705,6 @@ void compose_entry_mark_default_to(Compose *compose, const gchar *mailto)
                    !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
@@ -6579,6 +6578,8 @@ static void compose_draft_cb(gpointer data, guint action, GtkWidget *widget)
                if (action == COMPOSE_AUTO_SAVE) {
                        compose->autosaved_draft = compose->targetinfo;
                }
+               compose->modified = FALSE;
+               compose_set_title(compose);
        }
 }
 
index 9faf8056d268ca9ecdbe4a0a707132af5fbe1878..c32d392f13760831cc8c64a008cbd7e98332645a 100644 (file)
@@ -1229,6 +1229,8 @@ static void mimeview_open_with(MimeView *mimeview)
        MimeInfo *partinfo;
        gchar *filename;
        gchar *cmd;
+       gchar *mime_command = NULL;
+       gchar *content_type = NULL;
 
        if (!mimeview->opened) return;
        if (!mimeview->file) return;
@@ -1256,13 +1258,18 @@ static void mimeview_open_with(MimeView *mimeview)
                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);