2012-06-20 [paul] 3.8.0cvs54
* src/prefs_common.c * src/prefs_common.h * src/textview.c * src/textview.h colourise attached patches. Patch by Ticho
This commit is contained in:
parent
e08ea0a073
commit
07e2cd579e
|
@ -1,3 +1,12 @@
|
|||
2012-06-20 [paul] 3.8.0cvs54
|
||||
|
||||
* src/prefs_common.c
|
||||
* src/prefs_common.h
|
||||
* src/textview.c
|
||||
* src/textview.h
|
||||
colourise attached patches.
|
||||
Patch by Ticho
|
||||
|
||||
2012-06-02 [wwp] 3.8.0cvs53
|
||||
|
||||
* src/gtk/progressdialog.c
|
||||
|
|
|
@ -4370,3 +4370,4 @@
|
|||
( cvs diff -u -r 1.382.2.602 -r 1.382.2.603 src/compose.c; ) > 3.8.0cvs51.patchset
|
||||
( cvs diff -u -r 1.1.2.9 -r 1.1.2.10 doc/man/claws-mail.1; cvs diff -u -r 1.115.2.249 -r 1.115.2.250 src/main.c; cvs diff -u -r 1.7.2.20 -r 1.7.2.21 src/main.h; cvs diff -u -r 1.149.2.106 -r 1.149.2.107 src/inc.c; cvs diff -u -r 1.150.2.123 -r 1.150.2.124 src/procmsg.c; cvs diff -u -r 1.4.2.83 -r 1.4.2.84 src/gtk/about.c; ) > 3.8.0cvs52.patchset
|
||||
( cvs diff -u -r 1.1.4.31 -r 1.1.4.32 src/gtk/progressdialog.c; ) > 3.8.0cvs53.patchset
|
||||
( cvs diff -u -r 1.204.2.210 -r 1.204.2.211 src/prefs_common.c; cvs diff -u -r 1.103.2.138 -r 1.103.2.139 src/prefs_common.h; cvs diff -u -r 1.96.2.241 -r 1.96.2.242 src/textview.c; cvs diff -u -r 1.12.2.31 -r 1.12.2.32 src/textview.h; ) > 3.8.0cvs54.patchset
|
||||
|
|
|
@ -12,7 +12,7 @@ MINOR_VERSION=8
|
|||
MICRO_VERSION=0
|
||||
INTERFACE_AGE=0
|
||||
BINARY_AGE=0
|
||||
EXTRA_VERSION=53
|
||||
EXTRA_VERSION=54
|
||||
EXTRA_RELEASE=
|
||||
EXTRA_GTK2_VERSION=
|
||||
|
||||
|
|
|
@ -1170,6 +1170,13 @@ static PrefParam param[] = {
|
|||
{"nav_history_length", "50", &prefs_common.nav_history_length, P_INT,
|
||||
NULL, NULL, NULL},
|
||||
|
||||
{"diff_added_color", "#008b8b", &prefs_common.diff_added_color, P_COLOR,
|
||||
NULL, NULL, NULL},
|
||||
{"diff_deleted_color", "#6a5acd", &prefs_common.diff_deleted_color, P_COLOR,
|
||||
NULL, NULL, NULL},
|
||||
{"diff_hunk_color", "#a52a2a", &prefs_common.diff_hunk_color, P_COLOR,
|
||||
NULL, NULL, NULL},
|
||||
|
||||
{NULL, NULL, NULL, P_OTHER, NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
|
|
|
@ -520,6 +520,10 @@ struct _PrefsCommon
|
|||
gboolean flush_metadata;
|
||||
|
||||
gint nav_history_length;
|
||||
|
||||
gulong diff_added_color;
|
||||
gulong diff_deleted_color;
|
||||
gulong diff_hunk_color;
|
||||
};
|
||||
|
||||
extern PrefsCommon prefs_common;
|
||||
|
|
|
@ -106,6 +106,27 @@ static GdkColor emphasis_color = {
|
|||
(gushort)0
|
||||
};
|
||||
|
||||
static GdkColor diff_added_color = {
|
||||
(gulong)0,
|
||||
(gushort)0,
|
||||
(gushort)0,
|
||||
(gushort)0
|
||||
};
|
||||
|
||||
static GdkColor diff_deleted_color = {
|
||||
(gulong)0,
|
||||
(gushort)0,
|
||||
(gushort)0,
|
||||
(gushort)0
|
||||
};
|
||||
|
||||
static GdkColor diff_hunk_color = {
|
||||
(gulong)0,
|
||||
(gushort)0,
|
||||
(gushort)0,
|
||||
(gushort)0
|
||||
};
|
||||
|
||||
static GdkCursor *hand_cursor = NULL;
|
||||
static GdkCursor *text_cursor = NULL;
|
||||
static GdkCursor *watch_cursor= NULL;
|
||||
|
@ -488,6 +509,24 @@ static void textview_create_tags(GtkTextView *text, TextView *textview)
|
|||
gtk_text_buffer_create_tag(buffer, "link-hover",
|
||||
"underline", PANGO_UNDERLINE_SINGLE,
|
||||
NULL);
|
||||
gtk_text_buffer_create_tag(buffer, "diff-add",
|
||||
"foreground-gdk", &diff_added_color,
|
||||
NULL);
|
||||
gtk_text_buffer_create_tag(buffer, "diff-del",
|
||||
"foreground-gdk", &diff_deleted_color,
|
||||
NULL);
|
||||
gtk_text_buffer_create_tag(buffer, "diff-add-file",
|
||||
"foreground-gdk", &diff_added_color,
|
||||
"weight", PANGO_WEIGHT_BOLD,
|
||||
NULL);
|
||||
gtk_text_buffer_create_tag(buffer, "diff-del-file",
|
||||
"foreground-gdk", &diff_deleted_color,
|
||||
"weight", PANGO_WEIGHT_BOLD,
|
||||
NULL);
|
||||
gtk_text_buffer_create_tag(buffer, "diff-hunk",
|
||||
"foreground-gdk", &diff_hunk_color,
|
||||
"weight", PANGO_WEIGHT_BOLD,
|
||||
NULL);
|
||||
g_signal_connect(G_OBJECT(qtag), "event",
|
||||
G_CALLBACK(textview_uri_button_pressed), textview);
|
||||
g_signal_connect(G_OBJECT(tag), "event",
|
||||
|
@ -527,8 +566,9 @@ static void textview_update_message_colors(TextView *textview)
|
|||
GtkTextTag *tag = NULL;
|
||||
|
||||
quote_bgcolors[0] = quote_bgcolors[1] = quote_bgcolors[2] = black;
|
||||
quote_colors[0] = quote_colors[1] = quote_colors[2] =
|
||||
uri_color = emphasis_color = signature_color = black;
|
||||
quote_colors[0] = quote_colors[1] = quote_colors[2] = black;
|
||||
uri_color = emphasis_color = signature_color = diff_added_color =
|
||||
diff_deleted_color = diff_hunk_color = black;
|
||||
|
||||
if (prefs_common.enable_color) {
|
||||
/* grab the quote colors, converting from an int to a GdkColor */
|
||||
|
@ -544,6 +584,12 @@ static void textview_update_message_colors(TextView *textview)
|
|||
&signature_color);
|
||||
gtkut_convert_int_to_gdk_color(prefs_common.emphasis_col,
|
||||
&emphasis_color);
|
||||
gtkut_convert_int_to_gdk_color(prefs_common.diff_added_color,
|
||||
&diff_added_color);
|
||||
gtkut_convert_int_to_gdk_color(prefs_common.diff_deleted_color,
|
||||
&diff_deleted_color);
|
||||
gtkut_convert_int_to_gdk_color(prefs_common.diff_hunk_color,
|
||||
&diff_hunk_color);
|
||||
}
|
||||
if (prefs_common.enable_color && prefs_common.enable_bgcolor) {
|
||||
gtkut_convert_int_to_gdk_color(prefs_common.quote_level1_bgcol,
|
||||
|
@ -565,6 +611,11 @@ static void textview_update_message_colors(TextView *textview)
|
|||
CHANGE_TAG_COLOR("signature", &signature_color, NULL);
|
||||
CHANGE_TAG_COLOR("link", &uri_color, NULL);
|
||||
CHANGE_TAG_COLOR("link-hover", &uri_color, NULL);
|
||||
CHANGE_TAG_COLOR("diff-add", &diff_added_color, NULL);
|
||||
CHANGE_TAG_COLOR("diff-del", &diff_deleted_color, NULL);
|
||||
CHANGE_TAG_COLOR("diff-add-file", &diff_added_color, NULL);
|
||||
CHANGE_TAG_COLOR("diff-del-file", &diff_deleted_color, NULL);
|
||||
CHANGE_TAG_COLOR("diff-hunk", &diff_hunk_color, NULL);
|
||||
}
|
||||
#undef CHANGE_TAG_COLOR
|
||||
|
||||
|
@ -991,6 +1042,7 @@ static void textview_write_body(TextView *textview, MimeInfo *mimeinfo)
|
|||
procmime_force_encoding(textview->messageview->forced_encoding);
|
||||
|
||||
textview->is_in_signature = FALSE;
|
||||
textview->is_diff = FALSE;
|
||||
|
||||
procmime_decode_content(mimeinfo);
|
||||
|
||||
|
@ -1080,6 +1132,10 @@ static void textview_write_body(TextView *textview, MimeInfo *mimeinfo)
|
|||
#endif
|
||||
} else {
|
||||
textview_default:
|
||||
if (!g_ascii_strcasecmp(mimeinfo->subtype, "x-patch")
|
||||
|| !g_ascii_strcasecmp(mimeinfo->subtype, "x-diff"))
|
||||
textview->is_diff = TRUE;
|
||||
|
||||
if (mimeinfo->content == MIMECONTENT_MEM)
|
||||
tmpfp = str_open_as_stream(mimeinfo->data.mem);
|
||||
else
|
||||
|
@ -1521,10 +1577,25 @@ static void textview_write_line(TextView *textview, const gchar *str,
|
|||
fg_color = quote_tag_str;
|
||||
}
|
||||
|
||||
if (prefs_common.enable_color &&
|
||||
(strcmp(buf,"-- \n") == 0 || strcmp(buf, "- -- \n") == 0 || textview->is_in_signature)) {
|
||||
fg_color = "signature";
|
||||
textview->is_in_signature = TRUE;
|
||||
if (prefs_common.enable_color) {
|
||||
if (textview->is_diff) {
|
||||
if (strncmp(buf, "+++ ", 4) == 0)
|
||||
fg_color = "diff-add-file";
|
||||
else if (buf[0] == '+')
|
||||
fg_color = "diff-add";
|
||||
else if (strncmp(buf, "--- ", 4) == 0)
|
||||
fg_color = "diff-del-file";
|
||||
else if (buf[0] == '-')
|
||||
fg_color = "diff-del";
|
||||
else if (strncmp(buf, "@@ ", 3) == 0 &&
|
||||
strcmp(buf+strlen(buf)-4, " @@\n") == 0)
|
||||
fg_color = "diff-hunk";
|
||||
} else if (strcmp(buf,"-- \n") == 0
|
||||
|| strcmp(buf, "- -- \n") == 0
|
||||
|| textview->is_in_signature) {
|
||||
fg_color = "signature";
|
||||
textview->is_in_signature = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (real_quotelevel > -1 && do_quote_folding) {
|
||||
|
|
|
@ -66,6 +66,7 @@ struct _TextView
|
|||
|
||||
gboolean default_text;
|
||||
gboolean is_in_signature;
|
||||
gboolean is_diff;
|
||||
|
||||
GSList *uri_list;
|
||||
gint body_pos;
|
||||
|
|
Loading…
Reference in a new issue