[Xfce4-commits] <postler:master> Implement message moving in Message.move()
Christian Dywan
noreply at xfce.org
Sat Jun 4 14:30:11 CEST 2011
Updating branch refs/heads/master
to 70385220636313718daf91edf852daddb8f1ac26 (commit)
from ef85546fc0daf33d7acc6acbdcedb0367ebdf2c4 (commit)
commit 70385220636313718daf91edf852daddb8f1ac26
Author: Christian Dywan <christian at twotoasts.de>
Date: Sat Jun 4 14:27:00 2011 +0200
Implement message moving in Message.move()
postler/postler-message.vala | 13 +++++++++++++
postler/postler-messages.vala | 12 ++----------
2 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/postler/postler-message.vala b/postler/postler-message.vala
index 2d1c593..e2e9aab 100644
--- a/postler/postler-message.vala
+++ b/postler/postler-message.vala
@@ -135,6 +135,19 @@ namespace Postler {
}
}
+ public void move (string? destination) throws GLib.Error {
+ var file = File.new_for_uri (uri);
+ if (destination == null) {
+ file.delete ();
+ return;
+ }
+
+ string new_location = Postler.Messages.update_filename (
+ file.get_path (), destination + "/cur/");
+ var destination_file = File.new_for_path (new_location);
+ file.move (destination_file, GLib.FileCopyFlags.NONE);
+ }
+
public Message.from_file (GLib.File file,
GLib.Cancellable? cancellable = null) throws GLib.Error {
diff --git a/postler/postler-messages.vala b/postler/postler-messages.vala
index 7039422..aee94e1 100644
--- a/postler/postler-messages.vala
+++ b/postler/postler-messages.vala
@@ -755,14 +755,10 @@ public class Postler.Messages : Gtk.TreeView {
if (model.get_iter (out iter, path)) {
Message message;
model.get (iter, Columns.MESSAGE, out message);
- var file = File.new_for_path (message.get_path ());
try {
- if (destination_path == null)
- file.delete (null);
- else {
if (account_info.type == AccountType.SEARCH) {
/* Look for the account belonging to the message */
- string location = file.get_path ();
+ string location = message.get_path ();
string inbox_folder = location.substring (0,
location.pointer_to_offset (location.rstr ("/")));
return_if_fail (inbox_folder.has_suffix ("/INBOX/new")
@@ -780,11 +776,7 @@ public class Postler.Messages : Gtk.TreeView {
return_if_fail (destination_path != null);
}
- string new_location = update_filename (location,
- destination_path + "/cur/");
- var destination_file = File.new_for_path (new_location);
- file.move (destination_file, GLib.FileCopyFlags.NONE);
- }
+ message.move (destination_path);
/* Move to next, more recent message row */
Gtk.TreePath next_path = model.get_path (iter);
More information about the Xfce4-commits
mailing list