0.8.6claws49
authorChristoph Hohmann <reboot@gmx.ch>
Mon, 2 Dec 2002 17:41:39 +0000 (17:41 +0000)
committerChristoph Hohmann <reboot@gmx.ch>
Mon, 2 Dec 2002 17:41:39 +0000 (17:41 +0000)
* doc-src/ui_seperation.txt     ** NEW **
        information for ui seperation

* src/Makefile.am
        remove files that were moved to common
        include common directory by default for the header files

* src/inc.c
* src/common/socket.c
* src/automaton.[ch]
        implement automaton using g_io_*-functions instead of
        gdk_input_add to make it ui independent

* src/codeconv.c
* src/compose.c
* src/ldif.c
* src/pgptext.c
* src/procmime.c
* src/rfc2015.c
* src/smtp.c
* src/unmime.c
        remove common/ prefix because directory is now in
        include path

* src/compose.c
* src/folder.c
* src/folderview.c
* src/mainwindow.c
* src/messageview.c
* src/prefs_common.c
* src/procmsg.c
* src/rfc2015.c
        fix warnings

* src/imap.c
* src/inc.c
* src/news.c
* src/pop.c
* src/send.c
* src/smtp.c
* src/ssl_certificate.c
        add log.h header file for logging functions

* src/main.c
* src/common/utils.c
* src/summaryview.c
* src/xml.c
        o move debug_mode to commno/utils.c
        o add functions to set and get debug_mode

* src/defs.h                    ** REMOVE **
* src/intl.h                    ** REMOVE **
* src/socket.[ch]               ** REMOVE **
* src/ssl.[ch]                  ** REMOVE **
* src/utils.[ch]                ** REMOVE **
        replaced by new files in src/common/

* src/common/Makefile.am
        add new files in src/common/

* src/common/defs.h             ** NEW **
* src/common/intl.h             ** NEW **
* src/common/log.[ch]           ** NEW **
* src/common/socket.[ch]        ** NEW **
* src/common/ssl.[ch]           ** NEW **
* src/common/utils.[ch]         ** NEW **
        replacement for files in src/

40 files changed:
ChangeLog.claws
configure.in
doc/src/ui_seperation.txt [new file with mode: 0644]
src/Makefile.am
src/automaton.c
src/automaton.h
src/codeconv.c
src/common/Makefile.am
src/common/defs.h [moved from src/defs.h with 100% similarity]
src/common/intl.h [moved from src/intl.h with 100% similarity]
src/common/log.c [new file with mode: 0644]
src/common/log.h [new file with mode: 0644]
src/common/socket.c [moved from src/socket.c with 97% similarity]
src/common/socket.h [moved from src/socket.h with 93% similarity]
src/common/ssl.c [moved from src/ssl.c with 95% similarity]
src/common/ssl.h [moved from src/ssl.h with 100% similarity]
src/common/utils.c [moved from src/utils.c with 95% similarity]
src/common/utils.h [moved from src/utils.h with 96% similarity]
src/compose.c
src/folder.c
src/folderview.c
src/imap.c
src/inc.c
src/ldif.c
src/main.c
src/mainwindow.c
src/messageview.c
src/news.c
src/pgptext.c
src/pop.c
src/prefs_common.c
src/procmime.c
src/procmsg.c
src/rfc2015.c
src/send.c
src/smtp.c
src/ssl_certificate.c
src/summaryview.c
src/unmime.c
src/xml.c

index 674f4c7..87093f4 100644 (file)
@@ -1,3 +1,73 @@
+2002-11-30 [christoph] 0.8.6claws49
+
+       * doc-src/ui_seperation.txt     ** NEW **
+               information for ui seperation
+
+       * src/Makefile.am
+               remove files that were moved to common
+               include common directory by default for the header files
+
+       * src/inc.c
+       * src/common/socket.c
+       * src/automaton.[ch]
+               implement automaton using g_io_*-functions instead of
+               gdk_input_add to make it ui independent
+
+       * src/codeconv.c
+       * src/compose.c
+       * src/ldif.c
+       * src/pgptext.c
+       * src/procmime.c
+       * src/rfc2015.c
+       * src/smtp.c
+       * src/unmime.c
+               remove common/ prefix because directory is now in
+               include path
+
+       * src/compose.c
+       * src/folder.c
+       * src/folderview.c
+       * src/mainwindow.c
+       * src/messageview.c
+       * src/prefs_common.c
+       * src/procmsg.c
+       * src/rfc2015.c
+               fix warnings
+
+       * src/imap.c
+       * src/inc.c
+       * src/news.c
+       * src/pop.c
+       * src/send.c
+       * src/smtp.c
+       * src/ssl_certificate.c
+               add log.h header file for logging functions
+
+       * src/main.c
+       * src/common/utils.c
+       * src/summaryview.c
+       * src/xml.c
+               o move debug_mode to commno/utils.c
+               o add functions to set and get debug_mode
+
+       * src/defs.h                    ** REMOVE **
+       * src/intl.h                    ** REMOVE **
+       * src/socket.[ch]               ** REMOVE **
+       * src/ssl.[ch]                  ** REMOVE **
+       * src/utils.[ch]                ** REMOVE **
+               replaced by new files in src/common/
+       
+       * src/common/Makefile.am
+               add new files in src/common/
+
+       * src/common/defs.h             ** NEW **
+       * src/common/intl.h             ** NEW **
+       * src/common/log.[ch]           ** NEW **
+       * src/common/socket.[ch]        ** NEW **
+       * src/common/ssl.[ch]           ** NEW **
+       * src/common/utils.[ch]         ** NEW **
+               replacement for files in src/
+
 2002-11-30 [colin]     0.8.6claws48
 
        * src/folderview.c
