Re: Bigpatch




Hello,

I've been following this list the past few weeks, and "bigpatch" fixed mostly all the things I was missing (of basic functions). But there was 1 thing missing.

By applying these files to "bigpatch" you get a new preference: Encoding.

With this feature you can select which charset and encoding style your mail will have.

regard,

Ragnar.
--- balsa-0.4.9.5/src/Makefile.in	Tue Apr 20 12:45:54 1999
+++ new/src/Makefile.in	Fri Jun 18 09:45:23 1999
@@ -127,7 +127,7 @@
 
 bin_PROGRAMS = balsa
 
-balsa_SOURCES =  	balsa-app.c			balsa-icons.c			balsa-index.c			balsa-init.c			balsa-mblist.c			balsa-message.c			filter-edit-callbacks.c		filter-edit-dialog.c		index-child.c			local-mailbox.c			mailbox-conf.c			main-window.c			main.c				message-window.c		pref-manager.c			save-restore.c			sendmsg-window.c		balsa-app.h			balsa-icons.h			balsa-index.h			balsa-mblist.h			balsa-init.h			balsa-message.h			filter-edit.h			index-child.h			local-mailbox.h			mailbox-conf.h			main-window.h			main.h				message-window.h		pref-manager.h			save-restore.h			sendmsg-window.h		mblist-window.c			mblist-window.h
+balsa_SOURCES = address-book.c 	balsa-app.c			balsa-icons.c			balsa-index.c			balsa-init.c			balsa-mblist.c			balsa-message.c			filter-edit-callbacks.c		filter-edit-dialog.c		index-child.c			local-mailbox.c			mailbox-conf.c			main-window.c			main.c				message-window.c		pref-manager.c			save-restore.c			sendmsg-window.c		balsa-app.h			balsa-icons.h			balsa-index.h			balsa-mblist.h			balsa-init.h			balsa-message.h			filter-edit.h			index-child.h			local-mailbox.h			mailbox-conf.h			main-window.h			main.h				message-window.h		pref-manager.h			save-restore.h			sendmsg-window.h		mblist-window.c			mblist-window.h
 
 
 INCLUDES =  	-DGNOMELOCALEDIR=\""$(datadir)/locale"\"		-I.							-I${top_srcdir}/libbalsa				-I${top_srcdir}						-I$(top_srcdir)/idl					-I$(top_builddir)/idl					-I${top_builddir}/libmutt				 $(GNOME_INCLUDEDIR)
@@ -143,7 +143,7 @@
 
 DEFS = @DEFS@ -I. -I$(srcdir) -I..
 LIBS = @LIBS@
-balsa_OBJECTS =  balsa-app.o balsa-icons.o balsa-index.o balsa-init.o \
+balsa_OBJECTS = address-book.o balsa-app.o balsa-icons.o balsa-index.o balsa-init.o \
 balsa-mblist.o balsa-message.o filter-edit-callbacks.o \
 filter-edit-dialog.o index-child.o local-mailbox.o mailbox-conf.o \
 main-window.o main.o message-window.o pref-manager.o save-restore.o \
--- balsa-0.4.9.5/src/balsa-app.c	Fri Jun 18 11:34:36 1999
+++ new/src/balsa-app.c	Fri Jun 18 09:47:45 1999
@@ -125,6 +125,12 @@
 
   /* font */
   balsa_app.message_font = NULL;
+
+   /*encoding */
+  balsa_app.encoding_style = 0;
+  balsa_app.charset = NULL;
+
+
 }
 
 gint
--- balsa-0.4.9.5/src/balsa-app.h	Fri Jun 18 11:34:36 1999
+++ new/src/balsa-app.h	Fri Jun 18 11:11:40 1999
@@ -40,6 +40,8 @@
 
 #define DEFAULT_MESSAGE_FONT "-adobe-helvetica-medium-r-normal--12-*-72-72-p-*-iso8859-1"
 
+#define DEFAULT_CHARSET "ISO-8859-1"
+#define DEFAULT_ENCODING ENC8BIT
 
 /* global balsa application structure */
 extern struct BalsaApplication
@@ -95,6 +97,12 @@
 
   /* font used to display messages */
   gchar *message_font;
+
+  /* encoding stuff */
+  gint encoding_style;
+  gchar *charset;
+
+      
 }
 balsa_app;
 
--- balsa-0.4.9.5/src/pref-manager.c	Fri Jun 18 11:34:36 1999
+++ new/src/pref-manager.c	Fri Jun 18 11:41:45 1999
@@ -25,9 +25,11 @@
 #include "mailbox-conf.h"
 #include "main-window.h"
 #include "save-restore.h"
