Re: Show All Headers button (again)



> From: Pawel Salek <pawsa@theochem.kth.se>
> On 2002.02.07 14:12 hitched97 wrote:
>> Apparently I forgot the patch.  I hate when that happens.
> 
> Apparently balsa mangled it by wrapping lines. Can you resend it, please?
> 
> -pawel

Ok, lets try this again...

-- 
Steve Wall
diff -u -p ../balsa/src/balsa-app.c ./src/balsa-app.c
--- ../balsa/src/balsa-app.c	Wed Jan 16 17:03:58 2002
+++ ./src/balsa-app.c	Tue Feb  5 17:09:39 2002
@@ -316,6 +316,7 @@ balsa_app_init(void)
     balsa_app.browse_wrap = TRUE;
     balsa_app.browse_wrap_length = 79;
     balsa_app.shown_headers = HEADERS_SELECTED;
+    balsa_app.show_all_headers = FALSE;
     balsa_app.selected_headers = g_strdup(DEFAULT_SELECTED_HDRS);
     balsa_app.threading_type = BALSA_INDEX_THREADING_JWZ;
     balsa_app.show_mblist = TRUE;
diff -u -p ../balsa/src/balsa-app.h ./src/balsa-app.h
--- ../balsa/src/balsa-app.h	Tue Feb  5 13:49:59 2002
+++ ./src/balsa-app.h	Tue Feb  5 17:10:20 2002
@@ -263,6 +263,7 @@ extern struct BalsaApplication {
     gboolean browse_wrap;
     gint browse_wrap_length;
     ShownHeaders shown_headers;
+    gboolean show_all_headers;
     gchar *selected_headers;
     gchar *message_title_format;
     BalsaIndexThreadingType threading_type;
diff -u -p ../balsa/src/balsa-message.c ./src/balsa-message.c
--- ../balsa/src/balsa-message.c	Tue Feb  5 13:49:59 2002
+++ ./src/balsa-message.c	Tue Feb  5 17:14:13 2002
@@ -280,6 +280,7 @@ balsa_message_init(BalsaMessage * bm)
 
     bm->wrap_text = balsa_app.browse_wrap;
     bm->shown_headers = balsa_app.shown_headers;
+    bm->show_all_headers = FALSE;
 
 }
 
