Commit 1b8d7830 authored by Andreas J. Guelzow 's avatar Andreas J. Guelzow

Save default search settings. [#625185]

2010-07-25  Andreas J. Guelzow <aguelzow@pyrshep.ca>

	* schemas/gnumeric-dialogs.schemas.in: new item search-results
	* schemas/gnumeric-general.schemas.in: fix typo
	* src/gnumeric-gconf.c (gnm_conf_*et_searchreplace_search_results*): new
	* src/gnumeric-gconf.h (gnm_conf_*et_searchreplace_search_results*): new

2010-07-25  Andreas J. Guelzow <aguelzow@pyrshep.ca>

	* dialog-search.c (dialog_search_save_in_prefs): new
	(dialog_search): use preferences
	(search_clicked): save preferences if appropriate
	* search-replace.glade: some minor adjustments
	* search.ui: add save as defaults checkbox
parent 6be9c2e5
2010-07-25 Andreas J. Guelzow <aguelzow@pyrshep.ca>
* schemas/gnumeric-dialogs.schemas.in: new item search-results
* schemas/gnumeric-general.schemas.in: fix typo
* src/gnumeric-gconf.c (gnm_conf_*et_searchreplace_search_results*): new
* src/gnumeric-gconf.h (gnm_conf_*et_searchreplace_search_results*): new
2010-07-24 Andreas J. Guelzow <aguelzow@pyrshep.ca>
* component/Gnumeric-embed.xml.in: add "clear filtered" menu items
......
......@@ -2,7 +2,7 @@ Gnumeric 1.10.8
Andreas:
* Add new Excel and Openformula units ("pica" and "picapt") to CONVERT.
* Save default search settings. [#105615]
* Save default search settings. [#105615][#625185]
* Improve configurable text export of numbers. [#126444]
* Improve horizontal fill. [#594193]
* Improve function syntax tooltips. [#623317]
......
......@@ -687,6 +687,17 @@
<long>Search &amp; Replace changes comments as default</long>
</locale>
</schema>
<schema>
<key>/schemas/apps/gnumeric/searchreplace/search-results</key>
<applyto>/apps/gnumeric/searchreplace/search-results</applyto>
<owner>Gnumeric</owner>
<type>bool</type>
<default>TRUE</default>
<locale name="C">
<short>Search searches in results</short>
<long>Search searches in results as default</long>
</locale>
</schema>
<schema>
<key>/schemas/apps/gnumeric/searchreplace/keep-strings</key>
<applyto>/apps/gnumeric/searchreplace/keep-strings</applyto>
......
......@@ -445,7 +445,7 @@ they are also processed at that time. If `lag' is negative, then recalculation h
<default>10</default>
<locale name="C">
<short>Number of Automatic Clauses</short>
<long>When selecting a sort region in the sort dialog, search clauses are automatically added. This number determines the maximum number of clauses to be added automatically.</long>
<long>When selecting a sort region in the sort dialog, sort clauses are automatically added. This number determines the maximum number of clauses to be added automatically.</long>
</locale>
</schema>
<schema>
......
2010-07-25 Andreas J. Guelzow <aguelzow@pyrshep.ca>
* dialog-search.c (dialog_search_save_in_prefs): new
(dialog_search): use preferences
(search_clicked): save preferences if appropriate
* search-replace.glade: some minor adjustments
* search.ui: add save as defaults checkbox
2010-07-25 Andreas J. Guelzow <aguelzow@pyrshep.ca>
* dialog-hyperlink.c (dialog_hyperlink): duplicate the hyperlink, it
......
......@@ -28,6 +28,7 @@
#include "help.h"
#include <gui-util.h>
#include <gnumeric-gconf.h>
#include <search.h>
#include <sheet.h>
#include <sheet-view.h>
......@@ -237,6 +238,29 @@ is_checked (GtkBuilder *gui, const char *name)
return gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (w));
}
static void
dialog_search_save_in_prefs (DialogState *dd)
{
GladeXML *gui = dd->gui;
#define SETW(w,f) f (is_checked (gui, w));
SETW("search_expr", gnm_conf_set_searchreplace_change_cell_expressions);
SETW("search_other", gnm_conf_set_searchreplace_change_cell_other);
SETW("search_string", gnm_conf_set_searchreplace_change_cell_strings);
SETW("search_comments", gnm_conf_set_searchreplace_change_comments);
SETW("search_expr_results", gnm_conf_set_searchreplace_search_results);
SETW("ignore_case", gnm_conf_set_searchreplace_ignore_case);
SETW("match_words", gnm_conf_set_searchreplace_whole_words_only);
SETW("column_major", gnm_conf_set_searchreplace_columnmajor);
#undef SETW
gnm_conf_set_searchreplace_regex
(go_gtk_builder_group_value (gui, search_type_group));
gnm_conf_set_searchreplace_scope
(go_gtk_builder_group_value (gui, scope_group));
}
static void
cursor_change (GtkTreeView *tree_view, DialogState *dd)
{
......@@ -337,6 +361,9 @@ search_clicked (G_GNUC_UNUSED GtkWidget *widget, DialogState *dd)
return;
}
if (is_checked (gui, "save-in-prefs"))
dialog_search_save_in_prefs (dd);
{
GnumericLazyList *ll;
GPtrArray *cells;
......@@ -526,6 +553,34 @@ dialog_search (WBCGtk *wbcg)
/* Set sensitivity of buttons. */
cursor_change (dd->matches_table, dd);
#define SETW(w,f) gtk_toggle_button_set_active \
(GTK_TOGGLE_BUTTON (gtk_builder_get_object (gui, w)), f())
SETW("search_expr", gnm_conf_get_searchreplace_change_cell_expressions);
SETW("search_other", gnm_conf_get_searchreplace_change_cell_other);
SETW("search_string", gnm_conf_get_searchreplace_change_cell_strings);
SETW("search_comments", gnm_conf_get_searchreplace_change_comments);
SETW("search_expr_results", gnm_conf_get_searchreplace_search_results);
SETW("ignore_case", gnm_conf_get_searchreplace_ignore_case);
SETW("match_words", gnm_conf_get_searchreplace_whole_words_only);
#undef SETW
gtk_toggle_button_set_active
(GTK_TOGGLE_BUTTON
(gtk_builder_get_object
(gui,
search_type_group[gnm_conf_get_searchreplace_regex ()])), TRUE);
gtk_toggle_button_set_active
(GTK_TOGGLE_BUTTON
(gtk_builder_get_object
(gui,
direction_group
[gnm_conf_get_searchreplace_columnmajor () ? 1 : 0])), TRUE);
gtk_toggle_button_set_active
(GTK_TOGGLE_BUTTON
(gtk_builder_get_object
(gui,
scope_group[gnm_conf_get_searchreplace_scope ()])), TRUE);
g_signal_connect (G_OBJECT (dd->matches_table), "cursor_changed",
G_CALLBACK (cursor_change), dd);
g_signal_connect (G_OBJECT (dd->matches_table), "select_cursor_row",
......
......@@ -473,7 +473,7 @@
<widget class="GtkTable" id="table5">
<property name="visible">True</property>
<property name="n_rows">4</property>
<property name="n_columns">3</property>
<property name="n_columns">2</property>
<property name="column_spacing">6</property>
<property name="row_spacing">6</property>
<child>
......@@ -484,7 +484,7 @@
<property name="use_markup">True</property>
</widget>
<packing>
<property name="right_attach">3</property>
<property name="right_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
......@@ -501,8 +501,6 @@
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
......@@ -521,26 +519,14 @@
<property name="group">row_major</property>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label14">
<property name="visible">True</property>
<property name="xalign">0</property>
</widget>
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options"></property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="keep_strings">
<property name="label" translatable="yes">_Keep strings as strings</property>
......@@ -554,8 +540,7 @@
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">3</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
......@@ -568,22 +553,15 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="tooltip" translatable="yes">When set, the current settings will be saved as the default settings for future invocations of this dialog.</property>
<property name="tooltip" translatable="yes">When set, the current settings will be saved as the default settings for future invocations of this and the Search dialog.</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">3</property>
<property name="right_attach">2</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</widget>
<packing>
<property name="expand">False</property>
......
This diff is collapsed.
......@@ -3318,6 +3318,32 @@ gnm_conf_get_searchreplace_scope_node (void)
return get_node (watch_searchreplace_scope.key);
}
static struct cb_watch_bool watch_searchreplace_search_results = {
0, "searchreplace/search-results", TRUE,
};
gboolean
gnm_conf_get_searchreplace_search_results (void)
{
if (!watch_searchreplace_search_results.handler)
watch_bool (&watch_searchreplace_search_results);
return watch_searchreplace_search_results.var;
}
void
gnm_conf_set_searchreplace_search_results (gboolean x)
{
if (!watch_searchreplace_search_results.handler)
watch_bool (&watch_searchreplace_search_results);
set_bool (&watch_searchreplace_search_results, x);
}
GOConfNode *
gnm_conf_get_searchreplace_search_results_node (void)
{
return get_node (watch_searchreplace_search_results.key);
}
static struct cb_watch_bool watch_searchreplace_whole_words_only = {
0, "searchreplace/whole-words-only", FALSE,
};
......
......@@ -441,6 +441,10 @@ GOConfNode *gnm_conf_get_searchreplace_scope_node (void);
int gnm_conf_get_searchreplace_scope (void);
void gnm_conf_set_searchreplace_scope (int);
GOConfNode *gnm_conf_get_searchreplace_search_results_node (void);
gboolean gnm_conf_get_searchreplace_search_results (void);
void gnm_conf_set_searchreplace_search_results (gboolean);
GOConfNode *gnm_conf_get_searchreplace_whole_words_only_node (void);
gboolean gnm_conf_get_searchreplace_whole_words_only (void);
void gnm_conf_set_searchreplace_whole_words_only (gboolean);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment