GNOME Bugzilla – Bug 104248
"View->Registers" checkmark gets out of sync
Last modified: 2004-12-22 21:47:04 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.
Created attachment 13869 [details] [review] A proposed patch.
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.
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.
Fixed (as described above) in v4.2.42.
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.
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.