GNOME Bugzilla – Bug 648724
A gnome shell extension to display places as a status indicator
Last modified: 2011-05-04 14:13:28 UTC
Created attachment 186707 [details] [review] git patch against gnome-shell-extensions A simple extension that adds a 'Folder' icon to the status indicators list. Clicking the icon, will open a popup menu which displays default places, bookmarks and static mount points. Further clicking on one of them opens the location in File manager.
I would love to have this as a tab inside the Overview, and maybe including removable devices for easy unmount.
Created attachment 186807 [details] [review] places menu patch against gnome-shell-extensions I have updated the patch as per suggestions by fpmurphy on fedora forums http://www.fedoraforum.org/forum/showpost.php?p=1465906&postcount=343
Review of attachment 186807 [details] [review]: ::: extensions/places-menu/extension.js @@ +31,3 @@ + this.defaultPlaces = Main.placesManager.getDefaultPlaces(); + this.bookmarks = Main.placesManager.getBookmarks(); + this.mounts = Main.placesManager.getMounts(); Shouldn't you connect to signals emitted by Main.placesManager? @@ +34,3 @@ + + // Display default places + for ( placeid = 0; placeid < this.defaultPlaces.length; placeid++) { No space after open parenthesis. @@ +39,3 @@ + this.menu.addMenuItem(this.placeItems[placeid]); + this.placeItems[placeid].connect('activate', function(actor,event) { + global.log("location called: " + actor.place.name); Please remove debug logs. (And if you really need it, use log, not global.log. Nobody checks the LookingGlass) @@ +58,3 @@ + } + + this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem()); You must ensure that the separator is hidden if there are no bookmarks or no mounts. @@ +72,3 @@ + + Main.panel._centerBox.add(this.actor, { y_fill: true }); + Main.panel._menus.addMenu(this.menu); This is not the way you do it. Instead, you add your class to Panel.STANDARD_TRAY_ICON_ORDER and Panel.STANDARD_TRAY_ICON_SHELL_IMPLEMENTATION. Anything else will break keyboard navigation. Also, it must be a PanelMenu.SystemStatusButton, not a PanelMenu.Button. @@ +75,3 @@ + }, + + _onDestroy: function() {} This is for? @@ +81,3 @@ +function main(extensionMeta) { + + let userExtensionLocalePath = extensionMeta.path + '/locale'; Use extensionMeta.localedir @@ +83,3 @@ + let userExtensionLocalePath = extensionMeta.path + '/locale'; + Gettext.bindtextdomain("places_button", userExtensionLocalePath); + Gettext.textdomain("places_button"); Ugh! You want to break all the translations everywhere? You cannot set the textdomain, it's not your application. Use a bound gettext by putting at the beginning const Gettext = imports.gettext.domain('gnome-shell-extensions') const _ = Gettext.gettext and inside main() imports.gettext.bindtextdomain('gnome-shell-extensions', extensionMeta.localedir). Also, the domain is gnome-shell-extensions, as written in configure.ac. Nothing else is supported. (in case of any doubts, see example or xrandr-indicator)
Thanks for the feedback. I have a much improved version now, but it still needs corrections from the comments above. I will resubmit the patch.
Created attachment 187143 [details] [review] places menu patch against gnome-shell-extensions: updated Made corrections to the earlier patch.
Created attachment 187144 [details] screenshot of updated extension Screenshot of the extension, just for a quick reference.
Review of attachment 187143 [details] [review]: Awesome! Ready to commit to master with one small fix. Thanks a lot for your work! ::: configure.ac @@ +44,3 @@ ADDITIONAL_PACKAGES="$ADDITIONAL_PAGKAGES gnome-desktop-3.0 >= 2.91.6" ;; + alternate-tab|example|windowsNavigator|auto-move-windows|dock|user-theme|alternative-status-menu|gajim|drive-menu|places-menu) places-menu must also be added to ALL_EXTENSIONS (or it will fail distcheck and --enable-extensions=all). You can add it to DEFAULT_EXTENSIONS as well, if you want.
Created attachment 187191 [details] [review] places menu patch against gnome-shell-extensions: final Added places-menu in ALL, DEFAULT extensions.
Comment on attachment 187191 [details] [review] places menu patch against gnome-shell-extensions: final Pushed to master, thanks!