[evolution-patches] Spell Changes



This removes the language property from the gtkhtml class properties. 
It removes a bunch of unneeded logic and should function exactly the
same.  This part of my large preferences patch that I am trying to split
up for readability.

--Larry
? autom4te.cache
? stamp-h1
? components/html-editor/test_editor
Index: components/html-editor/spell.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/components/html-editor/spell.c,v
retrieving revision 1.40
diff -u -p -r1.40 spell.c
--- components/html-editor/spell.c	9 Apr 2003 11:10:38 -0000	1.40
+++ components/html-editor/spell.c	20 May 2003 14:40:18 -0000
@@ -23,7 +23,7 @@
 #include <config.h>
 #include <glib.h>
 #include <libgnome/gnome-i18n.h>
-
+#include <gal/util/e-iconv.h>
 #include "gtkhtml.h"
 #include "gtkhtml-properties.h"
 
@@ -139,6 +139,19 @@ spell_set_language (GtkHTML *html, const
 void
 spell_init (GtkHTML *html, GtkHTMLControlData *cd)
 {
+	GConfClient *gconf = gconf_client_get_default ();
+	GError *error = NULL;
+	char *language;
+
+	language = gconf_client_get_string (gconf, "/GNOME/Spell/language", &error);
+	if (error) {
+		g_warning ("error reading language: %s", error->message);
+		g_error_free (error);
+		language = g_iconv_locale_language ();
+	}
+
+	html_engine_set_language (html->engine, language);
+	g_object_unref (gconf);
 }
 
 static void
Index: src/gtkhtml-private.h
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/gtkhtml-private.h,v
retrieving revision 1.38
diff -u -p -r1.38 gtkhtml-private.h
--- src/gtkhtml-private.h	29 Apr 2003 16:02:48 -0000	1.38
+++ src/gtkhtml-private.h	20 May 2003 14:40:18 -0000
@@ -51,7 +51,6 @@ struct _GtkHTMLPrivate {
 
 	guint set_font_id;
 	guint notify_id;
-	guint notify_spell_id;
 
 	GtkIMContext *im_context;
 	gboolean need_im_reset;
Index: src/gtkhtml-properties.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/gtkhtml-properties.c,v
retrieving revision 1.92
diff -u -p -r1.92 gtkhtml-properties.c
--- src/gtkhtml-properties.c	16 Apr 2003 17:51:55 -0000	1.92
+++ src/gtkhtml-properties.c	20 May 2003 14:40:18 -0000
@@ -72,7 +72,6 @@ gtk_html_class_properties_new (GtkWidget
 	/* editing */
 	p->magic_links             = TRUE;
 	p->live_spell_check        = TRUE;
-	p->language                = g_strdup (e_iconv_locale_language ());
 
 	/* printf ("Variable Printing Font: \"%s\"\n", p->font_var_print); */
 	p->font_var_print          = g_strdup (pango_font_description_get_family (var_desc));
@@ -90,7 +89,6 @@ gtk_html_class_properties_destroy (GtkHT
 {
 	g_free (p->font_fix_print);
 	g_free (p->font_var_print);
-	g_free (p->language);
 	g_free (p);
 }
 
@@ -101,14 +99,6 @@ gtk_html_class_properties_destroy (GtkHT
         gconf_value_free (val); } \
         g_free (key);
 
-#define GNOME_SPELL_GCONF_DIR "/GNOME/Spell"
-#define GETSP(t,x,prop,f,c) \
-        key = g_strconcat (GNOME_SPELL_GCONF_DIR, x, NULL); \
-        val = gconf_client_get_without_default (client, key, NULL); \
-        if (val) { f; p->prop = c (gconf_value_get_ ## t (val)); \
-        gconf_value_free (val); } \
-        g_free (key);
-
 void
 gtk_html_class_properties_load (GtkHTMLClassProperties *p, GConfClient *client)
 {
@@ -119,9 +109,6 @@ gtk_html_class_properties_load (GtkHTMLC
 
 	GET (bool, "/magic_links", magic_links,,);
 	GET (bool, "/animations", animations,,);
-
-	GETSP (string, "/language", language,
-	       g_free (p->language), g_strdup);
 
 }
 
Index: src/gtkhtml-properties.h
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/gtkhtml-properties.h,v
retrieving revision 1.24
diff -u -p -r1.24 gtkhtml-properties.h
--- src/gtkhtml-properties.h	9 Apr 2003 18:57:14 -0000	1.24
+++ src/gtkhtml-properties.h	20 May 2003 14:40:18 -0000
@@ -50,7 +50,6 @@ struct _GtkHTMLClassProperties {
 	/* editor */
 	gboolean  magic_links;
 	gboolean  live_spell_check;
-	gchar    *language;
 };
 
 GtkHTMLClassProperties * gtk_html_class_properties_new       (GtkWidget *widget);
Index: src/gtkhtml.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/gtkhtml.c,v
retrieving revision 1.511
diff -u -p -r1.511 gtkhtml.c
--- src/gtkhtml.c	16 May 2003 15:33:10 -0000	1.511
+++ src/gtkhtml.c	20 May 2003 14:40:19 -0000
@@ -89,8 +89,6 @@ static GtkTargetEntry dnd_link_sources [
 };
 #define DND_LINK_SOURCES sizeof (dnd_link_sources) / sizeof (GtkTargetEntry)
 
-#define GNOME_SPELL_GCONF_DIR "/GNOME/Spell"
-
 #define d_s(x)
 
 static GtkLayoutClass *parent_class = NULL;
@@ -710,11 +708,6 @@ destroy (GtkObject *object)
 			html->priv->notify_id = 0;
 		}
 
-		if (html->priv->notify_spell_id) {
-			gconf_client_notify_remove (gconf_client, html->priv->notify_spell_id);
-			html->priv->notify_spell_id = 0;
-		}
-
 		g_free (html->priv->content_type);
 		g_free (html->priv);
 		html->priv = NULL;
@@ -1975,27 +1968,6 @@ client_notify_widget (GConfClient* clien
 }
 
 static void
-client_notify_spell_widget (GConfClient* client, guint cnxn_id, GConfEntry* entry, gpointer user_data)
-{
-	GtkHTML *html = (GtkHTML *) user_data;
-	GtkHTMLClass *klass = GTK_HTML_CLASS (GTK_WIDGET_GET_CLASS (html));
-	GtkHTMLClassProperties *prop = klass->properties;	
-	gchar *tkey;
-
-	g_assert (client == gconf_client);
-	g_assert (entry->key);
-	tkey = strrchr (entry->key, '/');
-	g_assert (tkey);
-
-	if (!strcmp (tkey, "/language")) {
-		g_free (prop->language);
-		prop->language = g_strdup (gconf_client_get_string (client, entry->key, NULL));
-		if (!html->engine->language)
-			gtk_html_api_set_language (html);
-	}
-}
-
-static void
 client_notify_class (GConfClient* client,
 		     guint cnxn_id,
 		     GConfEntry* entry,
@@ -2040,11 +2012,7 @@ get_class_properties (GtkHTML *html)
 		gconf_client_add_dir (gconf_client, GTK_HTML_GCONF_DIR, GCONF_CLIENT_PRELOAD_ONELEVEL, &gconf_error);
 		if (gconf_error)
 			g_error ("gconf error: %s\n", gconf_error->message);
-		gconf_client_add_dir (gconf_client, GNOME_SPELL_GCONF_DIR, GCONF_CLIENT_PRELOAD_ONELEVEL, &gconf_error);
-		if (gconf_error)
-			g_error ("gconf error: %s\n", gconf_error->message);
 		gtk_html_class_properties_load (klass->properties, gconf_client);
-
 		gconf_client_notify_add (gconf_client, GTK_HTML_GCONF_DIR, client_notify_class, klass, NULL, &gconf_error);
 		if (gconf_error)
 			g_warning ("gconf error: %s\n", gconf_error->message);
@@ -2706,13 +2674,6 @@ init_properties_widget (GtkHTML *html)
 	if (gconf_error) {
 		g_warning ("gconf error: %s\n", gconf_error->message);
 		html->priv->notify_id = 0;
-	}
-
-	html->priv->notify_spell_id = gconf_client_notify_add (gconf_client, GNOME_SPELL_GCONF_DIR,
-							       client_notify_spell_widget, html, NULL, &gconf_error);
-	if (gconf_error) {
-		g_warning ("gconf error: %s\n", gconf_error->message);
-		html->priv->notify_spell_id = 0;
 	}
 }
 
Index: src/htmlengine.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/htmlengine.c,v
retrieving revision 1.542
diff -u -p -r1.542 htmlengine.c
--- src/htmlengine.c	19 May 2003 19:10:36 -0000	1.542
+++ src/htmlengine.c	20 May 2003 14:40:20 -0000
@@ -5583,8 +5583,6 @@ html_engine_get_language (HTMLEngine *e)
 
 	language = e->language;
 	if (!language)
-		language = GTK_HTML_CLASS (GTK_WIDGET_GET_CLASS (e->widget))->properties->language;
-	if (!language)
 		language = "";
 
 	return language;


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