[evolution-patches] spell color



This adds the spelling color to the list of things we set in our custom
gtkrc.  The evolution_dir thing has always been broken so this doesn't
make it worse, it is my fault but not serious for release.

--Larry
Index: mail-config.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/mail-config.c,v
retrieving revision 1.276
diff -u -p -r1.276 mail-config.c
--- mail-config.c	16 May 2003 18:52:14 -0000	1.276
+++ mail-config.c	20 May 2003 14:08:06 -0000
@@ -87,7 +87,8 @@ typedef struct {
 	guint label_notify_id;
 	
 	guint font_notify_id;
-	
+	guint spell_notify_id;
+
 	GPtrArray *mime_types;
 	guint mime_types_notify_id;
 } MailConfig;
@@ -429,20 +430,24 @@ config_cache_mime_types (void)
 }
 
 static void
-config_write_fonts (void)
+config_write_style (void)
 {
 	char *filename;
 	FILE *rc;
 	gboolean custom;
 	char *fix_font;
 	char *var_font;
+	gint red, green, blue;
 	
-	if (!evolution_dir) {
-		g_warning ("evolution_dir empty");
-		return;
-	}
+	/*
+	 * This is the wrong way to get the path but it needs to 
+	 * always be the same as the gtk_rc_parse call and evolution_dir 
+	 * may not have been set yet
+	 *
+	 * filename = g_build_filename (evolution_dir, MAIL_CONFIG_RC, NULL);
+	 */
+	filename = g_build_filename (g_get_home_dir (), "evolution", MAIL_CONFIG_RC, NULL);
 
-	filename = g_build_filename (evolution_dir, MAIL_CONFIG_RC, NULL);
 	rc = fopen (filename, "w");
 
 	if (!rc) {
@@ -456,8 +461,14 @@ config_write_fonts (void)
 	var_font = gconf_client_get_string (config->gconf, "/apps/evolution/mail/display/fonts/variable", NULL);
 	fix_font = gconf_client_get_string (config->gconf, "/apps/evolution/mail/display/fonts/monospace", NULL);
 
+	red   = gconf_client_get_int (config->gconf, "/GNOME/Spell/spell_error_color_red", NULL);
+	green = gconf_client_get_int (config->gconf, "/GNOME/Spell/spell_error_color_green", NULL);
+	blue  = gconf_client_get_int (config->gconf, "/GNOME/Spell/spell_error_color_blue", NULL);
 
 	fprintf (rc, "style \"evolution-mail-custom-fonts\" {\n");
+	fprintf (rc, "        GtkHTML::spell_error_color = \"#%2x%2x%2x\"\n",
+		 red >> 8, green >> 8, blue >> 8);
+
 	if (custom && var_font && fix_font) {
 		fprintf (rc,
 			 "        GtkHTML::fixed_font_name = \"%s\"\n"
@@ -484,10 +495,10 @@ gconf_labels_changed (GConfClient *clien
 }
 
 static void
-gconf_fonts_changed (GConfClient *client, guint cnxn_id,
+gconf_style_changed (GConfClient *client, guint cnxn_id,
 		     GConfEntry *entry, gpointer user_data)
 {
-	config_write_fonts ();
+	config_write_style ();
 }
 
 static void
@@ -514,17 +525,20 @@ mail_config_init (void)
 	mail_config_clear ();
 
 	/*
-	  config_write_fonts ();
 	  filename = g_build_filename (evolution_dir, MAIL_CONFIG_RC, NULL);
 	*/
-	filename = g_build_filename (g_get_home_dir (), "/evolution", MAIL_CONFIG_RC, NULL);
+	filename = g_build_filename (g_get_home_dir (), "evolution", MAIL_CONFIG_RC, NULL);
 	gtk_rc_parse (filename);
 	g_free (filename);
 	
 	gconf_client_add_dir (config->gconf, "/apps/evolution/mail/display/fonts", 			      
 			      GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
+	gconf_client_add_dir (config->gconf, "/GNOME/Spell", 			      
+			      GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
 	config->font_notify_id = gconf_client_notify_add (config->gconf, "/apps/evolution/mail/display/fonts",
-							  gconf_fonts_changed, NULL, NULL, NULL);
+							  gconf_style_changed, NULL, NULL, NULL);
+	config->spell_notify_id = gconf_client_notify_add (config->gconf, "/GNOME/Spell",
+							   gconf_style_changed, NULL, NULL, NULL);
 
 	gconf_client_add_dir (config->gconf, "/apps/evolution/mail/labels",
 			      GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/mail/ChangeLog,v
retrieving revision 1.2730
diff -u -p -r1.2730 ChangeLog
--- ChangeLog	19 May 2003 15:12:10 -0000	1.2730
+++ ChangeLog	20 May 2003 14:08:12 -0000
@@ -1,3 +1,10 @@
+2003-05-20  Larry Ewing  <lewing ximian com>
+
+	* mail-config.c (mail_config_init): add a notify callback to the
+	spelling color.
+	(config_write_style): rename and write out the spell color as
+	well.
+
 2003-05-20  Not Zed  <notzed lostzed mmc com au>
 
 	** See bug #43234


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