[caribou/kb-rework: 8/13] Add keyboard model retrieval from GConf



commit 6d0ec0eefbb75a82d9e91c866da4a56f83b46fa3
Author: Joaquim Rocha <jrocha igalia com>
Date:   Mon May 24 17:23:49 2010 +0200

    Add keyboard model retrieval from GConf

 caribou/window.py |   18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)
---
diff --git a/caribou/window.py b/caribou/window.py
index bed83c4..0d4109e 100644
--- a/caribou/window.py
+++ b/caribou/window.py
@@ -23,6 +23,10 @@ import gconf
 import gtk
 import gtk.gdk as gdk
 import opacity
+import os
+
+CARIBOU_GCONF_LAYOUT_KEY = '/apps/caribou/osk/layout'
+CARIBOU_LAYOUT_DIR = 'caribou/keyboards'
 
 class CaribouWindow(gtk.Window):
     __gtype_name__ = "CaribouWindow"
@@ -43,7 +47,11 @@ class CaribouWindow(gtk.Window):
         self._entry_location = gdk.Rectangle()
         self._default_placement = default_placement or \
             CaribouWindowPlacement()
-        
+
+        conf_file_path = self._get_keyboard_conf()
+        if conf_file_path:
+            text_entry_mech.load_kb(conf_file_path)
+
     def set_cursor_location(self, cursor_location):
         self._cursor_location = cursor_location
         self._update_position()
@@ -123,6 +131,14 @@ class CaribouWindow(gtk.Window):
 
         return offset
 
+    def _get_keyboard_conf(self):
+        layout = self._gconf_client.get_string(CARIBOU_GCONF_LAYOUT_KEY)
+        conf_file_path = os.path.join(os.curdir,
+                                      CARIBOU_LAYOUT_DIR,
+                                      layout)
+        print conf_file_path
+        if os.path.exists(conf_file_path):
+            return conf_file_path
 
 class CaribouWindowDocked(CaribouWindow, 
                           animation.AnimatedWindowBase,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]