Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/gconf_monitor_test.py
blob: 6a6b1d710cb788dee219b092cdc57c82ce65ca61 (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
27
28
29
30
31
from gi.repository import Gtk
from gi.repository import GConf

import logging

def gconf_event_cb(client, timestamp, entry, *extra):
    logging.error('GCONF CHANGED %s', client.get_string('/test/blabla'))

def change_value_cb(widget, client):
    text = widget.get_text()
    logging.error('Before changing gconf value %s', text)
    client.set_string('/test/blabla', text)

window = Gtk.Window()
window.connect('destroy',
        lambda sender: Gtk.main_quit())

box = Gtk.VBox()
window.add(box)

entry = Gtk.Entry()
box.add(entry)

client = GConf.Client.get_default()
client.add_dir('/test/blabla', GConf.ClientPreloadType.PRELOAD_NONE)
client.notify_add('/test/blabla', gconf_event_cb, None)

entry.connect('activate', change_value_cb, client)

window.show_all()
Gtk.main()