[gnumeric] Fix the AutoCorrect menu item



commit 5c9abfab7dcdd62c7947968546220658c58583f6
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Mon Jul 11 08:44:55 2011 -0600

    Fix the AutoCorrect menu item
    
    2011-07-11 Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* dialogs.h (dialog_preferences): change the type of the last argument
    	and change all callers
    	* dialog-preferences.c (dialog_pref_select_page_search): use the name
    	rather than the position
    	(dialog_pref_select_page): ditto

 BUGS                             |    5 -----
 src/dialogs/ChangeLog            |    8 ++++++++
 src/dialogs/dialog-preferences.c |   34 ++++++++++++++++++++--------------
 src/dialogs/dialogs.h            |    2 +-
 src/wbc-gtk-actions.c            |    4 ++--
 5 files changed, 31 insertions(+), 22 deletions(-)
---
diff --git a/BUGS b/BUGS
index eacd669..b53df02 100644
--- a/BUGS
+++ b/BUGS
@@ -147,10 +147,6 @@ Architecture Changes
 	    4.45.2.2) items
 	    4.45.2.3) custom
 	    4.45.2.4) dynamic
-    4.46) ODF
-	4.46.1) import
-	4.46.2) export
-    4.50) #346002 : tooltip of matching rows  (using progress bar) (DONE)
     4.51) #383400 : '95' should match 95
     22.52) Clipboard ?? do we want this ?
     4.53) Support Office 2007 toggle date based buckets
@@ -525,7 +521,6 @@ Architecture Changes
                  5.1.1 of the OpenDocument Standard. 
 	36.2.4) col/row manual vs auto
     36.5) See 12.6 (Input Messages)
-    36.6) See 4.46 (Autofilters)
     36.7) See 22.13 (Validation)
     36.10) See 5.3 (pivots)
     36.11) See 17.2.5 (page breaks)
diff --git a/src/dialogs/ChangeLog b/src/dialogs/ChangeLog
index e9864c3..b1fa07d 100644
--- a/src/dialogs/ChangeLog
+++ b/src/dialogs/ChangeLog
@@ -1,3 +1,11 @@
+2011-07-11 Andreas J. Guelzow <aguelzow pyrshep ca>
+
+	* dialogs.h (dialog_preferences): change the type of the last argument
+	and change all callers
+	* dialog-preferences.c (dialog_pref_select_page_search): use the name 
+	rather than the position
+	(dialog_pref_select_page): ditto
+
 2011-07-10 Andreas J. Guelzow <aguelzow pyrshep ca>
 
 	* dialog-cell-format-cond.c (c_fmt_dialog_init_editor_page): enable
diff --git a/src/dialogs/dialog-preferences.c b/src/dialogs/dialog-preferences.c
index 4b40d0e..2f2ead9 100644
--- a/src/dialogs/dialog-preferences.c
+++ b/src/dialogs/dialog-preferences.c
@@ -1173,7 +1173,7 @@ typedef struct {
 					 GtkNotebook *notebook, gint page_num);
 } page_info_t;
 
