After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 648724 - A gnome shell extension to display places as a status indicator
A gnome shell extension to display places as a status indicator
Status: RESOLVED FIXED
Product: gnome-shell
Classification: Core
Component: extensions
3.0.x
Other Linux
: Normal enhancement
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
Depends on:
Blocks:
 
 
Reported: 2011-04-27 05:00 UTC by Vamsi Krishna
Modified: 2011-05-04 14:13 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
git patch against gnome-shell-extensions (7.07 KB, patch)
2011-04-27 05:00 UTC, Vamsi Krishna
none Details | Review
places menu patch against gnome-shell-extensions (7.34 KB, patch)
2011-04-28 10:06 UTC, Vamsi Krishna
needs-work Details | Review
places menu patch against gnome-shell-extensions: updated (7.60 KB, patch)
2011-05-03 18:32 UTC, Vamsi Krishna
accepted-commit_now Details | Review
screenshot of updated extension (127.56 KB, image/png)
2011-05-03 18:44 UTC, Vamsi Krishna
  Details
places menu patch against gnome-shell-extensions: final (8.48 KB, patch)
2011-05-04 14:04 UTC, Vamsi Krishna
committed Details | Review

Description Vamsi Krishna 2011-04-27 05:00:34 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.
Comment 1 David Prieto 2011-04-27 18:49:22 UTC
I would love to have this as a tab inside the Overview, and maybe including removable devices for easy unmount.
Comment 2 Vamsi Krishna 2011-04-28 10:06:41 UTC
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
Comment 3 Giovanni Campagna 2011-05-01 19:23:06 UTC
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)
Comment 4 Vamsi Krishna 2011-05-01 19:31:59 UTC
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.
Comment 5 Vamsi Krishna 2011-05-03 18:32:29 UTC
Created attachment 187143 [details] [review]
places menu patch against gnome-shell-extensions: updated

Made corrections to the earlier patch.
Comment 6 Vamsi Krishna 2011-05-03 18:44:04 UTC
Created attachment 187144 [details]
screenshot of updated extension

Screenshot of the extension, just for a quick reference.
Comment 7 Giovanni Campagna 2011-05-04 13:07:07 UTC
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.
Comment 8 Vamsi Krishna 2011-05-04 14:04:46 UTC
Created attachment 187191 [details] [review]
places menu patch against gnome-shell-extensions: final

Added places-menu in ALL, DEFAULT extensions.
Comment 9 Giovanni Campagna 2011-05-04 14:13:19 UTC
Comment on attachment 187191 [details] [review]
places menu patch against gnome-shell-extensions: final

Pushed to master, thanks!