After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 143924 - 'Show trailing zeroes' option cannot be selected
'Show trailing zeroes' option cannot be selected
Status: RESOLVED FIXED
Product: gnome-calculator
Classification: Core
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: Rich Burridge
Rich Burridge
Depends on:
Blocks:
 
 
Reported: 2004-06-08 04:10 UTC by Raj
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Fix for the second part of the problem. (949 bytes, text/plain)
2004-06-11 17:48 UTC, Rich Burridge
Details

Description Raj 2004-06-08 04:10:12 UTC
1. Launch Programs->Accessories->Calculator
2. Click on View->Basic Mode.
3. Click on View.


Actual Results:
The option 'Show Trailing Zeroes' cannot be selected using the mouse.
Using the keyboard, typing CTRL+T enables this option.

Expected Results:
The option 'Show Trailing Zeroes' should be enabled for selecting
using a mouse.

How often does this happen? 
Always

Additional Information:
This problem is seen only in Basic/Financial mode.

I have found that the option can be re-enabled as follows:
- Do a calculation which results in an error ( e.g: divide by zero )
- Click on 'Clr' to re-enable the option. Now it can be selected/deselected
  using a mouse.

Once re-enabled, switching to Scientific mode and back to Basic,  would
again disable this option.
Comment 1 Rich Burridge 2004-06-08 15:32:16 UTC
Bug #108226 is the bug where the inclusion of the
"Show Trailing Zeroes" menu item was added. The
assumption was the this should only be available
to "power users".

In hindsight, I think this option should always
be active (default: not ticked) in all three modes
(Basic, Financial and Scientific) and it should be
up to the user to decide whether they want it.

I've cc:'ed my HCI guy on this, to get his input.
Comment 2 Calum Benson 2004-06-08 15:42:55 UTC
I guess the question to answer here is what's the use case for enabling trailing
zeroes in basic (or financial) mode, given that there's no way to set the
accuracy in those modes anyway.  The reporter doesn't say why they wanted to do it.

Either way, the fact that Ctrl-T currently works when its menu item is disabled
is certainly a bug, though-- disabling a menu item should disable its keyboard
shortcut, too.
Comment 3 Rich Burridge 2004-06-09 16:52:36 UTC
Here's what I plan to do. We made the decision that you
shouldn't be able to set trailing zeroes in Basic or
Financial modes, so I need to fix the following two 
problems:

1/ Control-T shouldn't work in Basic or Financial modes.
2/ Generating an "Error", then clicking on Clr shouldn't
   active the "Show Trailing Zeroes" menu item if you are
   in Basic or Financial modes.
Comment 4 Calum Benson 2004-06-10 16:26:33 UTC
Sounds reasonable to me.
Comment 5 Rich Burridge 2004-06-11 17:48:38 UTC
Created attachment 28607 [details]
Fix for the second part of the problem.

I've attached a fix for the second part of the problem.
The first part of the problem (the fact that Control-t
works even though the menu item is grayed out), would
appear to be a problem with the gtk_ui_manager.
Comment 6 Rich Burridge 2004-06-11 18:04:59 UTC
I've checked in the fix for the second part to CVS HEAD
(bumping the version number to 4.4.12 in configure.in).

I've added Matthias to the cc: for this bug, for his comments
on whether the fact that Control-t works (as the keyboard 
accelerator for the inactive menu item) is a gtk_ui_manager()
or a gtk_action bug.
Comment 7 Rich Burridge 2004-06-14 16:36:03 UTC
I'm transferring this bug to gtk+/uimanager. I believe it's a bug in
the gtk_ui_manager or gtk_action. Matthias, here's a simple way for
you to test it. I made the following change to:

.../gtk+-2.4.1/demos/gtk-demo/ui_manager.c

--- ui_manager.c.orig	2004-06-14 09:23:45.754734000 -0700
+++ ui_manager.c	2004-06-14 09:26:14.364525000 -0700
@@ -195,6 +195,9 @@ do_ui_manager (GtkWidget *do_widget)
 	  g_error_free (error);
 	}
 
+      gtk_widget_set_sensitive(gtk_ui_manager_get_widget(ui, 
+                                 "/MenuBar/FileMenu/Quit"), FALSE);
+
       box1 = gtk_vbox_new (FALSE, 0);
       gtk_container_add (GTK_CONTAINER (window), box1);
       

Now if you startup gtk-demo, select the uimanager demo, you'll see
that the Quit menu entry in the File menu in the menubar is inactive.
Yes, typing "Control-q" still activates it.
Comment 8 Matthias Clasen 2004-06-14 16:44:34 UTC
Widgets obtained by gtk_ui_manager_get_widget() are proxies for actions and
derive their visibility and sensitivity from that of their action. You shouldn't
directly modify the visibility or sensitivity of a proxy. Use 
g_object_set (action, "sensitive", FALSE, NULL) instead
Comment 9 Rich Burridge 2004-06-14 16:48:43 UTC
Hmmm. I can (and will) do that - thanks, but surely if
it lets me do the change visually using gtk_widget_set_sensitive()
then shouldn't it also do the [in]sensitivity of the action,
especially as the "old" way of doing this (with GtkItemFactory)
worked that way?
Comment 10 Rich Burridge 2004-06-14 16:57:17 UTC
Okay, I just tried (I think) what you suggested. I made the
following change to the uimanager gtk-demo example:

--- ui_manager.c.orig	2004-06-14 09:23:45.754734000 -0700
+++ ui_manager.c	2004-06-14 09:56:05.747405000 -0700
@@ -195,6 +195,9 @@ do_ui_manager (GtkWidget *do_widget)
 	  g_error_free (error);
 	}
 
+      g_object_set(gtk_ui_manager_get_widget(ui, 
+                                 "/MenuBar/FileMenu/Quit"), FALSE, NULL);
+
       box1 = gtk_vbox_new (FALSE, 0);
       gtk_container_add (GTK_CONTAINER (window), box1);
       

I still see exactly the same behaviour. The menu item is inactive, but
Control-Q is still seen and actioned.

What am I doing wrong?
Comment 11 Matthias Clasen 2004-06-14 17:06:28 UTC
You have to set the property on the action, not on the widget
Comment 12 Rich Burridge 2004-06-14 17:22:24 UTC
Got it. Thanks, it's working fine. I'll take the bug back.
Comment 13 Rich Burridge 2004-06-14 17:58:22 UTC
Changes checked into CVS HEAD. Version number in configure.in
bumped to 4.4.13. Matthias, thanks for your help.