Cinnamon 1.5.8 menu issue.

Custom (tree) cinnamon-applications.menu is not parsed correctly under cinnamon 1.5.8. Several menus and most menu entries are missing. The same menu works well under Gnome fallback (there is no syntax error in the menu).

Here’s the warning:


 JS ERROR: !!!   WARNING: 'assignment to undeclared variable subdir'
 JS ERROR: !!!   WARNING: file '/usr/share/cinnamon/applets/menu@cinnamon.org/applet.js' line 1298 exception 0 number 156

As a temporary workaround, using menu@cinnamon.org/applet.js from version 1.4.0 (copying this file to /usr/share/cinnamon/applets/menu@cinnamon.org/) would solve the menu issue (all menus and entries are displayed correctly) but produces this warning over and over:


(cinnamon:2899): Clutter-WARNING **: Attempting to add actor of type 'CinnamonGenericContainer' to a container of type 'StBoxLayout', but the actor has already a parent of type 'StBoxLayout'.

(cinnamon:2899): Clutter-WARNING **: Attempting to add actor of type 'StScrollView' to a container of type 'StBoxLayout', but the actor has already a parent of type 'StBoxLayout'.


I submitted a bug report: https://bugzilla.novell.com/show_bug.cgi?id=781074

This is not fixed in 1.6.0. Same problem, same workaround.

I got it fixed. Here’s a patch in /usr/share/cinnamon against version 1.6.1 (will submit it):

--- applets/menu@cinnamon.org/applet.js.1.6.1   2012-09-28 17:50:40.048812007 -0700
+++ applets/menu@cinnamon.org/applet.js 2012-10-06 13:51:20.188587373 -0700
@@ -1284,8 +1284,8 @@
                         applicationButton.actor.connect('leave-event', Lang.bind(this, this._appLeaveEvent, applicationButton));
                         this._addEnterEvent(applicationButton, Lang.bind(this, this._appEnterEvent, applicationButton));
                         this._applicationsButtons.push(applicationButton);
-                        applicationButton.category.push(dir.get_menu_id());
-                        this.applicationsByCategory[dir.get_menu_id()].push(app.get_name());
+                        applicationButton.category.push(top_dir.get_menu_id());
+                        this.applicationsByCategory[top_dir.get_menu_id()].push(app.get_name());
                     } else {
                         for (let i = 0; i < this._applicationsButtons.length; i++) {
                             if (this._applicationsButtons*.app == app) {

The only problem is that some entries (mostly YaST modules) are duplicated:

http://imageshack.us/a/img138/9753/cinnamonmenu.png

Also the Adminstration menu shows up twice - once from my menu, a second time maybe imported from somewhere by default (?) - but I had this already with previous versions.*

Got another undeclared variable (I thought it was fixed though).


JS ERROR: !!!   WARNING: 'assignment to undeclared variable subdir'
JS ERROR: !!!   WARNING: file '/usr/share/cinnamon/applets/menu@cinnamon.org/applet.js' line 1299 exception 0 number 156

Just in case it’s not just me being confused, here’s a better patch:

--- applets/menu@cinnamon.org/applet.js.1.6.1   2012-09-28 17:50:40.048812007 -0700
+++ applets/menu@cinnamon.org/applet.js 2012-10-06 15:43:42.446100568 -0700
@@ -1284,8 +1284,8 @@
                         applicationButton.actor.connect('leave-event', Lang.bind(this, this._appLeaveEvent, applicationButton));
                         this._addEnterEvent(applicationButton, Lang.bind(this, this._appEnterEvent, applicationButton));
                         this._applicationsButtons.push(applicationButton);
-                        applicationButton.category.push(dir.get_menu_id());
-                        this.applicationsByCategory[dir.get_menu_id()].push(app.get_name());
+                        applicationButton.category.push(top_dir.get_menu_id());
+                        this.applicationsByCategory[top_dir.get_menu_id()].push(app.get_name());
                     } else {
                         for (let i = 0; i < this._applicationsButtons.length; i++) {
                             if (this._applicationsButtons*.app == app) {
@@ -1296,7 +1296,7 @@
                     }
                 }
             } else if (nextType == GMenu.TreeItemType.DIRECTORY) {
-                subdir = iter.get_directory();
+                let subdir = iter.get_directory();
                 this.applicationsByCategory[subdir.get_menu_id()] = new Array();
                 this._loadCategory(subdir, top_dir);
             }