sync with 0.7.8cvs16
authorPaul Mangan <paul@claws-mail.org>
Fri, 5 Jul 2002 07:49:10 +0000 (07:49 +0000)
committerPaul Mangan <paul@claws-mail.org>
Fri, 5 Jul 2002 07:49:10 +0000 (07:49 +0000)
12 files changed:
ChangeLog
ChangeLog.claws
ChangeLog.jp
Makefile.am
configure.in
src/Makefile.am
src/codeconv.c
src/codeconv.h
src/defs.h
src/mainwindow.c
src/prefs_actions.c
src/prefs_actions.h

index ea2ac65..4c6c2a5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2002-07-05
+
+       * src/prefs_actions.[ch]: merged the 'Actions' feature from claws.
+         update_actions_menu(): simplified the menu deletion.
+       * src/mainwindow.c: added 'Actions' menu to Tools and Configuration.
+
+2002-07-04
+
+       * src/codeconv.[ch]: implemented conv_jistoeuc(), conv_euctojis(),
+         conv_sjistoeuc(), and conv_guess_encoding(). Removed the dependency
+         to libkcc.
+
 2002-07-04
 
        * configure.in: added check for strchr.
index 624c65f..f494654 100644 (file)
@@ -1,3 +1,8 @@
+2002-07-05 [paul]      0.7.8claws48
+
+       * sync with 0.7.8cvs16
+               see ChangeLog 2002-07-04 and 2002-07-05
+
 2002-07-04 [paul]      0.7.8claws47
 
        * sync with 0.7.8cvs14
index 26874c9..cd297c2 100644 (file)
@@ -1,3 +1,15 @@
+2002-07-05
+
+       * src/prefs_actions.[ch]: claws ¤«¤é¡Ö¥¢¥¯¥·¥ç¥ó¡×µ¡Ç½¤ò¥Þ¡¼¥¸¡£
+         update_actions_menu(): ¥á¥Ë¥å¡¼ºï½ü¤ò´Êά²½¡£
+       * src/mainwindow.c: ¡Ö¥¢¥¯¥·¥ç¥ó¡×¥á¥Ë¥å¡¼¤ò¥Ä¡¼¥ë¤ÈÀßÄê¤ËÄɲá£
+
+2002-07-04
+
+       * src/codeconv.[ch]: conv_jistoeuc(), conv_euctojis(),
+         conv_sjistoeuc(), conv_guess_encoding() ¤ò¼ÂÁõ¡£ libkcc ¤Ë°Í¸
+         ¤·¤Ê¤¤¤è¤¦¤Ë¤·¤¿¡£
+
 2002-07-04
 
        * configure.in: strchr ¤Î¥Á¥§¥Ã¥¯¤òÄɲá£
index 2466c62..fcdee47 100644 (file)
@@ -1,4 +1,4 @@
-SUBDIRS = ac po intl libkcc src man manual faq tools
+SUBDIRS = ac po intl src man manual faq tools
 
 EXTRA_DIST = \
        ChangeLog.jp \
index 2c61b91..ca0e5a0 100644 (file)
@@ -8,7 +8,7 @@ MINOR_VERSION=7
 MICRO_VERSION=8
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws47
+EXTRA_VERSION=claws48
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl set $target
index 3f76751..971f51b 100644 (file)
@@ -35,6 +35,7 @@ sylpheed_SOURCES = \
        prefs_customheader.c prefs_customheader.h \
        prefs_summary_column.c prefs_summary_column.h \
        prefs_template.c prefs_template.h \
+       prefs_actions.c prefs_actions.h \
        account.c account.h \
        displayheader.c displayheader.h \
        customheader.c customheader.h \
@@ -125,7 +126,6 @@ sylpheed_SOURCES = \
        matcher.c matcher.h \
        prefs_matcher.c prefs_matcher.h \
        prefs_scoring.c prefs_scoring.h \
-       prefs_actions.c prefs_actions.h \
        filtering.c filtering.h \
        prefs_filtering.c prefs_filtering.h \
        mbox_folder.c mbox_folder.h \
@@ -213,7 +213,6 @@ EXTRA_DIST = \
 
 INCLUDES = \
        -DG_LOG_DOMAIN=\"Sylpheed\" \
-       -I$(top_srcdir)/libkcc \
        -I$(top_srcdir)/intl \
        $(GTK_CFLAGS) \
        $(GDK_IMLIB_CFLAGS) \
@@ -223,7 +222,6 @@ INCLUDES = \
        -I$(includedir)
 
 sylpheed_LDADD = \