index a7dfe69..0e885db 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=8
 MICRO_VERSION=6
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws48
+EXTRA_VERSION=claws49
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl set $target
diff --git a/doc/src/ui_seperation.txt b/doc/src/ui_seperation.txt
new file mode 100644 (file)
index 0000000..e4f4381
--- /dev/null
@@ -0,0 +1,19 @@
+This is a table of old and new files to find functions when
+files have been splitted into several files for seperation
+
+old                    new                     state
+
+base64.[ch]            common/base64.[ch]      ok
+
+uuencode.[ch]          common/uuencode.[ch]    ok
+
+utils.[ch]             common/utils.[ch]       ok
+                       common/log.[ch]         FIXME
+
+socket.[ch]            common/socket.[ch]      ok
+
+ssl.[ch]               common/ssl.[ch]         FIXME
+
+intl.h                 common/intl.h           ok
+
+defs.h                 common/defs.h           ok
index fb86425..04e73d7 100644 (file)
@@ -86,13 +86,10 @@ sylpheed_SOURCES = \
        grouplistdialog.c grouplistdialog.h \
        about.c about.h \
        setup.c setup.h \
-       utils.c utils.h \
        gtkutils.c gtkutils.h \
        codeconv.c codeconv.h \
        unmime.c unmime.h \
        md5.c md5.h \
-       socket.c socket.h \
-       ssl.c ssl.h \
        ssl_certificate.c ssl_certificate.h \
        ssl_manager.c ssl_manager.h \
        automaton.c automaton.h \
@@ -219,6 +216,7 @@ EXTRA_DIST = \
        pixmaps/quicksearch.xpm
 
 INCLUDES = \
+       -Icommon \
        -DG_LOG_DOMAIN=\"Sylpheed\" \
        -I$(top_srcdir)/intl \
         $(ASPELL_CFLAGS)    \
index d6f0808..b71a5fb 100644 (file)
@@ -44,8 +44,9 @@ void automaton_destroy(Automaton *atm)
        g_free(atm);
 }
 
