Commit ab31a649 authored by Morten Welinder's avatar Morten Welinder

ssconvert: don't save configuration

This should avoid warnings about dbus not being started without DISPLAY
set.
parent af8470dc
......@@ -9,6 +9,7 @@ Morten:
* Test suite improvements.
* ssconvert improvements.
* Makefile improvements.
* Don't save any configuration when running ssconvert/ssdiff/...
--------------------------------------------------------------------------
Gnumeric 1.12.41
......
......@@ -47,6 +47,8 @@
#define GNM_CONF_DIR "gnumeric"
static gboolean persist_changes = TRUE;
static GOConfNode *root = NULL;
/*
......@@ -204,8 +206,10 @@ set_bool (struct cb_watch_bool *watch, gboolean x)
MAYBE_DEBUG_SET (watch->key);
watch->var = x;
go_conf_set_bool (root, watch->key, x);
schedule_sync ();
if (persist_changes) {
go_conf_set_bool (root, watch->key, x);
schedule_sync ();
}
}
/* ---------------------------------------- */
......@@ -249,8 +253,10 @@ set_int (struct cb_watch_int *watch, int x)
MAYBE_DEBUG_SET (watch->key);
watch->var = x;
go_conf_set_int (root, watch->key, x);
schedule_sync ();
if (persist_changes) {
go_conf_set_int (root, watch->key, x);
schedule_sync ();
}
}
/* ---------------------------------------- */
......@@ -294,8 +300,10 @@ set_double (struct cb_watch_double *watch, double x)
MAYBE_DEBUG_SET (watch->key);
watch->var = x;
go_conf_set_double (root, watch->key, x);
schedule_sync ();
if (persist_changes) {
go_conf_set_double (root, watch->key, x);
schedule_sync ();
}
}
/* ---------------------------------------- */
......@@ -343,8 +351,10 @@ set_string (struct cb_watch_string *watch, const char *x)
watch->var = xc;
/* Update pool before setting so monitors see the right value. */
g_hash_table_replace (string_pool, (gpointer)watch->key, xc);
go_conf_set_string (root, watch->key, xc);
schedule_sync ();
if (persist_changes) {
go_conf_set_string (root, watch->key, xc);
schedule_sync ();
}
}
/* ---------------------------------------- */
......@@ -381,8 +391,10 @@ static gboolean
string_list_equal (GSList *x, GSList *y)
{
while (x && y) {
if (strcmp (x->data, y->data) != 0)
if (strcmp (x->data, y->data) != 0) {
g_printerr ("Diff: %s %s\n", x->data, y->data);
return FALSE;
}
x = x->next;
y = y->next;
}
......@@ -402,8 +414,10 @@ set_string_list (struct cb_watch_string_list *watch, GSList *x)
watch->var = x;
/* Update pool before setting so monitors see the right value. */
g_hash_table_replace (string_list_pool, (gpointer)watch->key, x);
go_conf_set_str_list (root, watch->key, x);
schedule_sync ();
if (persist_changes) {
go_conf_set_str_list (root, watch->key, x);
schedule_sync ();
}
}
/* ---------------------------------------- */
......@@ -446,8 +460,10 @@ set_enum (struct cb_watch_enum *watch, int x)
MAYBE_DEBUG_SET (watch->key);
watch->var = x;
go_conf_set_enum (root, watch->key, watch->typ, x);
schedule_sync ();
if (persist_changes) {
go_conf_set_enum (root, watch->key, watch->typ, x);
schedule_sync ();
}
}
/* -------------------------------------------------------------------------- */
......@@ -494,7 +510,7 @@ gnm_conf_shutdown (void)
if (debug_getters || debug_setters)
g_printerr ("gnm_conf_shutdown\n");
go_conf_sync (root);
//go_conf_sync (root);
if (sync_handler) {
g_source_remove (sync_handler);
sync_handler = 0;
......@@ -518,6 +534,19 @@ gnm_conf_shutdown (void)
root = NULL;
}
/**
* gnm_conf_set_persistence:
* @persist: whether to save changes
*
* If @persist is %TRUE, then changes from this point on will not be saved.
*/
void
gnm_conf_set_persistence (gboolean persist)
{
persist_changes = persist;
}
/**
* gnm_conf_get_page_setup:
*
......
......@@ -9,6 +9,8 @@ G_BEGIN_DECLS
void gnm_conf_init (void);
void gnm_conf_shutdown (void);
void gnm_conf_set_persistence (gboolean persist);
GOConfNode *gnm_conf_get_root (void);
char const *gnm_conf_get_short_desc (GOConfNode *node);
......
......@@ -30,6 +30,7 @@
#include <command-context.h>
#include <command-context-stderr.h>
#include <workbook-view.h>
#include <gnumeric-conf.h>
#include <tools/analysis-tools.h>
#include <dialogs/dialogs.h>
#include <goffice/goffice.h>
......@@ -1046,6 +1047,8 @@ main (int argc, char const **argv)
/* No code before here, we need to init threads */
argv = gnm_pre_parse_init (argc, argv);
gnm_conf_set_persistence (FALSE);
ocontext = g_option_context_new (_("INFILE [OUTFILE]"));
g_option_context_add_main_entries (ocontext, ssconvert_options, GETTEXT_PACKAGE);
g_option_context_add_group (ocontext, gnm_get_option_group ());
......
......@@ -32,6 +32,8 @@
#include <input-msg.h>
#include <expr-name.h>
#include <sheet-diff.h>
#include <gnumeric-conf.h>
#include <gsf/gsf-libxml.h>
#include <gsf/gsf-output-stdio.h>
#include <gsf/gsf-input.h>
......@@ -922,6 +924,8 @@ main (int argc, char const **argv)
// No code before here, we need to init threads
argv = gnm_pre_parse_init (argc, argv);
gnm_conf_set_persistence (FALSE);
ocontext = g_option_context_new (_("OLDFILE NEWFILE"));
g_option_context_add_main_entries (ocontext, ssdiff_options, GETTEXT_PACKAGE);
g_option_context_add_group (ocontext, gnm_get_option_group ());
......
......@@ -21,6 +21,7 @@
#include <func.h>
#include <parse-util.h>
#include <sheet-object-cell-comment.h>
#include <gnumeric-conf.h>
#include <gsf/gsf-input-stdio.h>
#include <gsf/gsf-input-textline.h>
......@@ -423,6 +424,8 @@ main (int argc, char const **argv)
/* No code before here, we need to init threads */
argv = gnm_pre_parse_init (argc, argv);
gnm_conf_set_persistence (FALSE);
ocontext = g_option_context_new (_("PATTERN INFILE..."));
g_option_context_add_main_entries (ocontext, ssgrep_options, GETTEXT_PACKAGE);
g_option_context_add_group (ocontext, gnm_get_option_group ());
......
......@@ -27,6 +27,7 @@
#include <validation.h>
#include <sheet-object-graph.h>
#include <gnm-plugin.h>
#include <gnumeric-conf.h>
#include <gsf/gsf-utils.h>
#include <gsf/gsf-libxml.h>
......@@ -246,6 +247,8 @@ main (int argc, char const **argv)
/* No code before here, we need to init threads */
argv = gnm_pre_parse_init (argc, argv);
gnm_conf_set_persistence (FALSE);
ocontext = g_option_context_new (_("INFILE..."));
g_option_context_add_main_entries (ocontext, ssindex_options, GETTEXT_PACKAGE);
g_option_context_add_group (ocontext, gnm_get_option_group ());
......
......@@ -27,6 +27,7 @@
#include <sf-dpq.h>
#include <sf-gamma.h>
#include <rangefunc.h>
#include <gnumeric-conf.h>
#include <gsf/gsf-input-stdio.h>
#include <gsf/gsf-input-textline.h>
......@@ -3473,6 +3474,8 @@ main (int argc, char const **argv)
/* No code before here, we need to init threads */
argv = gnm_pre_parse_init (argc, argv);
gnm_conf_set_persistence (FALSE);
ocontext = g_option_context_new (_("[testname]"));
g_option_context_add_main_entries (ocontext, sstest_options, GETTEXT_PACKAGE);
g_option_context_add_group (ocontext, gnm_get_option_group ());
......
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