File: client-example.py

package info (click to toggle)
ayatana-indicator-messages 24.5.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,584 kB
  • sloc: ansic: 4,600; cpp: 1,048; xml: 72; python: 69; sh: 32; makefile: 27
file content (21 lines) | stat: -rwxr-xr-x 823 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/env python

from gi.repository import GLib, Gio, MessagingMenu

mmapp = MessagingMenu.App(desktop_id='evolution.desktop')

# make the application appear in the messaging menu. The name and icon are taken from the desktop file above
mmapp.register()

def source_activated(mmapp, source_id):
  print('source {} activated'.format(source_id))

# do something when the user clicks on a source. The source will be removed automatically
mmapp.connect('activate-source', source_activated)

# add a 'source' (a menu item below the application's name) with the name 'Inbox' and a count of 7
icon = Gio.ThemedIcon.new_with_default_fallbacks('my-source-icon')
mmapp.append_source_with_count('inbox', icon, 'Inbox', 7)

# this is not necessary for gtk applications, which start a mainloop in gtk_main()
GLib.MainLoop().run()