[gedit] spell-checker-dialog: use G_DECLARE macro



commit 6fa1ed69a8f9326d3b6b1dca0ec6288c3138d65a
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Sat Aug 1 17:53:44 2015 +0200

    spell-checker-dialog: use G_DECLARE macro

 plugins/spell/gedit-spell-checker-dialog.c |  226 +++++++++++++++++-----------
 plugins/spell/gedit-spell-checker-dialog.h |   15 +--
 2 files changed, 143 insertions(+), 98 deletions(-)
---
diff --git a/plugins/spell/gedit-spell-checker-dialog.c b/plugins/spell/gedit-spell-checker-dialog.c
index 2697495..b89274a 100644
--- a/plugins/spell/gedit-spell-checker-dialog.c
+++ b/plugins/spell/gedit-spell-checker-dialog.c
@@ -22,10 +22,10 @@
 #include "gedit-spell-checker-dialog.h"
 #include <glib/gi18n.h>
 
-struct _GeditSpellCheckerDialog
-{
-       GtkDialog parent_instance;
+typedef struct _GeditSpellCheckerDialogPrivate GeditSpellCheckerDialogPrivate;
 
+struct _GeditSpellCheckerDialogPrivate
+{
        GeditSpellChecker *spell_checker;
 
        gchar *misspelled_word;
@@ -63,21 +63,24 @@ enum
 
 static guint signals[LAST_SIGNAL] = { 0 };
 
-G_DEFINE_TYPE (GeditSpellCheckerDialog, gedit_spell_checker_dialog, GTK_TYPE_DIALOG)
+G_DEFINE_TYPE_WITH_PRIVATE (GeditSpellCheckerDialog, gedit_spell_checker_dialog, GTK_TYPE_DIALOG)
 
 static void
 set_spell_checker (GeditSpellCheckerDialog *dialog,
                   GeditSpellChecker       *checker)
 {
+       GeditSpellCheckerDialogPrivate *priv;
        GtkHeaderBar *header_bar;
        const GeditSpellCheckerLanguage *lang;
 
-       g_return_if_fail (dialog->spell_checker == NULL);
-       dialog->spell_checker = g_object_ref (checker);
+       priv = gedit_spell_checker_dialog_get_instance_private (dialog);
+
+       g_return_if_fail (priv->spell_checker == NULL);
+       priv->spell_checker = g_object_ref (checker);
 
        header_bar = GTK_HEADER_BAR (gtk_dialog_get_header_bar (GTK_DIALOG (dialog)));
 
-       lang = gedit_spell_checker_get_language (dialog->spell_checker);
+       lang = gedit_spell_checker_get_language (priv->spell_checker);
 
        gtk_header_bar_set_subtitle (header_bar,
                                     gedit_spell_checker_language_to_string (lang));
@@ -91,12 +94,14 @@ gedit_spell_checker_dialog_get_property (GObject    *object,
                                         GValue     *value,
                                         GParamSpec *pspec)
 {
-       GeditSpellCheckerDialog *dialog = GEDIT_SPELL_CHECKER_DIALOG (object);
+       GeditSpellCheckerDialogPrivate *priv;
+
+       priv = gedit_spell_checker_dialog_get_instance_private (GEDIT_SPELL_CHECKER_DIALOG (object));
 
        switch (prop_id)
        {
                case PROP_SPELL_CHECKER:
-                       g_value_set_object (value, dialog->spell_checker);
+                       g_value_set_object (value, priv->spell_checker);
                        break;
 
                default:
@@ -128,9 +133,11 @@ gedit_spell_checker_dialog_set_property (GObject      *object,
 static void
 gedit_spell_checker_dialog_dispose (GObject *object)
 {
-       GeditSpellCheckerDialog *dialog = GEDIT_SPELL_CHECKER_DIALOG (object);
+       GeditSpellCheckerDialogPrivate *priv;
+
+       priv = gedit_spell_checker_dialog_get_instance_private (GEDIT_SPELL_CHECKER_DIALOG (object));
 
-       g_clear_object (&dialog->spell_checker);
+       g_clear_object (&priv->spell_checker);
 
        G_OBJECT_CLASS (gedit_spell_checker_dialog_parent_class)->dispose (object);
 }
@@ -138,9 +145,11 @@ gedit_spell_checker_dialog_dispose (GObject *object)
 static void
 gedit_spell_checker_dialog_finalize (GObject *object)
 {
-       GeditSpellCheckerDialog *dialog = GEDIT_SPELL_CHECKER_DIALOG (object);
+       GeditSpellCheckerDialogPrivate *priv;
+
+       priv = gedit_spell_checker_dialog_get_instance_private (GEDIT_SPELL_CHECKER_DIALOG (object));
 
-       g_free (dialog->misspelled_word);
+       g_free (priv->misspelled_word);
 
        G_OBJECT_CLASS (gedit_spell_checker_dialog_parent_class)->finalize (object);
 }
@@ -199,41 +208,47 @@ gedit_spell_checker_dialog_class_init (GeditSpellCheckerDialogClass *klass)
        /* Bind class to template */
        gtk_widget_class_set_template_from_resource (widget_class,
                                                     "/org/gnome/gedit/plugins/spell/ui/spell-checker.ui");
-       gtk_widget_class_bind_template_child (widget_class, GeditSpellCheckerDialog, misspelled_word_label);
-       gtk_widget_class_bind_template_child (widget_class, GeditSpellCheckerDialog, word_entry);
-       gtk_widget_class_bind_template_child (widget_class, GeditSpellCheckerDialog, check_word_button);
-       gtk_widget_class_bind_template_child (widget_class, GeditSpellCheckerDialog, ignore_button);
-       gtk_widget_class_bind_template_child (widget_class, GeditSpellCheckerDialog, ignore_all_button);
-       gtk_widget_class_bind_template_child (widget_class, GeditSpellCheckerDialog, change_button);
-       gtk_widget_class_bind_template_child (widget_class, GeditSpellCheckerDialog, change_all_button);
-       gtk_widget_class_bind_template_child (widget_class, GeditSpellCheckerDialog, add_word_button);
-       gtk_widget_class_bind_template_child (widget_class, GeditSpellCheckerDialog, suggestions_view);
+       gtk_widget_class_bind_template_child_private (widget_class, GeditSpellCheckerDialog, 
misspelled_word_label);
+       gtk_widget_class_bind_template_child_private (widget_class, GeditSpellCheckerDialog, word_entry);
+       gtk_widget_class_bind_template_child_private (widget_class, GeditSpellCheckerDialog, 
check_word_button);
+       gtk_widget_class_bind_template_child_private (widget_class, GeditSpellCheckerDialog, ignore_button);
+       gtk_widget_class_bind_template_child_private (widget_class, GeditSpellCheckerDialog, 
ignore_all_button);
+       gtk_widget_class_bind_template_child_private (widget_class, GeditSpellCheckerDialog, change_button);
+       gtk_widget_class_bind_template_child_private (widget_class, GeditSpellCheckerDialog, 
change_all_button);
+       gtk_widget_class_bind_template_child_private (widget_class, GeditSpellCheckerDialog, add_word_button);
+       gtk_widget_class_bind_template_child_private (widget_class, GeditSpellCheckerDialog, 
suggestions_view);
 }
 
 static void
 clear_suggestions (GeditSpellCheckerDialog *dialog)
 {
+       GeditSpellCheckerDialogPrivate *priv;
        GtkListStore *store;
 
-       store = GTK_LIST_STORE (gtk_tree_view_get_model (dialog->suggestions_view));
+       priv = gedit_spell_checker_dialog_get_instance_private (dialog);
+
+       store = GTK_LIST_STORE (gtk_tree_view_get_model (priv->suggestions_view));
        gtk_list_store_clear (store);
 
-       gtk_tree_view_columns_autosize (dialog->suggestions_view);
+       gtk_tree_view_columns_autosize (priv->suggestions_view);
 }
 
 static void
 set_suggestions (GeditSpellCheckerDialog *dialog,
                 GSList                  *suggestions)
 {
+       GeditSpellCheckerDialogPrivate *priv;
        GtkListStore *store;
        GtkTreeIter iter;
        GtkTreeSelection *selection;
        const gchar *first_suggestion;
        GSList *l;
 
+       priv = gedit_spell_checker_dialog_get_instance_private (dialog);
+
        clear_suggestions (dialog);
 
-       store = GTK_LIST_STORE (gtk_tree_view_get_model (dialog->suggestions_view));
+       store = GTK_LIST_STORE (gtk_tree_view_get_model (priv->suggestions_view));
 
        if (suggestions == NULL)
        {
@@ -246,15 +261,15 @@ set_suggestions (GeditSpellCheckerDialog *dialog,
                                    COLUMN_SUGGESTION, _("(no suggested words)"),
                                    -1);
 
-               gtk_entry_set_text (dialog->word_entry, "");
-               gtk_widget_set_sensitive (GTK_WIDGET (dialog->suggestions_view), FALSE);
+               gtk_entry_set_text (priv->word_entry, "");
+               gtk_widget_set_sensitive (GTK_WIDGET (priv->suggestions_view), FALSE);
                return;
        }
 
-       gtk_widget_set_sensitive (GTK_WIDGET (dialog->suggestions_view), TRUE);
+       gtk_widget_set_sensitive (GTK_WIDGET (priv->suggestions_view), TRUE);
 
        first_suggestion = suggestions->data;
-       gtk_entry_set_text (dialog->word_entry, first_suggestion);
+       gtk_entry_set_text (priv->word_entry, first_suggestion);
 
        for (l = suggestions; l != NULL; l = l->next)
        {
@@ -266,7 +281,7 @@ set_suggestions (GeditSpellCheckerDialog *dialog,
                                    -1);
        }
 
-       selection = gtk_tree_view_get_selection (dialog->suggestions_view);
+       selection = gtk_tree_view_get_selection (priv->suggestions_view);
        gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter);
        gtk_tree_selection_select_iter (selection, &iter);
 }
@@ -275,23 +290,29 @@ static void
 word_entry_changed_handler (GtkEntry                *word_entry,
                            GeditSpellCheckerDialog *dialog)
 {
+       GeditSpellCheckerDialogPrivate *priv;
        gboolean sensitive;
 
+       priv = gedit_spell_checker_dialog_get_instance_private (dialog);
+
        sensitive = gtk_entry_get_text_length (word_entry) > 0;
 
-       gtk_widget_set_sensitive (dialog->check_word_button, sensitive);
-       gtk_widget_set_sensitive (dialog->change_button, sensitive);
-       gtk_widget_set_sensitive (dialog->change_all_button, sensitive);
+       gtk_widget_set_sensitive (priv->check_word_button, sensitive);
+       gtk_widget_set_sensitive (priv->change_button, sensitive);
+       gtk_widget_set_sensitive (priv->change_all_button, sensitive);
 }
 
 static void
 suggestions_selection_changed_handler (GtkTreeSelection        *selection,
                                       GeditSpellCheckerDialog *dialog)
 {
+       GeditSpellCheckerDialogPrivate *priv;
        GtkTreeModel *model;
        GtkTreeIter iter;
        gchar *text;
 
+       priv = gedit_spell_checker_dialog_get_instance_private (dialog);
+
        if (!gtk_tree_selection_get_selected (selection, &model, &iter))
        {
                return;
@@ -301,7 +322,7 @@ suggestions_selection_changed_handler (GtkTreeSelection        *selection,
                            COLUMN_SUGGESTION, &text,
                            -1);
 
-       gtk_entry_set_text (dialog->word_entry, text);
+       gtk_entry_set_text (priv->word_entry, text);
 
        g_free (text);
 }
@@ -310,15 +331,18 @@ static void
 check_word_button_clicked_handler (GtkButton               *button,
                                   GeditSpellCheckerDialog *dialog)
 {
+       GeditSpellCheckerDialogPrivate *priv;
        const gchar *word;
        gboolean correctly_spelled;
        GError *error = NULL;
 
-       g_return_if_fail (gtk_entry_get_text_length (dialog->word_entry) > 0);
+       priv = gedit_spell_checker_dialog_get_instance_private (dialog);
 
-       word = gtk_entry_get_text (dialog->word_entry);
+       g_return_if_fail (gtk_entry_get_text_length (priv->word_entry) > 0);
 
-       correctly_spelled = gedit_spell_checker_check_word (dialog->spell_checker, word, &error);
+       word = gtk_entry_get_text (priv->word_entry);
+
+       correctly_spelled = gedit_spell_checker_check_word (priv->spell_checker, word, &error);
 
        if (error != NULL)
        {
@@ -334,7 +358,7 @@ check_word_button_clicked_handler (GtkButton               *button,
 
                clear_suggestions (dialog);
 
-               store = GTK_LIST_STORE (gtk_tree_view_get_model (dialog->suggestions_view));
+               store = GTK_LIST_STORE (gtk_tree_view_get_model (priv->suggestions_view));
 
                gtk_list_store_append (store, &iter);
                gtk_list_store_set (store, &iter,
@@ -345,13 +369,13 @@ check_word_button_clicked_handler (GtkButton               *button,
                                    COLUMN_SUGGESTION, _("(correct spelling)"),
                                    -1);
 
-               gtk_widget_set_sensitive (GTK_WIDGET (dialog->suggestions_view), FALSE);
+               gtk_widget_set_sensitive (GTK_WIDGET (priv->suggestions_view), FALSE);
        }
        else
        {
                GSList *suggestions;
 
-               suggestions = gedit_spell_checker_get_suggestions (dialog->spell_checker, word);
+               suggestions = gedit_spell_checker_get_suggestions (priv->spell_checker, word);
 
                set_suggestions (dialog, suggestions);
 
@@ -363,10 +387,14 @@ static void
 add_word_button_clicked_handler (GtkButton               *button,
                                 GeditSpellCheckerDialog *dialog)
 {
-       g_return_if_fail (dialog->misspelled_word != NULL);
+       GeditSpellCheckerDialogPrivate *priv;
+
+       priv = gedit_spell_checker_dialog_get_instance_private (dialog);
 
-       gedit_spell_checker_add_word_to_personal (dialog->spell_checker,
-                                                 dialog->misspelled_word);
+       g_return_if_fail (priv->misspelled_word != NULL);
+
+       gedit_spell_checker_add_word_to_personal (priv->spell_checker,
+                                                 priv->misspelled_word);
 
        g_signal_emit (G_OBJECT (dialog), signals[SIGNAL_GOTO_NEXT], 0);
 }
@@ -382,10 +410,14 @@ static void
 ignore_all_button_clicked_handler (GtkButton               *button,
                                   GeditSpellCheckerDialog *dialog)
 {
-       g_return_if_fail (dialog->misspelled_word != NULL);
+       GeditSpellCheckerDialogPrivate *priv;
+
+       priv = gedit_spell_checker_dialog_get_instance_private (dialog);
 
-       gedit_spell_checker_add_word_to_session (dialog->spell_checker,
-                                                dialog->misspelled_word);
+       g_return_if_fail (priv->misspelled_word != NULL);
+
+       gedit_spell_checker_add_word_to_session (priv->spell_checker,
+                                                priv->misspelled_word);
 
        g_signal_emit (G_OBJECT (dialog), signals[SIGNAL_GOTO_NEXT], 0);
 }
@@ -394,20 +426,23 @@ static void
 change_button_clicked_handler (GtkButton               *button,
                               GeditSpellCheckerDialog *dialog)
 {
+       GeditSpellCheckerDialogPrivate *priv;
        gchar *word;
        gchar *change;
 
-       g_return_if_fail (dialog->misspelled_word != NULL);
+       priv = gedit_spell_checker_dialog_get_instance_private (dialog);
+
+       g_return_if_fail (priv->misspelled_word != NULL);
 
-       change = g_strdup (gtk_entry_get_text (dialog->word_entry));
+       change = g_strdup (gtk_entry_get_text (priv->word_entry));
        g_return_if_fail (change != NULL);
        g_return_if_fail (*change != '\0');
 
-       gedit_spell_checker_set_correction (dialog->spell_checker,
-                                           dialog->misspelled_word,
+       gedit_spell_checker_set_correction (priv->spell_checker,
+                                           priv->misspelled_word,
                                            change);
 
-       word = g_strdup (dialog->misspelled_word);
+       word = g_strdup (priv->misspelled_word);
        g_signal_emit (G_OBJECT (dialog), signals[SIGNAL_CHANGE], 0, word, change);
        g_signal_emit (G_OBJECT (dialog), signals[SIGNAL_GOTO_NEXT], 0);
 
@@ -422,27 +457,34 @@ suggestions_row_activated_handler (GtkTreeView             *view,
                                   GtkTreeViewColumn       *column,
                                   GeditSpellCheckerDialog *dialog)
 {
-       change_button_clicked_handler (GTK_BUTTON (dialog->change_button), dialog);
+       GeditSpellCheckerDialogPrivate *priv;
+
+       priv = gedit_spell_checker_dialog_get_instance_private (dialog);
+
+       change_button_clicked_handler (GTK_BUTTON (priv->change_button), dialog);
 }
 
 static void
 change_all_button_clicked_handler (GtkButton               *button,
                                   GeditSpellCheckerDialog *dialog)
 {
+       GeditSpellCheckerDialogPrivate *priv;
        gchar *word;
        gchar *change;
 
-       g_return_if_fail (dialog->misspelled_word != NULL);
+       priv = gedit_spell_checker_dialog_get_instance_private (dialog);
+
+       g_return_if_fail (priv->misspelled_word != NULL);
 
-       change = g_strdup (gtk_entry_get_text (dialog->word_entry));
+       change = g_strdup (gtk_entry_get_text (priv->word_entry));
        g_return_if_fail (change != NULL);
        g_return_if_fail (*change != '\0');
 
-       gedit_spell_checker_set_correction (dialog->spell_checker,
-                                           dialog->misspelled_word,
+       gedit_spell_checker_set_correction (priv->spell_checker,
+                                           priv->misspelled_word,
                                            change);
 
-       word = g_strdup (dialog->misspelled_word);
+       word = g_strdup (priv->misspelled_word);
        g_signal_emit (G_OBJECT (dialog), signals[SIGNAL_CHANGE_ALL], 0, word, change);
        g_signal_emit (G_OBJECT (dialog), signals[SIGNAL_GOTO_NEXT], 0);
 
@@ -453,16 +495,19 @@ change_all_button_clicked_handler (GtkButton               *button,
 static void
 gedit_spell_checker_dialog_init (GeditSpellCheckerDialog *dialog)
 {
+       GeditSpellCheckerDialogPrivate *priv;
        GtkListStore *store;
        GtkTreeViewColumn *column;
        GtkCellRenderer *cell;
        GtkTreeSelection *selection;
 
+       priv = gedit_spell_checker_dialog_get_instance_private (dialog);
+
        gtk_widget_init_template (GTK_WIDGET (dialog));
 
        /* Suggestion list */
        store = gtk_list_store_new (N_COLUMNS, G_TYPE_STRING);
-       gtk_tree_view_set_model (dialog->suggestions_view, GTK_TREE_MODEL (store));
+       gtk_tree_view_set_model (priv->suggestions_view, GTK_TREE_MODEL (store));
        g_object_unref (store);
 
        /* Add the suggestions column */
@@ -471,16 +516,16 @@ gedit_spell_checker_dialog_init (GeditSpellCheckerDialog *dialog)
                                                           "text", COLUMN_SUGGESTION,
                                                           NULL);
 
-       gtk_tree_view_append_column (dialog->suggestions_view, column);
+       gtk_tree_view_append_column (priv->suggestions_view, column);
 
-       gtk_tree_view_set_search_column (dialog->suggestions_view, COLUMN_SUGGESTION);
+       gtk_tree_view_set_search_column (priv->suggestions_view, COLUMN_SUGGESTION);
 
-       selection = gtk_tree_view_get_selection (dialog->suggestions_view);
+       selection = gtk_tree_view_get_selection (priv->suggestions_view);
 
        gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);
 
        /* Connect signals */
-       g_signal_connect (dialog->word_entry,
+       g_signal_connect (priv->word_entry,
                          "changed",
                          G_CALLBACK (word_entry_changed_handler),
                          dialog);
@@ -491,42 +536,42 @@ gedit_spell_checker_dialog_init (GeditSpellCheckerDialog *dialog)
                                 dialog,
                                 0);
 
-       g_signal_connect (dialog->check_word_button,
+       g_signal_connect (priv->check_word_button,
                          "clicked",
                          G_CALLBACK (check_word_button_clicked_handler),
                          dialog);
 
-       g_signal_connect (dialog->add_word_button,
+       g_signal_connect (priv->add_word_button,
                          "clicked",
                          G_CALLBACK (add_word_button_clicked_handler),
                          dialog);
 
-       g_signal_connect (dialog->ignore_button,
+       g_signal_connect (priv->ignore_button,
                          "clicked",
                          G_CALLBACK (ignore_button_clicked_handler),
                          dialog);
 
-       g_signal_connect (dialog->ignore_all_button,
+       g_signal_connect (priv->ignore_all_button,
                          "clicked",
                          G_CALLBACK (ignore_all_button_clicked_handler),
                          dialog);
 
-       g_signal_connect (dialog->change_button,
+       g_signal_connect (priv->change_button,
                          "clicked",
                          G_CALLBACK (change_button_clicked_handler),
                          dialog);
 
-       g_signal_connect (dialog->change_all_button,
+       g_signal_connect (priv->change_all_button,
                          "clicked",
                          G_CALLBACK (change_all_button_clicked_handler),
                          dialog);
 
-       g_signal_connect (dialog->suggestions_view,
+       g_signal_connect (priv->suggestions_view,
                          "row-activated",
                          G_CALLBACK (suggestions_row_activated_handler),
                          dialog);
 
-       gtk_widget_grab_default (dialog->change_button);
+       gtk_widget_grab_default (priv->change_button);
 }
 
 GtkWidget *
@@ -547,22 +592,26 @@ void
 gedit_spell_checker_dialog_set_misspelled_word (GeditSpellCheckerDialog *dialog,
                                                const gchar             *word)
 {
+       GeditSpellCheckerDialogPrivate *priv;
        gchar *label;
        GSList *suggestions;
 
        g_return_if_fail (GEDIT_IS_SPELL_CHECKER_DIALOG (dialog));
        g_return_if_fail (word != NULL);
-       g_return_if_fail (!gedit_spell_checker_check_word (dialog->spell_checker, word, NULL));
 
-       g_free (dialog->misspelled_word);
-       dialog->misspelled_word = g_strdup (word);
+       priv = gedit_spell_checker_dialog_get_instance_private (dialog);
+
+       g_return_if_fail (!gedit_spell_checker_check_word (priv->spell_checker, word, NULL));
+
+       g_free (priv->misspelled_word);
+       priv->misspelled_word = g_strdup (word);
 
        label = g_strdup_printf("<b>%s</b>", word);
-       gtk_label_set_label (dialog->misspelled_word_label, label);
+       gtk_label_set_label (priv->misspelled_word_label, label);
        g_free (label);
 
-       suggestions = gedit_spell_checker_get_suggestions (dialog->spell_checker,
-                                                          dialog->misspelled_word);
+       suggestions = gedit_spell_checker_get_suggestions (priv->spell_checker,
+                                                          priv->misspelled_word);
 
        set_suggestions (dialog, suggestions);
 
@@ -572,25 +621,28 @@ gedit_spell_checker_dialog_set_misspelled_word (GeditSpellCheckerDialog *dialog,
 void
 gedit_spell_checker_dialog_set_completed (GeditSpellCheckerDialog *dialog)
 {
+       GeditSpellCheckerDialogPrivate *priv;
        gchar *label;
 
        g_return_if_fail (GEDIT_IS_SPELL_CHECKER_DIALOG (dialog));
 
+       priv = gedit_spell_checker_dialog_get_instance_private (dialog);
+
        label = g_strdup_printf ("<b>%s</b>", _("Completed spell checking"));
-       gtk_label_set_label (dialog->misspelled_word_label, label);
+       gtk_label_set_label (priv->misspelled_word_label, label);
        g_free (label);
 
        clear_suggestions (dialog);
-       gtk_entry_set_text (dialog->word_entry, "");
-
-       gtk_widget_set_sensitive (GTK_WIDGET (dialog->word_entry), FALSE);
-       gtk_widget_set_sensitive (dialog->check_word_button, FALSE);
-       gtk_widget_set_sensitive (dialog->ignore_button, FALSE);
-       gtk_widget_set_sensitive (dialog->ignore_all_button, FALSE);
-       gtk_widget_set_sensitive (dialog->change_button, FALSE);
-       gtk_widget_set_sensitive (dialog->change_all_button, FALSE);
-       gtk_widget_set_sensitive (dialog->add_word_button, FALSE);
-       gtk_widget_set_sensitive (GTK_WIDGET (dialog->suggestions_view), FALSE);
+       gtk_entry_set_text (priv->word_entry, "");
+
+       gtk_widget_set_sensitive (GTK_WIDGET (priv->word_entry), FALSE);
+       gtk_widget_set_sensitive (priv->check_word_button, FALSE);
+       gtk_widget_set_sensitive (priv->ignore_button, FALSE);
+       gtk_widget_set_sensitive (priv->ignore_all_button, FALSE);
+       gtk_widget_set_sensitive (priv->change_button, FALSE);
+       gtk_widget_set_sensitive (priv->change_all_button, FALSE);
+       gtk_widget_set_sensitive (priv->add_word_button, FALSE);
+       gtk_widget_set_sensitive (GTK_WIDGET (priv->suggestions_view), FALSE);
 }
 
 /* ex:set ts=8 noet: */
diff --git a/plugins/spell/gedit-spell-checker-dialog.h b/plugins/spell/gedit-spell-checker-dialog.h
index f6e5c46..9a0994b 100644
--- a/plugins/spell/gedit-spell-checker-dialog.h
+++ b/plugins/spell/gedit-spell-checker-dialog.h
@@ -26,15 +26,10 @@
 
 G_BEGIN_DECLS
 
-#define GEDIT_TYPE_SPELL_CHECKER_DIALOG            (gedit_spell_checker_dialog_get_type ())
-#define GEDIT_SPELL_CHECKER_DIALOG(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), 
GEDIT_TYPE_SPELL_CHECKER_DIALOG, GeditSpellCheckerDialog))
-#define GEDIT_SPELL_CHECKER_DIALOG_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), 
GEDIT_TYPE_SPELL_CHECKER_DIALOG, GeditSpellCheckerDialog))
-#define GEDIT_IS_SPELL_CHECKER_DIALOG(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), 
GEDIT_TYPE_SPELL_CHECKER_DIALOG))
-#define GEDIT_IS_SPELL_CHECKER_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), 
GEDIT_TYPE_SPELL_CHECKER_DIALOG))
-#define GEDIT_SPELL_CHECKER_DIALOG_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), 
GEDIT_TYPE_SPELL_CHECKER_DIALOG, GeditSpellCheckerDialog))
-
-typedef struct _GeditSpellCheckerDialog                GeditSpellCheckerDialog;
-typedef struct _GeditSpellCheckerDialogClass   GeditSpellCheckerDialogClass;
+#define GEDIT_TYPE_SPELL_CHECKER_DIALOG (gedit_spell_checker_dialog_get_type ())
+G_DECLARE_DERIVABLE_TYPE (GeditSpellCheckerDialog, gedit_spell_checker_dialog,
+                         GEDIT, SPELL_CHECKER_DIALOG,
+                         GtkDialog)
 
 struct _GeditSpellCheckerDialogClass
 {
@@ -52,8 +47,6 @@ struct _GeditSpellCheckerDialogClass
        void    (* goto_next)           (GeditSpellCheckerDialog *dialog);
 };
 
-GType          gedit_spell_checker_dialog_get_type                     (void) G_GNUC_CONST;
-
 GtkWidget *    gedit_spell_checker_dialog_new                          (GtkWindow         *parent,
                                                                         GeditSpellChecker *checker);
 



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