[Xfce4-commits] <postler:master> Determine part numbers before display
Christian Dywan
noreply at xfce.org
Thu Feb 3 00:34:08 CET 2011
Updating branch refs/heads/master
to 317b4fb94f4ddf7d53cea0f41e7827923f3fceea (commit)
from f945633a80e314a5681364dfd22bbb70fbac7928 (commit)
commit 317b4fb94f4ddf7d53cea0f41e7827923f3fceea
Author: Christian Dywan <christian at twotoasts.de>
Date: Tue Feb 1 23:51:54 2011 +0100
Determine part numbers before display
Otherwise merging of parts results in wrong indices.
postler/postler-bureau.vala | 6 +++---
postler/postler-content.vala | 15 ++++-----------
2 files changed, 7 insertions(+), 14 deletions(-)
diff --git a/postler/postler-bureau.vala b/postler/postler-bureau.vala
index 1dc7f3c..eef6e5f 100644
--- a/postler/postler-bureau.vala
+++ b/postler/postler-bureau.vala
@@ -159,17 +159,17 @@ public class Postler.Bureau : Gtk.Window {
void action_message_reply () {
unowned string? reply = list_or_sender (content.reply_to);
if (reply != null)
- compose_message ("Re: ", reply, content.current_part.partnum);
+ compose_message ("Re: ", reply, content.current_part_index);
}
void action_message_reply_all () {
unowned string? reply = content.reply_to_all;
if (reply != null)
- compose_message ("Re: ", reply, content.current_part.partnum);
+ compose_message ("Re: ", reply, content.current_part_index);
}
void action_message_forward () {
- compose_message ("Fw: ", null, content.current_part.partnum);
+ compose_message ("Fw: ", null, content.current_part_index);
}
void action_message_unread () {
diff --git a/postler/postler-content.vala b/postler/postler-content.vala
index 0763de3..f933aac 100644
--- a/postler/postler-content.vala
+++ b/postler/postler-content.vala
@@ -16,7 +16,6 @@ public class Postler.MessagePart : Object {
public bool plain_text;
public string? content_disposition;
public string? filename;
- public int partnum { get; set; default = 0; }
public MessagePart (string mime_type) {
body = new StringBuilder ();
this.mime_type = mime_type;
@@ -99,6 +98,7 @@ public class Postler.Content : WebKit.WebView {
public unowned List<MessagePart> message_parts { public get; set; }
public MessagePart? current_part { get; private set; }
+ public int current_part_index { get; private set; }
public MessagePart? html_part { get; private set; }
public MessagePart? text_part { get; private set; }
@@ -775,7 +775,6 @@ public class Postler.Content : WebKit.WebView {
throw new GLib.FileError.FAILED (_("Failed to read message: %s").
printf (contents_error.message));
}
- number_messageparts ();
notify_property ("message-parts");
}
@@ -947,14 +946,6 @@ public class Postler.Content : WebKit.WebView {
}
}
- void number_messageparts () {
- int i = 0;
- foreach (var part in message_parts) {
- part.partnum = i;
- i++;
- }
- }
-
public bool display (string location, AccountInfo? account_info=null) {
selected_account = account_info;
try {
@@ -1003,8 +994,10 @@ public class Postler.Content : WebKit.WebView {
}
public void display_part (MessagePart message_part) {
- if (current_part != message_part)
+ if (current_part != message_part) {
current_part = message_part;
+ current_part_index = message_parts.index (message_part);
+ }
string body_chunk;
if (message_part == html_part)
More information about the Xfce4-commits
mailing list