Back to index

libunity  5.92.0
launcher.py
Go to the documentation of this file.
00001 from gi.repository import Unity, Gio, GObject, Dbusmenu
00002 
00003 loop = GObject.MainLoop()
00004 
00005 # Pretend to be evolution for the sake of the example 
00006 launcher = Unity.LauncherEntry.get_for_desktop_id ("evolution.desktop")
00007 
00008 # Show a count of 124 on the icon
00009 launcher.set_property("count", 124)
00010 launcher.set_property("count_visible", True)
00011 
00012 # Set progress to 42% done 
00013 launcher.set_property("progress", 0.42)
00014 launcher.set_property("progress_visible", True)
00015 
00016 # Set us as urgent. Quickly! Go! Go! Go! Now! Now!
00017 launcher.set_property("urgent", True)
00018 
00019 # We also want a quicklist 
00020 ql = Dbusmenu.Menuitem.new ()
00021 item1 = Dbusmenu.Menuitem.new ()
00022 item1.property_set (Dbusmenu.MENUITEM_PROP_LABEL, "Item 1")
00023 item1.property_set_bool (Dbusmenu.MENUITEM_PROP_VISIBLE, True)
00024 item2 = Dbusmenu.Menuitem.new ()
00025 item2.property_set (Dbusmenu.MENUITEM_PROP_LABEL, "Item 2")
00026 item2.property_set_bool (Dbusmenu.MENUITEM_PROP_VISIBLE, True)
00027 ql.child_append (item1)
00028 ql.child_append (item2)
00029 launcher.set_property("quicklist", ql)
00030 
00031 loop.run()