-/* Note that the first two items must remain here in that order */
+/* Note that the page names are used in calls to dialog_preferences and as default in  dialog_pref_select_page! */
 static page_info_t const page_info[] = {
 	{N_("Auto Correct"),  GTK_STOCK_DIALOG_ERROR,	 NULL, &pref_autocorrect_general_page_initializer},
 	{N_("Font"),          GTK_STOCK_ITALIC,		 NULL, &pref_font_initializer	       },
@@ -1193,7 +1193,7 @@ static page_info_t const page_info[] = {
 };
 
 typedef struct {
-	int  const page;
+	gchar const *page;
 	GtkTreePath *path;
 } page_search_t;
 
@@ -1203,27 +1203,33 @@ dialog_pref_select_page_search (GtkTreeModel *model,
 				GtkTreeIter *iter,
 				page_search_t *pst)
 {
-	int page;
-	gtk_tree_model_get (model, iter, PAGE_NUMBER, &page, -1);
-	if (page == pst->page) {
+	gchar *page;
+	gtk_tree_model_get (model, iter, ITEM_NAME, &page, -1);
+	if (0 == strcmp (page, pst->page)) {
+		g_free (page);
 		pst->path = gtk_tree_path_copy (path);
 		return TRUE;
-	} else
+	} else {
+		g_free (page);
 		return FALSE;
+	}
 }
 
 static void
-dialog_pref_select_page (PrefState *state, int page)
+dialog_pref_select_page (PrefState *state, gchar const *page)
 {
-	page_search_t pst = {page, NULL};
+	page_search_t pst = {NULL, NULL};
+
+	if (page == NULL)
+		page = "Tools";
 
-	if (page >= 0)
-		gtk_tree_model_foreach (GTK_TREE_MODEL (state->store),
-					(GtkTreeModelForeachFunc) dialog_pref_select_page_search,
-					&pst);
+	pst.page = _(page);
+	gtk_tree_model_foreach (GTK_TREE_MODEL (state->store),
+				(GtkTreeModelForeachFunc) dialog_pref_select_page_search,
+				&pst);
 
 	if (pst.path == NULL)
-		pst.path = gtk_tree_path_new_from_string ("0");
+		pst.path = gtk_tree_path_new_first ();
 
 	if (pst.path != NULL) {
 		gtk_tree_view_set_cursor (state->view, pst.path, NULL, FALSE);
@@ -1282,7 +1288,7 @@ cb_workbook_removed (PrefState *state)
 }
 
 void
-dialog_preferences (WBCGtk *wbcg, gint page)
+dialog_preferences (WBCGtk *wbcg, gchar const *page)
 {
 	PrefState *state;
 	GtkBuilder *gui;
diff --git a/src/dialogs/dialogs.h b/src/dialogs/dialogs.h
index 4086663..39ad498 100644
--- a/src/dialogs/dialogs.h
+++ b/src/dialogs/dialogs.h
@@ -125,7 +125,7 @@ int dialog_ttest_tool    (WBCGtk *wbcg, Sheet *sheet, ttest_type test);
 char *dialog_get_password (GtkWindow *parent, char const *filename);
 
 /* Modeless dialogs */
-void	dialog_preferences (WBCGtk *wbcg, gint page);
+void	dialog_preferences (WBCGtk *wbcg, gchar const *page);
 void    dialog_recent_used (WBCGtk *wbcg);
 
 void	dialog_new_view (WBCGtk *wbcg);
diff --git a/src/wbc-gtk-actions.c b/src/wbc-gtk-actions.c
index 94c3ce9..43a53a6 100644
--- a/src/wbc-gtk-actions.c
+++ b/src/wbc-gtk-actions.c
@@ -308,7 +308,7 @@ static GNM_ACTION_DEF (cb_file_print_preview)
 }
 
 static GNM_ACTION_DEF (cb_doc_meta_data)	{ dialog_doc_metadata_new (wbcg, 0); }
-static GNM_ACTION_DEF (cb_file_preferences)	{ dialog_preferences (wbcg, 0); }
+static GNM_ACTION_DEF (cb_file_preferences)	{ dialog_preferences (wbcg, NULL); }
 static GNM_ACTION_DEF (cb_file_history_full)    { dialog_recent_used (wbcg); }
 static GNM_ACTION_DEF (cb_file_close)		{ wbc_gtk_close (wbcg); }
 
@@ -928,7 +928,7 @@ static GNM_ACTION_DEF (cb_format_cells_cond)    { dialog_cell_format_cond (wbcg)
 static GNM_ACTION_DEF (cb_autoformat)		{ dialog_autoformat (wbcg); }
 static GNM_ACTION_DEF (cb_workbook_attr)	{ dialog_workbook_attr (wbcg); }
 static GNM_ACTION_DEF (cb_tools_plugins)	{ dialog_plugin_manager (wbcg); }
-static GNM_ACTION_DEF (cb_tools_autocorrect)	{ dialog_preferences (wbcg, 1); }
+static GNM_ACTION_DEF (cb_tools_autocorrect)	{ dialog_preferences (wbcg, "Auto Correct"); }
 static GNM_ACTION_DEF (cb_tools_auto_save)	{ dialog_autosave (wbcg); }
 static GNM_ACTION_DEF (cb_tools_goal_seek)	{ dialog_goal_seek (wbcg, wbcg_cur_sheet (wbcg)); }
 static GNM_ACTION_DEF (cb_tools_tabulate)	{ dialog_tabulate (wbcg, wbcg_cur_sheet (wbcg)); }



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