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 104248 - "View->Registers" checkmark gets out of sync
"View->Registers" checkmark gets out of sync
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: 2003-01-23 17:26 UTC by Calum Benson
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
A proposed patch. (3.14 KB, patch)
2003-01-28 02:20 UTC, Dennis Cranston
none Details | Review

Description Calum Benson 2003-01-23 17:26:22 UTC
It looks like the checkmark beside "View->Memory Registers" only toggles
when you actually select the menu item.  Consequently, if you close the
memory registers window by clicking its close button rather than selecting
the menu item again, the checkmark doesn't disappear.
Comment 1 Dennis Cranston 2003-01-28 02:20:19 UTC
Created attachment 13869 [details] [review]
A proposed patch.
Comment 2 Dennis Cranston 2003-01-28 02:26:12 UTC
This patch should fix the following:

1.  The toggling of the 'Memory Register' menu when the window is
closed by the window manager. (bug #10428)
2.  The incorrectly selected (Basic/Financial/Scientific) Mode after a
restarting.
3.  The focus and transient properties of the 'Insert ASCII Value' dialog.
Comment 3 Rich Burridge 2003-01-28 02:53:55 UTC
Thanks Dennis! I think I can take it from here. 
There are a couple other minor adjustments that 
will be needed. I'll work on integrating it 
tomorrow morning.

gcalctool will remember the state of the memory register window
(visible/hidden) when the application is terminated. So if the
user does dismiss the memory register popup, that state change
needs to be reflected with a call to:

 put_resource(R_REGS, set_bool(v->rstate == TRUE));

after v->rstate is set to zero in dismiss_rframe() in gtk.c

In a similar fashion, create_rframe() will need to be adjusted
to set/clear the toggle on the View->Memory Registers menu item
depending upon the v->rstate setting.

It might be worth putting the first three lines of the new code
in the patch for dismiss_rframe() in a separate routine, that can
be called from create_rframe() or dismiss_rframe() depending upon 
the current setting of v->rstate. Something like:

static void
set_memory_toggle(int state)
{
    GtkWidget *register_widget;

    register_widget = gtk_item_factory_get_widget(X->mb_fact,
MEM_REG_TOGGLE_MENU);  
   
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(register_widget),
state);
}


static gboolean
 dismiss_rframe(GtkWidget *widget, GdkEvent *event, gpointer user_data)
 {
    v->rstate = 0;
    set_memory_toggle(FALSE);
    put_resource(R_REGS, set_bool(v->rstate == TRUE));
...

and so on. You get the idea. I'll look at in more detail tomorrow.
Comment 4 Rich Burridge 2003-01-28 16:25:10 UTC
Fixed (as described above) in v4.2.42.
Comment 5 Dennis Cranston 2003-01-28 17:04:54 UTC
Hi Rich,

I updated gcalctool to v4.2.42.  I am seeing a new bug with the
modified patch.  

Steps to reproduce the problem:  

1.  Launch gcalctool with the View/Memory Registers menu item unchecked .
2.  Select the menu item View/Memory Registers.  The Memory Registers
window is displayed.   The View/Memory Registers is checked.
3.  Click the close button of the window manager on the Memory
Registers window.   The Memory Registers window is hidden.  The
View/Memory Registers is unchecked.
4.  Select the menu item View/Memory Registers again.   The Memory
Registers window is ___not___ displayed, but the View/Memory Registers
menu item is checked.

Expected results:
In step 4, the Memory Registers window should be displayed.
Comment 6 Rich Burridge 2003-01-28 22:55:05 UTC
Ugh. You're right. The problem here was that the callback
handler for the menu items (mb_proc in gtk.c) needed to have 
a check at the top to see if we'd started the application yet, 
and if it hadn't, then to just return. Seemed it was getting 
called as gcalctool was initially coming up, which was toggling 
the state of the v->rstate variable incorrectly.

Hopefully (really) fixed now in v4.2.43.

Thanks for tracking this.