2006-08-16 [colin] 2.4.0cvs54
authorColin Leroy <colin@colino.net>
Wed, 16 Aug 2006 16:24:00 +0000 (16:24 +0000)
committerColin Leroy <colin@colino.net>
Wed, 16 Aug 2006 16:24:00 +0000 (16:24 +0000)
* src/compose.c
* src/main.c
* src/mainwindow.c
Fix send button sensitivity at startup
Set send menu sensitivity (patch by Fabien)
* src/ssl_manager.c
Enable closing with esc (patch by Fabien)
* src/gtk/foldersort.c
Enable closing with esc (patch by Fabien)
* src/procmime.c
Optimisation (no need to copy to tempfile to
"decode" 7bit and 8bit)
* src/summaryview.c
Fix cruft in swap_from case
* src/textview.c
Fix missing last line in some mail cases
(Fixes debian #381872)
* src/plugins/pgpcore/prefs_gpg.c
* src/plugins/pgpcore/sgpgme.c
* src/plugins/pgpcore/sgpgme.h
Don't show "no key found" when user explicitely
wants to create a key

15 files changed:
ChangeLog
PATCHSETS
configure.ac
src/compose.c
src/gtk/foldersort.c
src/main.c
src/mainwindow.c
src/plugins/pgpcore/prefs_gpg.c
src/plugins/pgpcore/sgpgme.c
src/plugins/pgpcore/sgpgme.h
src/procmime.c
src/ssl_manager.c
src/summaryview.c
src/textview.c
src/toolbar.c

index c4672ea63b4e75f6c70aa4e7ffc0bb4d930ec62f..6847f6fe3a95b1e104ae2bd51e0fdb480e9fbef1 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,28 @@
+2006-08-16 [colin]     2.4.0cvs54
+
+       * src/compose.c
+       * src/main.c
+       * src/mainwindow.c
+               Fix send button sensitivity at startup
+               Set send menu sensitivity (patch by Fabien)
+       * src/ssl_manager.c
+               Enable closing with esc (patch by Fabien)
+       * src/gtk/foldersort.c
+               Enable closing with esc (patch by Fabien)
+       * src/procmime.c
+               Optimisation (no need to copy to tempfile to
+               "decode" 7bit and 8bit)
+       * src/summaryview.c
+               Fix cruft in swap_from case
+       * src/textview.c
+               Fix missing last line in some mail cases 
+               (Fixes debian #381872)
+       * src/plugins/pgpcore/prefs_gpg.c
+       * src/plugins/pgpcore/sgpgme.c
+       * src/plugins/pgpcore/sgpgme.h
+               Don't show "no key found" when user explicitely
+               wants to create a key
+
 2006-08-16 [paul]      2.4.0cvs53
 
        * configure.ac
index 4e5c30fc01dffa88952f6f28ccb40772e228061c..01ea49f68f77a4a5eff2cbbf2f83104f55821aad 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.1.2.10 -r 1.1.2.11 src/plugins/pgpcore/prefs_gpg.c;  cvs diff -u -r 1.1.2.24 -r 1.1.2.25 src/plugins/pgpcore/sgpgme.c;  ) > 2.4.0cvs51.patchset
 ( cvs diff -u -r 1.43.2.49 -r 1.43.2.50 src/toolbar.c;  ) > 2.4.0cvs52.patchset
 ( cvs diff -u -r 1.654.2.1791 -r 1.654.2.1792 configure.ac;  cvs diff -u -r 1.61.2.49 -r 1.61.2.50 src/account.c;  cvs diff -u -r 1.60.2.60 -r 1.60.2.61 src/addressbook.c;  cvs diff -u -r 1.8.2.16 -r 1.8.2.17 src/headerview.c;  cvs diff -u -r 1.105.2.65 -r 1.105.2.66 src/prefs_account.c;  cvs diff -u -r 1.1.2.14 -r 1.1.2.15 src/prefs_message.c;  cvs diff -u -r 1.5.2.36 -r 1.5.2.37 src/gtk/gtkutils.c;  ) > 2.4.0cvs53.patchset
+( cvs diff -u -r 1.382.2.300 -r 1.382.2.301 src/compose.c;  cvs diff -u -r 1.115.2.102 -r 1.115.2.103 src/main.c;  cvs diff -u -r 1.274.2.137 -r 1.274.2.138 src/mainwindow.c;  cvs diff -u -r 1.49.2.79 -r 1.49.2.80 src/procmime.c;  cvs diff -u -r 1.3.2.19 -r 1.3.2.20 src/ssl_manager.c;  cvs diff -u -r 1.395.2.229 -r 1.395.2.230 src/summaryview.c;  cvs diff -u -r 1.96.2.136 -r 1.96.2.137 src/textview.c;  cvs diff -u -r 1.43.2.50 -r 1.43.2.51 src/toolbar.c;  cvs diff -u -r 1.1.2.10 -r 1.1.2.11 src/gtk/foldersort.c;  cvs diff -u -r 1.1.2.11 -r 1.1.2.12 src/plugins/pgpcore/prefs_gpg.c;  cvs diff -u -r 1.1.2.25 -r 1.1.2.26 src/plugins/pgpcore/sgpgme.c;  cvs diff -u -r 1.1.2.5 -r 1.1.2.6 src/plugins/pgpcore/sgpgme.h;  ) > 2.4.0cvs54.patchset
index 837a92012910fe660797e9f5f72d7357e254702a..8c7bc4ec47acc9c81e8bdf1a70240f5e68ac4075 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=4
 MICRO_VERSION=0
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=53
+EXTRA_VERSION=54
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index 728ec990418388f133e3347002e9eadef53ee732..b584fc2ae7cec3c3ebb27a77384b86b6ca577108 100644 (file)
@@ -4059,6 +4059,8 @@ gint compose_send(Compose *compose)
        gchar *msgpath = NULL;
        gboolean discard_window = FALSE;
        gchar *errstr = NULL;
+       MainWindow *mainwin = mainwindow_get_mainwindow();
+
        if (prefs_common.send_dialog_mode != SEND_DIALOG_ALWAYS
                        || compose->batch == TRUE)
                discard_window = TRUE;
@@ -4153,14 +4155,16 @@ gint compose_send(Compose *compose)
                return -1;
        }
 
