sync with sylpheed 0.5.3cvs10
authorPaul Mangan <paul@claws-mail.org>
Wed, 29 Aug 2001 10:02:29 +0000 (10:02 +0000)
committerPaul Mangan <paul@claws-mail.org>
Wed, 29 Aug 2001 10:02:29 +0000 (10:02 +0000)
15 files changed:
ChangeLog
ChangeLog.claws
ChangeLog.jp
configure.in
po/POTFILES.in
src/Makefile.am
src/compose.c
src/prefs_filtering.c
src/send.c
src/stringtable.c [new file with mode: 0644]
src/stringtable.h [new file with mode: 0644]
src/summaryview.c
src/summaryview.h
src/xml.c
sylpheed.desktop

index 23cb8ef..03fe8c5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2001-08-29
+
+       * src/compose.c: compose_queue(): added AID: to the queueing header.
+       * src/send.c: send_message_queue(): look for AID: header, and use
+         the server specified in the account instead of SSV: header.
+
+2001-08-28
+
+       * applied the XML string table patch from Alfons Hoogervorst that
+         stores strings in a hash table and minimizes memory allocations
+         (thanks!).
+       * src/stringtable.[ch]: new.
+         removed all G and g_ prefix from type and function names since
+         they're not official GLib symbol names.
+         string_table_insert_string(): fixed a bug that might refer to an
+         invalid pointer on lookup, and also made a bit of optimization.
+
 2001-08-27
 
        * merged the color label feature from the claws branch (thanks to
@@ -7,6 +24,10 @@
        * src/summaryview.[ch]: added color label support.
        * src/procmsg.h: added color label flags to the permanent flags.
        * updated to gettext 0.10.39.
+       * src/summaryview.[ch]: put the color label menu item to ItemFactory.
+       * sylpheed.desktop: added for GNOME.
+       * configure.in: added AC_MSG_CHECKING() for some options.
+         Output the configuration results when configure is finished.
 
 2001-08-27
 
index ed9afdd..c5bd174 100644 (file)
@@ -1,3 +1,11 @@
+2001-08-29 [paul]
+
+       * configure.in
+               change to version 0.5.3claws6
+
+       * sync with sylpheed 0.5.3cvs10
+               src/stringtable.[ch]: New Files
+
 2001-08-27 [paul]
 
        * src/mainwindow.c
index f3ed995..54434e1 100644 (file)
@@ -1,3 +1,19 @@
+2001-08-29
+
+       * src/compose.c: compose_queue(): ¥­¥å¡¼¥¤¥ó¥°¥Ø¥Ã¥À¤Ë AID: ¤òÄɲá£
+       * src/send.c: send_message_queue(): AID: ¥Ø¥Ã¥À¤òõ¤·¡¢ SSV: ¤Î
+         Âå¤ï¤ê¤Ë¥¢¥«¥¦¥ó¥È¤Ç»ØÄꤵ¤ì¤¿¥µ¡¼¥Ð¤ò»ÈÍѤ¹¤ë¤è¤¦¤Ë¤·¤¿¡£
+
+2001-08-28
+
+       * Ê¸»úÎó¤ò¥Ï¥Ã¥·¥å¥Æ¡¼¥Ö¥ë¤ËÊݸ¤·¡¢¥á¥â¥ê³ÎÊݤòºÇ¾®²½¤¹¤ë Alfons
+         Hoogervorst ¤µ¤ó¤«¤é¤Î XML string table ¥Ñ¥Ã¥Á¤òŬÍÑ(thanks!)¡£
+       * src/stringtable.[ch]: ¿·µ¬¡£
+         official ¤Ê GLib ¤Î¥·¥ó¥Ü¥ë̾¤Ç¤Ï¤Ê¤¤¤¿¤á·¿¤È´Ø¿ô̾¤«¤éÁ´¤Æ¤Î
+         G ¤È g_ ¥×¥ì¥Õ¥£¥¯¥¹¤òºï½ü¡£
+         string_table_insert_string(): ¸¡º÷»þ¤Ë̵¸ú¤Ê¥Ý¥¤¥ó¥¿¤ò»²¾È¤¹¤ë
+         ²ÄǽÀ­¤Î¤¢¤Ã¤¿¥Ð¥°¤ò½¤Àµ¤·¡¢¤Þ¤¿¾¯¤·ºÇŬ²½¤·¤¿¡£
+
 2001-08-27
 
        * claws ¥Ö¥é¥ó¥Á¤«¤é¥«¥é¡¼¥é¥Ù¥ëµ¡Ç½¤ò¥Þ¡¼¥¸(Satoshi Nagayasu ¤µ¤ó
@@ -7,6 +23,11 @@
        * src/summaryview.[ch]: ¥«¥é¡¼¥é¥Ù¥ë¤ËÂбþ¡£
        * src/procmsg.h: ±Ê³¥Õ¥é¥°¤Ë¥«¥é¡¼¥é¥Ù¥ë¥Õ¥é¥°¤òÄɲá£
        * gettext 0.10.39 ¤Ë¹¹¿·¡£
+       * src/summaryview.[ch]: ¥«¥é¡¼¥é¥Ù¥ë¤Î¥á¥Ë¥å¡¼¹àÌܤò ItemFactory
+         ¤ËÃÖ¤¤¤¿¡£
+       * sylpheed.desktop: GNOME ÍѤËÄɲá£
+       * configure.in: ¤¤¤¯¤Ä¤«¤Î¥ª¥×¥·¥ç¥ó¤Ë AC_MSG_CHECKING() ¤òÄɲá£
+         configure ¤¬´°Î»¤·¤¿¤È¤­¤ËÀßÄê·ë²Ì¤ò½ÐÎϤ¹¤ë¤è¤¦¤Ë¤·¤¿¡£
 
 2001-08-27
 
index 7df8fa1..f47e689 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=5
 MICRO_VERSION=3
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws5
+EXTRA_VERSION=claws6
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl
@@ -102,31 +102,33 @@ dnl GPGME is used to support OpenPGP
 AC_ARG_ENABLE(gpgme,
        [  --enable-gpgme          Enable GnuPG support using GPGME [default=no]],
        [ac_cv_enable_gpgme=$enableval], [ac_cv_enable_gpgme=no])
+AC_MSG_CHECKING([whether to use GPGME])
 if test $ac_cv_enable_gpgme = yes; then
-       AM_PATH_GPGME(0.2.1, AC_DEFINE(USE_GPGME), [use_gpgme=no])
+       AC_MSG_RESULT(yes)
+       AM_PATH_GPGME(0.2.1, AC_DEFINE(USE_GPGME), [use_gpgme=no
+                                                   ac_cv_enable_gpgme=no])
+else
+       AC_MSG_RESULT(no)
 fi
 
-dnl Use OpenSSL for SSL connections 
-AC_MSG_CHECKING([whether to use ssl])
+dnl Check for OpenSSL
 AC_ARG_ENABLE(ssl,
        [  --enable-ssl            Enable SSL support using OpenSSL [default=no]],
        [ac_cv_enable_ssl=$enableval], [ac_cv_enable_ssl=no])
+AC_MSG_CHECKING([whether to use OpenSSL])
 if test $ac_cv_enable_ssl = yes; then
        AC_MSG_RESULT(yes)
-else
-       AC_MSG_RESULT(no)
-fi
-
-if test $ac_cv_enable_ssl = yes; then
-       AC_MSG_CHECKING([whether to openssl is available])
-       LIBS="$LIBS -lssl"
+       AC_MSG_CHECKING([if openssl is available])
+       LIBS="$LIBS -lssl -lcrypto"
        AC_TRY_LINK([
 #include <openssl/opensslv.h>
-],     [ return(OPENSSL_VERSION_NUMBER); ],
+],     [ return OPENSSL_VERSION_NUMBER; ],
        [ AC_MSG_RESULT(yes)
          AC_DEFINE(USE_SSL) ],
-       [ AC_MSG_RESULT(no) 
+       [ AC_MSG_RESULT(no)
          LIBS="$ac_save_LIBS" ])
+else
+       AC_MSG_RESULT(no)
 fi
 
 dnl Check for X-Face support
@@ -134,7 +136,7 @@ AC_ARG_ENABLE(compface,
        [  --disable-compface      Do not use compface (X-Face)],
        [ac_cv_disable_compface=disable], [ac_cv_disable_compface=no])
 if test "$ac_cv_disable_compface" = no; then
-       AC_CHECK_LIB(compface, uncompface)
+       AC_CHECK_LIB(compface, uncompface,,[ac_cv_disable_compface=disable])
 fi
 
 dnl for JPilot support in addressbook
@@ -205,13 +207,13 @@ AC_ARG_ENABLE(jconv,
        [  --disable-jconv         Do not use libjconv],
        [ac_cv_disable_jconv=disable], [ac_cv_disable_jconv=no])
 if test "$ac_cv_disable_jconv" = no; then
-       AC_CHECK_LIB(jconv, jconv_alloc_conv)
+       AC_CHECK_LIB(jconv, jconv_alloc_conv,,[ac_cv_disable_jconv=disable])
 fi
 
 AC_CHECK_LIB(xpg4, setlocale)
 dnl AC_CHECK_LIB(kcc, KCC_filter)
 
-dnl for GThread support
+dnl for GThread support (currently disabled)
 dnl AC_ARG_ENABLE(threads,
 dnl    [  --enable-threads        Enable multithread support [default=no]],
 dnl    [use_threads=$enableval], [use_threads=no])
@@ -236,7 +238,9 @@ AC_ARG_ENABLE(ipv6,
        [ac_cv_enableipv6=$enableval], [ac_cv_enableipv6=no])
 
 dnl automated checks for IPv6 support.
+AC_MSG_CHECKING([whether to use IPv6])
 if test x"$ac_cv_enableipv6" = xyes; then
+       AC_MSG_RESULT(yes)
        AC_MSG_CHECKING([for IPv6 support])
        AC_CACHE_VAL(ac_cv_ipv6,[
                AC_TRY_COMPILE([#define INET6
@@ -248,7 +252,12 @@ if test x"$ac_cv_enableipv6" = xyes; then
        AC_MSG_RESULT($ac_cv_ipv6)
        if test $ac_cv_ipv6 = yes; then
                AC_DEFINE(INET6)
+       else
+               AC_MSG_WARN(*** IPv6 will not be supported ***)
+               ac_cv_enableipv6=no
        fi
+else
+       AC_MSG_RESULT(no)
 fi
 
 dnl check if gdk / gtk was compiled with USE_XIM
@@ -318,6 +327,39 @@ po/Makefile.in
 libkcc/Makefile
 src/Makefile
 manual/Makefile
-manual/ja/Makefile
 manual/en/Makefile
+manual/ja/Makefile
 ])
+
+dnl Output the configuration summary
+echo ""
+echo "$PACKAGE $VERSION"
+echo ""
+if test "$ac_cv_disable_gdk_pixbuf" = no; then
+       echo "gdk-pixbuf : yes"
+       echo "gdk_imlib  : no"
+else
+       echo "gdk-pixbuf : no"
+       if test "$ac_cv_disable_imlib" = no; then
+               echo "gdk_imlib  : yes"
+       else
+               echo "gdk_imlib  : no"
+       fi
+fi
+echo "GPGME      : $ac_cv_enable_gpgme"
+echo "OpenSSL    : $ac_cv_enable_ssl"
+if test "$ac_cv_disable_compface" = no; then
+       echo "compface   : yes"
+else
+       echo "compface   : no"
+fi
+if test "$ac_cv_disable_jconv" = no; then
+       echo "libjconv   : yes"
+else
+       echo "libjconv   : no"
+fi
+echo "IPv6       : $ac_cv_enableipv6"
+echo ""
+echo "The binary will be installed in $prefix/bin"
+echo ""
+echo "Configure finished, type 'make' to build."
index 3f30857..52c8fb5 100644 (file)
@@ -6,6 +6,7 @@ src/alertpanel.c
 src/automaton.c
 src/base64.c
 src/codeconv.c
+src/colorlabel.c
 src/compose.c
 src/editjpilot.c
 src/editldap.c
@@ -26,7 +27,6 @@ src/imap.c
 src/import.c
 src/inc.c
 src/inputdialog.c
-src/labelcolors.c
 src/logwindow.c
 src/main.c
 src/mainwindow.c
index 546278b..413637a 100644 (file)
@@ -80,6 +80,7 @@ sylpheed_SOURCES = \
        sigstatus.c sigstatus.h \
        simple-gettext.c \
        manual.c manual.h \
+       stringtable.c stringtable.h \
        gtkstext.c gtkstext.h \
        scoring.c scoring.h \
        prefs_folder_item.c prefs_folder_item.h \
index 7cfbeca..324f9e4 100644 (file)
@@ -2353,6 +2353,8 @@ static gint compose_queue(Compose *compose, const gchar *file)
        for (cur = compose->to_list->next; cur != NULL; cur = cur->next)
                fprintf(fp, ",<%s>", (gchar *)cur->data);
        fprintf(fp, "\n");
+       /* Sylpheed account ID */
+       fprintf(fp, "AID:%d\n", compose->account->account_id);
        fprintf(fp, "\n");
 
        while (fgets(buf, sizeof(buf), src_fp) != NULL) {
index ae41f3e..7263f6c 100644 (file)
@@ -48,7 +48,7 @@
 #include "folder.h"
 #include "filtering.h"
 #include "addr_compl.h"
-#include "labelcolors.h"
+#include "colorlabel.h"
 
 static struct Filtering {
        GtkWidget *window;
index 040f670..1d6c8bf 100644 (file)
@@ -140,7 +140,8 @@ enum
 {
        Q_SENDER     = 0,
        Q_SMTPSERVER = 1,
-       Q_RECIPIENTS = 2
+       Q_RECIPIENTS = 2,
+       Q_ACCOUNT_ID = 3
 };
 
 static gint send_message_with_command(GSList *to_list, gchar * mailcmd,
@@ -191,6 +192,7 @@ gint send_message_queue(const gchar *file)
        static HeaderEntry qentry[] = {{"S:",   NULL, FALSE},
                                       {"SSV:", NULL, FALSE},
                                       {"R:",   NULL, FALSE},
+                                      {"AID:", NULL, FALSE},
                                       {NULL,   NULL, FALSE}};
        FILE *fp;
        gint val;
@@ -199,6 +201,7 @@ gint send_message_queue(const gchar *file)
        GSList *to_list = NULL;
        gchar buf[BUFFSIZE];
        gint hnum;
+       PrefsAccount *ac = NULL;
 
        g_return_val_if_fail(file != NULL, -1);
 
@@ -221,22 +224,27 @@ gint send_message_queue(const gchar *file)
                case Q_RECIPIENTS:
                        to_list = address_list_append(to_list, p);
                        break;
+               case Q_ACCOUNT_ID:
+                       ac = account_find_from_id(atoi(p));
+                       break;
                default:
                }
        }
 
-       if (!to_list || !from || !server) {
+       if (!to_list || !from) {
                g_warning(_("Queued message header is broken.\n"));
                val = -1;
        } else {
                gushort port;
                gchar *domain;
-               PrefsAccount *ac;
 
-               ac = account_find_from_smtp_server(from, server);
                if (!ac) {
-                       g_warning(_("Account not found. Using current account...\n"));
-                       ac = cur_account;
+                       ac = account_find_from_smtp_server(from, server);
+                       if (!ac) {
+                               g_warning(_("Account not found. "
+                                           "Using current account...\n"));
+                               ac = cur_account;
+                       }
                }
 
                if (ac) {
@@ -250,12 +258,12 @@ gint send_message_queue(const gchar *file)
                        domain = ac->set_domain ? ac->domain : NULL;
 #if USE_SSL
                        val = send_message_smtp
-                               (to_list, from, server, port, domain,
+                               (to_list, from, ac->smtp_server, port, domain,
                                 ac->userid, ac->passwd, ac->use_smtp_auth,
                                 ac->ssl_smtp, fp);
 #else
                        val = send_message_smtp
-                               (to_list, from, server, port, domain,
+                               (to_list, from, ac->smtp_server, port, domain,
                                 ac->userid, ac->passwd, ac->use_smtp_auth, fp);
 #endif
                } else {
diff --git a/src/stringtable.c b/src/stringtable.c
new file mode 100644 (file)
index 0000000..0317602
--- /dev/null
@@ -0,0 +1,156 @@
+/*
+ * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
+ * Copyright (C) 1999-2001 Hiroyuki Yamamoto
+ *
+ * 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include <glib.h>
+#include <string.h>
+
+#include "stringtable.h"
+#include "utils.h"
+
+/* alfons - hashed string table (I wasn't content with GStringChunk; 
+ * can't recall why :-) */
+
+#define XXX_DEBUG \
+       debug_print  
+typedef struct StringEntry_ {
+       gint    ref_count;
+       gchar  *string;
+} StringEntry;
+
+static StringEntry *string_entry_new(const gchar *str)
+{
+       StringEntry *entry;
+
+       entry = g_new0(StringEntry, 1);
+       entry->ref_count = 1;
+       entry->string = g_strdup(str);
+       return entry;
+}
+
+static void string_entry_free(StringEntry *entry)
+{
+       g_return_if_fail(entry != NULL);
+       g_return_if_fail(entry->string);
+
+       g_free(entry->string);
+       g_free(entry);
+}
+
+StringTable *string_table_new(void)
+{
+       StringTable *strtable;
+
+       strtable = g_new0(StringTable, 1);
+       g_return_val_if_fail(strtable != NULL, NULL);
+       strtable->hash_table = g_hash_table_new(g_str_hash, g_str_equal);
+       g_return_val_if_fail(strtable->hash_table, NULL);
+       return strtable;
+}
+
+gchar *string_table_lookup_string(StringTable *table, gchar *str)
+{
+       StringEntry *entry = g_hash_table_lookup(table->hash_table,
+                                                (gconstpointer)str);
+       if (!entry) {
+               return NULL;
+       } else {
+               return entry->string;
+       }
+}
+
+gchar *string_table_insert_string(StringTable *table, gchar *str)
+{
+       gchar *key = NULL;
+       StringEntry *entry = NULL;
+
+       if (g_hash_table_lookup_extended
+               (table->hash_table, str, (gpointer *)&key, (gpointer *)&entry)) {
+               entry->ref_count++;
+               XXX_DEBUG ("ref++ for %s (%d)\n", entry->string, entry->ref_count);
+       } else {
+               entry = string_entry_new(str);
+               XXX_DEBUG ("inserting %s\n", str);
+               /* insert entry->string instead of str, since it can be
+                * invalid pointer after this. */
+               g_hash_table_insert(table->hash_table, entry->string, entry);
+       }
+
+       return entry->string;
+}
+
+void string_table_free_string(StringTable *table, gchar *str)
+{
+       StringEntry *entry;
+
+       entry = g_hash_table_lookup(table->hash_table, str);
+
+       if (entry) {
+               entry->ref_count--;
+               if (entry->ref_count <= 0) {
+                       XXX_DEBUG ("refcount of string %s dropped to zero\n", entry->string);
+                       g_hash_table_remove(table->hash_table, str);
+                       g_free(entry->string);
+                       g_free(entry);
+               } else {
+                       XXX_DEBUG ("ref-- for %s (%d)\n", entry->string, entry->ref_count); 
+               }
+       }
+}
+
+static gboolean string_table_remove_for_each_fn(gchar *key, StringEntry *entry,
+                                               gpointer user_data)
+{
+       g_return_val_if_fail(key != NULL, TRUE);
+       g_return_val_if_fail(entry != NULL, TRUE);
+
+       g_free(entry->string);
+       g_free(entry);
+
+       return TRUE;
+}
+
+void string_table_free(StringTable *table)
+{
+       g_return_if_fail(table != NULL);
+       g_return_if_fail(table->hash_table != NULL);
+
+       g_hash_table_foreach_remove(table->hash_table,
+                                   (GHRFunc)string_table_remove_for_each_fn,
+                                   NULL);
+       g_hash_table_destroy(table->hash_table);
+       g_free(table);
+}
+
+static void string_table_stats_for_each_fn(gchar *key, StringEntry *entry,
+                                          guint *totals)
+{
+       if (entry->ref_count > 1) {
+               *totals += strlen(key) * (entry->ref_count - 1);
+       }
+}
+
+void string_table_get_stats(StringTable *table)
+{
+       guint totals = 0;
+
+       g_hash_table_foreach(table->hash_table,
+                            (GHFunc)string_table_stats_for_each_fn, &totals);
+       XXX_DEBUG ("TOTAL UNSPILLED %d (%dK)\n", totals, totals / 1024);
+}
diff --git a/src/stringtable.h b/src/stringtable.h
new file mode 100644 (file)
index 0000000..fdafb71
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * sylpheed -- a gtk+ based, lightweight, and fast e-mail client
+ * copyright (c) 1999-2001 hiroyuki yamamoto
+ *
+ * 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
+ * the free software foundation; either version 2 of the license, or
+ * (at your option) any later version.
+ *
+ * this program is distributed in the hope that it will be useful,
+ * but without any warranty; without even the implied warranty of
+ * merchantability or fitness for a particular purpose.  see the
+ * gnu general public license for more details.
+ *
+ * you should have received a copy of the gnu general public license
+ * along with this program; if not, write to the free software
+ * foundation, inc., 59 temple place - suite 330, boston, ma 02111-1307, usa.
+ */
+
+#ifndef STRINGTABLE_H__
+#define STRINGTABLE_H__
+
+#include <glib.h>
+
+typedef struct {
+       GHashTable *hash_table;
+} StringTable;
+
+StringTable *string_table_new     (void);
+void         string_table_free    (StringTable *table);
+
+gchar *string_table_lookup_string (StringTable *table, gchar *str);
+gchar *string_table_insert_string (StringTable *table, gchar *str);
+void   string_table_free_string   (StringTable *table, gchar *str);
+
+void   string_table_get_stats     (StringTable *table);
+
+#endif /* STRINGTABLE_H__ */
index 90c1d85..7a1382e 100644 (file)
@@ -363,6 +363,7 @@ static GtkItemFactoryEntry summary_popup_entries[] =
 #endif 
        {N_("/_Mark/Ignore thread"),    NULL, summary_ignore_thread, 0, NULL},
        {N_("/_Mark/Unignore thread"),  NULL, summary_unignore_thread, 0, NULL},
+       {N_("/Color la_bel"),           NULL, NULL,             0, NULL},
 
        {N_("/---"),                    NULL, NULL,             0, "<Separator>"},
        {N_("/_Reply"),                 NULL, summary_reply_cb, COMPOSE_REPLY, NULL},
@@ -1037,15 +1038,28 @@ static void summary_set_menu_sensitive(SummaryView *summaryview)
        }
 
        if (summaryview->folder_item->folder->type != F_NEWS) {
-               if (summaryview->folder_item->stype != F_TRASH)
-                       menu_set_sensitive(ifactory, "/Delete", TRUE);
                menu_set_sensitive(ifactory, "/Move...", TRUE);
                menu_set_sensitive(ifactory, "/Copy...", TRUE);
+               if (summaryview->folder_item->stype != F_TRASH)
+                       menu_set_sensitive(ifactory, "/Delete", TRUE);
        }
 
-       gtk_widget_set_sensitive(summaryview->colorlabel_menu_item, TRUE);
        menu_set_sensitive(ifactory, "/Execute", TRUE);
 
+        menu_set_sensitive(ifactory, "/Mark", TRUE);
+       menu_set_sensitive(ifactory, "/Mark/Mark",   TRUE);
+       menu_set_sensitive(ifactory, "/Mark/Unmark", TRUE);
+
+       menu_set_sensitive(ifactory, "/Mark/Mark as unread", TRUE);
+       menu_set_sensitive(ifactory, "/Mark/Mark as read",   TRUE);
+#if MARK_ALL_READ
+       menu_set_sensitive(ifactory, "/Mark/Mark all read", TRUE);
+#endif
+       menu_set_sensitive(ifactory, "/Mark/Ignore thread",   TRUE);
+       menu_set_sensitive(ifactory, "/Mark/Unignore thread", TRUE);
+
+       menu_set_sensitive(ifactory, "/Color label", TRUE);
+
        sens = (selection == SUMMARY_SELECTED_MULTIPLE) ? FALSE : TRUE;
        menu_set_sensitive(ifactory, "/Reply",                    sens);
        menu_set_sensitive(ifactory, "/Reply to sender",          sens);
@@ -1064,19 +1078,6 @@ static void summary_set_menu_sensitive(SummaryView *summaryview)
        menu_set_sensitive(ifactory, "/Save as...", sens);
        menu_set_sensitive(ifactory, "/Print...",   TRUE);
 
-       menu_set_sensitive(ifactory, "/Mark", TRUE);
-
-       menu_set_sensitive(ifactory, "/Mark/Mark",   TRUE);
-       menu_set_sensitive(ifactory, "/Mark/Unmark", TRUE);
-
-       menu_set_sensitive(ifactory, "/Mark/Mark as unread", TRUE);
-       menu_set_sensitive(ifactory, "/Mark/Mark as read",   TRUE);
-#if MARK_ALL_READ      
-       menu_set_sensitive(ifactory, "/Mark/Mark all read", TRUE);
-#endif 
-       menu_set_sensitive(ifactory, "/Mark/Ignore thread",   TRUE);
-       menu_set_sensitive(ifactory, "/Mark/Unignore thread", TRUE);
-
        menu_set_sensitive(ifactory, "/Select all", TRUE);
 
        if (summaryview->folder_item->folder->account)
@@ -3441,7 +3442,7 @@ static void summary_filter_func(GtkCTree *ctree, GtkCTreeNode *node,
 
 /* color label */
 
-#define LABEL_COLORS_ELEMS colorlabel_get_color_count()
+#define N_COLOR_LABELS colorlabel_get_color_count()
 
 static void summary_colorlabel_menu_item_activate_cb(GtkWidget *widget,
                                                     gpointer data)
@@ -3477,7 +3478,7 @@ void summary_set_colorlabel_color(GtkCTree *ctree, GtkCTreeNode *node,
                prev_style = ctree_style;
        style = gtk_style_copy(prev_style);
 
-       if (color_index < 0 || color_index >= LABEL_COLORS_ELEMS) {
+       if (color_index < 0 || color_index >= N_COLOR_LABELS) {
                color_index = 0;
                color.red = ctree_style->fg[GTK_STATE_NORMAL].red;
                color.green = ctree_style->fg[GTK_STATE_NORMAL].green;
@@ -3516,11 +3517,11 @@ void summary_set_colorlabel(SummaryView *summaryview, guint labelcolor,
                                             labelcolor);
 }
 
-static void summary_colorlabel_menu_item_activate_item_cb(GtkMenuItem *label_menu_item,
+static void summary_colorlabel_menu_item_activate_item_cb(GtkMenuItem *menu_item,
                                                          gpointer data)
 {
        SummaryView *summaryview;
-       GtkMenuShell *label_menu;
+       GtkMenuShell *menu;
        GtkCheckMenuItem **items;
        gint n;
        GList *cur, *sel;
@@ -3531,18 +3532,18 @@ static void summary_colorlabel_menu_item_activate_item_cb(GtkMenuItem *label_men
        sel = GTK_CLIST(summaryview->ctree)->selection;
        if (!sel) return;
 
-       label_menu = GTK_MENU_SHELL(summaryview->colorlabel_menu);
-       g_return_if_fail(label_menu != NULL);
+       menu = GTK_MENU_SHELL(summaryview->colorlabel_menu);
+       g_return_if_fail(menu != NULL);
 
-       Xalloca(items, (LABEL_COLORS_ELEMS + 1) * sizeof(GtkWidget *), return);
+       Xalloca(items, (N_COLOR_LABELS + 1) * sizeof(GtkWidget *), return);
 
        /* NOTE: don't return prematurely because we set the "dont_toggle"
         * state for check menu items */
-       gtk_object_set_data(GTK_OBJECT(label_menu), "dont_toggle",
+       gtk_object_set_data(GTK_OBJECT(menu), "dont_toggle",
                            GINT_TO_POINTER(1));
 
        /* clear items. get item pointers. */
-       for (n = 0, cur = label_menu->children; cur != NULL; cur = cur->next) {
+       for (n = 0, cur = menu->children; cur != NULL; cur = cur->next) {
                if (GTK_IS_CHECK_MENU_ITEM(cur->data)) {
                        gtk_check_menu_item_set_state
                                (GTK_CHECK_MENU_ITEM(cur->data), FALSE);
@@ -3551,50 +3552,47 @@ static void summary_colorlabel_menu_item_activate_item_cb(GtkMenuItem *label_men
                }
        }
 
-       if (n == (LABEL_COLORS_ELEMS + 1)) {
+       if (n == (N_COLOR_LABELS + 1)) {
                /* iterate all messages and set the state of the appropriate
                 * items */
                for (; sel != NULL; sel = sel->next) {
                        MsgInfo *msginfo;
-                       gint menu_item;
+                       gint clabel;
 
                        msginfo = gtk_ctree_node_get_row_data
                                (GTK_CTREE(summaryview->ctree),
                                 GTK_CTREE_NODE(sel->data));
                        if (msginfo) {
-                               menu_item = MSG_GET_COLORLABEL_VALUE(msginfo->flags);
-                               if (!items[menu_item]->active)
+                               clabel = MSG_GET_COLORLABEL_VALUE(msginfo->flags);
+                               if (!items[clabel]->active)
                                        gtk_check_menu_item_set_state
-                                               (items[menu_item], TRUE);
+                                               (items[clabel], TRUE);
                        }
                }
        } else
                g_warning("invalid number of color elements (%d)\n", n);
 
        /* reset "dont_toggle" state */
-       gtk_object_set_data(GTK_OBJECT(label_menu), "dont_toggle",
+       gtk_object_set_data(GTK_OBJECT(menu), "dont_toggle",
                            GINT_TO_POINTER(0));
 }
 
 static void summary_colorlabel_menu_create(SummaryView *summaryview)
 {
-       const gint LABEL_MENU_POS = 5;
-       GtkWidget *label_menu_item;
-       GtkWidget *label_menu;
+       GtkWidget *label_menuitem;
+       GtkWidget *menu;
        GtkWidget *item;
        gint i;
 
-       label_menu_item = gtk_menu_item_new_with_label(_("Color label"));
-       gtk_menu_insert(GTK_MENU(summaryview->popupmenu), label_menu_item,
-                       LABEL_MENU_POS);
-       gtk_signal_connect(GTK_OBJECT(label_menu_item), "activate",
+       label_menuitem = gtk_item_factory_get_item(summaryview->popupfactory,
+                                                  "/Color label");
+       gtk_signal_connect(GTK_OBJECT(label_menuitem), "activate",
                           GTK_SIGNAL_FUNC(summary_colorlabel_menu_item_activate_item_cb),
                           summaryview);
 
-       gtk_widget_show(label_menu_item);
-       summaryview->colorlabel_menu_item = label_menu_item;
+       gtk_widget_show(label_menuitem);
 
-       label_menu = gtk_menu_new();
+       menu = gtk_menu_new();
 
        /* create sub items. for the menu item activation callback we pass the
         * index of label_colors[] as data parameter. for the None color we
@@ -3602,7 +3600,7 @@ static void summary_colorlabel_menu_create(SummaryView *summaryview)
         * can always get back the SummaryView pointer. */
 
        item = gtk_check_menu_item_new_with_label(_("None"));
-       gtk_menu_append(GTK_MENU(label_menu), item);
+       gtk_menu_append(GTK_MENU(menu), item);
        gtk_signal_connect(GTK_OBJECT(item), "activate",
                           GTK_SIGNAL_FUNC(summary_colorlabel_menu_item_activate_cb),
                           GUINT_TO_POINTER(0));
@@ -3610,13 +3608,13 @@ static void summary_colorlabel_menu_create(SummaryView *summaryview)
        gtk_widget_show(item);
 
        item = gtk_menu_item_new();
-       gtk_menu_append(GTK_MENU(label_menu), item);
+       gtk_menu_append(GTK_MENU(menu), item);
        gtk_widget_show(item);
 
        /* create pixmap/label menu items */
-       for (i = 0; i < LABEL_COLORS_ELEMS; i++) {
+       for (i = 0; i < N_COLOR_LABELS; i++) {
                item = colorlabel_create_check_color_menu_item(i);
-               gtk_menu_append(GTK_MENU(label_menu), item);
+               gtk_menu_append(GTK_MENU(menu), item);
                gtk_signal_connect(GTK_OBJECT(item), "activate",
                                   GTK_SIGNAL_FUNC(summary_colorlabel_menu_item_activate_cb),
                                   GUINT_TO_POINTER(i + 1));
@@ -3625,9 +3623,9 @@ static void summary_colorlabel_menu_create(SummaryView *summaryview)
                gtk_widget_show(item);
        }
 
-       gtk_widget_show(label_menu);
-       gtk_menu_item_set_submenu(GTK_MENU_ITEM(label_menu_item), label_menu);
-       summaryview->colorlabel_menu = label_menu;
+       gtk_widget_show(menu);
+       gtk_menu_item_set_submenu(GTK_MENU_ITEM(label_menuitem), menu);
+       summaryview->colorlabel_menu = menu;
 }
 
 /* callback functions */
index 794843c..06b83ac 100644 (file)
@@ -93,7 +93,6 @@ struct _SummaryView
        GtkWidget *toggle_arrow;
        GtkWidget *popupmenu;
        GtkWidget *colorlabel_menu;
-       GtkWidget *colorlabel_menu_item;
 
        GtkItemFactory *popupfactory;
 
index b276115..f3a2403 100644 (file)
--- a/src/xml.c
+++ b/src/xml.c
@@ -1,6 +1,6 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999,2000 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2001 Hiroyuki Yamamoto
  *
  * 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
 #include <ctype.h>
 
 #include "xml.h"
+#include "main.h"
 #include "utils.h"
 
+#define SPARSE_MEMORY
+/* if this is defined all attr.names and tag.names are stored
+ * in a hash table */
+#if defined(SPARSE_MEMORY)
+#include "stringtable.h" 
+
+static StringTable *xml_string_table;
+
+static void xml_string_table_create(void)
+{
+       if (xml_string_table == NULL)
+               xml_string_table = string_table_new();
+}
+#define XML_STRING_ADD(str) \
+       string_table_insert_string(xml_string_table, (str))
+#define XML_STRING_FREE(str) \
+       string_table_free_string(xml_string_table, (str))
+
+#define XML_STRING_TABLE_CREATE() \
+       xml_string_table_create()
+
+#else /* !SPARSE_MEMORY */
+
+#define XML_STRING_ADD(str) \
+       g_strdup(str)
+#define XML_STRING_FREE(str) \
+       g_free(str)
+
+#define XML_STRING_TABLE_CREATE()
+
+#endif /* SPARSE_MEMORY */
+
 static void xml_free_tag       (XMLTag         *tag);
 static gint xml_get_parenthesis        (XMLFile        *file,
                                 gchar          *buf,
@@ -36,6 +69,8 @@ XMLFile *xml_open_file(const gchar *path)
 
        g_return_val_if_fail(path != NULL, NULL);
 
+       XML_STRING_TABLE_CREATE();
+
        newfile = g_new(XMLFile, 1);
 
        newfile->fp = fopen(path, "r");
@@ -114,6 +149,12 @@ GNode *xml_parse_file(const gchar *path)
        node = xml_build_tree(file, NULL, file->level);
 
        xml_close_file(file);
+
+#if defined(SPARSE_MEMORY)
+       if (debug_mode)
+               string_table_get_stats(xml_string_table);
+#endif
+
        return node;
 }
 
@@ -181,11 +222,11 @@ gint xml_parse_next_tag(XMLFile *file)
 
        while (*bufp != '\0' && !isspace(*bufp)) bufp++;
        if (*bufp == '\0') {
-               tag->tag = g_strdup(buf);
+               tag->tag = XML_STRING_ADD(buf);
                return 0;
        } else {
                *bufp++ = '\0';
-               tag->tag = g_strdup(buf);
+               tag->tag = XML_STRING_ADD(buf);
        }
 
        /* parse attributes ( name=value ) */
@@ -224,9 +265,9 @@ gint xml_parse_next_tag(XMLFile *file)
                xml_unescape_str(attr_value);
 
                attr = g_new(XMLAttr, 1);
-               attr->name  = g_strdup(attr_name);
+               attr->name  = XML_STRING_ADD(attr_name);
                attr->value = g_strdup(attr_value);
-               tag->attr = g_list_append(tag->attr, attr);
+               tag->attr   = g_list_append(tag->attr, attr);
        }
 
        return 0;
@@ -345,7 +386,7 @@ XMLTag *xml_copy_tag(XMLTag *tag)
        GList *list;
 
        new_tag = g_new(XMLTag, 1);
-       new_tag->tag = g_strdup(tag->tag);
+       new_tag->tag = XML_STRING_ADD(tag->tag);
        new_tag->attr = NULL;
        for (list = tag->attr; list != NULL; list = list->next) {
                attr = xml_copy_attr((XMLAttr *)list->data);
@@ -360,7 +401,7 @@ XMLAttr *xml_copy_attr(XMLAttr *attr)
        XMLAttr *new_attr;
 
        new_attr = g_new(XMLAttr, 1);
-       new_attr->name  = g_strdup(attr->name);
+       new_attr->name  = XML_STRING_ADD(attr->name);
        new_attr->value = g_strdup(attr->value);
 
        return new_attr;
@@ -475,10 +516,10 @@ static void xml_free_tag(XMLTag *tag)
 {
        if (!tag) return;
 
-       g_free(tag->tag);
+       XML_STRING_FREE(tag->tag);
        while (tag->attr != NULL) {
                XMLAttr *attr = (XMLAttr *)tag->attr->data;
-               g_free(attr->name);
+               XML_STRING_FREE(attr->name);
                g_free(attr->value);
                g_free(attr);
                tag->attr = g_list_remove(tag->attr, tag->attr->data);
index 08e137a..765a8ce 100644 (file)
@@ -1,7 +1,9 @@
-[desktop Entry]
+[Desktop Entry]
 Name=Sylpheed
-Comment=Sylpheed Mail
+Name[ja]=Sylpheed
+Comment=E-Mail client
+Comment[ja]=ÅŻҥ᡼¥ë¥¯¥é¥¤¥¢¥ó¥È
 Exec=sylpheed
 Icon=sylpheed.png
 Terminal=0
-Type=Application
+Type=Internet