~ubuntu-branches/ubuntu/precise/gnome-games/precise-proposed

« back to all changes in this revision

Viewing changes to gnome-sudoku/src/lib/gtk_goodies/gconf_wrapper.py

  • Committer: Package Import Robot
  • Author(s): Rodrigo Moya
  • Date: 2011-05-30 13:32:04 UTC
  • mfrom: (1.3.4)
  • mto: (163.1.3 precise)
  • mto: This revision was merged to the branch mainline in revision 143.
  • Revision ID: package-import@ubuntu.com-20110530133204-celaq1v1dsxc48q1
Tags: upstream-3.0.2
ImportĀ upstreamĀ versionĀ 3.0.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
# COPIED VERBATIM FROM http://www.daa.com.au/pipermail/pygtk/2002-August/003220.html
4
4
# by Johan Dahlin
5
5
 
6
 
import gconf
7
 
from gconf import VALUE_BOOL, VALUE_INT, VALUE_STRING, VALUE_FLOAT
 
6
from gi.repository import GConf
8
7
from types import StringType, IntType, FloatType, BooleanType
9
8
 
10
9
verbose = False
13
12
    pass
14
13
 
15
14
 
16
 
class GConf:
 
15
class GConfWrap:
17
16
    def __init__ (self, appname, allowed={}):
18
17
        self._domain = '/apps/%s/' % appname
19
18
        self._allowed = allowed
20
 
        self._gconf_client = gconf.client_get_default ()
 
19
        self._gconf_client = GConf.Client.get_default()
21
20
 
22
21
    def __getitem__ (self, attr):
23
22
        return self.get_value (attr)
66
65
        if value == None:
67
66
            raise GConfError("gconf_client returned a None!")
68
67
        ValueType = value.type
69
 
        if ValueType == VALUE_BOOL:
 
68
        if ValueType == GConf.ValueType.BOOL:
70
69
            return value.get_bool ()
71
 
        elif ValueType == VALUE_INT:
 
70
        elif ValueType == GConf.ValueType.INT:
72
71
            return value.get_int ()
73
 
        elif ValueType == VALUE_STRING:
 
72
        elif ValueType == GConf.ValueType.STRING:
74
73
            return value.get_string ()
75
 
        elif ValueType == VALUE_FLOAT:
 
74
        elif ValueType == GConf.ValueType.FLOAT:
76
75
            return value.get_float ()
77
76
   
78
77
    def set_value (self, key, value):
195
194
    
196
195
 
197
196
def test():
198
 
    c = GConf ('test-gconf')
 
197
    c = GConfWrap ('test-gconf')
199
198
    c['foo'] = '1'
200
199
    c['bar'] = 2
201
200
    c['baz'] = 3.0