Commit 698076a5 authored by Alberto Fanjul's avatar Alberto Fanjul

Change gtkspell3 to gspell

parent b975d3ce
Pipeline #102513 passed with stages
in 5 minutes and 51 seconds
......@@ -101,7 +101,7 @@ change and a definite list can be obtained by inspecting configure.ac instead:
- gsettings-desktop-schemas
- libpeas >= 1.5.0
- libpeas-gtk >= 1.5.0
- gtkspell3 >= 3.0.3
- gspell-1 >= 1.8.1
- libdazzle >= 1.0
gitg has a soft dependency on python due to its plugin system. Building gitg
......
......@@ -78,7 +78,7 @@ class Dialog : Gtk.Dialog
private Settings? d_commit_settings;
private bool d_enable_spell_checking;
private string? d_spell_checking_language;
private GtkSpell.Checker? d_spell_checker;
private Gspell.Checker? d_spell_checker;
private Ggit.Diff d_diff;
private bool d_infobar_shown;
private Gtk.CssProvider css_provider;
......@@ -250,7 +250,6 @@ class Dialog : Gtk.Dialog
set
{
d_spell_checking_language = value;
set_spell_language();
}
}
......@@ -265,41 +264,33 @@ class Dialog : Gtk.Dialog
{
if (d_spell_checker == null)
{
d_spell_checker = new GtkSpell.Checker();
d_spell_checker.attach(d_source_view_message);
d_spell_checker = new Gspell.Checker (get_spell_language ());
unowned Gspell.TextBuffer gspell_buffer = Gspell.TextBuffer.get_from_gtk_text_buffer (d_source_view_message.buffer);
gspell_buffer.set_spell_checker (d_spell_checker);
set_spell_language();
d_spell_checker.language_changed.connect(() => {
spell_checking_language = d_spell_checker.get_language();
});
Gspell.TextView gspell_view = Gspell.TextView.get_from_gtk_text_view (d_source_view_message as Gtk.TextView);
gspell_view.inline_spell_checking = true;
gspell_view.enable_language_menu = true;
}
}
else
{
if (d_spell_checker != null)
{
d_spell_checker.detach();
d_spell_checker = null;
}
}
}
}
private void set_spell_language()
private unowned Gspell.Language? get_spell_language ()
{
if (d_spell_checker != null && d_spell_checking_language != "")
{
try
{
d_spell_checker.set_language(d_spell_checking_language);
}
catch
{
warning(_("Cannot set spell checking language: %s"), d_spell_checking_language);
d_spell_checking_language = "";
}
}
string? lang_code = d_spell_checking_language;
if (lang_code[0] == '\0')
return null;
return Gspell.Language.lookup (lang_code);
}
private bool d_use_gravatar;
......@@ -472,14 +463,14 @@ class Dialog : Gtk.Dialog
"subject-margin-position",
SettingsBindFlags.GET);
d_message_settings.bind("enable-spell-checking",
d_message_settings.bind("spell-checking-language",
this,
"enable-spell-checking",
"spell-checking-language",
SettingsBindFlags.GET | SettingsBindFlags.SET);
d_message_settings.bind("spell-checking-language",
d_message_settings.bind("enable-spell-checking",
this,
"spell-checking-language",
"enable-spell-checking",
SettingsBindFlags.GET | SettingsBindFlags.SET);
var interface_settings = new Settings(Gitg.Config.APPLICATION_ID + ".preferences.interface");
......
......@@ -58,7 +58,7 @@ deps = [
gitg_platform_support_dep,
gobject_introspection_dep,
gtksourceview_dep,
gtkspell_dep,
gspell_dep,
libgitg_ext_dep,
libpeas_dep,
libdazzle_dep,
......
......@@ -48,6 +48,8 @@ public class PreferencesCommit : Gtk.Grid, GitgExt.Preferences
[GtkChild (name = "spin_button_right_margin")]
private Gtk.SpinButton d_spin_button_right_margin;
[GtkChild (name = "spell_language_button")]
private Gspell.LanguageChooserButton d_spell_language_button;
[GtkChild (name = "enable_spell_checking")]
private Gtk.CheckButton d_enable_spell_checking;
......@@ -99,6 +101,11 @@ public class PreferencesCommit : Gtk.Grid, GitgExt.Preferences
d_enable_spell_checking,
"active",
SettingsBindFlags.GET | SettingsBindFlags.SET);
settings.bind("spell-checking-language", d_spell_language_button,
"language-code",
SettingsBindFlags.GET | SettingsBindFlags.SET);
}
public Gtk.Widget widget
......
......@@ -65,7 +65,7 @@
<property name="is_focus">False</property>
<property name="row_spacing">6</property>
<property name="column_spacing">6</property>
<property name="margin_start">12</property>
<property name="margin_start">0</property>
<child>
<object class="GtkCheckButton" id="check_button_show_subject_margin">
<property name="label" translatable="yes">Display _subject margin at column:</property>
......@@ -184,6 +184,40 @@
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkGrid" id="grid8">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="column_spacing">12</property>
<property name="margin_start">0</property>
<child>
<object class="GtkLabel" id="label7">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Language:</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GspellLanguageChooserButton" id="spell_language_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="enable_spell_checking">
<property name="label" translatable="yes">Enable spell checking</property>
......@@ -197,7 +231,7 @@
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
<property name="top_attach">3</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
......
......@@ -131,7 +131,7 @@ glib_dep = dependency('glib-2.0', version: glib_req_version)
gobject_introspection_dep = dependency('gobject-introspection-1.0', version: '>= 0.10.1')
gsettings_desktop_schemas_dep = dependency('gsettings-desktop-schemas')
gtk_dep = dependency('gtk+-3.0', version: '>= 3.20.0')
gtkspell_dep = dependency('gtkspell3-3.0')
gspell_dep = dependency('gspell-1', version: '>= 1.8.1')
gtksourceview_dep = dependency('gtksourceview-4', version: '>= 4.0.3')
libgit2_glib_dep = dependency('libgit2-glib-1.0', version: ['>= 0.27.8'])
libpeas_dep = dependency('libpeas-1.0')
......
......@@ -126,12 +126,23 @@
]
},
{
"name" : "gtkspell3",
"name" : "gspell",
"config-opts" : [
"--disable-gtk-doc",
"--disable-gtk-doc-html"
],
"cleanup" : [
"/bin",
"/include",
"/lib/pkgconfig",
"*.la",
"/share"
],
"sources" : [
{
"type" : "archive",
"url" : "https://sourceforge.net/projects/gtkspell/files/3.0.9/gtkspell3-3.0.9.tar.xz",
"sha256" : "a4f4a4a2789f7499563e26d96b22d8085222ebe278da47d026b2de782b8b4d26"
"url" : "https://download.gnome.org/sources/gspell/1.8/gspell-1.8.1.tar.xz",
"sha256" : "819a1d23c7603000e73f5e738bdd284342e0cd345fb0c7650999c31ec741bbe5"
}
]
},
......
......@@ -17,7 +17,7 @@ class Gitg < Formula
depends_on "gnome/gitg/libsoup"
depends_on "gnome/gitg/libsecret"
depends_on "gnome/gitg/libpeas"
depends_on "gnome/gitg/gtkspell3"
depends_on "gnome/gitg/gspell"
depends_on "gnome/gitg/libgee"
depends_on "gnome/gitg/gsettings-desktop-schemas"
depends_on "gnome/gitg/libgit2-glib" => "with-vala"
......
class Gtkspell3 < Formula
desc "Gtk widget for highlighting and replacing misspelled words"
homepage "http://gtkspell.sourceforge.net/"
url "http://gtkspell.sourceforge.net/download/gtkspell3-3.0.8.tar.gz"
sha256 "011a0ce3f7c2f4b3a5b8f54c55927cdd73e1abf591a284a6d66cfb4cfe2d3fff"
class Gspell < Formula
desc "Flexible API to implement spellchecking in GTK+ applications"
homepage "https://wiki.gnome.org/Projects/gspell"
url "https://download.gnome.org/sources/gspell/1.8/gspell-1.8.1.tar.xz"
sha256 "819a1d23c7603000e73f5e738bdd284342e0cd345fb0c7650999c31ec741bbe5"
revision 3
bottle do
sha256 "083214065b899c04af8b560ebd3eea9cf8a48fa85854fbf39328bb9f81d89e9f" => :mojave
sha256 "9f31e90688aee9a297264bffdf754a6d5413aaafde425e91ced1a5f5032e404f" => :high_sierra
sha256 "adef51e1f769f52f678bf1980e34536521ee9182f21cebd3441d8c37249dddab" => :sierra
end
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "gtk-doc" => :build
depends_on "libtool" => :build
depends_on "pkg-config" => :build
depends_on "intltool" => :build
depends_on "gnome/gitg/gtk+3"
depends_on "gnome/gitg/enchant"
depends_on "enchant"
depends_on "gtk+3"
depends_on "gtk-mac-integration"
depends_on "iso-codes"
depends_on "vala"
patch :DATA
def install
system "./configure", "--disable-debug", "--prefix=#{prefix}"
system "autoreconf", "-i"
system "./configure", "--disable-dependency-tracking",
"--disable-silent-rules",
"--prefix=#{prefix}"
system "make", "install"
end
test do
(testpath/"test.c").write <<-EOS.undent
#include <gtkspell/gtkspell.h>
(testpath/"test.c").write <<~EOS
#include <gspell/gspell.h>
int main(int argc, char *argv[]) {
GList *list = gtk_spell_checker_get_language_list();
const GList *list = gspell_language_get_available();
return 0;
}
EOS
......@@ -32,15 +49,16 @@ class Gtkspell3 < Formula
gettext = Formula["gettext"]
glib = Formula["glib"]
gtkx3 = Formula["gtk+3"]
gtk_mac_integration = Formula["gtk-mac-integration"]
harfbuzz = Formula["harfbuzz"]
libepoxy = Formula["libepoxy"]
libpng = Formula["libpng"]
pango = Formula["pango"]
pixman = Formula["pixman"]
flags = (ENV.cflags || "").split + (ENV.cppflags || "").split + (ENV.ldflags || "").split
flags += %W[
flags = %W[
-I#{atk.opt_include}/atk-1.0
-I#{cairo.opt_include}/cairo
-I#{enchant.opt_include}/enchant
-I#{enchant.opt_include}/enchant-2
-I#{fontconfig.opt_include}
-I#{freetype.opt_include}/freetype2
-I#{gdk_pixbuf.opt_include}/gdk-pixbuf-2.0
......@@ -48,16 +66,18 @@ class Gtkspell3 < Formula
-I#{glib.opt_include}/gio-unix-2.0/
-I#{glib.opt_include}/glib-2.0
-I#{glib.opt_lib}/glib-2.0/include
-I#{gtk_mac_integration.opt_include}/gtkmacintegration
-I#{gtkx3.opt_include}/gtk-3.0
-I#{include}/gtkspell-3.0
-I#{harfbuzz.opt_include}/harfbuzz
-I#{include}/gspell-1
-I#{libepoxy.opt_include}
-I#{libpng.opt_include}/libpng16
-I#{pango.opt_include}/pango-1.0
-I#{pixman.opt_include}/pixman-1
-DMAC_INTEGRATION
-D_REENTRANT
-L#{atk.opt_lib}
-L#{cairo.opt_lib}
-L#{enchant.opt_lib}
-L#{gdk_pixbuf.opt_lib}
-L#{gettext.opt_lib}
-L#{glib.opt_lib}
......@@ -67,20 +87,47 @@ class Gtkspell3 < Formula
-latk-1.0
-lcairo
-lcairo-gobject
-lenchant
-lgdk-3
-lgdk_pixbuf-2.0
-lgio-2.0
-lglib-2.0
-lgmodule-2.0
-lgobject-2.0
-lgspell-1
-lgtk-3
-lgtkspell3-3
-lintl
-lpango-1.0
-lpangocairo-1.0
]
system ENV.cc, "test.c", "-o", "test", *flags
system "./test"
ENV["G_DEBUG"] = "fatal-warnings"
system "./test" # This test will fail intentionally when iso-codes gets updated. Resolve by revbumping this formula.
end
end
__END__
diff --git a/gspell/Makefile.am b/gspell/Makefile.am
index 076a9fd..6c67184 100644
--- a/gspell/Makefile.am
+++ b/gspell/Makefile.am
@@ -91,6 +91,7 @@ nodist_libgspell_core_la_SOURCES = \
$(BUILT_SOURCES)
libgspell_core_la_LIBADD = \
+ $(GTK_MAC_LIBS) \
$(CODE_COVERAGE_LIBS)
libgspell_core_la_CFLAGS = \
@@ -155,6 +156,12 @@ gspell_private_headers += \
gspell_private_c_files += \
gspell-osx.c
+libgspell_core_la_CFLAGS += \
+ -xobjective-c
+
+libgspell_core_la_LDFLAGS += \
+ -framework Cocoa
+
endif # OS_OSX
if HAVE_INTROSPECTION
/* gspell-1.vapi generated by vapigen-0.46, do not modify. */
[CCode (cprefix = "Gspell", gir_namespace = "Gspell", gir_version = "1", lower_case_cprefix = "gspell_")]
namespace Gspell {
[CCode (cheader_filename = "gspell/gspell.h", type_id = "gspell_checker_get_type ()")]
public class Checker : GLib.Object {
[CCode (has_construct_function = false)]
public Checker (Gspell.Language? language);
public void add_word_to_personal (string word, ssize_t word_length);
public void add_word_to_session (string word, ssize_t word_length);
public bool check_word (string word, ssize_t word_length) throws GLib.Error;
public void clear_session ();
public unowned Gspell.Language? get_language ();
public GLib.SList<string> get_suggestions (string word, ssize_t word_length);
public void set_correction (string word, ssize_t word_length, string replacement, ssize_t replacement_length);
public void set_language (Gspell.Language? language);
public Gspell.Language language { get; set construct; }
public virtual signal void session_cleared ();
public virtual signal void word_added_to_personal (string word);
public virtual signal void word_added_to_session (string word);
}
[CCode (cheader_filename = "gspell/gspell.h", type_id = "gspell_checker_dialog_get_type ()")]
public class CheckerDialog : Gtk.Dialog, Atk.Implementor, Gtk.Buildable {
[CCode (has_construct_function = false, type = "GtkWidget*")]
public CheckerDialog (Gtk.Window parent, Gspell.Navigator navigator);
public unowned Gspell.Navigator get_spell_navigator ();
public Gspell.Navigator spell_navigator { get; construct; }
}
[CCode (cheader_filename = "gspell/gspell.h", type_id = "gspell_entry_get_type ()")]
public class Entry : GLib.Object {
[CCode (has_construct_function = false)]
protected Entry ();
[Version (since = "1.4")]
public void basic_setup ();
[Version (since = "1.4")]
public unowned Gtk.Entry get_entry ();
[Version (since = "1.4")]
public static unowned Gspell.Entry get_from_gtk_entry (Gtk.Entry gtk_entry);
[Version (since = "1.4")]
public bool get_inline_spell_checking ();
[Version (since = "1.4")]
public void set_inline_spell_checking (bool enable);
[Version (since = "1.4")]
public Gtk.Entry entry { get; construct; }
[Version (since = "1.4")]
public bool inline_spell_checking { get; set; }
}
[CCode (cheader_filename = "gspell/gspell.h", type_id = "gspell_entry_buffer_get_type ()")]
public class EntryBuffer : GLib.Object {
[CCode (has_construct_function = false)]
protected EntryBuffer ();
[Version (since = "1.4")]
public unowned Gtk.EntryBuffer get_buffer ();
[Version (since = "1.4")]
public static unowned Gspell.EntryBuffer get_from_gtk_entry_buffer (Gtk.EntryBuffer gtk_buffer);
[Version (since = "1.4")]
public unowned Gspell.Checker? get_spell_checker ();
[Version (since = "1.4")]
public void set_spell_checker (Gspell.Checker? spell_checker);
[Version (since = "1.4")]
public Gtk.EntryBuffer buffer { get; construct; }
[Version (since = "1.4")]
public Gspell.Checker spell_checker { get; set; }
}
[CCode (cheader_filename = "gspell/gspell.h", copy_function = "g_boxed_copy", free_function = "g_boxed_free", type_id = "gspell_language_get_type ()")]
[Compact]
public class Language {
public int compare (Gspell.Language language_b);
public Gspell.Language copy ();
public void free ();
public static unowned GLib.List<Gspell.Language> get_available ();
public unowned string get_code ();
public static unowned Gspell.Language? get_default ();
public unowned string get_name ();
public static unowned Gspell.Language? lookup (string language_code);
}
[CCode (cheader_filename = "gspell/gspell.h", type_id = "gspell_language_chooser_button_get_type ()")]
public class LanguageChooserButton : Gtk.Button, Atk.Implementor, Gspell.LanguageChooser, Gtk.Actionable, Gtk.Activatable, Gtk.Buildable {
[CCode (has_construct_function = false, type = "GtkWidget*")]
public LanguageChooserButton (Gspell.Language? current_language);
}
[CCode (cheader_filename = "gspell/gspell.h", type_id = "gspell_language_chooser_dialog_get_type ()")]
public class LanguageChooserDialog : Gtk.Dialog, Atk.Implementor, Gspell.LanguageChooser, Gtk.Buildable {
[CCode (has_construct_function = false, type = "GtkWidget*")]
public LanguageChooserDialog (Gtk.Window parent, Gspell.Language? current_language, Gtk.DialogFlags flags);
}
[CCode (cheader_filename = "gspell/gspell.h", type_id = "gspell_navigator_text_view_get_type ()")]
public class NavigatorTextView : GLib.InitiallyUnowned, Gspell.Navigator {
[CCode (has_construct_function = false)]
protected NavigatorTextView ();
public unowned Gtk.TextView get_view ();
public static unowned Gspell.Navigator @new (Gtk.TextView view);
public Gtk.TextView view { get; construct; }
}
[CCode (cheader_filename = "gspell/gspell.h", type_id = "gspell_text_buffer_get_type ()")]
public class TextBuffer : GLib.Object {
[CCode (has_construct_function = false)]
protected TextBuffer ();
public unowned Gtk.TextBuffer get_buffer ();
public static unowned Gspell.TextBuffer get_from_gtk_text_buffer (Gtk.TextBuffer gtk_buffer);
public unowned Gspell.Checker? get_spell_checker ();
public void set_spell_checker (Gspell.Checker? spell_checker);
public Gtk.TextBuffer buffer { get; construct; }
public Gspell.Checker spell_checker { get; set; }
}
[CCode (cheader_filename = "gspell/gspell.h", type_id = "gspell_text_view_get_type ()")]
public class TextView : GLib.Object {
[CCode (has_construct_function = false)]
protected TextView ();
[Version (since = "1.2")]
public void basic_setup ();
[Version (since = "1.2")]
public bool get_enable_language_menu ();
public static unowned Gspell.TextView get_from_gtk_text_view (Gtk.TextView gtk_view);
public bool get_inline_spell_checking ();
public unowned Gtk.TextView get_view ();
[Version (since = "1.2")]
public void set_enable_language_menu (bool enable_language_menu);
public void set_inline_spell_checking (bool enable);
[Version (since = "1.2")]
public bool enable_language_menu { get; set; }
public bool inline_spell_checking { get; set; }
public Gtk.TextView view { get; construct; }
}
[CCode (cheader_filename = "gspell/gspell.h", type_cname = "GspellLanguageChooserInterface", type_id = "gspell_language_chooser_get_type ()")]
public interface LanguageChooser : GLib.Object {
public unowned Gspell.Language? get_language ();
public unowned string get_language_code ();
[NoWrapper]
public abstract unowned Gspell.Language get_language_full (bool default_language);
public abstract void set_language (Gspell.Language? language);
public void set_language_code (string? language_code);
[ConcreteAccessor]
public abstract Gspell.Language language { get; set; }
[ConcreteAccessor]
public abstract string language_code { get; set; }
}
[CCode (cheader_filename = "gspell/gspell.h", type_cname = "GspellNavigatorInterface", type_id = "gspell_navigator_get_type ()")]
public interface Navigator : GLib.InitiallyUnowned {
public abstract void change (string word, string change_to);
public abstract void change_all (string word, string change_to);
public abstract bool goto_next (out string word, out Gspell.Checker spell_checker) throws GLib.Error;
}
[CCode (cheader_filename = "gspell/gspell.h", cprefix = "GSPELL_CHECKER_ERROR_")]
public errordomain CheckerError {
DICTIONARY,
NO_LANGUAGE_SET;
public static GLib.Quark quark ();
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment