GNOME Bugzilla – Bug 780371
apps-menu: Allow creating desktop launchers via DND
Last modified: 2017-03-22 18:33:59 UTC
See patches.
Created attachment 348441 [details] [review] apps-menu: Use Map to keep track of app items The use of Array to keep track of inserted items is extremely confusing, as no elements are ever added to the array. What the code actually does is monkey-patching properties into an empty object (that happens to be of type "Array"). While the direct idiomatic replacement would be {}, update the code to use a proper map instead.
Created attachment 348442 [details] [review] apps-menu: Allow creating desktop launchers via DND Back in the olden days, it used to be possible to drag items from the application menu to the desktop to create a launcher shortcut. Reimplement that "classic" functionality in the apps menu extension.
Created attachment 348443 [details] [review] apps-menu: Only enable DND when there's a desktop It's not very useful to allow dragging when there's no drop target, so tie the functionality added in the previous commit to the presence of a DESKTOP window.
Review of attachment 348441 [details] [review]: yeah, this looks better
Review of attachment 348442 [details] [review]: untested but looks fine even with the sync copy ::: extensions/apps-menu/extension.js @@ +344,3 @@ + + try { + // copy_async() isn't introspectable :-( why? can we get that fixed? we could check for the method's existence and use it if it's there so that it starts working when Gio gets fixed. OTOH, .desktop files are small so the change of blocking the compositor should be small...
Review of attachment 348443 [details] [review]: makes sense ::: extensions/apps-menu/extension.js @@ +107,3 @@ + setDragEnabled: function(enable) { + if (this._dragEnabled == enable) not really needed @@ +298,3 @@ + get hasDesktop() { + return this._desktop != null; we should explicitly initialize this._desktop to null on _init()
(In reply to Rui Matos from comment #5) > why? can we get that fixed? Two callback+data pairs, so not easily. > we could check for the method's existence and use it if it's there so that > it starts working when Gio gets fixed. OTOH, .desktop files are small so the > change of blocking the compositor should be small... Yeah. Also I was in doubt whether to file the patches upstream at all, as it appears an absolute fringe feature (but maybe that's just me)
Attachment 348441 [details] pushed as 021037b - apps-menu: Use Map to keep track of app items Attachment 348442 [details] pushed as 243f700 - apps-menu: Allow creating desktop launchers via DND Attachment 348443 [details] pushed as 09a60a2 - apps-menu: Only enable DND when there's a desktop (Squashed the other two comments)