[Commits] prefs_common.c 1.204.2.210 1.204.2.211 prefs_common.h 1.103.2.138 1.103.2.139 textview.c 1.96.2.241 1.96.2.242 textview.h 1.12.2.31 1.12.2.32
claws at claws-mail.org
claws at claws-mail.org
Wed Jun 20 10:07:17 CEST 2012
Update of /home/claws-mail/claws/src
In directory srv:/tmp/cvs-serv21862/src
Modified Files:
Tag: gtk2
prefs_common.c prefs_common.h textview.c textview.h
Log Message:
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
Index: prefs_common.h
===================================================================
RCS file: /home/claws-mail/claws/src/prefs_common.h,v
retrieving revision 1.103.2.138
retrieving revision 1.103.2.139
diff -u -d -r1.103.2.138 -r1.103.2.139
--- prefs_common.h 27 May 2012 17:30:53 -0000 1.103.2.138
+++ prefs_common.h 20 Jun 2012 08:07:14 -0000 1.103.2.139
@@ -520,6 +520,10 @@
gboolean flush_metadata;
gint nav_history_length;
+
+ gulong diff_added_color;
+ gulong diff_deleted_color;
+ gulong diff_hunk_color;
};
extern PrefsCommon prefs_common;
Index: textview.c
===================================================================
RCS file: /home/claws-mail/claws/src/textview.c,v
retrieving revision 1.96.2.241
retrieving revision 1.96.2.242
diff -u -d -r1.96.2.241 -r1.96.2.242
--- textview.c 27 May 2012 17:31:00 -0000 1.96.2.241
+++ textview.c 20 Jun 2012 08:07:14 -0000 1.96.2.242
@@ -106,6 +106,27 @@
(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 @@
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 @@
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 @@
&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 @@
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 @@
procmime_force_encoding(textview->messageview->forced_encoding);
textview->is_in_signature = FALSE;
+ textview->is_diff = FALSE;
procmime_decode_content(mimeinfo);
@@ -1080,6 +1132,10 @@
#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 @@
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) {
Index: textview.h
===================================================================
RCS file: /home/claws-mail/claws/src/textview.h,v
retrieving revision 1.12.2.31
retrieving revision 1.12.2.32
diff -u -d -r1.12.2.31 -r1.12.2.32
--- textview.h 27 May 2012 17:31:00 -0000 1.12.2.31
+++ textview.h 20 Jun 2012 08:07:15 -0000 1.12.2.32
@@ -66,6 +66,7 @@
gboolean default_text;
gboolean is_in_signature;
+ gboolean is_diff;
GSList *uri_list;
gint body_pos;
Index: prefs_common.c
===================================================================
RCS file: /home/claws-mail/claws/src/prefs_common.c,v
retrieving revision 1.204.2.210
retrieving revision 1.204.2.211
diff -u -d -r1.204.2.210 -r1.204.2.211
--- prefs_common.c 27 May 2012 17:30:52 -0000 1.204.2.210
+++ prefs_common.c 20 Jun 2012 08:07:14 -0000 1.204.2.211
@@ -1170,6 +1170,13 @@
{"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}
};
More information about the Commits
mailing list