[recipes] Allow building without gspell
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [recipes] Allow building without gspell
- Date: Thu, 29 Dec 2016 16:55:54 +0000 (UTC)
commit 36a5d629cc8f85dba2110c049a9c423805d8e692
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Dec 29 11:35:44 2016 -0500
Allow building without gspell
This will help getting recipes to build on other platforms.
configure.ac | 16 +++++++++++++++-
src/gr-details-page.c | 13 +++++++++----
src/gr-edit-page.c | 29 ++++++++++++++++++++---------
src/gr-preferences.c | 13 ++++++++++---
4 files changed, 54 insertions(+), 17 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 13f6b3c..0863fff 100644
--- a/configure.ac
+++ b/configure.ac
@@ -93,12 +93,25 @@ AX_CHECK_COMPILE_FLAG([-std=gnu11],
dnl ***********************************************************************
+dnl Build options
+dnl ***********************************************************************
+AC_ARG_ENABLE(gspell,
+ [AS_HELP_STRING([--enable-gspell],
+ [Use gspell for spell-checking])],,
+ [enable_gspell="yes"])
+
+if test "x$enable_gspell" = xgspell; then
+ GSPELL_DEP=gspell-1
+ AC_DEFINE([ENABLE_GSPELL], [], [Define to 1 if gspell is used])
+fi
+
+dnl ***********************************************************************
dnl Check for required packages
dnl ***********************************************************************
PKG_CHECK_MODULES(RECIPES, [gio-2.0 >= 2.42
gtk+-3.0 >= 3.20
gnome-autoar-0
- gspell-1])
+ $GSPELL_DEP])
LIBGD_INIT([tagged-entry])
@@ -131,4 +144,5 @@ echo " Options"
echo ""
echo " Prefix ............................... : ${prefix}"
echo " Libdir ............................... : ${libdir}"
+echo " Spell checking ....................... : ${enable_gspell}"
echo ""
diff --git a/src/gr-details-page.c b/src/gr-details-page.c
index 27c7ab4..b791d3b 100644
--- a/src/gr-details-page.c
+++ b/src/gr-details-page.c
@@ -25,7 +25,9 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
+#ifdef ENABLE_GSPELL
#include <gspell/gspell.h>
+#endif
#include "gr-details-page.h"
#include "gr-recipe-store.h"
@@ -580,8 +582,6 @@ schedule_save (GtkTextBuffer *buffer, GrDetailsPage *page)
static void
gr_details_page_init (GrDetailsPage *page)
{
- GspellTextView *gspell_view;
-
gtk_widget_set_has_window (GTK_WIDGET (page), FALSE);
gtk_widget_init_template (GTK_WIDGET (page));
connect_store_signals (page);
@@ -597,8 +597,13 @@ gr_details_page_init (GrDetailsPage *page)
g_signal_connect (gtk_text_view_get_buffer (GTK_TEXT_VIEW (page->notes_field)), "changed",
G_CALLBACK (schedule_save), page);
- gspell_view = gspell_text_view_get_from_gtk_text_view (GTK_TEXT_VIEW (page->notes_field));
- gspell_text_view_basic_setup (gspell_view);
+#ifdef ENABLE_GSPELL
+ {
+ GspellTextView *gspell_view;
+ gspell_view = gspell_text_view_get_from_gtk_text_view (GTK_TEXT_VIEW (page->notes_field));
+ gspell_text_view_basic_setup (gspell_view);
+ }
+#endif
}
static void
diff --git a/src/gr-edit-page.c b/src/gr-edit-page.c
index bd1cc5f..38608b9 100644
--- a/src/gr-edit-page.c
+++ b/src/gr-edit-page.c
@@ -23,7 +23,9 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
+#ifdef ENABLE_GSPELL
#include <gspell/gspell.h>
+#endif
#include "gr-edit-page.h"
#include "gr-recipe-store.h"
@@ -829,8 +831,6 @@ populate_units_list (GrEditPage *self)
static void
gr_edit_page_init (GrEditPage *page)
{
- GspellTextView *gspell_view;
-
gtk_widget_set_has_window (GTK_WIDGET (page), FALSE);
gtk_widget_init_template (GTK_WIDGET (page));
@@ -842,11 +842,17 @@ gr_edit_page_init (GrEditPage *page)
populate_ingredients_list (page);
populate_units_list (page);
- gspell_view = gspell_text_view_get_from_gtk_text_view (GTK_TEXT_VIEW (page->description_field));
- gspell_text_view_basic_setup (gspell_view);
+#ifdef ENABLE_GSPELL
+ {
+ GspellTextView *gspell_view;
- gspell_view = gspell_text_view_get_from_gtk_text_view (GTK_TEXT_VIEW (page->instructions_field));
- gspell_text_view_basic_setup (gspell_view);
+ gspell_view = gspell_text_view_get_from_gtk_text_view (GTK_TEXT_VIEW
(page->description_field));
+ gspell_text_view_basic_setup (gspell_view);
+
+ gspell_view = gspell_text_view_get_from_gtk_text_view (GTK_TEXT_VIEW
(page->instructions_field));
+ gspell_text_view_basic_setup (gspell_view);
+ }
+#endif
}
static gboolean
@@ -1062,7 +1068,6 @@ add_ingredients_segment (GrEditPage *page,
GtkWidget *button;
GtkWidget *stack;
GtkWidget *image;
- GspellEntry *gspell_entry;
segment = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_widget_set_margin_top (segment, 20);
@@ -1092,8 +1097,14 @@ add_ingredients_segment (GrEditPage *page,
gtk_widget_show (entry);
gtk_entry_set_text (GTK_ENTRY (entry), segment_label[0] ? segment_label : _("Ingredients for …"));
- gspell_entry = gspell_entry_get_from_gtk_entry (GTK_ENTRY (entry));
- gspell_entry_basic_setup (gspell_entry);
+#ifdef ENABLE_GSPELL
+ {
+ GspellEntry *gspell_entry;
+
+ gspell_entry = gspell_entry_get_from_gtk_entry (GTK_ENTRY (entry));
+ gspell_entry_basic_setup (gspell_entry);
+ }
+#endif
gtk_box_pack_start (GTK_BOX (box), entry, TRUE, TRUE, 0);
diff --git a/src/gr-preferences.c b/src/gr-preferences.c
index 2012358..2b487e1 100644
--- a/src/gr-preferences.c
+++ b/src/gr-preferences.c
@@ -23,7 +23,9 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
+#ifdef ENABLE_GSPELL
#include <gspell/gspell.h>
+#endif
#include "gr-preferences.h"
#include "gr-chef.h"
@@ -171,7 +173,6 @@ gr_preferences_init (GrPreferences *self)
GrRecipeStore *store;
g_autoptr(GrChef) chef = NULL;
const char *id;
- GspellTextView *gspell_view;
gtk_widget_init_template (GTK_WIDGET (self));
@@ -205,8 +206,14 @@ gr_preferences_init (GrPreferences *self)
g_signal_connect_swapped (self, "delete-event", G_CALLBACK (window_close), self);
- gspell_view = gspell_text_view_get_from_gtk_text_view (GTK_TEXT_VIEW (self->description));
- gspell_text_view_basic_setup (gspell_view);
+#ifdef ENABLE_GSPELL
+ {
+ GspellTextView *gspell_view;
+
+ gspell_view = gspell_text_view_get_from_gtk_text_view (GTK_TEXT_VIEW (self->description));
+ gspell_text_view_basic_setup (gspell_view);
+ }
+#endif
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]