-void automaton_input_cb(gpointer data, gint dummy_source,
-                       GdkInputCondition condition)
+gboolean automaton_input_cb(GIOChannel *channel,
+                       GIOCondition condition,
+                       gpointer data)
 {
        Automaton *atm = (Automaton *)data;
        SockInfo *sock;
@@ -55,7 +56,7 @@ void automaton_input_cb(gpointer data, gint dummy_source,
         * passed file descriptor because we can't map that one back
         * to the sockinfo */
        sock = atm->help_sock;
-       g_return_if_fail(sock->sock == dummy_source);
+       g_return_val_if_fail(sock->sock == g_io_channel_unix_get_fd(channel), TRUE);
 
        if (atm->timeout_tag > 0) {
                gtk_timeout_remove(atm->timeout_tag);
@@ -67,7 +68,7 @@ void automaton_input_cb(gpointer data, gint dummy_source,
 
        if (atm->cancelled) {
                atm->terminate(sock, data);
-               return;
+               return TRUE;
        }
 
        if (atm->ui_func)
@@ -75,19 +76,21 @@ void automaton_input_cb(gpointer data, gint dummy_source,
        next = atm->state[atm->num].handler(sock, atm->data);
 
        if (atm->terminated)
-               return;
+               return TRUE;
        if (atm->cancelled) {
                atm->terminate(sock, data);
-               return;
+               return TRUE;
        }
 
        if (next >= 0 && next <= atm->max && next != atm->num) {
                atm->num = next;
-               atm->tag = sock_gdk_input_add(sock,
-                                        atm->state[atm->num].condition,       
-                                        automaton_input_cb,
-                                        data);
+               atm->tag = sock_input_add(sock,
+                                         atm->state[atm->num].condition,       
+                                         automaton_input_cb,
+                                         data);
        } else {
                atm->terminate(sock, data);
        }
+
+       return TRUE;
 }
index 17e0fb8..97be9ff 100644 (file)
@@ -34,7 +34,7 @@ typedef void  (*AtmUIFunc)    (gpointer        data,
 
 struct _AtmState
 {
-       GdkInputCondition condition;
+       GIOCondition     condition;
        gint (*handler) (SockInfo       *source,
                         gpointer        data);
 };
@@ -62,8 +62,8 @@ struct _Automaton
 
 Automaton *automaton_create    (gint                    num);
 void automaton_destroy         (Automaton              *atm);
-void automaton_input_cb                (gpointer                data,
-                                gint                    dummy_source,
-                                GdkInputCondition       condition);
+gboolean automaton_input_cb    (GIOChannel             *channel,
+                                GIOCondition            condition,
+                                gpointer                data);
 
 #endif /* __AUTOMATON_H__ */
index 7153838..b9d381e 100644 (file)
@@ -42,7 +42,7 @@
 #include "intl.h"
 #include "codeconv.h"
 #include "unmime.h"
-#include "common/base64.h"
+#include "base64.h"
 #include "utils.h"
 #include "prefs_common.h"
 
index 7927685..6c6619d 100644 (file)
@@ -1,8 +1,12 @@
 noinst_LTLIBRARIES = libsylpheedcommon.la
 
 libsylpheedcommon_la_SOURCES = \
+       utils.c utils.h \
        base64.c base64.h \
-       uuencode.c uuencode.h
+       uuencode.c uuencode.h \
+       socket.c socket.h \
+       ssl.c ssl.h \
+       log.c log.h
 
 INCLUDES = \
        $(GLIB_CFLAGS)
similarity index 100%
rename from src/defs.h
rename to src/common/defs.h
similarity index 100%
rename from src/intl.h
rename to src/common/intl.h
diff --git a/src/common/log.c b/src/common/log.c
new file mode 100644 (file)
index 0000000..34dc0e4
--- /dev/null
@@ -0,0 +1,169 @@
+/*
+ * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
+ * 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
+ * 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
+
+#include <stdio.h>
+#include <glib.h>
+
+#include "defs.h"
+#include "utils.h"
+
+static FILE *log_fp = NULL;
+
+void set_log_file(const gchar *filename)
+{
+       if (log_fp) return;
+       log_fp = fopen(filename, "wb");
+       if (!log_fp)
+               FILE_OP_ERROR(filename, "fopen");
+}
+
+void close_log_file(void)
+{
+       if (log_fp) {
+               fclose(log_fp);
+               log_fp = NULL;
+       }
+}
+
+static guint log_verbosity_count = 0;
+
+void log_verbosity_set(gboolean verbose)
+{
+       if (verbose)
+               log_verbosity_count++;
+       else if (log_verbosity_count > 0)
+               log_verbosity_count--;
+}
+
+#define TIME_LEN       11
+
+void log_print(const gchar *format, ...)
+{
+       va_list args;
+       gchar buf[BUFFSIZE + TIME_LEN];
+       time_t t;
+
+       time(&t);
+       strftime(buf, TIME_LEN + 1, "[%H:%M:%S] ", localtime(&t));
+
+       va_start(args, format);
+       g_vsnprintf(buf + TIME_LEN, BUFFSIZE, format, args);
+       va_end(args);
+
+       if (debug_get_mode()) fputs(buf, stdout);
+/*     FIXME:
+       callback for gui logging
+
+       log_window_append(buf, LOG_NORMAL); */
+       if (log_fp) {
+               fputs(buf, log_fp);
+               fflush(log_fp);
+       }
+/*     FIXME:
+       callback for gui logging
+
+       if (log_verbosity_count)
+               statusbar_puts_all(buf + TIME_LEN); */
+}
+
+void log_message(const gchar *format, ...)
+{
+       va_list args;
+       gchar buf[BUFFSIZE + TIME_LEN];
+       time_t t;
+
+       time(&t);
+       strftime(buf, TIME_LEN + 1, "[%H:%M:%S] ", localtime(&t));
+
+       va_start(args, format);
+       g_vsnprintf(buf + TIME_LEN, BUFFSIZE, format, args);
+       va_end(args);
+
+       if (debug_get_mode()) g_message("%s", buf + TIME_LEN);
+/*     FIXME:
+       callback for gui logging
+
+       log_window_append(buf + TIME_LEN, LOG_MSG); */
+       if (log_fp) {
+               fwrite(buf, TIME_LEN, 1, log_fp);
+               fputs("* message: ", log_fp);
+               fputs(buf + TIME_LEN, log_fp);
+               fflush(log_fp);
+       }
+/*     FIXME:
+       callback for gui logging
+
+       statusbar_puts_all(buf + TIME_LEN); */
+}
+
+void log_warning(const gchar *format, ...)
+{
+       va_list args;
+       gchar buf[BUFFSIZE + TIME_LEN];
+       time_t t;
+
+       time(&t);
+       strftime(buf, TIME_LEN + 1, "[%H:%M:%S] ", localtime(&t));
+
+       va_start(args, format);
+       g_vsnprintf(buf + TIME_LEN, BUFFSIZE, format, args);
+       va_end(args);
+
+       g_warning("%s", buf);
+/*     FIXME:
+       callback for gui logging
+
+       log_window_append(buf + TIME_LEN, LOG_WARN); */
+       if (log_fp) {
+               fwrite(buf, TIME_LEN, 1, log_fp);
+               fputs("** warning: ", log_fp);
+               fputs(buf + TIME_LEN, log_fp);
+               fflush(log_fp);
+       }
+}
+
+void log_error(const gchar *format, ...)
+{
+       va_list args;
+       gchar buf[BUFFSIZE + TIME_LEN];
+       time_t t;
+
+       time(&t);
+       strftime(buf, TIME_LEN + 1, "[%H:%M:%S] ", localtime(&t));
+
+       va_start(args, format);
+       g_vsnprintf(buf + TIME_LEN, BUFFSIZE, format, args);
+       va_end(args);
+
+       g_warning("%s", buf);
+/*     FIXME:
+       callback for gui logging
+
+       log_window_append(buf + TIME_LEN, LOG_ERROR); */
+       if (log_fp) {
+               fwrite(buf, TIME_LEN, 1, log_fp);
+               fputs("*** error: ", log_fp);
+               fputs(buf + TIME_LEN, log_fp);
+               fflush(log_fp);
+       }
+}
diff --git a/src/common/log.h b/src/common/log.h
new file mode 100644 (file)
index 0000000..2523d65
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
+ * 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
+ * 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 LOG_H
+#define LOG_H
+
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
+
+#include <glib.h>
+
+/* logging */
+void set_log_file      (const gchar *filename);
+void close_log_file    (void);
+void log_verbosity_set (gboolean verbose);
+void log_print         (const gchar *format, ...) G_GNUC_PRINTF(1, 2);
+void log_message       (const gchar *format, ...) G_GNUC_PRINTF(1, 2);
+void log_warning       (const gchar *format, ...) G_GNUC_PRINTF(1, 2);
+void log_error         (const gchar *format, ...) G_GNUC_PRINTF(1, 2);
+
+#endif /* LOG_H */
similarity index 97%
rename from src/socket.c
rename to src/common/socket.c
index c0430a2..e9bbef2 100644 (file)
@@ -43,6 +43,7 @@
 
 #include "socket.h"
 #include "utils.h"
+#include "log.h"
 #if USE_SSL
 #  include "ssl.h"
 #endif
@@ -709,14 +710,21 @@ gint fd_close(gint fd)
        return close(fd);
 }
 
-gint sock_gdk_input_add(SockInfo *sock,
-                       GdkInputCondition condition,
-                       GdkInputFunction function,
-                       gpointer data)
+gint sock_input_add(SockInfo *sock,
+                   GIOCondition condition,
+                   GIOFunc function,
+                   gpointer data)
 {
+       GIOChannel *channel;
+       guint result;
+
        g_return_val_if_fail(sock != NULL, -1);
 
+       channel = g_io_channel_unix_new(sock->sock);
        /* :WK: We have to change some things here becuse most likey
           function() does take SockInfo * and not an gint */
-       return gdk_input_add(sock->sock, condition, function, data);
+       result = g_io_add_watch(channel, condition, function, data);
+       g_io_channel_unref(channel);
+
+       return result;
 }
similarity index 93%
rename from src/socket.h
rename to src/common/socket.h
index ba0fb19..733eac2 100644 (file)
@@ -25,7 +25,6 @@
 #endif
 
 #include <glib.h>
-#include <gdk/gdk.h> /* ugly, just needed for the GdkInputCondition et al. */
 #include <netdb.h>
 
 typedef struct _SockInfo       SockInfo;
@@ -79,9 +78,9 @@ gint sock_puts                (SockInfo *sock, const gchar *buf);
 gint sock_close                (SockInfo *sock);
 
 /* wrapper functions */
-gint sock_gdk_input_add          (SockInfo             *sock,
-                          GdkInputCondition     condition,
-                          GdkInputFunction      function,
+gint sock_input_add      (SockInfo             *sock,
+                          GIOCondition          condition,
+                          GIOFunc               function,
                           gpointer              data);
 
 /* Functions to directly work on FD.  They are needed for pipes */
similarity index 95%
rename from src/ssl.c
rename to src/common/ssl.c
index 7c4c07e..5383bcd 100644 (file)
--- a/src/ssl.c
@@ -30,7 +30,8 @@
 #include "intl.h"
 #include "utils.h"
 #include "ssl.h"
-#include "ssl_certificate.h"
+#include "log.h"
+/* #include "ssl_certificate.h" */
 
 static SSL_CTX *ssl_ctx;
 
@@ -108,12 +109,17 @@ gboolean ssl_init_socket_with_method(SockInfo *sockinfo, SSLMethod method)
                return FALSE;
        }
 
+/*     FIXME
+
+       gui independant certificate check and callback for
+       gui for user accepted certificates
+       
        if (!ssl_certificate_check(server_cert, sockinfo->hostname, sockinfo->port)) {
                X509_free(server_cert);
                SSL_free(ssl);
                return FALSE;
        }
-       
+*/
        X509_free(server_cert);
        sockinfo->ssl = ssl;
 
similarity index 100%
rename from src/ssl.h
rename to src/common/ssl.h
similarity index 95%
rename from src/utils.c
rename to src/common/utils.c
index 6cb751a..7016e41 100644 (file)
 #include "intl.h"
 #include "utils.h"
 #include "socket.h"
-#include "statusbar.h"
-#include "logwindow.h"
 
 #define BUFFSIZE       8192
 
-extern gboolean debug_mode;
+static gboolean debug_mode = FALSE;
 
 static void hash_free_strings_func(gpointer key, gpointer value, gpointer data);
 
@@ -2946,32 +2944,14 @@ void get_rfc822_date(gchar *buf, gint len)
                   day, dd, mon, yyyy, hh, mm, ss, tzoffset(&t));
 }
 
-static FILE *log_fp = NULL;
-
-void set_log_file(const gchar *filename)
+void debug_set_mode(gboolean mode)
 {
-       if (log_fp) return;
-       log_fp = fopen(filename, "wb");
-       if (!log_fp)
-               FILE_OP_ERROR(filename, "fopen");
+       debug_mode = mode;
 }
 
-void close_log_file(void)
+gboolean debug_get_mode()
 {
-       if (log_fp) {
-               fclose(log_fp);
-               log_fp = NULL;
-       }
-}
-
-static guint log_verbosity_count = 0;
-
-void log_verbosity_set(gboolean verbose)
-{
-       if (verbose)
-               log_verbosity_count++;
-       else if (log_verbosity_count > 0)
-               log_verbosity_count--;
+       return debug_mode;
 }
 
 void debug_print_real(const gchar *format, ...)
@@ -2988,102 +2968,6 @@ void debug_print_real(const gchar *format, ...)
        fputs(buf, stdout);
 }
 
