aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog9
-rw-r--r--ChangeLog.ja9
-rw-r--r--libsylph/procheader.c4
-rw-r--r--libsylph/utils.c15
-rw-r--r--libsylph/utils.h3
-rw-r--r--src/folderview.c19
-rw-r--r--src/summaryview.c31
7 files changed, 64 insertions, 26 deletions
diff --git a/ChangeLog b/ChangeLog
index 432b7290..4471cd61 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2006-03-27
+
+ * libsylph/utils.[ch]: subst_control(): new.
+ * libsylph/procheader.c: procheader_parse_stream(): remove control
+ characters from headers.
+ * src/folderview.c
+ src/summaryview.c: fixed a bug that bold face was disabled with
+ GLib 2.10 and Pango 1.12.
+
2006-03-24
* src/summaryview.[ch]: added the clear button for quick search entry.
diff --git a/ChangeLog.ja b/ChangeLog.ja
index 8862fa27..9f988bb8 100644
--- a/ChangeLog.ja
+++ b/ChangeLog.ja
@@ -1,3 +1,12 @@
+2006-03-27
+
+ * libsylph/utils.[ch]: subst_control(): 新規。
+ * libsylph/procheader.c: procheader_parse_stream(): ヘッダからコント
+ ロール文字を除去。
+ * src/folderview.c
+ src/summaryview.c: GLib 2.10 と Pango 1.12 でボールド表示が無効に
+ なっていたバグを修正。
+
2006-03-24
* src/summaryview.[ch]: クイックサーチエントリのクリアボタンを追加。
diff --git a/libsylph/procheader.c b/libsylph/procheader.c
index cf9d481e..84c5f36d 100644
--- a/libsylph/procheader.c
+++ b/libsylph/procheader.c
@@ -687,19 +687,23 @@ MsgInfo *procheader_parse_stream(FILE *fp, MsgFlags flags, gboolean full)
if (from) {
msginfo->from = conv_unmime_header(from, charset);
+ subst_control(msginfo->from, ' ');
msginfo->fromname = procheader_get_fromname(msginfo->from);
g_free(from);
}
if (to) {
msginfo->to = conv_unmime_header(to, charset);
+ subst_control(msginfo->to, ' ');
g_free(to);
}
if (subject) {
msginfo->subject = conv_unmime_header(subject, charset);
+ subst_control(msginfo->subject, ' ');
g_free(subject);
}
if (cc) {
msginfo->cc = conv_unmime_header(cc, charset);
+ subst_control(msginfo->cc, ' ');
g_free(cc);
}
diff --git a/libsylph/utils.c b/libsylph/utils.c
index 914fd007..3cee525e 100644
--- a/libsylph/utils.c
+++ b/libsylph/utils.c
@@ -1079,7 +1079,7 @@ void subst_chars(gchar *str, gchar *orig, gchar subst)
while (*p) {
if (strchr(orig, *p) != NULL)
*p = subst;
- p++;
+ ++p;
}
}
@@ -1090,7 +1090,18 @@ void subst_null(gchar *str, gint len, gchar subst)
while (len--) {
if (*p == '\0')
*p = subst;
- p++;
+ ++p;
+ }
+}
+
+void subst_control(gchar *str, gchar subst)
+{
+ register gchar *p = str;
+
+ while (*p) {
+ if (g_ascii_iscntrl(*p))
+ *p = subst;
+ ++p;
}
}
diff --git a/libsylph/utils.h b/libsylph/utils.h
index 63bb7861..b8fe7051 100644
--- a/libsylph/utils.h
+++ b/libsylph/utils.h
@@ -296,6 +296,7 @@ GSList *newsgroup_list_append (GSList *group_list,
GList *add_history (GList *list,
const gchar *str);
+/* modify string */
void remove_return (gchar *str);
void remove_space (gchar *str);
void unfold_line (gchar *str);
@@ -308,6 +309,8 @@ void subst_chars (gchar *str,
void subst_null (gchar *str,
gint len,
gchar subst);
+void subst_control (gchar *str,
+ gchar subst);
void subst_for_filename (gchar *str);
gchar *get_alt_filename (const gchar *filename,
diff --git a/src/folderview.c b/src/folderview.c
index 0aa42588..bc9c3117 100644
--- a/src/folderview.c
+++ b/src/folderview.c
@@ -333,7 +333,7 @@ FolderView *folderview_create(void)
store = gtk_tree_store_new(N_COLS, G_TYPE_STRING, G_TYPE_STRING,
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER,
GDK_TYPE_PIXBUF, GDK_TYPE_PIXBUF,
- GDK_TYPE_COLOR, G_TYPE_BOOLEAN);
+ GDK_TYPE_COLOR, G_TYPE_INT);
gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(store),
COL_FOLDER_NAME,
folderview_folder_name_compare,
@@ -383,9 +383,8 @@ FolderView *folderview_create(void)
gtk_tree_view_column_set_attributes(column, renderer,
"text", COL_FOLDER_NAME,
"foreground-gdk", COL_FOREGROUND,
- "weight-set", COL_BOLD,
+ "weight", COL_BOLD,
NULL);
- g_object_set(G_OBJECT(renderer), "weight", PANGO_WEIGHT_BOLD, NULL);
gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column);
gtk_tree_view_set_expander_column(GTK_TREE_VIEW(treeview), column);
@@ -1176,7 +1175,8 @@ static void folderview_update_row(FolderView *folderview, GtkTreeIter *iter)
gchar *name, *str;
gchar new_s[11], unread_s[11], total_s[11];
gboolean add_unread_mark;
- gboolean use_bold, use_color;
+ gboolean use_color;
+ PangoWeight weight = PANGO_WEIGHT_NORMAL;
GdkColor *foreground = NULL;
gtk_tree_model_get(model, iter, COL_FOLDER_ITEM, &item, -1);
@@ -1296,13 +1296,16 @@ static void folderview_update_row(FolderView *folderview, GtkTreeIter *iter)
if (item->stype == F_OUTBOX || item->stype == F_DRAFT ||
item->stype == F_TRASH) {
- use_bold = use_color = FALSE;
+ use_color = FALSE;
} else if (item->stype == F_QUEUE) {
/* highlight queue folder if there are any messages */
- use_bold = use_color = (item->total > 0);
+ use_color = (item->total > 0);
+ if (item->total > 0)
+ weight = PANGO_WEIGHT_BOLD;
} else {
/* if unread messages exist, print with bold font */
- use_bold = (item->unread > 0) || add_unread_mark;
+ if ((item->unread > 0) || add_unread_mark)
+ weight = PANGO_WEIGHT_BOLD;
/* if new messages exist, print with colored letter */
use_color =
(item->new > 0) ||
@@ -1324,7 +1327,7 @@ static void folderview_update_row(FolderView *folderview, GtkTreeIter *iter)
COL_PIXBUF, pixbuf,
COL_PIXBUF_OPEN, open_pixbuf,
COL_FOREGROUND, foreground,
- COL_BOLD, use_bold,
+ COL_BOLD, weight,
-1);
g_free(name);
diff --git a/src/summaryview.c b/src/summaryview.c
index 0dc149a4..ebc3f2ce 100644
--- a/src/summaryview.c
+++ b/src/summaryview.c
@@ -2061,7 +2061,7 @@ static void summary_set_row(SummaryView *summaryview, GtkTreeIter *iter,
GdkPixbuf *unread_pix = NULL;
GdkPixbuf *mime_pix = NULL;
GdkColor *foreground = NULL;
- gboolean use_bold = FALSE;
+ PangoWeight weight = PANGO_WEIGHT_NORMAL;
MsgFlags flags;
GdkColor color;
gint color_val;
@@ -2124,7 +2124,7 @@ static void summary_set_row(SummaryView *summaryview, GtkTreeIter *iter,
if (prefs_common.bold_unread) {
if (MSG_IS_UNREAD(flags))
- use_bold = TRUE;
+ weight = PANGO_WEIGHT_BOLD;
else if (gtk_tree_model_iter_has_child(GTK_TREE_MODEL(store),
iter)) {
GtkTreePath *path;
@@ -2134,7 +2134,7 @@ static void summary_set_row(SummaryView *summaryview, GtkTreeIter *iter,
if (!gtk_tree_view_row_expanded
(GTK_TREE_VIEW(summaryview->treeview), path) &&
summary_have_unread_children(summaryview, iter))
- use_bold = TRUE;
+ weight = PANGO_WEIGHT_BOLD;
gtk_tree_path_free(path);
}
}
@@ -2165,7 +2165,7 @@ static void summary_set_row(SummaryView *summaryview, GtkTreeIter *iter,
S_COL_TO, NULL,
S_COL_FOREGROUND, foreground,
- S_COL_BOLD, use_bold,
+ S_COL_BOLD, weight,
-1);
if (subject_s)
@@ -2259,7 +2259,8 @@ static void summary_set_tree_model_from_list(SummaryView *summaryview,
prefs_common.bold_unread &&
summary_have_unread_children(summaryview, &iter)) {
gtk_tree_store_set(store, &iter,
- S_COL_BOLD, TRUE, -1);
+ S_COL_BOLD,
+ PANGO_WEIGHT_BOLD, -1);
}
}
@@ -2850,7 +2851,8 @@ void summary_mark_thread_as_read(SummaryView *summaryview)
!gtk_tree_view_row_expanded(treeview, path) &&
!summary_have_unread_children(summaryview, &iter)) {
gtk_tree_store_set(GTK_TREE_STORE(model), &iter,
- S_COL_BOLD, FALSE, -1);
+ S_COL_BOLD,
+ PANGO_WEIGHT_NORMAL, -1);
}
}
}
@@ -2894,7 +2896,8 @@ void summary_mark_all_read(SummaryView *summaryview)
path))
gtk_tree_store_set
(GTK_TREE_STORE(model), &iter,
- S_COL_BOLD, FALSE, -1);
+ S_COL_BOLD,
+ PANGO_WEIGHT_NORMAL, -1);
gtk_tree_path_free(path);
}
}
@@ -4844,7 +4847,7 @@ static GtkWidget *summary_tree_view_create(SummaryView *summaryview)
G_TYPE_UINT,
G_TYPE_POINTER,
GDK_TYPE_COLOR,
- G_TYPE_BOOLEAN);
+ G_TYPE_INT);
#define SET_SORT(col, func) \
gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(store), \
@@ -4890,12 +4893,8 @@ static GtkWidget *summary_tree_view_create(SummaryView *summaryview)
(column, renderer, \
# type, col, \
"foreground-gdk", S_COL_FOREGROUND, \
- "weight-set", S_COL_BOLD, \
+ "weight", S_COL_BOLD, \
NULL); \
- gtk_cell_renderer_text_set_fixed_height_from_font \
- (GTK_CELL_RENDERER_TEXT(renderer), 1); \
- g_object_set(G_OBJECT(renderer), \
- "weight", PANGO_WEIGHT_BOLD, NULL); \
gtk_tree_view_column_set_resizable(column, TRUE); \
} \
gtk_tree_view_column_set_alignment(column, align); \
@@ -5509,7 +5508,7 @@ static void summary_set_bold_recursive(SummaryView *summaryview,
GET_MSG_INFO(msginfo, iter);
if (!MSG_IS_UNREAD(msginfo->flags)) {
gtk_tree_store_set(summaryview->store, iter,
- S_COL_BOLD, FALSE, -1);
+ S_COL_BOLD, PANGO_WEIGHT_NORMAL, -1);
}
valid = gtk_tree_model_iter_children(model, &child, iter);
@@ -5542,8 +5541,8 @@ static void summary_row_collapsed(GtkTreeView *treeview, GtkTreeIter *iter,
{
if (prefs_common.bold_unread &&
summary_have_unread_children(summaryview, iter)) {
- gtk_tree_store_set(summaryview->store, iter, S_COL_BOLD, TRUE,
- -1);
+ gtk_tree_store_set(summaryview->store, iter,
+ S_COL_BOLD, PANGO_WEIGHT_BOLD, -1);
}
}