gcalctool r2461 - in trunk: . gcalctool
- From: rancell svn gnome org
- To: svn-commits-list gnome org
- Subject: gcalctool r2461 - in trunk: . gcalctool
- Date: Mon, 30 Mar 2009 05:59:54 +0000 (UTC)
Author: rancell
Date: Mon Mar 30 05:59:54 2009
New Revision: 2461
URL: http://svn.gnome.org/viewvc/gcalctool?rev=2461&view=rev
Log:
Fix display on startup to be replaced on entry (Robert Ancell, Bug #575385)
Modified:
trunk/ChangeLog
trunk/gcalctool/functions.c
Modified: trunk/gcalctool/functions.c
==============================================================================
--- trunk/gcalctool/functions.c (original)
+++ trunk/gcalctool/functions.c Mon Mar 30 05:59:54 2009
@@ -205,21 +205,23 @@
{
int ret, MP[MP_SIZE];
- ret = display_is_usable_number(&v->display, MP);
-
- if (ret) {
- ui_set_statusbar(_("No sane value to convert"),
- "gtk-dialog-error");
- } else {
- mp_set_from_mp(MP, display_get_answer(&v->display));
- display_set_string(&v->display, "Ans", -1);
+ if (!display_is_empty(&v->display))
+ {
+ ret = display_is_usable_number(&v->display, MP);
+ if (ret) {
+ ui_set_statusbar(_("No sane value to convert"),
+ "gtk-dialog-error");
+ } else {
+ mp_set_from_mp(MP, display_get_answer(&v->display));
+ display_set_string(&v->display, "Ans", -1);
+ clear_undo_history();
+ }
}
v->base = b;
set_enumerated_resource(R_BASE, Rbstr, (int) v->base);
display_set_base(&v->display, basevals[v->base]);
ui_set_base(v->base);
ui_make_registers();
- clear_undo_history();
}
@@ -248,15 +250,19 @@
{
int ret, MP[MP_SIZE];
- ret = display_is_usable_number(&v->display, MP);
- if (ret) {
- ui_set_statusbar(_("No sane value to convert"),
- "gtk-dialog-error");
- } else {
- mp_set_from_mp(MP, display_get_answer(&v->display));
- display_set_string(&v->display, "Ans", -1);
+ /* Convert display if it contains a number */
+ if (!display_is_empty(&v->display))
+ {
+ ret = display_is_usable_number(&v->display, MP);
+ if (ret) {
+ ui_set_statusbar(_("No sane value to convert"),
+ "gtk-dialog-error");
+ } else {
+ mp_set_from_mp(MP, display_get_answer(&v->display));
+ display_set_string(&v->display, "Ans", -1);
+ clear_undo_history();
+ }
}
- clear_undo_history();
display_set_format(&v->display, n);
ui_make_registers();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]