[Xfce4-commits] <postler:master> Update Junk and Delete icons depending on selected folder

Christian Dywan noreply at xfce.org
Thu Mar 10 04:24:05 CET 2011


Updating branch refs/heads/master
         to 846bf65aac5a5d13a702846a4889bdce82a1775d (commit)
       from 71ef7c8514b3c53366d8f654fb0b1fe4bae97fc1 (commit)

commit 846bf65aac5a5d13a702846a4889bdce82a1775d
Author: Sergio Spinatelli <spinatelli.sergio at gmail.com>
Date:   Mon Mar 7 21:10:31 2011 +0100

    Update Junk and Delete icons depending on selected folder

 postler/postler-bureau.vala |   33 +++++++++++++++++----------------
 1 files changed, 17 insertions(+), 16 deletions(-)

diff --git a/postler/postler-bureau.vala b/postler/postler-bureau.vala
index 07e6bea..b169e2e 100644
--- a/postler/postler-bureau.vala
+++ b/postler/postler-bureau.vala
@@ -653,6 +653,23 @@ public class Postler.Bureau : Gtk.Window {
         folders.set_size_request (100, 100);
         search.sensitive = false;
         folders.notify["selected-location"].connect ((object, pspec) => {
+            string folder = Path.get_basename (folders.selected_location ?? "");
+            var action = actions.get_action ("MessageJunk");
+            if (folder == folders.get_selected_account ().get_folder (FolderType.JUNK)) {
+                action.stock_id = STOCK_MAIL_MARK_NOT_JUNK;
+                action.tooltip = _("Mark message as not junk");
+            } else {
+                action.stock_id = STOCK_MAIL_MARK_JUNK;
+                action.tooltip = _("Mark message as junk");
+            }
+            action = actions.get_action ("MessageDelete");
+            if (folder == folders.get_selected_account ().get_folder (FolderType.TRASH)) {
+                action.stock_id = Gtk.STOCK_UNDELETE;
+                action.tooltip = _("Restore message");
+            } else {
+                action.stock_id = Gtk.STOCK_DELETE;
+                action.tooltip = _("Delete message");
+            }
             search.sensitive = folders.selected_location != null;
             if (search_options.visible)
                 GLib.Idle.add (() => {
@@ -734,24 +751,8 @@ public class Postler.Bureau : Gtk.Window {
             var action = actions.get_action ("MessageJunk");
             action.sensitive = state
                 && messages.account_info.get_folder (FolderType.JUNK) != null;
-            if (state &&
-                folder != messages.account_info.get_folder (FolderType.JUNK)) {
-                action.stock_id = STOCK_MAIL_MARK_JUNK;
-                action.tooltip = _("Mark message as junk");
-            } else if (state) {
-                action.stock_id = STOCK_MAIL_MARK_NOT_JUNK;
-                action.tooltip = _("Mark message as not junk");
-            }
             action = actions.get_action ("MessageDelete");
             action.sensitive = state && messages.account_info.can_delete ();
-            if (state &&
-                folder != messages.account_info.get_folder (FolderType.TRASH)) {
-                action.stock_id = Gtk.STOCK_DELETE;
-                action.tooltip = _("Delete message");
-            } else if (state) {
-                action.stock_id = Gtk.STOCK_UNDELETE;
-                action.tooltip = _("Restore message");
-            }
         });
         scrolled = new Postler.ScrolledWindow (messages);
         messages_box.pack_end (scrolled, true, true, 0);



More information about the Xfce4-commits mailing list