Correct usage of GConf. There is still code needs to be fixed
This commit is contained in:
parent
e78e4318c5
commit
75eb686f09
|
@ -25,6 +25,7 @@
|
||||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
from types import *
|
from types import *
|
||||||
|
from glib import GError
|
||||||
|
|
||||||
def remove(sequence, target):
|
def remove(sequence, target):
|
||||||
if isinstance(sequence, ListType):
|
if isinstance(sequence, ListType):
|
||||||
|
@ -37,7 +38,7 @@ def remove(sequence, target):
|
||||||
def gconf(path):
|
def gconf(path):
|
||||||
try:
|
try:
|
||||||
from gconf import client_get_default
|
from gconf import client_get_default
|
||||||
except ImportError:
|
|
||||||
return
|
|
||||||
client = client_get_default()
|
client = client_get_default()
|
||||||
return client.get_string(path)
|
return client.get_string(path)
|
||||||
|
except ImportError, GError:
|
||||||
|
pass
|
|
@ -173,13 +173,11 @@ def get_default_font():
|
||||||
Xfce and last KDE it returns None on failure or else a string 'Font Size'
|
Xfce and last KDE it returns None on failure or else a string 'Font Size'
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
import gconf
|
from gconf import client_get_default
|
||||||
# in try because daemon may not be there
|
client = client_get_default()
|
||||||
client = gconf.client_get_default()
|
value = client.get_string("/desktop/gnome/interface/font_name")
|
||||||
|
return value.decode("utf8")
|
||||||
return client.get_string('/desktop/gnome/interface/font_name'
|
except ImportError, glib.GError:
|
||||||
).decode('utf-8')
|
|
||||||
except Exception:
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# try to get Xfce default font
|
# try to get Xfce default font
|
||||||
|
|
Loading…
Reference in New Issue