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 780371 - apps-menu: Allow creating desktop launchers via DND
apps-menu: Allow creating desktop launchers via DND
Status: RESOLVED FIXED
Product: gnome-shell
Classification: Core
Component: extensions
unspecified
Other All
: Normal normal
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
Depends on:
Blocks:
 
 
Reported: 2017-03-21 20:01 UTC by Florian Müllner
Modified: 2017-03-22 18:33 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
apps-menu: Use Map to keep track of app items (2.38 KB, patch)
2017-03-21 20:01 UTC, Florian Müllner
committed Details | Review
apps-menu: Allow creating desktop launchers via DND (5.97 KB, patch)
2017-03-21 20:01 UTC, Florian Müllner
committed Details | Review
apps-menu: Only enable DND when there's a desktop (3.03 KB, patch)
2017-03-21 20:01 UTC, Florian Müllner
committed Details | Review

Description Florian Müllner 2017-03-21 20:01:01 UTC
See patches.
Comment 1 Florian Müllner 2017-03-21 20:01:09 UTC
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.
Comment 2 Florian Müllner 2017-03-21 20:01:17 UTC
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.
Comment 3 Florian Müllner 2017-03-21 20:01:24 UTC
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.
Comment 4 Rui Matos 2017-03-22 18:03:24 UTC
Review of attachment 348441 [details] [review]:

yeah, this looks better
Comment 5 Rui Matos 2017-03-22 18:04:00 UTC
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...
Comment 6 Rui Matos 2017-03-22 18:04:17 UTC
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()
Comment 7 Florian Müllner 2017-03-22 18:31:31 UTC
(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)
Comment 8 Florian Müllner 2017-03-22 18:33:42 UTC
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)