-       $(top_builddir)/libkcc/libkcc.a \
        $(INTLLIBS) \
        $(GTK_LIBS) \
        $(GDK_IMLIB_LIBS) \
index 9aac44f..e5315cb 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-2002 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
@@ -39,8 +39,6 @@
 #  include <jconv.h>
 #endif
 
-#include <kcc.h>
-
 #include "intl.h"
 #include "codeconv.h"
 #include "unmime.h"
 #include "utils.h"
 #include "prefs_common.h"
 
-#define iskanji(c) \
+typedef enum
+{
+       JIS_ASCII,
+       JIS_KANJI,
+       JIS_HWKANA,
+       JIS_AUXKANJI
+} JISState;
+
+#define SUBST_CHAR     '_'
+#define ESC            '\033'
+
+#define iseuckanji(c) \
        (((c) & 0xff) >= 0xa1 && ((c) & 0xff) <= 0xfe)
-#define iseucss(c) \
-       (((c) & 0xff) == 0x8e || ((c) & 0xff) == 0x8f)
-#define isunprintablekanji(c) \
+#define iseuchwkana1(c) \
+       (((c) & 0xff) == 0x8e)
+#define iseuchwkana2(c) \
+       (((c) & 0xff) >= 0xa1 && ((c) & 0xff) <= 0xdf)
+#define iseucaux(c) \
+       (((c) & 0xff) == 0x8f)
+#define isunprintableeuckanji(c) \
        (((c) & 0xff) >= 0xa9 && ((c) & 0xff) <= 0xaf)
