Skip to content
Snippets Groups Projects
Commit b8186352 authored by Yann Leboulanger's avatar Yann Leboulanger
Browse files

use gobject introspection to access gconf

parent ad2f2ead
No related branches found
No related tags found
No related merge requests found
......@@ -25,7 +25,6 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
from types import *
#from glib import GError
def remove(sequence, target):
if isinstance(sequence, ListType):
......@@ -36,9 +35,9 @@ def remove(sequence, target):
del sequence[target]
def gconf(path):
# try:
# from gconf import client_get_default
# client = client_get_default()
# return client.get_string(path)
# except ImportError, GError:
pass
\ No newline at end of file
try:
from gi.repository import GConf
client = GConf.Client.get_default()
return client.get_string(path)
except ImportError:
pass
......@@ -31,7 +31,6 @@ import xml.sax.saxutils
from gi.repository import Gtk
from gi.repository import Gdk
from gi.repository import GdkPixbuf
import glib
from gi.repository import GObject
from gi.repository import Pango
import os
......@@ -175,11 +174,11 @@ def get_default_font():
Xfce and last KDE it returns None on failure or else a string 'Font Size'
"""
try:
from gconf import client_get_default
client = client_get_default()
from gi.repository import GConf
client = GConf.Client.get_default()
value = client.get_string("/desktop/gnome/interface/font_name")
return value.decode("utf8")
except ImportError, glib.GError:
except ImportError:
pass
# try to get Xfce default font
......@@ -833,7 +832,7 @@ def on_avatar_save_as_menuitem_activate(widget, jid, default_name=''):
# Save image
try:
pixbuf.save(file_path, image_format)
except glib.GError, e:
except Exception, e:
log.debug('Error saving avatar: %s' % str(e))
if os.path.exists(file_path):
os.remove(file_path)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment