[evolution-patches] patch to disable the attachment bar in message view



Adds an environmental variable EVOLUTION_NO_BAR which disables it
entirely.


-- 
adfa(evolution-2.4:20087): gtkhtml-WARNING **: cannot find icon:
'stock_insert-url' in gnome 
Index: mail/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/mail/ChangeLog,v
retrieving revision 1.3699
diff -u -p -r1.3699 ChangeLog
--- mail/ChangeLog	18 Aug 2005 04:36:34 -0000	1.3699
+++ mail/ChangeLog	18 Aug 2005 07:43:03 -0000
@@ -1,3 +1,9 @@
+2005-08-18  Not Zed  <NotZed Ximian com>
+
+	* em-format-html-display.c (efhd_message_add_bar): dont add
+	attachment bar if it is disabled.
+	(efhd_attachment_button): dont add attachments if there is no bar.
+
 2005-08-16  Not Zed  <NotZed Ximian com>
 
 	** See #312668.
Index: mail/em-format-html-display.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/em-format-html-display.c,v
retrieving revision 1.74
diff -u -p -r1.74 em-format-html-display.c
--- mail/em-format-html-display.c	17 Aug 2005 13:25:50 -0000	1.74
+++ mail/em-format-html-display.c	18 Aug 2005 07:43:04 -0000
@@ -276,6 +276,8 @@ efhd_init(GObject *o)
 	efh->text_html_flags |= CAMEL_MIME_FILTER_TOHTML_CONVERT_URLS | CAMEL_MIME_FILTER_TOHTML_CONVERT_ADDRESSES;
 #undef efh
 
+	efhd->nobar = getenv("EVOLUTION_NO_BAR") != NULL;
+
 	efhd->priv->show_bar = FALSE;
 	efhd->priv->files = NULL;
 }
@@ -1431,45 +1433,47 @@ efhd_attachment_button(EMFormatHTML *efh
 	g_assert(info != NULL);
 	g_assert(info->forward == NULL);
 
-	file = camel_mime_part_get_filename(info->puri.part);
+	if (efhd->priv->attachment_bar) {
+		file = camel_mime_part_get_filename(info->puri.part);
 
-	new = e_attachment_new_from_mime_part (info->puri.part);
+		new = e_attachment_new_from_mime_part (info->puri.part);
 
-	if (!file) {
-		file = "attachment.dat";
-		new->file_name = g_strdup(file);
-	}
+		if (!file) {
+			file = "attachment.dat";
+			new->file_name = g_strdup(file);
+		}
 
-	tmp = g_hash_table_lookup (efhd->priv->files, file);
-	if (tmp) {
-		guint count = GPOINTER_TO_UINT(tmp);
-		char *ext;
-		char *tmp_file = g_strdup (file);
+		tmp = g_hash_table_lookup (efhd->priv->files, file);
+		if (tmp) {
+			guint count = GPOINTER_TO_UINT(tmp);
+			char *ext;
+			char *tmp_file = g_strdup (file);
 		
-		if ((ext = strrchr(tmp_file, '.'))) {
-			ext[0] = 0;
-			new_file = g_strdup_printf("%s(%d).%s", tmp_file, count++, ext+1);
+			if ((ext = strrchr(tmp_file, '.'))) {
+				ext[0] = 0;
+				new_file = g_strdup_printf("%s(%d).%s", tmp_file, count++, ext+1);
+			} else {
+				new_file = g_strdup_printf("%s(%d)", tmp_file, count++);
+			}
+
+			g_free (tmp_file);
+			g_hash_table_insert (efhd->priv->files, g_strdup(file), GUINT_TO_POINTER(count));
+			g_free (new->file_name);
+			new->file_name = new_file;
 		} else {
-			new_file = g_strdup_printf("%s(%d)", tmp_file, count++);
+			g_hash_table_insert (efhd->priv->files, g_strdup(file), GUINT_TO_POINTER(1));
 		}
 
-		g_free (tmp_file);
-		g_hash_table_insert (efhd->priv->files, g_strdup(file), GUINT_TO_POINTER(count));
-		g_free (new->file_name);
-		new->file_name = new_file;
-	} else {
-		g_hash_table_insert (efhd->priv->files, g_strdup(file), GUINT_TO_POINTER(1));
-	}
-
-	/* Store the status of encryption / signature on the attachment for emblem display 
-	 * FIXME: May not work well always
-	 */
-	new->sign = info->sign;
-	new->encrypt = info->encrypt;
+		/* Store the status of encryption / signature on the attachment for emblem display 
+		 * FIXME: May not work well always
+		 */
+		new->sign = info->sign;
+		new->encrypt = info->encrypt;
 	
-	/* Add the attachment to the bar.*/
-	e_attachment_bar_add_attachment (E_ATTACHMENT_BAR(efhd->priv->attachment_bar), new);
-	efhd_attachment_bar_refresh (efhd);
+		/* Add the attachment to the bar.*/
+		e_attachment_bar_add_attachment(E_ATTACHMENT_BAR(efhd->priv->attachment_bar), new);
+		efhd_attachment_bar_refresh(efhd);
+	}
 	
 	mainbox = gtk_hbox_new(FALSE, 0);
 
@@ -1984,7 +1988,7 @@ efhd_message_add_bar(EMFormat *emf, Came
 	EMFormatHTMLDisplay *efhd = (EMFormatHTMLDisplay *) emf;
 	const char *classid = "attachment-bar";
 
-	if (efhd->priv->files)
+	if (efhd->nobar || efhd->priv->files)
 		return;
 
 	efhd->priv->files = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
Index: mail/em-format-html-display.h
===================================================================
RCS file: /cvs/gnome/evolution/mail/em-format-html-display.h,v
retrieving revision 1.5
diff -u -p -r1.5 em-format-html-display.h
--- mail/em-format-html-display.h	16 May 2005 07:53:53 -0000	1.5
+++ mail/em-format-html-display.h	18 Aug 2005 07:43:04 -0000
@@ -22,6 +22,7 @@ struct _EMFormatHTMLDisplay {
 
 	unsigned int animate:1;
 	unsigned int caret_mode:1;
+	unsigned int nobar:1;
 };
 
 #define EM_FORMAT_HTML_DISPLAY_SEARCH_PRIMARY (0)


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