+#define issjiskanji1(c) \
+       ((((c) & 0xff) >= 0x81 && ((c) & 0xff) <= 0x9f) || \
+        (((c) & 0xff) >= 0xe0 && ((c) & 0xff) <= 0xfc))
+#define issjiskanji2(c) \
+       ((((c) & 0xff) >= 0x40 && ((c) & 0xff) <= 0x7e) || \
+        (((c) & 0xff) >= 0x80 && ((c) & 0xff) <= 0xfc))
+#define issjishwkana(c) \
+       (((c) & 0xff) >= 0xa1 && ((c) & 0xff) <= 0xdf)
+
+#define K_IN()                         \
+       if (state != JIS_KANJI) {       \
+               *out++ = ESC;           \
+               *out++ = '$';           \
+               *out++ = 'B';           \
+               state = JIS_KANJI;      \
+       }
+
+#define K_OUT()                                \
+       if (state != JIS_ASCII) {       \
+               *out++ = ESC;           \
+               *out++ = '(';           \
+               *out++ = 'B';           \
+               state = JIS_ASCII;      \
+       }
+
+#define HW_IN()                                \
+       if (state != JIS_HWKANA) {      \
+               *out++ = ESC;           \
+               *out++ = '(';           \
+               *out++ = 'I';           \
+               state = JIS_HWKANA;     \
+       }
+
+#define AUX_IN()                       \
+       if (state != JIS_AUXKANJI) {    \
+               *out++ = ESC;           \
+               *out++ = '$';           \
+               *out++ = '(';           \
+               *out++ = 'D';           \
+               state = JIS_AUXKANJI;   \
+       }
 
 void conv_jistoeuc(gchar *outbuf, gint outlen, const gchar *inbuf)
 {
-       KCC_filter(outbuf, "EUC", (gchar *)inbuf, "JISBB", 0, 0, 0);
+       const guchar *in = inbuf;
+       guchar *out = outbuf;
+       JISState state = JIS_ASCII;
+
+       while (*in != '\0') {
+               if (*in == ESC) {
+                       in++;
+                       if (*in == '$') {
+                               if (*(in + 1) == '@' || *(in + 1) == 'B') {
+                                       state = JIS_KANJI;
+                                       in += 2;
+                               } else if (*(in + 1) == '(' &&
+                                          *(in + 2) == 'D') {
+                                       state = JIS_AUXKANJI;
+                                       in += 3;
+                               } else {
+                                       /* unknown escape sequence */
+                                       state = JIS_ASCII;
+                               }
+                       } else if (*in == '(') {
+                               if (*(in + 1) == 'B' || *(in + 1) == 'J') {
+                                       state = JIS_ASCII;
+                                       in += 2;
+                               } else if (*(in + 1) == 'I') {
+                                       state = JIS_HWKANA;
+                                       in += 2;
+                               } else {
+                                       /* unknown escape sequence */
+                                       state = JIS_ASCII;
+                               }
+                       } else {
+                               /* unknown escape sequence */
+                               state = JIS_ASCII;
+                       }
+               } else if (*in == 0x0e) {
+                       state = JIS_HWKANA;
+                       in++;
+               } else if (*in == 0x0f) {
+                       state = JIS_ASCII;
+                       in++;
+               } else {
+                       switch (state) {
+                       case JIS_ASCII:
+                               *out++ = *in++;
+                               break;
+                       case JIS_KANJI:
+                               *out++ = *in++ | 0x80;
+                               if (*in == '\0') break;
+                               *out++ = *in++ | 0x80;
+                               break;
+                       case JIS_HWKANA:
+                               *out++ = 0x8e;
+                               *out++ = *in++ | 0x80;
+                               break;
+                       case JIS_AUXKANJI:
+                               *out++ = 0x8f;
+                               *out++ = *in++ | 0x80;
+                               if (*in == '\0') break;
+                               *out++ = *in++ | 0x80;
+                               break;
+                       }
+               }
+       }
+
+       *out = '\0';
 }
 
 void conv_euctojis(gchar *outbuf, gint outlen, const gchar *inbuf)
 {
-       size_t inlen, len;
-
-       inlen = strlen(inbuf);
-       if (iskanji(inbuf[inlen - 1]) || iseucss(inbuf[inlen - 1])) {
-               /* if tail end of the string is not ended with ascii,
-                  add dummy return code. */
-               gchar *tmpin, *tmpout;
-
-               /* length of original string + '\n' + '\0' */
-               tmpin = alloca(inlen + 2);
-               if (tmpin == NULL) {
-                       g_warning(_("can't allocate memory\n"));
-                       KCC_filter(outbuf, "JISBB", (gchar *)inbuf, "EUC",
-                                  0, 0, 0);
-                       return;
-               }
-               strcpy(tmpin, inbuf);
-               tmpin[inlen] = '\n';
-               tmpin[inlen + 1] = '\0';
-
-               tmpout = alloca(outlen + 1);
-               if (tmpout == NULL) {
-                       g_warning(_("can't allocate memory\n"));
-                       KCC_filter(outbuf, "JISBB", (gchar *)inbuf, "EUC",
-                                  0, 0, 0);
-                       return;
+       const guchar *in = inbuf;
+       guchar *out = outbuf;
+       JISState state = JIS_ASCII;
+
+       while (*in != '\0') {
+               if (isascii(*in)) {
+                       K_OUT();
+                       *out++ = *in++;
+               } else if (iseuckanji(*in)) {
+                       if (iseuckanji(*(in + 1))) {
+                               K_IN();
+                               *out++ = *in++ & 0x7f;
+                               *out++ = *in++ & 0x7f;
+                       } else {
+                               K_OUT();
+                               *out++ = SUBST_CHAR;
+                               in++;
+                               if (*in != '\0' && !isascii(*in)) {
+                                       *out++ = SUBST_CHAR;
+                                       in++;
+                               }
+                       }
+               } else if (iseuchwkana1(*in)) {
+                       in++;
+                       if (iseuchwkana2(*in)) {
+                               HW_IN();
+                               *out++ = *in++ & 0x7f;
+                       } else {
+                               K_OUT();
+                               if (*in != '\0' && !isascii(*in)) {
+                                       *out++ = SUBST_CHAR;
+                                       in++;
+                               }
+                       }
+               } else if (iseucaux(*in)) {
+                       in++;
+                       if (iseuckanji(*in) && iseuckanji(*(in + 1))) {
+                               AUX_IN();
+                               *out++ = *in++ & 0x7f;
+                               *out++ = *in++ & 0x7f;
+                       } else {
+                               K_OUT();
+                               if (*in != '\0' && !isascii(*in)) {
+                                       *out++ = SUBST_CHAR;
+                                       in++;
+                                       if (*in != '\0' && !isascii(*in)) {
+                                               *out++ = SUBST_CHAR;
+                                               in++;
+                                       }
+                               }
+                       }
                }
+       }
 
-               KCC_filter(tmpout, "JISBB", tmpin, "EUC", 0, 0, 0);
-               len = strlen(tmpout);
-               if (tmpout[len - 1] == '\n')
-                       tmpout[len - 1] = '\0';
-               strncpy2(outbuf, tmpout, outlen);
-       } else
-               KCC_filter(outbuf, "JISBB", (gchar *)inbuf, "EUC", 0, 0, 0);
+       K_OUT();
+       *out = '\0';
 }
 
 void conv_sjistoeuc(gchar *outbuf, gint outlen, const gchar *inbuf)
 {
-       KCC_filter(outbuf, "EUC", (gchar *)inbuf, "SJIS", 0, 0, 0);
+       const guchar *in = inbuf;
+       guchar *out = outbuf;
+
+       while (*in != '\0') {
+               if (isascii(*in)) {
+                       *out++ = *in++;
+               } else if (issjiskanji1(*in)) {
+                       if (issjiskanji2(*(in + 1))) {
+                               guchar out1 = *in;
+                               guchar out2 = *(in + 1);
+                               guchar row;
+
+                               row = out1 < 0xa0 ? 0x70 : 0xb0;
+                               if (out2 < 0x9f) {
+                                       out1 = (out1 - row) * 2 - 1;
+                                       out2 -= out2 > 0x7f ? 0x20 : 0x1f;
+                               } else {
+                                       out1 = (out1 - row) * 2;
+                                       out2 -= 0x7e;
+                               }
+
+                               *out++ = out1 | 0x80;
+                               *out++ = out2 | 0x80;
+                               in += 2;
+                       } else {
+                               *out++ = SUBST_CHAR;
+                               in++;
+                               if (*in != '\0' && !isascii(*in)) {
+                                       *out++ = SUBST_CHAR;
+                                       in++;
+                               }
+                       }
+               } else if (issjishwkana(*in)) {
+                       *out++ = 0x8e;
+                       *out++ = *in++;
+               } else {
+                       *out++ = SUBST_CHAR;
+                       in++;
+               }
+       }
+
+       *out = '\0';
 }
 
 void conv_anytoeuc(gchar *outbuf, gint outlen, const gchar *inbuf)
 {
-       KCC_filter(outbuf, "EUC", (gchar *)inbuf, "AUTO", 0, 0, 0);
+       switch (conv_guess_encoding(inbuf)) {
+       case C_ISO_2022_JP:
+               conv_jistoeuc(outbuf, outlen, inbuf);
+               break;
+       case C_SHIFT_JIS:
+               conv_sjistoeuc(outbuf, outlen, inbuf);
+               break;
+       default:
+               strncpy2(outbuf, inbuf, outlen);
+               break;
+       }
 }
 
 void conv_anytojis(gchar *outbuf, gint outlen, const gchar *inbuf)
 {
-       KCC_filter(outbuf, "JISBB", (gchar *)inbuf, "AUTO", 0, 0, 0);
+       switch (conv_guess_encoding(inbuf)) {
+       case C_EUC_JP:
+               conv_euctojis(outbuf, outlen, inbuf);
+               break;
+       default:
+               strncpy2(outbuf, inbuf, outlen);
+               break;
+       }
 }
 
-#define SUBST_CHAR     '_'
-
 void conv_unreadable_eucjp(gchar *str)
 {
        register guchar *p = str;
@@ -127,8 +322,8 @@ void conv_unreadable_eucjp(gchar *str)
                                memmove(p, p + 1, strlen(p));
                        /* printable 7 bit code */
                        p++;
-               } else if (iskanji(*p)) {
-                       if (iskanji(*(p + 1)) && !isunprintablekanji(*p))
+               } else if (iseuckanji(*p)) {
+                       if (iseuckanji(*(p + 1)) && !isunprintableeuckanji(*p))
                                /* printable euc-jp code */
                                p += 2;
                        else {
@@ -141,12 +336,18 @@ void conv_unreadable_eucjp(gchar *str)
                                                *p++ = SUBST_CHAR;
                                }
                        }
-               } else if (iseucss(*p)) {
-                       if ((*(p + 1) & 0x80) != 0)
+               } else if (iseuchwkana1(*p)) {
+                       if (iseuchwkana2(*(p + 1)))
                                /* euc-jp hankaku kana */
                                p += 2;
                        else
                                *p++ = SUBST_CHAR;
+               } else if (iseucaux(*p)) {
+                       if (iseuckanji(*(p + 1)) && iseuckanji(*(p + 2))) {
+                               /* auxiliary kanji */
+                               p += 3;
+                       } else
+                               *p++ = SUBST_CHAR;
                } else
                        /* substitute unprintable 1 byte code */
                        *p++ = SUBST_CHAR;
