2004-11-09 [colin] 0.9.12cvs144.1
authorColin Leroy <colin@colino.net>
Tue, 9 Nov 2004 15:26:36 +0000 (15:26 +0000)
committerColin Leroy <colin@colino.net>
Tue, 9 Nov 2004 15:26:36 +0000 (15:26 +0000)
* ChangeLog.claws
* src/compose.c
* src/folder.c
* src/folder_item_prefs.c
* src/prefs_account.c
* src/prefs_account.h
* src/plugins/pgpmime/pgpmime.c
Sync with HEAD

ChangeLog-gtk2.claws
ChangeLog.claws
PATCHSETS
configure.ac
src/compose.c
src/folder.c
src/folder_item_prefs.c
src/plugins/pgpmime/pgpmime.c
src/prefs_account.c
src/prefs_account.h

index 709fa22..cd21073 100644 (file)
@@ -1,3 +1,14 @@
+2004-11-09 [colin]     0.9.12cvs144.1
+
+       * ChangeLog.claws
+       * src/compose.c
+       * src/folder.c
+       * src/folder_item_prefs.c
+       * src/prefs_account.c
+       * src/prefs_account.h
+       * src/plugins/pgpmime/pgpmime.c
+               Sync with HEAD
+
 2004-11-08 [colin]     0.9.12cvs143.1
 
        * src/summaryview.c
index e866257..74760d4 100644 (file)
@@ -1,3 +1,28 @@
+2004-11-09 [christoph] 0.9.12cvs144
+
+       * src/compose.c
+       * src/prefs_account.[ch]
+               add option menu to select default privacy system
+
+       * src/plugins/pgpmime/pgpmime.c
+               better memory allocation
+
+       * src/folder.c
+               syncronize flags when scanning a folder
+
+2004-11-08 [colin]     0.9.12cvs143
+
+       * src/summaryview.c
+               Prevent useless folder count updates while 
+               quicksearch is running. It is really annoying 
+               while quicksearch is running a full-mail
+               scan, like 'b foo', in a big folder.
+
+2004-11-08 [colin]     0.9.12cvs142
+
+       * src/textview.c
+               Really fix these mail URIs
+
 2004-11-08 [colin]     0.9.12cvs141
 
        * src/textview.c
index 42cb288..143b4bd 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.96.2.29 -r 1.96.2.30 src/textview.c; ) > 0.9.12cvs142.1.patchset
 ( cvs diff -u -r 1.382.2.60 -r 1.382.2.61 src/compose.c; ) > 0.9.12cvs142.2.patchset
 ( cvs diff -u -r 1.395.2.37 -r 1.395.2.38 src/summaryview.c; ) > 0.9.12cvs143.1.patchset
+( cvs diff -u -r 1.2504.2.30 -r 1.2504.2.31 ChangeLog.claws; cvs diff -u -r 1.382.2.61 -r 1.382.2.62 src/compose.c; cvs diff -u -r 1.213.2.19 -r 1.213.2.20 src/folder.c; cvs diff -u -r 1.2.2.3 -r 1.2.2.4 src/folder_item_prefs.c; cvs diff -u -r 1.105.2.10 -r 1.105.2.11 src/prefs_account.c; cvs diff -u -r 1.49.2.5 -r 1.49.2.6 src/prefs_account.h; cvs diff -u -r 1.1.2.8 -r 1.1.2.9 src/plugins/pgpmime/pgpmime.c; ) > 0.9.12cvs144.1.patchset
index ade3671..73e6fb8 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=9
 MICRO_VERSION=12
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=143
+EXTRA_VERSION=144
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=.1
 
