How do I make the launcher progress bar work with my application?

Posted by Kevin Gurney on Ask Ubuntu See other posts from Ask Ubuntu or by Kevin Gurney
Published on 2012-07-01T16:07:16Z Indexed on 2012/07/02 15:24 UTC
Read the original article Hit count: 329

Background Research

I am attempting to update the progress bar within the Unity launcher for a simple python/Gtk application created using Quickly called test; however, following the instructions in this video, I have not been able to successfully update the progress bar in the Unity launcher. In the Unity Integration video, Quickly was not used, so the way that the application was structured was slightly different, and the code used in the video does not seem to function properly without modification in a default Quickly ubuntu-application template application.

Screenshots

Here is a screenshot of the application icon as it is currently displayed in the Unity Launcher.

enter image description here

Here is a screenshot of the kind of Unity launcher progress bar functionality that I would like (overlayed on mail icon: wiki.ubuntu.com).

enter image description here

Code

class TestWindow(Window):
__gtype_name__ = "TestWindow"

def finish_initializing(self, builder): # pylint: disable=E1002
    """Set up the main window"""
    super(TestWindow, self).finish_initializing(builder)

    self.AboutDialog = AboutTestDialog
    self.PreferencesDialog = PreferencesTestDialog

    # Code for other initialization actions should be added here.
    self.add_launcher_integration()

def add_launcher_integration(self):
    self.launcher = Unity.LauncherEntry.get_for_desktop_id("test.destkop")
    self.launcher.set_property("progress", 0.75)
    self.launcher.set_property("progress_visible", True)

Expected Behavior

I would expect the above code to show a progress bar that is 75% full overlayed on the icon for the test application in the Unity Launcher, but the application only runs and displays no progress bar when the command quickly run is executed.

Problem Investigation

I believe that the problem is that I am not properly getting a reference to the application's main window, however, I am not sure how to properly fix this problem. I also believe that the line: self.launcher = Unity.LauncherEntry.get_for_desktop_id("test.destkop") may be another source of complication because Quickly creates .desktop.in files rather than ordinary .desktop files, so I am not sure if that might be causing issues as well.

Perhaps, another source of the issue is that I do not entirely understand the difference between .desktop and .desktop.in files. Does it possibly make sense to make a copy of the test.desktop.in file and rename it test.desktop, and place it in /usr/share/applications in order for get_for_desktop_id("test,desktop") to reference the correct .desktop file?

Related Research Links

Although, I am still not clear on the difference between .desktop and .desktop.in files, I have done some research on .desktop files and I have come across a couple of links:

© Ask Ubuntu or respective owner

Related posts about unity

Related posts about application-development