@@ -236,7 +437,7 @@ void conv_mb_alnum(gchar *str)
                                p += 2;
                                len -= 2;
                        }
-               } else if (iskanji(*p)) {
+               } else if (iseuckanji(*p)) {
                        p += 2;
                        len -= 2;
                } else {
@@ -246,6 +447,46 @@ void conv_mb_alnum(gchar *str)
        }
 }
 
+CharSet conv_guess_encoding(const gchar *str)
+{
+       const guchar *p = str;
+       CharSet guessed = C_US_ASCII;
+
+       while (*p != '\0') {
+               if (*p == ESC && (*(p + 1) == '$' || *(p + 1) == '(')) {
+                       if (guessed == C_US_ASCII)
+                               return C_ISO_2022_JP;
+                       p += 2;
+               } else if (iseuckanji(*p) && iseuckanji(*(p + 1))) {
+                       if (*p >= 0xfd && *p <= 0xfe)
+                               return C_EUC_JP;
+                       else if (guessed == C_SHIFT_JIS) {
+                               if ((issjiskanji1(*p) &&
+                                    issjiskanji2(*(p + 1))) ||
+                                   issjishwkana(*p))
+                                       guessed = C_SHIFT_JIS;
+                               else
+                                       guessed = C_EUC_JP;
+                       } else
+                               guessed = C_EUC_JP;
+                       p += 2;
+               } else if (issjiskanji1(*p) && issjiskanji2(*(p + 1))) {
+                       if (iseuchwkana1(*p) && iseuchwkana2(*(p + 1)))
+                               guessed = C_SHIFT_JIS;
+                       else
+                               return C_SHIFT_JIS;
+                       p += 2;
+               } else if (issjishwkana(*p)) {
+                       guessed = C_SHIFT_JIS;
+                       p++;
+               } else {
+                       p++;
+               }
+       }
+
+       return guessed;
+}
+
 void conv_jistodisp(gchar *outbuf, gint outlen, const gchar *inbuf)
 {
        conv_jistoeuc(outbuf, outlen, inbuf);
@@ -264,6 +505,12 @@ void conv_euctodisp(gchar *outbuf, gint outlen, const gchar *inbuf)
        conv_unreadable_eucjp(outbuf);
 }
 
