From 68fa8a5127d44edeefbc04d859368b1498d41acb Mon Sep 17 00:00:00 2001 From: Sergio Spinatelli Date: Wed, 30 Mar 2011 23:18:14 +0200 Subject: [PATCH] Move message to Inbox when unarchiving --- postler/postler-app.vala | 1 + postler/postler-bureau.vala | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/postler/postler-app.vala b/postler/postler-app.vala index 2469061..523935b 100644 --- a/postler/postler-app.vala +++ b/postler/postler-app.vala @@ -13,6 +13,7 @@ namespace Postler { const string STOCK_ACCOUNT_NEW = "contact-new"; const string STOCK_ADDRESSBOOK = "stock_addressbook"; const string STOCK_ARCHIVE = "gnome-mime-application-x-archive"; + const string STOCK_ARCHIVE_EXTRACT = "archive-insert"; const string STOCK_ARCHIVE_INSERT = "archive-insert"; const string STOCK_EDIT_CLEAR_SYMBOLIC = "edit-clear-symbolic"; const string STOCK_EDIT_FIND_SYMBOLIC = "edit-find-symbolic"; diff --git a/postler/postler-bureau.vala b/postler/postler-bureau.vala index fee04ea..edece4b 100644 --- a/postler/postler-bureau.vala +++ b/postler/postler-bureau.vala @@ -202,7 +202,11 @@ public class Postler.Bureau : Gtk.Window { } void action_archive () { - messages.move_selected (FolderType.ARCHIVE); + string folder = Path.get_basename (folders.selected_location); + if (folder != messages.account_info.get_folder (FolderType.ARCHIVE)) + messages.move_selected (FolderType.ARCHIVE); + else + messages.move_selected (FolderType.INBOX); } void action_junk () { @@ -700,6 +704,14 @@ public class Postler.Bureau : Gtk.Window { action.stock_id = STOCK_MAIL_MARK_JUNK; action.tooltip = _("Mark message as junk"); } + action = actions.get_action ("MessageArchive"); + if (folder == folders.get_selected_account ().get_folder (FolderType.ARCHIVE)) { + action.stock_id = STOCK_ARCHIVE_EXTRACT; + action.tooltip = _("Move message back to Inbox"); + } else { + action.stock_id = STOCK_ARCHIVE_INSERT; + action.tooltip = _("Archive message"); + } action = actions.get_action ("MessageDelete"); if (folder == folders.get_selected_account ().get_folder (FolderType.TRASH)) { action.stock_id = Gtk.STOCK_UNDELETE; @@ -777,9 +789,8 @@ public class Postler.Bureau : Gtk.Window { Postler.Messages messages = object as Postler.Messages; bool state = messages.selected_location != null; actions.get_action ("MessageFlag").sensitive = state; - string folder = Path.get_basename (folders.selected_location ?? ""); actions.get_action ("MessageArchive").sensitive = state - && folder != messages.account_info.get_folder (FolderType.ARCHIVE); + && messages.account_info.get_folder (FolderType.ARCHIVE) != null; var action = actions.get_action ("MessageJunk"); action.sensitive = state && messages.account_info.get_folder (FolderType.JUNK) != null; -- 1.7.1