[PATCH] identities




I've attached three small patches :

1/ mblist-remaining-part.patch : This patch simply change the mblist
scrollbar, in context menu, to be automatic. There's no reason to display a
scrollbar all the time.

2/ identity.patch : This patch add a ident entry in the sendmsg structure
and use it to store the identity choosen by the user. Then insert_identity
use it (CTRL-Z insert the correct signature). This patch will allow to
replace the signature when the user change his identity.

3/ cleanup-signature.patch : this patch remove the old
balsa-app.signature_patch which is no more needed. BTW We can remove other,
now identity managed, variables. 

Christophe

-- 
Christophe Barbé <christophe.barbe@online.fr>
GnuPG FingerPrint: E0F6 FADF 2A5C F072 6AF8  F67A 8F45 2F1E D72C B41E
diff -u -b -B -r balsa/src/balsa-index.c balsa/src/balsa-index.c
--- balsa/src/balsa-index.c	Fri Jul  6 22:06:43 2001
+++ balsa/src/balsa-index.c	Tue Jul 10 21:01:28 2001
@@ -1901,7 +1901,7 @@
 
     scroll = gtk_scrolled_window_new (NULL, NULL);
     gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(scroll), 
-                                    GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
+                                    GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
 
     bmbl = balsa_mblist_new();
     gtk_signal_connect(GTK_OBJECT(bmbl), "tree_select_row",
diff -u -b -B -r balsa/src/balsa-app.c balsa/src/balsa-app.c
--- balsa/src/balsa-app.c	Tue Jul 10 00:01:45 2001
+++ balsa/src/balsa-app.c	Tue Jul 10 22:27:59 2001
@@ -200,7 +200,6 @@
 /*     balsa_app.replyto = NULL; */
 /*     balsa_app.domain = NULL; */
 /*     balsa_app.bcc = NULL; */
-/*     balsa_app.signature_path = NULL; */
 /*     balsa_app.sig_separator = TRUE; */
 
     balsa_app.local_mail_directory = NULL;
diff -u -b -B -r balsa/src/balsa-identity.c balsa/src/balsa-identity.c
--- balsa/src/balsa-identity.c	Fri Jul  6 22:06:43 2001
+++ balsa/src/balsa-identity.c	Tue Jul 10 22:30:04 2001
@@ -226,7 +226,6 @@
     balsa_app.reply_string = ident->reply_string;
     balsa_app.forward_string = ident->forward_string;
 
-    balsa_app.signature_path = ident->signature_path;
     balsa_app.sig_sending = ident->sig_sending;
     balsa_app.sig_whenforward = ident->sig_whenforward;
     balsa_app.sig_whenreply = ident->sig_whenreply;
@@ -331,9 +330,6 @@
     
     g_free(ident->signature_path);
     ident->signature_path = g_strdup(path);
-    
-    if (ident == balsa_app.current_ident)
-        balsa_app.signature_path = ident->signature_path;
 }
 
 
diff -u -b -B -r balsa/src/sendmsg-window.c balsa/src/sendmsg-window.c
--- balsa/src/sendmsg-window.c	Tue Jul 10 19:24:58 2001
+++ balsa/src/sendmsg-window.c	Tue Jul 10 22:23:24 2001
@@ -75,7 +75,7 @@
 
 #define GNOME_MIME_BUG_WORKAROUND 1
 
-static gchar *read_signature(void);
+static gchar *read_signature(BalsaSendmsg *msg);
 static gint include_file_cb(GtkWidget *, BalsaSendmsg *);
 static gint send_message_cb(GtkWidget *, BalsaSendmsg *);
 static gint queue_message_cb(GtkWidget *, BalsaSendmsg *);
@@ -640,6 +640,7 @@
      * the signature if path changed */
 
     /* update the current messages identity */
+	msg->ident=ident;
 }
 
 
@@ -1287,7 +1288,7 @@
     else
 	body = g_string_new("");
 
-    if ((signature = read_signature()) != NULL) {
+    if ((signature = read_signature(msg)) != NULL) {
 	if (((type == SEND_REPLY || type == SEND_REPLY_ALL || type == SEND_REPLY_GROUP) &&
 	     balsa_app.sig_whenreply) ||
 	    ((type == SEND_FORWARD) && balsa_app.sig_whenforward) ||
@@ -1323,7 +1324,7 @@
 	gchar *signature;
 	gint pos=gtk_editable_get_position(GTK_EDITABLE(msg->text));
 	
-	if ((signature = read_signature()) != NULL) {
+	if ((signature = read_signature(msg)) != NULL) {
 	    if (balsa_app.sig_separator
 		&& g_strncasecmp(signature, "--\n", 3)
 		&& g_strncasecmp(signature, "-- \n", 4)) {
@@ -1356,6 +1357,7 @@
     msg->font     = NULL;
     msg->charset  = NULL;
     msg->locale   = NULL;
+    msg->ident = balsa_app.current_ident;
     msg->update_config = FALSE;
 
     switch (type) {
@@ -1677,17 +1679,17 @@
 }
 
 static gchar *
-read_signature(void)
+read_signature(BalsaSendmsg *msg)
 {
     FILE *fp;
     size_t len;
     gint siglen;
     gchar *ret, *p, *sigpath;
 
-    if (balsa_app.signature_path == NULL)
+	 if (msg->ident->signature_path == NULL)
 	return NULL;
 
-    for (p = balsa_app.signature_path; *p != '|' && *p != '\0'; p++);
+    for (p = msg->ident->signature_path; *p != '|' && *p != '\0'; p++);
     /* Signature is a path to a program */
     if (*p == '|') {
 	p++;
@@ -1706,7 +1708,7 @@
     }
     /* Signature is just a regular file. */
     else {
-	if (!(fp = fopen(balsa_app.signature_path, "r")))
+	if (!(fp = fopen(msg->ident->signature_path, "r")))
 	    return NULL;
 	len = libbalsa_readfile_nostat(fp, &ret);
 	fclose(fp);
diff -u -b -B -r balsa/src/sendmsg-window.h balsa/src/sendmsg-window.h
--- balsa/src/sendmsg-window.h	Fri Jul  6 22:06:43 2001
+++ balsa/src/sendmsg-window.h	Tue Jul 10 21:46:43 2001
@@ -55,7 +55,8 @@
 	const gchar *charset;
 	const gchar *locale;
 	GtkWidget *current_language_menu;
-
+	/* identity related data */
+	BalsaIdentity* ident;
 	/* widgets to be disabled when the address is incorrect */
 	GtkWidget *ready_widgets[3];
 	GtkWidget *view_checkitems[VIEW_MENU_LENGTH];


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