-       toolbar_main_set_sensitive(mainwindow_get_mainwindow());
+       toolbar_main_set_sensitive(mainwin);
+       main_window_set_menu_sensitive(mainwin);
        return 0;
 
 bail:
        compose_allow_user_actions (compose, TRUE);
        compose->sending = FALSE;
        compose->modified = TRUE; 
-       toolbar_main_set_sensitive(mainwindow_get_mainwindow());
+       toolbar_main_set_sensitive(mainwin);
+       main_window_set_menu_sensitive(mainwin);
 
        return -1;
 }
index 53866ffe80ac9b1c266a9b88ba12a7c17b926b97..2d1083bd9529a0d5de847f356dfa012c2fc96340 100644 (file)
@@ -21,6 +21,7 @@
 
 #include <glib.h>
 #include <glib/gi18n.h>
+#include <gdk/gdkkeysyms.h>
 
 #include "foldersort.h"
 #include "inc.h"
@@ -114,6 +115,19 @@ static void row_moved(GtkCList *clist, gint srcpos, gint destpos, FolderSortDial
                set_selected(dialog, dialog->selected + 1);
 }
 
+static gint delete_event(GtkWidget *widget, GdkEventAny *event, FolderSortDialog *dialog)
+{
+       destroy_dialog(dialog);
+       return TRUE;
+}
+
+static gboolean key_pressed(GtkWidget *widget, GdkEventKey *event, FolderSortDialog *dialog)
+{
+       if (event && event->keyval == GDK_Escape)
+               destroy_dialog(dialog);
+       return FALSE;
+}
+
 void foldersort_open()
 {
        FolderSortDialog *dialog = g_new0(FolderSortDialog, 1);
@@ -138,10 +152,14 @@ void foldersort_open()
        window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
        g_object_set_data(G_OBJECT(window), "window", window);
        gtk_container_set_border_width(GTK_CONTAINER(window), 8);
-       gtk_window_set_title(GTK_WINDOW(window),
-                            _("Set folder order"));
+       gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
+       gtk_window_set_title(GTK_WINDOW(window), _("Set folder order"));
        gtk_window_set_modal(GTK_WINDOW(window), TRUE);
        gtk_window_set_default_size(GTK_WINDOW(window), 400, 300);
+       g_signal_connect(G_OBJECT(window), "delete_event",
+                        G_CALLBACK(delete_event), dialog);
+       g_signal_connect(G_OBJECT(window), "key_press_event",
+                        G_CALLBACK(key_pressed), dialog);
 
        vbox = gtk_vbox_new(FALSE, 6);
        gtk_widget_show(vbox);
index c50425127ac3c5fcab2b61d33a756cf792b86983..089739a022d8a06eefa966bb547d3c37b599e9c8 100644 (file)
@@ -499,6 +499,10 @@ int main(int argc, char *argv[])
                        exit_sylpheed(mainwin);
        }
 
