Fri, 21 Feb 2025 00:03:24 -0600
Add basic support for libspelling
This does the bare minimum to implement libspelling to get things going.
Testing Done:
Built locally as well as the flatpak and verified that my horrible typing skills were pointed out.
Bugs closed: PIDGIN-18054
Reviewed at https://reviews.imfreedom.org/r/3850/
--- a/im.pidgin.Pidgin3.yml Wed Feb 19 01:52:06 2025 -0600 +++ b/im.pidgin.Pidgin3.yml Fri Feb 21 00:03:24 2025 -0600 @@ -104,6 +104,15 @@ archive-type: tar-xz url: https://sourceforge.net/projects/pidgin/files/seagull/0.1.1/seagull-0.1.1.tar.xz sha256: 499fc45b6a8539bc2293b362fec1c847fe25697355a0572f07ace3f359a38873 + - name: libspelling + buildsystem: meson + config-opts: + - "--wrap-mode=nofallback" + sources: + - type: archive + archive-type: tar-xz + url: https://download.gnome.org/sources/libspelling/0.4/libspelling-0.4.6.tar.xz + sha256: 3248a9b5336ea2f727d2db912d2f0083accc0505ce707679b3d9b8266c0101f5 - name: pidgin3 buildsystem: meson config-opts:
--- a/meson.build Wed Feb 19 01:52:06 2025 -0600 +++ b/meson.build Fri Feb 21 00:03:24 2025 -0600 @@ -190,15 +190,36 @@ endif ####################################################################### +# Documentation +####################################################################### + +if get_option('doc') and not get_option('introspection') + error('Documentation requires GObject Introspection.') +endif + +dependency( + 'gi-docgen', version: '>= 2021.1', + fallback: ['gi-docgen', 'dummy_dep'], + required: get_option('doc') +) + +gidocgen = find_program('gi-docgen', required : get_option('doc')) +docs_dir = get_option('prefix') / get_option('datadir') / 'doc' + +####################################################################### # Check Pidgin dependencies ####################################################################### if get_option('gtkui') gtk = dependency('gtk4', version : '>= 4.10.0') + libadwaita = dependency('libadwaita-1', version : '>= 1.5') add_project_arguments( '-DADW_VERSION_MIN_REQUIRED=ADW_VERSION_1_5', '-DADW_VERSION_MAX_ALLOWED=ADW_VERSION_1_5', language: 'c') + + libspelling = dependency('libspelling-1', version : '>= 0.4.0', + default_options : ['sysprof=false']) endif ENABLE_GTK = get_option('gtkui') @@ -362,23 +383,6 @@ hasl = dependency('hasl', version : '>= 0.4.0') ####################################################################### -# Documentation -####################################################################### - -if get_option('doc') and not get_option('introspection') - error('Documentation requires GObject Introspection.') -endif - -dependency( - 'gi-docgen', version: '>= 2021.1', - fallback: ['gi-docgen', 'dummy_dep'], - required: get_option('doc') -) - -gidocgen = find_program('gi-docgen', required : get_option('doc')) -docs_dir = get_option('prefix') / get_option('datadir') / 'doc' - -####################################################################### # Random Stuff ####################################################################### # So that purpleconfig.h may be found.
--- a/pidgin/meson.build Wed Feb 19 01:52:06 2025 -0600 +++ b/pidgin/meson.build Fri Feb 21 00:03:24 2025 -0600 @@ -135,6 +135,7 @@ gtk, json, libadwaita, + libspelling, math, libpurple_dep, ]
--- a/pidgin/pidginconversation.c Wed Feb 19 01:52:06 2025 -0600 +++ b/pidgin/pidginconversation.c Fri Feb 21 00:03:24 2025 -0600 @@ -22,6 +22,10 @@ #include <glib/gi18n-lib.h> +#include <libspelling.h> + +#include <gtksourceview/gtksourceview.h> + #include <purple.h> #include "pidginautoadjustment.h" @@ -53,6 +57,7 @@ GtkCustomSorter *member_list_sorter; GtkWidget *input; + GtkSourceBuffer *input_buffer; GtkWidget *typing_label; GtkWidget *status_label; @@ -403,6 +408,10 @@ static void pidgin_conversation_init(PidginConversation *conversation) { + SpellingChecker *checker = NULL; + SpellingTextBufferAdapter *adapter = NULL; + GMenuModel *menu = NULL; + gtk_widget_init_template(GTK_WIDGET(conversation)); gtk_custom_sorter_set_sort_func(conversation->member_list_sorter, @@ -412,6 +421,20 @@ gtk_custom_filter_set_filter_func(conversation->member_list_filter, (GtkCustomFilterFunc)pidgin_conversation_member_list_filter, conversation, NULL); + + /* Create the spell checking adapter. */ + checker = spelling_checker_get_default(); + adapter = spelling_text_buffer_adapter_new(conversation->input_buffer, + checker); + + /* Add the spell checking menu items and actions. */ + menu = spelling_text_buffer_adapter_get_menu_model(adapter); + gtk_text_view_set_extra_menu(GTK_TEXT_VIEW(conversation->input), menu); + gtk_widget_insert_action_group(conversation->input, "spelling", + G_ACTION_GROUP(adapter)); + spelling_text_buffer_adapter_set_enabled(adapter, TRUE); + + g_clear_object(&adapter); } static void @@ -458,6 +481,8 @@ gtk_widget_class_bind_template_child(widget_class, PidginConversation, input); gtk_widget_class_bind_template_child(widget_class, PidginConversation, + input_buffer); + gtk_widget_class_bind_template_child(widget_class, PidginConversation, typing_label); gtk_widget_class_bind_template_child(widget_class, PidginConversation, status_label);
--- a/pidgin/resources/Conversations/conversation.ui Wed Feb 19 01:52:06 2025 -0600 +++ b/pidgin/resources/Conversations/conversation.ui Fri Feb 21 00:03:24 2025 -0600 @@ -228,7 +228,7 @@ <property name="input-purpose">free-form</property> <property name="input-hints">emoji|spellcheck|word-completion</property> <property name="buffer"> - <object class="GtkTextBuffer"> + <object class="GtkSourceBuffer" id="input_buffer"> <signal name="delete-range" handler="pidgin_conversation_input_delete_range_cb" after="yes"/> <signal name="insert-text" handler="pidgin_conversation_input_insert_text_cb"/> </object>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/subprojects/gtksourceview-5.wrap Fri Feb 21 00:03:24 2025 -0600 @@ -0,0 +1,5 @@ +[wrap-file] +directory = gtksourceview-5.14.2 +source_url = https://download.gnome.org/sources/gtksourceview/5.14/gtksourceview-5.14.2.tar.xz +source_filename = gtksourceview-5.14.2.tar.xz +source_hash = 1a6d387a68075f8aefd4e752cf487177c4a6823b14ff8a434986858aeaef6264
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/subprojects/libspelling-1.wrap Fri Feb 21 00:03:24 2025 -0600 @@ -0,0 +1,5 @@ +[wrap-file] +directory = libspelling-0.4.6 +source_url = https://download.gnome.org/sources/libspelling/0.4/libspelling-0.4.6.tar.xz +source_filename = libspelling-0.4.6.tar.xz +source_hash = 3248a9b5336ea2f727d2db912d2f0083accc0505ce707679b3d9b8266c0101f5