[gnome-software] review-dialog: use gspell instead of GtkSpell



commit bde838109aefbe9b3debea394b2906387370c894
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Sun Feb 11 20:23:21 2018 +0100

    review-dialog: use gspell instead of GtkSpell
    
    It permits to spell-check the summary/title (the GtkEntry) in addition
    to the GtkTextView.
    
    https://gitlab.gnome.org/GNOME/gnome-software/issues/60

 .gitlab-ci.yml                 |  2 +-
 contrib/gnome-software.spec.in |  2 +-
 meson.build                    |  6 +++---
 meson_options.txt              |  2 +-
 src/gs-review-dialog.c         | 22 +++++++++++++---------
 src/meson.build                |  4 ++--
 6 files changed, 21 insertions(+), 17 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index b93223e9..a205c87f 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -19,7 +19,7 @@ before_script:
       gsettings-desktop-schemas-devel \
       gtk3-devel \
       gtk-doc \
-      gtkspell3-devel \
+      gspell-devel \
       json-glib-devel \
       libappstream-glib-devel \
       libgudev1-devel \
diff --git a/contrib/gnome-software.spec.in b/contrib/gnome-software.spec.in
index d7775190..05c9a681 100644
--- a/contrib/gnome-software.spec.in
+++ b/contrib/gnome-software.spec.in
@@ -42,7 +42,7 @@ BuildRequires: gsettings-desktop-schemas-devel >= %{gsettings_desktop_schemas_ve
 BuildRequires: gtk3-devel >= %{gtk3_version}
 BuildRequires: gtk-doc
 BuildRequires: sqlite-devel
-BuildRequires: gtkspell3-devel
+BuildRequires: gspell-devel
 BuildRequires: json-glib-devel >= %{json_glib_version}
 BuildRequires: libappstream-glib-devel >= %{appstream_glib_version}
 BuildRequires: libsoup-devel
diff --git a/meson.build b/meson.build
index d20fc864..ac65d4bd 100644
--- a/meson.build
+++ b/meson.build
@@ -123,9 +123,9 @@ if get_option('enable-gnome-desktop')
   conf.set('HAVE_GNOME_DESKTOP', 1)
 endif
 
-if get_option('enable-gtkspell')
-  gtkspell = dependency('gtkspell3-3.0')
-  conf.set('HAVE_GTKSPELL', 1)
+if get_option('enable-gspell')
+  gspell = dependency('gspell-1')
+  conf.set('HAVE_GSPELL', 1)
 endif
 
 if get_option('enable-polkit')
diff --git a/meson_options.txt b/meson_options.txt
index 50722415..b7699e5f 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,5 +1,5 @@
 option('enable-tests', type : 'boolean', value : true, description : 'enable tests')
-option('enable-gtkspell', type : 'boolean', value : true, description : 'enable gtkspell')
+option('enable-gspell', type : 'boolean', value : true, description : 'enable gspell')
 option('enable-gnome-desktop', type : 'boolean', value : true, description : 'enable gnome-desktop')
 option('enable-man', type : 'boolean', value : true, description : 'enable man pages')
 option('enable-packagekit', type : 'boolean', value : true, description : 'enable PackageKit support')
diff --git a/src/gs-review-dialog.c b/src/gs-review-dialog.c
index f3cd875b..21a2a0bf 100644
--- a/src/gs-review-dialog.c
+++ b/src/gs-review-dialog.c
@@ -24,8 +24,8 @@
 #include <glib/gi18n.h>
 #include <gtk/gtk.h>
 
-#ifdef HAVE_GTKSPELL
-#include <gtkspell/gtkspell.h>
+#ifdef HAVE_GSPELL
+#include <gspell/gspell.h>
 #endif
 
 #include "gs-review-dialog.h"
@@ -46,9 +46,6 @@ struct _GsReviewDialog
        GtkWidget       *summary_entry;
        GtkWidget       *post_button;
        GtkWidget       *text_view;
-#ifdef HAVE_GTKSPELL
-       GtkSpellChecker *spell_checker;
-#endif
        guint            timer_id;
 };
 
@@ -180,11 +177,18 @@ gs_review_dialog_init (GsReviewDialog *dialog)
        gtk_widget_init_template (GTK_WIDGET (dialog));
        gs_star_widget_set_icon_size (GS_STAR_WIDGET (dialog->star), 32);
 
-#ifdef HAVE_GTKSPELL
+#ifdef HAVE_GSPELL
        /* allow checking spelling */
-       dialog->spell_checker = gtk_spell_checker_new ();
-       gtk_spell_checker_attach (dialog->spell_checker,
-                                 GTK_TEXT_VIEW (dialog->text_view));
+       {
+               GspellEntry *gspell_entry;
+               GspellTextView *gspell_view;
+
+               gspell_entry = gspell_entry_get_from_gtk_entry (GTK_ENTRY (dialog->summary_entry));
+               gspell_entry_basic_setup (gspell_entry);
+
+               gspell_view = gspell_text_view_get_from_gtk_text_view (GTK_TEXT_VIEW (dialog->text_view));
+               gspell_text_view_basic_setup (gspell_view);
+       }
 #endif
 
        /* require the user to spend at least 30 seconds on writing a review */
diff --git a/src/meson.build b/src/meson.build
index c90366b3..97e449b5 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -100,8 +100,8 @@ if get_option('enable-gnome-desktop')
   gnome_software_dependencies += [gnome_desktop]
 endif
 
-if get_option('enable-gtkspell')
-  gnome_software_dependencies += [gtkspell]
+if get_option('enable-gspell')
+  gnome_software_dependencies += [gspell]
 endif
 
 executable(


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