[gedit/wip/spell-shaking] spell-checker-dialog: show message "No misspelled words"



commit e96821c7001864ddc0bd3a71c29b25cec4c6f8d6
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Fri Aug 7 11:38:01 2015 +0200

    spell-checker-dialog: show message "No misspelled words"
    
    It was before shown in the statusbar, but showing it in the dialog is
    also a good solution. Ideally the dialog should have an "empty state",
    or "completed state", by hiding the widgets and show only the message
    with an icon. In the statusbar it is easier to miss the message.

 plugins/spell/gedit-spell-checker-dialog.c |   25 +++++++++++++++++++------
 1 files changed, 19 insertions(+), 6 deletions(-)
---
diff --git a/plugins/spell/gedit-spell-checker-dialog.c b/plugins/spell/gedit-spell-checker-dialog.c
index bcbf8d6..082d657 100644
--- a/plugins/spell/gedit-spell-checker-dialog.c
+++ b/plugins/spell/gedit-spell-checker-dialog.c
@@ -41,6 +41,8 @@ struct _GeditSpellCheckerDialogPrivate
        GtkWidget *change_all_button;
        GtkWidget *add_word_button;
        GtkTreeView *suggestions_view;
+
+       guint initialized : 1;
 };
 
 enum
@@ -192,14 +194,9 @@ static void
 set_completed (GeditSpellCheckerDialog *dialog)
 {
        GeditSpellCheckerDialogPrivate *priv;
-       gchar *label;
 
        priv = gedit_spell_checker_dialog_get_instance_private (dialog);
 
-       label = g_strdup_printf ("<b>%s</b>", _("Completed spell checking"));
-       gtk_label_set_label (priv->misspelled_word_label, label);
-       g_free (label);
-
        clear_suggestions (dialog);
        gtk_entry_set_text (priv->word_entry, "");
 
@@ -239,9 +236,25 @@ goto_next (GeditSpellCheckerDialog *dialog)
        }
        else
        {
+               gchar *label;
+
+               if (priv->initialized)
+               {
+                       label = g_strdup_printf ("<b>%s</b>", _("Completed spell checking"));
+               }
+               else
+               {
+                       label = g_strdup_printf ("<b>%s</b>", _("No misspelled words"));
+               }
+
+               gtk_label_set_label (priv->misspelled_word_label, label);
+               g_free (label);
+
                set_completed (dialog);
        }
 
+       priv->initialized = TRUE;
+
        g_free (word);
        g_clear_object (&checker);
 }
@@ -333,7 +346,7 @@ gedit_spell_checker_dialog_show (GtkWidget *widget)
         * GtkTextBuffer). So that's why goto_next() is called after the
         * chain-up.
         */
-       if (priv->misspelled_word == NULL)
+       if (!priv->initialized)
        {
                goto_next (dialog);
        }


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