[pan2/testing: 174/279] almost done, one thing missing: default save path. debug...
- From: Heinrich MÃller <henmull src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pan2/testing: 174/279] almost done, one thing missing: default save path. debug...
- Date: Sat, 3 Dec 2011 22:36:47 +0000 (UTC)
commit 7c6d3d49ce29bd19066628b22fe0b20d45c3698d
Author: Heinrich MÃller <sphemuel stud informatik uni-erlangen de>
Date: Tue Jul 19 13:08:53 2011 +0200
almost done, one thing missing: default save path. debug...
pan.cbp | 1 -
pan/data-impl/data-impl.h | 3 ++-
pan/data-impl/my-tree.cc | 18 +++++++++++++-----
pan/data/Makefile.am | 22 +++++++++++-----------
pan/data/data.h | 10 ++++++----
pan/general/file-util.cc | 10 ++++++++++
pan/general/file-util.h | 4 +---
pan/gui/prefs.h | 5 ++++-
pan/usenet-utils/rules-info.cc | 2 +-
9 files changed, 48 insertions(+), 27 deletions(-)
---
diff --git a/pan.cbp b/pan.cbp
index 5e43ecb..321146f 100644
--- a/pan.cbp
+++ b/pan.cbp
@@ -257,7 +257,6 @@
<Unit filename="pan/usenet-utils/numbers-test.cc" />
<Unit filename="pan/usenet-utils/numbers.cc" />
<Unit filename="pan/usenet-utils/numbers.h" />
- <Unit filename="pan/usenet-utils/rng.h" />
<Unit filename="pan/usenet-utils/rules-info.cc" />
<Unit filename="pan/usenet-utils/rules-info.h" />
<Unit filename="pan/usenet-utils/scorefile-test.cc" />
diff --git a/pan/data-impl/data-impl.h b/pan/data-impl/data-impl.h
index 655cca0..c0d92c7 100644
--- a/pan/data-impl/data-impl.h
+++ b/pan/data-impl/data-impl.h
@@ -61,6 +61,7 @@ namespace pan
public TaskArchive,
public ProfilesImpl
{
+
/**
*** SERVERS
**/
@@ -635,7 +636,7 @@ namespace pan
public:
const ArticleFilter _article_filter;
- RulesFilter _rules_filter;
+ RulesFilter _rules_filter;
private:
guint newsrc_autosave_id;
diff --git a/pan/data-impl/my-tree.cc b/pan/data-impl/my-tree.cc
index a52a539..72ec41a 100644
--- a/pan/data-impl/my-tree.cc
+++ b/pan/data-impl/my-tree.cc
@@ -20,6 +20,7 @@
#include <config.h>
#include <cassert>
#include <pan/general/debug.h>
+#include <pan/general/file-util.h>
#include <pan/general/macros.h>
#include <pan/general/quark.h>
#include <pan/usenet-utils/filter-info.h>
@@ -238,27 +239,34 @@ DataImpl :: MyTree :: apply_rules (const_nodes_v& candidates)
void
DataImpl :: MyTree :: cache_articles (std::set<const Article*> s)
{
- if (!_data._queue) return;
+ Queue * q (_data.get_queue());
+ if (!q) return;
Queue::tasks_t tasks;
ArticleCache& cache(_data.get_cache());
foreach_const (std::set<const Article*>, s, it)
tasks.push_back (new TaskArticle (_data, _data, **it, cache, _data));
if (!tasks.empty())
- _data._queue->add_tasks (tasks, Queue::TOP);
+ q->add_tasks (tasks, Queue::BOTTOM);
}
void
DataImpl :: MyTree :: download_articles (std::set<const Article*> s)
{
- if (!_data._queue) return;
+ Queue * q (_data.get_queue());
+ if (!q) return;
+ std::string path; /// TODO default path from prefs !!
Queue::tasks_t tasks;
ArticleCache& cache(_data.get_cache());
+
+ if (path.empty())
+ path = file :: get_temp_attach_path();
+
foreach_const (std::set<const Article*>, s, it)
- tasks.push_back (new TaskArticle (_data, _data, **it, cache, _data));
+ tasks.push_back (new TaskArticle (_data, _data, **it, cache, _data, 0, TaskArticle::DECODE, path));
if (!tasks.empty())
- _data._queue->add_tasks (tasks, Queue::TOP);
+ q->add_tasks (tasks, Queue::BOTTOM);
}
diff --git a/pan/data/Makefile.am b/pan/data/Makefile.am
index 6562464..b979ea9 100644
--- a/pan/data/Makefile.am
+++ b/pan/data/Makefile.am
@@ -1,4 +1,5 @@
-AM_CPPFLAGS = -I top_srcdir@ @GMIME_CFLAGS@ @GLIB_CFLAGS@
+AM_CPPFLAGS = -I top_srcdir@ @GMIME_CFLAGS@ @GLIB_CFLAGS@ @GTK_CFLAGS@
+LDADD = @GTK_LIBS@
SUBDIRS = decode-test-cache
@@ -22,18 +23,17 @@ noinst_HEADERS = \
server-info.h \
xref.h
-#noinst_PROGRAMS = \
-# article-test \
-#xref-test
+noinst_PROGRAMS = \
+ article-test \
+ xref-test
#dnl decode-test
#dnl decode_test_SOURCES = decode-test.cc
#dnl decode_test_LDADD = $(TEST_LDADD)
-#TESTS = $(noinst_PROGRAMS)
-#TEST_LDADD = ./libdata.a ../usenet-utils/libusenetutils.a
-#../general/libgeneralutils.a @GMIME_LIBS@ @GLIB_LIBS@
-#xref_test_SOURCES = xref-test.cc
-#xref_test_LDADD = $(TEST_LDADD)
-#article_test_SOURCES = article-test.cc
-#article_test_LDADD = $(TEST_LDADD)
+TESTS = $(noinst_PROGRAMS)
+TEST_LDADD = ./libdata.a ../usenet-utils/libusenetutils.a ../general/libgeneralutils.a @GMIME_LIBS@ @GLIB_LIBS@
+xref_test_SOURCES = xref-test.cc
+xref_test_LDADD = $(TEST_LDADD)
+article_test_SOURCES = article-test.cc
+article_test_LDADD = $(TEST_LDADD)
diff --git a/pan/data/data.h b/pan/data/data.h
index e33a096..9ed005f 100644
--- a/pan/data/data.h
+++ b/pan/data/data.h
@@ -506,15 +506,17 @@ namespace pan
size_t end_line,
bool do_rescore) = 0;
- virtual void rescore_articles (const Quark& group, const quarks_t mids) = 0;
+ virtual void rescore_articles (const Quark& group, const quarks_t mids) = 0;
- virtual void rescore () = 0;
+ virtual void rescore () = 0;
- ///TODO private!
public:
- Queue * _queue;
+
void set_queue (Queue* q) { _queue = q; }
+ Queue* get_queue () { return _queue; }
+ private:
+ Queue * _queue;
/*****************************************************************
diff --git a/pan/general/file-util.cc b/pan/general/file-util.cc
index 2e08bc2..7e8a770 100644
--- a/pan/general/file-util.cc
+++ b/pan/general/file-util.cc
@@ -70,6 +70,16 @@ file :: get_pan_home ()
return pan_home;
}
+std::string
+file :: get_temp_attach_path()
+{
+ char * pch (g_build_filename (file::get_pan_home().c_str(), "downloaded-attachments", NULL));
+ file :: ensure_dir_exists (pch);
+ std::string path (pch);
+ g_free (pch);
+ return path;
+}
+
const char*
file :: pan_strerror (int error_number)
{
diff --git a/pan/general/file-util.h b/pan/general/file-util.h
index 1d43bf0..fb9c77a 100644
--- a/pan/general/file-util.h
+++ b/pan/general/file-util.h
@@ -58,9 +58,7 @@ namespace pan
*/
std::string get_pan_home ();
- std::string get_uulib_path();
-
- void uulib_cache_clear();
+ std::string get_temp_attach_path ();
/**
* If the specified directory doesn't exist, Pan tries to create it.
diff --git a/pan/gui/prefs.h b/pan/gui/prefs.h
index a3215a7..99ded01 100644
--- a/pan/gui/prefs.h
+++ b/pan/gui/prefs.h
@@ -25,7 +25,10 @@
#include <string>
#include <vector>
#include <pan/general/string-view.h>
-#include <gtk/gtk.h>
+extern "C"
+{
+ #include <gtk/gtk.h>
+}
namespace pan
{
diff --git a/pan/usenet-utils/rules-info.cc b/pan/usenet-utils/rules-info.cc
index bb3c2a3..6580814 100644
--- a/pan/usenet-utils/rules-info.cc
+++ b/pan/usenet-utils/rules-info.cc
@@ -19,7 +19,7 @@
#include <iostream>
#include <pan/general/debug.h>
-#include <pan/tasks/queue.h>
+
#include <config.h>
extern "C" {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]