aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2005-06-22 10:52:55 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2005-06-22 10:52:55 +0000
commita29eb7eb2646616d7a3702bcd05a0a11e7c973dc (patch)
tree70b5c1b3ad1eb0c8219d579f174538a1a62f6890 /src
parent846fb4282b146dd4957e53b7a85003dec40d9644 (diff)
fixed bugs of quote colors setting.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@364 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'src')
-rw-r--r--src/prefs_common.c6
-rw-r--r--src/textview.c63
-rw-r--r--src/textview.h8
3 files changed, 54 insertions, 23 deletions
diff --git a/src/prefs_common.c b/src/prefs_common.c
index 132e151e..aadbfaa6 100644
--- a/src/prefs_common.c
+++ b/src/prefs_common.c
@@ -2792,7 +2792,6 @@ void prefs_quote_colors_dialog(void)
gtk_main();
gtk_widget_hide(quote_color_win);
- textview_update_message_colors();
main_window_reflect_prefs_all();
}
@@ -3027,7 +3026,10 @@ static gboolean quote_colors_set_dialog_key_pressed(GtkWidget *widget,
GdkEventKey *event,
gpointer data)
{
- gtk_widget_destroy(color_dialog);
+ if (event && event->keyval == GDK_Escape) {
+ gtk_widget_destroy(color_dialog);
+ return TRUE;
+ }
return FALSE;
}
diff --git a/src/textview.c b/src/textview.c
index f974fde6..26d1e385 100644
--- a/src/textview.c
+++ b/src/textview.c
@@ -296,8 +296,9 @@ TextView *textview_create(void)
return textview;
}
-static void textview_create_tags(GtkTextView *text, TextView *textview)
+static void textview_create_tags(TextView *textview)
{
+ GtkTextView *text = GTK_TEXT_VIEW(textview->text);
GtkTextBuffer *buffer;
static PangoFontDescription *font_desc;
@@ -316,25 +317,32 @@ static void textview_create_tags(GtkTextView *text, TextView *textview)
gtk_text_buffer_create_tag(buffer, "header_title",
"weight", PANGO_WEIGHT_BOLD,
NULL);
- gtk_text_buffer_create_tag(buffer, "quote0",
- "foreground-gdk", &quote_colors[0],
- NULL);
- gtk_text_buffer_create_tag(buffer, "quote1",
- "foreground-gdk", &quote_colors[1],
- NULL);
- gtk_text_buffer_create_tag(buffer, "quote2",
- "foreground-gdk", &quote_colors[2],
- NULL);
+
+ textview->quote0_tag =
+ gtk_text_buffer_create_tag(buffer, "quote0",
+ "foreground-gdk", &quote_colors[0],
+ NULL);
+ textview->quote1_tag =
+ gtk_text_buffer_create_tag(buffer, "quote1",
+ "foreground-gdk", &quote_colors[1],
+ NULL);
+ textview->quote2_tag =
+ gtk_text_buffer_create_tag(buffer, "quote2",
+ "foreground-gdk", &quote_colors[2],
+ NULL);
+ textview->link_tag =
+ gtk_text_buffer_create_tag(buffer, "link",
+ "foreground-gdk", &uri_color,
+ NULL);
+ textview->hover_link_tag =
+ gtk_text_buffer_create_tag(buffer, "hover-link",
+ "foreground-gdk", &uri_color,
+ "underline", PANGO_UNDERLINE_SINGLE,
+ NULL);
+
gtk_text_buffer_create_tag(buffer, "emphasis",
"foreground-gdk", &emphasis_color,
NULL);
- gtk_text_buffer_create_tag(buffer, "link",
- "foreground-gdk", &uri_color,
- NULL);
- gtk_text_buffer_create_tag(buffer, "hover-link",
- "foreground-gdk", &uri_color,
- "underline", PANGO_UNDERLINE_SINGLE,
- NULL);
#if USE_GPGME
gtk_text_buffer_create_tag(buffer, "good-signature",
"foreground-gdk", &good_sig_color,
@@ -358,18 +366,19 @@ void textview_init(TextView *textview)
if (!regular_cursor)
regular_cursor = gdk_cursor_new(GDK_XTERM);
+ textview_create_tags(textview);
textview_reflect_prefs(textview);
textview_set_all_headers(textview, FALSE);
textview_set_font(textview, NULL);
- textview_create_tags(GTK_TEXT_VIEW(textview->text), textview);
}
-void textview_update_message_colors(void)
+static void textview_update_message_colors(void)
{
GdkColor black = {0, 0, 0, 0};
if (prefs_common.enable_color) {
- /* grab the quote colors, converting from an int to a GdkColor */
+ /* grab the quote colors, converting from an int to a
+ GdkColor */
gtkut_convert_int_to_gdk_color(prefs_common.quote_level1_col,
&quote_colors[0]);
gtkut_convert_int_to_gdk_color(prefs_common.quote_level2_col,
@@ -384,9 +393,23 @@ void textview_update_message_colors(void)
}
}
+static void textview_update_tags(TextView *textview)
+{
+ g_object_set(textview->quote0_tag, "foreground-gdk", &quote_colors[0],
+ NULL);
+ g_object_set(textview->quote1_tag, "foreground-gdk", &quote_colors[1],
+ NULL);
+ g_object_set(textview->quote2_tag, "foreground-gdk", &quote_colors[2],
+ NULL);
+ g_object_set(textview->link_tag, "foreground-gdk", &uri_color, NULL);
+ g_object_set(textview->hover_link_tag, "foreground-gdk", &uri_color,
+ NULL);
+}
+
void textview_reflect_prefs(TextView *textview)
{
textview_update_message_colors();
+ textview_update_tags(textview);
gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW(textview->text),
prefs_common.textview_cursor_visible);
}
diff --git a/src/textview.h b/src/textview.h
index df4a20fc..57382d39 100644
--- a/src/textview.h
+++ b/src/textview.h
@@ -26,6 +26,7 @@
#include <glib.h>
#include <gtk/gtkwidget.h>
+#include <gtk/gtktexttag.h>
typedef struct _TextView TextView;
@@ -41,6 +42,12 @@ struct _TextView
GtkWidget *popup_menu;
GtkItemFactory *popup_factory;
+ GtkTextTag *quote0_tag;
+ GtkTextTag *quote1_tag;
+ GtkTextTag *quote2_tag;
+ GtkTextTag *link_tag;
+ GtkTextTag *hover_link_tag;
+
GSList *uri_list;
gint body_pos;
@@ -51,7 +58,6 @@ struct _TextView
TextView *textview_create (void);
void textview_init (TextView *textview);
-void textview_update_message_colors (void);
void textview_reflect_prefs (TextView *textview);
void textview_show_message (TextView *textview,