[Xfce4-commits] <postler:master> Reflect current folder in window title

Christian Dywan noreply at xfce.org
Thu Apr 7 01:36:01 CEST 2011


Updating branch refs/heads/master
         to 30b0c0d2423e26f8183a90cce524047c8816a7fe (commit)
       from d3f893f76799152f9203f899392a927cab5cd881 (commit)

commit 30b0c0d2423e26f8183a90cce524047c8816a7fe
Author: Christian Dywan <christian at twotoasts.de>
Date:   Thu Apr 7 01:25:04 2011 +0200

    Reflect current folder in window title

 postler/postler-bureau.vala |   28 +++++++++++++++++++++-------
 1 files changed, 21 insertions(+), 7 deletions(-)

diff --git a/postler/postler-bureau.vala b/postler/postler-bureau.vala
index 3153f8e..59774cd 100644
--- a/postler/postler-bureau.vala
+++ b/postler/postler-bureau.vala
@@ -718,19 +718,33 @@ public class Postler.Bureau : Gtk.Window {
         folders.set_size_request (100, 100);
         search.sensitive = false;
         folders.notify["selected-location"].connect ((object, pspec) => {
-            search.sensitive = folders.selected_location != null;
+            string? selected_location = folders.selected_location;
+            var account_info = folders.get_selected_account ();
+            string folder_name = Path.get_basename (selected_location ?? "");
+
+            if (selected_location != null) {
+                if (folder_name == "INBOX")
+                    title = _("%s - Postler").printf (account_info.display_name);
+                else {
+                    unowned MailFolder folder = account_info.get_localized_folder (folder_name);
+                    title = _("%s - Postler").printf (_(folder.label)
+                        ?? Postler.Folders.decode_foldername (folder_name));
+                }
+            }
+            else
+                title = Environment.get_application_name ();
+            search.sensitive = selected_location != null;
             if (search_options.visible)
                 GLib.Idle.add (() => {
                     search.activate ();
                     return false;
                 });
 
-            if (folders.get_selected_account () == null)
+            if (account_info == null)
                 return;
 
-            string folder = Path.get_basename (folders.selected_location ?? "");
             var action = actions.get_action ("MessageJunk");
-            if (folder == folders.get_selected_account ().get_folder (FolderType.JUNK)) {
+            if (folder_name == account_info.get_folder (FolderType.JUNK)) {
                 action.stock_id = STOCK_MAIL_MARK_NOT_JUNK;
                 action.tooltip = _("Mark message as not junk");
             } else {
@@ -738,7 +752,7 @@ public class Postler.Bureau : Gtk.Window {
                 action.tooltip = _("Mark message as junk");
             }
             action = actions.get_action ("MessageArchive");
-            if (folder == folders.get_selected_account ().get_folder (FolderType.ARCHIVE)) {
+            if (folder_name == account_info.get_folder (FolderType.ARCHIVE)) {
                 action.stock_id = STOCK_ARCHIVE_UNDO;
                 action.tooltip = _("Move message back to Inbox");
             } else {
@@ -746,8 +760,8 @@ public class Postler.Bureau : Gtk.Window {
                 action.tooltip = _("Archive message");
             }
             action = actions.get_action ("MessageDelete");
-            if (folder == folders.get_selected_account ().get_folder (FolderType.TRASH))
-                show_trash_action_infobar (folders.get_selected_account ());
+            if (folder_name == account_info.get_folder (FolderType.TRASH))
+                show_trash_action_infobar (account_info);
             else if (trash_action_infobar != null)
                 trash_action_infobar.hide ();
         });



More information about the Xfce4-commits mailing list