Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 151554 Details for
Bug 235022
RFE : Spell-checker retains on/off toggle between instances
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
enable spell check for new documents
gedit-spell-plugin.c.diff (text/plain), 5.95 KB, created by
ritz
on 2007-04-03 13:02:18 UTC
(
hide
)
Description:
enable spell check for new documents
Filename:
MIME Type:
Creator:
ritz
Created:
2007-04-03 13:02:18 UTC
Size:
5.95 KB
patch
obsolete
>diff -Naur spell/gedit-spell-plugin.c spell.orig/gedit-spell-plugin.c >--- spell/gedit-spell-plugin.c 2007-03-20 06:02:07.000000000 +0530 >+++ spell.orig/gedit-spell-plugin.c 2007-03-20 06:06:47.000000000 +0530 >@@ -20,6 +20,14 @@ > * $Id: gedit-spell-plugin.c 5335 2006-12-04 00:31:27Z paolo $ > */ > >+ >+/* >+ * To Do - Write a schema, and probably add a UI ? >+ * As a temporary work to enable auto-init of spell check >+ * gconftool-2 --type bool --set /apps/gedit-2/plugins/spellcheck/value true >+ * >+ */ >+ > #ifdef HAVE_CONFIG_H > #include <config.h> > #endif >@@ -38,6 +46,8 @@ > #include <gedit/gedit-metadata-manager.h> > #include <gedit/gedit-prefs-manager.h> > #include <gedit/gedit-statusbar.h> >+#include <gconf/gconf-client.h> >+ > > #include "gedit-spell-checker.h" > #include "gedit-spell-checker-dialog.h" >@@ -46,6 +56,7 @@ > > #define WINDOW_DATA_KEY "GeditSpellPluginWindowData" > #define MENU_PATH "/MenuBar/ToolsMenu/ToolsOps_1" >+#define SPELL_BROWSER_BASE_KEY "/apps/gedit-2/plugins/spellcheck/" > > #define GEDIT_SPELL_PLUGIN_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), GEDIT_TYPE_SPELL_PLUGIN, GeditSpellPluginPrivate)) > >@@ -823,6 +834,71 @@ > g_free (data); > } > >+ >+static void >+on_document_load (GeditDocument *document, >+ const GError *error, >+ GeditView *view) >+{ >+ GeditAutomaticSpellChecker *autospell; >+ GeditSpellChecker *spell; >+ gboolean active; >+ >+ gedit_debug (DEBUG_PLUGINS); >+ >+ gedit_debug_message (DEBUG_PLUGINS, active ? "Auto Spell activated" : "Auto Spell deactivated"); >+ >+ if (document == NULL) >+ return; >+ >+ spell = get_spell_checker_from_document (document); >+ g_return_if_fail (spell != NULL); >+ >+ autospell = gedit_automatic_spell_checker_get_from_document (document); >+ >+ if (autospell == NULL) >+ { >+ g_return_if_fail (view != NULL); >+ >+ autospell = gedit_automatic_spell_checker_new (document, spell); >+ gedit_automatic_spell_checker_attach_view (autospell, view); >+ gedit_automatic_spell_checker_recheck_all (autospell); >+ } >+ >+} >+ >+ >+static void >+connect_handlers (GeditView *view) >+{ >+ GtkTextBuffer *doc; >+ >+ doc = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)); >+ >+ g_signal_connect (doc, "loaded", >+ G_CALLBACK (on_document_load), >+ view); >+} >+ >+static void >+on_window_tab_added (GeditWindow *window, >+ GeditTab *tab, >+ gpointer user_data) >+{ >+ on_document_load (gedit_tab_get_document(tab), >+ NULL, >+ gedit_tab_get_view(tab)); >+} >+static void >+on_window_tab_removed (GeditWindow *window, >+ GeditTab *tab, >+ gpointer user_data) >+{ >+ g_signal_handlers_disconnect_by_func(gedit_tab_get_document(tab), >+ on_document_load,NULL); >+} >+ >+ > static void > update_ui_real (GeditWindow *window, > WindowData *data) >@@ -909,6 +985,30 @@ > GTK_UI_MANAGER_MENUITEM, > FALSE); > >+ /* routine to init spell check >+ * borrowed without permission from mode-line >+ */ >+ GConfClient *client= gconf_client_get_default(); >+ gboolean check = gconf_client_get_bool(client,SPELL_BROWSER_BASE_KEY "value",NULL); >+ g_object_unref(client); >+ if ( check == TRUE ) >+ { >+ GList *views; >+ GList *l; >+ >+ views = gedit_window_get_views (window); >+ for (l = views; l != NULL; l = l->next) >+ { >+ connect_handlers (GEDIT_VIEW (l->data)); >+ } >+ g_list_free (views); >+ >+ g_signal_connect (window, "tab-added", >+ G_CALLBACK (on_window_tab_added), NULL); >+ >+ g_signal_connect (window, "tab-removed", >+ G_CALLBACK (on_window_tab_removed), NULL); >+ } > > > update_ui_real (window, data); >@@ -932,6 +1032,24 @@ > gtk_ui_manager_remove_action_group (manager, data->action_group); > > g_object_set_data (G_OBJECT (window), WINDOW_DATA_KEY, NULL); >+ >+ /* >+ * callback un-register . Modeled after mode-line plugin >+ * monkey see, monkey do, monkey cleans -- khadgaray >+ */ >+ GList *doc; >+ GList *l; >+ >+ doc = gedit_window_get_documents (window); >+ for (l = doc; l != NULL; l = l->next) >+ { >+ g_signal_handlers_disconnect_by_func (GEDIT_DOCUMENT (l->data), >+ on_document_load, NULL); >+ } >+ g_list_free (doc); >+ >+ g_signal_handlers_disconnect_by_func(window,on_window_tab_added, NULL); >+ g_signal_handlers_disconnect_by_func(window,on_window_tab_removed, NULL); > } > > static void >diff -Naur spell/gedit-spell-plugin.schemas.in spell.orig/gedit-spell-plugin.schemas.in >--- spell/gedit-spell-plugin.schemas.in 1970-01-01 05:30:00.000000000 +0530 >+++ spell.orig/gedit-spell-plugin.schemas.in 2007-03-20 05:00:18.000000000 +0530 >@@ -0,0 +1,15 @@ >+<gconfschemafile> >+ <schemalist> >+ <schema> >+ <key>/schemas/apps/gedit-2/plugins/spellcheck/value</key> >+ <applyto>/apps/gedit-2/plugins/spellcheck/value</applyto> >+ <owner>gedit</owner> >+ <type>bool</type> >+ <default>FALSE</default> >+ <locale name="C"> >+ <short>Auto initialize spell-check</short> >+ <long>Enables spell-check for new document, and on document load</long> >+ </locale> >+ </schema> >+ </schemalist> >+</gconfschemafile> >diff -Naur spell/Makefile.am spell.orig/Makefile.am >--- spell/Makefile.am 2007-03-20 06:02:07.000000000 +0530 >+++ spell.orig/Makefile.am 2007-03-20 05:18:14.000000000 +0530 >@@ -52,12 +52,33 @@ > > plugin_DATA = $(plugin_in_files:.gedit-plugin.desktop.in=.gedit-plugin) > >+schemasdir = $(GCONF_SCHEMA_FILE_DIR) >+schemas_in_files = gedit-spell-plugin.schemas.in >+schemas_DATA = $(schemas_in_files:.schemas.in=.schemas) >+@INTLTOOL_SCHEMAS_RULE@ >+ >+if GCONF_SCHEMAS_INSTALL >+install-data-local: >+ if test -z "$(DESTDIR)" ; then \ >+ for p in $(schemas_DATA) ; do \ >+ GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) $(GCONFTOOL) --makefile-install-rule $(top_builddir)/plugins/spell/$$p ; \ >+ done \ >+ fi >+else >+install-data-local: >+endif >+ >+ > EXTRA_DIST = \ > $(glade_DATA) \ > $(plugin_in_files) \ >+ $(schemas_in_files) \ > gedit-spell-checker-dialog-marshal.list > >-CLEANFILES = $(BUILT_SOURCES) $(plugin_DATA) >+CLEANFILES = \ >+ $(BUILT_SOURCES) \ >+ $(plugin_DATA) \ >+ $(schemas_DATA) > > dist-hook: > cd $(distdir); rm -f $(BUILT_SOURCES)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 235022
: 151554