Error checking

gtk_spell_checker_set_language returns FALSE if there was an error. If a GError ** was provided as the last argument, the error message can be displayed to the user:

GError *err = NULL; /* this initialization is important. */
/* ... */
GtkSpellChecker* spell = gtk_spell_checker_new ();
if (!gtk_spell_checker_set_language (spell, "en_US", &err))
  {
    GtkWidget *errdlg;
    errdlg = gtk_message_dialog_new (main_application_window,
                                     GTK_DIALOG_DESTROY_WITH_PARENT,
                                     GTK_MESSAGE_ERROR,
                                     GTK_BUTTONS_CLOSE,
                                     "Error initializing spell checking: %s",
                                     err->message);
                                     gtk_dialog_run (GTK_DIALOG (errdlg));
  gtk_widget_destroy (errdlg);
  g_error_free (err); /* don't forget to free GErrors when you're done! */
  }