aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--ChangeLog.ja5
-rw-r--r--README3
-rw-r--r--README.ja2
-rw-r--r--src/logwindow.c36
-rw-r--r--src/prefs_common.c3
-rw-r--r--src/prefs_common.h2
7 files changed, 41 insertions, 16 deletions
diff --git a/ChangeLog b/ChangeLog
index f1105c4c..af22d59e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2005-02-23
+
+ * src/logwindow.c
+ src/prefs_common.[ch]: re-enabled the line number limit, and made
+ the value configurable.
+
2005-02-22
* src/codeconv.c:
diff --git a/ChangeLog.ja b/ChangeLog.ja
index c839469a..52e84167 100644
--- a/ChangeLog.ja
+++ b/ChangeLog.ja
@@ -1,3 +1,8 @@
+2005-02-23
+
+ * src/logwindow.c
+ src/prefs_common.[ch]: 行数制限を再度有効にし、値を設定可能にした。
+
2005-02-22
* src/codeconv.c:
diff --git a/README b/README
index 42603490..a156a6f6 100644
--- a/README
+++ b/README
@@ -186,6 +186,9 @@ bold_unread show unread messages using bold font in
folderview_vscrollbar_policy specify the policy of vertical scroll bar
of folder view
0: always 1: automatic 2: never [default: 0]
+logwindow_line_limit specify the limit of line numbers of log
+ window
+ 0: unlimited n (> 0): n lines [default: 1000]
Information
===========
diff --git a/README.ja b/README.ja
index 581c4a24..a10e9ad5 100644
--- a/README.ja
+++ b/README.ja
@@ -199,6 +199,8 @@ bold_unread サマリビューで未読メッセージをボールド
folderview_vscrollbar_policy フォルダビューの垂直スクロールバーのポリシー
を指定
0: 常に表示 1: 自動 2: 非表示 [デフォルト: 0]
+logwindow_line_limit ログウィンドウの行数制限を指定
+ 0: 無制限 n (> 0): n 行 [デフォルト: 1000]
情報
====
diff --git a/src/logwindow.c b/src/logwindow.c
index 41cdf254..277adfe3 100644
--- a/src/logwindow.c
+++ b/src/logwindow.c
@@ -1,6 +1,6 @@
/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2003 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2005 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
@@ -32,10 +32,10 @@
#include <gtk/gtkstyle.h>
#include "logwindow.h"
+#include "prefs_common.h"
#include "utils.h"
#include "gtkutils.h"
-#define MAX_LINES 500
#define TRIM_LINES 25
static LogWindow *logwindow;
@@ -91,7 +91,7 @@ LogWindow *log_window_create(void)
logwin->window = window;
logwin->scrolledwin = scrolledwin;
logwin->text = text;
- logwin->lines = 0;
+ logwin->lines = 1;
logwindow = logwin;
@@ -107,8 +107,6 @@ void log_window_init(LogWindow *logwin)
gboolean success[3];
gint i;
- //gtkut_widget_disable_theme_engine(logwin->text);
-
logwin->msg_color = color[0];
logwin->warn_color = color[1];
logwin->error_color = color[2];
@@ -147,30 +145,36 @@ void log_window_show(LogWindow *logwin)
GtkTextMark *mark;
buffer = gtk_text_view_get_buffer(text);
-
- gtk_widget_hide(logwin->window);
-
mark = gtk_text_buffer_get_mark(buffer, "end");
gtk_text_view_scroll_mark_onscreen(text, mark);
- gtk_widget_show(logwin->window);
+ gtk_window_present(GTK_WINDOW(logwin->window));
}
void log_window_append(const gchar *str, LogType type)
{
GtkTextView *text;
GtkTextBuffer *buffer;
- GtkTextMark *mark;
GtkTextIter iter;
GdkColor *color = NULL;
gchar *head = NULL;
const gchar *tag;
+ gint line_limit = prefs_common.logwin_line_limit;
g_return_if_fail(logwindow != NULL);
text = GTK_TEXT_VIEW(logwindow->text);
buffer = gtk_text_view_get_buffer(text);
- gtk_text_buffer_get_iter_at_offset(buffer, &iter, -1);
+
+ if (line_limit > 0 && logwindow->lines >= line_limit) {
+ GtkTextIter start, end;
+
+ gtk_text_buffer_get_start_iter(buffer, &start);
+ end = start;
+ gtk_text_iter_forward_lines(&end, TRIM_LINES);
+ gtk_text_buffer_delete(buffer, &start, &end);
+ logwindow->lines = gtk_text_buffer_get_line_count(buffer);
+ }
switch (type) {
case LOG_MSG:
@@ -193,9 +197,7 @@ void log_window_append(const gchar *str, LogType type)
break;
}
- if (logwindow->lines == MAX_LINES) {
- //
- }
+ gtk_text_buffer_get_end_iter(buffer, &iter);
if (head)
gtk_text_buffer_insert_with_tags_by_name
@@ -203,9 +205,11 @@ void log_window_append(const gchar *str, LogType type)
gtk_text_buffer_insert_with_tags_by_name
(buffer, &iter, str, -1, tag, NULL);
- mark = gtk_text_buffer_get_mark(buffer, "end");
- if (GTK_WIDGET_VISIBLE(text))
+ if (GTK_WIDGET_VISIBLE(text)) {
+ GtkTextMark *mark;
+ mark = gtk_text_buffer_get_mark(buffer, "end");
gtk_text_view_scroll_mark_onscreen(text, mark);
+ }
logwindow->lines++;
}
diff --git a/src/prefs_common.c b/src/prefs_common.c
index 459f1d00..3b9d7105 100644
--- a/src/prefs_common.c
+++ b/src/prefs_common.c
@@ -653,6 +653,9 @@ static PrefParam param[] = {
P_INT, &other.spinbtn_iotimeout,
prefs_set_data_from_spinbtn, prefs_set_spinbtn},
+ {"logwindow_line_limit", "1000", &prefs_common.logwin_line_limit,
+ P_INT, NULL, NULL, NULL},
+
{NULL, NULL, NULL, P_OTHER, NULL, NULL, NULL}
};
diff --git a/src/prefs_common.h b/src/prefs_common.h
index b8075649..259410a3 100644
--- a/src/prefs_common.h
+++ b/src/prefs_common.h
@@ -220,6 +220,8 @@ struct _PrefsCommon
gint io_timeout_secs;
+ gint logwin_line_limit;
+
/* Filtering */
GSList *fltlist;