Commit cf0f8da6 authored by Morten Welinder's avatar Morten Welinder Committed by Morten Welinder

Plug leak. (entry_to_float_with_format): Plug leak.

2004-09-24  Morten Welinder  <terra@gnome.org>

	* src/gui-util.c (entry_to_int): Plug leak.
	(entry_to_float_with_format): Plug leak.

2004-09-24  Morten Welinder  <terra@gnome.org>

	* dialog-autosave.c (autosave_set_sensitivity): Fix type
	confusion.  entry_to_int returns a gboolean.
	(cb_autosave_ok): Ditto.
parent c2e770b0
2004-09-24 Morten Welinder <terra@gnome.org>
* src/gui-util.c (entry_to_int): Plug leak.
(entry_to_float_with_format): Plug leak.
2004-09-23 Morten Welinder <terra@gnome.org>
* src/gui-util.c (cb_activate_default): New function to avoid
......
......@@ -42,6 +42,7 @@ Morten:
* Fix crash when adding a xy plot over a pie plot
* Work on using pango layouts for printing.
* Fix endless recursion. [#153544.]
* Plug leaks.
Uwe Steinmann:
* Validate the field names for paradox databases
......
2004-09-24 Morten Welinder <terra@gnome.org>
* src/gui-util.c (entry_to_int): Plug leak.
(entry_to_float_with_format): Plug leak.
2004-09-23 Morten Welinder <terra@gnome.org>
* src/gui-util.c (cb_activate_default): New function to avoid
......
2004-09-24 Morten Welinder <terra@gnome.org>
* dialog-autosave.c (autosave_set_sensitivity): Fix type
confusion. entry_to_int returns a gboolean.
(cb_autosave_ok): Ditto.
2004-09-08 Jody Goldberg <jody@gnome.org>
* Release 1.3.90
......
......@@ -54,14 +54,13 @@ autosave_set_sensitivity (G_GNUC_UNUSED GtkWidget *widget,
{
gboolean active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (state->autosave_on_off));
gint minutes;
gint minutes_valid = entry_to_int (GTK_ENTRY (state->minutes_entry), &minutes, FALSE);
gboolean minutes_err = entry_to_int (GTK_ENTRY (state->minutes_entry), &minutes, FALSE);
gtk_widget_set_sensitive (state->minutes_entry, active);
gtk_widget_set_sensitive (state->prompt_cb, active);
gtk_widget_set_sensitive (state->ok_button, !active ||
((minutes_valid == 0) && (minutes > 0)));
gtk_widget_set_sensitive (state->ok_button,
!active || (!minutes_err && minutes > 0));
}
gboolean
......@@ -135,19 +134,19 @@ cb_autosave_cancel (G_GNUC_UNUSED GtkWidget *button,
static void
cb_autosave_ok (G_GNUC_UNUSED GtkWidget *button, autosave_t *state)
{
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (state->autosave_on_off))) {
int minutes;
int minutes_valid = entry_to_int (GTK_ENTRY (state->minutes_entry),
&minutes, TRUE);
g_return_if_fail (minutes_valid == 0); /* Why is ok active? */
wbcg_autosave_set (state->wbcg, minutes,
gtk_toggle_button_get_active (
GTK_TOGGLE_BUTTON (state->prompt_cb)));
} else
wbcg_autosave_set (state->wbcg, 0, FALSE);
gtk_widget_destroy (state->dialog);
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (state->autosave_on_off))) {
int minutes;
gboolean minutes_err = entry_to_int (GTK_ENTRY (state->minutes_entry),
&minutes, TRUE);
g_return_if_fail (!minutes_err); /* Why is ok active? */
wbcg_autosave_set (state->wbcg, minutes,
gtk_toggle_button_get_active (
GTK_TOGGLE_BUTTON (state->prompt_cb)));
} else
wbcg_autosave_set (state->wbcg, 0, FALSE);
gtk_widget_destroy (state->dialog);
}
void
......@@ -222,4 +221,3 @@ dialog_autosave (WorkbookControlGUI *wbcg)
gtk_widget_show (state->dialog);
}
......@@ -886,10 +886,15 @@ entry_to_float_with_format (GtkEntry *entry, gnm_float *the_float, gboolean upda
{
GnmValue *value = format_match_number (gtk_entry_get_text (entry), format, NULL);
if ((value == NULL) || !VALUE_IS_NUMBER (value)) {
*the_float = 0.0;
*the_float = 0.0;
if (!value)
return TRUE;
if (!VALUE_IS_NUMBER (value)) {
value_release (value);
return TRUE;
}
*the_float = value_get_as_float (value);
if (update) {
char *tmp = format_value (format, value, NULL, 16, NULL);
......@@ -915,10 +920,15 @@ entry_to_int (GtkEntry *entry, gint *the_int, gboolean update)
{
GnmValue *value = format_match_number (gtk_entry_get_text (entry), NULL, NULL);
if ((value == NULL) || !(value->type == VALUE_INTEGER)) {
*the_int = 0;
*the_int = 0;
if (!value)
return TRUE;
if (value->type != VALUE_INTEGER) {
value_release (value);
return TRUE;
}
*the_int = value_get_as_int (value);
if (update) {
char *tmp = format_value (NULL, value, NULL, 16, NULL);
......@@ -939,14 +949,13 @@ entry_to_int (GtkEntry *entry, gint *the_int, gboolean update)
void
float_to_entry (GtkEntry *entry, gnm_float the_float)
{
GnmValue *val = value_new_float (the_float);
char *text = format_value (NULL, val, NULL, 16, NULL);
GnmValue *val = value_new_float (the_float);
char *text = format_value (NULL, val, NULL, 16, NULL);
value_release(val);
if (text != NULL) {
gtk_entry_set_text (entry, text);
g_free (text);
}
if (val != NULL)
value_release(val);
}
/**
......@@ -960,13 +969,12 @@ void
int_to_entry (GtkEntry *entry, gint the_int)
{
GnmValue *val = value_new_int (the_int);
char *text = format_value (NULL, val, NULL, 16, NULL);
char *text = format_value (NULL, val, NULL, 16, NULL);
value_release(val);
if (text != NULL) {
gtk_entry_set_text (entry, text);
g_free (text);
}
if (val != NULL)
value_release(val);
}
char *
......
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