コード例 #1
0
static void
spell_dialog_finalize (GObject *object)
{
	GtkhtmlSpellDialogPrivate *priv;

	priv = GTKHTML_SPELL_DIALOG (object)->priv;

	g_free (priv->word);

	/* Chain up to parent's finalize() method. */
	G_OBJECT_CLASS (parent_class)->finalize (object);
}
コード例 #2
0
static void
spell_dialog_dispose (GObject *object)
{
	GtkhtmlSpellDialogPrivate *priv;

	priv = GTKHTML_SPELL_DIALOG (object)->priv;

	if (priv->add_word_button != NULL) {
		g_object_unref (priv->add_word_button);
		priv->add_word_button = NULL;
	}

	if (priv->back_button != NULL) {
		g_object_unref (priv->back_button);
		priv->back_button = NULL;
	}

	if (priv->dictionary_combo != NULL) {
		g_object_unref (priv->dictionary_combo);
		priv->dictionary_combo = NULL;
	}

	if (priv->ignore_button != NULL) {
		g_object_unref (priv->ignore_button);
		priv->ignore_button = NULL;
	}

	if (priv->replace_button != NULL) {
		g_object_unref (priv->replace_button);
		priv->replace_button = NULL;
	}

	if (priv->replace_all_button != NULL) {
		g_object_unref (priv->replace_all_button);
		priv->replace_all_button = NULL;
	}

	if (priv->skip_button != NULL) {
		g_object_unref (priv->skip_button);
		priv->skip_button = NULL;
	}

	if (priv->tree_view != NULL) {
		g_object_unref (priv->tree_view);
		priv->tree_view = NULL;
	}

	/* Chain up to parent's dispose() method. */
	G_OBJECT_CLASS (parent_class)->dispose (object);
}
コード例 #3
0
static void
spell_dialog_get_property (GObject *object,
                           guint property_id,
                           GValue *value,
                           GParamSpec *pspec)
{
	switch (property_id) {
		case PROP_WORD:
			g_value_set_string (
				value, gtkhtml_spell_dialog_get_word (
				GTKHTML_SPELL_DIALOG (object)));
			return;
	}

	G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
コード例 #4
0
ファイル: gtkhtml-editor-private.c プロジェクト: 0lvin/ghtml
void
gtkhtml_editor_spell_check (GtkhtmlEditor *editor,
                            gboolean whole_document)
{
	GtkHTML *html;
	gboolean spelling_errors;

	g_return_if_fail (GTKHTML_IS_EDITOR (editor));

	html = gtkhtml_editor_get_html (editor);

	if (whole_document) {
		html_engine_disable_selection (html->engine);
		html_engine_beginning_of_document (html->engine);
		gtk_html_set_inline_spelling (html, TRUE);
	}

	spelling_errors =
		!html_engine_spell_word_is_valid (html->engine) ||
		gtkhtml_editor_next_spell_error (editor);

	if (spelling_errors) {
		GtkWidget *dialog;

		dialog = gtkhtml_spell_dialog_new (GTK_WINDOW (editor));

		gtkhtml_spell_dialog_set_spell_checkers (
			GTKHTML_SPELL_DIALOG (dialog),
			editor->priv->active_spell_checkers);

		editor_set_word (editor, GTKHTML_SPELL_DIALOG (dialog));

		g_signal_connect_swapped (
			dialog, "added",
			G_CALLBACK (editor_recheck_cb), editor);

		g_signal_connect_swapped (
			dialog, "ignored",
			G_CALLBACK (editor_recheck_cb), editor);

		g_signal_connect_swapped (
			dialog, "next-word",
			G_CALLBACK (editor_next_word_cb), editor);

		g_signal_connect_swapped (
			dialog, "prev-word",
			G_CALLBACK (editor_prev_word_cb), editor);

		g_signal_connect_swapped (
			dialog, "replace",
			G_CALLBACK (editor_replace_cb), editor);

		g_signal_connect_swapped (
			dialog, "replace-all",
			G_CALLBACK (editor_replace_all_cb), editor);

		gtk_dialog_run (GTK_DIALOG (dialog));

		gtk_widget_destroy (dialog);
	}

	/* XXX Restore original inline spelling value. */
}