[pan2/testing: 106/279] some fixes to log-ui and save dialog
- From: Heinrich MÃller <henmull src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pan2/testing: 106/279] some fixes to log-ui and save dialog
- Date: Sat, 3 Dec 2011 22:31:05 +0000 (UTC)
commit 796af32a19de55fba0dbec1984ef131e77e54a58
Author: Heinrich MÃller <sphemuel stud informatik uni-erlangen de>
Date: Tue Jun 14 13:39:56 2011 +0200
some fixes to log-ui and save dialog
pan/gui/gui.cc | 2 --
pan/gui/gui.h | 3 ---
pan/gui/post-ui.cc | 21 ++++++++++-----------
pan/tasks/encoder.cc | 2 +-
pan/tasks/nzb.cc | 1 +
pan/tasks/task-upload.cc | 9 ++++-----
6 files changed, 16 insertions(+), 22 deletions(-)
---
diff --git a/pan/gui/gui.cc b/pan/gui/gui.cc
index 44a2ffd..78a9057 100644
--- a/pan/gui/gui.cc
+++ b/pan/gui/gui.cc
@@ -183,8 +183,6 @@ GUI :: GUI (Data& data, Queue& queue, ArticleCache& cache, EncodeCache& encode_c
_taskbar (0)
{
-// mtrand.seed(); // for mids
-
char * filename = g_build_filename (file::get_pan_home().c_str(), "pan.ui", NULL);
if (!gtk_ui_manager_add_ui_from_file (_ui_manager, filename, NULL))
gtk_ui_manager_add_ui_from_string (_ui_manager, fallback_ui_file, -1, NULL);
diff --git a/pan/gui/gui.h b/pan/gui/gui.h
index d34b47f..4ebafc1 100644
--- a/pan/gui/gui.h
+++ b/pan/gui/gui.h
@@ -31,8 +31,6 @@
#include <pan/gui/group-prefs.h>
#include <pan/gui/wait.h>
-#include <pan/usenet-utils/MersenneTwister.h>
-
#include "gtk_compat.h"
namespace pan
@@ -59,7 +57,6 @@ namespace pan
GUI (Data& data, Queue&, ArticleCache&, EncodeCache&, Prefs&, GroupPrefs&);
virtual ~GUI ();
GtkWidget* root () { return _root; }
-// MTRand mtrand;
public: // ActionManager
virtual bool is_action_active (const char * action_name) const;
diff --git a/pan/gui/post-ui.cc b/pan/gui/post-ui.cc
index 003f926..d3f7dee 100644
--- a/pan/gui/post-ui.cc
+++ b/pan/gui/post-ui.cc
@@ -866,7 +866,7 @@ PostUI :: maybe_mail_message (GMimeMessage * message)
void
PostUI :: on_progress_finished (Progress&, int status) // posting finished
{
-
+ bool close(false);
if (_file_queue_empty)
{
_post_task->remove_listener (this);
@@ -880,21 +880,19 @@ PostUI :: on_progress_finished (Progress&, int status) // posting finished
{
if (!_save_file.empty())
{
-// mut.lock();
+ mut.lock();
int no = status;
- std::cerr<<"saving to file "<<_save_file<<" from upload no. "<<no<<std::endl;
TaskUpload * ptr = _upload_queue[no];
- std::cerr<<"saving to file (mutex) "<<_save_file<<std::endl;
if (ptr) NZB :: upload_list_to_xml_file (_out, ptr->_upload_list);
--_running_uploads;
- std::cerr<<"running uploads now : "<<_running_uploads<<"\n";
if (_running_uploads==0 )
{
_out << "</nzb>\n";
_out.close();
- close_window(true);
+ close = true;
}
-// mut.unlock();
+ mut.unlock();
+ if (close) close_window(true);
}
}
@@ -1025,7 +1023,7 @@ PostUI :: maybe_post_message (GMimeMessage * message)
(*it)->add_listener(this);
_upload_listeners.push_back(*it);
}
- gtk_widget_hide (_root); // dont wait for the upload queue
+ gtk_widget_hide (_root); // hide the main window, we still need the class' data
}
/**
@@ -2793,8 +2791,7 @@ PostUI :: prompt_user_for_queueable_files (GtkWindow * parent, const Prefs& pref
? GNKSA::generate_message_id (profile.fqdn)
: GNKSA::generate_message_id_from_email_address (profile.address);
- int cnt(1);
- for (; cur; cur = cur->next, ++cnt)
+ for (; cur; cur = cur->next)
{
Article a;
a.subject = subject;
@@ -2846,7 +2843,9 @@ PostUI :: prompt_user_for_upload_nzb_dir (GtkWindow * parent, const Prefs& prefs
std::string prev_path = prefs.get_string ("default-save-attachments-path", g_get_home_dir ());
if (!file :: file_exists (prev_path.c_str()))
prev_path = g_get_home_dir ();
- std::string prev_file(_("Untitled.nzb"));
+ const char * cpch (gtk_entry_get_text (GTK_ENTRY(_subject_entry)));
+ g_snprintf(buf,sizeof(buf), "%s.nzb", cpch ? cpch : "_(Untitled)");
+ std::string prev_file(buf);
GtkWidget * w = gtk_file_chooser_dialog_new (_("Save Upload Queue as NZB File"),
GTK_WINDOW(parent),
diff --git a/pan/tasks/encoder.cc b/pan/tasks/encoder.cc
index 5aaf84e..afe8a32 100644
--- a/pan/tasks/encoder.cc
+++ b/pan/tasks/encoder.cc
@@ -180,7 +180,7 @@ Encoder :: do_work()
(char*)subject.c_str(), s.empty() ? NULL : (char*)s.c_str(), (char*)format.c_str(), agent.empty() ? NULL : (char*)agent.c_str(), 0);
if (fp) fclose(fp);
-// if (res != UURET_CONT && res != UURET_OK) break;
+ if (res != UURET_CONT && res != UURET_OK) break;
cache->finalize(it->second.message_id);
cache->get_filename(cachename, Quark(it->second.message_id));
stat (cachename, &sb);
diff --git a/pan/tasks/nzb.cc b/pan/tasks/nzb.cc
index 62f38c5..ae840de 100644
--- a/pan/tasks/nzb.cc
+++ b/pan/tasks/nzb.cc
@@ -369,6 +369,7 @@ NZB :: nzb_to_xml (std::ostream & out,
<< "<path>" << task->_filename << "</path>\n";
out << indent(depth) << "<groups>\n";
+
++depth;
foreach_const (quarks_t, task->_groups, git)
out << indent(depth) << "<group>" << *git << "</group>\n";
diff --git a/pan/tasks/task-upload.cc b/pan/tasks/task-upload.cc
index 295504c..3938a75 100644
--- a/pan/tasks/task-upload.cc
+++ b/pan/tasks/task-upload.cc
@@ -287,16 +287,15 @@ TaskUpload :: on_nntp_done (NNTP * nntp,
/* get error state for the whole upload: if one part failed, set global status to error */
bool error(false);
foreach_const (std::deque<Log::Entry>, _logfile, it)
- error = (it->severity == Log :: PAN_SEVERITY_ERROR);
+ if (it->severity == Log :: PAN_SEVERITY_ERROR) error = true;
if (!error)
g_snprintf(buf,sizeof(buf), _("Posting of file %s succesful: %s"),
_basename.c_str(), response.str);
else
- g_snprintf(buf,sizeof(buf), _("Posting of file %s not completely successful: Check the popup log!"),
+ g_snprintf(buf,sizeof(buf), _("Posting of file %s not completely successful: Check the log (right-click on list item) !"),
_basename.c_str(), response.str);
tmp.message = buf;
- _logfile.push_back(tmp);
Log::add_entry_list (tmp, _logfile);
_logfile.clear();
}
@@ -309,7 +308,7 @@ TaskUpload :: on_nntp_done (NNTP * nntp,
this->stop();
Log::add_entry_list (tmp, _logfile);
_logfile.clear();
- Log :: add_err_va (_("Posting of file %s not successful: Check the popup log!"),
+ Log :: add_err_va (_("Posting of file %s not successful: Check the log (right-click on list item) !"),
_basename.c_str(), response.str);
break;
}
@@ -361,7 +360,7 @@ TaskUpload :: use_encoder (Encoder* encoder)
format_s << " (%d/%d) yEnc"; // will be filled in by uuencode
std::string format(format_s.str());
_encoder->enqueue (this, &_cache, &_article, _filename, _basename,
- groups, _subject, _author, _agent, format , _domain, YENC);
+ groups, _subject, _author, _agent, format, _domain, YENC);
debug ("encoder thread was free, enqueued work");
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]