+#include "../libmutt/mime.h"
 
 #define NUM_TOOLBAR_MODES 3
 #define NUM_MDI_MODES 4
+#define NUM_ENCODING_MODES 3
 
 typedef struct _PropertyUI
   {
@@ -49,6 +51,12 @@
 
     GtkWidget *message_font;    /* font used to display messages */ 
     GtkWidget *font_picker;
+
+      /* charset */
+    GtkRadioButton *encoding_type[NUM_ENCODING_MODES];
+    GtkWidget *charset;
+
+
   }
 PropertyUI;
 
@@ -71,11 +79,26 @@
   N_("Both"),
 };
 
+guint encoding_type[NUM_ENCODING_MODES] =
+{
+    ENC7BIT,
+    ENC8BIT,
+    ENCQUOTEDPRINTABLE
+};
+
+gchar *encoding_type_label[NUM_ENCODING_MODES] =
+{
+    N_("7bits"),
+    N_("8bits"),
+    N_("quoted")
+};
+
 /* notebook pages */
 static GtkWidget *create_identity_page (void);
 static GtkWidget *create_mailservers_page (void);
 static GtkWidget *create_display_page (void);
 static GtkWidget *create_misc_page (void);
+static GtkWidget *create_encoding_page (void);
 
 
 /* save the settings */
@@ -165,6 +188,12 @@
 			     create_misc_page (),
 			     label);
 
+  /* Misc page */
+  label = gtk_label_new (_ ("Encoding"));
+  gtk_notebook_append_page (
+		    GTK_NOTEBOOK (GNOME_PROPERTY_BOX (pui->pbox)->notebook),
+			     create_encoding_page (),
+			     label);
   set_prefs ();
   for (i = 0; i < NUM_TOOLBAR_MODES; i++)
     {
@@ -210,6 +239,17 @@
   		      GTK_SIGNAL_FUNC (font_changed),
 		      pui->pbox);
  
+  /* charset */
+  gtk_signal_connect (GTK_OBJECT (pui->charset), "changed",
+		      GTK_SIGNAL_FUNC (properties_modified_cb),
+		      pui->pbox);
+
+ for (i = 0; i < NUM_ENCODING_MODES; i++)
+    {
+      gtk_signal_connect (GTK_OBJECT (pui->encoding_type[i]), "clicked",
+			  properties_modified_cb, pui->pbox);
+    }
+
 
   /* set data and show the whole thing */
   gtk_widget_show_all (GTK_WIDGET (pui->pbox));
@@ -281,6 +321,19 @@
   balsa_app.message_font =
     g_strdup (gtk_entry_get_text (GTK_ENTRY (pui->message_font)));
 
+
+  /* charset*/
+  g_free (balsa_app.charset);
+  balsa_app.charset =
+      g_strdup (gtk_entry_get_text (GTK_ENTRY (pui->charset)));
+
+  for (i = 0; i < NUM_ENCODING_MODES; i++)
+    if (GTK_TOGGLE_BUTTON (pui->encoding_type[i])->active)
+      {
+	balsa_app.encoding_style = encoding_type[i];
+	break;
+      }
+
   refresh_main_window ();
 
   /*
@@ -326,6 +379,17 @@
   /* message font */
   gtk_entry_set_text (GTK_ENTRY (pui->message_font), balsa_app.message_font);
   gtk_entry_set_position (GTK_ENTRY (pui->message_font), 0);
+
+  /* charset */
+  gtk_entry_set_text (GTK_ENTRY (pui->charset), balsa_app.charset);
+  for (i = 0; i < NUM_ENCODING_MODES; i++)
+    if (balsa_app.encoding_style == encoding_type[i])
+      {
+	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pui->encoding_type[i]), TRUE);
+	break;
+      }
+
+
 }
 
 void
@@ -668,6 +732,64 @@
 
 
   return vbox;
