gcampax / gnome-shell-extensions

A collection of extensions for GNOME Shell (forked from previous repo on git.gnome.org)
GNU General Public License v2.0
19 stars 10 forks source link

places-menu: use columned layout is better than a long popup menu #5

Open fermat618 opened 10 years ago

fermat618 commented 10 years ago

I have several bookmarks, and several devices. Now the one column menu have two shortcomings.

Firstly, it takes a long movement to open a bookmark, because the menu can becomes two long to the bottom of the screen.

Secondly, not all the bookmarks will be displayed, since there not enough space.

I have tried to do some modification

--- a/extension.js
+++ b/extension.js
@@ -82,7 +82,7 @@ const PlacesMenu = new Lang.Class({
         this.placesManager = new PlaceDisplay.PlacesManager();

         this._sections = { };
-
+        this._menuBox = new St.BoxLayout({vertical: false});
         for (let i=0; i < SECTIONS.length; i++) {
             let id = SECTIONS[i];
             this._sections[id] = new PopupMenu.PopupMenuSection();
@@ -91,9 +91,11 @@ const PlacesMenu = new Lang.Class({
             }));

             this._create(id);
-            this.menu.addMenuItem(this._sections[id]);
-            this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());
+            this._menuBox.add_actor(this._sections[id].actor);
         }
+        let section = new PopupMenu.PopupMenuSection();
+        section.actor.add_actor(this._menuBox);
+        this.menu.addMenuItem(section);
     },

     destroy: function() {

The layout is OK, but the popup window doesn't disappear when some item is clicked.

gcampax commented 10 years ago

Hi, thank you for your patch.

Because places-menu is an official part of GNOME Classic, I'd like if you gladly posted it at bugzilla.gnome.org, under the gnome-shell product, extensions component.

Thanks again

Giovanni

2014-05-18 16:38 GMT+02:00 fermat618 notifications@github.com:

I have several bookmarks, and several devices. Now the one column menu have two shortcomings.

Firstly, it takes a long movement to open a bookmark, because the menu can becomes two long to the bottom of the screen.

Secondly, not all the bookmarks will be displayed, since there not enough space.

I have tried to do some modification

--- a/extension.js+++ b/extension.js@@ -82,7 +82,7 @@ const PlacesMenu = new Lang.Class({ this.placesManager = new PlaceDisplay.PlacesManager();

     this._sections = { };-+        this._menuBox = new St.BoxLayout({vertical: false});
     for (let i=0; i < SECTIONS.length; i++) {
         let id = SECTIONS[i];
         this._sections[id] = new PopupMenu.PopupMenuSection();@@ -91,9 +91,11 @@ const PlacesMenu = new Lang.Class({
         }));

         this._create(id);-            this.menu.addMenuItem(this._sections[id]);-            this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());+            this._menuBox.add_actor(this._sections[id].actor);
     }+        let section = new PopupMenu.PopupMenuSection();+        section.actor.add_actor(this._menuBox);+        this.menu.addMenuItem(section);
 },

 destroy: function() {

The layout is OK, but the popup window doesn't disappear when some item is clicked.

— Reply to this email directly or view it on GitHubhttps://github.com/gcampax/gnome-shell-extensions/issues/5 .

fermat618 commented 10 years ago

Yes, thanks.