[Xfce4-commits] <postler:master> Fallback to selected account for choosing from
Christian Dywan
noreply at xfce.org
Wed Jan 12 03:42:02 CET 2011
Updating branch refs/heads/master
to 4bbd22184ed0a07ff3527efa773ff7e46efdebd9 (commit)
from 3f61640a99d3fc4ad7bbe0b563d9ec5b843e72c6 (commit)
commit 4bbd22184ed0a07ff3527efa773ff7e46efdebd9
Author: Christian Dywan <christian at twotoasts.de>
Date: Tue Jan 11 23:59:42 2011 +0100
Fallback to selected account for choosing from
postler/postler-bureau.vala | 9 ++++++++-
postler/postler-content.vala | 10 ++++++----
2 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/postler/postler-bureau.vala b/postler/postler-bureau.vala
index 95c7429..b042495 100644
--- a/postler/postler-bureau.vala
+++ b/postler/postler-bureau.vala
@@ -104,9 +104,16 @@ public class Postler.Bureau : Gtk.Window {
}
void compose_message (string? prefix=null, string? recipient=null, int part=0) {
+ string? chosen_from = content.choose_from ();
+ if (chosen_from == null) {
+ if (messages.account_info != null)
+ chosen_from = messages.account_info.address;
+ else
+ chosen_from = "";
+ }
Postler.App.spawn_module ("compose", (recipient != null ? recipient : "")
+ (prefix != null ? "?subject=" + prefix + content.subject : "")
- + "&from=" + content.choose_from () + "&part=" + part.to_string (),
+ + "&from=" + chosen_from + "&part=" + part.to_string (),
prefix != null ? content.last_location : null);
}
diff --git a/postler/postler-content.vala b/postler/postler-content.vala
index f60d191..bbcc2d4 100644
--- a/postler/postler-content.vala
+++ b/postler/postler-content.vala
@@ -561,7 +561,7 @@ public class Postler.Content : WebKit.WebView {
load_string (body.str, mime_type, charset, "about:blank");
}
- public string choose_from () {
+ public string? choose_from () {
/* See if recipient is among the accounts, otherwise pick a fallback */
if (recipient != null) {
string from = Postler.Messages.parse_address (recipient)[1];
@@ -572,7 +572,7 @@ public class Postler.Content : WebKit.WebView {
}
if (selected_account != null && selected_account.address != null)
return selected_account.address.split (",")[0];
- return "";
+ return null;
}
void parse_message (string location) throws GLib.FileError {
@@ -686,8 +686,10 @@ public class Postler.Content : WebKit.WebView {
/* Linkify From, To and Reply-To */
/* FIXME: Use raw subject for argument? */
/* TODO: Show addressbook icons beside addresses */
- string arguments = "?from=" + html_escape (choose_from ())
- + "&subject=Re: " + subject;
+ string arguments = "?subject=Re: " + subject;
+ string? chosen_from = choose_from ();
+ if (chosen_from != null)
+ arguments += "?from=" + html_escape (chosen_from);
sender = linkify_address (from, arguments);
if (recipient != "")
recipient = linkify_address (recipient, arguments);
More information about the Xfce4-commits
mailing list