aboutsummaryrefslogtreecommitdiff
path: root/examples/simple-client.py
blob: ff7b416732a7655be5dee516cd9c50a4c52c2fba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# creates this menu:
#
#   Menu Item
#   ----------------
#   One
#   Two
#   Three
#   ----------------
#   Submenu        > | One
#                    | Two
#                    | Three

from gi.repository import GLib, Gio

def on_items_changed (model, position, removed, added, data):
    print 'items changed:', position, removed, added

bus = Gio.bus_get_sync (Gio.BusType.SESSION, None)
print dir(bus)
menu = bus.get_menu_model(':1.473', '/menu')
#menu = Gio.dbus_menu_model_get(Gio.BusType.SESSION, ':1.473', '/menu')
menu.connect ('items-changed', on_items_changed)

loop = GLib.MainLoop ()
loop.run ()