[evolution-patches] [PATCH 08/22] BUGFIX: GNOME Bugzilla #596051 - Make it easier to differentiate tabs.



From: Srinivasa Ragavan <sragavan gnome org>


Signed-off-by: Yan Li <yanli infradead org>
---
 src/mail-folder-view.c |   32 ++++++++++++++++++++++++--------
 1 files changed, 24 insertions(+), 8 deletions(-)

diff --git a/src/mail-folder-view.c b/src/mail-folder-view.c
index 31f7287..1cb6df9 100644
--- a/src/mail-folder-view.c
+++ b/src/mail-folder-view.c
@@ -216,14 +216,23 @@ mfv_close (GtkButton *w, MailFolderView *mfv)
 }
 
 static char *
-mfv_folder_name (char *name)
+mfv_folder_name (CamelStore *store, char *name, char *uri)
 {
+	char *new_name;
+
 	if (strcmp(name, CAMEL_VTRASH_NAME) == 0)
-		return _("Trash");
+		name = _("Trash");
 	else if (strcmp (name, CAMEL_VJUNK_NAME) == 0)
-		return _("Junk");
+		name = _("Junk");
 
-	return name;
+	if (uri && strncmp (uri, "mbox", 4) == 0) {
+		new_name = g_strdup_printf ("%s %s '%s'", name, _("on"), _("On This Computer"));
+	} else {
+		char *tmpstr = camel_service_get_name((CamelService *)store, TRUE);
+		new_name = g_strdup_printf ("%s %s '%s'", name, _("on"), tmpstr);
+		g_free(tmpstr);
+	}
+	return new_name;
 }
 
 static void
@@ -486,12 +495,15 @@ mfv_folder_renamed (CamelStore *store, void *event, void *data)
 	MailFolderView *mfv = (MailFolderView *)data;
 	CamelRenameInfo *info = (CamelRenameInfo *)event;
 	if (g_strcmp0(info->old_base, mfv->priv->folder_name) == 0){
+		char *tmpstr;
 		/* Folder renamed. Revamp the uri.*/
 		g_free(mfv->uri);
 		g_free(mfv->priv->folder_name);
 		mfv->uri = g_strdup(info->new->uri);
 		mfv->priv->folder_name = g_strdup (info->new->full_name);
-		gtk_label_set_text ((GtkLabel *)mfv->priv->tab_str, mfv_folder_name(info->new->full_name));
+		tmpstr = mfv_folder_name(store, info->new->full_name, mfv->uri);
+		gtk_label_set_text ((GtkLabel *)mfv->priv->tab_str, tmpstr);
+		g_free(tmpstr);
 	}
 }
 
@@ -517,7 +529,8 @@ mail_folder_view_set_folder (MailFolderView *mfv, CamelFolder *folder, const cha
 		double pos = 0;
 		GtkTreeIter iter;
 		gboolean outgoing = FALSE;
-		
+		char *tmp_tabstr;
+
 	        if (em_utils_folder_is_drafts(folder, uri)
 			|| em_utils_folder_is_sent(folder, uri)
 			|| em_utils_folder_is_outbox(folder, uri))
@@ -546,7 +559,10 @@ mail_folder_view_set_folder (MailFolderView *mfv, CamelFolder *folder, const cha
 		if (spos && *spos) {
 			pos = strtod(spos, NULL);
 		}
-		gtk_label_set_text ((GtkLabel *)mfv->priv->tab_str, mfv_folder_name(folder->full_name));
+		tmp_tabstr = mfv_folder_name(folder->parent_store, folder->full_name, mfv->uri);
+		gtk_label_set_text ((GtkLabel *)mfv->priv->tab_str, tmp_tabstr);
+		g_free (tmp_tabstr);
+
 		gtk_adjustment_set_value(gtk_scrolled_window_get_vadjustment ((GtkScrolledWindow *)mfv->priv->view_scroller), pos);
 		if (last_sel_uid && *last_sel_uid) {
 			 GtkTreeSelection *sel = gtk_tree_view_get_selection (mfv->tree);
-- 
1.6.5.7



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