+void conv_anytodisp(gchar *outbuf, gint outlen, const gchar *inbuf)
+{
+       conv_anytoeuc(outbuf, outlen, inbuf);
+       conv_unreadable_eucjp(outbuf);
+}
+
 void conv_ustodisp(gchar *outbuf, gint outlen, const gchar *inbuf)
 {
        strncpy2(outbuf, inbuf, outlen);
@@ -763,7 +1010,7 @@ void conv_unmime_header_overwrite(gchar *str)
                UnMimeHeader(buf);
                len = strlen(buf) * 2 + 1;
                Xalloca(tmp, len, {strncpy2(str, buf, outlen); return;});
-               conv_jistodisp(tmp, len, buf);
+               conv_anytodisp(tmp, len, buf);
                strncpy2(str, tmp, outlen);
        } else
                UnMimeHeader(str);
@@ -790,7 +1037,7 @@ void conv_unmime_header(gchar *outbuf, gint outlen, const gchar *str,
 
                len = strlen(outbuf) * 2 + 1;
                Xalloca(buf, len, return);
-               conv_jistodisp(buf, len, outbuf);
+               conv_anytodisp(buf, len, outbuf);
                strncpy2(outbuf, buf, outlen);
        }
 }
index 3ff4777..bc40db3 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-2002 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
@@ -122,6 +122,8 @@ void conv_unreadable_8bit(gchar *str);
 void conv_unreadable_latin(gchar *str);
 void conv_mb_alnum(gchar *str);
 
+CharSet conv_guess_encoding(const gchar *str);
+
 void conv_jistodisp  (gchar *outbuf, gint outlen, const gchar *inbuf);
 void conv_sjistodisp (gchar *outbuf, gint outlen, const gchar *inbuf);
 void conv_euctodisp  (gchar *outbuf, gint outlen, const gchar *inbuf);