@@ -614,7 +615,8 @@ add_header_gchar(BalsaMessage * bm, cons
     gchar *wrapped_value;
     const gchar *msgcharset;
 
-    if (!(bm->shown_headers == HEADERS_ALL || libbalsa_find_word(header, balsa_app.selected_headers))) 
+    if (!(bm->show_all_headers || bm->shown_headers == HEADERS_ALL ||
+	  libbalsa_find_word(header, balsa_app.selected_headers)))
 	return;
 
     /* always display the label in the predefined font */
@@ -689,7 +691,8 @@ add_header_glist(BalsaMessage * bm, gcha
     if (list == NULL)
 	return;
 
-    if (!(bm->shown_headers == HEADERS_ALL || libbalsa_find_word(header, balsa_app.selected_headers))) 
+    if (!(bm->show_all_headers || bm->shown_headers == HEADERS_ALL ||
+	  libbalsa_find_word(header, balsa_app.selected_headers)))
 	return;
 
     value = libbalsa_make_string_from_list(list);
@@ -709,7 +712,7 @@ display_headers(BalsaMessage * bm)
 
     gtk_editable_delete_text(GTK_EDITABLE(bm->header_text), 0, -1);
  
-    if (bm->shown_headers == HEADERS_NONE) {
+    if (!bm->show_all_headers && bm->shown_headers == HEADERS_NONE) {
 	gtk_widget_hide(bm->header_text);
 	return;
     } else {
diff -u -p ../balsa/src/balsa-message.h ./src/balsa-message.h
--- ../balsa/src/balsa-message.h	Sun Feb  4 06:48:34 2001
+++ ./src/balsa-message.h	Tue Feb  5 17:14:29 2002
@@ -49,6 +49,7 @@ struct _BalsaMessage {
 	/* Widget to hold headers */
 	GtkWidget *header_text;
 	ShownHeaders shown_headers;
+	gboolean show_all_headers;
 
 	/* Widget to hold content */
 	GtkWidget *content;
diff -u -p ../balsa/src/main-window.c ./src/main-window.c
--- ../balsa/src/main-window.c	Tue Feb  5 13:50:00 2002
+++ ./src/main-window.c	Wed Feb  6 12:10:23 2002
@@ -108,8 +108,6 @@ static void display_new_mail_notificatio
 
 #endif
 
-static int show_all_headers_save=-1;
-
 static void balsa_window_class_init(BalsaWindowClass * klass);
 static void balsa_window_init(BalsaWindow * window);
 static void balsa_window_real_open_mbnode(BalsaWindow *window,
@@ -1453,9 +1451,6 @@ balsa_window_destroy(GtkObject * object)
 
     window = BALSA_WINDOW(object);
 
-    if(show_all_headers_save != -1)
-        balsa_app.shown_headers=show_all_headers_save;
-
     if (GTK_OBJECT_CLASS(parent_class)->destroy)
         (*GTK_OBJECT_CLASS(parent_class)->destroy) (GTK_OBJECT(object));
 
@@ -1490,7 +1481,7 @@ balsa_window_refresh(BalsaWindow * windo
     }
     if (balsa_app.alternative_layout)
 	paned = GTK_WIDGET(balsa_app.notebook)->parent->parent;
-    else    
+    else
 	paned = GTK_WIDGET(balsa_app.notebook)->parent;
     g_assert(paned != NULL);
     if (balsa_app.previewpane) {
@@ -3483,30 +3478,18 @@ show_all_headers_tool_cb(GtkWidget * wid
     btn=get_tool_widget(GTK_WIDGET(balsa_app.main_window), 0, BALSA_PIXMAP_SHOW_HEADERS);
     if(!btn)
         return;
+    bw = BALSA_WINDOW(data);
     if(GTK_TOGGLE_BUTTON(btn)->active) {
-        show_all_headers_save=balsa_app.shown_headers;
-        balsa_app.shown_headers=HEADERS_ALL;
-        bw = BALSA_WINDOW(data);
+        balsa_app.show_all_headers = TRUE;
         if (bw->preview)
             balsa_message_set_displayed_headers(BALSA_MESSAGE(bw->preview),
                                                 HEADERS_ALL);
     } else {
-        if(show_all_headers_save == -1)
-            return;
-
-        switch(show_all_headers_save) {
-        case HEADERS_NONE:
-            show_no_headers_cb(NULL, data);
-            break;
-        case HEADERS_ALL:
-            show_all_headers_cb(NULL, data);
-            break;
-        case HEADERS_SELECTED:
-        default:
-            show_selected_cb(NULL, data);
-            break;
+        balsa_app.show_all_headers = FALSE;
+        if (bw->preview) {
+            balsa_message_set_displayed_headers(BALSA_MESSAGE(bw->preview),
+                                                balsa_app.shown_headers);
         }
-        show_all_headers_save=-1;
     }
 }
 
@@ -3515,7 +3498,7 @@ reset_show_all_headers(void)
 {
     GtkWidget *btn;
 
-    show_all_headers_save=-1;
+    balsa_app.show_all_headers = FALSE;
     btn=get_tool_widget(GTK_WIDGET(balsa_app.main_window), 0,
                         BALSA_PIXMAP_SHOW_HEADERS);
     if(btn)
diff -u -p ../balsa/src/message-window.c ./src/message-window.c
--- ../balsa/src/message-window.c	Tue Feb  5 13:50:00 2002
+++ ./src/message-window.c	Wed Feb  6 08:44:32 2002
@@ -199,8 +199,8 @@ struct _MessageWindow {
     GtkWidget *bmessage;
 
     LibBalsaMessage *message;
-    int show_all_headers_save;
     int headers_shown;
+    int show_all_headers;
     GtkWidget *move_menu;
     gint transferred;
     GList *mru_list;
@@ -260,8 +260,8 @@ message_window_new(LibBalsaMessage * mes
     mw->window = gnome_app_new("balsa", title);
     g_free(title);
 
-    mw->show_all_headers_save=-1;
     mw->headers_shown=balsa_app.shown_headers;
+    mw->show_all_headers = FALSE;
 
     set_toolbar_button_callback(2, BALSA_PIXMAP_REPLY,
 				GTK_SIGNAL_FUNC(replyto_message_cb), mw);
@@ -494,7 +494,7 @@ show_no_headers_cb(GtkWidget * widget, g
 {
     MessageWindow *mw = (MessageWindow *) data;
 
-	mw->headers_shown=HEADERS_NONE;
+    mw->headers_shown=HEADERS_NONE;
 
     reset_show_all_headers(mw);
     balsa_message_set_displayed_headers(BALSA_MESSAGE(mw->bmessage),
@@ -506,7 +506,7 @@ show_selected_cb(GtkWidget * widget, gpo
 {
     MessageWindow *mw = (MessageWindow *) data;
 
-	mw->headers_shown=HEADERS_SELECTED;
+    mw->headers_shown=HEADERS_SELECTED;
 
     reset_show_all_headers(mw);
     balsa_message_set_displayed_headers(BALSA_MESSAGE(mw->bmessage),
@@ -518,7 +518,7 @@ show_all_headers_cb(GtkWidget * widget, 
 {
     MessageWindow *mw = (MessageWindow *) data;
 
-	mw->headers_shown=HEADERS_ALL;
+    mw->headers_shown=HEADERS_ALL;
 
     reset_show_all_headers(mw);
     balsa_message_set_displayed_headers(BALSA_MESSAGE(mw->bmessage),
@@ -647,27 +647,13 @@ static void show_all_headers_tool_cb(Gtk
         return;
 
     if(GTK_TOGGLE_BUTTON(btn)->active)  {
-        mw->show_all_headers_save=mw->headers_shown;
-		mw->headers_shown=HEADERS_ALL;
+        mw->show_all_headers = TRUE;
 	balsa_message_set_displayed_headers(BALSA_MESSAGE(mw->bmessage),
 					    HEADERS_ALL);
     } else {
-        if(mw->show_all_headers_save == -1)
-            return;
-
-        switch(mw->show_all_headers_save) {
-        case HEADERS_NONE:
-            show_no_headers_cb(widget, data);
-            break;
-        case HEADERS_ALL:
-            show_all_headers_cb(widget, data);
-            break;
-        case HEADERS_SELECTED:
-        default:
-            show_selected_cb(widget, data);
-            break;
-        }
-        mw->show_all_headers_save=-1;
+        mw->show_all_headers = FALSE;
+	balsa_message_set_displayed_headers(BALSA_MESSAGE(mw->bmessage),
+					    mw->headers_shown);
     }
 }
 
@@ -675,7 +661,7 @@ void reset_show_all_headers(MessageWindo
 {
     GtkWidget *btn;
 
-    mw->show_all_headers_save=-1;
+    mw->show_all_headers = FALSE;
     btn=get_tool_widget(GTK_WIDGET(mw->window), 2, 
 			BALSA_PIXMAP_SHOW_HEADERS);
     if(btn)
diff -u -p ../balsa/src/print.c ./src/print.c
--- ../balsa/src/print.c	Thu Dec 13 16:49:11 2001
+++ ./src/print.c	Wed Feb  6 08:59:39 2002
@@ -314,10 +314,10 @@ print_header_string(GList **header_list,
 {
     gchar **hdr_pair;
 
-    if (!value ||
-	balsa_app.shown_headers == HEADERS_NONE ||
-	!(balsa_app.shown_headers == HEADERS_ALL || 
-	  libbalsa_find_word(field_id, balsa_app.selected_headers)))
+    if (!value || !balsa_app.show_all_headers &&
+	(balsa_app.shown_headers == HEADERS_NONE ||
+	 !(balsa_app.shown_headers == HEADERS_ALL || 
+	  libbalsa_find_word(field_id, balsa_app.selected_headers))))
 	return;
 
     hdr_pair = g_new0(gchar *, 3);
@@ -332,10 +332,10 @@ print_header_list(GList **header_list, c
 {
     gchar **hdr_pair;
 
-    if (!values ||
-	balsa_app.shown_headers == HEADERS_NONE ||
-	!(balsa_app.shown_headers == HEADERS_ALL || 
-	  libbalsa_find_word(field_id, balsa_app.selected_headers)))
+    if (!values || !balsa_app.show_all_headers &&
+	(balsa_app.shown_headers == HEADERS_NONE ||
+	 !(balsa_app.shown_headers == HEADERS_ALL || 
+	  libbalsa_find_word(field_id, balsa_app.selected_headers))))
 	return;
 
     hdr_pair = g_new0(gchar *, 3);


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