[Gtranslator-devel] [patch] Default translation color for messages table



Hi,

The attached patch fixes some failed asserts:

** (gtranslator:14701): CRITICAL **: file pango-color.c: line 952
(pango_color_parse): assertion `spec != NULL' failed
 
** (gtranslator:14701): CRITICAL **: file pango-color.c: line 952
(pango_color_parse): assertion `spec != NULL' failed


It also sets the translated text color to the default widget one (this
should be noticed by users of dark/inverted themes).

OK to commit?


-dan
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gtranslator/src/ChangeLog,v
retrieving revision 1.909
diff -u -r1.909 ChangeLog
--- ChangeLog	11 Jan 2004 14:30:47 -0000	1.909
+++ ChangeLog	11 Jan 2004 22:07:41 -0000
@@ -1,3 +1,8 @@
+2004-01-12  Dan Damian  <dand gnome ro>
+
+	* messages-table.c (read_messages_table_colors): Fix pango-color.c
+	failed asserts by setting a valid translated_color.
+
 2004-01-11  Dan Damian  <dand gnome ro>
 
 	* languages.c (languages): Added mailing list for Romanian.
Index: messages-table.c
===================================================================
RCS file: /cvs/gnome/gtranslator/src/messages-table.c,v
retrieving revision 1.90
diff -u -r1.90 messages-table.c
--- messages-table.c	26 Aug 2003 19:52:30 -0000	1.90
+++ messages-table.c	11 Jan 2004 22:07:41 -0000
@@ -107,6 +107,8 @@
  */
 static void read_messages_table_colors()
 {
+	GtkStyle *style=NULL;
+	
 	messages_table_colors=g_new0(GtrMessagesTableColors, 1);
 
 	/*
@@ -164,7 +166,14 @@
 	 */
 	gdk_color_parse(messages_table_colors->untranslated, &messages_table_colors->untranslated_color);
 	gdk_color_parse(messages_table_colors->fuzzy, &messages_table_colors->fuzzy_color);
-	gdk_color_parse(messages_table_colors->translated, &messages_table_colors->translated_color);
+
+	/* If no custom color is set, use the default style color. */
+	if (messages_table_colors->translated == NULL) {
+		style=gtk_widget_get_style(GTK_WIDGET(trans_box));
+		messages_table_colors->translated_color=style->text[GTK_STATE_NORMAL];
+	} else {
+		gdk_color_parse(messages_table_colors->translated, &messages_table_colors->translated_color);
+	}
 }
 
 /*


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]