conduit r1901 - in trunk: . conduit/modules/FeedModule



Author: arosenfeld
Date: Mon Feb 23 07:58:48 2009
New Revision: 1901
URL: http://svn.gnome.org/viewvc/conduit?rev=1901&view=rev

Log:
2009-02-23  Alexandre Rosenfeld  <airmind gmail com>

	* conduit/modules/FeedModule/FeedModule.py:
	* conduit/modules/FeedModule/Makefile.am:
	* conduit/modules/FeedModule/config.glade:
	Port to new config system.



Removed:
   trunk/conduit/modules/FeedModule/config.glade
Modified:
   trunk/ChangeLog
   trunk/conduit/modules/FeedModule/FeedModule.py
   trunk/conduit/modules/FeedModule/Makefile.am

Modified: trunk/conduit/modules/FeedModule/FeedModule.py
==============================================================================
--- trunk/conduit/modules/FeedModule/FeedModule.py	(original)
+++ trunk/conduit/modules/FeedModule/FeedModule.py	Mon Feb 23 07:58:48 2009
@@ -66,13 +66,15 @@
 
     def __init__(self, *args):
         DataProvider.DataSource.__init__(self)
-        self.feedUrl = ""
+        self.update_configuration(
+            feedUrl = "",
+            limit = 0,
+            randomize = False,
+            downloadPhotos = True,
+            downloadAudio = True,
+            downloadVideo = True,
+        )
         self.files = {}
-        self.limit = 0        
-        self.randomize = False
-        self.downloadPhotos = True
-        self.downloadAudio = True
-        self.downloadVideo = True
         
     def _is_allowed_type(self, mimetype):
         ok = False
@@ -95,48 +97,32 @@
     def initialize(self):
         return True
 
-    def configure(self, window):
-        tree = Utils.dataprovider_glade_get_widget(
-                        __file__, 
-                        "config.glade",
-                        "RSSSourceConfigDialog"
-                        )
+    def config_setup(self, config):
+        #FIXME: Add Randomize
+        config.add_section("Feed details")
+        config.add_item("Feed address", "text",
+            config_name = 'feedUrl',
+        )
+        config.add_section("Enclosure settings")
+        limit_config = config.add_item("Limit downloaded enclosures", "check",
+            initial_value = (self.limit > 0)
+        )
+        limit_config.connect("value-changed", 
+            lambda item, changed, value: limit_spin_config.set_enabled(value)
+        )
+        limit_spin_config = config.add_item("Limit to", "spin",
+            config_name = 'limit',
+            enabled = (self.limit > 0),
+        )
+        random_config = config.add_item("Randomize enclosures", "check",
+            config_name = 'randomize'
+        )
         
-        #get a whole bunch of widgets
-        url = tree.get_widget("url")
-        limitCb = tree.get_widget("limitdownloads")
-        limitSb = tree.get_widget("limitnumber")        
-        randomize = tree.get_widget("randomize")
-        photosCb = tree.get_widget("downloadphotos")
-        audioCb = tree.get_widget("downloadaudio")
-        videoCb = tree.get_widget("downloadvideo")
-        
-        #preload the widgets
-        if self.limit > 0:
-            limitCb.set_active(True)
-            limitSb.set_value(self.limit)
-        else:
-            limitCb.set_active(False)
-        url.set_text(self.feedUrl)
-        randomize.set_active(self.randomize)
-        photosCb.set_active(self.downloadPhotos)
-        audioCb.set_active(self.downloadAudio)
-        videoCb.set_active(self.downloadVideo)
-                
-        dlg = tree.get_widget("RSSSourceConfigDialog")
-        
-        response = Utils.run_dialog (dlg, window)
-        if response == True:
-            self.feedUrl = url.get_text()
-            if limitCb.get_active():
-                self.limit = int(limitSb.get_value())
-            self.randomize = randomize.get_active()
-            self.downloadPhotos = photosCb.get_active()
-            self.downloadAudio = audioCb.get_active()
-            self.downloadVideo = videoCb.get_active()
-            
-        dlg.destroy()            
-
+        config.add_section("Download types")
+        config.add_item("Download audio files", "check", config_name = "downloadAudio")
+        config.add_item("Download video files", "check", config_name = "downloadVideo")
+        config.add_item("Download photo files", "check", config_name = "downloadPhotos")
+    
     def refresh(self):
         DataProvider.DataSource.refresh(self)
         #url : (title, mimetype)
@@ -192,16 +178,5 @@
         DataProvider.DataSource.finish(self)
         self.files = {}
 
-    def get_configuration(self):
-        return {
-            "feedUrl" : self.feedUrl,
-            "limit" : self.limit,
-            "randomize" : self.randomize,
-            "downloadPhotos" : self.downloadPhotos,
-            "downloadAudio" : self.downloadAudio,
-            "downloadVideo" : self.downloadVideo
-            }
-
     def get_UID(self):
         return self.feedUrl
-

Modified: trunk/conduit/modules/FeedModule/Makefile.am
==============================================================================
--- trunk/conduit/modules/FeedModule/Makefile.am	(original)
+++ trunk/conduit/modules/FeedModule/Makefile.am	Mon Feb 23 07:58:48 2009
@@ -1,8 +1,5 @@
 conduit_handlersdir = $(libdir)/conduit/modules/FeedModule
 conduit_handlers_PYTHON = FeedModule.py
 
-conduit_handlers_DATA = config.glade
-EXTRA_DIST = config.glade
-
 clean-local:
 	rm -rf *.pyc *.pyo



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