[evolution-patches] 46287 Composer Preferences and a little touch up (UI Freeze)



Fixed the problem listed and while in there, remove the enable/disable
button.  Too fugly, and you can do everything in the list anyhow.  Also
moved the info message to a better spot and made it more succinct.

-JP
-- 
JP Rosevear <jpr novell com>
Novell, Inc.

Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/mail/ChangeLog,v
retrieving revision 1.3541
diff -u -r1.3541 ChangeLog
--- ChangeLog	21 Jan 2005 21:04:48 -0000	1.3541
+++ ChangeLog	21 Jan 2005 22:56:04 -0000
@@ -1,5 +1,19 @@
 2005-01-21  JP Rosevear  <jpr novell com>
 
+	Fixes #46287
+	
+	* mail-config.glade: remove enable/disable button
+
+	* em-composer-prefs.h: remove unused button
+
+	* em-composer-prefs.c (spell_language_toggled): handle the cell
+	being toggled
+	(spell_setup): enable/disable button is gone
+	(em_composer_prefs_construct): setup a listener for the toggle
+	cell
+
+2005-01-21  JP Rosevear  <jpr novell com>
+	
 	Fixes #46404
 	
 	* em-folder-view.c (emfv_print_response): use the config in the
Index: em-composer-prefs.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/em-composer-prefs.c,v
retrieving revision 1.23
diff -u -r1.23 em-composer-prefs.c
--- em-composer-prefs.c	3 Dec 2004 03:38:03 -0000	1.23
+++ em-composer-prefs.c	21 Jan 2005 22:56:04 -0000
@@ -585,22 +585,6 @@
 	/* FIXME: what gconf key is this? */
 }
 
-static void
-spell_language_selection_changed (GtkTreeSelection *selection, EMComposerPrefs *prefs)
-{
-	GtkTreeIter iter;
-	GtkTreeModel *model;
-	gboolean state = FALSE;
-	
-	if (gtk_tree_selection_get_selected (selection, &model, &iter)) {
-		gtk_tree_model_get ((GtkTreeModel *) model, &iter, 0, &state, -1);
-		gtk_button_set_label ((GtkButton *) prefs->spell_able_button, state ? _("Disable") : _("Enable"));
-		state = TRUE;
-	}
-	
-	gtk_widget_set_sensitive (prefs->spell_able_button, state);
-}
-
 static char *
 spell_get_language_str (EMComposerPrefs *prefs)
 {
@@ -637,58 +621,25 @@
 	return rv;
 }
 
-static void
-spell_language_enable (GtkWidget *widget, EMComposerPrefs *prefs)
-{
-	GtkTreeIter iter;
-	GtkTreeModel *model;
-	GtkTreeSelection *selection;
-	gboolean state;
-	char *str;
-	
-	selection = gtk_tree_view_get_selection (prefs->language);
-	if (!gtk_tree_selection_get_selected (selection, &model, &iter))
-		return;
-	
-	gtk_tree_model_get (model, &iter, 0, &state, -1);
-	gtk_list_store_set ((GtkListStore *) model, &iter, 0, !state, -1);
-	gtk_button_set_label ((GtkButton *) prefs->spell_able_button, state ? _("Enable") : _("Disable"));
-	
-	str = spell_get_language_str (prefs);
-	gconf_client_set_string (prefs->gconf, GNOME_SPELL_GCONF_DIR "/language", str ? str : "", NULL);
-	g_free (str);
-}
-
-static gboolean
-spell_language_button_press (GtkTreeView *treeview, GdkEventButton *event, EMComposerPrefs *prefs)
+static void 
+spell_language_toggled (GtkCellRendererToggle *renderer, const char *path_string, EMComposerPrefs *prefs)
 {
-	GtkTreeViewColumn *column = NULL;
-	GtkTreePath *path = NULL;
+	GtkTreePath *path = gtk_tree_path_new_from_string (path_string);
 	GtkTreeModel *model;
 	GtkTreeIter iter;
 	gboolean enabled;
 	char *str;
 	
-	if (!(gtk_tree_view_get_path_at_pos (treeview, event->x, event->y, &path, &column, NULL, NULL)))
-		return FALSE;
-	
-	/* FIXME: This routine should just be a "toggled" event handler on the checkbox cell renderer which
-	   has "activatable" set. */
-	
-	if (strcmp (gtk_tree_view_column_get_title (column), _("Enabled")) != 0)
-		return FALSE;
-	
-	model = gtk_tree_view_get_model (treeview);
+	model = gtk_tree_view_get_model (prefs->language);
 	gtk_tree_model_get_iter (model, &iter, path);
 	gtk_tree_model_get (model, &iter, 0, &enabled, -1);
 	gtk_list_store_set ((GtkListStore *) model, &iter, 0, !enabled, -1);
-	gtk_button_set_label ((GtkButton *) prefs->spell_able_button, enabled ? _("Enable") : _("Disable"));
 	
 	str = spell_get_language_str (prefs);
 	gconf_client_set_string (prefs->gconf, GNOME_SPELL_GCONF_DIR "/language", str ? str : "", NULL);
 	g_free (str);
-	
-	return FALSE;
+
+	gtk_tree_path_free (path);
 }
 
 static void
