aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mail/ChangeLog7
-rw-r--r--mail/mail-folder-cache.c85
2 files changed, 52 insertions, 40 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 8b2f23e5e8..4c59922da5 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,10 @@
+2001-07-03 Peter Williams <peterw@ximian.com>
+
+ * mail-folder-cache.c (make_folder_name, make_folder_status): Split
+ make_string into these.
+ (update_idle): Use (name and status) instead of (wide and thin) for
+ the text.
+
2001-07-03 Jason Leach <jleach@ximian.com>
* folder-browser-ui.c: "Mark as Important" menu thingy here.
diff --git a/mail/mail-folder-cache.c b/mail/mail-folder-cache.c
index b2be0664aa..d6fb475813 100644
--- a/mail/mail-folder-cache.c
+++ b/mail/mail-folder-cache.c
@@ -129,54 +129,59 @@ get_folder_info (const gchar *uri)
}
static gchar *
-make_string (mail_folder_info *mfi, gboolean full)
+make_folder_name (mail_folder_info *mfi)
{
- gboolean set_one = FALSE;
GString *work;
gchar *ret;
LOCK_FOLDERS ();
- /* Build the display string */
-
work = g_string_new (mfi->name);
- if (mfi->flags == 0)
- goto done;
+ if (mfi->flags & MAIL_FIF_UNREAD_VALID && mfi->unread)
+ g_string_sprintfa (work, " (%d)", mfi->unread);
+
+ UNLOCK_FOLDERS ();
+
+ ret = work->str;
+ g_string_free (work, FALSE);
+ return ret;
+}
+
+
+static gchar *
+make_folder_status (mail_folder_info *mfi)
+{
+ gboolean set_one = FALSE;
+ GString *work;
+ gchar *ret;
+
+ LOCK_FOLDERS ();
- if (!full &&
- (!(mfi->flags & MAIL_FIF_UNREAD_VALID) ||
- mfi->unread == 0))
- goto done;
+ /* Build the display string */
- work = g_string_append (work, " (");
+ work = g_string_new ("");
- if (full) {
- if (mfi->flags & MAIL_FIF_UNREAD_VALID) {
- g_string_sprintfa (work, _("%d new"), mfi->unread);
- set_one = TRUE;
- }
+ if (mfi->flags & MAIL_FIF_UNREAD_VALID) {
+ g_string_sprintfa (work, _("%d new"), mfi->unread);
+ set_one = TRUE;
+ }
- if (mfi->flags & MAIL_FIF_HIDDEN_VALID) {
- if (set_one)
- work = g_string_append (work, _(", "));
- g_string_sprintfa (work, _("%d hidden"), mfi->hidden);
- set_one = TRUE;
- }
+ if (mfi->flags & MAIL_FIF_HIDDEN_VALID) {
+ if (set_one)
+ work = g_string_append (work, _(", "));
+ g_string_sprintfa (work, _("%d hidden"), mfi->hidden);
+ set_one = TRUE;
+ }
- if (mfi->flags & MAIL_FIF_TOTAL_VALID) {
- if (set_one)
- work = g_string_append (work, _(", "));
- g_string_sprintfa (work, _("%d total"), mfi->total);
- }
- } else {
- g_string_sprintfa (work, "%d", mfi->unread);
+ if (mfi->flags & MAIL_FIF_TOTAL_VALID) {
+ if (set_one)
+ work = g_string_append (work, _(", "));
+ g_string_sprintfa (work, _("%d total"), mfi->total);
}
- work = g_string_append (work, ")");
-
- done:
UNLOCK_FOLDERS ();
+
ret = work->str;
g_string_free (work, FALSE);
return ret;
@@ -186,7 +191,7 @@ static gboolean
update_idle (gpointer user_data)
{
mail_folder_info *mfi = (mail_folder_info *) user_data;
- gchar *wide, *thin;
+ gchar *f_name, *f_status;
gboolean bold;
gchar *uri, *path;
mfiui info;
@@ -217,8 +222,8 @@ update_idle (gpointer user_data)
/* Get the display string */
UNLOCK_FOLDERS ();
- wide = make_string (mfi, TRUE);
- thin = make_string (mfi, FALSE);
+ f_name = make_folder_name (mfi);
+ f_status = make_folder_status (mfi);
LOCK_FOLDERS ();
/* bold? */
@@ -256,7 +261,7 @@ update_idle (gpointer user_data)
CORBA_exception_init (&ev);
GNOME_Evolution_LocalStorage_updateFolder (info.ls,
path,
- thin,
+ f_name,
bold,
&ev);
if (BONOBO_EX (&ev))
@@ -268,7 +273,7 @@ update_idle (gpointer user_data)
dm("Updating via EvolutionStorage");
evolution_storage_update_folder_by_uri (info.es,
uri,
- thin,
+ f_name,
bold);
break;
case MAIL_FIUM_UNKNOWN:
@@ -286,7 +291,7 @@ update_idle (gpointer user_data)
dm("Updating via ShellView");
CORBA_exception_init (&ev);
GNOME_Evolution_ShellView_setFolderBarLabel (shell_view,
- wide,
+ f_status,
&ev);
if (BONOBO_EX (&ev))
g_warning ("Exception in folder bar label update: %s",
@@ -309,8 +314,8 @@ update_idle (gpointer user_data)
g_free (uri);
if (path)
g_free (path);
- g_free (wide);
- g_free (thin);
+ g_free (f_name);
+ g_free (f_status);
return FALSE;
}