[Xfce4-commits] <postler:master> Remove Reply and Forward from bureau toolbar
Christian Dywan
noreply at xfce.org
Sat Jul 2 17:08:01 CEST 2011
Updating branch refs/heads/master
to 60b57d7cca761b2df2fd968f4a0792b7443b4224 (commit)
from dbef54ed64f0de435a292a90d8830316bb2ea409 (commit)
commit 60b57d7cca761b2df2fd968f4a0792b7443b4224
Author: Christian Dywan <christian at twotoasts.de>
Date: Fri Jul 1 00:01:59 2011 +0200
Remove Reply and Forward from bureau toolbar
Make Reply All decide who to reply to.
Always prefer reply_to over sender.
Don't propagate the location, we do have the message id.
postler/postler-bureau.vala | 54 ++++--------------------------------------
postler/postler-content.vala | 44 ++++++++++++++++++++++++----------
2 files changed, 36 insertions(+), 62 deletions(-)
diff --git a/postler/postler-bureau.vala b/postler/postler-bureau.vala
index 3fcd54f..844c38a 100644
--- a/postler/postler-bureau.vala
+++ b/postler/postler-bureau.vala
@@ -75,9 +75,7 @@ public class Postler.Bureau : Gtk.Window {
<toolitem action="MailReceive"/>
<toolitem action="MessageNew"/>
<separator/>
- <toolitem action="MessageReply"/>
<toolitem action="MessageReplyAll"/>
- <toolitem action="MessageForward"/>
<separator/>
<toolitem action="MessageArchive"/>
<toolitem action="MessageJunk"/>
@@ -112,51 +110,15 @@ public class Postler.Bureau : Gtk.Window {
content.compose_message ();
}
- unowned string? list_or_sender (string reply_to) {
- if (content.list_post == null)
- return reply_to;
-
- Gtk.MessageDialog dialog;
-
- if (content.list_post.has_prefix ("NO ")) {
- dialog = new Gtk.MessageDialog (this, 0,
- Gtk.MessageType.WARNING, Gtk.ButtonsType.NONE,
- _("This message was sent to a mailing list."));
- dialog.format_secondary_text (_("Replying is not allowed."));
- dialog.add_buttons (_("Reply to _Sender"), Gtk.ResponseType.CANCEL,
- Gtk.STOCK_CANCEL, Gtk.ResponseType.NONE);
- dialog.set_default_response (Gtk.ResponseType.NONE);
- }
- else {
- dialog = new Gtk.MessageDialog (this, 0,
- Gtk.MessageType.QUESTION, Gtk.ButtonsType.NONE,
- _("This message was sent to a mailing list."));
- dialog.format_secondary_text (_("Do you want to reply to the list?"));
- dialog.add_buttons (_("Reply to _Sender"), Gtk.ResponseType.CANCEL,
- _("Reply to _List"), Gtk.ResponseType.OK);
- dialog.set_default_response (Gtk.ResponseType.OK);
- }
-
- int response = dialog.run ();
- dialog.destroy ();
-
- if (response == Gtk.ResponseType.OK)
- return content.list_post;
- else if (response == Gtk.ResponseType.DELETE_EVENT)
- return null;
- return reply_to;
- }
-
void action_message_reply () {
- unowned string? reply = list_or_sender (content.message.reply_to
- ?? content.message.sender);
- if (reply != null)
- content.compose_message ("Re: ", reply);
+ unowned string reply = content.message.reply_to ?? content.message.sender;
+ content.compose_message ("Re: ", reply);
}
void action_message_reply_all () {
- string reply = content.message.recipients + "," + content.message.sender;
- content.compose_message ("Re: ", reply);
+ string? reply = content.list_or_all ();
+ if (reply != null)
+ content.compose_message ("Re: ", reply);
}
void action_message_forward () {
@@ -885,12 +847,6 @@ public class Postler.Bureau : Gtk.Window {
bool state = messages.selected_message != null;
actions.get_action ("MessageReply").sensitive = state;
actions.get_action ("MessageForward").sensitive = state;
- state = content.message.recipients.chr (-1, ',') != null;
- actions.get_action ("MessageReplyAll").sensitive = state;
- });
- content.notify["reply-to-all"].connect ((object, pspec) => {
- Postler.Content content = object as Postler.Content;
- bool state = content.message.recipients.chr (-1, ',') != null;
actions.get_action ("MessageReplyAll").sensitive = state;
});
content.notify["last-location"].connect ((object, pspec) => {
diff --git a/postler/postler-content.vala b/postler/postler-content.vala
index c0a934d..7517d03 100644
--- a/postler/postler-content.vala
+++ b/postler/postler-content.vala
@@ -615,8 +615,20 @@ public class Postler.Content : WebKit.WebView {
"text/html", charset, "about:blank");
}
- string selected_address () {
- return selected_account != null ? (selected_account.address ?? "") : "";
+ public string? list_or_all () {
+ if (list_post == null)
+ return message.recipients + "," + message.reply_to ?? message.sender;
+
+ if (!list_post.has_prefix ("NO "))
+ return list_post;
+
+ var dialog = new Gtk.MessageDialog (get_toplevel () as Gtk.Window, 0,
+ Gtk.MessageType.WARNING, Gtk.ButtonsType.NONE,
+ _("This message was sent to a mailing list."));
+ dialog.format_secondary_text (_("Replying is not allowed."));
+ dialog.run ();
+ dialog.destroy ();
+ return null;
}
public string? choose_from (Message the_message) {
@@ -626,6 +638,8 @@ public class Postler.Content : WebKit.WebView {
string from = Postler.Contact.address_from_string (recipient);
var accounts = new Accounts ();
foreach (var info in accounts.get_infos ()) {
+ if (info.address == null)
+ continue;
foreach (string address in info.address.split (",")) {
if (Contact.equal (from, address))
return from;
@@ -640,28 +654,32 @@ public class Postler.Content : WebKit.WebView {
public string reply_uri (Message the_message, string? prefix=null, string? recipients=null) {
string chosen_from = choose_from (the_message);
- var clipboard = get_clipboard (Gdk.SELECTION_PRIMARY);
- string? selected = null;
- if (can_copy_clipboard ())
- selected = GLib.Uri.escape_string (clipboard.wait_for_text (), "", true);
- StringBuilder mailto = new StringBuilder (recipients ?? the_message.sender);
+ StringBuilder mailto = new StringBuilder (
+ recipients ?? (the_message.reply_to ?? the_message.sender));
char delimiter = '?';
if (prefix != null) {
- mailto.append_printf ("?subject=%s%s", prefix, the_message.subject);
+ mailto.append_printf ("%csubject=%s%s",
+ delimiter,
+ GLib.Uri.escape_string (prefix, "", true),
+ GLib.Uri.escape_string (the_message.subject, "", true));
delimiter = '&';
}
- if (chosen_from != null)
+ if (chosen_from != null) {
mailto.append_printf ("%cfrom=%s", delimiter, chosen_from);
- delimiter = '&';
- mailto.append_printf ("&in-reply-to=%s", the_message.id);
- if (selected != null)
+ delimiter = '&';
+ }
+ mailto.append_printf ("%cin-reply-to=%s", delimiter, the_message.id);
+ if (can_copy_clipboard ()) {
+ var clipboard = get_clipboard (Gdk.SELECTION_PRIMARY);
+ string? selected = GLib.Uri.escape_string (clipboard.wait_for_text (), "", true);
mailto.append_printf ("&body=%s", selected);
+ }
return mailto.str;
}
public void compose_message (string? prefix=null, string? recipients=null) {
string mailto = reply_uri (message, prefix, recipients);
- Postler.App.spawn_module ("compose", mailto, prefix != null ? last_location : null);
+ Postler.App.spawn_module ("compose", mailto);
}
public async bool display (Message the_message, AccountInfo? account_info=null) {
More information about the Xfce4-commits
mailing list