Blob Blame History Raw
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Error checking: GtkSpell Reference Manual</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="index.html" title="GtkSpell Reference Manual">
<link rel="up" href="chapter-tutorial.html" title="GtkSpell Tutorial">
<link rel="prev" href="chapter-tutorial.html" title="GtkSpell Tutorial">
<link rel="next" href="tutorial-advanced.html" title="Advanced usage">
<meta name="generator" content="GTK-Doc V1.25 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
<td width="100%" align="left" class="shortcuts"></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
<td><a accesskey="u" href="chapter-tutorial.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
<td><a accesskey="p" href="chapter-tutorial.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="tutorial-advanced.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
</tr></table>
<div class="sect1">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="tutorial-lang"></a>Error checking</h2></div></div></div>
<p><code class="function">gtk_spell_checker_set_language</code> returns
<code class="literal">FALSE</code> if there was an error. If a
<em class="parameter"><code>GError **</code></em> was provided as the last argument, the error
message can be displayed to the user:</p>
<pre class="programlisting">
GError *err = NULL; /* this initialization is important. */
/* ... */
GtkSpellChecker* spell = gtk_spell_checker_new ();
if (!gtk_spell_checker_set_language (spell, "en_US", &amp;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-&gt;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! */
  }
</pre>
</div>
<div class="footer">
<hr>Generated by GTK-Doc V1.25</div>
</body>
</html>