Only supports GTK+ 2. You can view, comment on, or merge this pull request online at:
https://github.com/geany/geany-plugins/pull/1414
-- Commit Summary --
* GeanyVC: Remove GtkSpell 2.0 code
-- File Changes --
M build/geanyvc.m4 (7) M geanyvc/src/geanyvc.c (9)
-- Patch Links --
https://github.com/geany/geany-plugins/pull/1414.patch https://github.com/geany/geany-plugins/pull/1414.diff
@cjmayo pushed 1 commit.
b65cf7b15e07fbf30124d14777d74cb828dbb9c8 GeanyVC: Remove GtkSpell 2.0 code
@b4n commented on this pull request.
@@ -6,13 +6,12 @@ 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_NAME=gtkspell3-3.0
Could you reuse the old name to simplify the diff? I don't see much reason to change the variable name, is there any?
@@ -41,11 +41,7 @@
#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) +static GtkSpellChecker *gtkspell_new_attach(GtkTextView *view, const gchar *lang, GError **error)
I'd rather just drop the whole compatibility code, and do something like so (untested): ```diff diff --git a/geanyvc/src/geanyvc.c b/geanyvc/src/geanyvc.c index d599759e..3e43302d 100644 --- a/geanyvc/src/geanyvc.c +++ b/geanyvc/src/geanyvc.c @@ -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; @@ -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
@@ -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) + { + 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
```
what do you think?
@cjmayo pushed 1 commit.
1cc56fe50196b935815d2dc207d0a1837795dc29 GeanyVC: Remove GtkSpell 2.0 code
@cjmayo commented on this pull request.
@@ -6,13 +6,12 @@ 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_NAME=gtkspell3-3.0
OK
@cjmayo commented on this pull request.
@@ -41,11 +41,7 @@
#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) +static GtkSpellChecker *gtkspell_new_attach(GtkTextView *view, const gchar *lang, GError **error)
No problem. Works for me.
I've force pushed it because I think the change is clearer in this case.
@b4n approved this pull request.
LGTM and spellchecking and language selection seem to still work OK
github-comments@lists.geany.org