[Sugar-devel] [PATCH sugar-datastore] Port to gi and gtk3 toolkit

Daniel Narvaez dwnarvaez at gmail.com
Tue Nov 13 09:10:00 EST 2012


From: Daniel Narvaez <dwnarvaez at gmail.com>

---
 bin/copy-from-journal        |    4 ++--
 bin/copy-to-journal          |    4 ++--
 bin/datastore-service        |    6 +++---
 src/carquinyol/datastore.py  |    8 ++++----
 src/carquinyol/filestore.py  |    4 ++--
 src/carquinyol/indexstore.py |    6 +++---
 src/carquinyol/optimizer.py  |    6 +++---
 7 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/bin/copy-from-journal b/bin/copy-from-journal
index c8d2d84..38830fd 100755
--- a/bin/copy-from-journal
+++ b/bin/copy-from-journal
@@ -12,8 +12,8 @@ import dbus
 if os.path.exists("/tmp/olpc-session-bus"):
     os.environ["DBUS_SESSION_BUS_ADDRESS"] = "unix:path=/tmp/olpc-session-bus"
 
-from sugar.datastore import datastore
-import sugar.mime
+from sugar3.datastore import datastore
+import sugar3.mime
 
 # Limit the number of objects returned on an ambiguous query to this number,
 # for quicker operation.
diff --git a/bin/copy-to-journal b/bin/copy-to-journal
index e675441..c6be436 100755
--- a/bin/copy-to-journal
+++ b/bin/copy-to-journal
@@ -15,8 +15,8 @@ import dbus
 if os.path.exists("/tmp/olpc-session-bus"):
     os.environ["DBUS_SESSION_BUS_ADDRESS"] = "unix:path=/tmp/olpc-session-bus"
 
-from sugar.datastore import datastore
-from sugar import mime
+from sugar3.datastore import datastore
+from sugar3 import mime
 
 
 def build_option_parser():
diff --git a/bin/datastore-service b/bin/datastore-service
index 008b66d..40bb85c 100755
--- a/bin/datastore-service
+++ b/bin/datastore-service
@@ -3,12 +3,12 @@ import sys
 import os
 import signal
 import logging
-import gobject
+from gi.repository import GObject
 import dbus.service
 import dbus.mainloop.glib
 import dbus.glib
 from carquinyol.datastore import DataStore
-from sugar import logger
+from sugar3 import logger
 
 # Path handling
 profile = os.environ.get('SUGAR_PROFILE', 'default')
@@ -28,7 +28,7 @@ connected = True
 ds = DataStore()
 
 # and run it
-mainloop = gobject.MainLoop()
+mainloop = GObject.MainLoop()
 
 
 def handle_disconnect():
diff --git a/src/carquinyol/datastore.py b/src/carquinyol/datastore.py
index 212901b..5e92e25 100644
--- a/src/carquinyol/datastore.py
+++ b/src/carquinyol/datastore.py
@@ -28,9 +28,9 @@ import tempfile
 
 import dbus
 import dbus.service
-import gobject
+from gi.repository import GObject
 
-from sugar import mime
+from sugar3 import mime
 
 from carquinyol import layoutmanager
 from carquinyol import migration
@@ -201,8 +201,8 @@ class DataStore(dbus.service.Object):
         logging.debug('Going to update the index with object_ids %r',
             uids)
         self._index_updating = True
-        gobject.idle_add(lambda: self.__update_index_cb(uids),
-                            priority=gobject.PRIORITY_LOW)
+        GObject.idle_add(lambda: self.__update_index_cb(uids),
+                         priority=GObject.PRIORITY_LOW)
 
     def __update_index_cb(self, uids):
         if uids:
diff --git a/src/carquinyol/filestore.py b/src/carquinyol/filestore.py
index 0b34b69..d8184ae 100644
--- a/src/carquinyol/filestore.py
+++ b/src/carquinyol/filestore.py
@@ -19,7 +19,7 @@ import errno
 import logging
 import tempfile
 
-import gobject
+from gi.repository import GObject
 
 from carquinyol import layoutmanager
 
@@ -223,4 +223,4 @@ class AsyncCopy(object):
         stat = os.fstat(self.src_fp)
         self.size = stat[6]
 
-        gobject.idle_add(self._copy_block)
+        GObject.idle_add(self._copy_block)
diff --git a/src/carquinyol/indexstore.py b/src/carquinyol/indexstore.py
index d922100..e817d37 100644
--- a/src/carquinyol/indexstore.py
+++ b/src/carquinyol/indexstore.py
@@ -18,7 +18,7 @@ import logging
 import os
 import sys
 
-import gobject
+from gi.repository import GObject
 import xapian
 from xapian import WritableDatabase, Document, Enquire, Query
 
@@ -396,7 +396,7 @@ class IndexStore(object):
         self._set_index_updated(False)
 
         if self._flush_timeout is not None:
-            gobject.source_remove(self._flush_timeout)
+            GObject.source_remove(self._flush_timeout)
             self._flush_timeout = None
 
         self._pending_writes += 1
@@ -411,5 +411,5 @@ class IndexStore(object):
             self._pending_writes = 0
             self._set_index_updated(True)
         else:
-            self._flush_timeout = gobject.timeout_add_seconds(_FLUSH_TIMEOUT,
+            self._flush_timeout = GObject.timeout_add_seconds(_FLUSH_TIMEOUT,
                                                       self._flush_timeout_cb)
diff --git a/src/carquinyol/optimizer.py b/src/carquinyol/optimizer.py
index c038c2b..5a002a3 100644
--- a/src/carquinyol/optimizer.py
+++ b/src/carquinyol/optimizer.py
@@ -19,7 +19,7 @@ import errno
 import logging
 import subprocess
 
-import gobject
+from gi.repository import GObject
 
 from carquinyol import layoutmanager
 
@@ -46,8 +46,8 @@ class Optimizer(object):
 
         if self._enqueue_checksum_id is None:
             self._enqueue_checksum_id = \
-                    gobject.idle_add(self._process_entry_cb,
-                                     priority=gobject.PRIORITY_LOW)
+                    GObject.idle_add(self._process_entry_cb,
+                                     priority=GObject.PRIORITY_LOW)
 
     def remove(self, uid):
         """Remove any structures left from space optimization
-- 
1.7.10.2



More information about the Sugar-devel mailing list