Show all headers button [WAS: Stability problems ?]




On 2003.02.27 12:19 Steffen Klemer wrote:
> 2) the show-all-headers button is not syncronised with the menu entry in
> View

I'm not sure what you mean by this, but I have had problems with the show all 
headers button since 1.3.x (?).  If I hit the button, then exit without 
hitting it again, the next time I restart, "All Headers" is selected in the 
View menu.  I came up with this patch, and apply it anytime I upgrade balsa.  
This is against 2.0.9.


-- 
Steve Wall
diff -u -p ../balsa-2.0.9/src/balsa-app.c ./src/balsa-app.c
--- ../balsa-2.0.9/src/balsa-app.c	Sun Feb 23 11:52:15 2003
+++ ./src/balsa-app.c	Fri Feb 28 08:56:37 2003
@@ -333,6 +333,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 = LB_MAILBOX_THREADING_JWZ;
     balsa_app.expand_tree = FALSE;
diff -u -p ../balsa-2.0.9/src/balsa-app.h ./src/balsa-app.h
--- ../balsa-2.0.9/src/balsa-app.h	Mon Feb 24 15:57:34 2003
+++ ./src/balsa-app.h	Fri Feb 28 08:56:37 2003
@@ -268,6 +268,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;
     LibBalsaMailboxThreadingType threading_type;
diff -u -p ../balsa-2.0.9/src/balsa-message.c ./src/balsa-message.c
--- ../balsa-2.0.9/src/balsa-message.c	Sun Feb 23 14:30:15 2003
+++ ./src/balsa-message.c	Fri Feb 28 08:56:38 2003
@@ -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;
 
 }
 
@@ -671,7 +672,7 @@ add_header_gchar(BalsaMessage * bm, cons
     gchar cr[] = "\n";
     gchar *line_start, *line_end;
     gchar *wrapped_value;
-    if (!(bm->shown_headers == HEADERS_ALL || 
+    if (!(bm->show_all_headers || bm->shown_headers == HEADERS_ALL || 
           libbalsa_find_word(header, balsa_app.selected_headers))) 
 	return;
 
@@ -735,7 +736,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);
@@ -757,7 +759,7 @@ display_headers(BalsaMessage * bm)
 
     gtk_text_buffer_set_text(buffer, "", 0);
  
-    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-2.0.9/src/balsa-message.h ./src/balsa-message.h
--- ../balsa-2.0.9/src/balsa-message.h	Sat Jan 25 08:04:28 2003
+++ ./src/balsa-message.h	Fri Feb 28 08:56:38 2003
@@ -50,6 +50,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-2.0.9/src/main-window.c ./src/main-window.c
--- ../balsa-2.0.9/src/main-window.c	Mon Feb 24 18:35:54 2003
+++ ./src/main-window.c	Fri Feb 28 08:56:38 2003
@@ -98,8 +98,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,
@@ -1540,9 +1538,6 @@ balsa_window_destroy(GtkObject * object)
 
     window = BALSA_WINDOW(object);
 
-    if(show_all_headers_save != -1)
-        balsa_app.shown_headers=show_all_headers_save;
-
     balsa_window_idle_remove(window);
 
     if (GTK_OBJECT_CLASS(parent_class)->destroy)
@@ -3533,31 +3528,18 @@ show_all_headers_tool_cb(GtkWidget * wid
     GtkWidget *toolbar = balsa_toolbar_get_from_gnome_app(GNOME_APP(data));
     BalsaWindow *bw;
 
+    bw = BALSA_WINDOW(data);
     if (balsa_toolbar_get_button_active(toolbar,
                                         BALSA_PIXMAP_SHOW_HEADERS)) {
-        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;
-        }
-        show_all_headers_save=-1;
+        balsa_app.show_all_headers = FALSE;
+        if (bw->preview)
+            balsa_message_set_displayed_headers(BALSA_MESSAGE(bw->preview),
+                                                balsa_app.shown_headers);
     }
 }
 
@@ -3567,7 +3549,7 @@ reset_show_all_headers(void)
     GtkWidget *toolbar =
         balsa_toolbar_get_from_gnome_app(GNOME_APP(balsa_app.main_window));
 
-    show_all_headers_save=-1;
+    balsa_app.show_all_headers = FALSE;
     balsa_toolbar_set_button_active(toolbar, BALSA_PIXMAP_SHOW_HEADERS,
                                     FALSE);
 }
diff -u -p ../balsa-2.0.9/src/message-window.c ./src/message-window.c
--- ../balsa-2.0.9/src/message-window.c	Sun Feb 23 11:42:54 2003
+++ ./src/message-window.c	Fri Feb 28 08:56:39 2003
@@ -192,8 +192,8 @@ struct _MessageWindow {
     GtkWidget *bmessage;
 
     LibBalsaMessage *message;
-    int show_all_headers_save;
     int headers_shown;
+    int show_all_headers;
 };
 
 void reset_show_all_headers(MessageWindow *mw);
@@ -373,8 +373,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;
 
     model = message_window_get_toolbar_model();
     toolbar = balsa_toolbar_new(model);
@@ -733,27 +733,13 @@ show_all_headers_tool_cb(GtkWidget * wid
 
     if (balsa_toolbar_get_button_active(toolbar,
                                         BALSA_PIXMAP_SHOW_HEADERS)) {
-        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);
     }
 }
 
@@ -762,7 +748,7 @@ void reset_show_all_headers(MessageWindo
     GtkWidget *toolbar =
         balsa_toolbar_get_from_gnome_app(GNOME_APP(mw->window));
 
-    mw->show_all_headers_save = -1;
+    mw->show_all_headers = FALSE;
     balsa_toolbar_set_button_active(toolbar, BALSA_PIXMAP_SHOW_HEADERS, FALSE);
 }
 
diff -u -p ../balsa-2.0.9/src/print.c ./src/print.c
--- ../balsa-2.0.9/src/print.c	Sun Feb  2 16:02:21 2003
+++ ./src/print.c	Fri Feb 28 08:56:39 2003
@@ -278,10 +278,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);
@@ -296,10 +296,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]