+       
+       toolbar_main_set_sensitive(mainwin);
+       main_window_set_menu_sensitive(mainwin);
+
        main_window_popup(mainwin);
 
 #ifdef HAVE_LIBETPAN
index cd62b9cc0e1d0ecf5b95cfe26a5ee4fa859b7cd8..8c27cc4674ba3337808a98093a5fabadc2fcf7e8 100644 (file)
@@ -2159,7 +2159,7 @@ void main_window_set_menu_sensitive(MainWindow *mainwin)
                                                 , M_HAVE_ACCOUNT|M_UNLOCKED},
                {"/Message/Receive/Cancel receiving"
                                                 , M_INC_ACTIVE},
-
+               {"/Message/Send queued messages"  , M_HAVE_ACCOUNT|M_HAVE_QUEUED_MAILS},
                {"/Message/Compose a news message", M_HAVE_NEWS_ACCOUNT},
                {"/Message/Reply"                 , M_HAVE_ACCOUNT|M_TARGET_EXIST},
                {"/Message/Reply to"              , M_HAVE_ACCOUNT|M_TARGET_EXIST},
index 6aea605cd1f40759d5578450e6e1a915dbdd06b1..29a7d247bc076b1fb63dab8505335ef569c20441 100644 (file)
@@ -239,7 +239,7 @@ static void prefs_gpg_update_sens(struct GPGAccountPage *page)
 static void new_key_clicked(GtkWidget *widget, gpointer user_data)
 {
        struct GPGAccountPage *page = (struct GPGAccountPage *) user_data;
-       sgpgme_create_secret_key(page->account);
+       sgpgme_create_secret_key(page->account, FALSE);
        prefs_gpg_update_sens(page);
 }
 
index 53c77833ac88ef00edebc26097ee1511169c50aa..aa87085c90986c5fb9ef19dfc8259f428db588ef 100644 (file)
@@ -579,14 +579,9 @@ void sgpgme_done()
         gpgmegtk_free_passphrase();
 }
 