+}
+
+/*
+ * encoding notepad
+ */
+static GtkWidget *
+create_encoding_page ()
+{
+   
+  GtkWidget *vbox;
+  GtkWidget *frame;
+
+  /* arp */
+  GtkWidget *vbox1;
+  GtkWidget *table;
+  GtkWidget *label;
+  GSList    *group;
+  gint      i;
+
+  vbox = gtk_vbox_new (FALSE, 5);
+  gtk_container_set_border_width (GTK_CONTAINER (vbox), 10);
+
+  // Misc 
+  frame = gtk_frame_new (_("Encoding"));
+  gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 5);
+
+  // arp 
+  vbox1 = gtk_vbox_new (FALSE, 0);
+  gtk_container_set_border_width (GTK_CONTAINER (vbox1), 5);
+  gtk_container_add (GTK_CONTAINER (frame), GTK_WIDGET (vbox1));
+
+  
+  table = gtk_table_new (1, 2, FALSE);
+
+  label = gtk_label_new (_("Charset:"));
+  gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5);
+  gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
+		    GTK_FILL, GTK_FILL, 10, 10);
+
+   pui->charset = gtk_entry_new ();
+   gtk_table_attach (GTK_TABLE (table), pui->charset, 1, 2, 0, 1,
+		    GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 10);
+
+  gtk_box_pack_start (GTK_BOX (vbox1), GTK_WIDGET (table), TRUE, TRUE, 2);
+
+  group = NULL;
+  for (i = 0; i < NUM_ENCODING_MODES; i++)
+    {
+      pui->encoding_type[i] = GTK_RADIO_BUTTON (gtk_radio_button_new_with_label (group,
+						    _(encoding_type_label[i])));
+      gtk_box_pack_start (GTK_BOX (vbox1), GTK_WIDGET (pui->encoding_type[i]), TRUE, TRUE,
+			  2);
+      group = gtk_radio_button_group (pui->encoding_type[i]);
+    }
+
+
+  return vbox;
+
 }
 
 /*
--- balsa-0.4.9.5/src/save-restore.c	Fri Jun 18 11:34:36 1999
+++ new/src/save-restore.c	Fri Jun 18 11:10:37 1999
@@ -677,15 +677,15 @@
   else
     balsa_app.mblist_width = atoi (field);
   /* FIXME this can be removed later */
-  if (balsa_app.mblist_width < 100)
-	  balsa_app.mblist_width = 170;
+  //  if (balsa_app.mblist_width < 100)
+  //	  balsa_app.mblist_width = 170;
   if ((field = pl_dict_get_str (globals, "MailboxListHeight")) == NULL)
     balsa_app.mblist_height = 170;
   else
     balsa_app.mblist_height = atoi (field);
   /* FIXME this can be removed later */
-  if (balsa_app.mblist_height < 100)
-	  balsa_app.mblist_height = 200;
+  //  if (balsa_app.mblist_height < 100)
+  //	  balsa_app.mblist_height = 200;
 
 
 
@@ -702,6 +702,18 @@
   else
     balsa_app.message_font = g_strdup (field);
 
+  /* more here */
+  g_free(balsa_app.charset);
+  if (( field = pl_dict_get_str (globals, "Charset")) == NULL)
+      balsa_app.charset = g_strdup(DEFAULT_CHARSET);
+  else
+      balsa_app.charset = g_strdup(field);
+
+  if (( field = pl_dict_get_str (globals, "EncodingStyle")) == NULL)
+      balsa_app.encoding_style = /*DEFAULT_ENCODING*/ 2;
+  else
+      balsa_app.encoding_style = atoi(field);
+
   return TRUE;
 }				/* config_global_load */
 
@@ -765,6 +777,9 @@
 
     snprintf (tmp, sizeof (tmp), "%d", balsa_app.mblist_height);
     pl_dict_add_str_str (globals, "MailboxListHeight", tmp);
+
+    snprintf (tmp, sizeof (tmp), "%d", balsa_app.encoding_style);
+    pl_dict_add_str_str (globals, "EncodingStyle", tmp);
   }
 
 
@@ -780,6 +795,11 @@
   else
     pl_dict_add_str_str (globals, "MessageFont", DEFAULT_MESSAGE_FONT);
 
+  /* encoding */
+  if (balsa_app.charset != NULL)
+      pl_dict_add_str_str(globals, "Charset", balsa_app.charset);
+  else
+      pl_dict_add_str_str(globals, "Charset", DEFAULT_CHARSET);
 
   /* Add it to configuration file */
   temp_str = PLMakeString ("Globals");
--- balsa-0.4.9.5/libbalsa/send.c	Fri Jun 18 11:34:36 1999
+++ new/libbalsa/send.c	Fri Jun 18 11:27:18 1999
@@ -71,7 +71,12 @@
   body->subtype = g_strdup ("plain");
   body->unlink = 1;
   body->use_disp = 0;
-  body->encoding = ENC7BIT;
+  
+  body->encoding = balsa_app.encoding_style;
+  body->parameter = mutt_new_parameter();
+  body->parameter->attribute = g_strdup("CHARSET");
+  body->parameter->value = g_strdup(balsa_app.charset);
+  body->parameter->next = NULL;
 
   mutt_mktemp (buffer);
   body->filename = g_strdup (buffer);


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