-#define TIME_LEN       11
-
-void log_print(const gchar *format, ...)
-{
-       va_list args;
-       gchar buf[BUFFSIZE + TIME_LEN];
-       time_t t;
-
-       time(&t);
-       strftime(buf, TIME_LEN + 1, "[%H:%M:%S] ", localtime(&t));
-
-       va_start(args, format);
-       g_vsnprintf(buf + TIME_LEN, BUFFSIZE, format, args);
-       va_end(args);
-
-       if (debug_mode) fputs(buf, stdout);
-       log_window_append(buf, LOG_NORMAL);
-       if (log_fp) {
-               fputs(buf, log_fp);
-               fflush(log_fp);
-       }
-       if (log_verbosity_count)
-               statusbar_puts_all(buf + TIME_LEN);
-}
-
-void log_message(const gchar *format, ...)
-{
-       va_list args;
-       gchar buf[BUFFSIZE + TIME_LEN];
-       time_t t;
-
-       time(&t);
-       strftime(buf, TIME_LEN + 1, "[%H:%M:%S] ", localtime(&t));
-
-       va_start(args, format);
-       g_vsnprintf(buf + TIME_LEN, BUFFSIZE, format, args);
-       va_end(args);
-
-       if (debug_mode) g_message("%s", buf + TIME_LEN);
-       log_window_append(buf + TIME_LEN, LOG_MSG);
-       if (log_fp) {
-               fwrite(buf, TIME_LEN, 1, log_fp);
-               fputs("* message: ", log_fp);
-               fputs(buf + TIME_LEN, log_fp);
-               fflush(log_fp);
-       }
-       statusbar_puts_all(buf + TIME_LEN);
-}
-
-void log_warning(const gchar *format, ...)
-{
-       va_list args;
-       gchar buf[BUFFSIZE + TIME_LEN];
-       time_t t;
-
-       time(&t);
-       strftime(buf, TIME_LEN + 1, "[%H:%M:%S] ", localtime(&t));
-
-       va_start(args, format);
-       g_vsnprintf(buf + TIME_LEN, BUFFSIZE, format, args);
-       va_end(args);
-
-       g_warning("%s", buf);
-       log_window_append(buf + TIME_LEN, LOG_WARN);
-       if (log_fp) {
-               fwrite(buf, TIME_LEN, 1, log_fp);
-               fputs("** warning: ", log_fp);
-               fputs(buf + TIME_LEN, log_fp);
-               fflush(log_fp);
-       }
-}
-
-void log_error(const gchar *format, ...)
-{
-       va_list args;
-       gchar buf[BUFFSIZE + TIME_LEN];
-       time_t t;
-
-       time(&t);
-       strftime(buf, TIME_LEN + 1, "[%H:%M:%S] ", localtime(&t));
-
-       va_start(args, format);
-       g_vsnprintf(buf + TIME_LEN, BUFFSIZE, format, args);
-       va_end(args);
-
-       g_warning("%s", buf);
-       log_window_append(buf + TIME_LEN, LOG_ERROR);
-       if (log_fp) {
-               fwrite(buf, TIME_LEN, 1, log_fp);
-               fputs("*** error: ", log_fp);
-               fputs(buf + TIME_LEN, log_fp);
-               fflush(log_fp);
-       }
-}
-
-
 void * subject_table_lookup(GHashTable *subject_table, gchar * subject)
 {
        if (subject == NULL)
similarity index 96%
rename from src/utils.h
rename to src/common/utils.h
index 883223a..260fbb3 100644 (file)
        perror(func); \
 }
 
