[pan2/testing: 213/279] - a few fixes - corrected profiles dialog (cancel) - removed plaintext encode mode (doesn't make any
- From: Heinrich MÃller <henmull src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pan2/testing: 213/279] - a few fixes - corrected profiles dialog (cancel) - removed plaintext encode mode (doesn't make any
- Date: Sat, 3 Dec 2011 22:39:29 +0000 (UTC)
commit 91b5ad5b2b1f51be37cbb0a8672a58ea19bda695
Author: Heinrich MÃller <sphemuel stud informatik uni-erlangen de>
Date: Sun Oct 9 16:23:54 2011 +0200
- a few fixes
- corrected profiles dialog (cancel)
- removed plaintext encode mode (doesn't make any real sense for now)
pan/gui/post-ui.cc | 116 +++++++++++++++++++++----------------------
pan/gui/post-ui.h | 9 ++--
pan/gui/post.ui.h | 6 +--
pan/gui/profiles-dialog.cc | 3 +-
pan/tasks/encoder.cc | 19 +------
pan/tasks/encoder.h | 6 +--
pan/tasks/task-upload.cc | 16 +++---
pan/tasks/task-upload.h | 44 ++++++----------
8 files changed, 92 insertions(+), 127 deletions(-)
---
diff --git a/pan/gui/post-ui.cc b/pan/gui/post-ui.cc
index 3c6e174..d4a516d 100644
--- a/pan/gui/post-ui.cc
+++ b/pan/gui/post-ui.cc
@@ -173,28 +173,27 @@ PostUI:: update_filequeue_label (GtkTreeSelection *selection)
****
***/
-/* only used if the encode mode has changed, would be too expensive for repetitive calls */
-void
-PostUI :: update_filequeue_tab()
-{
- GtkListStore *store = GTK_LIST_STORE(
- gtk_tree_view_get_model(GTK_TREE_VIEW(_filequeue_store)));
- gtk_list_store_clear(store);
- GtkTreeIter iter;
- int i(0);
- TaskUpload * task;
- while (task = dynamic_cast<TaskUpload*>(_upload_queue[i++]))
- {
- gtk_list_store_insert (store, &iter, i);
- gtk_list_store_set (store, &iter,
- 0, i+1,
- 1, task->_subject.c_str(),
- 2, task,
- 3, task->_bytes/1024,
- 4, task->encode_mode().c_str(),
- -1);
- }
-}
+//* only used if the encode mode has changed, would be too expensive for repetitive calls */
+//void
+//PostUI :: update_filequeue_tab()
+//{
+// GtkListStore *store = GTK_LIST_STORE(
+// gtk_tree_view_get_model(GTK_TREE_VIEW(_filequeue_store)));
+// gtk_list_store_clear(store);
+// GtkTreeIter iter;
+// int i(0);
+// TaskUpload * task;
+// while (task = dynamic_cast<TaskUpload*>(_upload_queue[i++]))
+// {
+// gtk_list_store_insert (store, &iter, i);
+// gtk_list_store_set (store, &iter,
+// 0, i+1,
+// 1, task->_subject.c_str(),
+// 2, task,
+// 3, task->_bytes/1024
+// -1);
+// }
+//}
void
PostUI :: on_queue_tasks_added (UploadQueue& queue, int index, int count)
@@ -214,8 +213,7 @@ PostUI :: on_queue_tasks_added (UploadQueue& queue, int index, int count)
0, pos+1,
1, task->_subject.c_str(),
2, task,
- 3, task->_bytes/1024,
- 4, task->encode_mode().c_str(),
+ 3, task->_bytes/1024.0f,
-1);
}
@@ -405,7 +403,7 @@ namespace
void do_move_down (GtkAction*, gpointer p) { static_cast<PostUI*>(p)->move_down(); }
void do_move_top (GtkAction*, gpointer p) { static_cast<PostUI*>(p)->move_top(); }
void do_move_bottom (GtkAction*, gpointer p) { static_cast<PostUI*>(p)->move_bottom(); }
- void do_select_encode (GtkAction* a, gpointer p) { static_cast<PostUI*>(p)->select_encode(a); }
+// void do_select_encode (GtkAction* a, gpointer p) { static_cast<PostUI*>(p)->select_encode(a); }
GtkActionEntry filequeue_popup_entries[] =
{
@@ -443,17 +441,17 @@ namespace
{ "move-bottom", NULL,
N_("Move to Bottom"), "",
N_("Move to Bottom"),
- G_CALLBACK(do_move_bottom) },
-
- { "yenc", NULL,
- N_("yEnc-Encode"), "",
- N_("yEnc-Encode"),
- G_CALLBACK(do_select_encode) },
-
- { "plain", NULL,
- N_("No encoding (plain)"), "",
- N_("No encoding (plain)"),
- G_CALLBACK(do_select_encode) }
+ G_CALLBACK(do_move_bottom) }
+
+// { "yenc", NULL,
+// N_("yEnc-Encode"), "",
+// N_("yEnc-Encode"),
+// G_CALLBACK(do_select_encode) },
+//
+// { "plain", NULL,
+// N_("No encoding (plain)"), "",
+// N_("No encoding (plain)"),
+// G_CALLBACK(do_select_encode) }
};
@@ -2498,7 +2496,7 @@ PostUI :: create_filequeue_tab ()
gtk_box_pack_start (GTK_BOX(vbox), gtk_hseparator_new(), false, false, 0);
//add filestore
- list_store = gtk_list_store_new (5, G_TYPE_UINT, G_TYPE_STRING, G_TYPE_POINTER, G_TYPE_UINT, G_TYPE_STRING);
+ list_store = gtk_list_store_new (4, G_TYPE_UINT, G_TYPE_STRING, G_TYPE_POINTER, G_TYPE_FLOAT);
w = _filequeue_store = gtk_tree_view_new_with_model (GTK_TREE_MODEL(list_store));
// add columns
@@ -2511,8 +2509,8 @@ PostUI :: create_filequeue_tab ()
gtk_tree_view_insert_column_with_data_func(t, 2, (_("Filename")), renderer, render_filename, 0, 0);
renderer = gtk_cell_renderer_text_new ();
gtk_tree_view_insert_column_with_attributes (t, 3, (_("Size (kB)")),renderer,"text", 3,NULL);
- renderer = gtk_cell_renderer_text_new ();
- gtk_tree_view_insert_column_with_attributes (t, 4, (_("Encode Mode")),renderer,"text", 4,NULL);
+// renderer = gtk_cell_renderer_text_new ();
+// gtk_tree_view_insert_column_with_attributes (t, 4, (_("Encode Mode")),renderer,"text", 4,NULL);
// connect signals for popup menu
g_signal_connect (w, "popup-menu", G_CALLBACK(on_popup_menu), this);
@@ -2801,26 +2799,26 @@ PostUI :: move_bottom (void)
_upload_queue.move_bottom (get_selected_files());
}
-void
-PostUI :: select_encode (GtkAction* a)
-{
- tasks_t tasks = get_selected_files();
- const gchar* name = gtk_action_get_name(a);
-
- TaskUpload::EncodeMode tmp;
- if (!strcmp(name, "yenc"))
- tmp = TaskUpload::YENC;
- if (!strcmp(name, "plain"))
- tmp = TaskUpload::PLAIN;
-
- struct stat sb;
- foreach(tasks_t, tasks, it)
- {
- TaskUpload * tmp2 (dynamic_cast<TaskUpload*>(*it));
- if (tmp2) tmp2->_encode_mode = tmp;
- }
- update_filequeue_tab();
-}
+//void
+//PostUI :: select_encode (GtkAction* a)
+//{
+// tasks_t tasks = get_selected_files();
+// const gchar* name = gtk_action_get_name(a);
+//
+// TaskUpload::EncodeMode tmp;
+// if (!strcmp(name, "yenc"))
+// tmp = TaskUpload::YENC;
+// if (!strcmp(name, "plain"))
+// tmp = TaskUpload::PLAIN;
+//
+// struct stat sb;
+// foreach(tasks_t, tasks, it)
+// {
+// TaskUpload * tmp2 (dynamic_cast<TaskUpload*>(*it));
+// if (tmp2) tmp2->_encode_mode = tmp;
+// }
+// update_filequeue_tab();
+//}
int
PostUI :: get_total_parts(const char* file)
diff --git a/pan/gui/post-ui.h b/pan/gui/post-ui.h
index 94a96b6..103ef9d 100644
--- a/pan/gui/post-ui.h
+++ b/pan/gui/post-ui.h
@@ -94,7 +94,7 @@ namespace pan
void move_down ();
void move_top ();
void move_bottom ();
- void select_encode (GtkAction*);
+// void select_encode (GtkAction*); deactivated for now
static void do_popup_menu (GtkWidget*, GdkEventButton *event, gpointer pane_g);
static gboolean on_button_pressed (GtkWidget * treeview, GdkEventButton *event, gpointer userdata);
@@ -188,12 +188,11 @@ namespace pan
GtkWidget* create_filequeue_status_bar ();
GtkWidget * _filequeue_eventbox;
GtkWidget * _filequeue_label;
- void update_filequeue_label (GtkTreeSelection *selection=NULL);
+ void update_filequeue_label (GtkTreeSelection *selection=0);
GtkWidget* create_parts_tab ();
- GtkWidget* create_log_tab ();
-
- void update_filequeue_tab();
+// GtkWidget* create_log_tab ();
+// void update_filequeue_tab();
private:
std::string utf8ize (const StringView&) const;
diff --git a/pan/gui/post.ui.h b/pan/gui/post.ui.h
index 3deb479..d873cb1 100644
--- a/pan/gui/post.ui.h
+++ b/pan/gui/post.ui.h
@@ -1,3 +1,4 @@
+// " <menuitem action='wrapselected' />\n" doesnt exist yet, so deactivated for now....
const char * fallback_post_ui =
"<ui>\n"
" <menubar name='post'>\n"
@@ -25,7 +26,6 @@ const char * fallback_post_ui =
" <menuitem action='always-run-editor' />\n"
" <separator />\n"
" <menuitem action='wrap' />\n"
-" <menuitem action='wrapselected' />\n"
" <menuitem action='spellcheck' />\n"
" <separator />\n"
" <menuitem action='manage-profiles' />\n"
@@ -58,10 +58,6 @@ const char * fallback_post_ui =
" <separator />\n"
" <menuitem action='move-top' />\n"
" <menuitem action='move-bottom' />\n"
-" <separator />\n"
-" <menuitem action='yenc' />\n"
-" <menuitem action='plain' />\n"
-" <separator />\n"
" </popup>\n"
"\n"
"</ui>\n";
diff --git a/pan/gui/profiles-dialog.cc b/pan/gui/profiles-dialog.cc
index 84cf25b..d2496ce 100644
--- a/pan/gui/profiles-dialog.cc
+++ b/pan/gui/profiles-dialog.cc
@@ -233,7 +233,8 @@ ProfileDialog :: run_until_valid_or_cancel (ProfileDialog& pd)
{
const int response (gtk_dialog_run (GTK_DIALOG(pd.root())));
- if (response == GTK_RESPONSE_CANCEL)
+ /* abort profile creation on cancel and closing of the window */
+ if (response == GTK_RESPONSE_CANCEL || response == GTK_RESPONSE_DELETE_EVENT)
return false;
std::string name;
diff --git a/pan/tasks/encoder.cc b/pan/tasks/encoder.cc
index 1a10dbd..024425f 100644
--- a/pan/tasks/encoder.cc
+++ b/pan/tasks/encoder.cc
@@ -66,8 +66,7 @@ Encoder :: enqueue (TaskUpload * task,
std::string & filename,
std::string & basename,
std::string & subject,
- int bpf,
- const TaskUpload::EncodeMode enc)
+ int bpf)
{
disable_progress_update ();
@@ -75,7 +74,6 @@ Encoder :: enqueue (TaskUpload * task,
this->task = task;
this->basename = basename;
this->filename = filename;
- this->encode_mode = enc;
this->needed = &task->_needed;
this->cache = cache;
this->article = article;
@@ -152,18 +150,6 @@ Encoder :: do_work()
int enc(YENC_ENCODED);
std::ofstream out;
std::ifstream in;
- switch (encode_mode)
- {
- case TaskUpload::YENC:
- enc = YENC_ENCODED;
- break;
- case TaskUpload::PLAIN:
- enc = PT_ENCODED;
- break;
- default:
- enc = YENC_ENCODED;
- break;
- }
fp = cache->get_fp_from_mid(it->second.message_id);
if (!fp)
@@ -173,10 +159,9 @@ Encoder :: do_work()
continue;
}
- res = UUEncodePartial_byFSize (fp, NULL, (char*)filename.c_str(), enc , (char*)basename.c_str(), 0, 0, cnt, bpf ,&crc);
+ res = UUEncodePartial_byFSize (fp, NULL, (char*)filename.c_str(), YENC_ENCODED , (char*)basename.c_str(), 0, 0, cnt, bpf ,&crc);
if (fp) fclose(fp);
-_no_encode:
if (res != UURET_CONT && res != UURET_OK) break;
cache->finalize(it->second.message_id);
cache->get_filename(cachename, Quark(it->second.message_id));
diff --git a/pan/tasks/encoder.h b/pan/tasks/encoder.h
index e41163a..895360a 100644
--- a/pan/tasks/encoder.h
+++ b/pan/tasks/encoder.h
@@ -41,7 +41,7 @@ extern "C" {
namespace pan
{
/**
- * Encodes attachments (yEnc, MIME PT) for posting to usenet groups.
+ * Encodes attachments (yEnc) for posting to usenet groups.
*
* @author Heinrich Mueller <eddie_v gmx de>
* @author Calin Culianu <calin ajvar org>
@@ -66,8 +66,7 @@ namespace pan
std::string & filename,
std::string & basename,
std::string & subject,
- int bpf,
- const TaskUpload::EncodeMode enc = TaskUpload::YENC);
+ int bpf);
public:
@@ -83,7 +82,6 @@ namespace pan
friend class TaskUpload;
int parts;
TaskUpload * task;
- TaskUpload::EncodeMode encode_mode;
std::string basename, filename, subject;
int bpf;
EncodeCache * cache;
diff --git a/pan/tasks/task-upload.cc b/pan/tasks/task-upload.cc
index 71f26cf..c4a0c4e 100644
--- a/pan/tasks/task-upload.cc
+++ b/pan/tasks/task-upload.cc
@@ -87,8 +87,7 @@ TaskUpload :: TaskUpload (const std::string & filename,
Article article,
UploadInfo format,
GMimeMessage * msg,
- Progress::Listener * listener,
- const TaskUpload::EncodeMode enc):
+ Progress::Listener * listener):
Task ("UPLOAD", get_description(filename.c_str())),
_filename(filename),
_basename (g_get_basename(filename.c_str())),
@@ -99,7 +98,6 @@ TaskUpload :: TaskUpload (const std::string & filename,
_author(article.author.to_string()),
_encoder(0),
_encoder_has_run (false),
- _encode_mode(enc),
_all_bytes(0),
_bpf(format.bpf),
_queue_pos(0),
@@ -123,13 +121,13 @@ TaskUpload :: TaskUpload (const std::string & filename,
namespace
{
- const char * build_subject_line (char* buf, int size, std::string& s, std::string& n, int p, int tp, TaskUpload::EncodeMode em)
+ const char * build_subject_line (char* buf, int size, std::string& s, std::string& n, int p, int tp)
{
if (tp != 1)
- g_snprintf(buf, size,"%s - \"%s\" %s (%03d/%03d)", s.c_str(), n.c_str(), em == TaskUpload::YENC ? "yEnc" : "", p, tp );
+ g_snprintf(buf, size,"%s - \"%s\" yEnc (%03d/%03d)", s.c_str(), n.c_str(), p, tp );
else
- g_snprintf(buf, size,"%s - \"%s\" %s", s.c_str(), n.c_str(), em == TaskUpload::YENC ? "yEnc" : "");
+ g_snprintf(buf, size,"%s - \"%s\" yEnc", s.c_str(), n.c_str());
return buf;
}
@@ -147,7 +145,7 @@ TaskUpload :: build_needed_tasks()
/* build new master subject */
char buf[4096];
- _master_subject = build_subject_line (buf, 4096, _subject, _basename, 1, _total_parts, _encode_mode);
+ _master_subject = build_subject_line (buf, 4096, _subject, _basename, 1, _total_parts);
}
void
@@ -201,7 +199,7 @@ TaskUpload :: prepend_headers(GMimeMessage* msg, TaskUpload::Needed * n, std::st
//modify subject
char buf[4096];
if (_queue_pos != -1)
- g_mime_message_set_subject (msg, build_subject_line (buf, 4096, _subject, _basename, n->partno, _total_parts, _encode_mode));
+ g_mime_message_set_subject (msg, build_subject_line (buf, 4096, _subject, _basename, n->partno, _total_parts));
//modify references header
std::string mids(_references);
@@ -411,7 +409,7 @@ TaskUpload :: use_encoder (Encoder* encoder)
init_steps(100);
_state.set_working();
- _encoder->enqueue (this, &_cache, &_article, _filename, _basename, _master_subject, _bpf, _encode_mode);
+ _encoder->enqueue (this, &_cache, &_article, _filename, _basename, _master_subject, _bpf);
debug ("encoder thread was free, enqueued work");
}
diff --git a/pan/tasks/task-upload.h b/pan/tasks/task-upload.h
index 73362c9..2be4800 100644
--- a/pan/tasks/task-upload.h
+++ b/pan/tasks/task-upload.h
@@ -85,12 +85,6 @@ namespace pan
typedef std::map<int, Needed> needed_t;
- enum EncodeMode
- {
- PLAIN,
- YENC
- };
-
// life cycle
TaskUpload ( const std::string & filename,
const Quark & server,
@@ -98,8 +92,7 @@ namespace pan
Article article,
UploadInfo format,
GMimeMessage * msg=0,
- Progress::Listener * listener= 0,
- const EncodeMode enc= YENC);
+ Progress::Listener * listener= 0);
virtual ~TaskUpload ();
@@ -107,24 +100,22 @@ namespace pan
unsigned long get_bytes_remaining () const;
void stop ();
const std::string& get_basename() { return _basename; }
- std::string enc_mode_to_str(EncodeMode& e)
- {
- std::string res;
- switch (e)
- {
- case YENC:
- res += "yEnc";
- break;
- case PLAIN:
- break;
- default:
- res += "yEnc";
- break;
- }
- return res;
- }
-
- std::string encode_mode() { return enc_mode_to_str(_encode_mode); }
+// std::string enc_mode_to_str(EncodeMode& e)
+// {
+// std::string res;
+// switch (e)
+// {
+// case YENC:
+// res += "yEnc";
+// break;
+// case PLAIN:
+// break;
+// default:
+// res += "yEnc";
+// break;
+// }
+// return res;
+// }
/** only call this for tasks in the NEED_ENCODE state
* attempts to acquire the encoder thread and start encoding
@@ -158,7 +149,6 @@ namespace pan
bool _encoder_has_run;
std::string _filename;
std::string _basename;
- EncodeMode _encode_mode;
std::string _subject, _master_subject, _author;
std::string _save_file;
int _total_parts, _needed_parts;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]