gnome-calculator / missing menu
After the upgrade of my desktop to Ubuntu Raring (13.04) my
gnome-calculator
’s menu bar had become unreachable.
I don’t need the menu, except that it went into default BASIC mode. And I need the PROGRAMMING mode.
The configuration seemed to be okay (accessible through gconf-editor
):
$ gconftool /apps/gcalctool --dump | grep -B1 -A4 mode
<entry>
<key>mode</key>
<value>
<string>PROGRAMMING</string>
</value>
</entry>
<entry>
<key>modetype</key>
<value>
<string>PROGRAMMING</string>
</value>
</entry>
But that was apparently the old config. The new config is in dconf
(accessible through dconf-editor
):
$ dconf dump /org/gnome/calculator/ | grep mode
button-mode='basic'
Switch that to 'programming'
and voilà. Programming mode is back.
What about fixing the problem?
Hacking around in the gnome-calculator
source got me lost between
gio GObject
s and gtk GtkWindow
s.
The following tweak made the menu appear, but now the menu items were drawn as separate menus on the menu bar.
diff -pru gnome-calculator-3.8.1/src/gnome-calculator.c gnome-calculator-3.8.1.hacked/src/gnome-calculator.c
--- gnome-calculator-3.8.1/src/gnome-calculator.c 2013-04-02 15:25:49.000000000 +0200
+++ gnome-calculator-3.8.1.hacked/src/gnome-calculator.c 2013-09-25 09:12:14.863018583 +0200
@@ -599,6 +599,7 @@ static void calculator_real_startup (GAp
_tmp54_ = section;
g_menu_append_section (menu, NULL, (GMenuModel*) _tmp54_);
gtk_application_set_app_menu ((GtkApplication*) self, (GMenuModel*) menu);
+ gtk_application_set_menubar ((GtkApplication*) self, (GMenuModel*) menu);
gtk_application_add_accelerator ((GtkApplication*) self, "<control>Q", "app.quit", NULL);
gtk_application_add_accelerator ((GtkApplication*) self, "F1", "app.help", NULL);
gtk_application_add_accelerator ((GtkApplication*) self, "<control>C", "app.copy", NULL);
Getting better results than that is taking too much time. There must be a better way.
The cause of the problem?
So, it turned out that I didn’t have Global menu support. I was aware of that — my upgrade from 12.04 apparently didn’t work flawlessly — but I wasn’t aware that that is unsupported.
Mr. Jojo Yee’s Tips and Tricks for Ubuntu after Installation [Ubuntu 12.04 to 13.04] finally revealed the fix. See the image to the right which shows the difference between having and not having the “Global menu”.
The global menu could be restored like this:
$ sudo apt-get install indicator-appmenu
...
The following NEW packages will be installed:
appmenu-gtk appmenu-gtk3 appmenu-qt appmenu-qt5 indicator-appmenu libdbusmenu-qt5
And, there is a project going on that should make it easier for people
to switch between the global menu and not. See:
Ubuntu’s new Enhanced Menu
project
Improve Unity Global
Menu
“This [feature enhancement] isn’t fixed in 13.04 yet.”
Finally I had enough information to file a decent bug report.