index 37511f2..73e6d09 100644 (file)
@@ -6971,12 +6971,8 @@ static void compose_toggle_encrypt_cb(gpointer data, guint action,
 
 static void activate_privacy_system(Compose *compose, PrefsAccount *account) 
 {
-       /* TODO
-       if (account->default_gnupg_mode)
-               compose->gnupg_mode = GNUPG_MODE_INLINE;
-       else
-               compose->gnupg_mode = GNUPG_MODE_DETACH;
-       */              
+       g_free(compose->privacy_system);
+       compose->privacy_system = g_strdup(account->default_privacy_system);
        compose_update_privacy_system_menu_item(compose);
 }
 
index d45cff3..f50b6d7 100644 (file)
@@ -1526,6 +1526,50 @@ static MsgInfo *get_msginfo(FolderItem *item, guint num)
        return msginfo;
 }
 
+static gint syncronize_flags(FolderItem *item, MsgInfoList *msglist)
+{
+       GRelation *relation;
+       gint ret = 0;
+       GSList *cur;
+
+       if(msglist == NULL)
+               return 0;
+       if(item->folder->klass->get_flags == NULL)
+               return 0;
+
+       relation = g_relation_new(2);
+       g_relation_index(relation, 0, g_direct_hash, g_direct_equal);
+       if ((ret = item->folder->klass->get_flags(
+           item->folder, item, msglist, relation)) == 0) {
+               GTuples *tuples;
+               MsgInfo *msginfo;
+               MsgPermFlags permflags;
+               gboolean skip;
+
+               for (cur = msglist; cur != NULL; cur = g_slist_next(cur)) {
+                       msginfo = (MsgInfo *) cur->data;
+               
+                       tuples = g_relation_select(relation, msginfo, 0);
+                       skip = tuples->len < 1;
+                       if (!skip)
+                               permflags = GPOINTER_TO_INT(g_tuples_index(tuples, 0, 1));
+                       g_tuples_destroy(tuples);
+                       if (skip)
+                               continue;
+                       
+                       if (msginfo->flags.perm_flags != permflags) {
+                               procmsg_msginfo_set_flags(msginfo,
+                                       permflags & ~msginfo->flags.perm_flags, 0);
+                               procmsg_msginfo_unset_flags(msginfo,
+                                       ~permflags & msginfo->flags.perm_flags, 0);
+                       }
+               }
+       }
+       g_relation_destroy(relation);   
+
+       return ret;
+}
+
 gint folder_item_scan_full(FolderItem *item, gboolean filtering)
 {
        Folder *folder;
@@ -1704,6 +1748,8 @@ gint folder_item_scan_full(FolderItem *item, gboolean filtering)
                g_slist_free(new_list);
        }
 
+       syncronize_flags(item, exists_list);
+
        folder_item_update_freeze();
        if (newmsg_list != NULL) {
                GSList *elem;
@@ -1767,60 +1813,6 @@ gint folder_item_scan_full(FolderItem *item, gboolean filtering)
        return 0;
 }
 
-gint folder_item_syncronize_flags(FolderItem *item)
-{
-       MsgInfoList *msglist = NULL;
-       GSList *cur;
-       GRelation *relation;
-       gint ret = 0;
-       
-       g_return_val_if_fail(item != NULL, -1);
-       g_return_val_if_fail(item->folder != NULL, -1);
-       g_return_val_if_fail(item->folder->klass != NULL, -1);
-       if(item->folder->klass->get_flags == NULL)
-               return 0;
-       
-       if (item->cache == NULL)
-               folder_item_read_cache(item);
-       
-       msglist = msgcache_get_msg_list(item->cache);
-       
-       relation = g_relation_new(2);
-       g_relation_index(relation, 0, g_direct_hash, g_direct_equal);
-       if ((ret = item->folder->klass->get_flags(
-           item->folder, item, msglist, relation)) == 0) {
-               GTuples *tuples;
-               MsgInfo *msginfo;
-               MsgPermFlags permflags;
-               gboolean skip;
-
-               for (cur = msglist; cur != NULL; cur = g_slist_next(cur)) {
-                       msginfo = (MsgInfo *) cur->data;
-               
-                       tuples = g_relation_select(relation, msginfo, 0);
-                       skip = tuples->len < 1;
-                       if (!skip)
-                               permflags = GPOINTER_TO_INT(g_tuples_index(tuples, 0, 1));
-                       g_tuples_destroy(tuples);
-                       if (skip)
-                               continue;
-                       
-                       if (msginfo->flags.perm_flags != permflags) {
-                               procmsg_msginfo_set_flags(msginfo,
-                                       permflags & ~msginfo->flags.perm_flags, 0);
-                               procmsg_msginfo_unset_flags(msginfo,
-                                       ~permflags & msginfo->flags.perm_flags, 0);
-                       }
-               }
-       }
-       g_relation_destroy(relation);
-       
-       for (cur = msglist; cur != NULL; cur = g_slist_next(cur))
-               procmsg_msginfo_free((MsgInfo *) cur->data);
-       
-       return ret;
-}
-
 gint folder_item_scan(FolderItem *item)
 {
        return folder_item_scan_full(item, TRUE);
@@ -1862,6 +1854,29 @@ void folder_count_total_cache_memusage(FolderItem *item, gpointer data)
        *memusage += msgcache_get_memory_usage(item->cache);
 }
 