index 1ee48fa..56d0fc8 100644 (file)
@@ -52,8 +52,8 @@
 #define SCORING_RC              "scoringrc"
 #define FILTERING_RC           "filteringrc"
 #define MATCHER_RC             "matcherrc"
-#define ACTIONS_RC             "actionsrc"
 #define MENU_RC                        "menurc"
+#define ACTIONS_RC             "actionsrc"
 #define RENDERER_RC            "rendererrc"
 #define COMMAND_HISTORY                "command_history"
 #define TEMPLATE_DIR           "templates"
index 2d3896d..04582ce 100644 (file)
@@ -413,27 +413,27 @@ static void create_filter_cb       (MainWindow    *mainwin,
                                  guint          action,
                                  GtkWidget     *widget);
 
-static void prefs_common_open_cb (MainWindow   *mainwin,
-                                 guint          action,
-                                 GtkWidget     *widget);
-static void prefs_filter_open_cb (MainWindow   *mainwin,
-                                 guint          action,
-                                 GtkWidget     *widget);
-static void prefs_scoring_open_cb (MainWindow  *mainwin,
-                                 guint          action,
-                                 GtkWidget     *widget);
-static void prefs_filtering_open_cb (MainWindow        *mainwin,
-                                 guint          action,
-                                 GtkWidget     *widget);
-static void prefs_account_open_cb(MainWindow   *mainwin,
-                                 guint          action,
-                                 GtkWidget     *widget);
+static void prefs_common_open_cb       (MainWindow     *mainwin,
+                                        guint           action,
+                                        GtkWidget      *widget);
+static void prefs_filter_open_cb       (MainWindow     *mainwin,
+                                        guint           action,
+                                        GtkWidget      *widget);
 static void prefs_template_open_cb     (MainWindow     *mainwin,
                                         guint           action,
                                         GtkWidget      *widget);
 static void prefs_actions_open_cb      (MainWindow     *mainwin,
                                         guint           action,
                                         GtkWidget      *widget);
