Commit 8df7e26a authored by Miguel de Icaza's avatar Miguel de Icaza Committed by Miguel de Icaza

Tag strings for internationalization. ditto.

2000-02-07  Miguel de Icaza  <miguel@gnu.org>

	* src/solver-lp.c: Tag strings for internationalization.
	* src/analysis-tools.c: ditto.

	* src/workbook.c (dialog_autosave_callback): Moved autosave code
	here.
	(workbook_autosave_cancel): Cancels autosaving.
	(workbook_autosave_set):
parent 1cff73da
2000-02-07 Miguel de Icaza <miguel@gnu.org>
* src/solver-lp.c: Tag strings for internationalization.
* src/analysis-tools.c: ditto.
* src/workbook.c (dialog_autosave_callback): Moved autosave code
here.
(workbook_autosave_cancel): Cancels autosaving.
(workbook_autosave_set):
* src/dialogs/dialog-autosave.c (dialog_autosave): Change the
order here.
(dialog_autosave): Correct. Help button does not mean OK. Hook
......
2000-02-07 Miguel de Icaza <miguel@gnu.org>
* src/solver-lp.c: Tag strings for internationalization.
* src/analysis-tools.c: ditto.
* src/workbook.c (dialog_autosave_callback): Moved autosave code
here.
(workbook_autosave_cancel): Cancels autosaving.
(workbook_autosave_set):
* src/dialogs/dialog-autosave.c (dialog_autosave): Change the
order here.
(dialog_autosave): Correct. Help button does not mean OK. Hook
......
This diff is collapsed.
......@@ -30,41 +30,28 @@ prompt_on_off_toggled(GtkWidget *widget, Workbook *wb)
wb->autosave_prompt = GTK_TOGGLE_BUTTON (widget)->active;
}
gint
dialog_autosave_callback (gpointer *data)
gboolean
dialog_autosave_prompt (Workbook *wb)
{
Workbook *wb = (Workbook *) data;
if (wb->autosave && workbook_is_dirty (wb)) {
if (wb->autosave_prompt) {
GladeXML *gui =
glade_xml_new (GNUMERIC_GLADEDIR
"/autosave-prompt.glade", NULL);
GtkWidget *dia;
gint v;
dia = glade_xml_get_widget (gui, "AutoSavePrompt");
if (!dia) {
printf("Corrupt file autosave-prompt.glade\n");
return 0;
}
v = gnumeric_dialog_run (wb, GNOME_DIALOG (dia));
if (v != -1)
gtk_object_destroy (GTK_OBJECT (dia));
gtk_object_unref (GTK_OBJECT (gui));
if (v != 0)
goto out;
}
workbook_save (workbook_command_context_gui (wb), wb);
GtkWidget *dia;
GladeXML *gui = glade_xml_new (GNUMERIC_GLADEDIR "/autosave-prompt.glade", NULL);
gint v;
dia = glade_xml_get_widget (gui, "AutoSavePrompt");
if (!dia) {
printf("Corrupt file autosave-prompt.glade\n");
return 0;
}
out:
wb->autosave_timer =
gtk_timeout_add(wb->autosave_minutes*60000,
(GtkFunction) dialog_autosave_callback, wb);
return 0;
v = gnumeric_dialog_run (wb, GNOME_DIALOG (dia));
if (v != -1)
gtk_object_destroy (GTK_OBJECT (dia));
gtk_object_unref (GTK_OBJECT (gui));
if (v == 0)
return TRUE;
else
return FALSE;
}
void
......@@ -137,19 +124,14 @@ loop:
goto loop;
}
} else if (v == 2) {
GnomeHelpMenuEntry *help_ref = { "gnumeric", "autosave.html" };
GnomeHelpMenuEntry help_ref = { "gnumeric", "autosave.html" };
gnome_help_display (NULL, &help_ref);
} else if (v == 1) {
wb->autosave = old_autosave;
wb->autosave_prompt = old_prompt;
wb->autosave_minutes = old_minutes;
workbook_autosave_set (wb, old_minutes, old_prompt);
}
wb->autosave_timer =
gtk_timeout_add(wb->autosave_minutes*60000,
(GtkFunction) dialog_autosave_callback, wb);
if (v != -1)
gtk_object_destroy (GTK_OBJECT (dia));
......
......@@ -89,26 +89,26 @@ typedef struct {
} data_analysis_output_t;
void dialog_goto_cell (Workbook *wb);
void dialog_cell_format (Workbook *wb, Sheet *sheet);
int dialog_paste_special (Workbook *wb);
void dialog_insert_cells (Workbook *wb, Sheet *sheet);
void dialog_delete_cells (Workbook *wb, Sheet *sheet);
void dialog_zoom (Workbook *wb, Sheet *sheet);
char *dialog_query_load_file (Workbook *wb);
void dialog_about (Workbook *wb);
void dialog_define_names (Workbook *wb);
void dialog_cell_comment (Workbook *wb, Cell *cell);
void dialog_cell_sort (Workbook *wb, Sheet *sheet);
char *dialog_function_wizard (Workbook *wb, FunctionDefinition *fd);
void dialog_goal_seek (Workbook *wb, Sheet *sheet);
void dialog_solver (Workbook *wb, Sheet *sheet);
void dialog_printer_setup (Workbook *wb, Sheet *sheet);
void dialog_summary_update (Workbook *wb, SummaryInfo *sin);
void dialog_autocorrect (Workbook *wb);
void dialog_advanced_filter (Workbook *wb);
void dialog_autosave (Workbook *wb);
gint dialog_autosave_callback (gpointer *data);
void dialog_goto_cell (Workbook *wb);
void dialog_cell_format (Workbook *wb, Sheet *sheet);
int dialog_paste_special (Workbook *wb);
void dialog_insert_cells (Workbook *wb, Sheet *sheet);
void dialog_delete_cells (Workbook *wb, Sheet *sheet);
void dialog_zoom (Workbook *wb, Sheet *sheet);
char *dialog_query_load_file (Workbook *wb);
void dialog_about (Workbook *wb);
void dialog_define_names (Workbook *wb);
void dialog_cell_comment (Workbook *wb, Cell *cell);
void dialog_cell_sort (Workbook *wb, Sheet *sheet);
char *dialog_function_wizard (Workbook *wb, FunctionDefinition *fd);
void dialog_goal_seek (Workbook *wb, Sheet *sheet);
void dialog_solver (Workbook *wb, Sheet *sheet);
void dialog_printer_setup (Workbook *wb, Sheet *sheet);
void dialog_summary_update (Workbook *wb, SummaryInfo *sin);
void dialog_autocorrect (Workbook *wb);
void dialog_advanced_filter (Workbook *wb);
void dialog_autosave (Workbook *wb);
gboolean dialog_autosave_prompt (Workbook *wb);
void dialog_data_analysis (Workbook *wb, Sheet *sheet);
char *dialog_get_sheet_name (Workbook *wb, const char *name);
gboolean dialog_get_number (Workbook *wb,
......
......@@ -386,16 +386,16 @@ solver_answer_report (Workbook *wb, Sheet *sheet, GSList *ov,
int row;
dao.type = NewSheetOutput;
prepare_output (wb, &dao, "Answer Report");
set_cell (&dao, 0, 0, "Gnumeric Solver Answer Report");
prepare_output (wb, &dao, _("Answer Report"));
set_cell (&dao, 0, 0, _("Gnumeric Solver Answer Report"));
if (param->problem_type == SolverMaximize)
set_cell (&dao, 0, 1, "Target Cell (Maximize)");
set_cell (&dao, 0, 1, _("Target Cell (Maximize)"));
else
set_cell (&dao, 0, 1, "Target Cell (Minimize)");
set_cell (&dao, 0, 2, "Cell");
set_cell (&dao, 1, 2, "Name");
set_cell (&dao, 2, 2, "Original Value");
set_cell (&dao, 3, 2, "Final Value");
set_cell (&dao, 0, 1, _("Target Cell (Minimize)"));
set_cell (&dao, 0, 2, _("Cell"));
set_cell (&dao, 1, 2, _("Name"));
set_cell (&dao, 2, 2, _("Original Value"));
set_cell (&dao, 3, 2, _("Final Value"));
/* Set `Cell' field */
set_cell (&dao, 0, 3, (char*) cell_name(param->target_cell->col->pos,
......@@ -417,11 +417,11 @@ solver_answer_report (Workbook *wb, Sheet *sheet, GSList *ov,
g_free (str);
row = 4;
set_cell (&dao, 0, row++, "Adjustable Cells");
set_cell (&dao, 0, row, "Cell");
set_cell (&dao, 1, row, "Name");
set_cell (&dao, 2, row, "Original Value");
set_cell (&dao, 3, row, "Final Value");
set_cell (&dao, 0, row++, _("Adjustable Cells"));
set_cell (&dao, 0, row, _("Cell"));
set_cell (&dao, 1, row, _("Name"));
set_cell (&dao, 2, row, _("Original Value"));
set_cell (&dao, 3, row, _("Final Value"));
row++;
while (cell_list != NULL) {
......@@ -452,13 +452,13 @@ solver_answer_report (Workbook *wb, Sheet *sheet, GSList *ov,
row++;
}
set_cell (&dao, 0, row++, "Constraints");
set_cell (&dao, 0, row, "Cell");
set_cell (&dao, 1, row, "Name");
set_cell (&dao, 2, row, "Cell Value");
set_cell (&dao, 3, row, "Formula");
set_cell (&dao, 4, row, "Status");
set_cell (&dao, 5, row, "Slack");
set_cell (&dao, 0, row++, _("Constraints"));
set_cell (&dao, 0, row, _("Cell"));
set_cell (&dao, 1, row, _("Name"));
set_cell (&dao, 2, row, _("Cell Value"));
set_cell (&dao, 3, row, _("Formula"));
set_cell (&dao, 4, row, _("Status"));
set_cell (&dao, 5, row, _("Slack"));
row++;
constraints = param->constraints;
......@@ -489,9 +489,9 @@ solver_answer_report (Workbook *wb, Sheet *sheet, GSList *ov,
lhs = value_get_as_float (cell->value);
if (fabs (lhs-rhs) < 0.0001)
set_cell (&dao, 4, row, "Binding");
set_cell (&dao, 4, row, _("Binding"));
else
set_cell (&dao, 4, row, "Not Binding");
set_cell (&dao, 4, row, _("Not Binding"));
/* Set `Slack' column */
sprintf(buf, "%f", fabs (lhs-rhs));
......@@ -517,21 +517,21 @@ solver_sensitivity_report (Workbook *wb, Sheet *sheet, float_t *init_tbl,
int row=0, i;
dao.type = NewSheetOutput;
prepare_output (wb, &dao, "Sensitivity Report");
set_cell (&dao, 0, row++, "Gnumeric Solver Sensitivity Report");
set_cell (&dao, 0, row++, "Adjustable Cells");
set_cell (&dao, 2, row, "Final");
set_cell (&dao, 3, row, "Reduced");
set_cell (&dao, 4, row, "Objective");
set_cell (&dao, 5, row, "Allowable");
set_cell (&dao, 6, row++, "Allowable");
set_cell (&dao, 0, row, "Cell");
set_cell (&dao, 1, row, "Name");
set_cell (&dao, 2, row, "Value");
set_cell (&dao, 3, row, "Cost");
set_cell (&dao, 4, row, "Coefficient");
set_cell (&dao, 5, row, "Increase");
set_cell (&dao, 6, row++, "Decrease");
prepare_output (wb, &dao, _("Sensitivity Report"));
set_cell (&dao, 0, row++, _("Gnumeric Solver Sensitivity Report"));
set_cell (&dao, 0, row++, _("Adjustable Cells"));
set_cell (&dao, 2, row, _("Final"));
set_cell (&dao, 3, row, _("Reduced"));
set_cell (&dao, 4, row, _("Objective"));
set_cell (&dao, 5, row, _("Allowable"));
set_cell (&dao, 6, row++, _("Allowable"));
set_cell (&dao, 0, row, _("Cell"));
set_cell (&dao, 1, row, _("Name"));
set_cell (&dao, 2, row, _("Value"));
set_cell (&dao, 3, row, _("Cost"));
set_cell (&dao, 4, row, _("Coefficient"));
set_cell (&dao, 5, row, _("Increase"));
set_cell (&dao, 6, row++, _("Decrease"));
i = 2;
while (cell_list != NULL) {
......@@ -566,19 +566,19 @@ solver_sensitivity_report (Workbook *wb, Sheet *sheet, float_t *init_tbl,
i++;
}
set_cell (&dao, 0, row++, "Constraints");
set_cell (&dao, 2, row, "Final");
set_cell (&dao, 3, row, "Shadow");
set_cell (&dao, 4, row, "Constraint");
set_cell (&dao, 5, row, "Allowable");
set_cell (&dao, 6, row++, "Allowable");
set_cell (&dao, 0, row, "Cell");
set_cell (&dao, 1, row, "Name");
set_cell (&dao, 2, row, "Value");
set_cell (&dao, 3, row, "Price");
set_cell (&dao, 4, row, "R.H. Side");
set_cell (&dao, 5, row, "Increase");
set_cell (&dao, 6, row++, "Decrease");
set_cell (&dao, 0, row++, _("Constraints"));
set_cell (&dao, 2, row, _("Final"));
set_cell (&dao, 3, row, _("Shadow"));
set_cell (&dao, 4, row, _("Constraint"));
set_cell (&dao, 5, row, _("Allowable"));
set_cell (&dao, 6, row++, _("Allowable"));
set_cell (&dao, 0, row, _("Cell"));
set_cell (&dao, 1, row, _("Name"));
set_cell (&dao, 2, row, _("Value"));
set_cell (&dao, 3, row, _("Price"));
set_cell (&dao, 4, row, _("R.H. Side"));
set_cell (&dao, 5, row, _("Increase"));
set_cell (&dao, 6, row++, _("Decrease"));
constraints = param->constraints;
while (constraints != NULL) {
......
......@@ -177,11 +177,14 @@ void workbook_recalc_all (Workbook *wb);
typedef gboolean (*WorkbookCallback)(Workbook *, gpointer data);
void workbook_foreach (WorkbookCallback cback,
gpointer data);
void workbook_foreach (WorkbookCallback cback,
gpointer data);
CommandContext *workbook_command_context_gui (Workbook *wb);
void workbook_autosave_cancel (Workbook *wb);
void workbook_autosave_set (Workbook *wb, int minutes, gboolean prompt);
/*
* Feedback routines
*/
......
......@@ -259,7 +259,7 @@ workbook_do_destroy (Workbook *wb)
GTK_OBJECT (wb->toplevel),
GTK_SIGNAL_FUNC (workbook_set_focus), wb);
gtk_timeout_remove (wb->autosave_timer);
workbook_autosave_cancel (wb);
/*
* Do all deletions that leave the workbook in a working
......@@ -2277,14 +2277,9 @@ workbook_new (void)
wb = gtk_type_new (workbook_get_type ());
wb->toplevel = gnome_app_new ("Gnumeric", "Gnumeric");
wb->priv->table = gtk_table_new (0, 0, 0);
wb->autosave = FALSE;
wb->autosave_prompt = TRUE;
wb->autosave_minutes = 15;
wb->autosave_timer =
gtk_timeout_add (wb->autosave_minutes*60000,
(GtkFunction) dialog_autosave_callback, wb);
workbook_autosave_set (wb, TRUE, 15);
wb->show_horizontal_scrollbar = TRUE;
wb->show_vertical_scrollbar = TRUE;
wb->show_notebook_tabs = TRUE;
......@@ -3079,3 +3074,51 @@ workbook_command_context_gui (Workbook *wb)
return wb->priv->gui_context;
}
/*
* Autosave
*/
static gint
dialog_autosave_callback (gpointer *data)
{
Workbook *wb = (Workbook *) data;
if (wb->autosave && workbook_is_dirty (wb)) {
if (wb->autosave_prompt) {
if (!dialog_autosave_prompt (wb))
return 1;
}
workbook_save (workbook_command_context_gui (wb), wb);
}
return 1;
}
void
workbook_autosave_cancel (Workbook *wb)
{
if (wb->autosave_timer != -1)
gtk_timeout_remove (wb->autosave_timer);
wb->autosave_timer = -1;
}
void
workbook_autosave_set (Workbook *wb, int minutes, gboolean prompt)
{
if (wb->autosave_timer != -1){
gtk_timeout_remove (wb->autosave_timer);
wb->autosave_timer = -1;
}
wb->autosave_minutes = minutes;
wb->autosave_prompt = prompt;
if (minutes == 0)
wb->autosave = FALSE;
else {
wb->autosave = TRUE;
wb->autosave_timer =
gtk_timeout_add (minutes * 60000,
(GtkFunction) dialog_autosave_callback, wb);
}
}
......@@ -177,11 +177,14 @@ void workbook_recalc_all (Workbook *wb);
typedef gboolean (*WorkbookCallback)(Workbook *, gpointer data);
void workbook_foreach (WorkbookCallback cback,
gpointer data);
void workbook_foreach (WorkbookCallback cback,
gpointer data);
CommandContext *workbook_command_context_gui (Workbook *wb);
void workbook_autosave_cancel (Workbook *wb);
void workbook_autosave_set (Workbook *wb, int minutes, gboolean prompt);
/*
* Feedback routines
*/
......
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