gnome-spell r427 - trunk/gnome-spell



Author: msuman
Date: Tue Jan 15 04:40:52 2008
New Revision: 427
URL: http://svn.gnome.org/viewvc/gnome-spell?rev=427&view=rev

Log:
Patch from Irene Huang  <Irene Huang sun com> ** Fix for bug #343972 (Add 'Replace All' option for Spell check)

Modified:
   trunk/gnome-spell/ChangeLog
   trunk/gnome-spell/control.c
   trunk/gnome-spell/spell-checker.glade

Modified: trunk/gnome-spell/control.c
==============================================================================
--- trunk/gnome-spell/control.c	(original)
+++ trunk/gnome-spell/control.c	Tue Jan 15 04:40:52 2008
@@ -61,6 +61,7 @@
 	GtkTreeIter iter_suggestions;
 
 	GtkWidget *button_replace;
+	GtkWidget *button_replace_all;
 	GtkWidget *button_add;
 	GtkWidget *button_ignore;
 	GtkWidget *button_skip;
@@ -75,6 +76,7 @@
 enum {
 	PROP_SPELL_WORD,
 	PROP_SPELL_REPLACE,
+	PROP_SPELL_REPLACEALL,
 	PROP_SPELL_ADD,
 	PROP_SPELL_IGNORE,
 	PROP_SPELL_SKIP,
@@ -125,6 +127,27 @@
 }
 
 static void
+clicked_replace_all (GtkWidget *w, SpellControlData *cd)
+{
+	GtkTreeModel *model;
+	GtkTreeIter iter;
+	gchar *replacement, *language;
+
+        if (gtk_tree_selection_get_selected (gtk_tree_view_get_selection (GTK_TREE_VIEW (cd->list_suggestions)),
+					     &model, &iter)) {
+		CORBA_Environment ev;
+                gtk_tree_model_get (model, &iter, 0, &replacement, 1, &language, -1);
+
+		CORBA_exception_init (&ev);
+		GNOME_Spell_Dictionary_setCorrection (cd->dict, cd->word, replacement, language, &ev);
+		CORBA_exception_free (&ev);
+
+		bonobo_pbclient_set_string (BONOBO_OBJREF (cd->pb), "repall", replacement, NULL);
+		g_free (replacement);
+	}
+}
+
+static void
 abbrevs_langs_clear (SpellControlData *cd)
 {
 	if (cd->abbrevs) {
@@ -294,6 +317,7 @@
 		}
 		break;
 	case PROP_SPELL_REPLACE:
+	case PROP_SPELL_REPLACEALL:
 	case PROP_SPELL_ADD:
 	case PROP_SPELL_SKIP:
 	case PROP_SPELL_BACK:
@@ -340,6 +364,7 @@
 	gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (cd->list_suggestions), FALSE);
 
 	cd->button_replace = glade_xml_get_widget (xml, "button_replace");
+	cd->button_replace_all = glade_xml_get_widget (xml, "button_replace_all");
 	cd->button_add     = glade_xml_get_widget (xml, "button_add");
 	cd->button_ignore  = glade_xml_get_widget (xml, "button_ignore");
 	cd->button_skip    = glade_xml_get_widget (xml, "button_skip");
@@ -348,6 +373,7 @@
 	cd->entry_add      = glade_xml_get_widget (xml, "entry_add");
 
 	g_signal_connect (cd->button_replace, "clicked", G_CALLBACK (clicked_replace), cd);
+	g_signal_connect (cd->button_replace_all, "clicked", G_CALLBACK (clicked_replace_all), cd);
 	g_signal_connect (cd->button_add, "clicked", G_CALLBACK (clicked_add), cd);
 	g_signal_connect (cd->button_ignore, "clicked", G_CALLBACK (clicked_ignore), cd);
 	g_signal_connect (cd->button_skip, "clicked", G_CALLBACK (clicked_skip), cd);
@@ -374,26 +400,32 @@
 	CORBA_free (def);
 
 	def = bonobo_arg_new (BONOBO_ARG_STRING);
+	BONOBO_ARG_SET_STRING (def, "replace all default values");
+	bonobo_property_bag_add (cd->pb, "repall", PROP_SPELL_REPLACEALL, BONOBO_ARG_STRING, def,
+				 "replacement to replace all words",  BONOBO_PROPERTY_READABLE);
+	CORBA_free (def);
+
+	def = bonobo_arg_new (BONOBO_ARG_STRING);
 	BONOBO_ARG_SET_STRING (def, "");
