[evolution-patches] [GtkHTML] bug 318561 PATCH



hi everyone,

This is the patch for the Bug 318561.

The patch solves the following Problems:
1. The bg/link/text color returns back to default when "None" Template is selected again after selecting other Templates.
2.  And the Template points back to the previous value (e.g Midnight/Draft/None ....etc the Template you had previously
     selected) after closing and opening the Format Page.


Pls verify this patch .... and let me know the result.

Victor Aloysius J

Index: body.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/components/html-editor/body.c,v
retrieving revision 1.55
diff -u -r1.55 body.c
--- body.c	14 Oct 2005 12:13:50 -0000	1.55
+++ body.c	2 Jan 2006 06:37:50 -0000
@@ -90,7 +90,7 @@
 		"rect.png",
 		{0, 0xffff, 0xffff, 0xffff},
 		{0, 0, 0, 0},
-		{0, 0, 0, 0xffff},
+		{0, 0, 0, 0xfffc},
 		10,
   	},
 	{
@@ -114,7 +114,7 @@
 		"confidential-stamp.jpg",
 		{0, 0xffff, 0xffff, 0xffff},
 		{0, 0, 0, 0},
-		{0, 0, 0, 0xffff},
+		{0, 0, 0, 0xfffd},
 		10,
   	},
 	{
@@ -122,7 +122,7 @@
 		"draft-stamp.jpg",
 		{0, 0xffff, 0xffff, 0xffff},
 		{0, 0, 0, 0},
-		{0, 0, 0, 0xffff},
+		{0, 0, 0, 0xfffe},
 		10,
   	},
 	{
@@ -195,18 +195,11 @@
 		gi_color_combo_set_color (GI_COLOR_COMBO (d->combo [1]), &body_templates [template].link_color);
 		left_margin = body_templates [template].left_margin;
 	} else {
-		gi_color_combo_set_color (GI_COLOR_COMBO (d->combo [2]),
-				       &html_colorset_get_color_allocated (d->cd->html->engine->settings->color_set,
-									   d->cd->html->engine->painter,
-									   HTMLBgColor)->color);
-		gi_color_combo_set_color (GI_COLOR_COMBO (d->combo [0]),
-				       &html_colorset_get_color_allocated (d->cd->html->engine->settings->color_set,
-									   d->cd->html->engine->painter,
-									   HTMLTextColor)->color);
-		gi_color_combo_set_color (GI_COLOR_COMBO (d->combo [1]),
-				       &html_colorset_get_color_allocated (d->cd->html->engine->settings->color_set,
-									   d->cd->html->engine->painter,
-									   HTMLLinkColor)->color);
+		gi_color_combo_set_color (GI_COLOR_COMBO (d->combo [2]),&body_templates [template].bg_color);
+				       
+		gi_color_combo_set_color (GI_COLOR_COMBO (d->combo [0]),&body_templates [template].text_color);
+				      
+		gi_color_combo_set_color (GI_COLOR_COMBO (d->combo [1]),&body_templates [template].link_color);
 	}
 
 	/* FIXME: add API for margins query/setting to libgtkhtml */
@@ -218,6 +211,10 @@
 {
 	GtkWidget *menu;
 	gint i;
+        HTMLEngine *a = d->cd->html->engine; 
+        GdkColor textprev_color;
+        GdkColor linkprev_color;
+        GdkColor bgprev_color;
 
 	menu = gtk_menu_new ();
 
@@ -228,6 +225,20 @@
 		gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
 		gtk_widget_show (item);
 	}
+
+
+    textprev_color = html_colorset_get_color_allocated (a->settings->color_set, a->painter, HTMLTextColor)->color;
+    linkprev_color  = html_colorset_get_color_allocated (a->settings->color_set, a->painter, HTMLLinkColor)->color;
+    bgprev_color   = html_colorset_get_color_allocated (a->settings->color_set, a->painter, HTMLBgColor)->color;
+
+  for(i=0; i < TEMPLATES; i++) {
+       if(gdk_color_equal(&textprev_color,&body_templates[i].text_color)&&gdk_color_equal(&bgprev_color,&body_templates[i].bg_color)       
+            &&gdk_color_equal(&linkprev_color,&body_templates[i].link_color))
+          {
+                         gtk_menu_set_active(GTK_MENU(menu),i);
+           }
+      }
+
 	gtk_option_menu_set_menu (GTK_OPTION_MENU (d->option_template), menu);
 }
 
@@ -310,6 +321,13 @@
 	SET_COLOR (HTMLTextColor);
 	SET_COLOR (HTMLLinkColor);
 	SET_COLOR (HTMLBgColor);
+
+    /* Initializing the text color, background color, link color */  
+ body_templates [0].text_color=html_colorset_get_color_allocated (cd->html->engine->defaultSettings->color_set, cd->html->engine->painter, HTMLTextColor)->color;
+    body_templates [0].link_color=html_colorset_get_color_allocated (cd->html->engine->defaultSettings->color_set, cd->html->engine->painter, HTMLLinkColor)->color;
+    body_templates [0].bg_color=html_colorset_get_color_allocated (cd->html->engine->defaultSettings->color_set, cd->html->engine->painter, 
+HTMLBgColor)->color;
+
 
 	/* connect signal handlers */
 	gtk_widget_show_all (main_vbox);
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gtkhtml/components/html-editor/ChangeLog,v
retrieving revision 1.519
diff -u -r1.519 ChangeLog
--- ChangeLog	19 Dec 2005 06:40:33 -0000	1.519
+++ ChangeLog	2 Jan 2006 06:45:02 -0000
@@ -1,3 +1,11 @@
+2006-1-2    M Victor Aloysius J  <victoraloy gmail com>
+ 
+      **Fixes bug #318561
+       
+      * body.c (body_properties): Initialized the value of text color,background color,link color 
+         body.c (changed_template): set the initialized value 
+         body.c (fill_templates): 
+
 2005-12-19  Srinivasa Ragavan <sragavan novell com>
 
 	** Fixes bug #246938







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