+/* debug functions */
+void debug_set_mode            (gboolean mode);
+gboolean debug_get_mode                ();
 #define debug_print \
        debug_print_real(__FILE__ ":%d:", __LINE__), \
        debug_print_real
@@ -382,15 +385,8 @@ gchar *tzoffset                    (time_t         *now);
 void get_rfc822_date           (gchar          *buf,
                                 gint            len);
 
-/* logging */
-void set_log_file      (const gchar *filename);
-void close_log_file    (void);
-void log_verbosity_set (gboolean verbose);
+/* debugging */
 void debug_print_real  (const gchar *format, ...) G_GNUC_PRINTF(1, 2);
-void log_print         (const gchar *format, ...) G_GNUC_PRINTF(1, 2);
-void log_message       (const gchar *format, ...) G_GNUC_PRINTF(1, 2);
-void log_warning       (const gchar *format, ...) G_GNUC_PRINTF(1, 2);
-void log_error         (const gchar *format, ...) G_GNUC_PRINTF(1, 2);
 
 /* subject threading */
 void * subject_table_lookup(GHashTable *subject_table, gchar * subject);
index b2715fd..b0dcded 100644 (file)
@@ -91,7 +91,7 @@
 #include "procmime.h"
 #include "statusbar.h"
 #include "about.h"
