[conduit/gsoc09_alexandre] Persistent syncsets experiment



commit e1beeaef83d3bb6596f11f657345dde9702e8eef
Author: Alexandre Rosenfeld <airmind gmail com>
Date:   Mon Jun 8 16:38:14 2009 -0300

    Persistent syncsets experiment

 conduit/DBus.py                           |   34 ++++++++++++++++++++++++++++-
 conduit/gtkui/SelectDataproviderDialog.py |   32 +++++++++++++++++++++++++++
 2 files changed, 65 insertions(+), 1 deletions(-)
---
diff --git a/conduit/DBus.py b/conduit/DBus.py
index aca2d8d..5d64ccd 100644
--- a/conduit/DBus.py
+++ b/conduit/DBus.py
@@ -16,6 +16,11 @@ import conduit.utils as Utils
 import conduit.Conduit as Conduit
 import conduit.SyncSet as SyncSet
 
+
+import gconf
+gconf = gconf.client_get_default()
+GCONF_PATH = "/apps/conduit"
+
 ERROR = -1
 SUCCESS = 0
 
@@ -445,6 +450,16 @@ class DBusInterface(DBusItem):
         self.type_converter = typeConverter
         self.sync_manager = syncManager
 
+        print gconf.all_dirs(GCONF_PATH)
+        for syncset_path in gconf.all_dirs(GCONF_PATH):
+            name = syncset_path.split("/")[-1]
+            if name not in ('gui', 'dbus'):
+                ss = SyncSet.SyncSet(
+                         moduleManager=self.moduleManager,
+                         syncManager=self.sync_manager
+                     )
+                new = SyncSetDBusItem(ss, name)
+                EXPORTED_OBJECTS[new.get_path()] = new
         
         #export the syncsets
         if guiSyncSet != None:
@@ -472,7 +487,19 @@ class DBusInterface(DBusItem):
         i = Utils.uuid_string()
         new = SyncSetDBusItem(ss, i)
         EXPORTED_OBJECTS[new.get_path()] = new
-        return new    
+        return new
+        
+    def _new_named_syncset(self, name):
+        if "/dataprovider/%s" % name in EXPORTED_OBJECTS:
+            return EXPORTED_OBJECTS["/dataprovider/%s" % name]
+        else:
+            ss = SyncSet.SyncSet(
+                        moduleManager=self.moduleManager,
+                        syncManager=self.sync_manager
+                        )
+            new = SyncSetDBusItem(ss, name)
+            EXPORTED_OBJECTS[new.get_path()] = new
+            return new        
     
     def _get_dataprovider(self, key):
         """
@@ -531,6 +558,11 @@ class DBusInterface(DBusItem):
     def NewSyncSet(self):
         self._print("NewSyncSet")
         return self._new_syncset()
+    
+    @dbus.service.method(APPLICATION_DBUS_IFACE, in_signature='', out_signature='o')    
+    def NewNamedSyncSet(self, syncset_name):
+        self._print("NewNamedSyncSet")
+        return self._new_named_syncset()
 
     @dbus.service.method(APPLICATION_DBUS_IFACE, in_signature='', out_signature='as')
     def GetAllDataProviders(self):
diff --git a/conduit/gtkui/SelectDataproviderDialog.py b/conduit/gtkui/SelectDataproviderDialog.py
new file mode 100644
index 0000000..3d26b3a
--- /dev/null
+++ b/conduit/gtkui/SelectDataproviderDialog.py
@@ -0,0 +1,32 @@
+"""
+Copyright: Alexandre Rosenfeld, 2009
+License: GPLv2
+"""
+import thread
+import gobject
+import gtk, gtk.glade
+import os.path
+import gettext
+import threading
+from gettext import gettext as _
+import logging
+log = logging.getLogger("gtkui.UI")
+
+import conduit
+import conduit.Web as Web
+import conduit.Conduit as Conduit
+import conduit.gtkui.Canvas as Canvas
+import conduit.gtkui.MsgArea as MsgArea
+import conduit.gtkui.Tree as Tree
+import conduit.gtkui.ConflictResolver as ConflictResolver
+import conduit.gtkui.Database as Database
+
+class SelectDataproviderDialog(object):
+
+    def __init__(self, filter_mime = None):
+        self.window = gtk.Assistant()
+        
+        conduit.GLOBALS.moduleManager.get_modules_by_type("source","sink","twoway")
+
+        self.dataproviders_list
+



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