+gint folder_item_syncronize_flags(FolderItem *item)
+{
+       MsgInfoList *msglist = NULL;
+       GSList *cur;
+       gint ret = 0;
+       
+       g_return_val_if_fail(item != NULL, -1);
+       g_return_val_if_fail(item->folder != NULL, -1);
+       g_return_val_if_fail(item->folder->klass != NULL, -1);
+       
+       if (item->cache == NULL)
+               folder_item_read_cache(item);
+       
+       msglist = msgcache_get_msg_list(item->cache);
+       
+       ret = syncronize_flags(item, msglist);
+
+       for (cur = msglist; cur != NULL; cur = g_slist_next(cur))
+               procmsg_msginfo_free((MsgInfo *) cur->data);
+       
+       return ret;
+}
+
 gint folder_cache_time_compare_func(gconstpointer a, gconstpointer b)
 {
        FolderItem *fa = (FolderItem *)a;
index 9d99647..054e11e 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2001 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2004 Hiroyuki Yamamoto and the Sylpheed-Claws team
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
index 4a213de..d027c75 100644 (file)
@@ -472,7 +472,8 @@ gboolean pgpmime_sign(MimeInfo *mimeinfo)
        newinfo->type = MIMETYPE_APPLICATION;
        newinfo->subtype = g_strdup("pgp-signature");
        newinfo->content = MIMECONTENT_MEM;
-       newinfo->data.mem = g_memdup(sigcontent, len + 1);
+       newinfo->data.mem = g_malloc(len + 1);
+       g_memmove(newinfo->data.mem, sigcontent, len);
        newinfo->data.mem[len] = '\0';
        g_node_append(sigmultipart->node, newinfo->node);
 
@@ -565,7 +566,8 @@ gboolean pgpmime_encrypt(MimeInfo *mimeinfo, const gchar *encrypt_data)
        newinfo->type = MIMETYPE_APPLICATION;
        newinfo->subtype = g_strdup("octet-stream");
        newinfo->content = MIMECONTENT_MEM;
-       newinfo->data.mem = g_memdup(enccontent, len + 1);
+       newinfo->data.mem = g_malloc(len);
+       g_memmove(newinfo->data.mem, enccontent, len);
        newinfo->data.mem[len] = '\0';
        g_node_append(encmultipart->node, newinfo->node);
 
index fa622b7..e131bfb 100644 (file)
@@ -136,6 +136,7 @@ static struct Compose {
 } compose;
 
 static struct Privacy {
+       GtkWidget *default_privacy_system;
        GtkWidget *default_encrypt_chkbtn;
        GtkWidget *default_sign_chkbtn;
 } privacy;
@@ -201,6 +202,9 @@ static void prefs_account_protocol_set_data_from_optmenu(PrefParam *pparam);
 static void prefs_account_protocol_set_optmenu         (PrefParam *pparam);
 static void prefs_account_protocol_activated           (GtkMenuItem *menuitem);
 
+static void prefs_account_set_string_from_optmenu      (PrefParam *pparam);
+static void prefs_account_set_optmenu_from_string      (PrefParam *pparam);
+
 static void prefs_account_imap_auth_type_set_data_from_optmenu
                                                        (PrefParam *pparam);
 static void prefs_account_imap_auth_type_set_optmenu   (PrefParam *pparam);
@@ -391,6 +395,9 @@ static PrefParam param[] = {
         prefs_set_data_from_entry, prefs_set_entry},
 
        /* Privacy */
+       {"default_privacy_system", "", &tmp_ac_prefs.default_privacy_system, P_STRING,
+        &privacy.default_privacy_system,
+        prefs_account_set_string_from_optmenu, prefs_account_set_optmenu_from_string},
        {"default_encrypt", "FALSE", &tmp_ac_prefs.default_encrypt, P_BOOL,
         &privacy.default_encrypt_chkbtn,
         prefs_set_data_from_toggle, prefs_set_toggle},
@@ -629,6 +636,32 @@ static gint prefs_account_get_new_id(void)
        return last_id + 1;
 }
 
