Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ jobs:
# geanypg
libgpgme-dev
# geanyvc
libgtkspell-dev
libgtkspell3-3-dev
# geaniuspaste/updatechecker
libsoup2.4-dev
Expand Down
3 changes: 1 addition & 2 deletions build/geanyvc.m4
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ AC_DEFUN([GP_CHECK_GEANYVC],
AC_HELP_STRING([--enable-gtkspell=ARG],
[Enable GtkSpell support in GeanyVC. [[default=auto]]]),,
enable_gtkspell=auto)
GP_CHECK_GTK3([gtkspell_package=gtkspell3-3.0],
[gtkspell_package=gtkspell-2.0])
gtkspell_package=gtkspell3-3.0
if [[ x"$enable_gtkspell" = "xauto" ]]; then
PKG_CHECK_MODULES(GTKSPELL, $gtkspell_package,
enable_gtkspell=yes, enable_gtkspell=no)
Expand Down
42 changes: 16 additions & 26 deletions geanyvc/src/geanyvc.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,25 +41,6 @@

#ifdef USE_GTKSPELL
#include <gtkspell/gtkspell.h>
/* forward compatibility with GtkSpell3 */
#if GTK_CHECK_VERSION(3, 0, 0)
#define GtkSpell GtkSpellChecker
#define gtkspell_set_language gtk_spell_checker_set_language
static GtkSpell *gtkspell_new_attach(GtkTextView *view, const gchar *lang, GError **error)
{
GtkSpellChecker *speller = gtk_spell_checker_new();

if (! lang || gtk_spell_checker_set_language(speller, lang, error))
gtk_spell_checker_attach(speller, view);
else
{
g_object_unref(g_object_ref_sink(speller));
speller = NULL;
}

return speller;
}
#endif
#endif

GeanyData *geany_data;
Expand Down Expand Up @@ -1773,7 +1754,7 @@ vccommit_activated(G_GNUC_UNUSED GtkMenuItem * menuitem, G_GNUC_UNUSED gpointer
gint height;

#ifdef USE_GTKSPELL
GtkSpell *speller = NULL;
GtkSpellChecker *speller = NULL;
GError *spellcheck_error = NULL;
#endif

Expand Down Expand Up @@ -1833,13 +1814,22 @@ vccommit_activated(G_GNUC_UNUSED GtkMenuItem * menuitem, G_GNUC_UNUSED gpointer
gtk_paned_set_position(GTK_PANED(vpaned2), height * 50 / 100);

#ifdef USE_GTKSPELL
speller = gtkspell_new_attach(GTK_TEXT_VIEW(messageView), EMPTY(lang) ? NULL : lang, &spellcheck_error);
if (speller == NULL && spellcheck_error != NULL)
speller = gtk_spell_checker_new();

if (EMPTY(lang) || gtk_spell_checker_set_language(speller, lang, &spellcheck_error))
gtk_spell_checker_attach(speller, GTK_TEXT_VIEW(messageView));
else
{
ui_set_statusbar(TRUE, _("Error initializing GeanyVC spell checking: %s. Check your configuration."),
spellcheck_error->message);
g_error_free(spellcheck_error);
spellcheck_error = NULL;
if (spellcheck_error != NULL)
{
ui_set_statusbar(TRUE, _("Error initializing GeanyVC spell checking: %s. Check your configuration."),
spellcheck_error->message);
g_error_free(spellcheck_error);
spellcheck_error = NULL;
}

g_object_unref(g_object_ref_sink(speller));
speller = NULL;
}
#endif

Expand Down