-void sgpgme_create_secret_key(PrefsAccount *account)
+void sgpgme_create_secret_key(PrefsAccount *account, gboolean ask_create)
 {
-       AlertValue val = alertpanel(_("No PGP key found"),
-                       _("Sylpheed-Claws did not find a secret PGP key, "
-                         "which means that you won't be able to sign "
-                         "emails or receive encrypted emails.\n"
-                         "Do you want to create a secret key now?"),
-                         GTK_STOCK_NO, "+" GTK_STOCK_YES, NULL);
+       AlertValue val = G_ALERTDEFAULT;
        gchar *key_parms = NULL;
        gchar *name = NULL;
        gchar *email = NULL;
@@ -601,10 +596,18 @@ void sgpgme_create_secret_key(PrefsAccount *account)
        if (account == NULL)
                account = account_get_default();
 
-       if (val == G_ALERTDEFAULT) {
-               prefs_gpg_get_config()->gpg_ask_create_key = FALSE;
-               prefs_gpg_save_config();
-               return;
+       if (ask_create) {
+               val = alertpanel(_("No PGP key found"),
+                               _("Sylpheed-Claws did not find a secret PGP key, "
+                                 "which means that you won't be able to sign "
+                                 "emails or receive encrypted emails.\n"
+                                 "Do you want to create a secret key now?"),
+                                 GTK_STOCK_NO, "+" GTK_STOCK_YES, NULL);
+               if (val == G_ALERTDEFAULT) {
+                       prefs_gpg_get_config()->gpg_ask_create_key = FALSE;
+                       prefs_gpg_save_config();
+                       return;
+               }
        }
 
        if (account->name) {
@@ -725,7 +728,7 @@ void sgpgme_check_create_key(void)
 {
        if (prefs_gpg_get_config()->gpg_ask_create_key &&
            !sgpgme_has_secret_key()) {
-               sgpgme_create_secret_key(NULL);
+               sgpgme_create_secret_key(NULL, TRUE);
        } else {
                prefs_gpg_get_config()->gpg_ask_create_key = FALSE;
                prefs_gpg_save_config();
index 1e1769d07ba8ff320d003d8bae992f62a21f356e..1e51351cde4ed6d2b63809bc4a630dac91aa6365 100644 (file)
@@ -47,5 +47,5 @@ gchar *sgpgme_get_encrypt_data                (GSList *recp_names,
 gboolean sgpgme_setup_signers(gpgme_ctx_t ctx, PrefsAccount *account);
 void sgpgme_check_create_key(void);
 gboolean sgpgme_has_secret_key(void);
-void sgpgme_create_secret_key(PrefsAccount *account);
+void sgpgme_create_secret_key(PrefsAccount *account, gboolean ask_create);
 #endif /* SGPGME_H */
index ac4e8537a78063bcb464d19ddc7862cfa108b549..3e64f262826ab66637079255898096191d8c3f8c 100644 (file)
@@ -243,7 +243,9 @@ gboolean procmime_decode_content(MimeInfo *mimeinfo)
        g_return_val_if_fail(mimeinfo != NULL, FALSE);
 
        if (encoding == ENC_UNKNOWN ||
-           encoding == ENC_BINARY)
+           encoding == ENC_BINARY ||
+           encoding == ENC_7BIT ||
+           encoding == ENC_8BIT)
                return TRUE;
 
        infp = g_fopen(mimeinfo->data.filename, "rb");
index b7143edd1e99fa4842a624e4b55cae314bf10520..c80d80350fbf497b602ff1264a652bccf0f4b136 100644 (file)
@@ -25,6 +25,7 @@
 #include <gtk/gtkwidget.h>
 #include <glib.h>
 #include <glib/gi18n.h>
+#include <gdk/gdkkeysyms.h>
 #include <sys/types.h>
 #include <dirent.h>
 
@@ -60,6 +61,8 @@ static struct SSLManager
 static void ssl_manager_view_cb                (GtkWidget *widget, gpointer data);
 static void ssl_manager_delete_cb      (GtkWidget *widget, gpointer data);
 static void ssl_manager_close_cb       (GtkWidget *widget, gpointer data);
+static gboolean key_pressed            (GtkWidget *widget, GdkEventKey *event,
+                                        gpointer data);
 static void ssl_manager_load_certs     (void);
 static void ssl_manager_double_clicked(GtkTreeView             *list_view,
                                        GtkTreePath             *path,
@@ -158,6 +161,8 @@ void ssl_manager_create(void)
        gtk_window_set_resizable(GTK_WINDOW (window), TRUE);
        g_signal_connect(G_OBJECT(window), "delete_event",
                         G_CALLBACK(ssl_manager_close_cb), NULL);
+       g_signal_connect(G_OBJECT(window), "key_press_event",
+                        G_CALLBACK(key_pressed), NULL);
        MANAGE_WINDOW_SIGNALS_CONNECT (window);
 
        hbox1 = gtk_hbox_new(FALSE, 6);
@@ -326,6 +331,13 @@ static void ssl_manager_close_cb(GtkWidget *widget,
        ssl_manager_close();
 }
 
+static gboolean key_pressed(GtkWidget *widget, GdkEventKey *event, gpointer data)
+{
+       if (event && event->keyval == GDK_Escape)
+               ssl_manager_close();
+       return FALSE;
+}
+
 static void ssl_manager_double_clicked(GtkTreeView             *list_view,
                                        GtkTreePath             *path,
                                        GtkTreeViewColumn       *column,
index 5ca48f1089c82e916dbad03643997991684c6373..832332c4562ce834a711b017365937d2618b6cf0 100644 (file)
@@ -180,8 +180,7 @@ static void summary_set_ctree_from_list     (SummaryView            *summaryview,
                                         GSList                 *mlist);
 static void summary_set_header         (SummaryView            *summaryview,
                                         gchar                  *text[],
-                                        MsgInfo                *msginfo,
-                                        gboolean               *free_from);
+                                        MsgInfo                *msginfo);
 static void summary_display_msg                (SummaryView            *summaryview,
                                         GtkCTreeNode           *row);
 static void summary_display_msg_full   (SummaryView            *summaryview,
@@ -2394,9 +2393,8 @@ gboolean summary_insert_gnode_func(GtkCTree *ctree, guint depth, GNode *gnode,
        gint *col_pos = summaryview->col_pos;
        const gchar *msgid = msginfo->msgid;
        GHashTable *msgid_table = summaryview->msgid_table;
-       gboolean free_from = FALSE;
        
-       summary_set_header(summaryview, text, msginfo, &free_from);
+       summary_set_header(summaryview, text, msginfo);
 
        gtk_sctree_set_node_info(ctree, cnode, text[col_pos[S_COL_SUBJECT]], 2,
                                NULL, NULL, NULL, NULL, FALSE, summaryview->threaded && !summaryview->thread_collapsed);
@@ -2418,11 +2416,6 @@ gboolean summary_insert_gnode_func(GtkCTree *ctree, guint depth, GNode *gnode,
        if (summaryview->col_state[summaryview->col_pos[S_COL_TO]].visible)
                SET_TEXT(S_COL_TO);
 
-       if (free_from) {
-               g_free(text[col_pos[S_COL_FROM]]);
-               text[col_pos[S_COL_FROM]] = NULL;
-       }
-
 #undef SET_TEXT
 
        GTKUT_CTREE_NODE_SET_ROW_DATA(cnode, msginfo);
@@ -2480,23 +2473,19 @@ static void summary_set_ctree_from_list(SummaryView *summaryview,
                END_TIMING();
        } else {
                gchar *text[N_SUMMARY_COLS];
-               gboolean free_from = FALSE;
                gint *col_pos = summaryview->col_pos;
                START_TIMING("summaryview_set_ctree_from_list(2)");
                cur = mlist;
                for (; mlist != NULL; mlist = mlist->next) {
                        msginfo = (MsgInfo *)mlist->data;
 
-                       summary_set_header(summaryview, text, msginfo, &free_from);
+                       summary_set_header(summaryview, text, msginfo);
 
                        node = gtk_sctree_insert_node
                                (ctree, NULL, node, text, 2,
                                 NULL, NULL, NULL, NULL,
                                 FALSE, FALSE);
-                       if (free_from) {
-                               g_free(text[col_pos[S_COL_FROM]]);
-                               text[col_pos[S_COL_FROM]] = NULL;
-                       }
+
                        GTKUT_CTREE_NODE_SET_ROW_DATA(node, msginfo);
                        summary_set_marks_func(ctree, node, summaryview);
 
@@ -2582,7 +2571,7 @@ static gchar *summary_complete_address(const gchar *addr)
 }
 
 static void summary_set_header(SummaryView *summaryview, gchar *text[],
-                              MsgInfo *msginfo, gboolean *free_from)
+                              MsgInfo *msginfo)
 {
        static gchar date_modified[80];
        static gchar col_score[11];
@@ -2668,12 +2657,11 @@ static void summary_set_header(SummaryView *summaryview, gchar *text[],
        text[col_pos[S_COL_TO]] = to_text;
        if (!should_swap) {
                text[col_pos[S_COL_FROM]] = from_text;
-               *free_from = FALSE;
        } else {
-               gchar *tmp = NULL;
-               tmp = g_strconcat("-->", to_text, NULL);
+               gchar tmp[BUFFSIZE];
+               snprintf(tmp, BUFFSIZE-1, "--> %s", to_text);
+               tmp[BUFFSIZE-1]='\0';
                text[col_pos[S_COL_FROM]] = tmp;
-               *free_from = TRUE;
        }
        
        if (summaryview->simplify_subject_preg != NULL)
index e3c31b8adbd32348bcf232b3ba652d3178e973f5..db6a40e79f1715e637ba5e654e1a350fcb46172e 100644 (file)
@@ -953,8 +953,8 @@ textview_default:
                tmpfp = g_fopen(mimeinfo->data.filename, "rb");
                fseek(tmpfp, mimeinfo->offset, SEEK_SET);
                debug_print("Viewing text content of type: %s (length: %d)\n", mimeinfo->subtype, mimeinfo->length);
-               while ((fgets(buf, sizeof(buf), tmpfp) != NULL) && 
-                      (ftell(tmpfp) <= mimeinfo->offset + mimeinfo->length))
+               while ((ftell(tmpfp) < mimeinfo->offset + mimeinfo->length) &&
+                      (fgets(buf, sizeof(buf), tmpfp) != NULL))
                        textview_write_line(textview, buf, conv);
                fclose(tmpfp);
        }
index 2effdeb24d67b5479d9af88ae7c5789a1081626c..c078c8f34e8d6e75d65479f80a9bcb5355cbcd3d 100644 (file)
@@ -1985,6 +1985,7 @@ void toolbar_main_set_sensitive(gpointer data)
        activate_compose_button(toolbar, 
                                prefs_common.toolbar_style,
                                toolbar->compose_btn_type);
+       
 }
 
 void toolbar_comp_set_sensitive(gpointer data, gboolean sensitive)