[evolution] Bug 745534 - Show only unread count in application's window title



commit c924b16f964f44515eccc2ccd9dec8e003e910c9
Author: Milan Crha <mcrha redhat com>
Date:   Tue Apr 7 12:35:20 2015 +0200

    Bug 745534 - Show only unread count in application's window title

 modules/mail/e-mail-shell-view-private.c |   18 +++++++++++++++---
 1 files changed, 15 insertions(+), 3 deletions(-)
---
diff --git a/modules/mail/e-mail-shell-view-private.c b/modules/mail/e-mail-shell-view-private.c
index a54e3af..00f6b4a 100644
--- a/modules/mail/e-mail-shell-view-private.c
+++ b/modules/mail/e-mail-shell-view-private.c
@@ -919,7 +919,7 @@ e_mail_shell_view_update_sidebar (EMailShellView *mail_shell_view)
        MailFolderCache *folder_cache;
        MessageList *message_list;
        guint selected_count;
-       GString *buffer;
+       GString *buffer, *title_short = NULL;
        gboolean store_is_local, is_inbox;
        const gchar *display_name;
        const gchar *folder_name;
@@ -1053,10 +1053,17 @@ e_mail_shell_view_update_sidebar (EMailShellView *mail_shell_view)
                                num_deleted - num_junked +
                                num_junked_not_deleted;
 
-               if (num_unread > 0 && selected_count <= 1)
+               if (num_unread > 0 && selected_count <= 1) {
                        g_string_append_printf (
                                buffer, ngettext ("%d unread, ",
                                "%d unread, ", num_unread), num_unread);
+
+                       title_short = g_string_sized_new (64);
+                       g_string_append_printf (
+                               title_short, ngettext ("%d unread",
+                               "%d unread", num_unread), num_unread);
+               }
+
                g_string_append_printf (
                        buffer, ngettext ("%d total", "%d total",
                        num_visible), num_visible);
@@ -1084,12 +1091,17 @@ e_mail_shell_view_update_sidebar (EMailShellView *mail_shell_view)
        if (strcmp (folder_name, "INBOX") == 0)
                display_name = _("Inbox");
 
-       title = g_strdup_printf ("%s (%s)", display_name, buffer->str);
+       if (title_short && title_short->len > 0)
+               title = g_strdup_printf ("%s (%s)", display_name, title_short->str);
+       else
+               title = g_strdup (display_name);
        e_shell_sidebar_set_secondary_text (shell_sidebar, buffer->str);
        e_shell_view_set_title (shell_view, title);
        g_free (title);
 
        g_string_free (buffer, TRUE);
+       if (title_short)
+               g_string_free (title_short, TRUE);
 
        g_clear_object (&folder);
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]