G_MODULE_EXPORT void toggle_autosaving(GtkWidget* widget, void* user) { gboolean newval = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); config_set_value("autosaving", newval ? "True" : "False"); if (newval) { gtk_widget_set_sensitive( GTK_WIDGET(gui->prefsgui->autosave_timer), TRUE); gint time = atoi(config_get_value("autosave_timer")); gtk_spin_button_set_value(gui->prefsgui->autosave_timer, time); iofunctions_reset_autosave(g_active_editor->filename); } else { gtk_widget_set_sensitive( GTK_WIDGET(gui->prefsgui->autosave_timer), FALSE); iofunctions_stop_autosave(); } }
void iofunctions_reset_autosave (const gchar* name) { iofunctions_stop_autosave (); if (config_get_value ("autosaving")) iofunctions_start_autosave (); }