@@ -716,13 +667,8 @@
 	widget = glade_xml_get_widget (prefs->gui, "colorpickerSpellCheckColor");
 	g_signal_connect (widget, "color_set", G_CALLBACK (spell_color_set), prefs);
 	
-	widget = glade_xml_get_widget (prefs->gui, "buttonSpellCheckEnable");
-	g_signal_connect (widget, "clicked", G_CALLBACK (spell_language_enable), prefs);
-	
 	widget = glade_xml_get_widget (prefs->gui, "chkEnableSpellChecking");
 	g_signal_connect (widget, "toggled", G_CALLBACK (spell_live_toggled), prefs);
-	
-	g_signal_connect (prefs->language, "button_press_event", G_CALLBACK (spell_language_button_press), prefs);
 }
 
 static gboolean
@@ -879,6 +825,7 @@
 	GladeXML *gui;
 	GtkListStore *model;
 	GtkTreeSelection *selection;
+	GtkCellRenderer *cell_renderer;
 	int style;
 	char *buf;
 	EMConfig *ec;
@@ -942,19 +889,19 @@
 	prefs->language = GTK_TREE_VIEW (glade_xml_get_widget (gui, "listSpellCheckLanguage"));
 	model = gtk_list_store_new (3, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_POINTER);
 	gtk_tree_view_set_model (prefs->language, (GtkTreeModel *) model);
+	cell_renderer = gtk_cell_renderer_toggle_new ();
 	gtk_tree_view_insert_column_with_attributes (prefs->language, -1, _("Enabled"),
-						     gtk_cell_renderer_toggle_new (),
+						     cell_renderer,
 						     "active", 0,
 						     NULL);
+	g_signal_connect (cell_renderer, "toggled", G_CALLBACK (spell_language_toggled), prefs);
+	
 	gtk_tree_view_insert_column_with_attributes (prefs->language, -1, _("Language(s)"),
 						     gtk_cell_renderer_text_new (),
 						     "text", 1,
 						     NULL);
 	selection = gtk_tree_view_get_selection (prefs->language);
