On Sun, Mar 01, 2009 at 06:35:54PM +0800, bill lam wrote:
> On Sun, 01 Mar 2009, Jean Br??fort wrote:
> > I don't think that the autosave option has ever been implemented in
> > gnumeric. See http://bugzilla.gnome.org/show_bug.cgi?id=64637 for more
> > details.
>
> Thank you for this information. It looks like this feature will never
> be implemented.
I whipped up the patch weeks ago but have not had a chance to
commit. Give this a try
diff --git a/src/dialogs/dialog-preferences.c b/src/dialogs/dialog-preferences.c
index 28f18a8..ea637bd 100644
--- a/src/dialogs/dialog-preferences.c
+++ b/src/dialogs/dialog-preferences.c
@@ -595,6 +595,10 @@ pref_window_page_initializer (PrefState *state,
page, row++, 1, 1, 64, 1,
gnm_gconf_set_workbook_nsheets,
_("Default Number of Sheets"));
+ int_pref_create_widget (state->root, GNM_CONF_WORKBOOK_AUTOSAVE_TIME,
+ page, row++, 0, 0, 365*24*60*60, 60,
+ gnm_gconf_set_workbook_autosave_time,
+ _("Default autosave frequency in seconds"));
bool_pref_create_widget (node, GNM_CONF_GUI_ED_LIVESCROLLING,
page, row++,
gnm_gconf_set_gui_livescrolling,
diff --git a/src/gnumeric-gconf-priv.h b/src/gnumeric-gconf-priv.h
index fcbd100..dd9c1b6 100644
--- a/src/gnumeric-gconf-priv.h
+++ b/src/gnumeric-gconf-priv.h
@@ -98,6 +98,7 @@ G_BEGIN_DECLS
#define GNM_CONF_FILE_SINGLE_SHEET_SAVE "save/single_sheet"
#define GNM_CONF_WORKBOOK_NSHEETS "core/workbook/n-sheet"
+#define GNM_CONF_WORKBOOK_AUTOSAVE_TIME "core/workbook/autosave_time"
#define GNM_CONF_GUI_DIR "core/gui"
#define GNM_CONF_GUI_RES_H "screen/horizontaldpi"
diff --git a/src/gnumeric-gconf.c b/src/gnumeric-gconf.c
index 423a5b6..dbc84b3 100644
--- a/src/gnumeric-gconf.c
+++ b/src/gnumeric-gconf.c
@@ -184,6 +184,8 @@ gnm_conf_init_essential (void)
node, GNM_CONF_GUI_RES_V, 10., 1000., 96.);
prefs.initial_sheet_number = go_conf_load_int (
root, GNM_CONF_WORKBOOK_NSHEETS, 1, 64, 3);
+ prefs.autosave_time = go_conf_load_int (
+ root, GNM_CONF_WORKBOOK_AUTOSAVE_TIME, 0, 365*24*60*60, 0);
prefs.horizontal_window_fraction = go_conf_load_double (
node, GNM_CONF_GUI_WINDOW_X, .1, 1., .6);
prefs.vertical_window_fraction = go_conf_load_double (
@@ -835,6 +837,15 @@ gnm_gconf_set_workbook_nsheets (gint val)
prefs.initial_sheet_number = val;
go_conf_set_int (root, GNM_CONF_WORKBOOK_NSHEETS, val);
}
+void
+gnm_gconf_set_workbook_autosave_time (gint val)
+
+{
+ if (val < 0)
+ val = 0;
+ prefs.autosave_time = val;
+ go_conf_set_int (root, GNM_CONF_WORKBOOK_AUTOSAVE_TIME, val);
+}
void
gnm_gconf_set_xml_compression (gint val)
diff --git a/src/gnumeric-gconf.h b/src/gnumeric-gconf.h
index 603c90d..22f2942 100644
--- a/src/gnumeric-gconf.h
+++ b/src/gnumeric-gconf.h
@@ -40,6 +40,7 @@ typedef struct {
gint undo_max_number;
gint initial_sheet_number;
+ gint autosave_time;
float horizontal_window_fraction;
float vertical_window_fraction;
float zoom;
@@ -189,6 +190,7 @@ void gnm_gconf_set_sort_ascending (gboolean value);
/* workbook */
void gnm_gconf_set_workbook_nsheets (gint value);
+void gnm_gconf_set_workbook_autosave_time (gint value);
void gnm_gconf_set_unfocused_rs (gboolean value);
/* function selector and formula guru */
diff --git a/src/wbc-gtk.c b/src/wbc-gtk.c
index a71ba6f..5e31ed6 100644
--- a/src/wbc-gtk.c
+++ b/src/wbc-gtk.c
@@ -4826,6 +4826,7 @@ wbc_gtk_init (GObject *obj)
wbc_gtk_set_toggle_action_state (wbcg, "ViewSheets", FALSE);
wbc_gtk_set_toggle_action_state (wbcg, "ViewStatusbar", FALSE);
#endif
+ wbcg_set_autosave_time (wbcg, gnm_app_prefs->autosave_time);
}
GSF_CLASS_FULL (WBCGtk, wbc_gtk, NULL, NULL, wbc_gtk_class_init, NULL,
_______________________________________________
gnumeric-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/gnumeric-list