4

At some point, Unity changed the Uri type it returned when a drag-n-drop operation occurred of applications from the Unity Dash to a Gtk window in an app I wrote. In 13.04 (Unity 7.0), the data call back received a text/uri-list with the full path, e.g. file://usr/share/applications/APP.desktop

Now however, it's a test/uri-list like this: application://APP.desktop

How do I get it to give me the full path to APP.desktop? Or can I use the uri to get an AppInfo object?

0

1 Answer 1

4
+500

Looking at the documentation, you should be able to use the get_path of the AppInfoManager object

Running the following in the python interpreter:

>>> from gi.repository import Unity
>>> a = Unity.AppInfoManager.get_instance()
>>> a.get_path("gedit.desktop")
'/usr/share/applications/gedit.desktop'

As you can see, just passing the desktop file-name returns the full-path to the desktop filename.

Thus, from your drag-drop app - ensure you add the uri target:

widget.drag_dest_add_uri_targets()

connect to the drag_data_get method

connect("drag-data-get", self.on_drag_data_get)

def on_drag_data_received(self, widget, drag_context, x,y, data,info, time):
    print (data.get_uris())

Split out from application://app.desktop (string.split(str, 1)[1]) and feed that into the appinfomanager.get_path() method

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .