aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2005-01-25 08:21:20 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2005-01-25 08:21:20 +0000
commit80ce4c1f69c088289c3c67408c820a03d0b04055 (patch)
tree29890de80367bd066e731075d7be5965b0d43c22
parentd97b4ce5ed25db02c5488c23bfdfa96ea3f5acd8 (diff)
improved font management.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@39 ee746299-78ed-0310-b773-934348b2243d
-rw-r--r--ChangeLog11
-rw-r--r--ChangeLog.ja13
-rw-r--r--src/defs.h4
-rw-r--r--src/folderview.c11
-rw-r--r--src/gtkutils.c17
-rw-r--r--src/gtkutils.h5
-rw-r--r--src/headerview.c23
-rw-r--r--src/prefs_common.c10
-rw-r--r--src/prefs_common.h5
-rw-r--r--src/summaryview.c41
-rw-r--r--src/textview.c16
11 files changed, 78 insertions, 78 deletions
diff --git a/ChangeLog b/ChangeLog
index 82cd8a5b..2e4e4363 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2005-01-25
+
+ * src/gtkutils.[ch]: gtkut_get_default_font_desc(): returns default
+ font_desc.
+ * src/prefs_common.[ch]
+ src/defs.h: removed unused font configs.
+ * src/textview.c: use default font for headers.
+ * src/headerview.c
+ src/folderview.c: generate bold font from normal font.
+ * src/summaryview.c: generate bold and small font from normal font.
+
2005-01-24
* src/alertpanel.c: alertpanel_create(): generate title font from
diff --git a/ChangeLog.ja b/ChangeLog.ja
index 22174953..b7ee7b05 100644
--- a/ChangeLog.ja
+++ b/ChangeLog.ja
@@ -1,3 +1,16 @@
+2005-01-25
+
+ * src/gtkutils.[ch]: gtkut_get_default_font_desc(): デフォルトの
+ font_desc を返す。
+ * src/prefs_common.[ch]
+ src/defs.h: 未使用のフォント設定を削除。
+ * src/textview.c: ヘッダにデフォルトのフォントを使用。
+ * src/headerview.c
+ src/folderview.c: 通常のフォントからボールドフォントを生成する
+ ようにした。
+ * src/summaryview.c: 通常のフォントからボールドと小さいフォントを
+ 生成するようにした。
+
2005-01-24
* src/alertpanel.c: alertpanel_create(): タイトルフォントを通常の
diff --git a/src/defs.h b/src/defs.h
index f31b5306..82a1f85a 100644
--- a/src/defs.h
+++ b/src/defs.h
@@ -103,10 +103,6 @@
#define SESSION_TIMEOUT_INTERVAL 60 /* sec */
#define MAX_HISTORY_SIZE 16
-#define DEFAULT_NORMAL_FONT "Sans 12"
#define DEFAULT_MESSAGE_FONT "Sans 14"
-#define DEFAULT_BOLD_FONT "Sans Bold 12"
-#define DEFAULT_SMALL_FONT "Sans 10"
-#define DEFAULT_TITLE_FONT "Sans 16"
#endif /* __DEFS_H__ */
diff --git a/src/folderview.c b/src/folderview.c
index b2b6210a..ef9a2e3f 100644
--- a/src/folderview.c
+++ b/src/folderview.c
@@ -416,16 +416,9 @@ void folderview_init(FolderView *folderview)
stock_pixmap_gdk(ctree, STOCK_PIXMAP_TRASH, &trashxpm, &trashxpmmask);
if (!bold_style) {
- PangoFontDescription *font_desc;
bold_style = gtk_style_copy(gtk_widget_get_style(ctree));
- font_desc = pango_font_description_from_string
- (prefs_common.boldfont);
- if (font_desc) {
- if (bold_style->font_desc)
- pango_font_description_free
- (bold_style->font_desc);
- bold_style->font_desc = font_desc;
- }
+ pango_font_description_set_weight
+ (bold_style->font_desc, PANGO_WEIGHT_BOLD);
bold_color_style = gtk_style_copy(bold_style);
bold_color_style->fg[GTK_STATE_NORMAL] = folderview->color_new;
}
diff --git a/src/gtkutils.c b/src/gtkutils.c
index 5c5fab44..5fb69c16 100644
--- a/src/gtkutils.c
+++ b/src/gtkutils.c
@@ -64,6 +64,23 @@ gboolean gtkut_get_font_size(GtkWidget *widget, gint *width, gint *height)
return TRUE;
}
+PangoFontDescription *gtkut_get_default_font_desc(void)
+{
+ static PangoFontDescription *font_desc = NULL;
+
+ if (!font_desc) {
+ GtkWidget *window;
+
+ window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+ gtk_widget_ensure_style(window);
+ font_desc = pango_font_description_copy
+ (window->style->font_desc);
+ gtk_object_sink(GTK_OBJECT(window));
+ }
+
+ return pango_font_description_copy(font_desc);
+}
+
void gtkut_convert_int_to_gdk_color(gint rgbvalue, GdkColor *color)
{
g_return_if_fail(color != NULL);
diff --git a/src/gtkutils.h b/src/gtkutils.h
index 0a4da843..0b951d2f 100644
--- a/src/gtkutils.h
+++ b/src/gtkutils.h
@@ -82,9 +82,8 @@ struct _ComboButton
gboolean gtkut_get_font_size (GtkWidget *widget,
gint *width,
gint *height);
-
-GdkFont *gtkut_font_load (const gchar *fontset_name);
-GdkFont *gtkut_font_load_from_fontset (const gchar *fontset_name);
+PangoFontDescription *gtkut_get_default_font_desc
+ (void);
void gtkut_convert_int_to_gdk_color (gint rgbvalue,
GdkColor *color);
diff --git a/src/headerview.c b/src/headerview.c
index 2a6d7369..ee730f37 100644
--- a/src/headerview.c
+++ b/src/headerview.c
@@ -139,20 +139,17 @@ void headerview_init(HeaderView *headerview)
{
static PangoFontDescription *boldfont = NULL;
- if (!boldfont && prefs_common.boldfont)
- boldfont = pango_font_description_from_string
- (prefs_common.boldfont);
-
-#define SET_FONT_STYLE(wid) \
-{ \
- if (boldfont) \
- gtk_widget_modify_font(headerview->wid, boldfont); \
-}
+ if (!boldfont) {
+ boldfont = pango_font_description_new();
+ pango_font_description_set_weight(boldfont, PANGO_WEIGHT_BOLD);
+ }
- SET_FONT_STYLE(from_header_label);
- SET_FONT_STYLE(to_header_label);
- SET_FONT_STYLE(ng_header_label);
- SET_FONT_STYLE(subject_header_label);
+ if (boldfont) {
+ gtk_widget_modify_font(headerview->from_header_label, boldfont);
+ gtk_widget_modify_font(headerview->to_header_label, boldfont);
+ gtk_widget_modify_font(headerview->ng_header_label, boldfont);
+ gtk_widget_modify_font(headerview->subject_header_label, boldfont);
+ }
headerview_clear(headerview);
headerview_set_visibility(headerview, prefs_common.display_header_pane);
diff --git a/src/prefs_common.c b/src/prefs_common.c
index 5fdc9b07..33e2e41a 100644
--- a/src/prefs_common.c
+++ b/src/prefs_common.c
@@ -338,18 +338,8 @@ static PrefParam param[] = {
prefs_set_data_from_text, prefs_set_text},
/* Display */
- {"widget_font_name", NULL, &prefs_common.widgetfont, P_STRING,
- NULL, NULL, NULL},
{"message_font_name", DEFAULT_MESSAGE_FONT, &prefs_common.textfont, P_STRING,
&display.entry_textfont, prefs_set_data_from_entry, prefs_set_entry},
- {"normal_font_name", DEFAULT_NORMAL_FONT, &prefs_common.normalfont, P_STRING,
- NULL, NULL, NULL},
- {"bold_font_name", DEFAULT_BOLD_FONT, &prefs_common.boldfont, P_STRING,
- NULL, NULL, NULL},
- {"small_font_name", DEFAULT_SMALL_FONT, &prefs_common.smallfont, P_STRING,
- NULL, NULL, NULL},
- {"title_font_name", DEFAULT_TITLE_FONT, &prefs_common.titlefont, P_STRING,
- NULL, NULL, NULL},
{"display_folder_unread_num", "TRUE",
&prefs_common.display_folder_unread, P_BOOL,
diff --git a/src/prefs_common.h b/src/prefs_common.h
index 863b3076..b2c42a58 100644
--- a/src/prefs_common.h
+++ b/src/prefs_common.h
@@ -90,12 +90,7 @@ struct _PrefsCommon
gchar *fw_quotefmt;
/* Display */
- gchar *widgetfont;
gchar *textfont;
- gchar *normalfont;
- gchar *boldfont;
- gchar *smallfont;
- gchar *titlefont;
gboolean trans_hdr;
gboolean display_folder_unread;
diff --git a/src/summaryview.c b/src/summaryview.c
index a67a3496..542a7e3f 100644
--- a/src/summaryview.c
+++ b/src/summaryview.c
@@ -488,8 +488,9 @@ SummaryView *summary_create(void)
void summary_init(SummaryView *summaryview)
{
- GtkStyle *style;
GtkWidget *pixmap;
+ PangoFontDescription *font_desc;
+ gint size;
gtk_widget_realize(summaryview->ctree);
stock_pixmap_gdk(summaryview->ctree, STOCK_PIXMAP_MARK,
@@ -510,19 +511,10 @@ void summary_init(SummaryView *summaryview)
&clipxpm, &clipxpmmask);
if (!bold_style) {
- PangoFontDescription *font_desc = NULL;
-
bold_style = gtk_style_copy
(gtk_widget_get_style(summaryview->ctree));
- if (prefs_common.boldfont)
- font_desc = pango_font_description_from_string
- (prefs_common.boldfont);
- if (font_desc) {
- if (bold_style->font_desc)
- pango_font_description_free
- (bold_style->font_desc);
- bold_style->font_desc = font_desc;
- }
+ pango_font_description_set_weight
+ (bold_style->font_desc, PANGO_WEIGHT_BOLD);
bold_marked_style = gtk_style_copy(bold_style);
bold_marked_style->fg[GTK_STATE_NORMAL] =
summaryview->color_marked;
@@ -531,23 +523,14 @@ void summary_init(SummaryView *summaryview)
summaryview->color_dim;
}
- style = gtk_style_copy(gtk_widget_get_style
- (summaryview->statlabel_folder));
- if (prefs_common.smallfont) {
- PangoFontDescription *font_desc = NULL;
-
- if (prefs_common.smallfont)
- font_desc = pango_font_description_from_string
- (prefs_common.smallfont);
- if (font_desc) {
- if (style->font_desc)
- pango_font_description_free(style->font_desc);
- style->font_desc = font_desc;
- }
- }
- gtk_widget_set_style(summaryview->statlabel_folder, style);
- gtk_widget_set_style(summaryview->statlabel_select, style);
- gtk_widget_set_style(summaryview->statlabel_msgs, style);
+ font_desc = pango_font_description_new();
+ size = pango_font_description_get_size
+ (summaryview->statlabel_folder->style->font_desc);
+ pango_font_description_set_size(font_desc, size * PANGO_SCALE_SMALL);
+ gtk_widget_modify_font(summaryview->statlabel_folder, font_desc);
+ gtk_widget_modify_font(summaryview->statlabel_select, font_desc);
+ gtk_widget_modify_font(summaryview->statlabel_msgs, font_desc);
+ pango_font_description_free(font_desc);
pixmap = stock_pixmap_widget(summaryview->hbox_l, STOCK_PIXMAP_DIR_OPEN);
gtk_box_pack_start(GTK_BOX(summaryview->hbox_l), pixmap, FALSE, FALSE, 4);
diff --git a/src/textview.c b/src/textview.c
index 675a258d..81eae79d 100644
--- a/src/textview.c
+++ b/src/textview.c
@@ -233,6 +233,14 @@ static void textview_create_tags(GtkTextView *text, TextView *textview)
{
GtkTextBuffer *buffer;
GtkTextTag *tag;
+ static PangoFontDescription *font_desc, *bold_font_desc;
+
+ if (!font_desc) {
+ font_desc = gtkut_get_default_font_desc();
+ bold_font_desc = pango_font_description_copy(font_desc);
+ pango_font_description_set_weight
+ (bold_font_desc, PANGO_WEIGHT_BOLD);
+ }
buffer = gtk_text_view_get_buffer(text);
@@ -241,11 +249,10 @@ static void textview_create_tags(GtkTextView *text, TextView *textview)
"pixels-above-lines-set", TRUE,
"pixels-below-lines", 0,
"pixels-below-lines-set", TRUE,
- //"left-margin", 0,
- //"left-margin-set", TRUE,
+ "font-desc", font_desc,
NULL);
gtk_text_buffer_create_tag(buffer, "header_title",
- "font", prefs_common.boldfont,
+ "font-desc", bold_font_desc,
NULL);
gtk_text_buffer_create_tag(buffer, "quote0",
"foreground-gdk", &quote_colors[0],
@@ -280,7 +287,6 @@ static void textview_create_tags(GtkTextView *text, TextView *textview)
void textview_init(TextView *textview)
{
- //gtkut_widget_disable_theme_engine(textview->text);
textview_update_message_colors();
textview_set_all_headers(textview, FALSE);
textview_set_font(textview, NULL);
@@ -907,7 +913,7 @@ static void textview_make_clickable_parts(TextView *textview,
uri->start = gtk_text_iter_get_offset(&iter);
gtk_text_buffer_insert_with_tags_by_name
(buffer, &iter, last->bp, last->ep - last->bp,
- uri_tag, NULL);
+ uri_tag, fg_tag, NULL);
uri->end = gtk_text_iter_get_offset(&iter);
textview->uri_list =
g_slist_append(textview->uri_list, uri);