-
Notifications
You must be signed in to change notification settings - Fork 272
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[GeanyVC] use compatible gtkspell on building for gtk3 #342
Conversation
I'm afraid build is failing here
|
Works for me after the mentioned fix. |
@@ -1528,7 +1528,12 @@ vccommit_activated(G_GNUC_UNUSED GtkMenuItem * menuitem, G_GNUC_UNUSED gpointer | |||
gint height; | |||
|
|||
#ifdef USE_GTKSPELL | |||
GtkSpell *speller = NULL; | |||
#if !GTK_CHECK_VERSION (3, 0, 0) | |||
//Since gtk3 will be default in future may be going this way would be better. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment is not very useful, but I agree adding compat layer for older version rather than newer
If we wanted a simpler/less intrusive port, we could just do diff --git a/geanyvc/src/geanyvc.c b/geanyvc/src/geanyvc.c
index a95a991..488f1f2 100644
--- a/geanyvc/src/geanyvc.c
+++ b/geanyvc/src/geanyvc.c
@@ -39,6 +39,25 @@
#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; in the code, and just keep the build system changes from this PR, which are just fine. [edit: fixed unref with regard to floating ref] |
Sorry about the typo. Have made changes according to suggestions made by @b4n . |
Indentation style is incorrect in geanyvc.c (should use tabs (with width=4), like the rest of the file). Commits should be squashed. Apart that, looks good and seems to work fine on both GTK2 and 3. BTW, good job simplifying the error handling that indeed was unnecessarily complex :) |
@b4n Do whatever you consider necessary. Also, I guess the error message should have something about GeanyVC as user may misunderstand it to be message of spell check plugin. Something like
|
When building against gtk3 the gtkspell support was missing for geanyvc plugin commit dialog box.