-#include "common/base64.h"
+#include "base64.h"
 #include "codeconv.h"
 #include "utils.h"
 #include "gtkutils.h"
@@ -5073,7 +5073,6 @@ static void compose_toolbar_create(Compose   *compose,
        ToolbarSylpheedActions *action_item;
        GSList *cur;
        GSList *toolbar_list;
-       GList *elem;
        toolbar_tips = gtk_tooltips_new();
        
        toolbar_read_config_file(TOOLBAR_COMPOSE);
index 28770c6..ea04318 100644 (file)
@@ -1590,8 +1590,8 @@ FolderItem *folder_item_move_recursive (FolderItem *src, FolderItem *dest)
 gint folder_item_move_to(FolderItem *src, FolderItem *dest, FolderItem **new_item)
 {
        FolderItem *tmp = dest->parent;
-       char * src_identifier, * dst_identifier, * new_identifier;
-       char * phys_srcpath, * phys_dstpath;
+       gchar * src_identifier, * dst_identifier;
+       gchar * phys_srcpath, * phys_dstpath;
        GNode *src_node;
        
        while (tmp) {
index 4fb7377..06766ff 100644 (file)
@@ -2754,10 +2754,6 @@ static void folderview_drag_received_cb(GtkWidget        *widget,
        } else {
                /* comes from folderview */
                char *source;
-               char *buf;
-               gint status;
-               GtkCTreeNode *src_node;
-               FolderItem *new_item, *src_parent;
                
                source = data->data + 17;
                if (gtk_clist_get_selection_info
index 0cbdc9d..b20f6cb 100644 (file)
@@ -48,6 +48,7 @@
 #include "codeconv.h"
 #include "utils.h"
 #include "inputdialog.h"
+#include "log.h"
 
 #define IMAP4_PORT     143
 #if USE_SSL
index 182d468..45aa4d6 100644 (file)
--- a/src/inc.c
+++ b/src/inc.c
@@ -65,6 +65,7 @@
 #include "folder.h"
 #include "filtering.h"
 #include "selective_download.h"
+#include "log.h"
 
 static GList *inc_dialog_list = NULL;
 
@@ -727,10 +728,10 @@ static IncState inc_pop3_session_do(IncSession *session)
 
        for (i = POP3_GREETING_RECV; i < N_POP3_PHASE; i++)
                atm->state[i].handler = handlers[i];
-       atm->state[POP3_GREETING_RECV].condition = GDK_INPUT_READ;
+       atm->state[POP3_GREETING_RECV].condition = (G_IO_IN | G_IO_HUP | G_IO_ERR);
        for (i = POP3_GREETING_RECV + 1; i < N_POP3_PHASE; ) {
-               atm->state[i++].condition = GDK_INPUT_WRITE;
-               atm->state[i++].condition = GDK_INPUT_READ;
+               atm->state[i++].condition = (G_IO_OUT | G_IO_ERR);
+               atm->state[i++].condition = (G_IO_IN | G_IO_HUP | G_IO_ERR);
        }
 
        atm->terminate = (AtmHandler)pop3_automaton_terminate;
@@ -798,9 +799,9 @@ static IncState inc_pop3_session_do(IncSession *session)
        */
        recv_set_ui_func(inc_pop3_recv_func, session);
 
-       atm->tag = sock_gdk_input_add(sockinfo,
-                                     atm->state[atm->num].condition,
-                                     automaton_input_cb, atm);
+       atm->tag = sock_input_add(sockinfo,
+                                 atm->state[atm->num].condition,
+                                 automaton_input_cb, atm);
 
        while (!atm->terminated && !atm->cancelled)
                gtk_main_iteration();
index f51cf82..7ad132f 100644 (file)
@@ -31,7 +31,7 @@
 #include "addritem.h"
 #include "addrcache.h"
 
-#include "common/base64.h"
+#include "base64.h"
 
 /*
 * Create new object.
index 4d8748e..7a7776d 100644 (file)
@@ -73,6 +73,7 @@
 #include "setup.h"
 #include "utils.h"
 #include "gtkutils.h"
+#include "log.h"
 
 #if USE_GPGME
 #  include "rfc2015.h"
@@ -88,7 +89,6 @@
 gchar *prog_version;
 gchar *startup_dir;
 gchar *argv0;
-gboolean debug_mode = FALSE;
 
 static gint lock_socket = -1;
 static gint lock_socket_tag = 0;
@@ -383,7 +383,7 @@ static void parse_cmd_opt(int argc, char *argv[])
 
        for (i = 1; i < argc; i++) {
                if (!strncmp(argv[i], "--debug", 7))
-                       debug_mode = TRUE;
+                       debug_set_mode(TRUE);
                else if (!strncmp(argv[i], "--receive-all", 13))
                        cmd.receive_all = TRUE;
                else if (!strncmp(argv[i], "--receive", 9))
index 1d8d02b..5a4bdf0 100644 (file)
@@ -246,9 +246,6 @@ static void toolbar_reply_to_sender_cb      (GtkWidget      *widget,
 static void toolbar_forward_cb         (GtkWidget      *widget,
                                         gpointer        data);
 
-static void toolbar_delete_cb          (GtkWidget      *widget,
-                                        gpointer        data);
-
 static void toolbar_exec_cb            (GtkWidget      *widget,
                                         gpointer        data);
 
@@ -2379,14 +2376,6 @@ static void toolbar_forward_cb(GtkWidget *widget,
                reply_cb(mainwin, COMPOSE_FORWARD, NULL);
 }
 
-static void toolbar_delete_cb(GtkWidget          *widget,
-                             gpointer     data)
-{
-       MainWindow *mainwin = (MainWindow *)data;
-
-       summary_delete(mainwin->summaryview);
-}
-
 static void toolbar_exec_cb(GtkWidget  *widget,
                            gpointer     data)
 {
index 78f83cc..1b3701e 100644 (file)
@@ -90,9 +90,6 @@ static void messageview_close_cb      (gpointer        data,
                                         guint           action,
                                         GtkWidget      *widget);
 
-static void set_toolbar_style(MessageView *messageview);
-
-
 MessageView *messageview_create(MainWindow *mainwin)
 {
        MessageView *messageview;
@@ -832,7 +829,6 @@ static void messageview_toolbar_create(MessageView   *messageview,
        ToolbarSylpheedActions *action_item;
        GSList *cur;
        GSList *toolbar_list;
-       GList *elem;
        toolbar_tips = gtk_tooltips_new();
        
        toolbar_read_config_file(TOOLBAR_MSGVIEW);
index fd1fe87..0cd38d1 100644 (file)
@@ -47,6 +47,7 @@
 #include "prefs_account.h"
 #include "inputdialog.h"
 #include "alertpanel.h"
+#include "log.h"
 #if USE_SSL
 #  include "ssl.h"
 #endif
index 952d3d7..bbfd76d 100644 (file)
@@ -36,8 +36,8 @@
 #include "intl.h"
 #include "procmime.h"
 #include "procheader.h"
-#include "common/base64.h"
-#include "common/uuencode.h"
+#include "base64.h"
+#include "uuencode.h"
 #include "unmime.h"
 #include "codeconv.h"
 #include "utils.h"
index 13e31c0..cede2ce 100644 (file)
--- a/src/pop.c
+++ b/src/pop.c
@@ -39,6 +39,7 @@
 #include "inc.h"
 #include "recv.h"
 #include "selective_download.h"
+#include "log.h"
 #if USE_SSL
 #  include "ssl.h"
 #endif
index 502ba01..9f15f7b 100644 (file)
@@ -2632,10 +2632,7 @@ static void prefs_interface_create(void)
 
        GtkWidget *button_keybind;
 
-       GtkWidget *hbox2;
        GtkWidget *optmenu_nextunreadmsgdialog;
-       GtkWidget *optmenu_nextunreadmsgdialog_menu;
-       GtkWidget *nextunreadmsgdialog_menuitem;
 
        GtkWidget *frame_pixmap_theme;
        GtkWidget *vbox_pixmap_theme;
index 0e98c97..bb288fd 100644 (file)
@@ -32,8 +32,8 @@
 #include "intl.h"
 #include "procmime.h"
 #include "procheader.h"
-#include "common/base64.h"
-#include "common/uuencode.h"
+#include "base64.h"
+#include "uuencode.h"
 #include "unmime.h"
 #include "html.h"
 #include "enriched.h"
index 8508388..0253f16 100644 (file)
@@ -1488,8 +1488,8 @@ void procmsg_msginfo_set_flags(MsgInfo *msginfo, MsgPermFlags perm_flags, MsgTmp
                        item->unreadmarked--;
                        item->need_update = TRUE;
                }
-               if ((perm_flags & MSG_MARKED) || MSG_IS_MARKED(msginfo->flags)
-               && !MSG_IS_IGNORE_THREAD(msginfo->flags)) {
+               if ((perm_flags & MSG_MARKED) || (MSG_IS_MARKED(msginfo->flags)
+               && !MSG_IS_IGNORE_THREAD(msginfo->flags))) {
                        procmsg_update_unread_children(msginfo, FALSE);
                }
 
index 7087dc0..6509f55 100644 (file)
@@ -36,8 +36,8 @@
 #include "intl.h"
 #include "procmime.h"
 #include "procheader.h"
-#include "common/base64.h"
-#include "common/uuencode.h"
+#include "base64.h"
+#include "uuencode.h"
 #include "unmime.h"
 #include "codeconv.h"
 #include "utils.h"
@@ -223,7 +223,6 @@ sig_status_for_key(GString *str, GpgmeCtx ctx, GpgmeSigStat status,
 {
        gint idx = 0;
        const char *uid;
-       unsigned long exp_time;
 
        uid = gpgme_key_get_string_attr (key, GPGME_ATTR_USERID, NULL, idx);
        if (uid == NULL) {
index 1ce2082..e0ee7d2 100644 (file)
@@ -52,6 +52,7 @@
 #include "gtkutils.h"
 #include "statusbar.h"
 #include "inc.h"
+#include "log.h"
 
 typedef struct _SendProgressDialog     SendProgressDialog;
 
index 674425e..b361281 100644 (file)
@@ -29,8 +29,9 @@
 #include "smtp.h"
 #include "socket.h"
 #include "md5.h"
-#include "common/base64.h"
+#include "base64.h"
 #include "utils.h"
+#include "log.h"
 
 static gint verbose = 1;
 
index 328f6f7..ab02fa3 100644 (file)
@@ -31,6 +31,7 @@
 #include "intl.h"
 #include "prefs_common.h"
 #include "socket.h"
+#include "log.h"
 
 static char *ssl_certificate_check_signer (X509 *cert); 
 static SSLCertificate *ssl_certificate_new_lookup(X509 *x509_cert, gchar *host, gushort port, gboolean lookup);
index 3a335f1..ff87ecc 100644 (file)
@@ -2201,7 +2201,7 @@ static void summary_set_ctree_from_list(SummaryView *summaryview,
 
        debug_print("done.\n");
        STATUSBAR_POP(summaryview->mainwin);
-       if (debug_mode) {
+       if (debug_get_mode()) {
                debug_print("\tmsgid hash table size = %d\n",
                            g_hash_table_size(msgid_table));
                debug_print("\tsubject hash table size = %d\n",
index eeba2af..1ba54c1 100644 (file)
@@ -26,7 +26,7 @@
 #include <ctype.h>
 
 #include "codeconv.h"
-#include "common/base64.h"
+#include "base64.h"
 
 #define ENCODED_WORD_BEGIN     "=?"
 #define ENCODED_WORD_END       "?="
index ee8dcc3..668ee48 100644 (file)
--- a/src/xml.c
+++ b/src/xml.c
@@ -151,7 +151,7 @@ GNode *xml_parse_file(const gchar *path)
        xml_close_file(file);
 
 #if defined(SPARSE_MEMORY)
-       if (debug_mode)
+       if (debug_get_mode())
                string_table_get_stats(xml_string_table);
 #endif