-	bonobo_property_bag_add (cd->pb, "add", PROP_SPELL_REPLACE, BONOBO_ARG_STRING, def,
+	bonobo_property_bag_add (cd->pb, "add", PROP_SPELL_ADD, BONOBO_ARG_STRING, def,
 				 "add word to dictionary",  BONOBO_PROPERTY_READABLE);
 	CORBA_free (def);
 
 	def = bonobo_arg_new (BONOBO_ARG_BOOLEAN);
 	BONOBO_ARG_SET_BOOLEAN (def, TRUE);
-	bonobo_property_bag_add (cd->pb, "ignore", PROP_SPELL_REPLACE, BONOBO_ARG_BOOLEAN, def,
+	bonobo_property_bag_add (cd->pb, "ignore", PROP_SPELL_IGNORE, BONOBO_ARG_BOOLEAN, def,
 				 "add word to session dictionary",  BONOBO_PROPERTY_READABLE);
 	CORBA_free (def);
 
 	def = bonobo_arg_new (BONOBO_ARG_BOOLEAN);
 	BONOBO_ARG_SET_BOOLEAN (def, TRUE);
-	bonobo_property_bag_add (cd->pb, "skip", PROP_SPELL_REPLACE, BONOBO_ARG_BOOLEAN, def,
+	bonobo_property_bag_add (cd->pb, "skip", PROP_SPELL_SKIP, BONOBO_ARG_BOOLEAN, def,
 				 "skip this word",  BONOBO_PROPERTY_READABLE);
 	CORBA_free (def);
 
 	def = bonobo_arg_new (BONOBO_ARG_BOOLEAN);
 	BONOBO_ARG_SET_BOOLEAN (def, TRUE);
-	bonobo_property_bag_add (cd->pb, "back", PROP_SPELL_REPLACE, BONOBO_ARG_BOOLEAN, def,
+	bonobo_property_bag_add (cd->pb, "back", PROP_SPELL_BACK, BONOBO_ARG_BOOLEAN, def,
 				 "back to prev incorrect word",  BONOBO_PROPERTY_READABLE);
 	CORBA_free (def);
 

Modified: trunk/gnome-spell/spell-checker.glade
==============================================================================
--- trunk/gnome-spell/spell-checker.glade	(original)
+++ trunk/gnome-spell/spell-checker.glade	Tue Jan 15 04:40:52 2008
@@ -516,6 +516,85 @@
 			      <property name="yalign">0.5</property>
 			      <property name="xpad">0</property>
 			      <property name="ypad">0</property>
+			      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+			      <property name="width_chars">-1</property>
+			      <property name="single_line_mode">False</property>
+			      <property name="angle">0</property>
+			    </widget>
+			    <packing>
+			      <property name="padding">0</property>
+			      <property name="expand">False</property>
+			      <property name="fill">False</property>
+			    </packing>
+			  </child>
+			</widget>
+		      </child>
+		    </widget>
+		  </child>
+		</widget>
+	      </child>
+
+	      <child>
+		<widget class="GtkButton" id="button_replace_all">
+		  <property name="visible">True</property>
+		  <property name="can_default">True</property>
+		  <property name="has_default">True</property>
+		  <property name="can_focus">True</property>
+		  <property name="relief">GTK_RELIEF_NORMAL</property>
+		  <property name="focus_on_click">True</property>
+
+		  <child>
+		    <widget class="GtkAlignment" id="alignment6">
+		      <property name="visible">True</property>
+		      <property name="xalign">0.5</property>
+		      <property name="yalign">0.5</property>
+		      <property name="xscale">0</property>
+		      <property name="yscale">0</property>
+		      <property name="top_padding">0</property>
+		      <property name="bottom_padding">0</property>
+		      <property name="left_padding">0</property>
+		      <property name="right_padding">0</property>
+
+		      <child>
+			<widget class="GtkHBox" id="hbox8">
+			  <property name="visible">True</property>
+			  <property name="homogeneous">False</property>
+			  <property name="spacing">2</property>
+
+			  <child>
+			    <widget class="GtkImage" id="image6">
+			      <property name="visible">True</property>
+			      <property name="stock">gtk-apply</property>
+			      <property name="icon_size">4</property>
+			      <property name="xalign">0.5</property>
+			      <property name="yalign">0.5</property>
+			      <property name="xpad">0</property>
+			      <property name="ypad">0</property>
+			    </widget>
+			    <packing>
+			      <property name="padding">0</property>
+			      <property name="expand">False</property>
+			      <property name="fill">False</property>
+			    </packing>
+			  </child>
+
+			  <child>
+			    <widget class="GtkLabel" id="label14">
+			      <property name="visible">True</property>
+			      <property name="label" translatable="yes">R_eplace All</property>
+			      <property name="use_underline">True</property>
+			      <property name="use_markup">False</property>
+			      <property name="justify">GTK_JUSTIFY_LEFT</property>
+			      <property name="wrap">False</property>
+			      <property name="selectable">False</property>
+			      <property name="xalign">0.5</property>
+			      <property name="yalign">0.5</property>
+			      <property name="xpad">0</property>
+			      <property name="ypad">0</property>
+			      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+			      <property name="width_chars">-1</property>
+			      <property name="single_line_mode">False</property>
+			      <property name="angle">0</property>
 			    </widget>
 			    <packing>
 			      <property name="padding">0</property>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]