+static void prefs_account_open_cb      (MainWindow     *mainwin,
+                                        guint           action,
+                                        GtkWidget      *widget);
+static void prefs_scoring_open_cb      (MainWindow     *mainwin,
+                                        guint           action,
+                                        GtkWidget      *widget);
+static void prefs_filtering_open_cb (MainWindow        *mainwin,
+                                        guint           action,
+                                        GtkWidget      *widget);
 
 static void new_account_cb      (MainWindow    *mainwin,
                                  guint          action,
@@ -725,13 +725,13 @@ static GtkItemFactoryEntry mainwin_entries[] =
        {N_("/_Tools/_Create filter rule/by _Subject"),
                                                NULL, create_filter_cb, FILTER_BY_SUBJECT, NULL},
        {N_("/_Tools/---"),                     NULL, NULL, 0, "<Separator>"},
-       {N_("/_Tools/Actio_ns"),                        NULL, NULL, 0, "<Branch>"},
-       {N_("/_Tools/---"),                     NULL, NULL, 0, "<Separator>"},
-       {N_("/_Tools/E_xecute"),                        "X", execute_summary_cb, 0, NULL},
+       {N_("/_Tools/Actio_ns"),                NULL, NULL, 0, "<Branch>"},
        {N_("/_Tools/---"),                     NULL, NULL, 0, "<Separator>"},
        {N_("/_Tools/Delete du_plicated messages"),
                                                NULL, delete_duplicated_cb,   0, NULL},
        {N_("/_Tools/---"),                     NULL, NULL, 0, "<Separator>"},
+       {N_("/_Tools/E_xecute"),                "X", execute_summary_cb, 0, NULL},
+       {N_("/_Tools/---"),                     NULL, NULL, 0, "<Separator>"},
        {N_("/_Tools/_Log window"),             "<control>L", log_window_show_cb, 0, NULL},
 
        {N_("/_Configuration"),                 NULL, NULL, 0, "<Branch>"},
@@ -1066,7 +1066,7 @@ MainWindow *main_window_create(SeparateType type)
 
        main_window_set_toolbar_sensitive(mainwin);
 
-       /* Create actions menu */
+       /* create actions menu */
        update_mainwin_actions_menu(ifactory, mainwin);
 
        /* show main window */
@@ -1724,8 +1724,8 @@ void main_window_set_menu_sensitive(MainWindow *mainwin)
                {"/Tools/Harvest addresses"         , M_UNLOCKED},
                {"/Tools/Filter messages"           , M_MSG_EXIST|M_EXEC|M_UNLOCKED},
                {"/Tools/Create filter rule"        , M_SINGLE_TARGET_EXIST|M_UNLOCKED},
+               {"/Tools/Actions"                   , M_SINGLE_TARGET_EXIST|M_UNLOCKED},
                {"/Tools/Execute"                   , M_MSG_EXIST|M_EXEC|M_UNLOCKED},
-               {"/Tools/Actions"                   , M_MSG_EXIST},
                {"/Tools/Delete duplicated messages", M_MSG_EXIST|M_ALLOW_DELETE|M_UNLOCKED},
 
                {"/Configuration", M_UNLOCKED},
index c918f65..4e82573 100644 (file)
@@ -200,8 +200,10 @@ static void catch_status           (gpointer data,
 
 void prefs_actions_open(MainWindow *mainwin)
 {
+#if 0
        if (prefs_rc_is_readonly(ACTIONS_RC))
                return;
+#endif
        inc_lock();
 
        if (!actions.window)
@@ -920,7 +922,7 @@ static void prefs_actions_select    (GtkCList       *clist,
        
        strncpy(buf, action, PREFSBUFSIZE - 1);
        buf[PREFSBUFSIZE - 1] = 0x00;
-       cmd = strstr2(buf, ": ");
+       cmd = strstr(buf, ": ");
 
        if (cmd && cmd[2])
                ENTRY_SET_TEXT(actions.cmd_entry, &cmd[2]);
@@ -1003,23 +1005,18 @@ static void update_actions_menu(GtkItemFactory *ifactory,
        gchar *menu_path;
        GSList *cur;
        gchar *action, *action_p;
-       GtkWidget *menu;
-       
-       GtkItemFactoryEntry ifentry = {
-               NULL, NULL, NULL, 0, "<Branch>"};
+       GList *amenu;
+       GtkItemFactoryEntry ifentry = {NULL, NULL, NULL, 0, "<Branch>"};
+
        ifentry.path = branch_path;
-       menuitem = gtk_item_factory_get_item(ifactory, branch_path);    
-       g_return_if_fail(menuitem);
-       /* FIXME: is there a better way to remove unknown submenu items? */
-       /* Deleting and recreating the parent looses the translation */
-       menu = GTK_WIDGET(GTK_MENU_ITEM(menuitem)->submenu);
-       if (GTK_MENU_SHELL(menu)->children) {
-               GList *amenu, *alist;
-               for (amenu = (GTK_MENU_SHELL(menu)->children); amenu; ) {
-                       alist = amenu->next;
-                       gtk_widget_destroy(GTK_WIDGET(amenu->data));
-                       amenu = alist;
-               }
+       menuitem = gtk_item_factory_get_widget(ifactory, branch_path);  
+       g_return_if_fail(menuitem != NULL);
+
+       amenu = GTK_MENU_SHELL(menuitem)->children;
+       while (amenu != NULL) {
+               GList *alist = amenu->next;
+               gtk_widget_destroy(GTK_WIDGET(amenu->data));
+               amenu = alist;
        }
 
        ifentry.accelerator     = NULL;
index 0951e37..5db0653 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2001 Hiroyuki Yamamoto & The Sylpheed Claws Team
+ * Copyright (C) 1999-2002 Hiroyuki Yamamoto & 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
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  */
 
-#ifndef ACTIONS_H
+#ifndef __ACTIONS_H__
+#define __ACTIONS_H__
 
-#define ACTIONS_H
 #include "mainwindow.h"
 
 void prefs_actions_read_config         (void);
 void prefs_actions_write_config                (void);
-void update_mainwin_actions_menu       (GtkItemFactory *ifactory, 
-                                        MainWindow *mainwin);
-void update_compose_actions_menu       (GtkItemFactory *ifactory, 
-                                        gchar *branch_path,
-                                        Compose *compose);
-void prefs_actions_open                        (MainWindow *mainwin);
-#endif
+void update_mainwin_actions_menu       (GtkItemFactory *ifactory, 
+                                        MainWindow     *mainwin);
+void update_compose_actions_menu       (GtkItemFactory *ifactory, 
+                                        gchar          *branch_path,
+                                        Compose        *compose);
+void prefs_actions_open                        (MainWindow     *mainwin);
 
+#endif /* __ACTIONS_H__ */