When the users config directory is on a filesystem with high latency,
moving a dialog box resulted in many writes and thus an unacceptable
delay. This change fixes that by consolidating the writes into a
low priority idle callback.
#include <stdio.h>
#include <sys/stat.h>
+#include <glib.h>
+
#include "psppire-conf.h"
static void psppire_conf_init (PsppireConf *conf);
NULL);
}
-static void
-conf_write (PsppireConf *conf)
+static gboolean
+flush_conf (PsppireConf *conf)
{
gsize length = 0;
}
g_free (kf);
+ conf->idle = 0;
+ return FALSE;
}
+static void
+conf_write (PsppireConf *conf)
+{
+ if ( conf->idle == 0)
+ conf->idle = g_idle_add_full (G_PRIORITY_LOW,
+ (GSourceFunc) flush_conf, conf, NULL);
+}
+
+
static void
psppire_conf_dispose (GObject *object)
{
conf->keyfile = g_key_file_new ();
conf->dispose_has_run = FALSE;
+ conf->idle = 0;
}
GKeyFile *keyfile;
gchar *filename;
+ guint idle;
};