[pan2/testing: 185/279] [+] added xface header input line to posting profiles
- From: Heinrich MÃller <henmull src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pan2/testing: 185/279] [+] added xface header input line to posting profiles
- Date: Sat, 3 Dec 2011 22:37:43 +0000 (UTC)
commit d423bf78fb149a7816be13c871e0e082db711461
Author: Heinrich MÃller <sphemuel stud informatik uni-erlangen de>
Date: Tue Jul 26 16:02:48 2011 +0200
[+] added xface header input line to posting profiles
pan/data-impl/profiles.cc | 10 ++++++----
pan/data/data.h | 1 +
pan/gui/post-ui.cc | 22 +++++++++++-----------
pan/gui/profiles-dialog.cc | 15 ++++++++++++---
pan/gui/profiles-dialog.h | 1 +
pan/gui/task-pane.cc | 8 ++++----
6 files changed, 35 insertions(+), 22 deletions(-)
---
diff --git a/pan/data-impl/profiles.cc b/pan/data-impl/profiles.cc
index fb88033..3ad36b3 100644
--- a/pan/data-impl/profiles.cc
+++ b/pan/data-impl/profiles.cc
@@ -84,7 +84,7 @@ namespace
mc.profile_name = *v;
if (!mc.profile_name.empty())
mc.profiles[mc.profile_name].clear ();
- }
+ }
if ((element_name == "signature_file") && !mc.profile_name.empty()) {
Profile& p (mc.profiles[mc.profile_name]);
@@ -116,6 +116,7 @@ namespace
if (element_name == "signature_file") p.signature_file.assign (t.str, t.len);
else if (element_name == "attribution") p.attribution.assign (t.str, t.len);
else if (element_name == "fqdn") p.fqdn.assign (t.str, t.len);
+ else if (element_name == "xface") p.xface.assign (t.str, t.len);
else if (element_name == "username") p.username.assign (t.str, t.len);
else if (element_name == "address") p.address.assign (t.str, t.len);
else if (element_name == "server") p.posting_server = t;
@@ -127,7 +128,7 @@ namespace
void text (GMarkupParseContext *context UNUSED,
const gchar *text,
- gsize text_len,
+ gsize text_len,
gpointer user_data,
GError **error UNUSED)
{
@@ -186,8 +187,8 @@ void
ProfilesImpl :: serialize (std::ostream& out) const
{
int depth (0);
-
- // xml header...
+
+ // xml header...
out << "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n";
out << indent(depth++) << "<posting>\n";
@@ -198,6 +199,7 @@ ProfilesImpl :: serialize (std::ostream& out) const
out << indent(depth) << "<username>" << escaped(it->second.username) << "</username>\n";
out << indent(depth) << "<address>" << escaped(it->second.address) << "</address>\n";
out << indent(depth) << "<server>" << escaped(it->second.posting_server.to_view()) << "</server>\n";
+ out << indent(depth) << "<xface>" << escaped(it->second.xface) << "</xface>\n";
if (!it->second.signature_file.empty()) {
const char * type;
switch (it->second.sig_type) {
diff --git a/pan/data/data.h b/pan/data/data.h
index 9ed005f..5aad9f1 100644
--- a/pan/data/data.h
+++ b/pan/data/data.h
@@ -94,6 +94,7 @@ namespace pan
std::string signature_file;
std::string attribution;
std::string fqdn;
+ std::string xface;
Quark posting_server;
void get_from_header (std::string& s) const {
diff --git a/pan/gui/post-ui.cc b/pan/gui/post-ui.cc
index e939ecf..4ad9707 100644
--- a/pan/gui/post-ui.cc
+++ b/pan/gui/post-ui.cc
@@ -312,6 +312,7 @@ PostUI :: set_spellcheck_enabled (bool enabled)
std::string
PostUI :: get_body () const
{
+ std::cerr<<"get body\n";
std::string body;
GtkTextBuffer * buf (_body_buf);
GtkTextView * view (GTK_TEXT_VIEW(_body_view));
@@ -656,7 +657,7 @@ namespace
{
gboolean delete_event_cb (GtkWidget*, GdkEvent*, gpointer user_data)
{
- static_cast<PostUI*>(user_data)->close_window ();
+ static_cast<PostUI*>(user_data)->close_window (true);
return true; // don't invoke the default handler that destroys the widget
}
@@ -692,7 +693,7 @@ PostUI :: close_window (bool flag)
gtk_widget_destroy (d);
}
- int w,h;
+ int w(450),h(450);
gtk_window_get_size( GTK_WINDOW(_root), &w, &h);
std::cerr<<"post ui sizes: "<<w<<" "<<h<<std::endl;
_prefs.set_int("post-ui-width", w);
@@ -850,7 +851,7 @@ PostUI :: done_sending_message (GMimeMessage * message, bool ok)
{
if (ok) {
_unchanged_body = get_body ();
- close_window ();
+ close_window (true);
}
g_object_unref (G_OBJECT(message));
@@ -945,7 +946,6 @@ PostUI :: on_progress_finished (Progress&, int status) // posting finished
done_sending_message (message, false);
else
maybe_mail_message (message);
- close_window(true);
} else
{
--_running_uploads;
@@ -1079,8 +1079,6 @@ PostUI :: maybe_post_message (GMimeMessage * message)
if (master_reply)
{
-// std::cerr<<"adding master reply to queue\n";
-
// master article, other attachments are threaded as replies to this
const Profile profile (get_current_profile ());
std::string out;
@@ -1107,8 +1105,6 @@ PostUI :: maybe_post_message (GMimeMessage * message)
if (!inline_or_bulk) // bulk upload
{
-// std::cerr<<"adding "<<tasks.size()<<" tasks."<<std::endl;
-
foreach (PostUI::tasks_t, tasks, it)
{
@@ -1484,6 +1480,10 @@ PostUI :: new_message_from_ui (Mode mode, bool copy_body)
if (!replyto.empty())
g_mime_object_set_header ((GMimeObject *) msg, "Reply-To", replyto.str);
+ // headers from posting profile(via prefs): X-Face
+ if (!profile.xface.empty())
+ g_mime_object_set_header ((GMimeObject *) msg, "X-Face", profile.xface.c_str());
+
// add the 'hidden headers'
foreach_const (str2str_t, _hidden_headers, it)
if ((mode==DRAFTING) || (it->first.find ("X-Draft-")!=0))
@@ -2320,7 +2320,7 @@ PostUI :: body_changed_cb (GtkEditable*, gpointer ui_gpointer)
PostUI * ui (static_cast<PostUI*>(ui_gpointer));
unsigned int& tag (ui->_body_changed_idle_tag);
if (!tag)
- tag = g_timeout_add (2000, body_changed_idle, ui);
+ tag = g_timeout_add (5000, body_changed_idle, ui);
}
/***
@@ -2492,7 +2492,7 @@ namespace
{
GtkTreePath * path = gtk_tree_model_get_path ( model , iter ) ;
- int cnt = gtk_tree_path_get_indices ( path )[0]+1 ;
+ int cnt (gtk_tree_path_get_indices ( path )[0]+1) ;
std::string tmp;
char buf[256];
g_snprintf(buf,sizeof(buf),"%d",cnt);
@@ -3057,7 +3057,7 @@ PostUI :: PostUI (GtkWindow * parent,
gtk_window_set_role (GTK_WINDOW(_root), "pan-post-window");
gtk_window_set_title (GTK_WINDOW(_root), _("Post Article"));
int w,h;
- w = _prefs.get_int("post-ui-width", -1);
+ w = _prefs.get_int("post-ui-width", 450);
h = _prefs.get_int("post-ui-height", 450);
gtk_window_set_default_size (GTK_WINDOW(_root), w, h);
g_object_set_data_full (G_OBJECT(_root), "post-ui", this, delete_post_ui);
diff --git a/pan/gui/profiles-dialog.cc b/pan/gui/profiles-dialog.cc
index 0b5da19..84cf25b 100644
--- a/pan/gui/profiles-dialog.cc
+++ b/pan/gui/profiles-dialog.cc
@@ -77,7 +77,7 @@ namespace
int port;
std::string addr;
data.get_server_addr (server, addr, port);
-
+
GtkTreeIter iter;
gtk_list_store_append (store, &iter);
gtk_list_store_set (store, &iter, 0, addr.c_str(), 1, server.c_str(), -1);
@@ -102,7 +102,7 @@ ProfileDialog :: ProfileDialog (const Data & data,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_APPLY, GTK_RESPONSE_OK,
NULL);
- gtk_dialog_set_default_response (GTK_DIALOG(_root), GTK_RESPONSE_OK);
+ gtk_dialog_set_default_response (GTK_DIALOG(_root), GTK_RESPONSE_OK);
gtk_window_set_role (GTK_WINDOW(_root), "pan-edit-profile-dialog");
int row (0);
@@ -158,12 +158,20 @@ ProfileDialog :: ProfileDialog (const Data & data,
HIG :: workarea_add_row (t, &row, _("Signature _Type:"), w);
HIG :: workarea_add_section_divider (t, &row);
+ HIG :: workarea_add_section_title (t, &row, _("X-Face (Avatar)"));
+ w = _xface_entry = gtk_entry_new ();
+ set_entry (w, profile.xface);
+ gtk_widget_set_tooltip_markup (w, _("You can add an avatar icon to your postings with a unique X-Face code. \n\
+Add the code without the trailing <b>\"X-Face:\"</b> \n if it was generated by a helper program (for example : http://www.dairiki.org/xface/xface.php)."));
+ HIG :: workarea_add_row (t, &row, _("_X-Face:"), w, NULL);
+ HIG :: workarea_add_section_divider (t, &row);
HIG :: workarea_add_section_title (t, &row, _("Optional Information"));
HIG :: workarea_add_section_spacer (t, row, 3);
w = _msgid_fqdn_entry = gtk_entry_new ();
set_entry (w, profile.fqdn);
- gtk_widget_set_tooltip_text (w, _("When posting to Usenet, your article's Message-ID contains a domain name. You can set a custom domain name here, or leave it blank to let Pan use the domain name from your email address."));
+ gtk_widget_set_tooltip_text (w, _("When posting to Usenet, your article's Message-ID contains a domain name. \n\
+You can set a custom domain name here, or leave it blank to let Pan use the domain name from your email address."));
HIG :: workarea_add_row (t, &row, _("Message-ID _Domain Name:"), w, NULL);
w = _attribution_entry = gtk_entry_new ();
@@ -258,6 +266,7 @@ ProfileDialog :: get_profile (std::string& profile_name, Profile& profile)
from_entry (_username_entry, profile.username);
from_entry (_address_entry, profile.address);
from_entry (_msgid_fqdn_entry, profile.fqdn);
+ from_entry (_xface_entry, profile.xface);
from_entry (_attribution_entry, profile.attribution);
profile.use_sigfile = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(_signature_file_check));
diff --git a/pan/gui/profiles-dialog.h b/pan/gui/profiles-dialog.h
index 74c4c64..44ce27c 100644
--- a/pan/gui/profiles-dialog.h
+++ b/pan/gui/profiles-dialog.h
@@ -43,6 +43,7 @@ namespace pan
GtkWidget * _username_entry;
GtkWidget * _address_entry;
GtkWidget * _msgid_fqdn_entry;
+ GtkWidget * _xface_entry;
GtkWidget * _attribution_entry;
GtkWidget * _signature_file_check;
GtkWidget * _signature_file;
diff --git a/pan/gui/task-pane.cc b/pan/gui/task-pane.cc
index 9d87960..d6a6224 100644
--- a/pan/gui/task-pane.cc
+++ b/pan/gui/task-pane.cc
@@ -142,8 +142,8 @@ TaskPane:: on_tooltip_query(GtkWidget *widget,
date = date_maker.get_date_string (tu->get_article().time_posted);
g_snprintf(buffer,sizeof(buffer),
_("\
-\n<u>Upload</u>\n\n<i>Subject:</i> <b>\"%s\"</b>,\n<i>From:</i> <b>%s</b>,\n\
-<i>Groups:</i> <b>%s</b>,\n<i>Sourcefile:</i> <b>%s</b>\n"),
+\n<u>Upload</u>\n\n<i>Subject:</i> <b>\"%s\"</b>\n<i>From:</i> <b>%s</b>\n\
+<i>Groups:</i> <b>%s</b>\n<i>Sourcefile:</i> <b>%s</b>\n"),
a.subject.to_string().c_str(), escaped(a.author.to_string()).c_str(),
tu->get_groups().c_str(), tu->get_filename().c_str());
}
@@ -155,8 +155,8 @@ TaskPane:: on_tooltip_query(GtkWidget *widget,
date = date_maker.get_date_string (ta->get_article().time_posted);
g_snprintf(buffer,sizeof(buffer),
_("\
-\n<u>Download</u>\n\n<i>Subject:</i> <b>\"%s\"</b>, \n<i>From:</i> <b>%s</b>,\n<i>Date:</i> <b>%s</b>,\n\
-<i>Groups:</i> <b>%s</b>, \n<i>Save Path:</i> <b>%s</b>\n"),
+\n<u>Download</u>\n\n<i>Subject:</i> <b>\"%s\"</b>\n<i>From:</i> <b>%s</b>\n<i>Date:</i> <b>%s</b>\n\
+<i>Groups:</i> <b>%s</b>\n<i>Save Path:</i> <b>%s</b>\n"),
a.subject.to_string().c_str(), escaped(a.author.to_string()).c_str(), date ? date : _("unknown"),
ta->get_groups().c_str(), ta->get_save_path().to_string().c_str());
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]