[gnome-software] Add spell checking to the review main text box
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] Add spell checking to the review main text box
- Date: Wed, 10 Feb 2016 17:29:44 +0000 (UTC)
commit b0f6161dac227dccb66a997bb1d2b3feb42620ca
Author: Richard Hughes <richard hughsie com>
Date: Wed Feb 10 17:29:24 2016 +0000
Add spell checking to the review main text box
configure.ac | 2 +-
contrib/gnome-software.spec.in | 1 +
src/gs-review-dialog.c | 8 ++++++++
3 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 0b90b36..32cd13a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -60,7 +60,7 @@ GLIB_GSETTINGS
dnl ---------------------------------------------------------------------------
dnl - Check library dependencies
dnl ---------------------------------------------------------------------------
-PKG_CHECK_MODULES(GTK, gtk+-3.0 >= 3.18.2 gio-unix-2.0)
+PKG_CHECK_MODULES(GTK, gtk+-3.0 >= 3.18.2 gio-unix-2.0 gtkspell3-3.0)
PKG_CHECK_MODULES(APPSTREAM, appstream-glib >= 0.5.5)
PKG_CHECK_MODULES(JSON_GLIB, json-glib-1.0)
PKG_CHECK_MODULES(SQLITE, sqlite3)
diff --git a/contrib/gnome-software.spec.in b/contrib/gnome-software.spec.in
index f7ec008..2b16f76 100644
--- a/contrib/gnome-software.spec.in
+++ b/contrib/gnome-software.spec.in
@@ -23,6 +23,7 @@ BuildRequires: docbook-style-xsl
BuildRequires: desktop-file-utils
BuildRequires: glib2-devel >= 2.39.1
BuildRequires: gtk3-devel >= 3.9.12
+BuildRequires: gtkspell3-devel
BuildRequires: libnotify-devel
BuildRequires: PackageKit-glib-devel >= 0.8.10
BuildRequires: libsoup-devel
diff --git a/src/gs-review-dialog.c b/src/gs-review-dialog.c
index 3c5525b..86e8ede 100644
--- a/src/gs-review-dialog.c
+++ b/src/gs-review-dialog.c
@@ -23,6 +23,7 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
+#include <gtkspell/gtkspell.h>
#include "gs-review-dialog.h"
#include "gs-star-widget.h"
@@ -41,6 +42,7 @@ struct _GsReviewDialog
GtkWidget *summary_entry;
GtkWidget *post_button;
GtkWidget *text_view;
+ GtkSpellChecker *spell_checker;
guint timer_id;
};
@@ -134,6 +136,11 @@ 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);
+ /* allow checking spelling */
+ dialog->spell_checker = gtk_spell_checker_new ();
+ gtk_spell_checker_attach (dialog->spell_checker,
+ GTK_TEXT_VIEW (dialog->text_view));
+
/* require the user to spend at least 30 seconds on writing a review */
dialog->timer_id = g_timeout_add_seconds (WRITING_TIME_MIN,
gs_review_dialog_timeout_cb,
@@ -158,6 +165,7 @@ gs_review_row_dispose (GObject *object)
GsReviewDialog *dialog = GS_REVIEW_DIALOG (object);
if (dialog->timer_id > 0)
g_source_remove (dialog->timer_id);
+ gtk_widget_destroy (dialog->spell_checker);
G_OBJECT_CLASS (gs_review_dialog_parent_class)->dispose (object);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]