[gspell] Entry: change underline to PANGO_UNDERLINE_SINGLE



commit ea601012912a43a9119ee1d0654f848f014e69e1
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Fri Mar 31 19:16:48 2017 +0200

    Entry: change underline to PANGO_UNDERLINE_SINGLE
    
    To be consistent with the GtkTextView support.

 gspell/gspell-entry.c |   19 ++++++++++++-------
 gspell/gspell-utils.c |    6 ++++++
 gspell/gspell-utils.h |    3 +++
 3 files changed, 21 insertions(+), 7 deletions(-)
---
diff --git a/gspell/gspell-entry.c b/gspell/gspell-entry.c
index 246b414..846e8f4 100644
--- a/gspell/gspell-entry.c
+++ b/gspell/gspell-entry.c
@@ -23,6 +23,7 @@
 #include "gspell-entry-utils.h"
 #include "gspell-context-menu.h"
 #include "gspell-current-word-policy.h"
+#include "gspell-utils.h"
 
 /**
  * SECTION:entry
@@ -30,11 +31,11 @@
  * @Short_description: Spell checking support for GtkEntry
  *
  * #GspellEntry extends the #GtkEntry class with inline spell checking.
- * Misspelled words are highlighted with a %PANGO_UNDERLINE_ERROR, usually a red
- * wavy underline. Right-clicking a misspelled word pops up a context menu of
- * suggested replacements. The context menu also contains an “Ignore All” item
- * to add the misspelled word to the session dictionary. And an “Add” item to
- * add the word to the personal dictionary.
+ * Misspelled words are highlighted with a red %PANGO_UNDERLINE_SINGLE.
+ * Right-clicking a misspelled word pops up a context menu of suggested
+ * replacements. The context menu also contains an “Ignore All” item to add the
+ * misspelled word to the session dictionary. And an “Add” item to add the word
+ * to the personal dictionary.
  *
  * For a basic use-case, there is the gspell_entry_basic_setup() convenience
  * function.
@@ -45,6 +46,10 @@
  *
  * Note that #GspellEntry extends the #GtkEntry class but without subclassing
  * it, because #GtkEntry is already subclassed by #GtkSearchEntry for example.
+ *
+ * %PANGO_UNDERLINE_SINGLE is used for consistency with #GspellTextView.
+ * If you want a %PANGO_UNDERLINE_ERROR instead (a wavy underline), please fix
+ * [this bug](https://bugzilla.gnome.org/show_bug.cgi?id=763741) first.
  */
 
 struct _GspellEntry
@@ -182,11 +187,11 @@ insert_underline (GspellEntry *gspell_entry,
        PangoAttribute *attr_underline_color;
        PangoAttrList *attr_list;
 
-       attr_underline = pango_attr_underline_new (PANGO_UNDERLINE_ERROR);
+       attr_underline = pango_attr_underline_new (PANGO_UNDERLINE_SINGLE);
        attr_underline->start_index = byte_start;
        attr_underline->end_index = byte_end;
 
-       attr_underline_color = pango_attr_underline_color_new (65535, 0, 0);
+       attr_underline_color = _gspell_utils_create_pango_attr_underline_color ();
        attr_underline_color->start_index = byte_start;
        attr_underline_color->end_index = byte_end;
 
diff --git a/gspell/gspell-utils.c b/gspell/gspell-utils.c
index 4582b1c..d5174d5 100644
--- a/gspell/gspell-utils.c
+++ b/gspell/gspell-utils.c
@@ -219,4 +219,10 @@ _gspell_utils_init_underline_rgba (GdkRGBA *underline_color)
        underline_color->alpha = 1.0;
 }
 
+PangoAttribute *
+_gspell_utils_create_pango_attr_underline_color (void)
+{
+       return pango_attr_underline_color_new (65535 * UNDERLINE_COLOR_RED_INTENSITY, 0, 0);
+}
+
 /* ex:set ts=8 noet: */
diff --git a/gspell/gspell-utils.h b/gspell/gspell-utils.h
index 63f482b..e1e465b 100644
--- a/gspell/gspell-utils.h
+++ b/gspell/gspell-utils.h
@@ -57,6 +57,9 @@ gboolean      _gspell_utils_is_apostrophe_or_dash     (gunichar ch);
 G_GNUC_INTERNAL
 void           _gspell_utils_init_underline_rgba       (GdkRGBA *underline_color);
 
+G_GNUC_INTERNAL
+PangoAttribute *_gspell_utils_create_pango_attr_underline_color (void);
+
 G_END_DECLS
 
 #endif /* GSPELL_UTILS_H */


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