diff src/gtkutils.c @ 7538:357eb1c39b72

[gaim-migrate @ 8151] Robot101 made a nice patch (which I modified just slightly) to put our gtkspell attachment function that we use all throughout gaim into a utility function, which handles error checking and only does anything if gtkspell support is compiled in. It lets us remove a lot of #ifdef USE_GTKSPELL from places, and doesn't change any functionality. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Mon, 17 Nov 2003 06:48:01 +0000
parents 53c86d59f20b
children 2823111061ba
line wrap: on
line diff
--- a/src/gtkutils.c	Mon Nov 17 06:44:05 2003 +0000
+++ b/src/gtkutils.c	Mon Nov 17 06:48:01 2003 +0000
@@ -30,6 +30,13 @@
 # endif
 #endif /*_WIN32*/
 
+#ifdef USE_GTKSPELL
+# include <gtkspell/gtkspell.h>
+# ifdef _WIN32
+#  include "wspell.h"
+# endif
+#endif
+
 #include <gdk/gdkkeysyms.h>
 
 #include "debug.h"
@@ -45,10 +52,6 @@
 #include "gtkutils.h"
 #include "ui.h"
 
-#ifdef _WIN32
-#include "wspell.h"
-#endif
-
 guint accels_save_timer = 0;
 
 static void
@@ -1029,7 +1032,9 @@
 	return buf;
 }
 
-void gaim_gtk_find_images(const char *message, GSList **list) {
+void
+gaim_gtk_find_images(const char *message, GSList **list)
+{
 	GData *attribs;
 	const char *tmp, *start, *end;
 
@@ -1081,6 +1086,25 @@
 }
 
 void
+gaim_gtk_setup_gtkspell(GtkTextView *textview)
+{
+#ifdef USE_GTKSPELL
+	GError *error = NULL;
+	char *locale = NULL;
+
+	g_return_if_fail(textview != NULL);
+	g_return_if_fail(GTK_IS_TEXT_VIEW(textview));
+
+	if (gtkspell_new_attach(textview, locale, &error) == NULL && error)
+	{
+		gaim_debug_warning("gtkspell", "Failed to setup GtkSpell: %s\n",
+						   error->message);
+		g_error_free(error);
+	}
+#endif /* USE_GTKSPELL */
+}
+
+void
 gaim_gtk_save_accels_cb(GtkAccelGroup *accel_group, guint arg1,
 														 GdkModifierType arg2, GClosure *arg3,
 														 gpointer data)