-	gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);
-	g_signal_connect (selection, "changed", G_CALLBACK (spell_language_selection_changed), prefs);
-	
-	prefs->spell_able_button = glade_xml_get_widget (gui, "buttonSpellCheckEnable");
+	gtk_tree_selection_set_mode (selection, GTK_SELECTION_NONE);
 	info_pixmap = glade_xml_get_widget (gui, "pixmapSpellInfo");
 	gtk_image_set_from_stock (GTK_IMAGE (info_pixmap), GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_BUTTON);
 	if (!spell_setup_check_options (prefs)) {
Index: em-composer-prefs.h
===================================================================
RCS file: /cvs/gnome/evolution/mail/em-composer-prefs.h,v
retrieving revision 1.11
diff -u -r1.11 em-composer-prefs.h
--- em-composer-prefs.h	20 May 2004 20:52:42 -0000	1.11
+++ em-composer-prefs.h	21 Jan 2005 22:56:04 -0000
@@ -77,7 +77,6 @@
 	gboolean spell_active;
 	
 	struct _GdkPixbuf *enabled_pixbuf;
-	struct _GtkWidget *spell_able_button;
 	
 	/* Forwards and Replies */
 	struct _GtkOptionMenu *forward_style;
Index: mail-config.glade
===================================================================
RCS file: /cvs/gnome/evolution/mail/mail-config.glade,v
retrieving revision 1.155
diff -u -r1.155 mail-config.glade
--- mail-config.glade	14 Dec 2004 17:10:44 -0000	1.155
+++ mail-config.glade	21 Jan 2005 22:56:05 -0000
@@ -7232,57 +7232,6 @@
 	  <property name="spacing">12</property>
 
 	  <child>
-	    <widget class="GtkHBox" id="hboxImageAndHelp">
-	      <property name="visible">True</property>
-	      <property name="homogeneous">False</property>
-	      <property name="spacing">6</property>
-
-	      <child>
-		<widget class="GtkImage" id="pixmapSpellInfo">
-		  <property name="visible">True</property>
-		  <property name="stock">gtk-dialog-info</property>
-		  <property name="icon_size">6</property>
-		  <property name="xalign">0.5</property>
-		  <property name="yalign">0</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">True</property>
-		</packing>
-	      </child>
-
-	      <child>
-		<widget class="GtkLabel" id="lblSpellChecking">
-		  <property name="visible">True</property>
-		  <property name="label" translatable="yes">This page allows you to configure spell checking behavior and language. The list of languages here reflects only the languages for which you have a dictionary installed.</property>
-		  <property name="use_underline">False</property>
-		  <property name="use_markup">False</property>
-		  <property name="justify">GTK_JUSTIFY_LEFT</property>
-		  <property name="wrap">True</property>
-		  <property name="selectable">False</property>
-		  <property name="xalign">0</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">True</property>
-		  <property name="fill">True</property>
-		</packing>
-	      </child>
-	    </widget>
-	    <packing>
-	      <property name="padding">0</property>
-	      <property name="expand">False</property>
-	      <property name="fill">False</property>
-	    </packing>
-	  </child>
-
-	  <child>
 	    <widget class="GtkVBox" id="vbox196">
 	      <property name="visible">True</property>
 	      <property name="homogeneous">False</property>
@@ -7402,33 +7351,53 @@
 			  </child>
 
 			  <child>
-			    <widget class="GtkHBox" id="hbox219">
+			    <widget class="GtkHBox" id="hboxImageAndHelp">
 			      <property name="visible">True</property>
 			      <property name="homogeneous">False</property>
 			      <property name="spacing">6</property>
 
 			      <child>
-				<widget class="GtkButton" id="buttonSpellCheckEnable">
+				<widget class="GtkImage" id="pixmapSpellInfo">
 				  <property name="visible">True</property>
-				  <property name="sensitive">False</property>
-				  <property name="can_default">True</property>
-				  <property name="can_focus">True</property>
-				  <property name="label" translatable="yes">_Enable</property>
-				  <property name="use_underline">True</property>
-				  <property name="relief">GTK_RELIEF_NORMAL</property>
-				  <property name="focus_on_click">True</property>
+				  <property name="stock">gtk-dialog-info</property>
+				  <property name="icon_size">4</property>
+				  <property name="xalign">0.5</property>
+				  <property name="yalign">0</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>
+				  <property name="fill">True</property>
+				</packing>
+			      </child>
+
+			      <child>
+				<widget class="GtkLabel" id="lblSpellChecking">
+				  <property name="visible">True</property>
+				  <property name="label" translatable="yes">The list of languages here reflects only the languages for which you have a dictionary installed.</property>
+				  <property name="use_underline">False</property>
+				  <property name="use_markup">False</property>
+				  <property name="justify">GTK_JUSTIFY_LEFT</property>
+				  <property name="wrap">True</property>
+				  <property name="selectable">False</property>
+				  <property name="xalign">0</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">True</property>
+				  <property name="fill">True</property>
 				</packing>
 			      </child>
 			    </widget>
 			    <packing>
 			      <property name="padding">0</property>
 			      <property name="expand">False</property>
-			      <property name="fill">False</property>
+			      <property name="fill">True</property>
 			    </packing>
 			  </child>
 			</widget>
@@ -7607,7 +7576,7 @@
 	    <packing>
 	      <property name="padding">0</property>
 	      <property name="expand">False</property>
-	      <property name="fill">False</property>
+	      <property name="fill">True</property>
 	    </packing>
 	  </child>
 	</widget>


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