[gnumeric] Sort the translated labels in the prference dialog
- From: Andreas J. Guelzow <guelzow src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnumeric] Sort the translated labels in the prference dialog
- Date: Wed, 11 Nov 2009 18:19:35 +0000 (UTC)
commit 0b22586dfda3358b3f157ff82a1365d2e8be8113
Author: Andreas J. Guelzow <aguelzow pyrshep ca>
Date: Wed Nov 11 11:19:15 2009 -0700
Sort the translated labels in the prference dialog
2009-11-11 Andreas J. Guelzow <aguelzow pyrshep ca>
* dialog-doc-metadata.c: use more appropriate icon for statistics
* dialog-preferences.c (page_info): change the order of items to
index the required page directly
(dialog_pref_select_page_search): new
(dialog_pref_select_page): use the page number rather than the path
(dialog_preferences): sort the pages by the translated descriptor
NEWS | 1 +
src/dialogs/ChangeLog | 9 +++++
src/dialogs/dialog-doc-metadata.c | 10 +++---
src/dialogs/dialog-preferences.c | 71 ++++++++++++++++++++++++------------
4 files changed, 62 insertions(+), 29 deletions(-)
---
diff --git a/NEWS b/NEWS
index ead413d..1bb55cc 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,7 @@ Gnumeric 1.9.16
Andreas:
* Clarify distinction between Document and View Properties.
+ * Sort the translated labels in the prference dialog.
Jean:
* Fix cursor and cell edition on dark backgrounds. [#600656]
diff --git a/src/dialogs/ChangeLog b/src/dialogs/ChangeLog
index fae98d9..949438b 100644
--- a/src/dialogs/ChangeLog
+++ b/src/dialogs/ChangeLog
@@ -1,5 +1,14 @@
2009-11-11 Andreas J. Guelzow <aguelzow pyrshep ca>
+ * dialog-doc-metadata.c: use more appropriate icon for statistics
+ * dialog-preferences.c (page_info): change the order of items to
+ index the required page directly
+ (dialog_pref_select_page_search): new
+ (dialog_pref_select_page): use the page number rather than the path
+ (dialog_preferences): sort the pages by the translated descriptor
+
+2009-11-11 Andreas J. Guelzow <aguelzow pyrshep ca>
+
* dialog-workbook-attr.c: remove the calculation related part of
the dialog. That is now correctly part of the Document Properties.
* workbook-attr.glade: ditto
diff --git a/src/dialogs/dialog-doc-metadata.c b/src/dialogs/dialog-doc-metadata.c
index 4342060..9eca03d 100644
--- a/src/dialogs/dialog-doc-metadata.c
+++ b/src/dialogs/dialog-doc-metadata.c
@@ -1594,11 +1594,11 @@ typedef struct {
static page_info_t const page_info[] = {
/* IMPORTANT: OBEY THE ORDER 0 - 3 - 2 - 1 */
- {N_("File"), GTK_STOCK_FILE, NULL, 0, &dialog_doc_metadata_init_file_page },
- {N_("Statistics"), GTK_STOCK_DIALOG_WARNING, NULL, 3 ,&dialog_doc_metadata_init_statistics_page },
- {N_("Properties"), GTK_STOCK_PROPERTIES, NULL, 2, &dialog_doc_metadata_init_properties_page },
- {N_("Description"), GTK_STOCK_ABOUT, NULL, 1, &dialog_doc_metadata_init_description_page },
- {N_("Calculation"), GTK_STOCK_EXECUTE, NULL, 4, &dialog_doc_metadata_init_calculations_page },
+ {N_("File"), GTK_STOCK_FILE, NULL, 0, &dialog_doc_metadata_init_file_page },
+ {N_("Statistics"), "Gnumeric_GraphGuru", NULL, 3 ,&dialog_doc_metadata_init_statistics_page },
+ {N_("Properties"), GTK_STOCK_PROPERTIES, NULL, 2, &dialog_doc_metadata_init_properties_page },
+ {N_("Description"), GTK_STOCK_ABOUT, NULL, 1, &dialog_doc_metadata_init_description_page },
+ {N_("Calculation"), GTK_STOCK_EXECUTE, NULL, 4, &dialog_doc_metadata_init_calculations_page },
{NULL, NULL, NULL, -1, NULL},
};
diff --git a/src/dialogs/dialog-preferences.c b/src/dialogs/dialog-preferences.c
index 45592a2..2fd79e6 100644
--- a/src/dialogs/dialog-preferences.c
+++ b/src/dialogs/dialog-preferences.c
@@ -1016,33 +1016,60 @@ typedef struct {
GtkNotebook *notebook, gint page_num);
} page_info_t;
+/* Note that the first two items must remain here in that order */
static page_info_t const page_info[] = {
+ {N_("Copy and Paste"),GTK_STOCK_PASTE, NULL, &pref_copypaste_page_initializer},
{N_("Auto Correct"), GTK_STOCK_DIALOG_ERROR, NULL, &pref_autocorrect_general_page_initializer},
{N_("Font"), GTK_STOCK_ITALIC, NULL, &pref_font_initializer },
- {N_("Copy and Paste"),GTK_STOCK_PASTE, NULL, &pref_copypaste_page_initializer},
{N_("Files"), GTK_STOCK_FLOPPY, NULL, &pref_file_page_initializer },
{N_("Tools"), GTK_STOCK_EXECUTE, NULL, &pref_tool_page_initializer },
{N_("Undo"), GTK_STOCK_UNDO, NULL, &pref_undo_page_initializer },
{N_("Windows"), "Gnumeric_ObjectCombo", NULL, &pref_window_page_initializer },
- {N_("Header/Footer"), GTK_STOCK_ITALIC, "1", &pref_font_hf_initializer },
+ {N_("Header/Footer"), GTK_STOCK_ITALIC, "2", &pref_font_hf_initializer },
{N_("Sorting"), GTK_STOCK_SORT_ASCENDING, "4", &pref_sort_page_initializer },
{N_("Screen"), GTK_STOCK_PREFERENCES, "6", &pref_screen_page_initializer },
- {N_("INitial CApitals"), NULL, "0", &pref_autocorrect_initialcaps_page_initializer },
- {N_("First Letter"), NULL, "0", &pref_autocorrect_firstletter_page_initializer },
+ {N_("INitial CApitals"), NULL, "1", &pref_autocorrect_initialcaps_page_initializer },
+ {N_("First Letter"), NULL, "1", &pref_autocorrect_firstletter_page_initializer },
{NULL, NULL, NULL, NULL },
};
+typedef struct {
+ int const page;
+ GtkTreePath *path;
+} page_search_t;
+
+static gboolean
+dialog_pref_select_page_search (GtkTreeModel *model,
+ GtkTreePath *path,
+ GtkTreeIter *iter,
+ page_search_t *pst)
+{
+ int page;
+ gtk_tree_model_get (model, iter, PAGE_NUMBER, &page, -1);
+ if (page == pst->page) {
+ pst->path = gtk_tree_path_copy (path);
+ return TRUE;
+ } else
+ return FALSE;
+}
+
static void
-dialog_pref_select_page (PrefState *state, char const *page)
+dialog_pref_select_page (PrefState *state, int page)
{
- GtkTreePath *path = gtk_tree_path_new_from_string (page);
- if (path == NULL)
- path = gtk_tree_path_new_from_string ("0");
-
- if (path != NULL) {
- gtk_tree_view_set_cursor (state->view, path, NULL, FALSE);
- gtk_tree_view_expand_row (state->view, path, TRUE);
- gtk_tree_path_free (path);
+ page_search_t pst = {page, NULL};
+
+ if (page >= 0)
+ 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");
+
+ if (pst.path != NULL) {
+ gtk_tree_view_set_cursor (state->view, pst.path, NULL, FALSE);
+ gtk_tree_view_expand_row (state->view, pst.path, TRUE);
+ gtk_tree_path_free (pst.path);
}
}
@@ -1096,10 +1123,6 @@ cb_workbook_removed (PrefState *state)
}
-/* Note: The first page listed below is opened through File/Preferences, */
-/* and the second through Tools/Autocorrect */
-static char const * const startup_pages[] = {"2", "0"};
-
void
dialog_preferences (WBCGtk *wbcg, gint page)
{
@@ -1179,16 +1202,16 @@ dialog_preferences (WBCGtk *wbcg, gint page)
this_page->page_initializer (state, NULL,
state->notebook, i);
gtk_notebook_append_page (state->notebook, page_widget, NULL);
- dialog_pref_add_item (state, this_page->page_name, this_page->icon_name, i, this_page->parent_path);
- }
-
- if (page <0 || page > (gint) sizeof (startup_pages)) {
- g_warning ("Selected startup page %i is invalid.", page);
- page = 0;
+ dialog_pref_add_item (state, this_page->page_name,
+ this_page->icon_name, i,
+ this_page->parent_path);
}
+
+ gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (state->store),
+ ITEM_NAME, GTK_SORT_ASCENDING);
wbcg_set_transient (wbcg, GTK_WINDOW (state->dialog));
gtk_widget_show (GTK_WIDGET (state->dialog));
- dialog_pref_select_page (state, startup_pages[page]);
+ dialog_pref_select_page (state, page);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]