Re: [evolution-patches] spell prefs in evo/mail



I have reverted this patch and I am attaching simpler one which only
fixes spell error color bug and doesn't move the gconf keys. I will look
more into moving after 1.4.1 release is done.

Cheers
Radek

On Wed, 2003-06-25 at 10:41, Radek Doulík wrote:
> On Wed, 2003-06-25 at 04:22, Not Zed wrote:
> > Sigh, you didn't give me time to disagree with this patch.
> 
> I am sorry, I though approval from Jeff was enough.
> 
> > I have serious issues with this:
> >  
> > +    <schema>
> > +     
> > <key>/schemas/apps/evolution/mail/composer/spell_copied_from_old_location</key>
> > +     
> > <applyto>/apps/evolution/mail/composer/spell_copied_from_old_location</applyto>
> > +      <owner>evolution-mail</owner>
> > +      <type>bool</type>
> > +      <default>false</default>
> > +      <locale name="C">
> > +         <short>spell preferences are copied from an old
> > location</short>
> > +         <long>
> > +        spell preferences are copied from an old location
> > (/GNOME/Spell)
> > +         </long>
> > +      </locale>
> > +    </schema>
> > 
> > 
> > All I can say is, WTF?  What sort of nonsense is this ???  The config
> > data is already versioned, and besides that, you can easily discover it
> > has been copied by implicit reasoning (i.e. if the new location exists
> > ... its been copied).
> 
> The reason for that change was to have default for spell error color in
> gconf. AFAIK I can't tell if value from gconf is schema default or
> actual value. The other benefit is avoiding additional gconf round-trips
> for /GNOME/Spell directory. That's why I did it like this.
> 
> What do you dislike on that approach so much? The visibility of copied
> flag in gconf-editor?
> 
> > Might be a nice idea to clean up the GET macro stuff too.
> 
> I will use the G_STMT_START/G_STMT_END macros if that's what you mean
> and/or rename it.
> 
> Radek
-- 
Radek Doulík <rodo ximian com>
Ximian, Inc.
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/mail/ChangeLog,v
retrieving revision 1.2760
diff -u -p -r1.2760 ChangeLog
--- ChangeLog	25 Jun 2003 16:20:38 -0000	1.2760
+++ ChangeLog	25 Jun 2003 16:28:24 -0000
@@ -1,3 +1,8 @@
+2003-06-25  Radek Doulik  <rodo ximian com>
+
+	* mail-config.c (config_write_style): provide hardcoded default
+	(red) spell error color
+
 2003-06-24  Jeffrey Stedfast  <fejj ximian com>
 
 	Might fix bug #45368 but I wouldn't bet on it.
Index: mail-config.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/mail-config.c,v
retrieving revision 1.283
diff -u -p -r1.283 mail-config.c
--- mail-config.c	25 Jun 2003 16:20:38 -0000	1.283
+++ mail-config.c	25 Jun 2003 16:28:25 -0000
@@ -426,16 +426,21 @@ config_cache_mime_types (void)
 	g_ptr_array_add (config->mime_types, NULL);
 }
 
+#define CONFIG_GET_SPELL_VALUE(t,x,prop,f,c) G_STMT_START { \
+        val = gconf_client_get_without_default (config->gconf, "/GNOME/Spell" x, NULL); \
+        if (val) { f; prop = c (gconf_value_get_ ## t (val)); \
+        gconf_value_free (val); } } G_STMT_END
+
 static void
 config_write_style (void)
 {
+	GConfValue *val;
 	char *filename;
 	FILE *rc;
 	gboolean custom;
 	char *fix_font;
 	char *var_font;
-	gint red, green, blue;
-
+	gint red = 0xffff, green = 0, blue = 0;
 	
 	/*
 	 * This is the wrong way to get the path but it needs to 
@@ -459,9 +464,9 @@ config_write_style (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);
+ 	CONFIG_GET_SPELL_VALUE (int, "/spell_error_color_red",   red, (void)0, (int));
+ 	CONFIG_GET_SPELL_VALUE (int, "/spell_error_color_green", green, (void)0, (int));
+ 	CONFIG_GET_SPELL_VALUE (int, "/spell_error_color_blue",  blue, (void)0, (int));
 
 	fprintf (rc, "style \"evolution-mail-custom-fonts\" {\n");
 	fprintf (rc, "        GtkHTML::spell_error_color = \"#%02x%02x%02x\"\n",


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