Changed external page version, and some widget usability modifications
[feedingit] / src / config.py
index 97fffd6..091dcb9 100644 (file)
@@ -30,12 +30,12 @@ from gobject import idle_add
 from gconf import client_get_default
 from urllib2 import ProxyHandler
 
-VERSION = "48"
+VERSION = "52"
 
 section = "FeedingIt"
-ranges = { "updateInterval":[0.5, 1, 2, 4, 12, 24], "expiry":[24, 48, 72], "fontSize":range(12,24), "orientation":["Automatic", "Landscape", "Portrait"], "artFontSize":[10, 12, 14, 16, 18, 20]}
-titles = {"updateInterval":"Auto-update interval", "expiry":"Delete articles", "fontSize":"List font size", "orientation":"Display orientation", "artFontSize":"Article font size"}
-subtitles = {"updateInterval":"Every %s hours", "expiry":"After %s hours", "fontSize":"%s pixels", "orientation":"%s", "artFontSize":"%s pixels"}
+ranges = { "updateInterval":[0.5, 1, 2, 4, 12, 24], "expiry":[24, 48, 72], "fontSize":range(12,24), "orientation":["Automatic", "Landscape", "Portrait"], "artFontSize":[10, 12, 14, 16, 18, 20], "feedsort":["Manual", "Most unread", "Least unread", "Most recent", "Least recent"] }
+titles = {"updateInterval":"Auto-update interval", "expiry":"Delete articles", "fontSize":"List font size", "orientation":"Display orientation", "artFontSize":"Article font size","feedsort":"Feed sort order"}
+subtitles = {"updateInterval":"Every %s hours", "expiry":"After %s hours", "fontSize":"%s pixels", "orientation":"%s", "artFontSize":"%s pixels", "feedsort":"%s"}
 
 class Config():
     def __init__(self, parent, configFilename):
@@ -55,6 +55,8 @@ class Config():
     def createDialog(self):
         
         self.window = gtk.Dialog("Settings", self.parent)
+        self.window.set_geometry_hints(min_height=600)
+
         save_button = self.window.add_button(gtk.STOCK_SAVE, gtk.RESPONSE_OK)
         save_button.connect('clicked', self.on_save_button_clicked)
         #self.window.set_default_size(-1, 600)
@@ -90,6 +92,7 @@ class Config():
         add_setting('fontSize')
         add_setting('artFontSize')
         add_setting('orientation')
+        add_setting('feedsort')
         button = hildon.CheckButton(gtk.HILDON_SIZE_FINGER_HEIGHT)
         button.set_label("Hide read feeds")
         button.set_active(self.config["hidereadfeeds"])
@@ -117,7 +120,7 @@ class Config():
         button.set_label('Cache images')
         button.set_active(self.config["imageCache"])
         button.connect("toggled", self.button_toggled, "imageCache")
-        vbox.pack_start(button, expand=False)      
+        vbox.pack_start(button, expand=False)
 
         button = hildon.CheckButton(gtk.HILDON_SIZE_FINGER_HEIGHT)
         button.set_label("Use HTTP proxy")
@@ -125,9 +128,15 @@ class Config():
         button.connect("toggled", self.button_toggled, "proxy")
         vbox.pack_start(button, expand=False)
         
+        button = hildon.CheckButton(gtk.HILDON_SIZE_FINGER_HEIGHT)
+        button.set_label('Open links in external browser')
+        button.set_active(self.config["extBrowser"])
+        button.connect("toggled", self.button_toggled, "extBrowser")
+        vbox.pack_start(button, expand=False)
+        
         panArea.add_with_viewport(vbox)
         
-        self.window.vbox.add(panArea)        
+        self.window.vbox.add(panArea)
         self.window.connect("destroy", self.onExit)
         #self.window.add(self.vbox)
         self.window.set_default_size(-1, 600)
@@ -200,6 +209,14 @@ class Config():
         except:
             self.config["hidereadfeeds"] = False
             self.config["hidereadarticles"] = False
+        try:
+            self.config["extBrowser"] = configParser.getboolean(section, "extBrowser")
+        except:
+            self.config["extBrowser"] = False
+        try:
+            self.config["feedsort"] = configParser.get(section, "feedsort")
+        except:
+            self.config["feedsort"] = "Manual"
         
     def saveConfig(self):
         configParser = RawConfigParser()
@@ -214,6 +231,8 @@ class Config():
         configParser.set(section, 'proxy', str(self.config["proxy"]))
         configParser.set(section, 'hidereadfeeds', str(self.config["hidereadfeeds"]))
         configParser.set(section, 'hidereadarticles', str(self.config["hidereadarticles"]))
+        configParser.set(section, 'extBrowser', str(self.config["extBrowser"]))
+        configParser.set(section, 'feedsort', str(self.config["feedsort"]))
 
         # Writing our configuration file
         file = open(self.configFilename, 'wb')
@@ -265,3 +284,7 @@ class Config():
         return self.config["hidereadfeeds"]
     def getHideReadArticles(self):
         return self.config["hidereadarticles"]
+    def getOpenInExternalBrowser(self):
+        return self.config["extBrowser"]
+    def getFeedSortOrder(self):
+        return self.config["feedsort"]