+void update_privacy_system_menu() {
+       GtkWidget *menu;
+       GtkWidget *menuitem;
+       GSList *system_ids, *cur;
+
+       menu = gtk_menu_new();
+       menuitem = gtk_menu_item_new_with_label(_("None"));
+       gtk_widget_show(menuitem);
+       g_object_set_data(G_OBJECT(menuitem), MENU_VAL_ID, "");
+       gtk_menu_append(GTK_MENU(menu), menuitem);
+
+       system_ids = privacy_get_system_ids();
+       for (cur = system_ids; cur != NULL; cur = g_slist_next(cur)) {
+               gchar *id = (gchar *) cur->data;
+               const gchar *name;
+               
+               name = privacy_system_get_name(id);
+               menuitem = gtk_menu_item_new_with_label(name);
+               gtk_widget_show(menuitem);
+               g_object_set_data_full(G_OBJECT(menuitem), MENU_VAL_ID, id, g_free);
+               gtk_menu_append(GTK_MENU(menu), menuitem);
+       }
+
+       gtk_option_menu_set_menu(GTK_OPTION_MENU(privacy.default_privacy_system), menu);
+}
+
 PrefsAccount *prefs_account_open(PrefsAccount *ac_prefs)
 {
        gboolean new_account = FALSE;
@@ -657,6 +690,8 @@ PrefsAccount *prefs_account_open(PrefsAccount *ac_prefs)
 
        tmp_ac_prefs = *ac_prefs;
 
+       update_privacy_system_menu();
+
        if (new_account) {
                PrefsAccount *def_ac;
                gchar *buf;
@@ -1634,6 +1669,9 @@ static void prefs_account_privacy_create(void)
 {
        GtkWidget *vbox1;
        GtkWidget *vbox2;
+       GtkWidget *hbox1;
+       GtkWidget *label;
+       GtkWidget *default_privacy_system;
        GtkWidget *default_encrypt_chkbtn;
        GtkWidget *default_sign_chkbtn;
 
@@ -1646,11 +1684,24 @@ static void prefs_account_privacy_create(void)
        gtk_widget_show (vbox2);
        gtk_box_pack_start (GTK_BOX (vbox1), vbox2, FALSE, FALSE, 0);
 
+       hbox1 = gtk_hbox_new(FALSE, 8);
+       gtk_widget_show (hbox1);
+       gtk_container_add (GTK_CONTAINER(vbox2), hbox1);
+
+       label = gtk_label_new(_("Default privacy system"));
+       gtk_widget_show(label);
+       gtk_box_pack_start (GTK_BOX (hbox1), label, FALSE, FALSE, 0);
+
+       default_privacy_system = gtk_option_menu_new();
+       gtk_widget_show (default_privacy_system);
+       gtk_box_pack_start (GTK_BOX(hbox1), default_privacy_system, TRUE, TRUE, 0);
+
        PACK_CHECK_BUTTON (vbox2, default_encrypt_chkbtn,
                           _("Encrypt message by default"));
        PACK_CHECK_BUTTON (vbox2, default_sign_chkbtn,
                           _("Sign message by default"));
                            
+       privacy.default_privacy_system = default_privacy_system;
        privacy.default_encrypt_chkbtn = default_encrypt_chkbtn;
        privacy.default_sign_chkbtn    = default_sign_chkbtn;
 }
@@ -2363,6 +2414,71 @@ static void prefs_account_smtp_auth_type_set_optmenu(PrefParam *pparam)
        gtk_menu_item_activate(GTK_MENU_ITEM(menuitem));
 }
 
+static void prefs_account_set_string_from_optmenu(PrefParam *pparam)
+{
+       GtkWidget *menu;
+       GtkWidget *menuitem;
+       gchar **str;
+
+       g_return_if_fail(*pparam->widget != NULL);
+
+       menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(*pparam->widget));
+       menuitem = gtk_menu_get_active(GTK_MENU(menu));
+       if (menuitem == NULL)
+               return;
+
+       str = (gchar **) pparam->data;
+        g_free(*str);
+       *str = g_strdup(g_object_get_data(G_OBJECT(menuitem), MENU_VAL_ID));
+}
+
+static void prefs_account_set_optmenu_from_string(PrefParam *pparam)
+{
+       GtkWidget *optionmenu;
+       GtkWidget *menu;
+       gboolean found = FALSE;
+       GList *children, *cur;
+       gchar *prefsid;
+       guint i = 0;
+
+       g_return_if_fail(*pparam->widget != NULL);
+
+       prefsid = *((gchar **) pparam->data);
+       if (prefsid == NULL)
+               return;
+
+       optionmenu = *pparam->widget;
+       menu = gtk_option_menu_get_menu(GTK_OPTION_MENU(optionmenu));
+       children = gtk_container_children(GTK_CONTAINER(menu));
+       for (cur = children; cur != NULL; cur = g_list_next(cur)) {
+               GtkWidget *item = (GtkWidget *) cur->data;
+               gchar *id;
+
+               id = g_object_get_data(G_OBJECT(item), MENU_VAL_ID);
+               if (id != NULL && strcmp(id, prefsid) == 0) {
+                       found = TRUE;
+                       gtk_option_menu_set_history(GTK_OPTION_MENU(optionmenu), i);
+               }
+               i++;
+       }
+
+       if (!found) {
+               gchar *name;
+               GtkWidget *menuitem;
+
+               name = g_strdup_printf(_("Unsupported (%s)"), prefsid);
+               menuitem = gtk_menu_item_new_with_label(name);
+               gtk_widget_show(menuitem);
+               g_object_set_data_full(G_OBJECT(menuitem), MENU_VAL_ID, g_strdup(prefsid), g_free);
+               gtk_menu_append(GTK_MENU(menu), menuitem);
+               g_free(name);
+
+               gtk_option_menu_set_history(GTK_OPTION_MENU(optionmenu), i);
+       }
+
+       g_list_free(children);
+}
+
 static void prefs_account_protocol_activated(GtkMenuItem *menuitem)
 {
        RecvProtocol protocol;
index 3a6cd32..09d09a6 100644 (file)
@@ -127,8 +127,9 @@ struct _PrefsAccount
        gchar    *auto_replyto;
 
        /* Privacy */
-       gboolean default_encrypt;
-       gboolean default_sign;
+       gchar    *default_privacy_system;
+       gboolean  default_encrypt;
+       gboolean  default_sign;
 
        /* Advanced */
        gboolean  set_smtpport;