[pan2/testing: 175/279] variable articlecache size via prefs



commit 0014fd777b92a992339aa469d01146475925211b
Author: Heinrich MÃller <sphemuel stud informatik uni-erlangen de>
Date:   Tue Jul 19 13:55:02 2011 +0200

    variable articlecache size via prefs

 pan/data/article-cache.h |    5 ++++-
 pan/gui/gui.cc           |    1 +
 pan/gui/prefs-ui.cc      |    8 +++++++-
 3 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/pan/data/article-cache.h b/pan/data/article-cache.h
index 6780fad..48508c2 100644
--- a/pan/data/article-cache.h
+++ b/pan/data/article-cache.h
@@ -86,6 +86,9 @@ namespace pan
       void add_listener (Listener * l) { _listeners.insert(l); }
       void remove_listener (Listener * l) { _listeners.erase(l); }
 
+    public:
+      void set_max_megs (size_t value) { _max_megs = value; }
+
     private:
 
       std::map<Quark,int> _locks;
@@ -109,7 +112,7 @@ namespace pan
       };
 
       std::string _path;
-      const size_t _max_megs;
+      size_t _max_megs; // changeable via prefs
       guint64 _current_bytes;
 
       typedef std::set<Listener*> listeners_t;
diff --git a/pan/gui/gui.cc b/pan/gui/gui.cc
index 421ae02..461beeb 100644
--- a/pan/gui/gui.cc
+++ b/pan/gui/gui.cc
@@ -1078,6 +1078,7 @@ void GUI :: prefs_dialog_destroyed (GtkWidget *)
     _prefs._rules_changed = !_prefs._rules_changed;
     _header_pane->rules(_prefs._rules_enabled);
   }
+  _cache.set_max_megs(_prefs.get_int("cache-size-megs",10));
 
 }
 
diff --git a/pan/gui/prefs-ui.cc b/pan/gui/prefs-ui.cc
index cdeeb52..77c255c 100644
--- a/pan/gui/prefs-ui.cc
+++ b/pan/gui/prefs-ui.cc
@@ -520,14 +520,20 @@ PrefsDialog :: PrefsDialog (Prefs& prefs, GtkWindow* parent):
     HIG :: workarea_add_wide_control (t, &row, w);
     w = new_check_button (_("Clear article cache on shutdown"), "clear-article-cache-on-shutdown", false, prefs);
     HIG :: workarea_add_wide_control (t, &row, w);
+    w = new_spin_button ("cache-size-megs", 10, 1024*16, prefs);
+    l = gtk_label_new(_("Size of Article Cache (in MiB): "));
+    gtk_misc_set_alignment (GTK_MISC(l), 0.0, 0.5);
+    gtk_label_set_mnemonic_widget(GTK_LABEL(l), w);
+    HIG::workarea_add_row (t, &row, w, l);
     HIG::workarea_add_section_divider (t, &row);
+    HIG :: workarea_add_section_title (t, &row, _("Autosave Articles"));
     w = new_spin_button ("newsrc-autosave-timeout-min", 0, 60, prefs);
     l = gtk_label_new(_("Minutes to autosave newsrc files."));
     gtk_misc_set_alignment (GTK_MISC(l), 0.0, 0.5);
     gtk_label_set_mnemonic_widget(GTK_LABEL(l), w);
     HIG::workarea_add_row (t, &row, w, l);
     HIG::workarea_add_section_divider (t, &row);
-    HIG :: workarea_add_section_title (t, &row, _("Article Drafts"));
+    HIG :: workarea_add_section_title (t, &row, _("Autosave Article Draft"));
     w = new_spin_button ("draft-autosave-timeout-min", 0, 60, prefs);
     l = gtk_label_new(_("Minutes to autosave the current Article Draft."));
     gtk_misc_set_alignment (GTK_MISC(l), 0.0, 0.5);



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